This commit was manufactured by cvs2svn to create tag 'v20021015'.
Sprout from master 2002-10-16 00:47:12 UTC kradloff <kradloff> 'Fixes working set test failures'
Cherrypick from master 2002-10-11 13:47:41 UTC Tod Creasey <tod> 'Added v20021014 notes':
bundles/org.eclipse.ui/buildnotes_workbench.html
Delete:
bundles/org.eclipse.jface/.classpath
bundles/org.eclipse.jface/.cvsignore
bundles/org.eclipse.jface/.project
bundles/org.eclipse.jface/build.properties
bundles/org.eclipse.jface/plugin.properties
bundles/org.eclipse.jface/plugin.xml
bundles/org.eclipse.jface/scripts/exportplugin.xml
bundles/org.eclipse.jface/src/org/eclipse/jface/action/AbstractGroupMarker.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/ActionContributionItem.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionItem.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionManager.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/ControlContribution.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/GroupMarker.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/IAction.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionItem.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManager.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManagerOverrides.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuCreator.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuListener.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuManager.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/IToolBarManager.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/Separator.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionItem.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionManager.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubMenuManager.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubToolBarManager.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarManager.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/images/stop.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/action/package.html
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ControlEnableState.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogPage.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogConstants.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogPage.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogSettings.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IInputValidator.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IMessageProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IconAndMessageDialog.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/InputDialog.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/MessageDialog.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ProgressIndicator.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/TitleAreaDialog.java
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/error.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/inform.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/message_error.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/message_info.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/message_warning.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/question.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/title_banner.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/warning.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/package.html
bundles/org.eclipse.jface/src/org/eclipse/jface/images/preference.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/images/wizard.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/messages.properties
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/BooleanFieldEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ColorFieldEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ColorSelector.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/DirectoryFieldEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditorPreferencePage.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FileFieldEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FontFieldEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferenceNode.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferencePage.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferencePageContainer.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferenceStore.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IntegerFieldEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/JFacePreferences.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ListEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PathEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceConverter.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceManager.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceNode.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferencePage.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceStore.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/RadioGroupFieldEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/StringButtonFieldEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/StringFieldEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/images/pref_dialog_title.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/package.html
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/CompositeImageDescriptor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/DataFormatException.java
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FileImageDescriptor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageRegistry.java
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceColors.java
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceResources.java
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/MissingImageDescriptor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/StringConverter.java
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/URLImageDescriptor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts.properties
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_aix.properties
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_hp-ux.properties
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_linux.properties
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_linux_gtk.properties
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_qnx.properties
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_sunos.properties
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windows2000.properties
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windows98.properties
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windowsnt.properties
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windowsxp.properties
bundles/org.eclipse.jface/src/org/eclipse/jface/resource/package.html
bundles/org.eclipse.jface/src/org/eclipse/jface/util/Assert.java
bundles/org.eclipse.jface/src/org/eclipse/jface/util/IOpenEventListener.java
bundles/org.eclipse.jface/src/org/eclipse/jface/util/IPropertyChangeListener.java
bundles/org.eclipse.jface/src/org/eclipse/jface/util/ListenerList.java
bundles/org.eclipse.jface/src/org/eclipse/jface/util/OpenStrategy.java
bundles/org.eclipse.jface/src/org/eclipse/jface/util/PropertyChangeEvent.java
bundles/org.eclipse.jface/src/org/eclipse/jface/util/package.html
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CellEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckStateChangedEvent.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxCellEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxTableViewer.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxTreeViewer.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColorCellEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnLayoutData.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnPixelData.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnWeightData.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ComboBoxCellEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ContentViewer.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DecoratingLabelProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DialogCellEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DoubleClickEvent.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IBaseLabelProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IBasicPropertyConstants.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellEditorListener.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellEditorValidator.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellModifier.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICheckStateListener.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICheckable.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IContentProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IDoubleClickListener.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IInputProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IInputSelectionProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelDecorator.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelProviderListener.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IOpenListener.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelection.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelectionChangedListener.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelectionProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IStructuredContentProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IStructuredSelection.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITableLabelProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITreeContentProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITreeViewerListener.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/LabelProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/LabelProviderChangedEvent.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ListViewer.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/OpenEvent.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/SelectionChangedEvent.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredSelection.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableLayout.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableTreeViewer.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewer.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewerImpl.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TextCellEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeExpansionEvent.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/Viewer.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerDropAdapter.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerFilter.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerSorter.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/package.html
bundles/org.eclipse.jface/src/org/eclipse/jface/window/Window.java
bundles/org.eclipse.jface/src/org/eclipse/jface/window/WindowManager.java
bundles/org.eclipse.jface/src/org/eclipse/jface/window/package.html
bundles/org.eclipse.ui.views/.classpath
bundles/org.eclipse.ui.views/.cvsignore
bundles/org.eclipse.ui.views/.project
bundles/org.eclipse.ui.views/build.properties
bundles/org.eclipse.ui.views/extensions/org/eclipse/ui/actions/AddTaskAction.java
bundles/org.eclipse.ui.views/plugin.properties
bundles/org.eclipse.ui.views/plugin.xml
bundles/org.eclipse.ui.views/scripts/exportplugin.xml
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkContentProvider.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkLabelProvider.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkMessages.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkNavigator.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/CopyBookmarkAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/IBookmarkHelpContextIds.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/OpenBookmarkAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/RemoveBookmarkAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/SelectAllAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/messages.properties
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/package.html
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutline.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutlinePage.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/IContentOutlinePage.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/messages.properties
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/package.html
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/BackAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/ForwardAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/Frame.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameList.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameListMessages.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/GoIntoAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/IFrameListHelpContextIds.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/IFrameSource.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/TreeFrame.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/TreeViewerFrameSource.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/UpAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/messages.properties
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/package.html
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/CopyAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/FilterSelectionAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/FiltersContentProvider.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoActionGroup.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoResourceAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoResourceDialog.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/INavigatorHelpContextIds.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/IResourceNavigator.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/MainActionGroup.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorDragAdapter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorDropAdapter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorFrameSource.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/OpenActionGroup.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/PasteAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/RefactorActionGroup.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigator.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorActionGroup.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorMessages.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorMoveAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorRenameAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourcePatternFilter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceSelectionUtil.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceSorter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ShowInNavigatorAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/SortAndFilterActionGroup.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/SortViewAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/StringMatcher.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/WorkspaceActionGroup.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/messages.properties
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/package.html
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CategoriesAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ColorPropertyDescriptor.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CopyPropertyAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/DefaultsAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/FilePropertySource.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/FilterAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ICellEditorActivationListener.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertiesHelpContextIds.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertyDescriptor.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntry.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntryListener.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetPage.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySource.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySourceProvider.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IResourcePropertyConstants.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertiesMessages.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetCategory.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPageContextComputer.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ResourcePropertySource.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/StandardPropertiesAdapterFactory.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/TextPropertyDescriptor.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/messages.properties
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/package.html
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/CopyTaskAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/DefaultTaskListResourceAdapter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/FiltersAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/FiltersDialog.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/GotoTaskAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/IMarkerConstants.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ITaskListHelpContextIds.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ITaskListResourceAdapter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkCompletedAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerType.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerTypesModel.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerUtil.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/NewTaskAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/PasteTaskAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/PurgeCompletedAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/RemoveTaskAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ResolveMarkerAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/SelectAllTasksAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskList.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskListContentProvider.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskListMessages.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskPropertiesAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskPropertiesDialog.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskSorter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TasksFilter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/messages.properties
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/package.html
bundles/org.eclipse.ui.win32/.classpath
bundles/org.eclipse.ui.win32/.cvsignore
bundles/org.eclipse.ui.win32/.project
bundles/org.eclipse.ui.win32/about.html
bundles/org.eclipse.ui.win32/build.properties
bundles/org.eclipse.ui.win32/fragment.xml
bundles/org.eclipse.ui.win32/src/org/eclipse/ui/internal/editorsupport/win32/OleEditor.java
bundles/org.eclipse.ui.workbench/.classpath
bundles/org.eclipse.ui.workbench/.cvsignore
bundles/org.eclipse.ui.workbench/.project
bundles/org.eclipse.ui.workbench/Eclipse UI Editor Support/org/eclipse/ui/internal/editorsupport/ComponentSupport.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionBars.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegate.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegateWithEvent.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionFilter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ICapabilityInstallWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ICapabilityUninstallWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ICapabilityWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IContributorResourceAdapter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IDecoratorManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionBarContributor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionDelegate.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorInput.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorLauncher.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorPart.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorReference.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorSite.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IElementFactory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IExportWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFileEditorInput.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFileEditorMapping.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFolderLayout.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IImportWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IKeyBindingService.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerActionFilter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerHelpRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerResolution.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerResolutionGenerator.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMemento.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationHistory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocationProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INewWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INullSelectionListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IObjectActionDelegate.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageLayout.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageService.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartService.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistableElement.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveFactory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPlaceholderFolderLayout.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IProjectActionFilter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPropertyListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IResourceActionFilter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IReusableEditor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionService.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISharedImages.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IStartup.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IStorageEditorInput.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewActionDelegate.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewPart.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewReference.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewSite.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWindowListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbench.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchActionConstants.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartReference.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartSite.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPropertyPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchSite.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindow.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowActionDelegate.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate2.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSet.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/NavigationLocation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PartInitException.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PlatformUI.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ResourceWorkingSetFilter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchException.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/XMLMemento.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionContext.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionDelegate.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionGroup.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/AddBookmarkAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BuildAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CloseResourceAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyProjectAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyProjectOperation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyResourceAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CreateFileAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CreateFolderAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CreateProjectAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/DeleteResourceAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ExportResourcesAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/GlobalBuildAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ImportResourcesAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/LabelRetargetAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/MoveFilesAndFoldersOperation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/MoveProjectAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/MoveResourceAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewProjectAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardMenu.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenFileAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenInNewWindowAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewPageMenu.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewWindowMenu.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenPerspectiveMenu.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenResourceAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenSystemEditorAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenWithMenu.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PartEventAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PerspectiveMenu.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ReadOnlyStateChecker.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RefreshAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RenameResourceAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RetargetAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ScrubLocalAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SelectionListenerAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SelectionProviderAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SimpleWildcardTester.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/TextActionHandler.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkspaceAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkspaceModifyDelegatingOperation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkspaceModifyOperation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/package.html
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/AbstractElementListSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CheckedTreeSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ContainerGenerator.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ContainerSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementListSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementTreeSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingContentProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingLabelProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileSystemElement.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredList.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IOverwriteQuery.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionStatusValidator.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionValidator.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetEditWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ListSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/MarkerResolutionSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ProjectLocationMoveDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ProjectLocationSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyDialogAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ResourceSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SaveAsDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionStatusDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoArrayQuickSorter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoPaneElementSelector.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TypeFilteringDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardDataTransferPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardExportPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardExportResourcesPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardImportPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewFileCreationPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewFolderMainPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewProjectCreationPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewProjectReferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardResourceImportPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/YesNoCancelListSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/package.html
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/DialogPageContextComputer.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/IContextComputer.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/ViewContextComputer.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/WorkbenchHelp.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/package.html
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AboutAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AboutInfo.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AboutItem.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractPartSelectionTracker.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractSelectionService.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AcceleratorMenu.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionExpression.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionPresentation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetActionBars.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetContributionItem.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetMenuManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetSeparator.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetToolBarManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivateEditorAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActiveEditorAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BaseSaveAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CTabPartDragDrop.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ChangeToPerspectiveMenu.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllPerspectivesAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllSavedAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseEditorAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ClosePerspectiveAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ConfigurationInfo.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ContainerPlaceholder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarContributionItem.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarLayout.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolItemMultiToolBarManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolItemPosition.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolItemToolBarManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleEditorAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CyclePartAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CyclePerspectiveAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DecoratorDefinition.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DecoratorManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DecoratorRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DefaultContributorResourceAdapter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DetachedPlaceHolder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DetachedWindow.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DynamicMenuManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditActionSetsAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBuilder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorArea.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistoryItem.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorMenuManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPane.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPluginAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPresentation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSite.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorToolBarManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorWorkbook.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExceptionHandler.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FolderLayout.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IActionSetContributionItem.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IHelpContextIds.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IInternalPerspectiveListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ILayoutContainer.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IMarkerImageProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectActionContributor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectContributor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPartDropListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPartDropTarget.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPerspectiveService.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPreferenceConstants.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchGraphicConstants.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/KeyBindingService.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/KeyTable.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LabelDecoratorAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutPart.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutPartSash.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutTree.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutTreeNode.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LightweightActionDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LockToolBarAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MessageLine.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MultiEditorInnerPane.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MultiEditorOuterPane.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NewConfigurationInfo.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NewWizardDropDownAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NewWizardShortcutAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectContributorManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectFilterTest.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectPluginAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPreferencesAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenedPerspectivesMenu.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageEventAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageLayout.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageListenerList.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PagePartSelectionTracker.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageSelectionService.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartDragDrop.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartDropEvent.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartDropTarget.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartListenerList.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPane.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPlaceholder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPluginAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSashContainer.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartTabFolder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Perspective.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveContributionItem.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveHistory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveListenerList.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveListenerListOld.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectivePresentation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PinEditorAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlaceholderFolderLayout.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlatformInfo.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlatformUIPreferenceListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionBuilder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSet.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSetReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PopupMenuExtender.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProblemImageProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/QuickStartAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/QuitAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReferenceCounter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReopenEditorMenu.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ResetPerspectiveAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ResourcePerspective.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RootLayoutContainer.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveAllAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveAsAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SavePerspectiveAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionEnabler.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Semaphore.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SetPagePerspectiveAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SharedImages.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShortcutBarPart.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShortcutBarPartDragDrop.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShortcutMenu.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowFastViewContribution.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowPartPaneMenuAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenu.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenuAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SubActionBars.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SwitchToWindowMenu.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SystemSummaryEditorInput.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SystemSummaryEditorInputFactory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ToggleEditorsVisibilityAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UISynchronizer.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UIWorkspaceLock.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewActionBars.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewActionBuilder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewFactory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewPane.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewPluginAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewSite.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewerActionBuilder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinActionBars.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinKeyBindingService.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPartService.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPerspectiveService.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginPulldown.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WelcomePageSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WindowPartSelectionTracker.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WindowSelectionService.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchActionBuilder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchColors.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchEditorsAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchImages.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartLabelProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSet.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetComparator.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetFactory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutFeaturesDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutPluginsDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetContentProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetDialogInput.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetLabelProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetSorter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/BuildOrderPreferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CheckboxSingleListGroup.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContainerCheckedTreeViewer.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CreateProjectStep.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CreateProjectWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DecoratorsPreferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DialogUtil.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EditorSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EditorsPreferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPreferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPropertyPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EventLoopProgressMonitor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ExportWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeAction.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeActionSetCategory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeActionSetDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakePerspectiveActionSet.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeViewActionSet.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeWizardActionSet.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileEditorsPreferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileStatesPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileSystemResourceExporter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FilterDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FontPreferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/IElementFilter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/IPropertyPageContributor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/InstallCapabilityStep.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/InternalBase64Encoder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/InternalErrorDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ListContentProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepCapabilityWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepConfigureWizardPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepReviewWizardPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepWizardDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewProjectWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardCollectionSorter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardNewPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardSelectionPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspContentProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspLabelProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspectivesPreferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceErrorDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProductInfoDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilityEditingPropertyPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilityPropertyPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilitySimpleAddWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilitySimpleSelectionPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectPerspectiveChoiceDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectReferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageContributorManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageNode.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RegistryPageContributor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RemoveCapabilityStep.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RemoveCapabilityWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceInfoPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceSorter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceTreeAndListGroup.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceWorkingSetPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SavePerspectiveDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ShowViewDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SimpleListContentProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/StartupPreferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/UpdateProjectCapabilityWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewContentProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewLabelProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewSorter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeEditor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeEditorInput.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeEditorInputFactory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeItem.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeParser.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardCollectionElement.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardNewProjectCapabilityPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardNewProjectNameAndLocationPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardStep.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkInProgressPreferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchEditorsDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceNode.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferencePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardElement.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardListSelectionPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardNode.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardSelectionPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetEditWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetNewWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetSelectionDialog.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetTypePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ZipFileResourceExportOperation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ZipFileResourceExporter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Action.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/ActionMatch.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Configuration.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Contributor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Element.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeyBinding.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeyBindingManager.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeySequence.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeyStroke.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Locale.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Node.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Path.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Platform.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Scope.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/State.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Util.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/AcceleratorHook.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ActivatorBar.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ActivatorBarLayout.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ActivatorItem.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Assert.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/AssertionFailedException.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/CheckboxDoubleListGroup.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/CheckboxTreeAndListGroup.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ContainerContentProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ContainerSelectionGroup.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalEditor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalProgramImageDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ItemListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/OverlayComposite.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/OverlayIcon.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ProgramImageDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ProjectCapabilitySelectionGroup.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ResourceAndContainerGroup.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Sorter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StatusUtil.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Stopwatch.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StringMatcher.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestPageListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestPartListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestSelectionListener.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIHackFinder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/WizardStepGroup.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Workbook.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/WorkbookPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/AdaptableList.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/ResourceFactory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchAdapter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchAdapterBuilder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchAdapterFactory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchFile.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchFolder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchMarker.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchProject.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchResource.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchRootResource.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchStatus.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchStatusList.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchWorkspace.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkspaceFactory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Accelerator.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorConfiguration.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorScope.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorSet.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionDefinition.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionDefinitionRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionDefinitionRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetCategory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetPartAssociationsReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Capability.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CapabilityRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CapabilityRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Category.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/FileEditorMapping.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSet.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSetDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ICategory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IViewDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IViewRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerHelpRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerHelpRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerImageProviderRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerQuery.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerQueryResult.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/NewWizardsRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveExtensionReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferencePageRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ProjectImageRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ProjectImageRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PropertyPagesRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/RegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WizardsRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetDescriptor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistry.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistryReader.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchContentProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchLabelProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchViewerSorter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/package.html
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/package.html
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CellEditorActionHandler.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CoolItemGroupMarker.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownAdapter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownComposite.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillFrame.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillStack.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorActionBarContributor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorPart.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/FileEditorInput.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/FileEditorInputFactory.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IContributedContentsView.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IDropActionDelegate.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageBookViewPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageSite.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ISetSelectionTarget.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MarkerTransfer.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MessagePage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditorInput.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorActionBarContributor.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorPart.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageSelectionProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/Page.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBook.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBookView.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSite.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginDropAdapter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransfer.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransferData.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ResourceTransfer.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ViewPart.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/WorkbenchPart.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/package.html
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/plugin/AbstractUIPlugin.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/plugin/package.html
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/Base64Encoder.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/DataTransferMessages.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ExternalProjectImportWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemExportOperation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemExportWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemExporter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemImportWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemStructureProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/IDataTransferHelpContextIds.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/IImportStructureProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ImportOperation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/MinimizedFileSystemElement.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/PopulateElementOperation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/PopulateRootOperation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/SelectFilesOperation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardExternalProjectImportPage.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemExportPage1.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemImportPage1.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemResourceExportPage1.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemResourceImportPage1.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileExportPage1.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileImportPage1.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileResourceExportPage1.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileResourceImportPage1.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileExportOperation.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileExportWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileExporter.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileImportWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileStructureProvider.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/messages.properties
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/package.html
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewFileResourceWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewFolderResourceWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewProjectResourceWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewResourceWizard.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/ResourceMessages.java
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/messages.properties
bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/package.html
bundles/org.eclipse.ui.workbench/build.properties
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/IStatusLineManager.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/StatusLine.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/StatusLineManager.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/SubStatusLineManager.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/dialogs/ErrorDialog.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/dialogs/ProgressMonitorDialog.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/images/preference.gif
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/images/wizard.gif
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/AccumulatingProgressMonitor.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/IRunnableContext.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/IRunnableWithProgress.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/ModalContext.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/package.html
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/util/SafeRunnable.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/window/ApplicationWindow.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizard.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizardContainer.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizardNode.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizardPage.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/ProgressMonitorPart.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/Wizard.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/WizardDialog.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/WizardPage.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/WizardSelectionPage.java
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/images/error.gif
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/images/page.gif
bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/package.html
bundles/org.eclipse.ui.workbench/icons/full/clcl16/addbkmrk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/addtsk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/alpha_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/apply_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/backward_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/close_view.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/defaults_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/edittsk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/filter_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/filter_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/forward_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/gotoobj_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/graph_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/home_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/list_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/min_view.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/pin_view.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/popup_menu.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/refresh_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/rembkmrk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/remtsk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/scroll_lft.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/scroll_rt.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/scrollend.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/scrollhome.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/selected_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/showbasic_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/showcategory_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/showchild_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/showcomplete_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/showerr_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/showexpert_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/showparents_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/showsync_rn.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/showtsk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/showwarn_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/step_current.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/step_done.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/stop_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/tree_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/up_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/clcl16/view_menu.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/build_exec.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/copy_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/cut_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/debug_exec.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/delete_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/export_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/exportdir_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/exportzip_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/import_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/importdir_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/importzip_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/move_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/new_page.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/new_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/newfile_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/newfolder_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/newprj_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/next_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/paste_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/pin_editor.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/prefs_misc.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/prev_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/print_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/redo_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/rename_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/run_exec.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/save_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/saveall_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/saveas_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/search_src.gif
bundles/org.eclipse.ui.workbench/icons/full/ctool16/undo_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/cview16/bkmrk_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/cview16/default_persp.gif
bundles/org.eclipse.ui.workbench/icons/full/cview16/defaultview_misc.gif
bundles/org.eclipse.ui.workbench/icons/full/cview16/filenav_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/cview16/new_persp.gif
bundles/org.eclipse.ui.workbench/icons/full/cview16/opensame_persp.gif
bundles/org.eclipse.ui.workbench/icons/full/cview16/outline_co.gif
bundles/org.eclipse.ui.workbench/icons/full/cview16/prop_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/cview16/replace_persp.gif
bundles/org.eclipse.ui.workbench/icons/full/cview16/resource_persp.gif
bundles/org.eclipse.ui.workbench/icons/full/cview16/tasks_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/addbkmrk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/addtsk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/alpha_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/apply_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/backward_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/close_view.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/defaults_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/edittsk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/filter_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/filter_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/forward_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/gotoobj_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/graph_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/home_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/list_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/min_view.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/pin_view.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/popup_menu.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/refresh_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/rembkmrk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/remtsk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scroll_lft.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scroll_rt.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scrollend.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scrollhome.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/selected_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showbasic_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showcategory_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showchild_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showcomplete_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showerr_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showexpert_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showparents_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showsync_rn.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showtsk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showwarn_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/stop_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/tree_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/up_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/dlcl16/view_menu.gif
bundles/org.eclipse.ui.workbench/icons/full/dnd/bottom_mask.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/bottom_source.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/invalid_mask.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/invalid_source.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/left_mask.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/left_source.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/offscreen_mask.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/offscreen_source.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/right_mask.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/right_source.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/stack_mask.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/stack_source.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/tofastview_mask.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/tofastview_source.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/top_mask.bmp
bundles/org.eclipse.ui.workbench/icons/full/dnd/top_source.bmp
bundles/org.eclipse.ui.workbench/icons/full/dtool16/build_exec.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/copy_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/cut_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/debug_exec.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/delete_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/export_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/exportdir_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/exportzip_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/import_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/importdir_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/importzip_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/move_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/new_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/newfile_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/newfolder_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/newprj_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/paste_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/pin_editor.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/prefs_misc.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/print_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/quick_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/redo_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/rename_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/run_exec.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/save_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/saveall_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/saveas_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/search_src.gif
bundles/org.eclipse.ui.workbench/icons/full/dtool16/undo_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/addbkmrk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/addtsk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/alpha_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/apply_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/backward_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/close_view.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/defaults_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/edittsk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/filter_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/filter_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/forward_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/gotoobj_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/graph_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/home_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/list_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/min_view.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/pin_view.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/popup_menu.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/refresh_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/rembkmrk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/remtsk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/scroll_lft.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/scroll_rt.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/scrollend.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/scrollhome.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/selected_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/showbasic_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/showcategory_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/showchild_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/showcomplete_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/showerr_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/showexpert_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/showparents_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/showsync_rn.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/showtsk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/showwarn_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/stop_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/tree_mode.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/up_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/elcl16/view_menu.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/build_exec.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/copy_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/cut_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/debug_exec.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/delete_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/export_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/exportdir_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/exportzip_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/import_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/importdir_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/importzip_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/move_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/new_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/newfile_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/newfolder_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/newprj_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/paste_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/pin_editor.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/prefs_misc.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/print_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/quick_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/redo_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/rename_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/run_exec.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/save_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/saveall_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/saveas_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/search_src.gif
bundles/org.eclipse.ui.workbench/icons/full/etool16/undo_edit.gif
bundles/org.eclipse.ui.workbench/icons/full/eview16/bkmrk_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/eview16/default_persp.gif
bundles/org.eclipse.ui.workbench/icons/full/eview16/defaultview_misc.gif
bundles/org.eclipse.ui.workbench/icons/full/eview16/filenav_nav.gif
bundles/org.eclipse.ui.workbench/icons/full/eview16/new_persp.gif
bundles/org.eclipse.ui.workbench/icons/full/eview16/opensame_persp.gif
bundles/org.eclipse.ui.workbench/icons/full/eview16/outline_co.gif
bundles/org.eclipse.ui.workbench/icons/full/eview16/prop_ps.gif
bundles/org.eclipse.ui.workbench/icons/full/eview16/replace_persp.gif
bundles/org.eclipse.ui.workbench/icons/full/eview16/resource_persp.gif
bundles/org.eclipse.ui.workbench/icons/full/eview16/tasks_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/bkmrk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/cfldr_obj.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/complete_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/cprj_obj.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/dots_button.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/element_obj.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/elements_obj.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/error_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/file_obj.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/fldr_obj.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/hprio_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/incomplete_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/info_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/lprio_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/prj_obj.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/probmrk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/system_summary_editor.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/taskmrk_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/warn_tsk.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/welcome_banner.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/welcome_editor.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/welcome_item.gif
bundles/org.eclipse.ui.workbench/icons/full/obj16/workset.gif
bundles/org.eclipse.ui.workbench/icons/full/wizban/export_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/wizban/exportdir_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/wizban/exportzip_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/wizban/import_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/wizban/importdir_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/wizban/importzip_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/wizban/new_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/wizban/newfile_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/wizban/newfolder_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/wizban/newprj_wiz.gif
bundles/org.eclipse.ui.workbench/icons/full/wizban/saveas_dlg.gif
bundles/org.eclipse.ui.workbench/icons/full/wizban/workset_wiz.gif
bundles/org.eclipse.ui.workbench/plugin.properties
bundles/org.eclipse.ui.workbench/plugin.xml
bundles/org.eclipse.ui.workbench/scripts/exportplugin.xml
examples/org.eclipse.ui.examples.multipageeditor/.classpath
examples/org.eclipse.ui.examples.multipageeditor/.cvsignore
examples/org.eclipse.ui.examples.multipageeditor/.project
examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MessageUtil.java
examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MultiPageContributor.java
examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MultiPageEditorExample.java
examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/messages.properties
examples/org.eclipse.ui.examples.multipageeditor/about.html
examples/org.eclipse.ui.examples.multipageeditor/build.properties
examples/org.eclipse.ui.examples.multipageeditor/doc-html/hglegal.htm
examples/org.eclipse.ui.examples.multipageeditor/doc-html/ngibmcpy.gif
examples/org.eclipse.ui.examples.multipageeditor/doc-html/ui_multipageeditor_ex.html
examples/org.eclipse.ui.examples.multipageeditor/icons/copy.gif
examples/org.eclipse.ui.examples.multipageeditor/plugin.properties
examples/org.eclipse.ui.examples.multipageeditor/plugin.xml
examples/org.eclipse.ui.examples.propertysheet/.classpath
examples/org.eclipse.ui.examples.propertysheet/.cvsignore
examples/org.eclipse.ui.examples.propertysheet/.project
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Address.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Birthday.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddress.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddressValidator.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/GroupElement.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/IUserConstants.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/MessageUtil.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Name.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/OrganizationElement.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PopupMenuActionDelegate.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PropertySheetContentOutlinePage.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PropertySheetPlugin.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/StreetAddress.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserEditor.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserElement.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserFileParser.java
examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/messages.properties
examples/org.eclipse.ui.examples.propertysheet/HelpContexts.xml
examples/org.eclipse.ui.examples.propertysheet/about.html
examples/org.eclipse.ui.examples.propertysheet/build.properties
examples/org.eclipse.ui.examples.propertysheet/doc-html/hglegal.htm
examples/org.eclipse.ui.examples.propertysheet/doc-html/ngibmcpy.gif
examples/org.eclipse.ui.examples.propertysheet/doc-html/ui_propertysheet_ex.html
examples/org.eclipse.ui.examples.propertysheet/doc.zip
examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.gif
examples/org.eclipse.ui.examples.propertysheet/plugin.properties
examples/org.eclipse.ui.examples.propertysheet/plugin.xml
examples/org.eclipse.ui.examples.readmetool/.classpath
examples/org.eclipse.ui.examples.readmetool/.cvsignore
examples/org.eclipse.ui.examples.readmetool/.project
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AdaptableList.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AddReadmeMarkerAction.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AddSentenceResolution.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/DefaultSectionsParser.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/DirtyStateContribution.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/EditorActionDelegate.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/IReadmeConstants.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/IReadmeFileParser.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MarkElement.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MarkElementProperties.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MessageUtil.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/PopupMenuActionDelegate.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeContentOutlineDragListener.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeContentOutlinePage.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeCreationPage.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeCreationWizard.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeDropActionDelegate.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeEditor.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeEditorActionBarContributor.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeFilePropertyPage.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeFilePropertyPage2.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeImages.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeMarkerResolutionGenerator.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeModelFactory.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmePlugin.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmePreferencePage.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeSectionsView.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/SectionsDialog.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ViewActionDelegate.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/WindowActionDelegate.java
examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/messages.properties
examples/org.eclipse.ui.examples.readmetool/HelpContexts.xml
examples/org.eclipse.ui.examples.readmetool/about.html
examples/org.eclipse.ui.examples.readmetool/build.properties
examples/org.eclipse.ui.examples.readmetool/doc-html/hglegal.htm
examples/org.eclipse.ui.examples.readmetool/doc-html/ngibmcpy.gif
examples/org.eclipse.ui.examples.readmetool/doc-html/ui_readmetool_ex.html
examples/org.eclipse.ui.examples.readmetool/doc.zip
examples/org.eclipse.ui.examples.readmetool/doc/hglegal.htm
examples/org.eclipse.ui.examples.readmetool/doc/ngibmcpy.gif
examples/org.eclipse.ui.examples.readmetool/doc/org_eclipse_ui_examples_readmetool.html
examples/org.eclipse.ui.examples.readmetool/doc/org_eclipse_ui_examples_readmetool_sectionParser.html
examples/org.eclipse.ui.examples.readmetool/icons/ctool16/action1.gif
examples/org.eclipse.ui.examples.readmetool/icons/ctool16/action2.gif
examples/org.eclipse.ui.examples.readmetool/icons/ctool16/action3.gif
examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.gif
examples/org.eclipse.ui.examples.readmetool/icons/dtool16/action1.gif
examples/org.eclipse.ui.examples.readmetool/icons/dtool16/action2.gif
examples/org.eclipse.ui.examples.readmetool/icons/dtool16/action3.gif
examples/org.eclipse.ui.examples.readmetool/icons/dtool16/openbrwsr.gif
examples/org.eclipse.ui.examples.readmetool/icons/etool16/action1.gif
examples/org.eclipse.ui.examples.readmetool/icons/etool16/action2.gif
examples/org.eclipse.ui.examples.readmetool/icons/etool16/action3.gif
examples/org.eclipse.ui.examples.readmetool/icons/etool16/openbrwsr.gif
examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.gif
examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.gif
examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.gif
examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.gif
examples/org.eclipse.ui.examples.readmetool/icons/wizban/newreadme_wiz.gif
examples/org.eclipse.ui.examples.readmetool/plugin.properties
examples/org.eclipse.ui.examples.readmetool/plugin.xml
diff --git a/bundles/org.eclipse.jface/.classpath b/bundles/org.eclipse.jface/.classpath
deleted file mode 100644
index 7bae64e..0000000
--- a/bundles/org.eclipse.jface/.classpath
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="/org.apache.xerces"/>
- <classpathentry exported="true" kind="src" path="/org.eclipse.swt"/>
- <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.jface/.cvsignore b/bundles/org.eclipse.jface/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- a/bundles/org.eclipse.jface/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.jface/.project b/bundles/org.eclipse.jface/.project
deleted file mode 100644
index a09af6e..0000000
--- a/bundles/org.eclipse.jface/.project
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.jface</name>
- <comment></comment>
- <projects>
- <project>org.apache.xerces</project>
- <project>org.eclipse.swt</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.jface/build.properties b/bundles/org.eclipse.jface/build.properties
deleted file mode 100644
index 8c35d1e..0000000
--- a/bundles/org.eclipse.jface/build.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-bin.includes = plugin.properties,\
- plugin.xml,\
- *.jar
-source.jface.jar = src/
diff --git a/bundles/org.eclipse.jface/plugin.properties b/bundles/org.eclipse.jface/plugin.properties
deleted file mode 100644
index 4aed6bd..0000000
--- a/bundles/org.eclipse.jface/plugin.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-pluginName = JFace
-providerName = Eclipse.org
diff --git a/bundles/org.eclipse.jface/plugin.xml b/bundles/org.eclipse.jface/plugin.xml
deleted file mode 100644
index 1d2f6f4..0000000
--- a/bundles/org.eclipse.jface/plugin.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.jface"
- name="%pluginName"
- version="2.1.0"
- provider-name="%providerName">
-
- <runtime>
- <library name="jface.jar">
- <export name="*"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.apache.xerces"/>
- <import plugin="org.eclipse.swt" export="true"/>
- </requires>
-
-
-</plugin>
diff --git a/bundles/org.eclipse.jface/scripts/exportplugin.xml b/bundles/org.eclipse.jface/scripts/exportplugin.xml
deleted file mode 100644
index 2ea417c..0000000
--- a/bundles/org.eclipse.jface/scripts/exportplugin.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<project name="Export JFace" default="export" basedir="..">
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="plugin" value="org.eclipse.jface" />
- <property name="version" value="_2.1.0" />
- <property name="dest" value="${destdir}/${plugin}${version}" />
- </target>
-
- <target name="build" depends="init">
- <eclipse.incrementalBuild project="${plugin}" kind="incr"/>
- </target>
-
- <target name="export" depends="build">
- <mkdir dir="${destdir}" />
- <delete dir="${dest}" />
- <mkdir dir="${dest}" />
- <jar
- jarfile="${dest}/jface.jar"
- basedir="bin"
- />
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <zip zipfile="${dest}/jfacesrc.zip">
- <fileset dir="src" />
- </zip>
- </target>
-</project>
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/AbstractGroupMarker.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/AbstractGroupMarker.java
deleted file mode 100644
index 4e5e173..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/AbstractGroupMarker.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-
-/**
- * Abstract superclass for group marker classes.
- * <p>
- * This class is not intended to be subclassed outside the framework.
- * </p>
- */
-public abstract class AbstractGroupMarker extends ContributionItem {
-/**
- * Constructor for use by subclasses.
- */
-protected AbstractGroupMarker() {
-}
-/**
- * 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.
- *
- * @param groupName the name of the group
- */
-protected AbstractGroupMarker(String groupName) {
- super(groupName);
- Assert.isTrue(groupName != null && groupName.length() > 0);
-}
-/**
- * Returns the group name.
- *
- * @return the group name
- */
-public String getGroupName() {
- return getId();
-}
-/**
- * The <code>AbstractGroupMarker</code> implementation of this <code>IContributionItem</code>
- * method returns <code>true</code> iff the id is not <code>null</code>. Subclasses may override.
- */
-public boolean isGroupMarker() {
- return getId() != null;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java
deleted file mode 100644
index 96f52e0..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java
+++ /dev/null
@@ -1,904 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.jface.resource.*;
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.HelpListener;
-import org.eclipse.swt.widgets.Event;
-
-
-/**
- * The standard abstract implementation of an action.
- * <p>
- * Subclasses must implement the <code>IAction.run</code> method to carry out
- * the action's semantics.
- * </p>
- */
-public abstract class Action implements IAction {
-
- /**
- * Table of key codes (key type: <code>String</code>,
- * value type: <code>Integer</code>); <code>null</code>
- * if not yet initialized.
- * @see #findKeyCode
- */
- private static Map keyCodes = null;
- /**
- * Table of key codes (key type: <code>String</code>,
- * value type: <code>Integer</code>); <code>null</code>
- * if not yet initialized. The key is the localalized name
- * of the key as it appears in menus.
- * @see #findLocalizedKeyCode
- */
- private static Map localizedKeyCodes = null;
-
- /**
- * The localized uppercase versions of the modifer
- * keys.
- */
- private static String LOCALIZED_CTRL;
- private static String LOCALIZED_SHIFT;
- private static String LOCALIZED_ALT;
-
-
- /**
- * Table of string representations of keys
- * (key type: <code>Integer</code>,
- * value type: <code>String</code>); <code>null</code>>
- * if not yet initialized.
- * @see #findKeyString
- */
- private static Map keyStrings = null;
-
- /**
- * List of registered listeners (element type: <code>IPropertyChangeListener</code>).
- */
- private ListenerList listeners = new ListenerList(3);
-
- /**
- * This action's text, or <code>null</code> if none.
- */
- private String text;
-
- /**
- * This action's description, or <code>null</code> if none.
- */
- private String description;
-
- /**
- * This action's id, or <code>null</code> if none.
- */
- private String id;
-
- /**
- * This action's action definition id, or <code>null</code> if none.
- */
- private String actionDefinitionId;
-
- /**
- * This action's tool tip text, or <code>null</code> if none.
- */
- private String toolTipText;
-
- /**
- * An action's help listener, or <code>null</code> if none.
- */
- private HelpListener helpListener;
-
- /**
- * This action's image, or <code>null</code> if none.
- */
- private ImageDescriptor image;
-
- /**
- * This action's hover image, or <code>null</code> if none.
- */
- private ImageDescriptor hoverImage;
-
- /**
- * This action's disabled image, or <code>null</code> if none.
- */
- private ImageDescriptor disabledImage;
-
- /**
- * Holds the action's menu creator (an IMenuCreator) or checked state (a Boolean),
- * or <code>null</code> if neither have been set.
- * The value of this field affects the value of <code>getStyle()</code>.
- */
- private Object value = null;
-
- /**
- * This action's accelerator; <code>0</code> means none.
- */
- private int accelerator = 0;
-
- /**
- * Indicates this action is enabled.
- */
- private boolean enabled = true;
-/**
- * Creates a new action with no text and no image.
- * <p>
- * Configure the action later using the set methods.
- * </p>
- */
-protected Action() {
-}
-/**
- * Creates a new action with the given text and no image.
- * Calls the zero-arg constructor, then <code>setText</code>.
- *
- * @param text the string used as the text for the action,
- * or <code>null</code> if these is no text
- * @see #setText
- */
-protected Action(String text) {
- this();
- setText(text);
-}
-/**
- * Creates a new action with the given text and image.
- * Calls the zero-arg constructor, then <code>setText</code> and <code>setImageDescriptor</code>.
- *
- * @param text the action's text, or <code>null</code> if there is no text
- * @param image the action's image, or <code>null</code> if there is no image
- * @see #setText
- * @see #setImageDescriptor
- */
-protected Action(String text, ImageDescriptor image) {
- this(text);
- setImageDescriptor(image);
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void addPropertyChangeListener(IPropertyChangeListener listener) {
- listeners.add(listener);
-}
-
-/**
- * Parses the given accelerator text, and converts it to an accelerator key code.
- *
- * Support for localized modifiers is for backwards compatibility
- * with 1.0. Use setAccelerator(int) to set accelerators programatically
- * or the <code>accelerator</code> tag in action definitions in
- * plugin.xml.
- *
- * @param acceleratorText the accelerator text localized to the current locale
- * @return the SWT key code, or 0 if there is no accelerator
- */
-private static int convertLocalizedAccelerator(String acceleratorText) {
- int accelerator = 0;
- StringTokenizer stok = new StringTokenizer(acceleratorText, "+"); //$NON-NLS-1$
-
- int keyCode = -1;
-
- boolean hasMoreTokens = stok.hasMoreTokens();
- while (hasMoreTokens) {
- String token = stok.nextToken();
- hasMoreTokens = stok.hasMoreTokens();
- // Every token except the last must be one of the modifiers
- // Ctrl, Shift, or Alt.
- if (hasMoreTokens) {
- int modifier = findLocalizedModifier(token);
- if (modifier != 0) {
- accelerator |= modifier;
- } else {//Leave if there are none
- return 0;
- }
- } else {
- keyCode = findLocalizedKeyCode(token);
- }
- }
- if (keyCode != -1) {
- accelerator |= keyCode;
- }
- return accelerator;
-}
-
-/**
- * Parses the given accelerator text, and converts it to an accelerator key code.
- *
- * @param acceleratorText the accelerator text
- * @return the SWT key code, or 0 if there is no accelerator
- */
-public static int convertAccelerator(String acceleratorText) {
- int accelerator = 0;
- StringTokenizer stok = new StringTokenizer(acceleratorText, "+"); //$NON-NLS-1$
-
- int keyCode = -1;
-
- boolean hasMoreTokens = stok.hasMoreTokens();
- while (hasMoreTokens) {
- String token = stok.nextToken();
- hasMoreTokens = stok.hasMoreTokens();
- // Every token except the last must be one of the modifiers
- // Ctrl, Shift, or Alt.
- if (hasMoreTokens) {
- int modifier = findModifier(token);
- if (modifier != 0) {
- accelerator |= modifier;
- } else {//Leave if there are none
- return 0;
- }
- } else {
- keyCode = findKeyCode(token);
- }
- }
- if (keyCode != -1) {
- accelerator |= keyCode;
- }
- return accelerator;
-}
-/**
- * Converts an accelerator key code to a string representation.
- *
- * @param keyCode the key code to be translated
- * @return a string representation of the key code
- */
-public static String convertAccelerator(int keyCode) {
- String modifier = getModifierString(keyCode);
- String fullKey;
- if(modifier.equals("")) { //$NON-NLS-1$
- fullKey = findKeyString(keyCode);
- } else {
- fullKey = modifier + "+" + findKeyString(keyCode); //$NON-NLS-1$
- }
- return fullKey;
-}
-/*
- * Returns the string representation of the modifiers (Ctrl, Alt, Shift)
- * of the key event.
- */
-private static String getModifierString(int keyCode) {
- String modString = ""; //$NON-NLS-1$
- if((keyCode & SWT.CTRL) != 0) {
- modString = findModifierString(keyCode & SWT.CTRL);
- }
- if((keyCode & SWT.ALT) != 0) {
- if(modString.equals("")) { //$NON-NLS-1$
- modString = findModifierString(keyCode & SWT.ALT);
- } else {
- modString = modString+"+"+findModifierString(keyCode & SWT.ALT); //$NON-NLS-1$
- }
- }
- if((keyCode & SWT.SHIFT) != 0) {
- if(modString.equals("")) { //$NON-NLS-1$
- modString = findModifierString(keyCode & SWT.SHIFT);
- } else {
- modString = modString+"+"+findModifierString(keyCode & SWT.SHIFT); //$NON-NLS-1$
- }
- }
- return modString;
-}
-/**
- * Extracts the accelerator text from the given text.
- * Returns <code>null</code> if there is no accelerator text,
- * and the empty string if there is no text after the accelerator delimeter (tab or '@').
- *
- * @param text the text for the action
- * @return the accelerator text, or <code>null</code>
- */
-private static String extractAcceleratorText(String text) {
- int index = text.lastIndexOf('\t');
- if (index == -1)
- index = text.lastIndexOf('@');
- if (index >= 0)
- return text.substring(index + 1);
- return null;
-}
-/**
- * Maps a standard keyboard key name to an SWT key code.
- * Key names are converted to upper case before comparison.
- * If the key name is a single letter, for example "S", its character code is returned.
- * <p>
- * The following key names are known (case is ignored):
- * <ul>
- * <li><code>"BACKSPACE"</code></li>
- * <li><code>"TAB"</code></li>
- * <li><code>"RETURN"</code></li>
- * <li><code>"ENTER"</code></li>
- * <li><code>"ESC"</code></li>
- * <li><code>"ESCAPE"</code></li>
- * <li><code>"DELETE"</code></li>
- * <li><code>"SPACE"</code></li>
- * <li><code>"ARROW_UP"</code>, <code>"ARROW_DOWN"</code>,
- * <code>"ARROW_LEFT"</code>, and <code>"ARROW_RIGHT"</code></li>
- * <li><code>"PAGE_UP"</code> and <code>"PAGE_DOWN"</code></li>
- * <li><code>"HOME"</code></li>
- * <li><code>"END"</code></li>
- * <li><code>"INSERT"</code></li>
- * <li><code>"F1"</code>, <code>"F2"</code> through <code>"F12"</code></li>
- * </ul>
- * </p>
- *
- * @param token the key name
- * @return the SWT key code, <code>-1</code> if no match was found
- * @see org.eclipse.swt.SWT
- */
-public static int findKeyCode(String token) {
- if (keyCodes == null)
- initKeyCodes();
- token= token.toUpperCase();
- Integer i= (Integer) keyCodes.get(token);
- if (i != null)
- return i.intValue();
- if (token.length() == 1)
- return token.charAt(0);
- return -1;
-}
-
-/**
- * Find the supplied code for a localized key. As
- * #findKeyCode but localized to the current locale.
- *
- * Support for localized modifiers is for backwards compatibility
- * with 1.0. Use setAccelerator(int) to set accelerators programatically
- * or the <code>accelerator</code> tag in action definitions in
- * plugin.xml.
- *
- * @param token the localized key name
- * @return the SWT key code, <code>-1</code> if no match was found
- * @see #findKeyCode
- */
-private static int findLocalizedKeyCode(String token) {
- if (localizedKeyCodes == null)
- initLocalizedKeyCodes();
- token= token.toUpperCase();
- Integer i= (Integer) localizedKeyCodes.get(token);
- if (i != null)
- return i.intValue();
- if (token.length() == 1)
- return token.charAt(0);
- return -1;
-}
-/**
- * Maps an SWT key code to a standard keyboard key name. The key code is
- * stripped of modifiers (SWT.CTRL, SWT.ALT, and SWT.SHIFT). If the key code is
- * not an SWT code (for example if it a key code for the key 'S'), a string
- * containing a character representation of the key code is returned.
- *
- * @param keyCode the key code to be translated
- * @return the string representation of the key code
- * @see org.eclipse.swt.SWT
- * @since 2.0
- */
-public static String findKeyString(int keyCode) {
- if (keyStrings == null)
- initKeyStrings();
- int i = keyCode & ~(SWT.CTRL|SWT.ALT|SWT.SHIFT);
- Integer integer = new Integer(i);
- String result = (String)keyStrings.get(integer);
- if(result != null)
- return result;
- result = new String(new char[] {(char) i});
- return result;
-}
-/**
- * Maps standard keyboard modifier key names to the corresponding
- * SWT modifier bit. The following modifier key names are recognized
- * (case is ignored): <code>"CTRL"</code>, <code>"SHIFT"</code>, and
- * <code>"ALT"</code>.
- * The given modifier key name is converted to upper case before comparison.
- *
- * @param token the modifier key name
- * @return the SWT modifier bit, or <code>0</code> if no match was found
- * @see org.eclipse.swt.SWT
- */
-public static int findModifier(String token) {
- token= token.toUpperCase();
- if (token.equals("CTRL"))//$NON-NLS-1$
- return SWT.CTRL;
- if (token.equals("SHIFT"))//$NON-NLS-1$
- return SWT.SHIFT;
- if (token.equals("ALT"))//$NON-NLS-1$
- return SWT.ALT;
- return 0;
-}
-
-/**
- * Maps the localized modifier names to a code in the same
- * manner as #findModifier.
- *
- * Support for localized modifiers is for backwards compatibility
- * with 1.0. Use setAccelerator(int) to set accelerators programatically
- * or the <code>accelerator</code> tag in action definitions in
- * plugin.xml.
- *
- * @see findModifier
- */
-private static int findLocalizedModifier(String token) {
- if(LOCALIZED_CTRL == null)
- initLocalizedModifiers();
-
- token= token.toUpperCase();
- if (token.equals(LOCALIZED_CTRL))//$NON-NLS-1$
- return SWT.CTRL;
- if (token.equals(LOCALIZED_SHIFT))//$NON-NLS-1$
- return SWT.SHIFT;
- if (token.equals(LOCALIZED_ALT))//$NON-NLS-1$
- return SWT.ALT;
- return 0;
-}
-
-/**
- * Initialize the list of localized modifiers
- */
-private static void initLocalizedModifiers(){
- LOCALIZED_CTRL = JFaceResources.getString("Ctrl").toUpperCase();//$NON-NLS-1$
- LOCALIZED_SHIFT = JFaceResources.getString("Shift").toUpperCase();//$NON-NLS-1$
- LOCALIZED_ALT = JFaceResources.getString("Alt").toUpperCase();//$NON-NLS-1$
-}
-
-/**
- * Returns a string representation of an SWT modifier bit (SWT.CTRL,
- * SWT.ALT, and SWT.SHIFT). Returns <code>null</code> if the key code
- * is not an SWT modifier bit.
- *
- * @param keyCode the SWT modifier bit to be translated
- * @return the string representation of the SWT modifier bit, or <code>null</code> if the key code was not an SWT modifier bit
- * @see org.eclopse.swt.SWT
- * @since 2.0
- */
-public static String findModifierString(int keyCode) {
- if(keyCode == SWT.CTRL)
- return JFaceResources.getString("Ctrl"); //$NON-NLS-1$
- if(keyCode == SWT.ALT)
- return JFaceResources.getString("Alt"); //$NON-NLS-1$
- if(keyCode == SWT.SHIFT)
- return JFaceResources.getString("Shift"); //$NON-NLS-1$
- return null;
-}
-/**
- * Notifies any property change listeners that a property has changed.
- * Only listeners registered at the time this method is called are notified.
- * This method avoids creating an event object if there are no listeners registered,
- * but calls <code>firePropertyChange(PropertyChangeEvent)</code> if there are.
- *
- * @param propertyName the name of the property that has changed
- * @param oldValue the old value of the property, or <code>null</code> if none
- * @param newValue the new value of the property, or <code>null</code> if none
- *
- * @see IPropertyChangeListener#propertyChange
- */
-protected void firePropertyChange(String propertyName, Object oldValue, Object newValue) {
- if (!listeners.isEmpty()) {
- firePropertyChange(new PropertyChangeEvent(this, propertyName, oldValue, newValue));
- }
-}
-/**
- * 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
- *
- * @see IPropertyChangeListener#propertyChange
- */
-protected void firePropertyChange(PropertyChangeEvent event) {
- Object[] listeners = this.listeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((IPropertyChangeListener) listeners[i]).propertyChange(event);
- }
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public int getAccelerator() {
- return accelerator;
-}
-
-/*(non-Javadoc)
- * Method declared on IAction.
- *
- */
-public String getActionDefinitionId() {
- return actionDefinitionId;
-}
-
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public String getDescription() {
- if (description != null)
- return description;
- return getToolTipText();
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public ImageDescriptor getDisabledImageDescriptor() {
- return disabledImage;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public HelpListener getHelpListener() {
- return helpListener;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public ImageDescriptor getHoverImageDescriptor() {
- return hoverImage;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public String getId() {
- return id;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public ImageDescriptor getImageDescriptor() {
- return image;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public IMenuCreator getMenuCreator() {
- Object o = value;
- if (o instanceof IMenuCreator)
- return (IMenuCreator) o;
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public int getStyle() {
- // Infer the style form the fValue field.
- if (value != null) {
- if (value instanceof Boolean)
- return AS_CHECK_BOX;
- if (value instanceof IMenuCreator)
- return AS_DROP_DOWN_MENU;
- }
- return AS_PUSH_BUTTON;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public String getText() {
- return text;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public String getToolTipText() {
- return toolTipText;
-}
-/**
- * Initializes the internal key code table.
- */
-private static void initKeyCodes() {
- keyCodes = new HashMap(40);
-
- keyCodes.put("BACKSPACE", new Integer(8));//$NON-NLS-1$
- keyCodes.put("TAB", new Integer(9));//$NON-NLS-1$
- keyCodes.put("RETURN", new Integer(13));//$NON-NLS-1$
- keyCodes.put("ENTER", new Integer(13));//$NON-NLS-1$
- keyCodes.put("ESCAPE", new Integer(27));//$NON-NLS-1$
- keyCodes.put("ESC", new Integer(27));//$NON-NLS-1$
- keyCodes.put("DELETE", new Integer(127));//$NON-NLS-1$
-
- keyCodes.put("SPACE", new Integer(' '));//$NON-NLS-1$
- keyCodes.put("ARROW_UP", new Integer(SWT.ARROW_UP));//$NON-NLS-1$
- keyCodes.put("ARROW_DOWN", new Integer(SWT.ARROW_DOWN));//$NON-NLS-1$
- keyCodes.put("ARROW_LEFT", new Integer(SWT.ARROW_LEFT));//$NON-NLS-1$
- keyCodes.put("ARROW_RIGHT", new Integer(SWT.ARROW_RIGHT));//$NON-NLS-1$
- keyCodes.put("PAGE_UP", new Integer(SWT.PAGE_UP));//$NON-NLS-1$
- keyCodes.put("PAGE_DOWN", new Integer(SWT.PAGE_DOWN));//$NON-NLS-1$
- keyCodes.put("HOME", new Integer(SWT.HOME));//$NON-NLS-1$
- keyCodes.put("END", new Integer(SWT.END));//$NON-NLS-1$
- keyCodes.put("INSERT", new Integer(SWT.INSERT));//$NON-NLS-1$
- keyCodes.put("F1", new Integer(SWT.F1));//$NON-NLS-1$
- keyCodes.put("F2", new Integer(SWT.F2));//$NON-NLS-1$
- keyCodes.put("F3", new Integer(SWT.F3));//$NON-NLS-1$
- keyCodes.put("F4", new Integer(SWT.F4));//$NON-NLS-1$
- keyCodes.put("F5", new Integer(SWT.F5));//$NON-NLS-1$
- keyCodes.put("F6", new Integer(SWT.F6));//$NON-NLS-1$
- keyCodes.put("F7", new Integer(SWT.F7));//$NON-NLS-1$
- keyCodes.put("F8", new Integer(SWT.F8));//$NON-NLS-1$
- keyCodes.put("F9", new Integer(SWT.F9));//$NON-NLS-1$
- keyCodes.put("F10", new Integer(SWT.F10));//$NON-NLS-1$
- keyCodes.put("F11", new Integer(SWT.F11));//$NON-NLS-1$
- keyCodes.put("F12", new Integer(SWT.F12));//$NON-NLS-1$
-}
-
-/**
- * Initializes the localized internal key code table.
- */
-private static void initLocalizedKeyCodes() {
- localizedKeyCodes = new HashMap(40);
-
- localizedKeyCodes.put(JFaceResources.getString("Backspace").toUpperCase(),new Integer(8));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("Tab").toUpperCase(),new Integer(9));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("Return").toUpperCase(), new Integer(13));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("Enter").toUpperCase(), new Integer(13));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("Escape").toUpperCase(), new Integer(27));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("Esc").toUpperCase(), new Integer(27));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("Delete").toUpperCase(), new Integer(127));//$NON-NLS-1$
-
- localizedKeyCodes.put(JFaceResources.getString("Space").toUpperCase(), new Integer(' '));//$NON-NLS-1$
-
- localizedKeyCodes.put(JFaceResources.getString("Arrow_Up").toUpperCase(), new Integer(SWT.ARROW_UP));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("Arrow_Down").toUpperCase(), new Integer(SWT.ARROW_DOWN));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("Arrow_Left").toUpperCase(), new Integer(SWT.ARROW_LEFT));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("Arrow_Right").toUpperCase(), new Integer(SWT.ARROW_RIGHT));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("Page_Up").toUpperCase(), new Integer(SWT.PAGE_UP));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("Page_Down").toUpperCase(), new Integer(SWT.PAGE_DOWN));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("Home").toUpperCase(), new Integer(SWT.HOME));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("End").toUpperCase(), new Integer(SWT.END));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("Insert").toUpperCase(), new Integer(SWT.INSERT));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("F1").toUpperCase(), new Integer(SWT.F1));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("F2").toUpperCase(), new Integer(SWT.F2));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("F3").toUpperCase(), new Integer(SWT.F3));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("F4").toUpperCase(), new Integer(SWT.F4));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("F5").toUpperCase(), new Integer(SWT.F5));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("F6").toUpperCase(), new Integer(SWT.F6));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("F7").toUpperCase(), new Integer(SWT.F7));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("F8").toUpperCase(), new Integer(SWT.F8));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("F9").toUpperCase(), new Integer(SWT.F9));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("F10").toUpperCase(), new Integer(SWT.F10));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("F11").toUpperCase(), new Integer(SWT.F11));//$NON-NLS-1$
- localizedKeyCodes.put(JFaceResources.getString("F12").toUpperCase(), new Integer(SWT.F12));//$NON-NLS-1$
-}
-
-/**
- * Initializes the internal key string table.
- */
-private static void initKeyStrings() {
- keyStrings = new HashMap(40);
-
- keyStrings.put(new Integer(8), JFaceResources.getString("Backspace"));//$NON-NLS-1$
- keyStrings.put(new Integer(9), JFaceResources.getString("Tab"));//$NON-NLS-1$
- keyStrings.put(new Integer(13), JFaceResources.getString("Return"));//$NON-NLS-1$
- keyStrings.put(new Integer(13), JFaceResources.getString("Enter"));//$NON-NLS-1$
- keyStrings.put(new Integer(27), JFaceResources.getString("Escape"));//$NON-NLS-1$
- keyStrings.put(new Integer(27), JFaceResources.getString("Esc"));//$NON-NLS-1$
- keyStrings.put(new Integer(127), JFaceResources.getString("Delete"));//$NON-NLS-1$
-
- keyStrings.put(new Integer(' '), JFaceResources.getString("Space"));//$NON-NLS-1$
-
- keyStrings.put(new Integer(SWT.ARROW_UP), JFaceResources.getString("Arrow_Up"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.ARROW_DOWN), JFaceResources.getString("Arrow_Down"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.ARROW_LEFT), JFaceResources.getString("Arrow_Left"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.ARROW_RIGHT), JFaceResources.getString("Arrow_Right"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.PAGE_UP), JFaceResources.getString("Page_Up"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.PAGE_DOWN), JFaceResources.getString("Page_Down"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.HOME), JFaceResources.getString("Home"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.END), JFaceResources.getString("End"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.INSERT), JFaceResources.getString("Insert"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.F1), JFaceResources.getString("F1"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.F2), JFaceResources.getString("F2"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.F3), JFaceResources.getString("F3"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.F4), JFaceResources.getString("F4"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.F5), JFaceResources.getString("F5"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.F6), JFaceResources.getString("F6"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.F7), JFaceResources.getString("F7"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.F8), JFaceResources.getString("F8"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.F9), JFaceResources.getString("F9"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.F10), JFaceResources.getString("F10"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.F11), JFaceResources.getString("F11"));//$NON-NLS-1$
- keyStrings.put(new Integer(SWT.F12), JFaceResources.getString("F12"));//$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public boolean isChecked() {
- Object o = value;
- if (o instanceof Boolean)
- return ((Boolean) o).booleanValue();
- return false;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public boolean isEnabled() {
- return enabled;
-}
-/**
- * Convenience method for removing any optional accelerator text from the given string.
- * The accelerator text appears at the end of the text, and is separated
- * from the main part by a single tab character <code>'\t'</code>.
- *
- * @param text the text
- * @return the text sans accelerator
- */
-public static String removeAcceleratorText(String text) {
- int index = text.lastIndexOf('\t');
- if (index == -1)
- index = text.lastIndexOf('@');
- if (index >= 0)
- return text.substring(0, index);
- return text;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void removePropertyChangeListener(IPropertyChangeListener listener) {
- listeners.remove(listener);
-}
-
-/**
- * The default implementation of this <code>IAction</code> method
- * does nothing. Subclasses should override this method
- * if they do not need information from the triggering event,
- * or override <code>run(Event)</code> if they do.
- */
-public void run() {
-}
-
-/**
- * The default implementation of this <code>IAction</code> method
- * ignores the event argument, and simply calls <code>run()</code>.
- * Subclasses should override this method if they need information
- * from the triggering event, or override <code>run()</code> if not.
- *
- * NOTE: This is experimental API, which may change in the future.
- *
- * @since 2.0
- */
-public void runWithEvent(Event event) {
- run();
-}
-
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void setActionDefinitionId(String id) {
- actionDefinitionId = id;
-}
-
-/*
- * This method is called by constructors of actions with valid action definitions in the registry.
- * We do not use a constructor Action(String id) to do this work because that would conflict with
- * the pre-existing constructor Action(String text).
- */
-
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void setChecked(boolean checked) {
- // Use prefab Booleans so that != check in Action.setValue() works.
- Object newValue = checked ? Boolean.TRUE : Boolean.FALSE;
- if (newValue != value) {
- Object oldValue = value;
- value = newValue;
- firePropertyChange(CHECKED, oldValue, value);
- }
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void setDescription(String text) {
-
- if ((description == null && text != null)
- || (description != null && text == null)
- || (description != null && text != null && !text.equals(description))) {
- String oldDescription = description;
- description = text;
- firePropertyChange(DESCRIPTION, oldDescription, description);
- }
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void setDisabledImageDescriptor(ImageDescriptor newImage) {
- if (disabledImage != newImage) {
- ImageDescriptor oldImage = disabledImage;
- disabledImage = newImage;
- firePropertyChange(IMAGE, oldImage, newImage);
- }
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void setEnabled(boolean enabled) {
- if (enabled != this.enabled) {
- Boolean oldVal = this.enabled ? Boolean.TRUE : Boolean.FALSE;
- Boolean newVal = enabled ? Boolean.TRUE : Boolean.FALSE;
- this.enabled = enabled;
- firePropertyChange(ENABLED, oldVal, newVal);
- }
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void setHelpListener(HelpListener listener) {
- helpListener = listener;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void setHoverImageDescriptor(ImageDescriptor newImage) {
- if (hoverImage != newImage) {
- ImageDescriptor oldImage = hoverImage;
- hoverImage = newImage;
- firePropertyChange(IMAGE, oldImage, newImage);
- }
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void setId(String id) {
- this.id = id;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void setImageDescriptor(ImageDescriptor newImage) {
- if (image != newImage) {
- ImageDescriptor oldImage = image;
- image = newImage;
- firePropertyChange(IMAGE, oldImage, newImage);
- }
-}
-/**
- * Sets the menu creator for this action.
- * <p>
- * Note that if this method is called, it overrides the check status.
- * </p>
- *
- * @param creator the menu creator, or <code>null</code> if none
- */
-public void setMenuCreator(IMenuCreator creator) {
- value = creator;
-}
-/**
- * Sets the text for this action.
- * <p>
- * Fires a property change event for the <code>TEXT</code> property
- * if the text actually changes as a consequence.
- * </p>
- *
- * @param text the text, or <code>null</code> if none
- */
-public void setText(String text) {
- String oldText = this.text;
- int oldAccel = this.accelerator;
- this.text = text;
- if(text != null) {
- String acceleratorText = extractAcceleratorText(text);
- if (acceleratorText != null) {
- int newAccelerator = convertLocalizedAccelerator(acceleratorText);
- //Be sure to not wipe out the accelerator if nothing found
- if (newAccelerator > 0) {
- setAccelerator(newAccelerator);
- }
- }
- }
- if (!(this.accelerator == oldAccel &&
- (oldText == null ? this.text == null : oldText.equals(this.text)))) {
- firePropertyChange(TEXT, oldText, this.text);
- }
-}
-/**
- * Sets the tool tip text for this action.
- * <p>
- * Fires a property change event for the <code>TOOL_TIP_TEXT</code> property
- * if the tool tip text actually changes as a consequence.
- * </p>
- *
- * @param toolTipText the tool tip text, or <code>null</code> if none
- */
-public void setToolTipText(String toolTipText) {
- String oldToolTipText= this.toolTipText;
- if (!(oldToolTipText == null ? toolTipText == null : oldToolTipText.equals(toolTipText))) {
- this.toolTipText = toolTipText;
- firePropertyChange(TOOL_TIP_TEXT, oldToolTipText, toolTipText);
- }
-}
-/*
- * @see IAction#setAccelerator(int)
- */
-public void setAccelerator(int keycode) {
- this.accelerator = keycode;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ActionContributionItem.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ActionContributionItem.java
deleted file mode 100644
index f8970cf..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ActionContributionItem.java
+++ /dev/null
@@ -1,644 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.*;
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import java.util.*;
-
-/**
- * A contribution item which delegates to an action.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class ActionContributionItem extends ContributionItem {
-
- private static ImageCache globalImageCache;
-
- /**
- * The action.
- */
- private IAction action;
-
- /**
- * The widget created for this item; <code>null</code>
- * before creation and after disposal.
- */
- private Widget widget = null;
-
- /**
- * Remembers the parent widget.
- */
- private Widget parentWidget = null;
-
- /**
- * Nested class handles notification from SWT widget and from Action,
- * to avoid polluting ActionContributionItem with public listener methods.
- */
- private class ActionListener implements Listener, IPropertyChangeListener {
- public void handleEvent(Event event) {
- ActionContributionItem.this.handleWidgetEvent(event);
- }
- public void propertyChange(PropertyChangeEvent event) {
- ActionContributionItem.this.actionPropertyChange(event);
- }
- }
-
- private ActionListener listener = new ActionListener();
-
- private class ImageCache {
- /** Map from ImageDescriptor to Entry */
- private Map entries = new HashMap(11);
- private Image missingImage;
-
- private class Entry {
- Image image;
- Image grayImage;
-
- void dispose() {
- if (image != null) {
- image.dispose();
- image = null;
- }
- if (grayImage != null) {
- grayImage.dispose();
- grayImage = null;
- }
- }
- }
-
- Entry getEntry(ImageDescriptor desc) {
- Entry entry = (Entry) entries.get(desc);
- if (entry == null) {
- entry = new Entry();
- entries.put(desc, entry);
- }
- return entry;
- }
-
- Image getImage(ImageDescriptor desc) {
- if (desc == null) {
- return null;
- }
- Entry entry = getEntry(desc);
- if (entry.image == null) {
- entry.image = desc.createImage();
- }
- return entry.image;
- }
-
- Image getGrayImage(ImageDescriptor desc) {
- if (desc == null) {
- return null;
- }
- Entry entry = getEntry(desc);
- if (entry.grayImage == null) {
- Image image = getImage(desc);
- if (image != null) {
- entry.grayImage = new Image(null, image, SWT.IMAGE_GRAY);
- }
- }
- return entry.grayImage;
- }
-
- Image getMissingImage() {
- if (missingImage == null) {
- missingImage = getImage(ImageDescriptor.getMissingImageDescriptor());
- }
- return missingImage;
- }
-
- void dispose() {
- for (Iterator i = entries.values().iterator(); i.hasNext();) {
- Entry entry = (Entry) i.next();
- entry.dispose();
- }
- entries.clear();
- }
- }
-/**
- * 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 ActionContributionItem(IAction action) {
- super(action.getId());
- this.action = action;
-}
-/**
- * Handles a property change event on the action (forwarded by nested listener).
- */
-private void actionPropertyChange(final PropertyChangeEvent e) {
- // This code should be removed. Avoid using free asyncExec
-
- if (isVisible() && widget != null) {
- Display display = widget.getDisplay();
- if (display.getThread() == Thread.currentThread()) {
- update(e.getProperty());
- }
- else {
- display.asyncExec(new Runnable() {
- public void run() {
- update(e.getProperty());
- }
- });
- }
-
- }
-}
-/**
- * Checks whether the given menu item belongs to a context menu
- * (the one that pops up if the user presses the right mouse button).
- */
-private static boolean belongsToContextMenu(MenuItem item) {
- Menu menu = item.getParent();
- if (menu == null)
- return false;
- while (menu.getParentMenu() != null)
- menu = menu.getParentMenu();
- return (menu.getStyle() & SWT.BAR) == 0;
-}
-/**
- * Compares this action contribution item with another object.
- * Two action contribution items are equal if they refer to the identical Action.
- */
-public boolean equals(Object o) {
- if (!(o instanceof ActionContributionItem)) {
- return false;
- }
- return action.equals(((ActionContributionItem) o).action);
-}
-/**
- * The <code>ActionContributionItem</code> implementation of this <code>IContributionItem</code>
- * method creates a SWT Button for the action.
- * If the action's checked property has been set, a toggle button is created
- * and primed to the value of the checked property.
- */
-public void fill(Composite parent) {
- if (widget == null && parent != null) {
- int flags = SWT.PUSH;
-
- if (action != null) {
- if (action.getStyle() == IAction.AS_CHECK_BOX)
- flags = SWT.TOGGLE;
- }
-
- Button b = new Button(parent, flags);
- b.setData(this);
- b.addListener(SWT.Dispose, listener);
- // Don't hook a dispose listener on the parent
- b.addListener(SWT.Selection, listener);
- if (action.getHelpListener() != null)
- b.addHelpListener(action.getHelpListener());
- widget = b;
- parentWidget = parent;
-
- update(null);
-
- action.addPropertyChangeListener(listener);
- }
-}
-/**
- * The <code>ActionContributionItem</code> implementation of this <code>IContributionItem</code>
- * method creates a SWT MenuItem for the action.
- * If the action's checked property has been set, a toggle button is created
- * and primed to the value of the checked property.
- * If the action's menu creator property has been set, a cascading submenu is created.
- */
-public void fill(Menu parent, int index) {
- if (widget == null && parent != null) {
- int flags = SWT.PUSH;
- Menu subMenu= null;
-
- if (action != null) {
- int style = action.getStyle();
- if (style == IAction.AS_CHECK_BOX)
- flags= SWT.CHECK;
- else if (style == IAction.AS_DROP_DOWN_MENU) {
- IMenuCreator mc = action.getMenuCreator();
- subMenu = mc.getMenu(parent);
- flags = SWT.CASCADE;
- }
- }
-
- MenuItem mi = null;
- if (index >= 0)
- mi = new MenuItem(parent, flags, index);
- else
- mi = new MenuItem(parent, flags);
- widget = mi;
- parentWidget = parent;
-
- mi.setData(this);
- mi.addListener(SWT.Arm, listener);
- mi.addListener(SWT.Dispose, listener);
- mi.addListener(SWT.Selection, listener);
- if (action.getHelpListener() != null)
- mi.addHelpListener(action.getHelpListener());
-
- if (subMenu != null)
- mi.setMenu(subMenu);
-
- update(null);
-
- action.addPropertyChangeListener(listener);
- }
-}
-/**
- * The <code>ActionContributionItem</code> implementation of this <code>IContributionItem</code>
- * method creates a SWT ToolItem for the action.
- * If the action's checked property has been set, a toggle button is created
- * and primed to the value of the checked property.
- * If the action's menu creator property has been set, a drop-down
- * tool item is created.
- */
-public void fill(ToolBar parent, int index) {
- if (widget == null && parent != null) {
- int flags = SWT.PUSH;
-
- if (action != null) {
- int style = action.getStyle();
- if (style == IAction.AS_CHECK_BOX)
- flags = SWT.CHECK;
- else if (style == IAction.AS_DROP_DOWN_MENU)
- flags = SWT.DROP_DOWN;
- }
-
- ToolItem ti = null;
- if (index >= 0)
- ti = new ToolItem(parent, flags, index);
- else
- ti = new ToolItem(parent, flags);
- ti.setData(this);
- ti.addListener(SWT.Selection, listener);
- ti.addListener(SWT.Dispose, listener);
-
- widget = ti;
- parentWidget = parent;
-
- update(null);
-
- action.addPropertyChangeListener(listener);
- }
-}
-/**
- * Returns the action associated with this contribution item.
- *
- * @return the action
- */
-public IAction getAction() {
- return action;
-}
-/**
- * Returns the image cache.
- * The cache is global, and is shared by all action contribution items.
- * This has the disadvantage that once an image is allocated, it is never freed until the display
- * is disposed. However, it has the advantage that the same image in different contribution managers
- * is only ever created once.
- */
-private ImageCache getImageCache() {
- ImageCache cache = globalImageCache;
- if (cache == null) {
- globalImageCache = cache = new ImageCache();
- Display display = Display.getDefault();
- if (display != null) {
- display.disposeExec(new Runnable() {
- public void run() {
- if (globalImageCache != null) {
- globalImageCache.dispose();
- globalImageCache = null;
- }
- }
- });
- }
- }
- return cache;
-}
-/**
- * Handles a widget arm event.
- */
-private void handleWidgetArm(Event e) {
- /*
- String description= null;
- if (fAction instanceof Action) // getDescription should go into IAction
- description= ((Action)fAction).getDescription();
- if (description != null)
- ApplicationWindow.showDescription(e.widget, description);
- else
- ApplicationWindow.resetDescription(e.widget);
- */
-}
-/**
- * Handles a widget dispose event for the widget corresponding to this item.
- */
-private void handleWidgetDispose(Event e) {
- if (e.widget == widget) {
- // the item is being disposed
- action.removePropertyChangeListener(listener);
- widget = null;
- }
-}
-/**
- * Handles an event from the widget (forwarded from nested listener).
- */
-private void handleWidgetEvent(Event e) {
- switch (e.type) {
- case SWT.Arm:
- handleWidgetArm(e);
- break;
- case SWT.Dispose:
- handleWidgetDispose(e);
- break;
- case SWT.Selection:
- handleWidgetSelection(e);
- break;
- }
-}
-/**
- * Handles a widget selection event.
- */
-private void handleWidgetSelection(Event e) {
- Widget item= e.widget;
- if (item != null) {
-
- int style = item.getStyle();
-
- if ((style & (SWT.TOGGLE | SWT.CHECK)) != 0) {
- if (action.getStyle() == IAction.AS_CHECK_BOX) {
- action.setChecked(!action.isChecked());
- }
-
- } else if ((style & SWT.DROP_DOWN) != 0) {
- if (e.detail == 4) { // on drop-down button
- if (action.getStyle() == IAction.AS_DROP_DOWN_MENU) {
- IMenuCreator mc = action.getMenuCreator();
- ToolItem ti = (ToolItem) item;
- // we create the menu as a sub-menu of "dummy" so that we can use
- // it in a cascading menu too.
- // If created on a SWT control we would get an SWT error...
- //Menu dummy= new Menu(ti.getParent());
- //Menu m= mc.getMenu(dummy);
- //dummy.dispose();
-
- Menu m= mc.getMenu(ti.getParent());
- if (m != null) {
- // position the menu below the drop down item
- Rectangle b = ti.getBounds();
- Point p = ti.getParent().toDisplay(new Point(b.x, b.y+b.height));
- m.setLocation(p.x, p.y); // waiting for SWT 0.42
- m.setVisible(true);
- return; // we don't fire the action
- }
- }
- }
- }
-
- // Ensure action is enabled first.
- // See 1GAN3M6: ITPUI:WINNT - Any IAction in the workbench can be executed while disabled.
- if (action.isEnabled()) {
- action.runWithEvent(e);
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on Object.
- */
-public int hashCode() {
- return action.hashCode();
-}
-/**
- * The action item implementation of this <code>IContributionItem</code>
- * method returns <code>true</code> for menu items and <code>false</code>
- * for everything else.
- */
-public boolean isDynamic() {
- //actions in menus are always dynamic
- return widget instanceof MenuItem;
-}
-/**
- * Returns <code>true</code> if this item is allowed to enable,
- * <code>false</code> otherwise.
- *
- * @return if this item is allowed to be enabled
- * @since 2.0
- */
-protected boolean isEnabledAllowed() {
- if (getParent() == null)
- return true;
- Boolean value = getParent().getOverrides().getEnabled(this);
- return (value == null) ? true : value.booleanValue();
-}
-
-/**
- * The action item implementation of this <code>IContributionItem</code>
- * method calls <code>update(null)</code>.
- */
-public final void update() {
- update(null);
-}
-/**
- * Synchronizes the UI with the given property.
- *
- * @param propertyName the name of the property, or <code>null</code> meaning all applicable
- * properties
- */
-public void update(String propertyName) {
- if (widget != null) {
-
- // determine what to do
- boolean textChanged = propertyName == null || propertyName.equals(Action.TEXT);
- boolean imageChanged = propertyName == null || propertyName.equals(Action.IMAGE);
- boolean tooltipTextChanged = propertyName == null || propertyName.equals(Action.TOOL_TIP_TEXT);
- boolean enableStateChanged = propertyName == null || propertyName.equals(Action.ENABLED) ||
- propertyName.equals(IContributionManagerOverrides.P_ENABLED);
- boolean checkChanged = (action.getStyle() == IAction.AS_CHECK_BOX) &&
- (propertyName == null || propertyName.equals(Action.CHECKED));
-
- if (widget instanceof ToolItem) {
- ToolItem ti = (ToolItem) widget;
- if (imageChanged) {
- updateImages(true);
- }
- if (tooltipTextChanged)
- ti.setToolTipText(action.getToolTipText());
-
- if (enableStateChanged) {
- boolean shouldBeEnabled = action.isEnabled() && isEnabledAllowed();
- if (ti.getEnabled() != shouldBeEnabled)
- ti.setEnabled(shouldBeEnabled);
- }
-
- if (checkChanged) {
- boolean bv = action.isChecked();
- if (ti.getSelection() != bv)
- ti.setSelection(bv);
- }
- return;
- }
-
- if (widget instanceof MenuItem) {
- MenuItem mi = (MenuItem) widget;
- boolean isContextMenu = belongsToContextMenu(mi);
-
- // We only install an accelerator if the menu item doesn't
- // belong to a context menu (right mouse button menu).
- if (textChanged && isContextMenu) {
- String text = action.getText();
- if (text != null) {
- text = Action.removeAcceleratorText(text);
- mi.setText(text);
- }
- } else {
- String text = null;
- IContributionManagerOverrides overrides = null;
- if(getParent() != null)
- overrides = getParent().getOverrides();
- if(overrides != null)
- text = getParent().getOverrides().getText(this);
- if(text == null)
- text = action.getText();
- if (text != null) {
- String label = Action.removeAcceleratorText(text);
- String accText = null;
- Integer acc = null;
- if(overrides != null) {
- accText = overrides.getAcceleratorText(this);
- acc = overrides.getAccelerator(this);
- }
- if((accText == null) && (label.length() + 1 < text.length()))
- accText = text.substring(label.length() + 1);
- if(acc == null)
- acc = new Integer(action.getAccelerator());
- if (acc.intValue() >= 0)
- mi.setAccelerator(acc.intValue());
- if(accText == null)
- mi.setText(label);
- else
- mi.setText(label + '\t' + accText);
- }
- }
- if (imageChanged) {
- updateImages(false);
- }
- if (enableStateChanged) {
- boolean shouldBeEnabled = action.isEnabled() && isEnabledAllowed();
- if (mi.getEnabled() != shouldBeEnabled)
- mi.setEnabled(shouldBeEnabled);
- }
-
- if (checkChanged) {
- boolean bv = action.isChecked();
- if (mi.getSelection() != bv)
- mi.setSelection(bv);
- }
- return;
- }
-
- if (widget instanceof Button) {
- Button button= (Button) widget;
- if (imageChanged) {
- if (updateImages(false)) {
- // don't update text if it has an image
- textChanged = false;
- }
- }
- if (textChanged) {
- String text = action.getText();
- if (text != null)
- button.setText(text);
- }
- if (tooltipTextChanged)
- button.setToolTipText(action.getToolTipText());
-
- if (enableStateChanged) {
- boolean shouldBeEnabled = action.isEnabled() && isEnabledAllowed();
- if (button.getEnabled() != shouldBeEnabled)
- button.setEnabled(shouldBeEnabled);
- }
-
- if (checkChanged) {
- boolean bv = action.isChecked();
- if (button.getSelection() != bv)
- button.setSelection(bv);
- }
- return;
- }
- }
-}
-/**
- * Updates the images for this action.
- *
- * @param forceImage <code>true</code> if some form of image is compulsory,
- * and <code>false</code> if it is acceptable for this item to have no image
- * @return <code>true</code> if there are images for this action, <code>false</code> if not
- */
-private boolean updateImages(boolean forceImage) {
-
- ImageCache cache = getImageCache();
-
- if (widget instanceof ToolItem) {
- Image image = cache.getImage(action.getImageDescriptor());
- Image hoverImage = cache.getImage(action.getHoverImageDescriptor());
- Image disabledImage = cache.getImage(action.getDisabledImageDescriptor());
-
- // If there is no regular image, but there is a hover image,
- // convert the hover image to gray and use it as the regular image.
- if (image == null && hoverImage != null) {
- image = cache.getGrayImage(action.getHoverImageDescriptor());
- }
- else {
- // If there is no hover image, use the regular image as the hover image,
- // and convert the regular image to gray
- if (hoverImage == null && image != null) {
- hoverImage = image;
- image = cache.getGrayImage(action.getImageDescriptor());
- }
- }
-
- // Make sure there is a valid image.
- if (hoverImage == null && image == null && forceImage) {
- image = cache.getMissingImage();
- }
-
- // performance: more efficient in SWT to set disabled and hot image before regular image
- if (disabledImage != null) {
- // Set the disabled image if we were able to create one.
- // Assumes that SWT.ToolItem will use platform's default
- // behavior to show item when it is disabled and a disabled
- // image has not been set.
- ((ToolItem) widget).setDisabledImage(disabledImage);
- }
- ((ToolItem) widget).setHotImage(hoverImage);
- ((ToolItem) widget).setImage(image);
-
- return image != null;
- }
- else if (widget instanceof Item || widget instanceof Button) {
- // Use hover image if there is one, otherwise use regular image.
- Image image = cache.getImage(action.getHoverImageDescriptor());
- if (image == null) {
- image = cache.getImage(action.getImageDescriptor());
- }
- // Make sure there is a valid image.
- if (image == null && forceImage) {
- image = cache.getMissingImage();
- }
- if (widget instanceof Item) {
- ((Item) widget).setImage(image);
- }
- else if (widget instanceof Button) {
- ((Button) widget).setImage(image);
- }
- return image != null;
- }
- return false;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionItem.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionItem.java
deleted file mode 100644
index 09f0ed7..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionItem.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-
-/**
- * An abstract base implementation for contribution items.
- */
-public abstract class ContributionItem implements IContributionItem {
-
- /**
- * The identifier for this contribution item, of <code>null</code> if none.
- */
- private String id = null;
-
- /**
- * Indicates this item is visible in its manager; <code>true</code>
- * by default.
- */
- private boolean visible = true;
-
- /**
- * The parent contribution manager for this item
- */
- private IContributionManager parent;
-/**
- * Creates a contribution item with a <code>null</code> id.
- * Calls <code>this(String)</code> with <code>null</code>.
- */
-protected ContributionItem() {
- this(null);
-}
-/**
- * Creates a contribution item with the given (optional) id.
- * The given id is used to find items in a contribution manager,
- * and for positioning items relative to other items.
- *
- * @param id the contribution item identifier, or <code>null</code>
- */
-protected ContributionItem(String id) {
- this.id = id;
-}
-/**
- * The default implementation of this <code>IContributionItem</code>
- * method does nothing. Subclasses may override.
- */
-public void fill(Composite parent) {
-}
-/**
- * The default implementation of this <code>IContributionItem</code>
- * method does nothing. Subclasses may override.
- */
-public void fill(Menu menu, int index) {
-}
-/**
- * The default implementation of this <code>IContributionItem</code>
- * method does nothing. Subclasses may override.
- */
-public void fill(ToolBar parent, int index) {
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public String getId() {
- return id;
-}
-/**
- * Returns the parent contribution manager.
- *
- * @return the parent contribution manager
- * @since 2.0
- */
-public IContributionManager getParent() {
- return parent;
-}
-/**
- * The default implementation of this <code>IContributionItem</code>
- * method returns <code>false</code>. Subclasses may override.
- */
-public boolean isDynamic() {
- return false;
-}
-/**
- * The default implementation of this <code>IContributionItem</code>
- * method returns <code>false</code>. Subclasses may override.
- */
-public boolean isGroupMarker() {
- return false;
-}
-/**
- * The default implementation of this <code>IContributionItem</code>
- * method returns <code>false</code>. Subclasses may override.
- */
-public boolean isSeparator() {
- return false;
-}
-/**
- * The default implementation of this <code>IContributionItem</code>
- * method returns the value recorded in an internal state variable,
- * which is <code>true</code> by default. <code>setVisible</code>
- * should be used to change this setting.
- */
-public boolean isVisible() {
- return visible;
-}
-/**
- * The default implementation of this <code>IContributionItem</code>
- * method stores the value in an internal state variable,
- * which is <code>true</code> by default.
- */
-public void setVisible(boolean visible) {
- this.visible = visible;
-}
-/**
- * Returns a string representation of this contribution item
- * suitable only for debugging.
- */
-public String toString() {
- return getClass().getName() + "(id=" + getId() + ")";//$NON-NLS-2$//$NON-NLS-1$
-}
-/**
- * The default implementation of this <code>IContributionItem</code>
- * method does nothing. Subclasses may override.
- */
-public void update() {
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void setParent(IContributionManager parent) {
- this.parent = parent;
-}
-/**
- * The <code>ContributionItem</code> implementation of this
- * method declared on <code>IContributionItem</code> does nothing.
- * Subclasses should override to update their state.
- */
-public void update(String id) {
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionManager.java
deleted file mode 100644
index 896b0ca..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionManager.java
+++ /dev/null
@@ -1,334 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-/**
- * Abstract base class for all contribution managers, and standard implementation
- * of <code>IContributionManager</code>. This class provides functionality
- * common across the specific managers defined by this framework.
- * <p>
- * This class maintains a list of contribution items and a dirty flag, both as
- * internal state. In addition to providing implementations of most
- * <code>IContributionManager</code> methods, this class automatically
- * coalesces adjacent separators, hides beginning and ending separators,
- * and deals with dynamically changing sets of contributions. When the set
- * of contributions does change dynamically, the changes are propagated
- * to the control via the <code>update</code> method, which subclasses
- * must implement.
- * </p>
- * <p>
- * Note: A <code>ContributionItem</code> cannot be shared between different
- * <code>ContributionManager</code>s.
- * </p>
- */
-public abstract class ContributionManager implements IContributionManager {
-
- // Internal debug flag.
-// protected static final boolean DEBUG = false;
-
- /**
- * The list of contribution items.
- */
- private List contributions = new ArrayList();
-
- /**
- * Indicates whether the widgets are in sync with the contributions.
- */
- private boolean isDirty = true;
-
- /**
- * Number of dynamic contribution items.
- */
- private int dynamicItems = 0;
-
- /**
- * The overrides for items of this manager
- */
- private IContributionManagerOverrides overrides;
-
-/**
- * Creates a new contribution manager.
- */
-protected ContributionManager() {
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void add(IAction action) {
- add(new ActionContributionItem(action));
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void add(IContributionItem item) {
- item.setParent(this);
- contributions.add(item);
- itemAdded(item);
-}
-/**
- * Adds a contribution item to the start or end of the group
- * with the given name.
- *
- * @param groupName the name of the group
- * @param item the contribution item
- * @param append <code>true</code> to add to the end of the group,
- * and <code>false</code> to add the beginning of the group
- * @exception IllegalArgumentException if there is no group with
- * the given name
- */
-private void addToGroup(String groupName, IContributionItem item, boolean append)
-{
- int i;
- item.setParent(this);
- Iterator items = contributions.iterator();
- for (i = 0; items.hasNext(); i++) {
- IContributionItem o = (IContributionItem) items.next();
- if (o.isGroupMarker()) {
- String id = o.getId();
- if (id != null && id.equalsIgnoreCase(groupName)) {
- i++;
- if (append) {
- for (; items.hasNext(); i++) {
- IContributionItem ci = (IContributionItem) items.next();
- if (ci.isGroupMarker())
- break;
- }
- }
- contributions.add(i,item);
- itemAdded(item);
- return;
- }
- }
- }
- throw new IllegalArgumentException("Group not found: " + groupName);//$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void appendToGroup(String groupName, IAction action) {
- addToGroup(groupName, new ActionContributionItem(action), true);
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void appendToGroup(String groupName, IContributionItem item) {
- addToGroup(groupName, item, true);
-}
-/**
- * Internal debug method for printing statistics about this manager
- * to <code>System.out</code>.
- */
-protected void dumpStatistics() {
- int size= 0;
- if (contributions != null)
- size = contributions.size();
-
- System.out.println(this.toString());
- System.out.println(" Number of elements: " + size);//$NON-NLS-1$
- int sum= 0;
- for (int i= 0; i < size; i++)
- if (((IContributionItem) contributions.get(i)).isVisible())
- sum++;
- System.out.println(" Number of visible elements: " + sum);//$NON-NLS-1$
- System.out.println(" Is dirty: " + isDirty()); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionItem find(String id) {
- Iterator e= contributions.iterator();
- while (e.hasNext()) {
- IContributionItem item= (IContributionItem) e.next();
- String itemId= item.getId();
- if (itemId != null && itemId.equalsIgnoreCase(id))
- return item;
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionItem[] getItems() {
- IContributionItem[] items = new IContributionItem[contributions.size()];
- contributions.toArray(items);
- return items;
-}
-/**
- * The <code>ContributionManager</code> implemenatation of this
- * method declared on <code>IContributionManager</code> returns
- * the current overrides. If there is no overrides it lazily creates
- * one which overrides no item state.
- *
- * @since 2.0
- */
-public IContributionManagerOverrides getOverrides() {
- if (overrides == null) {
- overrides = new IContributionManagerOverrides() {
- public Boolean getEnabled(IContributionItem item) {
- return null;
- }
- public Integer getAccelerator(IContributionItem item) {
- return null;
- }
- public String getAcceleratorText(IContributionItem item) {
- return null;
- }
- public String getText(IContributionItem item) {
- return null;
- }
- };
- }
- return overrides;
-}
-/**
- * Returns whether this contribution manager contains dynamic items.
- * A dynamic contribution item contributes items conditionally,
- * dependent on some internal state.
- *
- * @return <code>true</code> if this manager contains dynamic items, and
- * <code>false</code> otherwise
- */
-protected boolean hasDynamicItems() {
- return (dynamicItems > 0);
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void insertAfter(String ID, IAction action) {
- insertAfter(ID, new ActionContributionItem(action));
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void insertAfter(String ID, IContributionItem item) {
- IContributionItem ci= find(ID);
- if (ci == null)
- throw new IllegalArgumentException("can't find ID");//$NON-NLS-1$
- int ix= contributions.indexOf(ci);
- if (ix >= 0) {
- // System.out.println("insert after: " + ix);
- item.setParent(this);
- contributions.add(ix+1,item);
- itemAdded(item);
- }
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void insertBefore(String ID, IAction action) {
- insertBefore(ID, new ActionContributionItem(action));
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void insertBefore(String ID, IContributionItem item) {
- IContributionItem ci= find(ID);
- if (ci == null)
- throw new IllegalArgumentException("can't find ID");//$NON-NLS-1$
- int ix = contributions.indexOf(ci);
- if (ix >= 0) {
- // System.out.println("insert before: " + ix);
- item.setParent(this);
- contributions.add(ix,item);
- itemAdded(item);
- }
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public boolean isDirty() {
- return isDirty || hasDynamicItems();
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public boolean isEmpty() {
- return contributions.isEmpty();
-}
-/**
- * The given item was added to the list of contributions.
- * Marks the manager as dirty and updates the number of dynamic items, and the memento.
- */
-protected void itemAdded(IContributionItem item) {
- markDirty();
- if (item.isDynamic())
- dynamicItems++;
-}
-/**
- * The given item was removed from the list of contributions.
- * Marks the manager as dirty and updates the number of dynamic items.
- */
-protected void itemRemoved(IContributionItem item) {
- markDirty();
- if (item.isDynamic())
- dynamicItems--;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void markDirty() {
- setDirty(true);
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void prependToGroup(String groupName, IAction action) {
- addToGroup(groupName, new ActionContributionItem(action), false);
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void prependToGroup(String groupName, IContributionItem item) {
- addToGroup(groupName, item, false);
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionItem remove(String ID) {
- IContributionItem ci= find(ID);
- if (ci == null)
- throw new IllegalArgumentException("can't find ID");//$NON-NLS-1$
- return remove(ci);
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionItem remove(IContributionItem item) {
- if (contributions.remove(item)) {
- itemRemoved(item);
- return item;
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void removeAll() {
- contributions.clear();
- dynamicItems = 0;
- markDirty();
-}
-/**
- * Sets whether this manager is dirty. When dirty, the list of contributions
- * is not accurately reflected in the corresponding widgets.
- *
- * @param <code>true</code> if this manager is dirty, and <code>false</code>
- * if it is up-to-date
- */
-protected void setDirty(boolean d) {
- isDirty = d;
-}
-/**
- * Sets the overrides for this contribution manager
- *
- * @param newOverrides the overrides for the items of this manager
- * @since 2.0
- */
-public void setOverrides(IContributionManagerOverrides newOverrides) {
- overrides = newOverrides;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ControlContribution.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ControlContribution.java
deleted file mode 100644
index 51f883b..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ControlContribution.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-
-/**
- * An abstract contribution item implementation for adding an arbitrary
- * SWT control to a tool bar.
- * Note, however, that these items cannot be contributed to menu bars.
- * <p>
- * The <code>createControl</code> framework method must be implemented
- * by concrete subclasses.
- * </p>
- */
-public abstract class ControlContribution extends ContributionItem {
-/**
- * Creates a control contribution item with the given id.
- *
- * @param id the contribution item id
- */
-protected ControlContribution(String id) {
- super(id);
-}
-/**
- * Computes the width of the given control which is being added
- * to a tool bar. This is needed to determine the width of the tool bar item
- * containing the given control.
- * <p>
- * The default implementation of this framework method returns
- * <code>control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x</code>.
- * Subclasses may override if required.
- * </p>
- *
- * @param control the control being added
- * @return the width of the control
- */
-protected int computeWidth(Control control) {
- return control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x;
-}
-/**
- * Creates and returns the control for this contribution item
- * under the given parent composite.
- * <p>
- * This framework method must be implemented by concrete
- * subclasses.
- * </p>
- *
- * @param parent the parent composite
- * @return the new control
- */
-protected abstract Control createControl(Composite parent);
-/**
- * The control item implementation of this <code>IContributionItem</code>
- * method calls the <code>createControl</code> framework method.
- * Subclasses must implement <code>createControl</code> rather than
- * overriding this method.
- */
-public final void fill(Composite parent) {
- createControl(parent);
-}
-/**
- * The control item implementation of this <code>IContributionItem</code>
- * method throws an exception since controls cannot be added to menus.
- */
-public final void fill(Menu parent, int index) {
- Assert.isTrue(false, "Can't add a control to a menu");//$NON-NLS-1$
-}
-/**
- * The control item implementation of this <code>IContributionItem</code>
- * method calls the <code>createControl</code> framework method to
- * create a control under the given parent, and then creates
- * a new tool item to hold it.
- * Subclasses must implement <code>createControl</code> rather than
- * overriding this method.
- */
-public final void fill(ToolBar parent, int index) {
- Control control = createControl(parent);
- ToolItem ti = new ToolItem(parent, SWT.SEPARATOR, index);
- ti.setControl(control);
- ti.setWidth(computeWidth(control));
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/GroupMarker.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/GroupMarker.java
deleted file mode 100644
index 9511991..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/GroupMarker.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-
-/**
- * A group marker is a special kind of contribution item denoting
- * the beginning of a group. These groups are used to structure
- * the list of items. Unlike regular contribution items and
- * separators, group markers have no visual representation.
- * The name of the group is synonymous with the contribution item id.
- * <p>
- * This class may be instantiated; it is not intended to be
- * subclassed outside the framework.
- * </p>
- */
-public class GroupMarker extends AbstractGroupMarker {
-/**
- * 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.
- *
- * @param groupName the name of the group
- */
-public GroupMarker(String groupName) {
- super(groupName);
-}
-/**
- * The <code>GroupMarker</code> implementation of this method
- * returns <code>false</code> since group markers are always invisible.
- */
-public boolean isVisible() {
- return false;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IAction.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IAction.java
deleted file mode 100644
index a7f0f7c..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IAction.java
+++ /dev/null
@@ -1,410 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.Event;
-
-/**
- * An action represents the non-UI side of a command which can be triggered
- * by the end user. Actions are typically associated with buttons, menu items,
- * and items in tool bars. The controls for a command are built by some container,
- * which furnished the context where these controls appear and configures
- * them with data from properties declared by the action. When the end user
- * triggers the command via its control, the action's <code>run</code>
- * method is invoked to do the real work.
- * <p>
- * Actions support a predefined set of properties (and possibly others as well).
- * Clients of an action may register property change listeners so that they get
- * notified whenever the value of a property changes.
- * </p>
- * <p>
- * Clients should subclass the abstract base class <code>Action</code> to define
- * concrete actions rather than implementing <code>IAction</code> from scratch.
- * </p>
- * <p>
- * This interface exists only to define the API for actions.
- * It is not intended to be implemented by clients.
- * </p>
- *
- * @see Action
- */
-public interface IAction {
-
- /**
- * Action style constant (value <code>1</code>) indicating action is
- * a simple push button.
- */
- public static int AS_PUSH_BUTTON = 0x01;
-
- /**
- * Action style constant (value <code>2</code>) indicating action is
- * a check box.
- */
- public static int AS_CHECK_BOX = 0x02;
-
- /**
- * Action style constant (value <code>4</code>) indicating action is
- * a drop down menu.
- */
- public static int AS_DROP_DOWN_MENU = 0x04;
-
- /**
- * Property name of an action's text (value <code>"text"</code>).
- */
- public static final String TEXT= "text"; //$NON-NLS-1$
-
-
- /**
- * Property name of an action's enabled state
- * (value <code>"enabled"</code>).
- */
- public static final String ENABLED= "enabled"; //$NON-NLS-1$
-
-
- /**
- * Property name of an action's image (value <code>"image"</code>).
- */
- public static final String IMAGE= "image"; //$NON-NLS-1$
-
- /**
- * Property name of an action's tooltip text (value <code>"toolTipText"</code>).
- */
- public static final String TOOL_TIP_TEXT= "toolTipText"; //$NON-NLS-1$
-
-
- /**
- * Property name of an action's description (value <code>"description"</code>).
- * Typically the description is shown as a (longer) help text in the status line.
- */
- public static final String DESCRIPTION= "description"; //$NON-NLS-1$
-
- /**
- * Property name of an action's checked status (value <code>"checked"</code>).
- */
- public static final String CHECKED= "checked"; //$NON-NLS-1$
-
-/**
- * Adds a property change listener to this action.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a property change listener
- */
-public void addPropertyChangeListener(IPropertyChangeListener listener);
-/**
- * Returns the accelerator keycode for this action.
- * The result is the bit-wise OR of zero or more modifier masks
- * and a key, as explained in <code>MenuItem.getAccelerator</code>.
- *
- * @return the accelerator keycode
- * @see org.eclipse.swt.widgets.MenuItem#getAccelerator
- */
-public int getAccelerator();
-/**
- * Returns the action definition id of this action.
- *
- * @return the action definition id of this action, or
- * <code>null</code> if none
- * @since 2.0
- */
-public String getActionDefinitionId();
-/**
- * Returns the action's description if it has one.
- * Otherwise it returns <code>getToolTipText()</code>.
- */
-public String getDescription();
-/**
- * Returns the disabled image for this action as an image descriptor.
- * <p>
- * This method is associated with the <code>IMAGE</code> property;
- * property change events are reported when its value changes.
- * </p>
- *
- * @return the image, or <code>null</code> if this action has no image
- * @see #IMAGE
- */
-public ImageDescriptor getDisabledImageDescriptor();
-/**
- * Returns a help listener for this action.
- *
- * @return a help listener for this action
- */
-public HelpListener getHelpListener();
-/**
- * Returns the hover image for this action as an image descriptor.
- * <p>
- * Hover images will be used on platforms that support changing the image
- * when the user hovers over the item. This method is associated with
- * the <code>IMAGE</code> property;
- * property change events are reported when its value changes.
- * </p>
- *
- * @return the image, or <code>null</code> if this action has no image
- * @see #IMAGE
- */
-public ImageDescriptor getHoverImageDescriptor();
-/**
- * Returns a unique identifier for this action, or <code>null</code> if it has
- * none.
- *
- * @return the action id, or <code>null</code> if none
- */
-public String getId();
-/**
- * Returns the image for this action as an image descriptor.
- * <p>
- * This method is associated with the <code>IMAGE</code> property;
- * property change events are reported when its value changes.
- * </p>
- *
- * @return the image, or <code>null</code> if this action has no image
- * @see #IMAGE
- */
-public ImageDescriptor getImageDescriptor();
-/**
- * Returns the menu creator for this action.
- *
- * @return the menu creator, or <code>null</code> if none
- */
-public IMenuCreator getMenuCreator();
-/**
- * Return this action's style.
- *
- * @return one of <code>AS_PUSH_BUTTON</code>, <code>AS_CHECK_BOX</code>,
- * and <code>AS_DROP_DOWN</code>.
- */
-public int getStyle();
-/**
- * Returns the text for this action.
- * <p>
- * This method is associated with the <code>TEXT</code> property;
- * property change events are reported when its value changes.
- * </p>
- *
- * @return the text, or <code>null</code> if none
- * @see #TEXT
- */
-public String getText();
-/**
- * Returns the tool tip text for this action.
- * <p>
- * This method is associated with the <code>TOOL_TIP_TEXT</code> property;
- * property change events are reported when its value changes.
- * </p>
- *
- * @return the tool tip text, or <code>null</code> if none
- * @see #TOOL_TIP_TEXT
- */
-public String getToolTipText();
-/**
- * Returns the checked status of this action.
- * <p>
- * This method is associated with the <code>CHECKED</code> property;
- * property change events are reported when its value changes.
- * </p>
- *
- * @return the checked status
- * @see #CHECKED
- */
-public boolean isChecked();
-/**
- * Returns whether this action is enabled.
- * <p>
- * This method is associated with the <code>ENABLED</code> property;
- * property change events are reported when its value changes.
- * </p>
- *
- * @return <code>true</code> if enabled, and
- * <code>false</code> if disabled
- * @see #ENABLED
- */
-public boolean isEnabled();
-/**
- * Removes the given listener from this action.
- * Has no effect if an identical listener is not registered.
- *
- * @param listener a property change listener
- */
-public void removePropertyChangeListener(IPropertyChangeListener listener);
-
-/**
- * Runs this action.
- * Each action implementation must define the steps needed to carry out this action.
- * The default implementation of this method in <code>Action</code>
- * does nothing.
- */
-public void run();
-
-/**
- * Runs this action, passing the triggering SWT event.
- * As of 2.0, <code>ActionContributionItem</code> calls this method
- * instead of <code>run()</code>.
- * The default implementation of this method in <code>Action</code>
- * simply calls <code>run()</code> for backwards compatibility.
- *
- * NOTE: This is experimental API, which may change in the future.
- *
- * @param event the SWT event which triggered this action being run
- * @since 2.0
- */
-public void runWithEvent(Event event);
-
-/**
- * Sets the action definition id of this action.
- *
- * @param id the action definition id
- * @since 2.0
- */
-public void setActionDefinitionId(String id);
-/**
- * Sets the checked status of this action.
- * <p>
- * Fires a property change event for the <code>CHECKED</code> property
- * if the checked status actually changes as a consequence.
- * </p>
- *
- * @param checked the new checked status
- * @see #CHECKED
- */
-public void setChecked(boolean checked);
-/**
- * Sets this action's description.
- * Typically the description is shown as a (longer) help text in the status line.
- * <p>
- * Fires a property change event for the <code>DESCRIPTION</code> property
- * if the description actually changes as a consequence.
- * </p>
- *
- * @param text the description, or <code>null</code> to clear the description
- * @see #DESCRIPTION
- */
-public void setDescription(String text);
-/**
- * Sets the disabled image for this action, as an image descriptor.
- * <p>
- * Disabled images will be used on platforms that support changing the image
- * when the item is disabled.Fires a property change event for
- * the <code>IMAGE</code> property
- * if the image actually changes as a consequence.
- * </p>
- *
- * @param newImage the image, or <code>null</code> if this
- * action should not have an image
- * @see #IMAGE
- */
-public void setDisabledImageDescriptor(ImageDescriptor newImage);
-/**
- * Sets the enabled state of this action.
- * <p>
- * When an action is in the enabled state, the control associated with
- * it is active; triggering it will end up inkoking this action's
- * <code>run</code> method.
- * </p>
- * <p>
- * Fires a property change event for the <code>ENABLED</code> property
- * if the enabled state actually changes as a consequence.
- * </p>
- *
- * @param enabled <code>true</code> to enable, and
- * <code>false</code> to disable
- * @see #ENABLED
- */
-public void setEnabled(boolean enabled);
-/**
- * Sets a help listener for this action.
- *
- * @param listener a help listener for this action
- */
-public void setHelpListener(HelpListener listener);
-/**
- * Sets the hover image for this action, as an image descriptor.
- * <p>
- * Hover images will be used on platforms that support changing the image
- * when the user hovers over the item.Fires a property change event for
- * the <code>IMAGE</code> property
- * if the image actually changes as a consequence.
- * </p>
- *
- * @param newImage the image, or <code>null</code> if this
- * action should not have an image
- * @see #IMAGE
- */
-public void setHoverImageDescriptor(ImageDescriptor newImage);
-/**
- * Sets the unique identifier for this action. This is used to identify actions
- * when added to a contribution manager.
- * It should be set when the action is created. It should not be modified once
- * the action is part of an action contribution item.
- *
- * @param id the action id
- *
- * @see ActionContributionItem
- * @see IContributionItem#getId
- */
-public void setId(String id);
-/**
- * Sets the image for this action, as an image descriptor.
- * <p>
- * Fires a property change event for the <code>IMAGE</code> property
- * if the image actually changes as a consequence.
- * </p>
- *
- * @param newImage the image, or <code>null</code> if this
- * action should not have an image
- * @see #IMAGE
- */
-public void setImageDescriptor(ImageDescriptor newImage);
-/**
- * Sets the menu creator for this action.
- * <p>
- * Note that if this method is called, it overrides the check status.
- * </p>
- *
- * @param creator the menu creator, or <code>null</code> if none
- */
-public void setMenuCreator(IMenuCreator creator);
-/**
- * Sets the text for this action.
- * <p>
- * An accelerator specification may follow the actual text, separated from it by
- * an '@' or a '\t' character. An accelerator specification consists of zero or more
- * modifier tokens followed by a key code token. The tokens are separated by a '+' character.
- * </p>
- * <p>
- * Fires a property change event for the <code>TEXT</code> property
- * if the text actually changes as a consequence.
- * </p>
- *
- * @param text the text, or <code>null</code> if none
- * @see #TEXT
- * @see Action#findModifier
- * @see Action#findKeyCode
- */
-public void setText(String text);
-/**
- * Sets the tool tip text for this action.
- * <p>
- * Fires a property change event for the <code>TOOL_TIP_TEXT</code> property
- * if the tool tip text actually changes as a consequence.
- * </p>
- *
- * @param text the tool tip text, or <code>null</code> if none
- * @see #TOOL_TIP_TEXT
- */
-public void setToolTipText(String text);
-
-/**
- * Sets the accelerator keycode that this action maps to.
- * This is a bitwise OR of zero or more SWT key modifier masks
- * (i.e. SWT.CTRL or SWT.ALT) and a character code.
- * For example, for Ctrl+Z, use <code>SWT.CTRL | 'Z'</code>.
- * Use 0 for no accelerator.
- *
- * @param int the keycode to be accepted.
- */
-public void setAccelerator(int keycode);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionItem.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionItem.java
deleted file mode 100644
index 892a5b1..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionItem.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.*;
-
-/**
- * A contribution item represents a contribution to a shared UI resource such as a
- * menu or tool bar. More generally, contribution items are managed by a contribution
- * manager.
- * For instance, in a tool bar a contribution item is a tool bar button or a separator.
- * In a menu bar a contribution item is a menu, and in a menu a contribution item
- * is a menu item or separator.
- * <p>
- * A contribution item can realize itself in different SWT widgets, using the different
- * <code>fill</code> methods. The same type of contribution item can be used with a
- * <code>MenuBarManager</code>, <code>ToolBarManager</code>, or a <code>StatusLineManager</code>.
- * </p>
- * <p>
- * This interface is internal to the framework; it should not be implemented outside
- * the framework.
- * </p>
- *
- * @see IContributionManager
- */
-public interface IContributionItem {
-
-/**
- * Fills the given composite control with controls representing this
- * contribution item. Used by <code>StatusLineManager</code>.
- *
- * @param parent the parent control
- */
-public void fill(Composite parent);
-/**
- * Fills the given menu with controls representing this contribution item.
- * Used by <code>MenuManager</code>.
- *
- * @param parent the parent menu
- * @param index the index where the controls are inserted,
- * or <code>-1</code> to insert at the end
- */
-public void fill(Menu parent, int index);
-/**
- * Fills the given tool bar with controls representing this contribution item.
- * Used by <code>ToolBarManager</code>.
- *
- * @param parent the parent tool bar
- * @param index the index where the controls are inserted,
- * or <code>-1</code> to insert at the end
- */
-public void fill(ToolBar parent, int index);
-/**
- * Returns the identifier of this contribution item.
- * The id is used for retrieving an item from its manager.
- *
- * @return the contribution item identifier, or <code>null</code>
- * if none
- */
-public String getId();
-/**
- * Returns whether this contribution item is dynamic. A dynamic contribution
- * item contributes items conditionally, dependent on some internal state.
- *
- * @return <code>true</code> if this item is dynamic, and
- * <code>false</code> for normal items
- */
-public boolean isDynamic();
-/**
- * Returns whether this contribution item is a group marker.
- * This information is used when adding items to a group.
- *
- * @return <code>true</code> if this item is a group marker, and
- * <code>false</code> for normal items
- *
- * @see GroupMarker
- * @see IContributionManager#appendToGroup
- * @see IContributionManager#prependToGroup
- */
-public boolean isGroupMarker();
-/**
- * Returns whether this contribution item is a separator.
- * This information is used to enable hiding of unnecessary separators.
- *
- * @return <code>true</code> if this item is a separator, and
- * <code>false</code> for normal items
- * @see Separator
- */
-public boolean isSeparator();
-/**
- * Returns whether this contribution item is visibile within its manager.
- *
- * @return <code>true</code> if this item is visible, and
- * <code>false</code> otherwise
- */
-public boolean isVisible();
-/**
- * Sets the parent manager of this item
- *
- * @param parent the parent contribution manager
- * @since 2.0
- */
-public void setParent(IContributionManager parent);
-/**
- * Sets whether this contribution item is visibile within its manager.
- *
- * @param visible <code>true</code> if this item should be visible, and
- * <code>false</code> otherwise
- */
-public void setVisible(boolean visible);
-/**
- * Updates any SWT controls cached by this contribution item with any
- * changes which have been made to this contribution item since the last update.
- * Called by contribution manager update methods.
- */
-public void update();
-/**
- * Updates any SWT controls cached by this contribution item with changes
- * for the the given property.
- *
- * @param String id the di of the changed property
- * @since 2.0
- */
-public void update(String id);
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManager.java
deleted file mode 100644
index b20d38e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManager.java
+++ /dev/null
@@ -1,205 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-/**
- * A contribution manager organizes contributions to such UI components
- * as menus, toolbars and status lines.
- * <p>
- * A contribution manager keeps track of a list of contribution
- * items. Each contribution item may has an optional identifier, which can be used
- * to retrieve items from a manager, and for positioning items relative to
- * each other. The list of contribution items can be subdivided into named groups
- * using special contribution items that serve as group markers.
- * </p>
- * <p>
- * The <code>IContributionManager</code> interface provides general
- * protocol for adding, removing, and retrieving contribution items.
- * It also provides convenience methods that make it convenient
- * to contribute actions. This interface should be implemented
- * by all objects that wish to manage contributions.
- * </p>
- * <p>
- * There are several implementions of this interface in this package,
- * including ones for menus ({@link MenuManager <code>MenuManager</code>}),
- * tool bars ({@link ToolBarManager <code>ToolBarManager</code>}),
- * and status lines ({@link StatusLineManager <code>StatusLineManager</code>}).
- * </p>
- */
-public interface IContributionManager {
-/**
- * Adds an action as a contribution item to this manager.
- * Equivalent to <code>add(new ActionContributionItem(action))</code>.
- *
- * @param action the action
- */
-public void add(IAction action);
-/**
- * Adds a contribution item to this manager.
- *
- * @param item the contribution item
- */
-public void add(IContributionItem item);
-/**
- * Adds a contribution item for the given action at the end of the group
- * with the given name.
- * Equivalent to
- * <code>appendToGroup(groupName,new ActionContributionItem(action))</code>.
- *
- * @param groupName the name of the group
- * @param action the action
- * @exception IllegalArgumentException if there is no group with
- * the given name
- */
-public void appendToGroup(String groupName, IAction action);
-/**
- * Adds a contribution item to this manager at the end of the group
- * with the given name.
- *
- * @param groupName the name of the group
- * @param item the contribution item
- * @exception IllegalArgumentException if there is no group with
- * the given name
- */
-public void appendToGroup(String groupName, IContributionItem item);
-/**
- * Finds the contribution item with the given id.
- *
- * @param id the contribution item id
- * @return the contribution item, or <code>null</code> if
- * no item with the given id can be found
- */
-public IContributionItem find(String id);
-/**
- * Returns all contribution items known to this manager.
- *
- * @return a list of contribution items
- */
-public IContributionItem[] getItems();
-/**
- * Returns the overrides for the items of this manager.
- *
- * @return the overrides for the items of this manager
- * @since 2.0
- */
-public IContributionManagerOverrides getOverrides();
-/**
- * Inserts a contribution item for the given action after the item
- * with the given id.
- * Equivalent to
- * <code>insertAfter(id,new ActionContributionItem(action))</code>.
- *
- * @param id the contribution item id
- * @param action the action to insert
- * @exception IllegalArgumentException if there is no item with
- * the given id
- */
-public void insertAfter(String id, IAction action);
-/**
- * Inserts a contribution item after the item with the given id.
- *
- * @param id the contribution item id
- * @param item the contribution item to insert
- * @exception IllegalArgumentException if there is no item with
- * the given id
- */
-public void insertAfter(String ID, IContributionItem item);
-/**
- * Inserts a contribution item for the given action before the item
- * with the given id.
- * Equivalent to
- * <code>insertBefore(id,new ActionContributionItem(action))</code>.
- *
- * @param id the contribution item id
- * @param action the action to insert
- * @exception IllegalArgumentException if there is no item with
- * the given id
- */
-public void insertBefore(String id, IAction action);
-/**
- * Inserts a contribution item before the item with the given id.
- *
- * @param id the contribution item id
- * @param item the contribution item to insert
- * @exception IllegalArgumentException if there is no item with
- * the given id
- */
-public void insertBefore(String ID, IContributionItem item);
-/**
- * Returns whether the list of contributions has recently changed and
- * has yet to be reflected in the corresponding widgets.
- *
- * @return <code>true</code> if this manager is dirty, and <code>false</code>
- * if it is up-to-date
- */
-public boolean isDirty();
-/**
- * Returns whether this manager has any contribution items.
- *
- * @return <code>true</code> if there are no items, and
- * <code>false</code> otherwise
- */
-public boolean isEmpty();
-/**
- * Marks this contribution manager as dirty.
- */
-public void markDirty();
-/**
- * Adds a contribution item for the given action at the beginning of the
- * group with the given name.
- * Equivalent to
- * <code>prependToGroup(groupName,new ActionContributionItem(action))</code>.
- *
- * @param groupName the name of the group
- * @param action the action
- * @exception IllegalArgumentException if there is no group with
- * the given name
- */
-public void prependToGroup(String groupName, IAction action);
-/**
- * Adds a contribution item to this manager at the beginning of the
- * group with the given name.
- *
- * @param groupName the name of the group
- * @param item the contribution item
- * @exception IllegalArgumentException if there is no group with
- * the given name
- */
-public void prependToGroup(String groupName, IContributionItem item);
-/**
- * Removes and returns the contribution item with the given id from this manager.
- * Returns <code>null</code> if this manager has no contribution items
- * with the given id.
- *
- * @param id the contribution item id
- * @return the item that was found and removed, or <code>null</code> if none
- */
-public IContributionItem remove(String id);
-/**
- * Removes the given contribution item from the contribution items
- * known to this manager.
- *
- * @param item the contribution item
- * @return the <code>item</code> parameter if the item was removed,
- * and <code>null</code> if it was not found
- */
-public IContributionItem remove(IContributionItem item);
-/**
- * Removes all contribution items from this manager.
- */
-public void removeAll();
-/**
- * Updates this manager's underlying widget(s) with any changes which
- * have been made to it or its items. Normally changes to a contribution
- * manager merely mark it as dirty, without updating the underlying widgets.
- * This brings the underlying widgets up to date with any changes.
- *
- * @param force <code>true</code> means update even if not dirty,
- * and <code>false</code> for normal incremental updating
- */
-public void update(boolean force);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManagerOverrides.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManagerOverrides.java
deleted file mode 100644
index f251f63..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManagerOverrides.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-/**
- * This interface is used by instances of <code>IContributionItem</code>
- * to determine if the values for certain properties have been overriden
- * by their manager.
- * <p>
- * This interface is internal to the framework; it should not be implemented outside
- * the framework.
- * </p>
- *
- * @since 2.0
- */
-public interface IContributionManagerOverrides {
- /**
- * Id for the enabled property. Value is <code>"enabled"</code>.
- *
- * @since 2.0
- */
- public final static String P_ENABLED = "enabled"; //$NON-NLS-1$
-
- /**
- * Returns <code>Boolean.TRUE</code> if the given contribution item should
- * be enabled, <code>Boolean.FALSE</code> if the item should be disabled, and
- * <code>null</code> if the item may determine its own enablement.
- *
- * @param the contribution item for which the enable override value is
- * determined
- * @since 2.0
- */
- public Boolean getEnabled(IContributionItem item);
-
- public Integer getAccelerator(IContributionItem item);
- public String getAcceleratorText(IContributionItem item);
- public String getText(IContributionItem item);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuCreator.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuCreator.java
deleted file mode 100644
index d872518..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuCreator.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * Interface for something that creates and disposes of SWT menus.
- */
-public interface IMenuCreator {
-/**
- * Disposes the menu returned by <code>getMenu</code>. Does nothing
- * if there is no menu.
- */
-public void dispose();
-/**
- * Returns the SWT menu, created as a pop up menu parented by the
- * given control.
- *
- * @param parent the parent control
- * @return the menu, or <code>null</code> if the menu could not
- * be created
- */
-public Menu getMenu(Control parent);
-/**
- * Returns an SWT menu created as a drop down menu parented by the
- * given menu.
- *
- * @param parent the parent menu
- * @return the menu, or <code>null</code> if the menu could not
- * be created
- */
-public Menu getMenu(Menu parent);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuListener.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuListener.java
deleted file mode 100644
index 4bec69c..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuListener.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A menu listener that gets informed when a menu is about to show.
- *
- * @see MenuManager#addMenuListener
- */
-public interface IMenuListener {
-/**
- * Notifies this listener that the menu is about to be shown by
- * the given menu manager.
- *
- * @param manager the menu manager
- */
-public void menuAboutToShow(IMenuManager manager);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuManager.java
deleted file mode 100644
index 5d763e4..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuManager.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-/**
- * The <code>IMenuManager</code> interface provides protocol for managing
- * contributions to a menu bar and its sub menus.
- * An <code>IMenuManager</code> is also an <code>IContributionItem</code>,
- * allowing sub-menus to be nested in parent menus.
- * <p>
- * This interface is internal to the framework; it should not be implemented outside
- * the framework.
- * </p>
- * <p>
- * This package provides a concrete menu manager implementation,
- * {@link MenuManager <code>MenuManager</code>}.
- * </p>
- */
-public interface IMenuManager extends IContributionManager, IContributionItem {
-/**
- * Adds a menu listener to this menu.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a menu listener
- */
-public void addMenuListener(IMenuListener listener);
-/**
- * Finds the manager for the menu at the given path. A path
- * consists of contribution item ids separated by the separator
- * character. The path separator character is <code>'/'</code>.
- * <p>
- * Convenience for <code>findUsingPath(path)</code> which
- * extracts an <code>IMenuManager</code> if possible.
- * </p>
- *
- * @param path the path string
- * @return the menu contribution item, or <code>null</code>
- * if there is no such contribution item or if the item does
- * not have an associated menu manager
- */
-public IMenuManager findMenuUsingPath(String path);
-/**
- * Finds the contribution item at the given path. A path
- * consists of contribution item ids separated by the separator
- * character. The path separator character is <code>'/'</code>.
- *
- * @param path the path string
- * @return the contribution item, or <code>null</code> if there is no
- * such contribution item
- */
-public IContributionItem findUsingPath(String path);
-/**
- * Returns whether all items should be removed when the menu is first shown,
- * but before notifying menu listeners. The default is <code>false</code>.
- *
- * @return <code>true</code> if all items should be removed when shown, <code>false</code> if not
- */
-public boolean getRemoveAllWhenShown();
-/**
- * Returns whether this menu should be enabled or not.
- *
- * @return <code>true</code> if enabled, and
- * <code>false</code> if disabled
- */
-public boolean isEnabled();
-/**
- * Removes the given menu listener from this menu.
- * Has no effect if an identical listener is not registered.
- *
- * @param listener the menu listener
- */
-public void removeMenuListener(IMenuListener listener);
-/**
- * Sets whether all items should be removed when the menu is first shown,
- * but before notifying menu listeners.
- *
- * @param removeAll <code>true</code> if all items should be removed when shown, <code>false</code> if not
- */
-public void setRemoveAllWhenShown(boolean removeAll);
-/**
- * Incrementally builds the menu from the contribution items, and
- * does so recursively for all submenus.
- *
- * @param force <code>true</code> means update even if not dirty,
- * and <code>false</code> for normal incremental updating
- */
-public void updateAll(boolean force);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IToolBarManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IToolBarManager.java
deleted file mode 100644
index 4951eba..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IToolBarManager.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * The <code>IToolBarManager</code> interface provides protocol for managing
- * contributions to a tool bar. It extends <code>IContributionManager</code>
- * but does not declare any new members; it exists only to increase the
- * readability of code using tool bars.
- * <p>
- * This package also provides a concrete tool bar manager implementation,
- * {@link ToolBarManager <code>ToolBarManager</code>}.
- * </p>
- */
-public interface IToolBarManager extends IContributionManager {
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java
deleted file mode 100644
index 8455c26..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java
+++ /dev/null
@@ -1,600 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List; // disambiguate from SWT List
-
-/**
- * A menu manager is a contribution manager which realizes itself and its items
- * in a menu control; either as a menu bar, a sub-menu, or a context menu.
- * <p>
- * This class may be instantiated; it may also be subclassed.
- * </p>
- */
-public class MenuManager extends ContributionManager implements IMenuManager {
-
- /**
- * The menu control; <code>null</code> before
- * creation and after disposal.
- */
- private Menu menu = null;
-
- /**
- * List of registered menu listeners (element type: <code>IMenuListener</code>).
- */
- private ListenerList listeners = new ListenerList(1);
-
- /**
- * The menu id.
- */
- private String id;
-
- /**
- * The menu item widget; <code>null</code> before
- * creation and after disposal. This field is used
- * when this menu manager is a sub-menu.
- */
- private MenuItem menuItem;
-
- /**
- * The text for a sub-menu.
- */
- private String menuText;
-
- /**
- * Indicates whether <code>removeAll</code> should be
- * called just before the menu is displayed.
- */
- private boolean removeAllWhenShown = false;
-
- /**
- * The parent contribution manager.
- */
- private IContributionManager parent;
-
- /**
- * Indicates this item is visible in its manager; <code>true</code>
- * by default.
- */
- private boolean visible = true;
-
- /**
- * The overrides for items of this manager
- */
- private IContributionManagerOverrides overrides;
-
- private static String OLD_ACCELERATOR = "org.eclipse.jface.action.MenuManager.oldAccelerator"; //$NON-NLS-1$
- private static String OLD_LABEL = "org.eclipse.jface.action.MenuManager.oldLabel"; //$NON-NLS-1$
- private static String ACCELERATORS_ALLOWED = "org.eclipse.jface.action.MenuManager.accelerators_allowed"; //$NON-NLS-1$
-
-
-/**
- * Creates a menu manager. The text and id are <code>null</code>.
- * Typically used for creating a context menu, where it doesn't need to be referred to by id.
- */
-public MenuManager() {
- this(null, null);
-}
-/**
- * Creates a menu manager with the given text. The id of the menu
- * is <code>null</code>.
- * Typically used for creating a sub-menu, where it doesn't need to be referred to by id.
- *
- * @param text the text for the menu, or <code>null</code> if none
- */
-public MenuManager(String text) {
- this(text, null);
-}
-/**
- * Creates a menu manager with the given text and id.
- * Typically used for creating a sub-menu, where it needs to be referred to by id.
- *
- * @param text the text for the menu, or <code>null</code> if none
- * @param id the menu id, or <code>null</code> if it is to have no id
- */
-public MenuManager(String text, String id) {
- this.menuText = text;
- this.id = id;
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public void addMenuListener(IMenuListener listener) {
- listeners.add(listener);
-}
-/**
- * Creates and returns an SWT context menu control for this menu,
- * and installs all registered contributions.
- * Does not create a new control if one already exists.
- * <p>
- * Note that the menu is not expected to be dynamic.
- * </p>
- *
- * @param parent the parent control
- * @return the menu control
- */
-public Menu createContextMenu(Control parent) {
- if (!menuExist()) {
- menu = new Menu(parent);
- initializeMenu();
- }
- return menu;
-}
-/**
- * Creates and returns an SWT menu bar control for this menu,
- * for use in the given shell, and installs all registered contributions.
- * Does not create a new control if one already exists.
- *
- * @param parent the parent shell
- * @return the menu control
- */
-public Menu createMenuBar(Shell parent) {
- if (!menuExist()) {
- menu = new Menu(parent, SWT.BAR);
- update(false);
- }
- return menu;
-}
-/**
- * Disposes of this menu manager and frees all allocated SWT resources.
- * Note that this method does not clean up references between this menu
- * manager and its associated contribution items.
- * Use <code>removeAll</code> for that purpose.
- */
-public void dispose() {
- if (menuExist())
- menu.dispose();
- menu = null;
-
- if (menuItem != null) {
- menuItem.dispose();
- menuItem = null;
- }
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void fill(Composite parent) {}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void fill(Menu parent, int index) {
- if (menuItem == null || menuItem.isDisposed()) {
- if (index >= 0)
- menuItem = new MenuItem(parent, SWT.CASCADE, index);
- else
- menuItem = new MenuItem(parent, SWT.CASCADE);
-
- menuItem.setText(menuText);
-
- if (!menuExist())
- menu = new Menu(parent);
-
- menuItem.setMenu(menu);
-
- initializeMenu();
-
- // populate the submenu, in order to enable accelerators
- // and to set enabled state on the menuItem properly
- update(true);
- }
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void fill(ToolBar parent, int index) {}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public IMenuManager findMenuUsingPath(String path) {
- IContributionItem item = findUsingPath(path);
- if (item instanceof IMenuManager)
- return (IMenuManager) item;
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public IContributionItem findUsingPath(String path) {
- String id = path;
- String rest = null;
- int separator = path.indexOf('/');
- if (separator != -1) {
- id = path.substring(0, separator);
- rest = path.substring(separator + 1);
- } else {
- return super.find(path);
- }
-
- IContributionItem item = super.find(id);
- if (item instanceof IMenuManager) {
- IMenuManager manager = (IMenuManager) item;
- return manager.findUsingPath(rest);
- }
- return null;
-}
-/**
- * Notifies any menu listeners that a menu is about to show.
- * Only listeners registered at the time this method is called are notified.
- *
- * @param manager the menu manager
- *
- * @see IMenuListener#menuAboutToShow
- */
-private void fireAboutToShow(IMenuManager manager) {
- Object[] listeners = this.listeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((IMenuListener) listeners[i]).menuAboutToShow(manager);
- }
-}
-/**
- * Returns the menu id.
- * The menu id is used when creating a contribution item
- * for adding this menu as a sub menu of another.
- *
- * @return the menu id
- */
-public String getId() {
- return id;
-}
-/**
- * Returns the SWT menu control for this menu manager.
- *
- * @return the menu control
- */
-public Menu getMenu() {
- return menu;
-}
-/**
- * Returns the text shown in the menu.
- *
- * @return the menu text
- */
-public String getMenuText() {
- return menuText;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionManagerOverrides getOverrides() {
- if (overrides == null) {
- if (parent == null) {
- overrides = new IContributionManagerOverrides() {
- public Boolean getEnabled(IContributionItem item) {
- return null;
- }
- public Integer getAccelerator(IContributionItem item) {
- return null;
- }
- public String getAcceleratorText(IContributionItem item) {
- return null;
- }
- public String getText(IContributionItem item) {
- return null;
- }
- };
- } else {
- overrides = parent.getOverrides();
- }
- super.setOverrides(overrides);
- }
- return overrides;
-}
-
-/**
- * Returns the parent contribution manager of this manger.
- *
- * @return the parent contribution manager
- * @since 2.0
- */
-public IContributionManager getParent() {
- return parent;
-}
-
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public boolean getRemoveAllWhenShown() {
- return removeAllWhenShown;
-}
-/**
- * Notifies all listeners that this menu is about to appear.
- */
-private void handleAboutToShow() {
- if (removeAllWhenShown)
- removeAll();
- fireAboutToShow(this);
- update(false);
-}
-/**
- * Returns whether this menu manager contains an <code>ActionContributionItem</code>
- * that defines an accelerator (short cut).
- *
- * @return <code>true</code> if there are accelerators, and <code>false</code>
- * if not
- */
-private boolean hasAccelerator() {
- IContributionItem[] items = getItems();
- for (int i = 0; i < items.length; ++i) {
- if (items[i] instanceof ActionContributionItem) {
- IAction action = ((ActionContributionItem) items[i]).getAction();
- if (action.getAccelerator() != 0)
- return true;
- }
- }
- return false;
-}
-/**
- * Initializes the menu control.
- */
-private void initializeMenu() {
- menu.addMenuListener(new MenuAdapter() {
- public void menuShown(MenuEvent e) {
- handleAboutToShow();
- }
- public void menuHidden(MenuEvent e) {
-// ApplicationWindow.resetDescription(e.widget);
- }
- });
- markDirty();
- // Don't do an update(true) here, in case menu is never opened.
- // Always do it lazily in handleAboutToShow().
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public boolean isDynamic() {
- return false;
-}
-/**
- * Returns whether this menu should be enabled or not.
- * Used to enable the menu item containing this menu when it is realized as a sub-menu.
- * <p>
- * The default implementation of this framework method
- * returns <code>true</code>. Subclasses may reimplement.
- * </p>
- *
- * @return <code>true</code> if enabled, and
- * <code>false</code> if disabled
- */
-public boolean isEnabled() {
- return true;
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public boolean isGroupMarker() {
- return false;
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public boolean isSeparator() {
- return false;
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public boolean isSubstituteFor(IContributionItem item) {
- return this.equals(item);
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public boolean isVisible() {
- return visible;
-}
-/**
- * Returns whether the menu control is created
- * and not disposed.
- *
- * @return <code>true</code> if the control is created
- * and not disposed, <code>false</code> otherwise
- */
-private boolean menuExist() {
- return menu != null && !menu.isDisposed();
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public void removeMenuListener(IMenuListener listener) {
- listeners.remove(listener);
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public void setRemoveAllWhenShown(boolean removeAll) {
- this.removeAllWhenShown = removeAll;
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void setVisible(boolean visible) {
- this.visible = visible;
-}
-/**
- * Sets the overrides for this contribution manager
- *
- * @param newOverrides the overrides for the items of this manager
- * @since 2.0
- */
-public void setOverrides(IContributionManagerOverrides newOverrides) {
- overrides = newOverrides;
- super.setOverrides(overrides);
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void setParent(IContributionManager manager) {
- parent = manager;
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void update() {
- updateMenuItem();
-}
-/**
- * The <code>MenuManager</code> implementation of this <code>IContributionManager</code>
- * updates this menu, but not any of its submenus.
- *
- * @see #updateAll
- */
-public void update(boolean force) {
- update(force, false);
-}
-public void update(String property) {
- IContributionItem items[] = getItems();
- for (int i = 0; i < items.length; i++) {
- items[i].update(property);
- }
- if(menu != null && (IAction.TEXT.equals(property))) {
- String text = getOverrides().getText(this);
- if(text == null)
- text = menuText;
- if(menu == null || menu.isDisposed())
- return;
- if((text != null) && (menu.getParentItem() != null))
- menu.getParentItem().setText(text);
- }
-}
-/**
- * Incrementally builds the menu from the contribution items.
- * This method leaves out double separators and separators in the first
- * or last position.
- *
- * @param force <code>true</code> means update even if not dirty,
- * and <code>false</code> for normal incremental updating
- * @param recursive <code>true</code> means recursively update
- * all submenus, and <code>false</code> means just this menu
- */
-protected void update(boolean force, boolean recursive) {
- if (isDirty() || force) {
- if (menuExist()) {
- // clean contains all active items without double separators
- IContributionItem[] items= getItems();
- List clean= new ArrayList(items.length);
- IContributionItem separator= null;
- for (int i = 0; i < items.length; ++i) {
- IContributionItem ci= items[i];
- if (!ci.isVisible())
- continue;
- if (ci.isSeparator()) {
- // delay creation until necessary
- // (handles both adjacent separators, and separator at end)
- separator= ci;
- } else {
- if (separator != null) {
- if (clean.size() > 0) // no separator if first item
- clean.add(separator);
- separator= null;
- }
- clean.add(ci);
- }
- }
-
- // remove obsolete (removed or non active)
- Item[] mi= menu.getItems();
- for (int i= 0; i < mi.length; i++) {
- Object data= mi[i].getData();
- if (data == null || !clean.contains(data) ||
- (data instanceof IContributionItem && ((IContributionItem)data).isDynamic()))
- mi[i].dispose();
- }
-
- // add new
- mi= menu.getItems();
- int srcIx= 0;
- int destIx= 0;
- for (Iterator e= clean.iterator(); e.hasNext();) {
- IContributionItem src= (IContributionItem) e.next();
- IContributionItem dest;
-
- // get corresponding item in SWT widget
- if (srcIx < mi.length)
- dest= (IContributionItem) mi[srcIx].getData();
- else
- dest= null;
-
- if (dest != null && src.equals(dest)) {
- srcIx++;
- destIx++;
- } else if (dest != null && dest.isSeparator() && src.isSeparator()) {
- mi[srcIx].setData(src);
- srcIx++;
- destIx++;
- } else {
- int start= menu.getItemCount();
- src.fill(menu, destIx);
- int newItems= menu.getItemCount()-start;
- for (int i= 0; i < newItems; i++) {
- MenuItem item = menu.getItem(destIx++);
- item.setData(src);
- }
- }
-
- // May be we can optimize this call. If the menu has just
- // been created via the call src.fill(fMenuBar, destIx) then
- // the menu has already been updated with update(true)
- // (see MenuManager). So if force is true we do it again. But
- // we can't set force to false since then information for the
- // sub sub menus is lost.
- if (recursive) {
- IContributionItem item = src;
- if (item instanceof SubContributionItem)
- item = ((SubContributionItem)item).getInnerItem();
- if (item instanceof IMenuManager)
- ((IMenuManager)item).updateAll(force);
- }
-
- }
-
- setDirty(false);
-
- updateMenuItem();
- }
- } else {
- // I am not dirty. Check if I must recursivly walk down the hierarchy.
- if (recursive) {
- IContributionItem[] items= getItems();
- for (int i = 0; i < items.length; ++i) {
- IContributionItem ci= items[i];
- if (ci instanceof IMenuManager) {
- IMenuManager mm = (IMenuManager) ci;
- if (mm.isVisible()) {
- mm.updateAll(force);
- }
- }
- }
- }
- }
-// updateAccelerators();
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public void updateAll(boolean force) {
- update(force, true);
-}
-/**
- * Updates the menu item for this sub menu.
- * The menu item is disabled if this sub menu is empty.
- * Does nothing if this menu is not a submenu.
- */
-private void updateMenuItem() {
- if (menuItem != null && !menuItem.isDisposed() && menuExist()) {
- boolean enabled = menu.getItemCount() > 0;
- // Workaround for 1GDDCN2: SWT:Linux - MenuItem.setEnabled() always causes a redraw
- if (menuItem.getEnabled() != enabled)
- menuItem.setEnabled(enabled);
- }
-}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Separator.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Separator.java
deleted file mode 100644
index a3868ff..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Separator.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.util.Assert;
-
-/**
- * A separator is a special kind of contribution item which acts
- * as a visual separator and, optionally, acts as a group marker.
- * Unlike group markers, separators do have a visual representation.
- * <p>
- * This class may be instantiated; it is not intended to be
- * subclassed outside the framework.
- * </p>
- */
-public class Separator extends AbstractGroupMarker {
-/**
- * Creates a separator which does not start a new group.
- */
-public Separator() {
- super();
-}
-/**
- * Creates a new separator which also defines a new group having the given group name.
- * The group name must not be <code>null</code> or the empty string.
- * The group name is also used as the item id.
- *
- * @param groupName the group name of the separator
- */
-public Separator(String groupName) {
- super(groupName);
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- * Fills the given menu with a SWT separator MenuItem.
- */
-public void fill(Menu menu, int index) {
- if (index >= 0)
- new MenuItem(menu, SWT.SEPARATOR, index);
- else
- new MenuItem(menu, SWT.SEPARATOR);
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- * Fills the given tool bar with a SWT separator ToolItem.
- */
-public void fill(ToolBar toolbar, int index) {
- if (index >= 0)
- new ToolItem(toolbar, SWT.SEPARATOR, index);
- else
- new ToolItem(toolbar, SWT.SEPARATOR);
-}
-/**
- * The <code>Separator</code> implementation of this <code>IContributionItem</code>
- * method returns <code>true</code>
- */
-public boolean isSeparator() {
- return true;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionItem.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionItem.java
deleted file mode 100644
index b9b5ab2..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionItem.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.*;
-
-/**
- * A <code>SubContributionItem</code> is a wrapper for an <code>IContributionItem</code>.
- * It is used within a <code>SubContributionManager</code> to control the visibility
- * of items.
- * <p>
- * This class is not intended to be subclassed.
- * </p>
- */
-public class SubContributionItem implements IContributionItem {
- /**
- * The visibility of the item.
- */
- private boolean visible;
-
- /**
- * The inner item for this contribution.
- */
- private IContributionItem innerItem;
-/**
- * Creates a new <code>SubContributionItem</code>.
- */
-public SubContributionItem(IContributionItem item) {
- innerItem = item;
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void fill(Composite parent) {
- if (visible)
- innerItem.fill(parent);
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void fill(Menu parent, int index) {
- if (visible)
- innerItem.fill(parent, index);
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void fill(ToolBar parent, int index) {
- if (visible)
- innerItem.fill(parent, index);
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public String getId() {
- return innerItem.getId();
-}
-/**
- * Returns the inner contribution item.
- *
- * @return the inner contribution item
- */
-public IContributionItem getInnerItem() {
- return innerItem;
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public boolean isDynamic() {
- return innerItem.isDynamic();
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public boolean isGroupMarker() {
- return innerItem.isGroupMarker();
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public boolean isSeparator() {
- return innerItem.isSeparator();
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public boolean isVisible() {
- return visible && innerItem.isVisible();
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void setParent(IContributionManager parent) {
- // do nothing, the parent of our inner item
- // is its SubContributionManager
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void setVisible(boolean visible) {
- this.visible = visible;
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void update() {
- innerItem.update();
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void update(String id) {
- innerItem.update(id);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionManager.java
deleted file mode 100644
index 928f691..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionManager.java
+++ /dev/null
@@ -1,297 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.jface.util.Assert;
-
-/**
- * A <code>SubContributionManager</code> is used to define a set of contribution
- * items within a parent manager. Once defined, the visibility of the entire set can
- * be changed as a unit.
- */
-public abstract class SubContributionManager implements IContributionManager {
- /**
- * The parent contribution manager.
- */
- private IContributionManager parentMgr;
-
- /**
- * Maps each item in the manager to a wrapper. The wrapper is used to
- * control the visibility of each item.
- */
- private Map mapItemToWrapper = new HashMap();
-
- /**
- * The visibility of the manager,
- */
- private boolean visible = false;
-
-/**
- * Constructs a new <code>SubContributionManager</code>
- *
- * @param mgr the parent contribution manager. All contributions made to the
- * <code>SubContributionManager</code> are forwarded and appear in the
- * parent manager.
- */
-public SubContributionManager(IContributionManager mgr) {
- super();
- parentMgr = mgr;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void add(IAction action) {
- add(new ActionContributionItem(action));
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void add(IContributionItem item) {
- item.setParent(this);
- SubContributionItem wrap = wrap(item);
- wrap.setVisible(visible);
- parentMgr.add(wrap);
- itemAdded(item, wrap);
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void appendToGroup(String groupName, IAction action) {
- appendToGroup(groupName, new ActionContributionItem(action));
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void appendToGroup(String groupName, IContributionItem item) {
- item.setParent(this);
- SubContributionItem wrap = wrap(item);
- wrap.setVisible(visible);
- parentMgr.appendToGroup(groupName, wrap);
- itemAdded(item, wrap);
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- *
- * Returns the item passed to us, not the wrapper.
- */
-public IContributionItem find(String id) {
- IContributionItem item = parentMgr.find(id);
- // Return the item passed to us, not the wrapper.
- item = unwrap(item);
- return item;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- *
- * Returns the items passed to us, not the wrappers.
- */
-public IContributionItem[] getItems() {
- IContributionItem[] result = new IContributionItem[mapItemToWrapper.size()];
- mapItemToWrapper.keySet().toArray(result);
- return result;
-}
-/**
- * Returns the parent manager.
- *
- * @return the parent manager
- */
-public IContributionManager getParent() {
- return parentMgr;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionManagerOverrides getOverrides() {
- return parentMgr.getOverrides();
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void insertAfter(String id, IAction action) {
- insertAfter(id, new ActionContributionItem(action));
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void insertAfter(String id, IContributionItem item) {
- item.setParent(this);
- SubContributionItem wrap = wrap(item);
- wrap.setVisible(visible);
- parentMgr.insertAfter(id, wrap);
- itemAdded(item, wrap);
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void insertBefore(String id, IAction action) {
- insertBefore(id, new ActionContributionItem(action));
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void insertBefore(String id, IContributionItem item) {
- item.setParent(this);
- SubContributionItem wrap = wrap(item);
- wrap.setVisible(visible);
- parentMgr.insertBefore(id, wrap);
- itemAdded(item, wrap);
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public boolean isDirty() {
- return parentMgr.isDirty();
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public boolean isEmpty() {
- return parentMgr.isEmpty();
-}
-/**
- * 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.
- *
- * @return <code>true</code> if the manager is visible
- */
-public boolean isVisible() {
- return visible;
-}
-/**
- * Notifies that an item has been added.
- * <p>
- * Subclasses are not expected to override this method.
- * </p>
- *
- * @param item the item contributed by the client
- * @param wrap the item contributed to the parent manager as a proxy for the item
- * contributed by the client
- */
-protected void itemAdded(IContributionItem item, SubContributionItem wrap) {
- mapItemToWrapper.put(item, wrap);
-}
-/**
- * Notifies that an item has been removed.
- * <p>
- * Subclasses are not expected to override this method.
- * </p>
- *
- * @param item the item contributed by the client
- */
-protected void itemRemoved(IContributionItem item) {
- mapItemToWrapper.remove(item);
-}
-/**
- * @deprecated Use getItems(String value) instead.
- */
-public Enumeration items() {
- final Iterator i = mapItemToWrapper.values().iterator();
- return new Enumeration() {
- public boolean hasMoreElements() {
- return i.hasNext();
- }
- public Object nextElement() {
- return i.next();
- }
- };
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void markDirty() {
- parentMgr.markDirty();
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void prependToGroup(String groupName, IAction action) {
- prependToGroup(groupName, new ActionContributionItem(action));
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void prependToGroup(String groupName, IContributionItem item) {
- item.setParent(this);
- SubContributionItem wrap = wrap(item);
- wrap.setVisible(visible);
- parentMgr.prependToGroup(groupName, wrap);
- itemAdded(item, wrap);
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionItem remove(String id) {
- IContributionItem result = parentMgr.remove(id);
- if (result != null)
- itemRemoved(result);
- return result;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionItem remove(IContributionItem item) {
- SubContributionItem wrap = (SubContributionItem)mapItemToWrapper.get(item);
- if (wrap == null)
- return null;
- IContributionItem result = parentMgr.remove(wrap);
- if (result == null)
- return null;
- itemRemoved(item);
- return item;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void removeAll() {
- Iterator enum = mapItemToWrapper.values().iterator();
- while (enum.hasNext()) {
- IContributionItem item = (IContributionItem)enum.next();
- parentMgr.remove(item);
- }
- mapItemToWrapper.clear();
-}
-/**
- * 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
- */
-public void setVisible(boolean visible) {
- this.visible = visible;
- if (mapItemToWrapper.size() > 0) {
- Iterator enum = mapItemToWrapper.values().iterator();
- while (enum.hasNext()) {
- IContributionItem item = (IContributionItem)enum.next();
- item.setVisible(visible);
- }
- parentMgr.markDirty();
- }
-}
-/**
- * Wraps a contribution item in a sub contribution item, and returns the new wrapper.
- */
-protected SubContributionItem wrap(IContributionItem item) {
- return new SubContributionItem(item);
-}
-
-/**
- * Unwrap a contribution item.
- */
-protected IContributionItem unwrap(IContributionItem item) {
- if (item == null ||
- item instanceof GroupMarker ||
- item instanceof Separator) {
- return item;
- }
-
- Assert.isTrue(item instanceof SubContributionItem);
-
- return ((SubContributionItem)item).getInnerItem();
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubMenuManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubMenuManager.java
deleted file mode 100644
index 036ee51..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubMenuManager.java
+++ /dev/null
@@ -1,281 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A <code>SubMenuManager</code> is used to define a set of contribution
- * items within a parent manager. Once defined, the visibility of the entire set can
- * be changed as a unit.
- * <p>
- * A client may ask for and make additions to a submenu. The visibility of these items
- * is also controlled by the visibility of the <code>SubMenuManager</code>.
- * </p>
- */
-public class SubMenuManager extends SubContributionManager implements IMenuManager {
- /**
- * The parent menu manager.
- */
- private IMenuManager parentMgr;
-
- /**
- * Maps each submenu in the manager to a wrapper. The wrapper is used to
- * monitor additions and removals. If the visibility of the manager is modified
- * the visibility of the submenus is also modified.
- */
- private Map mapMenuToWrapper;
-
-/**
- * Constructs a new manager.
- *
- * @param mgr the parent manager. All contributions made to the
- * <code>SubMenuManager</code> are forwarded and appear in the
- * parent manager.
- */
-public SubMenuManager(IMenuManager mgr) {
- super(mgr);
- parentMgr = mgr;
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public void addMenuListener(IMenuListener listener) {
- parentMgr.addMenuListener(listener);
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public void fill(Composite parent) {
- if (isVisible())
- parentMgr.fill(parent);
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public void fill(Menu parent, int index) {
- if (isVisible())
- parentMgr.fill(parent, index);
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public void fill(ToolBar parent, int index) {
- if (isVisible())
- parentMgr.fill(parent, index);
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-/**
- * <p>
- * The menu returned is wrapped within a <code>SubMenuManager</code> to
- * monitor additions and removals. If the visibility of this menu is modified
- * the visibility of the submenus is also modified.
- * </p>
- */
-public IMenuManager findMenuUsingPath(String path) {
- IContributionItem item = findUsingPath(path);
- if (item instanceof IMenuManager) {
- return (IMenuManager)item;
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- *
- * Returns the item passed to us, not the wrapper.
- *
- * We use use the same algorithm as MenuManager.findUsingPath, but unwrap
- * submenus along so that SubMenuManagers are visible.
- */
-public IContributionItem findUsingPath(String path) {
- String id = path;
- String rest = null;
- int separator = path.indexOf('/');
- if (separator != -1) {
- id = path.substring(0, separator);
- rest = path.substring(separator + 1);
- }
- IContributionItem item = find(id); // unwraps item
- if (rest != null && item instanceof IMenuManager) {
- IMenuManager menu = (IMenuManager) item;
- item = menu.findUsingPath(rest);
- }
- return item;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- *
- * 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.
- */
-public IContributionItem find(String id) {
- IContributionItem item = parentMgr.find(id);
- if (item instanceof SubContributionItem)
- // Return the item passed to us, not the wrapper.
- item = unwrap(item);
-
- if (item instanceof IMenuManager) {
- // if it is a menu manager wrap it before returning
- IMenuManager menu = (IMenuManager)item;
- item = getWrapper(menu);
- }
-
- return item;
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public String getId() {
- return parentMgr.getId();
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public boolean getRemoveAllWhenShown() {
- return false;
-}
-/**
- * Returns the menu wrapper for a menu manager.
- * <p>
- * The sub menus within this menu are wrapped within a <code>SubMenuManager</code> to
- * monitor additions and removals. If the visibility of this menu is modified
- * the visibility of the sub menus is also modified.
- * <p>
- *
- * @return the menu wrapper
- */
-protected IMenuManager getWrapper(IMenuManager mgr) {
- if (mapMenuToWrapper == null) {
- mapMenuToWrapper = new HashMap(4);
- }
- SubMenuManager wrapper = (SubMenuManager) mapMenuToWrapper.get(mgr);
- if (wrapper == null) {
- wrapper = wrapMenu(mgr);
- mapMenuToWrapper.put(mgr, wrapper);
- }
- return wrapper;
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public boolean isDynamic() {
- return parentMgr.isDynamic();
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public boolean isEnabled() {
- return isVisible() && parentMgr.isEnabled();
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public boolean isGroupMarker() {
- return parentMgr.isGroupMarker();
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public boolean isSeparator() {
- return parentMgr.isSeparator();
-}
-/**
- * Remove all contribution items.
- */
-public void removeAll() {
- super.removeAll();
- if (mapMenuToWrapper != null) {
- Iterator iter = mapMenuToWrapper.values().iterator();
- while (iter.hasNext()) {
- SubMenuManager wrapper = (SubMenuManager)iter.next();
- wrapper.removeAll();
- }
- mapMenuToWrapper.clear();
- mapMenuToWrapper = null;
- }
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public void removeMenuListener(IMenuListener listener) {
- parentMgr.removeMenuListener(listener);
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void setParent(IContributionManager parent) {
- // do nothing, our "parent manager's" parent
- // is set when it is added to a manager
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public void setRemoveAllWhenShown(boolean removeAll) {
- Assert.isTrue(false, "Should not be called on submenu manager");
-}
-/* (non-Javadoc)
- * Method declared on SubContributionManager.
- */
-public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (mapMenuToWrapper != null) {
- Iterator iter = mapMenuToWrapper.values().iterator();
- while (iter.hasNext()) {
- SubMenuManager wrapper = (SubMenuManager)iter.next();
- wrapper.setVisible(visible);
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public void update() {
- // This method is not governed by visibility. The client may
- // call <code>setVisible</code> and then force an update. At that
- // point we need to update the parent.
- parentMgr.update();
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public void update(boolean force) {
- // This method is not governed by visibility. The client may
- // call <code>setVisible</code> and then force an update. At that
- // point we need to update the parent.
- parentMgr.update(force);
-}
-/* (non-Javadoc)
- * Method declared on IMenuManager.
- */
-public void updateAll(boolean force) {
- // This method is not governed by visibility. The client may
- // call <code>setVisible</code> and then force an update. At that
- // point we need to update the parent.
- parentMgr.updateAll(force);
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public void update(String id) {
- parentMgr.update(id);
-}
-/**
- * Wraps a menu manager in a sub menu manager, and returns the new wrapper.
- */
-protected SubMenuManager wrapMenu(IMenuManager menu) {
- SubMenuManager mgr = new SubMenuManager(menu);
- mgr.setVisible(isVisible());
- return mgr;
-}
-
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubToolBarManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubToolBarManager.java
deleted file mode 100644
index bdbb765..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubToolBarManager.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A <code>SubToolBarManager</code> monitors the additional and removal of
- * items from a parent manager so that visibility of the entire set can be changed as a
- * unit.
- */
-public class SubToolBarManager extends SubContributionManager
- implements IToolBarManager
-{
- /**
- * The parent tool bar manager.
- */
- private IToolBarManager parentMgr;
-/**
- * Constructs a new manager.
- *
- * @param mgr the parent manager. All contributions made to the
- * <code>SubToolBarManager</code> are forwarded and appear in the
- * parent manager.
- */
-public SubToolBarManager(IToolBarManager mgr) {
- super(mgr);
- parentMgr = mgr;
-}
-/* (non-Javadoc)
- * Method declared on IToolBarManager.
- */
-public void update(boolean force) {
- // This method is not governed by visibility. The client may
- // call <code>setVisible</code> and then force an update. At that
- // point we need to update the parent.
- parentMgr.update(force);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarManager.java
deleted file mode 100644
index f4ea092..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarManager.java
+++ /dev/null
@@ -1,256 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import java.util.*;
-
-/**
- * A tool bar manager is a contribution manager which realizes itself and its items
- * in a tool bar control.
- * <p>
- * This class may be instantiated; it may also be subclassed if a more
- * sophisticated layout is required.
- * </p>
- */
-public class ToolBarManager extends ContributionManager implements IToolBarManager {
-
- /**
- * The tool bar items style; <code>SWT.NONE</code> by default.
- */
- private int itemStyle = SWT.NONE;
-
- /**
- * The tool bat control; <code>null</code> before creation
- * and after disposal.
- */
- private ToolBar toolBar = null;
-/**
- * Creates a new tool bar manager with the default SWT button style.
- * Use the <code>createControl</code> method to create the
- * tool bar control.
- */
-public ToolBarManager() {
-}
-/**
- * Creates a tool bar manager with the given SWT button style.
- * Use the <code>createControl</code> method to create the
- * tool bar control.
- *
- * @param style the tool bar item style
- * @see org.eclipse.swt.widgets.ToolBar#ToolBar for valid style bits
- */
-public ToolBarManager(int style) {
- itemStyle= style;
-}
-/**
- * Creates a tool bar manager for an existing tool bar control.
- * This manager becomes responsible for the control, and will
- * dispose of it when the manager is disposed.
- *
- * @param toolbar the tool bar control
- */
-public ToolBarManager(ToolBar toolbar) {
- this();
- this.toolBar = toolbar;
-}
-/**
- * Creates and returns this manager's tool bar control.
- * Does not create a new control if one already exists.
- *
- * @param parent the parent control
- * @return the tool bar control
- */
-public ToolBar createControl(Composite parent) {
- if (!toolBarExist() && parent != null) {
- toolBar = new ToolBar(parent, itemStyle);
- update(false);
- }
- return toolBar;
-}
-/**
- * Disposes of this tool bar manager and frees all allocated SWT resources.
- * Note that this method does not clean up references between this tool bar
- * manager and its associated contribution items.
- * Use <code>removeAll</code> for that purpose.
- */
-public void dispose() {
- if (toolBarExist())
- toolBar.dispose();
- toolBar = null;
-}
-/**
- * Returns the tool bar control for this manager.
- *
- * @return the tool bar control, or <code>null</code>
- * if none (before creating or after disposal)
- */
-public ToolBar getControl() {
- return toolBar;
-}
-/**
- * Re-lays out the tool bar.
- * <p>
- * The default implementation of this framework method re-lays out
- * the parent when the number of items crosses the zero threshold.
- * Subclasses should override this method to implement their own
- * re-layout strategy
- *
- * @param toolBar the tool bar control
- * @param oldCount the old number of items
- * @param newCount the new number of items
- */
-protected void relayout(ToolBar toolBar, int oldCount, int newCount) {
- if ((oldCount == 0) != (newCount == 0))
- toolBar.getParent().layout();
-}
-/**
- * Returns whether the tool bar control is created
- * and not disposed.
- *
- * @return <code>true</code> if the control is created
- * and not disposed, <code>false</code> otherwise
- */
-private boolean toolBarExist() {
- return toolBar != null && !toolBar.isDisposed();
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void update(boolean force) {
-
-// long startTime= 0;
-// if (DEBUG) {
-// dumpStatistics();
-// startTime= (new Date()).getTime();
-// }
-
- if (isDirty() || force) {
-
- if (toolBarExist()) {
-
- int oldCount= toolBar.getItemCount();
-
- // clean contains all active items without double separators
- IContributionItem[] items= getItems();
- ArrayList clean= new ArrayList(items.length);
- IContributionItem separator= null;
-// long cleanStartTime= 0;
-// if (DEBUG) {
-// cleanStartTime= (new Date()).getTime();
-// }
- for (int i = 0; i < items.length; ++i) {
- IContributionItem ci= items[i];
- if (!ci.isVisible())
- continue;
- if (ci.isSeparator()) {
- // delay creation until necessary
- // (handles both adjacent separators, and separator at end)
- separator= ci;
- } else {
- if (separator != null) {
- if (clean.size() > 0) // no separator if first item
- clean.add(separator);
- separator= null;
- }
- clean.add(ci);
- }
- }
-// if (DEBUG) {
-// System.out.println(" Time needed to build clean vector: " + ((new Date()).getTime() - cleanStartTime));
-// }
-
- // determine obsolete items (removed or non active)
- Item[] mi= toolBar.getItems();
- ArrayList toRemove = new ArrayList(mi.length);
- for (int i= 0; i < mi.length; i++) {
- Object data= mi[i].getData();
- if (data == null || !clean.contains(data) ||
- (data instanceof IContributionItem && ((IContributionItem)data).isDynamic())) {
- toRemove.add(mi[i]);
- }
- }
-
- // Turn redraw off if the number of items to be added
- // is above a certain threshold, to minimize flicker,
- // otherwise the toolbar can be seen to redraw after each item.
- // Do this before any modifications are made.
- // We assume each contribution item will contribute at least one toolbar item.
- boolean useRedraw = (clean.size() - (mi.length - toRemove.size())) >= 3;
- if (useRedraw) {
- toolBar.setRedraw(false);
- }
-
- // remove obsolete items
- for (int i = toRemove.size(); --i >= 0;) {
- ToolItem item = (ToolItem) toRemove.get(i);
- if (!item.isDisposed()) {
- Control ctrl = item.getControl();
- if (ctrl != null) {
- item.setControl(null);
- ctrl.dispose();
- }
- item.dispose();
- }
- }
-
- // add new items
- IContributionItem src, dest;
- mi= toolBar.getItems();
- int srcIx= 0;
- int destIx= 0;
- for (Iterator e = clean.iterator(); e.hasNext();) {
- src= (IContributionItem) e.next();
-
- // get corresponding item in SWT widget
- if (srcIx < mi.length)
- dest= (IContributionItem) mi[srcIx].getData();
- else
- dest= null;
-
- if (dest != null && src.equals(dest)) {
- srcIx++;
- destIx++;
- continue;
- }
-
- if (dest != null && dest.isSeparator() && src.isSeparator()) {
- mi[srcIx].setData(src);
- srcIx++;
- destIx++;
- continue;
- }
-
- int start= toolBar.getItemCount();
- src.fill(toolBar, destIx);
- int newItems = toolBar.getItemCount()-start;
- for (int i = 0; i < newItems; i++) {
- ToolItem item = toolBar.getItem(destIx++);
- item.setData(src);
- }
- }
-
- setDirty(false);
-
- // turn redraw back on if we turned it off above
- if (useRedraw) {
- toolBar.setRedraw(true);
- }
-
- int newCount= toolBar.getItemCount();
- relayout(toolBar, oldCount, newCount);
- }
-
- }
-
-// if (DEBUG) {
-// System.out.println(" Time needed for update: " + ((new Date()).getTime() - startTime));
-// System.out.println();
-// }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/images/stop.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/images/stop.gif
deleted file mode 100644
index 4eb53ec..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/images/stop.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/package.html b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/package.html
deleted file mode 100644
index f4356bd..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/package.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides support for shared UI resources such as menus,
-tool bars, and status lines.
-<h2>
-Package Specification</h2>
-Contribution managers coordinate contributions to shared UI resources such
-as menus, menu bars, tool bars, and status lines. <tt>ContributionManager</tt>
-maintains the contributions as a dynamic list of contribution items (<tt>IContributionItems</tt>).
-Separators (<tt>Separator</tt>) can be included in contribution lists to
-break up the list's visual representation. Internally, contribution lists
-can be organized into named groups via special group markers (<tt>GroupMarker</tt>)
-to facilitate programatic insertion at specific positions within the list.
-<p>Three specific contribution managers are provided: a status line manager
-(<tt>StatusLineManager</tt>), a tool bar manager (<tt>ToolBarManager</tt>),
-and a hierarchical menu manager (<tt>MenuManager</tt>).
-<p>Actions (<tt>IAction</tt>) are commands which can be triggered from
-the UI, like the ones found in menus, toolbars, and buttons. Menus and
-tools bars are typically populated with contribution items that delegate
-to actions (<tt>ActionContributionItem</tt>).
-<p>Note: None of the classes in this package maintain global state.
-<br>
-</body>
-</html>
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ControlEnableState.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ControlEnableState.java
deleted file mode 100644
index 3545c03..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ControlEnableState.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Composite;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Helper class to save the enable/disable state of a control
- * including all its descendent controls.
- */
-public class ControlEnableState {
-
- /**
- * List of exception controls (element type: <code>Control</code>);
- * <code>null</code> if none.
- */
- private List exceptions = null;
-
- /**
- * List of saved states (element type: <code>ItemState</code>).
- */
- private List states;
-
- /**
- * Internal class for recording the enable/disable state of a
- * single control.
- */
- private class ItemState {
- protected Control item;
- protected boolean state;
- public ItemState(Control item, boolean state) {
- this.item = item;
- this.state = state;
- }
- public void restore() {
- if (item != null)
- item.setEnabled(state);
- }
- }
-/**
- * Creates a new object and saves in it the current enable/disable
- * state of the given control and its descendents; the controls
- * that are saved are also disabled.
- *
- * @param w the control
- */
-protected ControlEnableState(Control w) {
- this(w, null);
-}
-/**
- * Creates a new object and saves in it the current enable/disable
- * state of the given control and its descendents except for the
- * given list of exception cases; the controls that are saved
- * are also disabled.
- *
- * @param w the control
- * @param exceptions the list of controls to not disable
- * (element type: <code>Control</code>), or <code>null</code> if none
- */
-protected ControlEnableState(Control w, List exceptions) {
- super();
- states = new ArrayList();
- this.exceptions = exceptions;
- readStateForAndDisable(w);
-}
-/**
- * Saves the current enable/disable state of the given control
- * and its descendents in the returned object; the controls
- * are all disabled.
- *
- * @param w the control
- * @return an object capturing the enable/disable state
- */
-public static ControlEnableState disable(Control w) {
- return new ControlEnableState(w);
-}
-/**
- * Saves the current enable/disable state of the given control
- * and its descendents in the returned object except for the
- * given list of exception cases; the controls that are saved
- * are also disabled.
- *
- * @param w the control
- * @param exceptions the list of controls to not disable
- * (element type: <code>Control</code>)
- * @return an object capturing the enable/disable state
- */
-public static ControlEnableState disable(Control w, List exceptions) {
- return new ControlEnableState(w, exceptions);
-}
-/**
- * Recursively reads the enable/disable state for the given window
- * and disables all controls.
- */
-private void readStateForAndDisable(Control w) {
- if ((exceptions != null && exceptions.contains(w)))
- return;
-
- if (w instanceof Composite) {
- Composite c = (Composite) w;
- Control[] children = c.getChildren();
- for (int i = 0; i < children.length; i++) {
- readStateForAndDisable(children[i]);
- }
- }
- // XXX: Workaround for 1G2Q8SS: ITPUI:Linux - Combo box is not enabled in "File->New->Solution"
- states.add(new ItemState(w, w.getEnabled()));
- w.setEnabled(false);
-}
-/**
- * Restores the window enable state saved in this object.
- */
-public void restore() {
- int size = states.size();
- for (int i = 0; i < size; i++) {
- ((ItemState) states.get(i)).restore();
- }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java
deleted file mode 100644
index 543c8dd..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java
+++ /dev/null
@@ -1,683 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.resource.*;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import java.util.*;
-
-/**
- * A dialog is a specialized window used for narrow-focused communication
- * with the user.
- * <p>
- * Dialogs are usually modal. Consequently, it is generally bad practice
- * to open a dialog without a parent. A model dialog without a parent
- * is not prevented from disappearing behind the application's other windows,
- * making it very confusing for the user.
- * </p>
- */
-public abstract class Dialog extends Window {
-
- /**
- * Image registry key for error image (value <code>"dialog_error_image"</code>).
- */
- public static final String DLG_IMG_ERROR = "dialog_error_image";//$NON-NLS-1$
-
- /**
- * Image registry key for info image (value <code>"dialog_info_image"</code>).
- */
- public static final String DLG_IMG_INFO = "dialog_info_image";//$NON-NLS-1$
-
- /**
- * Image registry key for question image (value <code>"dialog_question_image"</code>).
- */
- public static final String DLG_IMG_QUESTION = "dialog_question_image";//$NON-NLS-1$
-
- /**
- * Image registry key for warning image (value <code>"dialog_warning_image"</code>).
- */
- public static final String DLG_IMG_WARNING = "dialog_warning_image";//$NON-NLS-1$
-
-
- /**
- * Image registry key for info message image (value <code>"dialog_messsage_info_image"</code>).
- * @since 2.0
- */
- public static final String DLG_IMG_MESSAGE_INFO = "dialog_messasge_info_image";//$NON-NLS-1$
-
- /**
- * Image registry key for info message image (value <code>"dialog_messasge_warning_image"</code>).
- * @since 2.0
- */
- public static final String DLG_IMG_MESSAGE_WARNING = "dialog_messasge_warning_image";//$NON-NLS-1$
-
- /**
- * Image registry key for info message image (value <code>"dialog_message_error_image"</code>).
- * @since 2.0
- */
- public static final String DLG_IMG_MESSAGE_ERROR = "dialog_message_error_image";//$NON-NLS-1$
-
- static {
- ImageRegistry reg = JFaceResources.getImageRegistry();
- reg.put(DLG_IMG_INFO, ImageDescriptor.createFromFile(Dialog.class, "images/inform.gif"));//$NON-NLS-1$
- reg.put(DLG_IMG_QUESTION, ImageDescriptor.createFromFile(Dialog.class, "images/question.gif"));//$NON-NLS-1$
- reg.put(DLG_IMG_WARNING, ImageDescriptor.createFromFile(Dialog.class, "images/warning.gif"));//$NON-NLS-1$
- reg.put(DLG_IMG_ERROR, ImageDescriptor.createFromFile(Dialog.class, "images/error.gif"));//$NON-NLS-1$
-
- reg.put(DLG_IMG_MESSAGE_INFO, ImageDescriptor.createFromFile(Dialog.class, "images/message_info.gif"));//$NON-NLS-1$
- reg.put(DLG_IMG_MESSAGE_WARNING, ImageDescriptor.createFromFile(Dialog.class, "images/message_warning.gif"));//$NON-NLS-1$
- reg.put(DLG_IMG_MESSAGE_ERROR, ImageDescriptor.createFromFile(Dialog.class, "images/message_error.gif"));//$NON-NLS-1$
- }
-
- /**
- * The dialog area; <code>null</code> until dialog is layed out.
- */
- protected Control dialogArea;
-
- /**
- * The button bar; <code>null</code> until dialog is layed out.
- */
- protected Control buttonBar;
-
- /**
- * Collection of buttons created by the <code>createButton</code> method.
- */
- private HashMap buttons = new HashMap();
-
- /**
- * Font metrics to use for determining pixel sizes.
- */
- private FontMetrics fontMetrics;
-
- /**
- * Number of horizontal dialog units per character, value <code>4</code>.
- */
- private static final int HORIZONTAL_DIALOG_UNIT_PER_CHAR = 4;
-
- /**
- * Number of vertical dialog units per character, value <code>8</code>.
- */
- private static final int VERTICAL_DIALOG_UNITS_PER_CHAR = 8;
-
-
-/**
- * Returns the number of pixels corresponding to the
- * height of the given number of characters.
- * <p>
- * The required <code>FontMetrics</code> parameter may be created in the
- * following way:
- * <code>
- * GC gc = new GC(control);
- * gc.setFont(control.getFont());
- * fontMetrics = gc.getFontMetrics();
- * gc.dispose();
- * </code>
- * </p>
- *
- * @param fontMetrics used in performing the conversion
- * @param chars the number of characters
- * @return the number of pixels
- * @since 2.0
- */
-public static int convertHeightInCharsToPixels(FontMetrics fontMetrics, int chars) {
- return fontMetrics.getHeight() * chars;
-}
-
-/**
- * Returns the number of pixels corresponding to the
- * given number of horizontal dialog units.
- * <p>
- * The required <code>FontMetrics</code> parameter may be created in the
- * following way:
- * <code>
- * GC gc = new GC(control);
- * gc.setFont(control.getFont());
- * fontMetrics = gc.getFontMetrics();
- * gc.dispose();
- * </code>
- * </p>
- *
- * @param fontMetrics used in performing the conversion
- * @param dlus the number of horizontal dialog units
- * @return the number of pixels
- * @since 2.0
- */
-public static int convertHorizontalDLUsToPixels(FontMetrics fontMetrics, int dlus) {
- // round to the nearest pixel
- return (fontMetrics.getAverageCharWidth()*dlus + HORIZONTAL_DIALOG_UNIT_PER_CHAR/2)
- / HORIZONTAL_DIALOG_UNIT_PER_CHAR;
-}
-
-/**
- * Returns the number of pixels corresponding to the
- * given number of vertical dialog units.
- * <p>
- * The required <code>FontMetrics</code> parameter may be created in the
- * following way:
- * <code>
- * GC gc = new GC(control);
- * gc.setFont(control.getFont());
- * fontMetrics = gc.getFontMetrics();
- * gc.dispose();
- * </code>
- * </p>
- *
- * @param fontMetrics used in performing the conversion
- * @param dlus the number of vertical dialog units
- * @return the number of pixels
- * @since 2.0
- */
-public static int convertVerticalDLUsToPixels(FontMetrics fontMetrics, int dlus) {
- // round to the nearest pixel
- return (fontMetrics.getHeight()*dlus + VERTICAL_DIALOG_UNITS_PER_CHAR/2)
- / VERTICAL_DIALOG_UNITS_PER_CHAR;
-}
-
-/**
- * Returns the number of pixels corresponding to the
- * width of the given number of characters.
- * <p>
- * The required <code>FontMetrics</code> parameter may be created in the
- * following way:
- * <code>
- * GC gc = new GC(control);
- * gc.setFont(control.getFont());
- * fontMetrics = gc.getFontMetrics();
- * gc.dispose();
- * </code>
- * </p>
- *
- * @param fontMetrics used in performing the conversion
- * @param chars the number of characters
- * @return the number of pixels
- * @since 2.0
- */
-public static int convertWidthInCharsToPixels(FontMetrics fontMetrics, int chars) {
- return fontMetrics.getAverageCharWidth() * chars;
-}
-
-/**
- * Creates a dialog instance.
- * Note that the window will have no visual representation (no widgets)
- * until it is told to open.
- * By default, <code>open</code> blocks for dialogs.
- *
- * @param parentShell the parent shell, or <code>null</code> to create a top-level shell
- */
-protected Dialog(Shell parentShell) {
- super(parentShell);
- setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL);
- setBlockOnOpen(true);
-}
-
-/**
- * Notifies that this dialog's button with the given id has been pressed.
- * <p>
- * The <code>Dialog</code> implementation of this framework method calls
- * <code>okPressed</code> if the ok button is the pressed,
- * and <code>cancelPressed</code> if the cancel button is the pressed.
- * All other button presses are ignored. Subclasses may override
- * to handle other buttons, but should call <code>super.buttonPressed</code>
- * if the default handling of the ok and cancel buttons is desired.
- * </p>
- *
- * @param buttonId the id of the button that was pressed (see
- * <code>IDialogConstants.*_ID</code> constants)
- */
-protected void buttonPressed(int buttonId) {
- if (IDialogConstants.OK_ID == buttonId)
- okPressed();
- else if (IDialogConstants.CANCEL_ID == buttonId)
- cancelPressed();
-}
-/**
- * Notifies that the cancel 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>Window.CANCEL</code>
- * and closes the dialog. Subclasses may override if desired.
- * </p>
- */
-protected void cancelPressed() {
- setReturnCode(CANCEL);
- close();
-}
-/**
- * Constrain the shell size to be no larger than the display bounds.
- * Reduce the shell size and move its origin as required.
- *
- * @since 2.0
- */
-protected void constrainShellSize() {
- // limit the shell size to the display size
- super.constrainShellSize();
- Shell shell = getShell();
- Point size = shell.getSize();
- Rectangle bounds = shell.getDisplay().getClientArea();
-
-
- // move the shell origin as required
- Point loc = shell.getLocation();
-
- //Choose the position between the origin of the client area and
- //the bottom right hand corner
- int x = Math.max(bounds.x, Math.min(loc.x, bounds.x + bounds.width - size.x));
- int y = Math.max(bounds.y, Math.min(loc.y, bounds.y + bounds.height - size.y));
- shell.setLocation(x, y);
-}
-/**
- * Returns the number of pixels corresponding to the
- * height of the given number of characters.
- * <p>
- * This method may only be called after <code>initializeDialogUnits</code>
- * has been called.
- * </p>
- * <p>
- * Clients may call this framework method, but should not override it.
- * </p>
- *
- * @param chars the number of characters
- * @return the number of pixels
- */
-protected int convertHeightInCharsToPixels(int chars) {
- // test for failure to initialize for backward compatibility
- if (fontMetrics == null)
- return 0;
- return convertHeightInCharsToPixels(fontMetrics, chars);
-}
-/**
- * Returns the number of pixels corresponding to the
- * given number of horizontal dialog units.
- * <p>
- * This method may only be called after <code>initializeDialogUnits</code>
- * has been called.
- * </p>
- * <p>
- * Clients may call this framework method, but should not override it.
- * </p>
- *
- * @param dlus the number of horizontal dialog units
- * @return the number of pixels
- */
-protected int convertHorizontalDLUsToPixels(int dlus) {
- // test for failure to initialize for backward compatibility
- if (fontMetrics == null)
- return 0;
- return convertHorizontalDLUsToPixels(fontMetrics, dlus);
-}
-/**
- * Returns the number of pixels corresponding to the
- * given number of vertical dialog units.
- * <p>
- * This method may only be called after <code>initializeDialogUnits</code>
- * has been called.
- * </p>
- * <p>
- * Clients may call this framework method, but should not override it.
- * </p>
- *
- * @param dlus the number of vertical dialog units
- * @return the number of pixels
- */
-protected int convertVerticalDLUsToPixels(int dlus) {
- // test for failure to initialize for backward compatibility
- if (fontMetrics == null)
- return 0;
- return convertVerticalDLUsToPixels(fontMetrics, dlus);
-}
-/**
- * Returns the number of pixels corresponding to the
- * width of the given number of characters.
- * <p>
- * This method may only be called after <code>initializeDialogUnits</code>
- * has been called.
- * </p>
- * <p>
- * Clients may call this framework method, but should not override it.
- * </p>
- *
- * @param chars the number of characters
- * @return the number of pixels
- */
-protected int convertWidthInCharsToPixels(int chars) {
- // test for failure to initialize for backward compatibility
- if (fontMetrics == null)
- return 0;
- return convertWidthInCharsToPixels(fontMetrics, chars);
-}
-/**
- * Creates a new button with the given id.
- * <p>
- * The <code>Dialog</code> implementation of this framework method
- * creates a standard push button, registers it for selection events
- * including button presses, and registers default buttons with its shell.
- * The button id is stored as the button's client data. If the button id
- * is <code>IDialogConstants.CANCEL_ID</code>, the new button will be
- * accessible from <code>getCancelButton()</code>. If the button id is
- * <code>IDialogConstants.OK_ID</code>, the new button will be accesible
- * from <code>getOKButton()</code>. 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 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
- *
- * @return the new button
- *
- * @see getCancelButton
- * @see getOKButton
- */
-protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
- // increment the number of columns in the button bar
- ((GridLayout)parent.getLayout()).numColumns++;
-
- Button button = new Button(parent, SWT.PUSH);
-
- button.setText(label);
-
- button.setData(new Integer(id));
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- buttonPressed(((Integer) event.widget.getData()).intValue());
- }
- });
- if (defaultButton) {
- Shell shell = parent.getShell();
- if (shell != null) {
- shell.setDefaultButton(button);
- }
- }
- button.setFont(parent.getFont());
- buttons.put(new Integer(id), button);
- setButtonLayoutData(button);
-
- return button;
-}
-
-/**
- * Creates and returns the contents of this dialog's
- * button bar.
- * <p>
- * The <code>Dialog</code> implementation of this framework method
- * lays out a button bar and calls the <code>createButtonsForButtonBar</code>
- * framework method to populate it. Subclasses may override.
- * </p>
- * <p>
- * The returned control's layout data must be an instance of
- * <code>GridData</code>.
- * </p>
- *
- * @param parent the parent composite to contain the button bar
- * @return the button bar control
- */
-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 = 0; // this is incremented by createButton
- layout.makeColumnsEqualWidth = true;
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
-
- composite.setLayout(layout);
-
- GridData data = new GridData(
- GridData.HORIZONTAL_ALIGN_END |
- GridData.VERTICAL_ALIGN_CENTER);
- composite.setLayoutData(data);
-
- composite.setFont(parent.getFont());
-
- // Add the buttons to the button bar.
- createButtonsForButtonBar(composite);
-
- return composite;
-}
-/**
- * Adds buttons to this dialog's button bar.
- * <p>
- * The <code>Dialog</code> implementation of this framework method adds
- * standard ok and cancel buttons using the <code>createButton</code>
- * framework method. These standard buttons will be accessible from
- * <code>getCancelButton</code>, and <code>getOKButton</code>.
- * Subclasses may override.
- * </p>
- *
- * @param parent the button bar composite
- */
-protected void createButtonsForButtonBar(Composite parent) {
- // create OK and Cancel buttons by default
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
-}
-
-/*
- * @see Window.configureShell()
- */
-protected void configureShell(Shell newShell) {
-
- super.configureShell(newShell);
- newShell.setFont(JFaceResources.getDialogFont());
-}
-
-/**
- * The <code>Dialog</code> implementation of this <code>Window</code> method
- * creates and lays out the top level composite for the dialog, and
- * determines the appropriate horizontal and vertical dialog units
- * based on the font size. It then calls the <code>createDialogArea</code>
- * and <code>createButtonBar</code> methods to create the dialog area
- * and button bar, respectively. Overriding <code>createDialogArea</code> and
- * <code>createButtonBar</code> are recommended rather than overriding
- * this method.
- */
-protected Control createContents(Composite parent) {
- // create the top level composite for the dialog
- Composite composite = new Composite(parent, 0);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
-
- // initialize the dialog units
- initializeDialogUnits(composite);
-
- // create the dialog area and button bar
- dialogArea = createDialogArea(composite);
- buttonBar = createButtonBar(composite);
-
-
- return composite;
-}
-/**
- * Creates and returns the contents of the upper part
- * of this dialog (above the button bar).
- * <p>
- * The <code>Dialog</code> implementation of this framework method
- * creates and returns a new <code>Composite</code> with
- * standard margins and spacing.
- * </p>
- * <p>
- * The returned control's layout data must be an instance of
- * <code>GridData</code>.
- * </p>
- * <p>
- * Subclasses must override this method but may call <code>super</code>
- * as in the following example:
- * </p>
- * <pre>
- * Composite composite = (Composite)super.createDialogArea(parent);
- * //add controls to composite as necessary
- * return composite;
- * </pre>
- *
- * @param parent the parent composite to contain the dialog area
- * @return the dialog area control
- */
-protected Control createDialogArea(Composite parent) {
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
-
- return composite;
-}
-/**
- * Returns the button created by the method <code>createButton</code>
- * for the specified ID as defined on <code>IDialogConstants</code>. If
- * <code>createButton</code> was never called with this ID, or
- * if <code>createButton</code> is overridden, this method will return
- * <code>null</code>.
- *
- * @return the button for the ID or <code>null</code>
- *
- * @see createButton
- * @since 2.0
- */
-protected Button getButton(int id) {
- return (Button)buttons.get(new Integer(id));
-}
-/**
- * Returns the button bar control.
- * <p>
- * Clients may call this framework method, but should not override it.
- * </p>
- *
- * @return the button bar, or <code>null</code> if
- * the button bar has not been created yet
- */
-protected Control getButtonBar() {
- return buttonBar;
-}
-/**
- * Returns the button created when <code>createButton</code> is called
- * with an ID of <code>IDialogConstants.CANCEL_ID</code>. If
- * <code>createButton</code> was never called with this parameter, or
- * if <code>createButton</code> is overridden, <code>getCancelButton</code>
- * will return <code>null</code>.
- *
- * @return the cancel button or <code>null</code>
- *
- * @see createButton
- * @since 2.0
- * @deprecated Use <code>getButton(IDialogConstants.CANCEL_ID)</code> instead.
- * This method will be removed soon.
- */
-protected Button getCancelButton() {
- return getButton(IDialogConstants.CANCEL_ID);
-}
-/**
- * Returns the dialog area control.
- * <p>
- * Clients may call this framework method, but should not override it.
- * </p>
- *
- * @return the dialog area, or <code>null</code> if
- * the dialog area has not been created yet
- */
-protected Control getDialogArea() {
- return dialogArea;
-}
-/**
- * Returns the standard dialog image with the given key.
- * Note that these images are managed by the dialog framework,
- * and must not be disposed by another party.
- *
- * @param key one of the <code>Dialog.DLG_IMG_* </code> constants
- * @return the standard dialog image
- */
-public static Image getImage(String key) {
- return JFaceResources.getImageRegistry().get(key);
-}
-/**
- * Returns the button created when <code>createButton</code> is called
- * with an ID of <code>IDialogConstants.OK_ID</code>. If <code>createButton</code>
- * was never called with this parameter, or if <code>createButton</code> is
- * overridden, <code>getOKButton</code> will return <code>null</code>.
- *
- * @return the OK button or <code>null</code>
- *
- * @see createButton
- * @since 2.0
- * @deprecated Use <code>getButton(IDialogConstants.OK_ID)</code> instead.
- * This method will be removed soon.
- */
-protected Button getOKButton() {
- return getButton(IDialogConstants.OK_ID);
-}
-/**
- * Initializes the computation of horizontal and vertical dialog units
- * based on the size of current font.
- * <p>
- * This method must be called before any of the dialog unit based
- * conversion methods are called.
- * </p>
- *
- * @param control a control from which to obtain the current font
- */
-protected void initializeDialogUnits(Control control) {
- // Compute and store a font metric
- GC gc = new GC(control);
- gc.setFont(control.getFont());
- fontMetrics = gc.getFontMetrics();
- gc.dispose();
-}
-/**
- * Notifies that the ok 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>Window.OK</code>
- * and closes the dialog. Subclasses may override.
- * </p>
- */
-protected void okPressed() {
- setReturnCode(OK);
- close();
-}
-protected void setButtonLayoutData(Button button) {
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- button.setLayoutData(data);
-}
-
-/**
- * @see org.eclipse.jface.window.Window#close()
- */
-public boolean close() {
- boolean returnValue = super.close();
- if(returnValue){
- buttons = new HashMap();
- buttonBar = null;
- dialogArea = null;
- }
- return returnValue;
-}}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogPage.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogPage.java
deleted file mode 100644
index b6a691e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogPage.java
+++ /dev/null
@@ -1,409 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Abstract base implementation of a dialog page.
- * All dialog pages are subclasses of this one.
- */
-public abstract class DialogPage implements IDialogPage, IMessageProvider {
- /**
- * The control for this dialog page.
- */
- private Control control;
- /**
- * Optional title; <code>null</code> if none.
- *
- * @see #setTitle
- */
- private String title = null;
- /**
- * Optional description; <code>null</code> if none.
- *
- * @see #setDescription
- */
- private String description = null;
- /**
- * Cached image; <code>null</code> if none.
- *
- * @see #setImageDescription
- */
- private Image image = null;
- /**
- * Optional image; <code>null</code> if none.
- *
- * @see #setImageDescription
- */
- private ImageDescriptor imageDescriptor = null;
- /**
- * The current message; <code>null</code> if none.
- */
- private String message = null;
- /**
- * The current message type; default value <code>NONE</code>.
- */
- private int messageType = NONE;
- /**
- * The current error message; <code>null</code> if none.
- */
- private String errorMessage = null;
-
- /**
- * Font metrics to use for determining pixel sizes.
- */
- private FontMetrics fontMetrics;
-
-/**
- * Creates a new empty dialog page.
- */
-protected DialogPage() {
-}
-/**
- * Creates a new dialog page with the given title.
- *
- * @param title the title of this dialog page,
- * or <code>null</code> if none
- */
-protected DialogPage(String title) {
- this.title = title;
-}
-/**
- * Creates a new dialog page with the given title and image.
- *
- * @param title the title of this dialog page,
- * or <code>null</code> if none
- * @param image the image for this dialog page,
- * or <code>null</code> if none
- */
-protected DialogPage(String title, ImageDescriptor image) {
- this(title);
- imageDescriptor = image;
-}
-/**
- * Returns the number of pixels corresponding to the
- * height of the given number of characters.
- * <p>
- * This method may only be called after <code>initializeDialogUnits</code>
- * has been called.
- * </p>
- * <p>
- * Clients may call this framework method, but should not override it.
- * </p>
- *
- * @param chars the number of characters
- * @return the number of pixels
- */
-protected int convertHeightInCharsToPixels(int chars) {
- // test for failure to initialize for backward compatibility
- if (fontMetrics == null)
- return 0;
- return Dialog.convertHeightInCharsToPixels(fontMetrics, chars);
-}
-/**
- * Returns the number of pixels corresponding to the
- * given number of horizontal dialog units.
- * <p>
- * This method may only be called after <code>initializeDialogUnits</code>
- * has been called.
- * </p>
- * <p>
- * Clients may call this framework method, but should not override it.
- * </p>
- *
- * @param dlus the number of horizontal dialog units
- * @return the number of pixels
- */
-protected int convertHorizontalDLUsToPixels(int dlus) {
- // test for failure to initialize for backward compatibility
- if (fontMetrics == null)
- return 0;
- return Dialog.convertHorizontalDLUsToPixels(fontMetrics, dlus);
-}
-/**
- * Returns the number of pixels corresponding to the
- * given number of vertical dialog units.
- * <p>
- * This method may only be called after <code>initializeDialogUnits</code>
- * has been called.
- * </p>
- * <p>
- * Clients may call this framework method, but should not override it.
- * </p>
- *
- * @param dlus the number of vertical dialog units
- * @return the number of pixels
- */
-protected int convertVerticalDLUsToPixels(int dlus) {
- // test for failure to initialize for backward compatibility
- if (fontMetrics == null)
- return 0;
- return Dialog.convertVerticalDLUsToPixels(fontMetrics, dlus);
-}
-/**
- * Returns the number of pixels corresponding to the
- * width of the given number of characters.
- * <p>
- * This method may only be called after <code>initializeDialogUnits</code>
- * has been called.
- * </p>
- * <p>
- * Clients may call this framework method, but should not override it.
- * </p>
- *
- * @param chars the number of characters
- * @return the number of pixels
- */
-protected int convertWidthInCharsToPixels(int chars) {
- // test for failure to initialize for backward compatibility
- if (fontMetrics == null)
- return 0;
- return Dialog.convertWidthInCharsToPixels(fontMetrics, chars);
-}
-/**
- * The <code>DialogPage</code> implementation of an <code>IDialogPage</code>
- * method does nothing. Subclasses may extend.
- */
-public void dispose() {
- // deallocate SWT resources
- if (image != null) {
- image.dispose();
- image = null;
- }
-}
-/**
- * Returns the top level control for this dialog page.
- *
- * @return the top level control
- */
-public Control getControl() {
- return control;
-}
-/* (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public String getDescription() {
- return description;
-}
-/**
- * Returns the symbolic font name used by dialog pages.
- *
- * @return the symbolic font name
- */
-protected String getDialogFontName() {
- return JFaceResources.DIALOG_FONT;
-}
-/* (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public String getErrorMessage() {
- return errorMessage;
-}
-/**
- * Returns the default font to use for this dialog page.
- *
- * @return the font
- */
-protected Font getFont() {
- return JFaceResources.getFontRegistry().get(getDialogFontName());
-}
-/* (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public Image getImage() {
- if (image == null) {
- if (imageDescriptor != null) {
- image = imageDescriptor.createImage();
- }
- }
- return image;
-}
-/* (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public String getMessage() {
- return message;
-}
-/* (non-Javadoc)
- * Method declared on IMessageProvider.
- */
-public int getMessageType() {
- return messageType;
-}
-/**
- * Returns this dialog page's shell.
- * Convenience method for <code>getControl().getShell()</code>.
- * This method may only be called after the page's control
- * has been created.
- *
- * @return the shell
- */
-public Shell getShell() {
- return getControl().getShell();
-}
-/* (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public String getTitle() {
- return title;
-}
-/**
- * Returns the tool tip text for the widget with the given id.
- * <p>
- * The default implementation of this framework method
- * does nothing and returns <code>null</code>.
- * Subclasses may override.
- * </p>
- *
- * @param widgetID the id of the widget for which
- * hover help is requested
- * @return the tool tip text, or <code>null</code> if none
- * @depecated will be removed
- */
-protected final String getToolTipText(int widgetId) {
- // return nothing by default
- return null;
-}
-/**
- * Initializes the computation of horizontal and vertical dialog units
- * based on the size of current font.
- * <p>
- * This method must be called before any of the dialog unit based
- * conversion methods are called.
- * </p>
- *
- * @param control a control from which to obtain the current font
- */
-protected void initializeDialogUnits(Control control) {
- // Compute and store a font metric
- GC gc = new GC(control);
- gc.setFont(control.getFont());
- fontMetrics = gc.getFontMetrics();
- gc.dispose();
-}
-
-/**
- * Sets the <code>GridData</code> on the specified button to
- * be one that is spaced for the current dialog page units. The
- * method <code>initializeDialogUnits</code> must be called once
- * before calling this method for the first time.
- *
- * @param button the button to set the <code>GridData</code>
- * @return the <code>GridData</code> set on the specified button
- */
-protected GridData setButtonLayoutData(Button button) {
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- button.setLayoutData(data);
- return data;
-}
-
-/**
- * Tests whether this page's UI content has already been created.
- *
- * @return <code>true</code> if the control has been created,
- * and <code>false</code> if not
- */
-protected boolean isControlCreated() {
- return control != null;
-}
-/**
- * This default implementation of an <code>IDialogPage</code>
- * method does nothing. Subclasses should override to take some
- * action in response to a help request.
- */
-public void performHelp() {
-}
-/* (non-Javadoc)
- * Set the control for this page.
- */
-protected void setControl(Control newControl) {
- control = newControl;
-}
- /* (non-Javadoc)
- * Method declared on IDialogPage.
- */
- public void setDescription(String description) {
- this.description= description;
- }
-/**
- * Sets or clears the error message for this page.
- *
- * @param newMessage the message, or <code>null</code> to clear
- * the error message
- */
-public void setErrorMessage(String newMessage) {
- errorMessage = newMessage;
-}
-/* (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void setImageDescriptor(ImageDescriptor desc) {
- imageDescriptor = desc;
- if (image != null) {
- image.dispose();
- image = null;
- }
-}
-/**
- * Sets or clears the message for this page.
- * <p>
- * This is a shortcut for <code>setMessage(newMesasge, NONE)</code>
- * </p>
- * @param newMessage the message, or <code>null</code> to clear
- * the message
- */
-public void setMessage(String newMessage) {
- setMessage(newMessage, NONE);
-}
-/**
- * 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>.
- * </p>
- * <p>
- * Note that for backward compatibility, a message of type <code>ERROR</code>
- * is different than an error message (set using <code>setErrorMessage</code>).
- * An error message overrides the current message until the error message is
- * cleared. This method replaces the current message and does not affect the
- * error message.
- * </p>
- *
- * @param newMessage the message, or <code>null</code> to clear
- * the message
- * @param newType the message type
- * @since 2.0
- */
-public void setMessage(String newMessage, int newType) {
- message = newMessage;
- messageType = newType;
-}
-/**
- * The <code>DialogPage</code> implementation of this <code>IDialogPage</code>
- * method remembers the title in an internal state variable.
- * Subclasses may extend.
- */
-public void setTitle(String title) {
- this.title = title;
-}
-/**
- * The <code>DialogPage</code> implementation of this <code>IDialogPage</code>
- * method sets the control to the given visibility state.
- * Subclasses may extend.
- */
-public void setVisible(boolean visible) {
- control.setVisible(visible);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java
deleted file mode 100644
index 50a220f..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java
+++ /dev/null
@@ -1,339 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.*;
-import java.util.*;
-import javax.xml.parsers.*;
-import org.w3c.dom.*;
-import org.xml.sax.*;
-import org.apache.xerces.dom.DocumentImpl;
-import org.apache.xml.serialize.*;
-
-
-/**
- * Concrete implementation of a dialog settings (<code>IDialogSettings</code>)
- * using a hash table and XML. The dialog store can be read
- * from and saved to a stream. All keys and values must be strings or array of
- * strings. Primitive types are converted to strings.
- * <p>
- * This class was not designed to be subclassed.
- *
- * Here is an example of using a DialogSettings:
- * </p>
- * <code>
- * DialogSettings settings = new DialogSettings("root");
- * settings.put("Boolean1",true);
- * settings.put("Long1",100);
- * settings.put("Array1",new String[]{"aaaa1","bbbb1","cccc1"});
- * DialogSettings section = new DialogSettings("sectionName");
- * settings.addSection(section);
- * section.put("Int2",200);
- * section.put("Float2",1.1);
- * section.put("Array2",new String[]{"aaaa2","bbbb2","cccc2"});
- * settings.save("c:\\temp\\test\\dialog.xml");
- * </code>
- */
-
-public class DialogSettings implements IDialogSettings {
- // The name of the DialogSettings.
- private String name;
- /* A Map of DialogSettings representing each sections in a DialogSettings.
- It maps the DialogSettings' name to the DialogSettings */
- private Map sections;
- /* A Map with all the keys and values of this sections.
- Either the keys an values are restricted to strings. */
- private Map items;
- // A Map with all the keys mapped to array of strings.
- private Map arrayItems;
-
- private final String TAG_SECTION = "section";//$NON-NLS-1$
- private final String TAG_NAME = "name";//$NON-NLS-1$
- private final String TAG_KEY = "key";//$NON-NLS-1$
- private final String TAG_VALUE = "value";//$NON-NLS-1$
- private final String TAG_LIST = "list";//$NON-NLS-1$
- private final String TAG_ITEM = "item";//$NON-NLS-1$
-/**
- * Create an empty dialog settings which loads and saves its
- * content to a file.
- * Use the methods <code>load(String)</code> and <code>store(String)</code>
- * to load and store this dialog settings.
- *
- * @param sectionName the name of the section in the settings.
- */
-public DialogSettings(String sectionName) {
- name = sectionName;
- items = new HashMap();
- arrayItems = new HashMap();
- sections = new HashMap();
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public IDialogSettings addNewSection(String name) {
- DialogSettings section = new DialogSettings(name);
- addSection(section);
- return section;
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public void addSection(IDialogSettings section) {
- sections.put(section.getName(),section);
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public String get(String key) {
- return (String)items.get(key);
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public String[] getArray(String key) {
- return (String[])arrayItems.get(key);
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public boolean getBoolean(String key) {
- return new Boolean((String)items.get(key)).booleanValue();
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public double getDouble(String key) throws NumberFormatException {
- String setting = (String)items.get(key);
- if(setting == null)
- throw new NumberFormatException("There is no setting associated with the key \"" + key + "\"");//$NON-NLS-1$ //$NON-NLS-2$
-
- return new Double(setting).doubleValue();
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public float getFloat(String key) throws NumberFormatException {
- String setting = (String)items.get(key);
- if(setting == null)
- throw new NumberFormatException("There is no setting associated with the key \"" + key + "\"");//$NON-NLS-1$ //$NON-NLS-2$
-
- return new Float(setting).floatValue();
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public int getInt(String key) throws NumberFormatException {
- String setting = (String)items.get(key);
- if(setting == null) {
- //new Integer(null) will throw a NumberFormatException and meet our spec, but this message
- //is clearer.
- throw new NumberFormatException("There is no setting associated with the key \"" + key + "\"");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- return new Integer(setting).intValue();
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public long getLong(String key) throws NumberFormatException {
- String setting = (String)items.get(key);
- if(setting == null) {
- //new Long(null) will throw a NumberFormatException and meet our spec, but this message
- //is clearer.
- throw new NumberFormatException("There is no setting associated with the key \"" + key + "\"");//$NON-NLS-1$ //$NON-NLS-2$
- }
-
- return new Long(setting).longValue();
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public String getName() {
- return name;
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public IDialogSettings getSection(String sectionName) {
- return (IDialogSettings)sections.get(sectionName);
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public IDialogSettings[] getSections() {
- Collection values = sections.values();
- DialogSettings[] result = new DialogSettings[values.size()];
- values.toArray(result);
- return result;
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public void load(Reader r) {
- Document document = null;
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder parser = factory.newDocumentBuilder();
-// parser.setProcessNamespace(true);
- document = parser.parse(new InputSource(r));
-
- //Strip out any comments first
- Node root = document.getFirstChild();
- while(root.getNodeType() == Node.COMMENT_NODE){
- document.removeChild(root);
- root = document.getFirstChild();
- }
- load(document, (Element) root);
- } catch (ParserConfigurationException e) {
- } catch (IOException e) {
- } catch (SAXException e) {
- }
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public void load(String fileName) throws IOException {
- FileInputStream stream = new FileInputStream(fileName);
- InputStreamReader reader = new InputStreamReader(stream, "utf-8");//$NON-NLS-1$
- load(reader);
- reader.close();
-}
-/* (non-Javadoc)
- * Load the setting from the <code>document</code>
- */
-private void load(Document document,Element root) {
- name = root.getAttribute(TAG_NAME);
- NodeList l = root.getElementsByTagName(TAG_ITEM);
- for (int i = 0; i < l.getLength(); i++){
- Node n = l.item(i);
- if(root == n.getParentNode()) {
- String key = ((Element)l.item(i)).getAttribute(TAG_KEY);
- String value = ((Element)l.item(i)).getAttribute(TAG_VALUE);
- items.put(key,value);
- }
- }
- l = root.getElementsByTagName(TAG_LIST);
- for (int i = 0; i < l.getLength(); i++){
- Node n = l.item(i);
- if(root == n.getParentNode()) {
- Element child = (Element)l.item(i);
- String key = child.getAttribute(TAG_KEY);
- NodeList list = child.getElementsByTagName(TAG_ITEM);
- List valueList = new ArrayList();
- for (int j = 0; j < list.getLength(); j++){
- Element node = (Element)list.item(j);
- if(child == node.getParentNode()) {
- valueList.add(node.getAttribute(TAG_VALUE));
- }
- }
- String[] value = new String[valueList.size()];
- valueList.toArray(value);
- arrayItems.put(key,value);
- }
- }
- l = root.getElementsByTagName(TAG_SECTION);
- for (int i = 0; i < l.getLength(); i++){
- Node n = l.item(i);
- if(root == n.getParentNode()) {
- DialogSettings s = new DialogSettings("NoName");//$NON-NLS-1$
- s.load(document,(Element)n);
- addSection(s);
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public void put(String key,String[] value) {
- arrayItems.put(key,value);
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public void put(String key,double value) {
- put(key,String.valueOf(value));
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public void put(String key,float value) {
- put(key,String.valueOf(value));
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public void put(String key,int value) {
- put(key,String.valueOf(value));
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public void put(String key,long value) {
- put(key,String.valueOf(value));
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public void put(String key,String value) {
- items.put(key,value);
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public void put(String key,boolean value) {
- put(key,String.valueOf(value));
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public void save(Writer writer) throws IOException {
- Document document = new DocumentImpl();
- save(document, (Node) document);
- OutputFormat format = new OutputFormat();
- Serializer serializer = SerializerFactory.getSerializerFactory("xml").makeSerializer(writer, format);//$NON-NLS-1$
- serializer.asDOMSerializer().serialize(document);
-}
-/* (non-Javadoc)
- * Method declared on IDialogSettings.
- */
-public void save(String fileName) throws IOException {
- FileOutputStream stream = new FileOutputStream(fileName);
- OutputStreamWriter writer = new OutputStreamWriter(stream, "utf-8");//$NON-NLS-1$
- save(writer);
- writer.close();
-}
-/* (non-Javadoc)
- * Save the settings in the <code>document</code>.
- */
-private void save(Document document,Node parent) {
- Element root = document.createElement(TAG_SECTION);
- parent.appendChild(root);
- root.setAttribute(TAG_NAME, name);
-
- for(Iterator i = items.keySet().iterator();i.hasNext();) {
- String key = (String)i.next();
- Element child = document.createElement(TAG_ITEM);
- root.appendChild(child);
- child.setAttribute(TAG_KEY, key);
- child.setAttribute(TAG_VALUE, (String)items.get(key));
- }
-
- for(Iterator i = arrayItems.keySet().iterator();i.hasNext();) {
- String key = (String)i.next();
- Element child = document.createElement(TAG_LIST);
- root.appendChild(child);
- child.setAttribute(TAG_KEY, key);
- String[] value = (String[])arrayItems.get(key);
- for (int index = 0; index < value.length; index++){
- Element c = document.createElement(TAG_ITEM);
- child.appendChild(c);
- c.setAttribute(TAG_VALUE, value[index]);
- }
- }
- for(Iterator i = sections.values().iterator();i.hasNext();) {
- ((DialogSettings)i.next()).save(document,root);
- }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogConstants.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogConstants.java
deleted file mode 100644
index d1e5ff4..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogConstants.java
+++ /dev/null
@@ -1,247 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Various dialog-related constants.
- * <p>
- * Within the dialog framework, all buttons are referred to
- * by a button id. Various common buttons, like "OK", "Cancel",
- * and "Finish", have pre-assigned button ids for convenience.
- * If an application requires other dialog buttons, they should
- * be assigned application-specific button ids counting up from
- * <code>CLIENT_ID</code>.
- * </p>
- * <p>
- * Button label constants are also provided for the common
- * buttons. JFace automatically localizes these strings to
- * the current locale; that is, <code>YES_LABEL</code> would
- * be bound to the string <code>"Si"</code> in a Spanish
- * locale, but to <code>"Oui"</code> in a French one.
- * </p>
- * <p>
- * All margins, spacings, and sizes are given in
- * "dialog units" (DLUs), where
- * <ul>
- * <li>1 horizontal DLU = 1/4 average character width</li>
- * <li>1 vertical DLU = 1/8 average character height</li>
- * </ul>
- * </p>
- */
-import org.eclipse.jface.resource.JFaceResources;
-
-public interface IDialogConstants {
-
- // button ids
-
- /**
- * Button id for an "Ok" button (value 0).
- */
- public int OK_ID = 0;
-
- /**
- * Button id for a "Cancel" button (value 1).
- */
- public int CANCEL_ID = 1;
-
- /**
- * Button id for a "Yes" button (value 2).
- */
- public int YES_ID = 2;
-
- /**
- * Button id for a "No" button (value 3).
- */
- public int NO_ID = 3;
-
- /**
- * Button id for a "Yes to All" button (value 4).
- */
- public int YES_TO_ALL_ID = 4;
-
- /**
- * Button id for a "Skip" button (value 5).
- */
- public int SKIP_ID = 5;
-
- /**
- * Button id for a "Stop" button (value 6).
- */
- public int STOP_ID = 6;
-
- /**
- * Button id for an "Abort" button (value 7).
- */
- public int ABORT_ID = 7;
-
- /**
- * Button id for a "Retry" button (value 8).
- */
- public int RETRY_ID = 8;
-
- /**
- * Button id for an "Ignore" button (value 9).
- */
- public int IGNORE_ID = 9;
-
- /**
- * Button id for a "Proceed" button (value 10).
- */
- public int PROCEED_ID = 10;
-
- /**
- * Button id for an "Open" button (value 11).
- */
- public int OPEN_ID = 11;
-
- /**
- * Button id for a "Close" button (value 12).
- */
- public int CLOSE_ID = 12;
-
- /**
- * Button id for a "Details" button (value 13).
- */
- public int DETAILS_ID = 13;
-
- /**
- * Button id for a "Back" button (value 14).
- */
- public int BACK_ID = 14;
-
- /**
- * Button id for a "Next" button (value 15).
- */
- public int NEXT_ID = 15;
-
- /**
- * Button id for a "Finish" button (value 16).
- */
- public int FINISH_ID = 16;
-
- /**
- * Button id for a "Help" button (value 17).
- */
- public int HELP_ID = 17;
-
- /**
- * Button id for a "Select All" button (value 18).
- */
- public int SELECT_ALL_ID = 18;
-
- /**
- * Button id for a "Deselect All" button (value 19).
- */
- public int DESELECT_ALL_ID = 19;
-
- /**
- * Button id for a "Select types" button (value 19).
- */
- public int SELECT_TYPES_ID = 20;
-
-
- /**
- * Starting button id reserved for internal use by
- * JFace (value 256). JFace classes make ids by
- * adding to this number.
- */
- public int INTERNAL_ID = 256;
-
- /**
- * Starting button id reserved for use by
- * clients of JFace (value 1024). Clients of JFace should
- * make ids by adding to this number.
- */
- public int CLIENT_ID = 1024;
-
- // button labels
- public String OK_LABEL = JFaceResources.getString("ok"); //$NON-NLS-1$
- public String CANCEL_LABEL = JFaceResources.getString("cancel"); //$NON-NLS-1$
- public String YES_LABEL = JFaceResources.getString("yes"); //$NON-NLS-1$
- public String NO_LABEL = JFaceResources.getString("no"); //$NON-NLS-1$
- public String NO_TO_ALL_LABEL = JFaceResources.getString("notoall"); //$NON-NLS-1$
- public String YES_TO_ALL_LABEL = JFaceResources.getString("yestoall"); //$NON-NLS-1$
- public String SKIP_LABEL = JFaceResources.getString("skip"); //$NON-NLS-1$
- public String STOP_LABEL = JFaceResources.getString("stop"); //$NON-NLS-1$
- public String ABORT_LABEL = JFaceResources.getString("abort"); //$NON-NLS-1$
- public String RETRY_LABEL = JFaceResources.getString("retry"); //$NON-NLS-1$
- public String IGNORE_LABEL = JFaceResources.getString("ignore"); //$NON-NLS-1$
- public String PROCEED_LABEL = JFaceResources.getString("proceed"); //$NON-NLS-1$
- public String OPEN_LABEL = JFaceResources.getString("open"); //$NON-NLS-1$
- public String CLOSE_LABEL = JFaceResources.getString("close"); //$NON-NLS-1$
- public String SHOW_DETAILS_LABEL = JFaceResources.getString("showDetails"); //$NON-NLS-1$
- public String HIDE_DETAILS_LABEL = JFaceResources.getString("hideDetails"); //$NON-NLS-1$
- public String BACK_LABEL = JFaceResources.getString("backButton"); //$NON-NLS-1$
- public String NEXT_LABEL = JFaceResources.getString("nextButton"); //$NON-NLS-1$
- public String FINISH_LABEL = JFaceResources.getString("finish"); //$NON-NLS-1$
- public String HELP_LABEL = JFaceResources.getString("help"); //$NON-NLS-1$
-
- // Margins, spacings, and sizes
- /**
- * Vertical margin in dialog units (value 7).
- */
- public int VERTICAL_MARGIN = 7;
-
- /**
- * Vertical spacing in dialog units (value 4).
- */
- public int VERTICAL_SPACING = 4;
-
- /**
- * Horizontal margin in dialog units (value 7).
- */
- public int HORIZONTAL_MARGIN = 7;
-
- /**
- * Horizontal spacing in dialog units (value 4).
- */
- public int HORIZONTAL_SPACING = 4;
-
- /**
- * Height of button bar in dialog units (value 25).
- */
- public int BUTTON_BAR_HEIGHT = 25;
-
- /**
- * Left margin in dialog units (value 20).
- */
- public int LEFT_MARGIN = 20;
-
- /**
- * Button margin in dialog units (value 4).
- */
- public int BUTTON_MARGIN = 4;
-
- /**
- * Button height in dialog units (value 14).
- */
- public int BUTTON_HEIGHT = 14;
-
- /**
- * Button width in dialog units (value 61).
- */
- public int BUTTON_WIDTH = 61;
-
- /**
- * Indent in dialog units (value 21).
- */
- public int INDENT = 21;
-
- /**
- * Small indent in dialog units (value 7).
- */
- public int SMALL_INDENT = 7;
-
- /**
- * Entry field width in dialog units (value 200).
- */
- public int ENTRY_FIELD_WIDTH = 200;
-
- /**
- * Minimum width of message area in dialog units (value 300).
- */
- public int MINIMUM_MESSAGE_AREA_WIDTH = 300;
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogPage.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogPage.java
deleted file mode 100644
index 03d5a2f..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogPage.java
+++ /dev/null
@@ -1,118 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Interface for a page in a multi-page dialog.
- */
-public interface IDialogPage {
-/**
- * Creates the top level control for this dialog
- * page under the given parent composite.
- * <p>
- * Implementors are responsible for ensuring that
- * the created control can be accessed via <code>getControl</code>
- * </p>
- *
- * @param parent the parent composite
- */
-public void createControl(Composite parent);
-/**
- * Disposes the SWT resources allocated by this
- * dialog page.
- */
-public void dispose();
-/**
- * Returns the top level control for this dialog page.
- * <p>
- * May return <code>null</code> if the control
- * has not been created yet.
- * </p>
- *
- * @return the top level control or <code>null</code>
- */
-public Control getControl();
-/**
- * Returns this dialog page's description text.
- *
- * @return the description text for this dialog page,
- * or <code>null</code> if none
- */
-public String getDescription();
-/**
- * Returns the current error message for this dialog page.
- * May be <code>null</null> to indicate no error message.
- * <p>
- * An error message should describe some error state,
- * as opposed to a message which may simply provide instruction
- * or information to the user.
- * </p>
- *
- * @return the error message, or <code>null</code> if none
- */
-public String getErrorMessage();
-/**
- * Returns this dialog page's image.
- *
- * @return the image for this dialog page, or <code>null</code>
- * if none
- */
-public Image getImage();
-/**
- * Returns the current message for this wizard page.
- * <p>
- * A message provides instruction or information to the
- * user, as opposed to an error message which should
- * describe some error state.
- * </p>
- *
- * @return the message, or <code>null</code> if none
- */
-public String getMessage();
-/**
- * Returns this dialog page's title.
- *
- * @return the title of this dialog page,
- * or <code>null</code> if none
- */
-public String getTitle();
-/**
- * Notifies that help has been requested for this dialog page.
- */
-public void performHelp();
-/**
- * Sets this dialog page's description text.
- *
- * @param description the description text for this dialog
- * page, or <code>null</code> if none
- */
-public void setDescription(String description);
-/**
- * Sets this dialog page's image.
- *
- * @param image the image for this dialog page,
- * or <code>null</code> if none
- */
-public void setImageDescriptor(ImageDescriptor image);
-/**
- * Set this dialog page's title.
- *
- * @param title the title of this dialog page,
- * or <code>null</code> if none
- */
-public void setTitle(String title);
-/**
- * Sets the visibility of this dialog page.
- *
- * @param visible <code>true</code> to make this page visible,
- * and <code>false</code> to hide it
- */
-public void setVisible(boolean visible);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogSettings.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogSettings.java
deleted file mode 100644
index b6cccfb..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogSettings.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-import java.io.*;
-
-/**
- * An interface to a storage mechanism for making dialog settings
- * persistent. The store manages a collection of key/value pairs.
- * The key must be a string and the values can be either, strings or
- * array of strings. Convenience API to convert primitive
- * types to strings is provided.
- */
-
-public interface IDialogSettings {
-/**
- * Create a new section in the receiver and return it.
- *
- * @param name the name of the new section
- * @return the new section
- */
-public IDialogSettings addNewSection(String name);
-/**
- * Add a section in the receiver.
- *
- * @param section the section to be added
- */
-public void addSection(IDialogSettings section);
-/**
- * Returns the value of the given key in this dialog settings.
- *
- * @param key the key
- * @return the value, or <code>null</code> if none
- */
-public String get(String key);
-/**
- * Returns the value, an array of strings, of the given key in
- * this dialog settings.
- *
- * @param key the key
- * @return the array of string, or <code>null</code> if none
- */
-public String[] getArray(String key);
-/**
- * Convenience API.
- * Convert the value of the given key in this dialog settings
- * to a boolean and return it.
- *
- * @param key the key
- * @return the boolean value, or <code>false</code> if none
- */
-public boolean getBoolean(String key);
-/**
- * Convenience API.
- * Convert the value of the given key in this dialog settings
- * to a double and return it.
- *
- * @param key the key
- * @return the value coverted to double, or throws <code>NumberFormatException</code> if none
- *
- * @exception NumberFormatException if the string value does not contain a
- * parsable number.
- * @see java.lang.Double#valueOf(java.lang.String)
- */
-public double getDouble(String key) throws NumberFormatException;
-/**
- * Convenience API.
- * Convert the value of the given key in this dialog settings
- * to a float and return it.
- *
- * @param key the key
- * @return the value coverted to float, or throws <code>NumberFormatException</code> if none
- *
- * @exception NumberFormatException if the string value does not contain a
- * parsable number.
- * @see java.lang.Float#valueOf(java.lang.String)
- */
-public float getFloat(String key) throws NumberFormatException;
-/**
- * Convenience API.
- * Convert the value of the given key in this dialog settings
- * to a int and return it.
- *
- * @param key the key
- * @return the value coverted to int, or throws <code>NumberFormatException</code> if none
- *
- * @exception NumberFormatException if the string value does not contain a
- * parsable number.
- * @see java.lang.Integer#valueOf(java.lang.String)
- */
-public int getInt(String key) throws NumberFormatException;
-/**
- * Convenience API.
- * Convert the value of the given key in this dialog settings
- * to a long and return it.
- *
- * @param key the key
- * @return the value coverted to long, or throws <code>NumberFormatException</code> if none
- *
- * @exception NumberFormatException if the string value does not contain a
- * parsable number.
- * @see java.lang.Long#valueOf(java.lang.String)
- */
-public long getLong(String key) throws NumberFormatException;
-/**
- * Returns the IDialogSettings name.
- *
- * @return the name
- */
-public String getName();
-/**
- * Returns the section with the given name in this dialog settings.
- *
- * @param key the key
- * @return the section, or <code>null</code> if none
- */
-public IDialogSettings getSection(String sectionName);
-/**
- * Returns all the sections in this dialog settings.
- *
- * @return the section, or <code>null</code> if none
- */
-public IDialogSettings[] getSections();
-/**
- * Load a dialog settings from a stream and fill the receiver with its
- * content.
- *
- * @param reader a Reader specifying the stream where the settings are read from.
- */
-public void load(Reader reader) throws IOException;
-/**
- * Load a dialog settings from a file and fill the receiver with its
- * content.
- *
- * @param fileName the name of the file the settings are read from.
- */
-public void load(String fileName) throws IOException;
-/**
- * Adds the pair <code>key/value</code> to this dialog settings.
- *
- * @param key the key.
- * @param value the value to be associated with the <code>key</code>
- */
-public void put(String key,String[] value);
-/**
- * Convenience API.
- * Converts the double <code>value</code> to a string and adds
- * the pair <code>key/value</code> to this dialog settings.
- *
- * @param key the key.
- * @param value the value to be associated with the <code>key</code>
- */
-public void put(String key,double value);
-/**
- * Convenience API.
- * Converts the float <code>value</code> to a string and adds
- * the pair <code>key/value</code> to this dialog settings.
- *
- * @param key the key.
- * @param value the value to be associated with the <code>key</code>
- */
-public void put(String key,float value);
-/**
- * Convenience API.
- * Converts the int <code>value</code> to a string and adds
- * the pair <code>key/value</code> to this dialog settings.
- *
- * @param key the key.
- * @param value the value to be associated with the <code>key</code>
- */
-public void put(String key,int value);
-/**
- * Convenience API.
- * Converts the long <code>value</code> to a string and adds
- * the pair <code>key/value</code> to this dialog settings.
- *
- * @param key the key.
- * @param value the value to be associated with the <code>key</code>
- */
-public void put(String key,long value);
-/**
- * Adds the pair <code>key/value</code> to this dialog settings.
- *
- * @param key the key.
- * @param value the value to be associated with the <code>key</code>
- */
-public void put(String key,String value);
-/**
- * Convenience API.
- * Converts the boolean <code>value</code> to a string and adds
- * the pair <code>key/value</code> to this dialog settings.
- *
- * @param key the key.
- * @param value the value to be associated with the <code>key</code>
- */
-public void put(String key,boolean value);
-/**
- * Save a dialog settings to a stream
- *
- * @param writer a Writer specifying the stream the settings are written in.
- */
-public void save(Writer writer) throws IOException;
-/**
- * Save a dialog settings to a file.
- *
- * @param fileName the name of the file the settings are written in.
- */
-public void save(String fileName) throws IOException;
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IInputValidator.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IInputValidator.java
deleted file mode 100644
index ba69588..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IInputValidator.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/*
- * Minimal interface to an input validator.
- * Input validators are used in <code>InputDialog</code>.
- */
-public interface IInputValidator {
-/**
- * Validates the given string. Returns an error message to display
- * if the new text is invalid. Returns <code>null</code> if there
- * is no error. Note that the empty string is not treated the same
- * as <code>null</code>; it indicates an error state but with no message
- * to display.
- *
- * @return an error message or <code>null</code> if no error
- */
-public String isValid(String newText);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IMessageProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IMessageProvider.java
deleted file mode 100644
index 3f72e0d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IMessageProvider.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-import org.eclipse.swt.SWT;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-/**
- * Minimal interface to a message provider.
- * Used for dialog pages which can provide a message with an icon.
- * @since 2.0
- */
-public interface IMessageProvider {
- /**
- * Constant for a regular message (value 0).
- * <p>
- * Typically this indicates that the message should be
- * shown without an icon.
- * </p>
- */
- public final static int NONE = 0;
-
- /**
- * Constant for an info message (value 1).
- */
- public final static int INFORMATION = 1;
-
- /**
- * Constant for a warning message (value 2).
- */
- public final static int WARNING = 2;
-
- /**
- * Constant for an error message (value 3).
- */
- public final static int ERROR = 3;
-
- /**
- * Returns the current message for this message provider
- * <p>
- * A message provides instruction or information to the
- * user.
- * </p>
- *
- * @return the message, or <code>null</code> if none
- */
- public String getMessage();
-
- /**
- * Returns a value indicating if the message is a an
- * information message, a rning message, or an error message.
- * <p>
- * Returns one of <code>NONE</code>, <code>INFORMATION</code>,
- * <code>WARNING</code>, or <code>ERROR</code>.
- * </p>
- *
- * @return the message type
- */
- public int getMessageType();
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IconAndMessageDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IconAndMessageDialog.java
deleted file mode 100644
index a68cc75..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IconAndMessageDialog.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * The IconAndMessageDialog is the abstract superclass of dialogs that
- * have an icon and a message as the first two widgets. In this dialog
- * the icon and message are direct children of the shell in order that
- * they can be read by accessibility tools more easily.
- */
-public abstract class IconAndMessageDialog extends Dialog {
-
- /**
- * Message (a localized string).
- */
- protected String message;
-
- /**
- * Constructor for IconAndMessageDialog.
- * @param parentShell
- */
- public IconAndMessageDialog(Shell parentShell) {
- super(parentShell);
- }
-
- /**
- * Create the area the message will be shown in.
- */
- protected Control createMessageArea(Composite composite) {
- // create composite
-
- // create image
- Image image = getImage();
- if (image != null) {
- Label label = new Label(composite, 0);
- image.setBackground(label.getBackground());
- label.setImage(image);
- label.setLayoutData(
- new GridData(
- GridData.HORIZONTAL_ALIGN_CENTER
- | GridData.VERTICAL_ALIGN_BEGINNING));
- }
-
- // create message
- if (message != null) {
- Label label = new Label(composite, SWT.WRAP);
- label.setText(message);
- GridData data = new GridData(GridData.GRAB_HORIZONTAL |
- //GridData.GRAB_VERTICAL |
- GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint =
- convertHorizontalDLUsToPixels(
- IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- ;
- label.setLayoutData(data);
- label.setFont(composite.getFont());
- }
- return composite;
- }
-
- /*
- * @see Dialog.createButtonBar()
- */
- 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 = 0; // this is incremented by createButton
- layout.makeColumnsEqualWidth = true;
- 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.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
- data.horizontalSpan = 2;
- composite.setLayoutData(data);
-
- composite.setFont(parent.getFont());
-
- // Add the buttons to the button bar.
- createButtonsForButtonBar(composite);
-
- return composite;
-
- }
-
- /**
- * Returns the image to display beside the message in this dialog.
- * <p>
- * Subclasses may override.
- * </p>
- *
- * @return the image to display beside the message
- * @since 2.0
- */
- protected abstract Image getImage();
-
- /*
- * @see Dialog.createContents(Composite)
- */
- protected Control createContents(Composite parent) {
-
- // initialize the dialog units
- initializeDialogUnits(parent);
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.makeColumnsEqualWidth = false;
- parent.setLayout(layout);
- parent.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // create the dialog area and button bar
- dialogArea = createDialogArea(parent);
- buttonBar = createButtonBar(parent);
-
-
- return parent;
- }
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/InputDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/InputDialog.java
deleted file mode 100644
index a2f2f2fe7..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/InputDialog.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-
-/**
- * A simple input dialog for soliciting an input string
- * from the user.
- * <p>
- * This concete dialog class can be instantiated as is,
- * or further subclassed as required.
- * </p>
- */
-public class InputDialog extends Dialog {
-
-
- /**
- * The title of the dialog.
- */
- private String title;
-
- /**
- * The message to display, or <code>null</code> if none.
- */
- private String message;
-
- /**
- * The input value; the empty string by default.
- */
- private String value= "";//$NON-NLS-1$
-
- /**
- * The input validator, or <code>null</code> if none.
- */
- private IInputValidator validator;
-
- /**
- * Ok button widget.
- */
- private Button okButton;
-
- /**
- * Input text widget.
- */
- private Text text;
-
- /**
- * Error message label widget.
- */
- private Label errorMessageLabel;
-/**
- * Creates an input dialog with OK and Cancel buttons.
- * Note that the dialog will have no visual representation (no widgets)
- * until it is told to open.
- * <p>
- * Note that the <code>open</code> method blocks for input dialogs.
- * </p>
- *
- * @param parentShell the parent shell
- * @param dialogTitle the dialog title, or <code>null</code> if none
- * @param dialogMessage the dialog message, or <code>null</code> if none
- * @param initialValue the initial input value, or <code>null</code> if none
- * (equivalent to the empty string)
- * @param validator an input validator, or <code>null</code> if none
- */
-public InputDialog(Shell parentShell, String dialogTitle, String dialogMessage, String initialValue, IInputValidator validator) {
- super(parentShell);
- this.title = dialogTitle;
- message = dialogMessage;
- if (initialValue == null)
- value = "";//$NON-NLS-1$
- else
- value = initialValue;
- this.validator = validator;
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID) {
- value= text.getText();
- } else {
- value= null;
- }
- super.buttonPressed(buttonId);
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- if (title != null)
- shell.setText(title);
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void createButtonsForButtonBar(Composite parent) {
- // create OK and Cancel buttons by default
- okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
-
- //do this here because setting the text will set enablement on the ok button
- text.setFocus();
- if (value != null) {
- text.setText(value);
- text.selectAll();
- }
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- // create composite
- Composite composite = (Composite)super.createDialogArea(parent);
-
- // create message
- if (message != null) {
- Label label = new Label(composite, SWT.WRAP);
- label.setText(message);
- GridData data = new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.GRAB_VERTICAL |
- GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_CENTER);
- data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);;
- label.setLayoutData(data);
- label.setFont(parent.getFont());
- }
-
- text= new Text(composite, SWT.SINGLE | SWT.BORDER);
- text.setLayoutData(new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.HORIZONTAL_ALIGN_FILL));
- text.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateInput();
- }
- }
- );
-
- errorMessageLabel = new Label(composite, SWT.NONE);
- errorMessageLabel.setLayoutData(new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.HORIZONTAL_ALIGN_FILL));
- errorMessageLabel.setFont(parent.getFont());
-
- return composite;
-}
-/**
- * Returns the error message label.
- *
- * @return the error message label
- */
-protected Label getErrorMessageLabel() {
- return errorMessageLabel;
-}
-/**
- * Returns the ok button.
- *
- * @return the ok button
- */
-protected Button getOkButton() {
- return okButton;
-}
-/**
- * Returns the text area.
- *
- * @return the text area
- */
-protected Text getText() {
- return text;
-}
-/**
- * Returns the validator.
- *
- * @return the validator
- */
-protected IInputValidator getValidator() {
- return validator;
-}
-/**
- * Returns the string typed into this input dialog.
- *
- * @return the input string
- */
-public String getValue() {
- return value;
-}
-/**
- * Validates the input.
- * <p>
- * The default implementation of this framework method
- * delegates the request to the supplied input validator object;
- * if it finds the input invalid, the error message is displayed
- * in the dialog's message line.
- * This hook method is called whenever the text changes in the
- * input field.
- * </p>
- */
-protected void validateInput() {
-
- String errorMessage = null;
-
- if (validator != null) {
- errorMessage = validator.isValid(text.getText());
- }
-
- // Bug 16256: important not to treat "" (blank error) the same as null (no error)
- errorMessageLabel.setText(errorMessage == null ? "" : errorMessage);
- okButton.setEnabled(errorMessage == null);
-
- errorMessageLabel.getParent().update();
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/MessageDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/MessageDialog.java
deleted file mode 100644
index 0635ef3..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/MessageDialog.java
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ProgressIndicator.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ProgressIndicator.java
deleted file mode 100644
index 7be2b99..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ProgressIndicator.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.ProgressBar;
-
-/**
- * A control for showing progress feedback for a long running operation.
- * This control supports both determinate and indeterminate SWT progress bars.
- * For indeterminate progress, we don't have to know the total amount of work in advance
- * and no <code>worked</code> method needs to be called.
- */
-public class ProgressIndicator extends Composite {
-
- private final static int PROGRESS_MAX = 1000; // value to use for max in progress bar
-
- private boolean animated = true;
- private StackLayout layout;
- private ProgressBar determinateProgressBar;
- private ProgressBar indeterminateProgressBar;
- private double totalWork;
- private double sumWorked;
-
- /**
- * Create a ProgressIndicator as a child under the given parent.
- * @param parent The widgets parent
- */
- public ProgressIndicator(Composite parent) {
- super(parent, SWT.NULL);
- determinateProgressBar = new ProgressBar(this, SWT.HORIZONTAL);
- indeterminateProgressBar = new ProgressBar(this, SWT.HORIZONTAL | SWT.INDETERMINATE);
- layout = new StackLayout();
- setLayout(layout);
- }
-
- /**
- * Initialize the progress bar to be animated.
- */
- public void beginAnimatedTask() {
- done();
- layout.topControl = indeterminateProgressBar;
- layout();
- animated = true;
- }
-
- /**
- * Initialize the progress bar.
- * @param max The maximum value.
- */
- public void beginTask(int totalWork) {
- done();
- this.totalWork = totalWork;
- this.sumWorked = 0;
- determinateProgressBar.setMinimum(0);
- determinateProgressBar.setMaximum(PROGRESS_MAX);
- determinateProgressBar.setSelection(0);
- layout.topControl = determinateProgressBar;
- layout();
- animated = false;
- }
-
- /**
- * Progress is done.
- */
- public void done() {
- if (!animated) {
- determinateProgressBar.setMinimum(0);
- determinateProgressBar.setMaximum(0);
- determinateProgressBar.setSelection(0);
- }
-
- layout.topControl = null;
- layout();
- }
-
- /**
- * Moves the progress indicator to the end.
- */
- public void sendRemainingWork() {
- worked(totalWork - sumWorked);
- }
-
- /**
- * Moves the progress indicator by the given amount of work units
- */
- public void worked(double work) {
- if (work == 0 || animated) {
- return;
- }
-
- sumWorked += work;
-
- if (sumWorked > totalWork) {
- sumWorked = totalWork;
- }
-
- if (sumWorked < 0) {
- sumWorked = 0;
- }
-
- int value = (int) (sumWorked / totalWork * PROGRESS_MAX);
-
- if (determinateProgressBar.getSelection() < value) {
- determinateProgressBar.setSelection(value);
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/TitleAreaDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/TitleAreaDialog.java
deleted file mode 100644
index 0f9ef7d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/TitleAreaDialog.java
+++ /dev/null
@@ -1,609 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.jface.resource.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.graphics.Point;
-/**
- * A dialog that has a title area for displaying a title and an image as well as
- * a common area for displaying a description, a message, or an error message.
- * <p>
- * This dialog class may be subclassed.
- */
-public class TitleAreaDialog extends Dialog {
- /**
- * Image registry key for error message image.
- */
- public static final String DLG_IMG_TITLE_ERROR = DLG_IMG_MESSAGE_ERROR;//$NON-NLS-1$
-
- /**
- * Image registry key for banner image (value <code>"dialog_title_banner_image"</code>).
- */
- public static final String DLG_IMG_TITLE_BANNER = "dialog_title_banner_image";//$NON-NLS-1$
-
- /**
- * Message type constant used to display an info icon with the message.
- * @since 2.0
- * @deprecated
- */
- public final static String INFO_MESSAGE = "INFO_MESSAGE"; //$NON-NLS-1$
-
- /**
- * Message type constant used to display a warning icon with the message.
- * @since 2.0
- * @deprecated
- */
- public final static String WARNING_MESSAGE = "WARNING_MESSAGE"; //$NON-NLS-1$
-
- // Space between an image and a label
- private static final int H_GAP_IMAGE = 5;
- //Minimum dialog width (in dialog units)
- private static final int MIN_DIALOG_WIDTH = 350;
- //Minimum dialog height (in dialog units)
- private static final int MIN_DIALOG_HEIGHT = 150;
-
- static {
- ImageRegistry reg = JFaceResources.getImageRegistry();
- reg.put(DLG_IMG_TITLE_BANNER, ImageDescriptor.createFromFile(TitleAreaDialog.class, "images/title_banner.gif"));//$NON-NLS-1$
- }
-
- private Label titleLabel;
- private Label titleImage;
- private Label bottomFillerLabel;
- private Label leftFillerLabel;
- private Color titleAreaColor;
- private RGB titleAreaRGB;
-
- private String message = ""; //$NON-NLS-1$
- private String errorMessage;
- private Label messageLabel;
-
- private Label messageImageLabel;
- private Image messageImage;
- private Color normalMsgAreaBackground;
- private Color errorMsgAreaBackground;
- private Image errorMsgImage;
- private boolean showingError = false;
- private boolean titleImageLargest = true;
-
-/**
- * Instantiate a new title area dialog.
- *
- * @param parentShell the parent SWT shell
- */
-public TitleAreaDialog(Shell parentShell) {
- super(parentShell);
-}
-
-/*
- * @see Dialog.createContents(Composite)
- */
-protected Control createContents(Composite parent) {
-
- // initialize the dialog units
- initializeDialogUnits(parent);
-
-
- FormLayout layout = new FormLayout();
- parent.setLayout(layout);
- FormData data = new FormData();
- data.top = new FormAttachment(0,0);
- data.bottom = new FormAttachment(100,100);
- parent.setLayoutData(data);
-
- Control top = createTitleArea(parent);
-
- //Now create a work area for the rest of the dialog
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout childLayout = new GridLayout();
- childLayout.marginHeight = 0;
- childLayout.marginWidth = 0;
- childLayout.verticalSpacing = 0;
- composite.setLayout(childLayout);
-
- FormData childData = new FormData();
- childData.top = new FormAttachment(top);
- childData.right = new FormAttachment(100,0);
- childData.left = new FormAttachment(0,0);
- childData.bottom = new FormAttachment(100,0);
- composite.setLayoutData(childData);
-
- composite.setFont(JFaceResources.getDialogFont());
-
- // initialize the dialog units
- initializeDialogUnits(composite);
-
- // create the dialog area and button bar
- dialogArea = createDialogArea(composite);
- buttonBar = createButtonBar(composite);
-
- return parent;
-}
-
-/**
- * Creates and returns the contents of the upper part
- * of this dialog (above the button bar).
- * <p>
- * The <code>Dialog</code> implementation of this framework method
- * creates and returns a new <code>Composite</code> with
- * standard margins and spacing. Subclasses should override.
- * </p>
- *
- * @param the parent composite to contain the dialog area
- * @return the dialog area control
- */
-protected Control createDialogArea(Composite parent) {
- // create the top level composite for the dialog area
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parent.getFont());
-
- // Build the separator line
- Label titleBarSeparator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
- titleBarSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- return composite;
-}
-/**
- * Creates the dialog's title area.
- *
- * @param parent the SWT parent for the title area widgets
- * @return Control with the highest x axis value.
- */
-private Control createTitleArea(Composite parent) {
-
- // add a dispose listener
- parent.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
-
- if (titleAreaColor != null)
- titleAreaColor.dispose();
- if (errorMsgAreaBackground != null)
- errorMsgAreaBackground.dispose();
- }
- });
-
-
- // Determine the background color of the title bar
- Display display = parent.getDisplay();
- Color background;
- Color foreground;
- if (titleAreaRGB != null) {
- titleAreaColor = new Color(display, titleAreaRGB);
- background = titleAreaColor;
- foreground = null;
- } else {
- background = JFaceColors.getBannerBackground(display);
- foreground = JFaceColors.getBannerForeground(display);
- }
-
- int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- parent.setBackground(background);
-
- // Dialog image @ right
- titleImage = new Label(parent, SWT.CENTER);
- titleImage.setBackground(background);
- titleImage.setImage(JFaceResources.getImage(DLG_IMG_TITLE_BANNER));
-
- FormData imageData = new FormData();
- imageData.top = new FormAttachment(0,verticalSpacing);
- imageData.right = new FormAttachment(100,horizontalSpacing);
- titleImage.setLayoutData(imageData);
-
- // Title label @ top, left
- titleLabel = new Label(parent, SWT.LEFT);
- JFaceColors.setColors(titleLabel,foreground,background);
- titleLabel.setFont(JFaceResources.getBannerFont());
- titleLabel.setText(" ");//$NON-NLS-1$
-
- FormData titleData = new FormData();
- titleData.top = new FormAttachment(0,verticalSpacing);
- titleData.right = new FormAttachment(titleImage);
- titleData.left = new FormAttachment(0,horizontalSpacing);
- titleLabel.setLayoutData(titleData);
-
- // Message image @ bottom, left
- messageImageLabel = new Label(parent, SWT.CENTER);
- messageImageLabel.setBackground(background);
-
- // Message label @ bottom, center
- messageLabel = new Label(parent, SWT.WRAP);
- JFaceColors.setColors(messageLabel,foreground,background);
- messageLabel.setText(" \n "); // two lines//$NON-NLS-1$
- messageLabel.setFont(JFaceResources.getDialogFont());
-
-
- // Filler labels
- leftFillerLabel = new Label(parent, SWT.CENTER);
- leftFillerLabel.setBackground(background);
-
- bottomFillerLabel = new Label(parent, SWT.CENTER);
- bottomFillerLabel.setBackground(background);
-
- setLayoutsForNormalMessage(verticalSpacing, horizontalSpacing);
-
- determineTitleImageLargest();
- if(titleImageLargest)
- return titleImage;
- else
- return messageLabel;
-
-}
-
-/**
- * Determine if the title image is larger than the title message
- * and message area. This is used for layout decisions.
- */
-private void determineTitleImageLargest (){
-
- int titleY = titleImage.computeSize(SWT.DEFAULT,SWT.DEFAULT).y;
-
- int labelY = titleLabel.computeSize(SWT.DEFAULT,SWT.DEFAULT).y;
- labelY += messageLabel.computeSize(SWT.DEFAULT,SWT.DEFAULT).y;
-
- titleImageLargest = titleY > labelY;
-}
-
-
-/**
- * Set the layout values for the messageLabel, messageImageLabel and
- * fillerLabel for the case where there is a normal message.
- * @param verticalSpacing int The spacing between widgets on the vertical axis.
- * @param horizontalSpacing int The spacing between widgets on the horizontal axis.
- */
-
-private void setLayoutsForNormalMessage(
- int verticalSpacing,
- int horizontalSpacing) {
- FormData messageImageData = new FormData();
- messageImageData.top = new FormAttachment(titleLabel,verticalSpacing);
- messageImageData.left = new FormAttachment(0,H_GAP_IMAGE);
- messageImageLabel.setLayoutData(messageImageData);
-
- FormData messageLabelData = new FormData();
- messageLabelData.top = new FormAttachment(titleLabel,verticalSpacing);
- messageLabelData.right = new FormAttachment(titleImage);
- messageLabelData.left = new FormAttachment(messageImageLabel,horizontalSpacing);
-
- if(titleImageLargest)
- messageLabelData.bottom = new FormAttachment(titleImage,0,SWT.BOTTOM);
-
- messageLabel.setLayoutData(messageLabelData);
-
- FormData fillerData = new FormData();
- fillerData.left = new FormAttachment(0,horizontalSpacing);
- fillerData.top = new FormAttachment(messageImageLabel,0);
- fillerData.bottom = new FormAttachment(messageLabel,0,SWT.BOTTOM);
- bottomFillerLabel.setLayoutData(fillerData);
-
- FormData data = new FormData();
- data.top = new FormAttachment(messageImageLabel, 0,SWT.TOP);
- data.left = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(messageImageLabel, 0, SWT.BOTTOM);
- data.right = new FormAttachment(messageImageLabel, 0);
- leftFillerLabel.setLayoutData(data);
-}
-/**
- * The <code>TitleAreaDialog</code> implementation of this
- * <code>Window</code> methods returns an initial size which
- * is at least some reasonable minimum.
- *
- * @return the initial size of the dialog
- */
-protected Point getInitialSize() {
- Point shellSize = super.getInitialSize();
- return new Point(
- Math.max(convertHorizontalDLUsToPixels(MIN_DIALOG_WIDTH), shellSize.x),
- Math.max(convertVerticalDLUsToPixels(MIN_DIALOG_HEIGHT), shellSize.y));
-}
-
-/**
- * Retained for backward compatibility.
- *
- * Returns the title area composite. There is no composite in this
- * implementation so the shell is returned.
- * @deprecated
- */
-protected Composite getTitleArea() {
- return getShell();
-}/**
- * Returns the title image label.
- *
- * @return the title image label
- */
-protected Label getTitleImageLabel() {
- return titleImage;
-}
-/**
- * Display the given error message. The currently displayed message
- * is saved and will be redisplayed when the error message is set
- * to <code>null</code>.
- *
- * @param newErrorMessage the newErrorMessage to display or <code>null</code>
- */
-public void setErrorMessage(String newErrorMessage) {
- // Any change?
- if (errorMessage == null ? newErrorMessage == null : errorMessage.equals(newErrorMessage))
- return;
-
- errorMessage = newErrorMessage;
- if (errorMessage == null) {
- if (showingError) {
- // we were previously showing an error
- showingError = false;
- setMessageBackgrounds(false);
- }
-
- // show the message
- // avoid calling setMessage in case it is overridden to call setErrorMessage,
- // which would result in a recursive infinite loop
- if (message == null) //this should probably never happen since setMessage does this conversion....
- message = ""; //$NON-NLS-1$
- updateMessage(message);
- messageImageLabel.setImage(messageImage);
- setImageLabelVisible(messageImage != null);
- messageLabel.setToolTipText(message);
-
- } else {
-
- //Add in a space for layout purposes
- errorMessage = " " + errorMessage;
- updateMessage(errorMessage);
- messageLabel.setToolTipText(errorMessage);
- if (!showingError) {
- // we were not previously showing an error
- showingError = true;
-
- // lazy initialize the error background color and image
- if (errorMsgAreaBackground == null) {
- errorMsgAreaBackground = JFaceColors.getErrorBackground(messageLabel.getDisplay());
- errorMsgImage = JFaceResources.getImage(DLG_IMG_TITLE_ERROR);
- }
-
- // show the error
- normalMsgAreaBackground = messageLabel.getBackground();
- setMessageBackgrounds(true);
- messageImageLabel.setImage(errorMsgImage);
- setImageLabelVisible(true);
- }
- }
- layoutForNewMessage();
-}
-
-/**
- * Re-layout the labels for the new message.
- */
-private void layoutForNewMessage(){
-
- int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
-
- //If there are no images then layout as normal
- if (errorMessage == null && messageImage == null) {
- setImageLabelVisible(false);
-
- setLayoutsForNormalMessage(verticalSpacing,horizontalSpacing);
-
- } else {
- messageImageLabel.setVisible(true);
- bottomFillerLabel.setVisible(true);
- leftFillerLabel.setVisible(true);
-
- /**
- * Note that we do not use horizontalSpacing here
- * as when the background of the messages changes
- * there will be gaps between the icon label and the
- * message that are the background color of the shell.
- * We add a leading space elsewhere to compendate for this.
- */
-
- FormData data = new FormData();
- data.left = new FormAttachment(0, H_GAP_IMAGE);
- data.top = new FormAttachment(titleLabel, verticalSpacing);
- messageImageLabel.setLayoutData(data);
-
- data = new FormData();
- data.top = new FormAttachment(messageImageLabel, 0);
- data.left = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(messageLabel, 0, SWT.BOTTOM);
- data.right = new FormAttachment(messageImageLabel, 0, SWT.RIGHT);
- bottomFillerLabel.setLayoutData(data);
-
- data = new FormData();
- data.top = new FormAttachment(messageImageLabel, 0,SWT.TOP);
- data.left = new FormAttachment(0, 0);
- data.bottom = new FormAttachment(messageImageLabel, 0, SWT.BOTTOM);
- data.right = new FormAttachment(messageImageLabel, 0);
- leftFillerLabel.setLayoutData(data);
-
- FormData messageLabelData = new FormData();
- messageLabelData.top = new FormAttachment(titleLabel,verticalSpacing);
- messageLabelData.right = new FormAttachment(titleImage);
- messageLabelData.left = new FormAttachment(messageImageLabel,0);
-
- if(titleImageLargest)
- messageLabelData.bottom = new FormAttachment(titleImage,0,SWT.BOTTOM);
-
- messageLabel.setLayoutData(messageLabelData);
-
- }
- //Do not layout before the dialog area has been created
- //to avoid incomplete calculations.
- if(dialogArea != null)
- getShell().layout(true);
-
-}
-
-
-/**
- * Set the message text. If the message line currently displays an error,
- * the message is saved and will be redisplayed when the error message is set
- * to <code>null</code>.
- * <p>
- * Shortcut for <code>setMessage(newMessage, IMessageProvider.NONE)</code>
- * </p>
- *
- * @param newMessage the message, or <code>null</code> to clear
- * the message
- */
-public void setMessage(String newMessage) {
- setMessage(newMessage, IMessageProvider.NONE);
-}
-/**
- * Sets the message for this dialog 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>.
- * </p>
- * <p>
- * Note that for backward compatibility, a message of type <code>ERROR</code>
- * is different than an error message (set using <code>setErrorMessage</code>).
- * An error message overrides the current message until the error message is
- * cleared. This method replaces the current message and does not affect the
- * error message.
- * </p>
- *
- * @param newMessage the message, or <code>null</code> to clear
- * the message
- * @param newType the message type
- * @since 2.0
- */
-public void setMessage(String newMessage, int newType) {
- Image newImage = null;
-
- if (newMessage != null) {
- switch (newType) {
- case IMessageProvider.NONE :
- break;
- case IMessageProvider.INFORMATION :
- newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_INFO);
- break;
- case IMessageProvider.WARNING :
- newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_WARNING);
- break;
- case IMessageProvider.ERROR :
- newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_ERROR);
- break;
- }
- }
-
- showMessage(newMessage, newImage);
-}
-/**
- * Show the new message
- */
-private void showMessage(String newMessage, Image newImage) {
- // Any change?
- if (message.equals(newMessage) && messageImage == newImage)
- return;
-
- message = newMessage;
- if (message == null)
- message = "";//$NON-NLS-1$
-
- //If there is an image then add in a space to the message
- //for layout purposes
- if(newImage != null)
- message = " " + message; //$NON-NLS-1$
-
- messageImage = newImage;
-
- if (!showingError) {
- // we are not showing an error
- updateMessage(message);
- messageImageLabel.setImage(messageImage);
- setImageLabelVisible(messageImage != null);
- messageLabel.setToolTipText(message);
- layoutForNewMessage();
- }
-}
-
-/**
- * Update the contents of the messageLabel.
- * @param String the message to use
- */
-private void updateMessage(String newMessage) {
-
- //Be sure there are always 2 lines for layout purposes
- if(newMessage != null && newMessage.indexOf('\n') == -1)
- newMessage = newMessage + "\n ";
-
- messageLabel.setText(newMessage);
-}
-
-/**
- * Sets the title to be shown in the title area of this dialog.
- *
- * @param newTitle the title show
- */
-public void setTitle(String newTitle) {
- if (titleLabel == null)
- return;
- String title = newTitle;
- if (title == null)
- title = "";//$NON-NLS-1$
- titleLabel.setText(title);
-}
-/**
- * Sets the title bar color for this dialog.
- *
- * @param color the title bar color
- */
-public void setTitleAreaColor(RGB color) {
- titleAreaRGB = color;
-}
-/**
- * Sets the title image to be shown in the title area of this dialog.
- *
- * @param newTitle the title image show
- */
-public void setTitleImage(Image newTitleImage) {
- titleImage.setImage(newTitleImage);
- titleImage.setVisible(newTitleImage != null);
-}
-
-/**
- * Make the label used for displaying error images visible
- * depending on boolean.
- */
-private void setImageLabelVisible(boolean visible){
- messageImageLabel.setVisible(visible);
- bottomFillerLabel.setVisible(visible);
- leftFillerLabel.setVisible(visible);
-
-}
-
-/**
- * Set the message backgrounds to be the error or normal color
- * depending on whether or not showingError is true.
- */
-private void setMessageBackgrounds(boolean showingError){
-
- Color color;
- if(showingError)
- color = errorMsgAreaBackground;
- else
- color = normalMsgAreaBackground;
-
- messageLabel.setBackground(color);
- messageImageLabel.setBackground(color);
- bottomFillerLabel.setBackground(color);
- leftFillerLabel.setBackground(color);
-}
-
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/error.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/error.gif
deleted file mode 100644
index 9441ff9..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/error.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/inform.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/inform.gif
deleted file mode 100644
index 744fb11..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/inform.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/message_error.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/message_error.gif
deleted file mode 100644
index def995e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/message_error.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/message_info.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/message_info.gif
deleted file mode 100644
index 26c7477..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/message_info.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/message_warning.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/message_warning.gif
deleted file mode 100644
index cf8d571..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/message_warning.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/question.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/question.gif
deleted file mode 100644
index 97045d4..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/question.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/title_banner.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/title_banner.gif
deleted file mode 100644
index 546a37c..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/title_banner.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/warning.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/warning.gif
deleted file mode 100644
index 8b91229..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/images/warning.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/package.html b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/package.html
deleted file mode 100644
index cc7dfcb..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/package.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides support for dialogs.
-<h2>
-Package Specification</h2>
-A dialog is a specialized window, typically consisting of a dialog area
-and a button bar, designed for narrow-focussed communication with the user.
-<p>The dialog framework consists of an abstract base class (<tt>Dialog</tt>),
-along with more concrete dialog subclasses for displaying messages (<tt>MessageDialog</tt>),
-soliciting text input (<tt>InputDialog</tt>), and displaying progress during
-a long-running operation (<tt>ProgressMonitorDialog</tt>).
-<p>Dialog stores (<tt>IDialogStore</tt>, <tt>DialogStore</tt>) provide
-a general framework for organizing a dialog's settings into key/value pairs.
-Multi-page dialogs are made easier through the use of dialog pages (<tt>IDialogPage</tt>,
-<tt>DialogPage</tt>).
-<p>Note: None of the classes in this package maintain global state.
-<br>
-<br>
-<br>
-</body>
-</html>
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/images/preference.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/images/preference.gif
deleted file mode 100644
index 2b8c0bb..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/images/preference.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/images/wizard.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/images/wizard.gif
deleted file mode 100644
index 2b8c0bb..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/images/wizard.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/messages.properties b/bundles/org.eclipse.jface/src/org/eclipse/jface/messages.properties
deleted file mode 100644
index ff5fe06..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/messages.properties
+++ /dev/null
@@ -1,158 +0,0 @@
-#############################################################
-#
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-#
-#############################################################
-# NLS file for JFace
-#############################################################
-
-#############################################################
-# Global label definitions
-#############################################################
-ok=OK
-cancel=Cancel
-yes=&Yes
-yestoall=Yes To &All
-skip=S&kip
-stop=&Stop
-abort=&Abort
-retry=&Retry
-ignore=&Ignore
-proceed=&Proceed
-open=&Open
-close=&Close
-showDetails=&Details>>
-hideDetails=<<&Details
-backButton=< &Back
-nextButton=&Next >
-finish=&Finish
-help=&Help
-no=&No
-notoall=No &To All
-finish=&Finish
-help=&Help
-defaults=Restore &Defaults
-apply=&Apply
-openBrowse=&Browse...
-
-openChange=&Change...
-help=&Help
-close=&Close
-
-##############################################################
-# Wizard Closing Dialog
-##############################################################
-WizardClosingDialog.title=Wizard Closing
-WizardClosingDialog.message=Wizard can not be closed due to an active operation. You must cancel the operation before you can close the wizard.
-
-##############################################################
-# The Progress Monitor Dialog
-##############################################################
-ProgressMonitorDialog.title=Progress Information
-ProgressMonitorDialog.message=Operation in progress...
-
-##############################################################
-# Preference Dialog
-##############################################################
-PreferenceDialog.title=Preferences
-PreferenceDialog.saveErrorTitle=Problem Saving Preferences
-PreferenceDialog.saveErrorMessage=A problem was encountered saving the page {0}.\n{1}
-
-##############################################################
-# Change Errors
-##############################################################
-PreferenceStore.changeError=Error notifying a preference change listener. Check the log for details.
-FontRegistry.changeError=Error notifying a font registry change listener. Check the log for details.
-
-##############################################################
-# Abort Page Flipping Dialog
-##############################################################
-AbortPageFlippingDialog.title=Could Not Accept Changes
-AbortPageFlippingDialog.message=The currently displayed page contains invalid values.
-
-##############################################################
-# Field editors
-##############################################################
-StringFieldEditor.errorMessage=Field contains an invalid value
-IntegerFieldEditor.errorMessage=Value must be an Integer
-FileFieldEditor.errorMessage=Value must be an existing file
-FileFieldEditor.errorMessage2=Value must be an absolute path
-DirectoryFieldEditor.errorMessage=Value must be an existing directory
-ListEditor.add = Ne&w...
-ListEditor.remove = &Remove
-ListEditor.up = &Up
-ListEditor.down = Dow&n
-
-##############################################################
-# Error messages for TextViewer
-##############################################################
-TextViewer.invalidRangeArg=Invalid range argument
-TextViewer.invalidVisibleRegionArg=Invalid visible region argument
-
-#############################################################
-# org.eclipse.jface.action
-#############################################################
-Cancel_Current_Operation = Cancel Current Operation
-Set_SubTask = {0} {1}
-
-#############################################################
-# org.eclipse.jface.dialog
-############################################################
-Problem_Occurred = Problem Occurred
-Reason = {0}\n\nReason:\n {1}
-
-############################################################
-
-Image_not_found = Image not found
-<empty_selection> = <empty selection>
-
-########################################################
-# Font properties labels for displaying a font
-#######################################################
-BoldItalicFont = bold italic
-BoldFont = bold
-ItalicFont = italic
-RegularFont = regular
-
-#############################################################
-# String representations of keys for Status line messages
-############################################################
-Ctrl = Ctrl
-Alt = Alt
-Shift = Shift
-Backspace = Backspace
-Tab = Tab
-Return = Return
-Enter = Enter
-Escape = Escape
-Esc = Esc
-Delete = Delete
-Space = Space
-Arrow_Up = Arrow Up
-Arrow_Down = Arrow Down
-Arrow_Left = Arrow Left
-Arrow_Right = Arrow Right
-Page_Up = Page Up
-Page_Down = Page Down
-Home = Home
-End = End
-Insert = Insert
-F1 = F1
-F2 = F2
-F3 = F3
-F4 = F4
-F5 = F5
-F6 = F6
-F7 = F7
-F8 = F8
-F9 = F9
-F10 = F10
-F11 = F11
-F12 = F12
-
-##############################################
-# Safe Runnable
-##############################################
-SafeRunnable.errorMessage = An error has occurred. See error log for more details.
-Error = Error
\ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/BooleanFieldEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/BooleanFieldEditor.java
deleted file mode 100644
index 98ad072..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/BooleanFieldEditor.java
+++ /dev/null
@@ -1,220 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A field editor for a boolean type preference.
- */
-public class BooleanFieldEditor extends FieldEditor {
-
- /**
- * Style constant (value <code>0</code>) indicating the default
- * layout where the field editor's check box appears to the left
- * of the label.
- */
- public static final int DEFAULT= 0;
-
- /**
- * Style constant (value <code>1</code>) indicating a layout
- * where the field editor's label appears on the left
- * with a check box on the right.
- */
- public static final int SEPARATE_LABEL= 1;
-
- /**
- * Style bits. Either <code>DEFAULT</code> or
- * <code>SEPARATE_LABEL</code>.
- */
- private int style;
-
- /**
- * The previously selected, or "before", value.
- */
- private boolean wasSelected;
-
- /**
- * The checkbox control, or <code>null</code> if none.
- */
- private Button checkBox = null;
-/**
- * Creates a new boolean field editor
- */
-protected BooleanFieldEditor() {
-}
-/**
- * Creates a boolean field editor in the given style.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param style the style, either <code>DEFAULT</code> or
- * <code>SEPARATE_LABEL</code>
- * @param parent the parent of the field editor's control
- * @see #DEFAULT
- * @see #SEPARATE_LABEL
- */
-public BooleanFieldEditor(String name, String labelText, int style, Composite parent) {
- init(name, labelText);
- this.style = style;
- createControl(parent);
-}
-/**
- * Creates a boolean field editor in the default style.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
-public BooleanFieldEditor(String name, String label, Composite parent) {
- this(name, label, DEFAULT, parent);
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void adjustForNumColumns(int numColumns) {
- if (style == SEPARATE_LABEL)
- numColumns--;
- ((GridData)checkBox.getLayoutData()).horizontalSpan = numColumns;
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doFillIntoGrid(Composite parent, int numColumns) {
- String text = getLabelText();
- switch (style) {
- case SEPARATE_LABEL :
- getLabelControl(parent);
- numColumns--;
- text = null;
- default :
- checkBox = getChangeControl(parent);
- GridData gd = new GridData();
- gd.horizontalSpan = numColumns;
- checkBox.setLayoutData(gd);
- if (text != null)
- checkBox.setText(text);
- }
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- * Loads the value from the preference store and sets it to
- * the check box.
- */
-protected void doLoad() {
- if (checkBox != null) {
- boolean value = getPreferenceStore().getBoolean(getPreferenceName());
- checkBox.setSelection(value);
- wasSelected = value;
- }
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- * Loads the default value from the preference store and sets it to
- * the check box.
- */
-protected void doLoadDefault() {
- if (checkBox != null) {
- boolean value = getPreferenceStore().getDefaultBoolean(getPreferenceName());
- checkBox.setSelection(value);
- wasSelected = value;
- }
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doStore() {
- getPreferenceStore().setValue(getPreferenceName(), checkBox.getSelection());
-}
-/**
- * Returns this field editor's current value.
- *
- * @return the value
- */
-public boolean getBooleanValue() {
- return checkBox.getSelection();
-}
-/**
- * Returns the change button for this field editor.
- *
- * @return the change button
- */
-protected Button getChangeControl(Composite parent) {
- if (checkBox == null) {
- checkBox = new Button(parent, SWT.CHECK | SWT.LEFT);
- checkBox.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- boolean isSelected = checkBox.getSelection();
- valueChanged(wasSelected, isSelected);
- wasSelected = isSelected;
- }
- });
- checkBox.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- checkBox = null;
- }
- });
- } else {
- checkParent(checkBox, parent);
- }
- return checkBox;
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-public int getNumberOfControls() {
- switch (style) {
- case SEPARATE_LABEL :
- return 2;
- default :
- return 1;
- }
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-public void setFocus() {
- if (checkBox != null) {
- checkBox.setFocus();
- }
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-public void setLabelText(String text) {
- super.setLabelText(text);
- Label label = getLabelControl();
- if (label == null && checkBox != null) {
- checkBox.setText(text);
- }
-}
-/**
- * Informs this field editor's listener, if it has one, about a change
- * to the value (<code>VALUE</code> property) provided that the old and
- * new values are different.
- *
- * @param oldValue the old value
- * @param newValue the new value
- */
-protected void valueChanged(boolean oldValue, boolean newValue) {
- setPresentsDefaultValue(false);
- if (oldValue != newValue)
- fireStateChanged(VALUE, oldValue, newValue);
-}
-
-/*
- * @see FieldEditor.setEnabled
- */
-public void setEnabled(boolean enabled, Composite parent){
- //Only call super if there is a label already
- if(style == SEPARATE_LABEL)
- super.setEnabled(enabled,parent);
- getChangeControl(parent).setEnabled(enabled);
-}
-
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ColorFieldEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ColorFieldEditor.java
deleted file mode 100644
index 9c120cc..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ColorFieldEditor.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.resource.FontRegistry;
-import org.eclipse.jface.dialogs.IDialogConstants;
-
-/**
- * A field editor for a color type preference.
- */
-public class ColorFieldEditor extends FieldEditor {
-
-/**
- * The color selector, or <code>null</code> if none.
- */
-private ColorSelector colorSelector;
-
-/**
- * Creates a new color field editor
- */
-protected ColorFieldEditor() {
-}
-/**
- * Creates a color field editor.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
-public ColorFieldEditor(String name, String labelText, Composite parent) {
- super(name, labelText, parent);
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void adjustForNumColumns(int numColumns) {
- ((GridData)colorSelector.getButton().getLayoutData()).horizontalSpan = numColumns - 1;
-}
-/**
- * Computes the size of the color image displayed on the button.
- * <p>
- * This is an internal method and should not be called by clients.
- * </p>
- */
-protected Point computeImageSize(Control window) {
- // Make the image height as high as a corresponding character. This
- // makes sure that the button has the same size as a "normal" text
- // button.
- GC gc = new GC(window);
- Font f = JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
- gc.setFont(f);
- int height = gc.getFontMetrics().getHeight();
- gc.dispose();
- Point p = new Point(height * 3 - 6, height);
- return p;
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doFillIntoGrid(Composite parent, int numColumns) {
- Control control = getLabelControl(parent);
- GridData gd = new GridData();
- gd.horizontalSpan = numColumns - 1;
- control.setLayoutData(gd);
-
- Button colorButton = getChangeControl(parent);
- gd = new GridData();
- gd.heightHint = convertVerticalDLUsToPixels(colorButton, IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(colorButton, IDialogConstants.BUTTON_WIDTH);
- gd.widthHint = Math.max(widthHint, colorButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- colorButton.setLayoutData(gd);
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doLoad() {
- if (colorSelector == null)
- return;
- colorSelector.setColorValue(PreferenceConverter.getColor(getPreferenceStore(), getPreferenceName()));
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doLoadDefault() {
- if (colorSelector == null)
- return;
- colorSelector.setColorValue(PreferenceConverter.getDefaultColor(getPreferenceStore(), getPreferenceName()));
-}
-
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doStore() {
- PreferenceConverter.setValue(getPreferenceStore(), getPreferenceName(), colorSelector.getColorValue());
-}
-/**
- * Returns the change button for this field editor.
- *
- * @return the change button
- */
-protected Button getChangeControl(Composite parent) {
- if (colorSelector == null) {
- colorSelector = new ColorSelector(parent);
- } else {
- checkParent(colorSelector.getButton(), parent);
- }
- return colorSelector.getButton();
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-public int getNumberOfControls() {
- return 2;
-}
-
-/*
- * @see FieldEditor.setEnabled
- */
-public void setEnabled(boolean enabled, Composite parent){
- super.setEnabled(enabled,parent);
- getChangeControl(parent).setEnabled(enabled);
-}
-
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ColorSelector.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ColorSelector.java
deleted file mode 100644
index 9097fa4..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ColorSelector.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.eclipse.jface.preference;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * The ColorSelector is a wrapper for a button that displays
- * a selected Color and allows the user to change the selection.
- */
-public class ColorSelector {
-
- private Point fExtent;
- private Image fImage;
- private RGB fColorValue;
- private Color fColor;
- private Button fButton;
-
- /**
- * Create a new instance of the reciever and the
- * button that it wrappers in the supplied parent Composite
- * @param parent. The parent of the button.
- */
- public ColorSelector(Composite parent) {
-
- fButton = new Button(parent, SWT.PUSH);
- fExtent = computeImageSize(parent);
- fImage = new Image(parent.getDisplay(), fExtent.x, fExtent.y);
-
- GC gc = new GC(fImage);
- gc.setBackground(fButton.getBackground());
- gc.fillRectangle(0, 0, fExtent.x, fExtent.y);
- gc.dispose();
-
- fButton.setImage(fImage);
- fButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- ColorDialog colorDialog = new ColorDialog(fButton.getShell());
- colorDialog.setRGB(fColorValue);
- RGB newColor = colorDialog.open();
- if (newColor != null) {
- fColorValue = newColor;
- updateColorImage();
- }
- }
- });
-
- fButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- if (fImage != null) {
- fImage.dispose();
- fImage = null;
- }
- if (fColor != null) {
- fColor.dispose();
- fColor = null;
- }
- }
- });
- }
-
- /**
- * Return the currently displayed color.
- * @return RGB
- */
- public RGB getColorValue() {
- return fColorValue;
- }
-
- /**
- * Set the current color value and update the control.
- * @param rgb. The new color.
- */
- public void setColorValue(RGB rgb) {
- fColorValue = rgb;
- updateColorImage();
- }
-
- /**
- * Get the button control being wrappered by the selector.
- * @return Button
- */
- public Button getButton() {
- return fButton;
- }
-
- /**
- * Update the image being displayed on the button using
- * the current color setting,
- */
-
- protected void updateColorImage() {
-
- Display display = fButton.getDisplay();
-
- GC gc = new GC(fImage);
- gc.setForeground(display.getSystemColor(SWT.COLOR_BLACK));
- gc.drawRectangle(0, 2, fExtent.x - 1, fExtent.y - 4);
-
- if (fColor != null)
- fColor.dispose();
-
- fColor = new Color(display, fColorValue);
- gc.setBackground(fColor);
- gc.fillRectangle(1, 3, fExtent.x - 2, fExtent.y - 5);
- gc.dispose();
-
- fButton.setImage(fImage);
- }
-
- /**
- * Compute the size of the image to be displayed.
- * @return Point
- * @param window - the window used to calculate
- */
-
- private Point computeImageSize(Control window) {
- GC gc = new GC(window);
- Font f =
- JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT);
- gc.setFont(f);
- int height = gc.getFontMetrics().getHeight();
- gc.dispose();
- Point p = new Point(height * 3 - 6, height);
- return p;
- }
-
- /**
- * Set whether or not the button is enabled.
- */
-
- public void setEnabled(boolean state) {
- getButton().setEnabled(state);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/DirectoryFieldEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/DirectoryFieldEditor.java
deleted file mode 100644
index 4bb4687..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/DirectoryFieldEditor.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-
-import java.io.File;
-
-/**
- * A field editor for a directory path type preference. A standard directory
- * dialog appears when the user presses the change button.
- */
-public class DirectoryFieldEditor extends StringButtonFieldEditor {
-/**
- * Creates a new directory field editor
- */
-protected DirectoryFieldEditor() {
-}
-/**
- * Creates a directory field editor.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
-public DirectoryFieldEditor(String name, String labelText, Composite parent) {
- init(name, labelText);
- setErrorMessage(JFaceResources.getString("DirectoryFieldEditor.errorMessage"));//$NON-NLS-1$
- setChangeButtonText(JFaceResources.getString("openBrowse"));//$NON-NLS-1$
- setValidateStrategy(VALIDATE_ON_FOCUS_LOST);
- createControl(parent);
-}
-/* (non-Javadoc)
- * Method declared on StringButtonFieldEditor.
- * Opens the directory chooser dialog and returns the selected directory.
- */
-protected String changePressed() {
- File f = new File(getTextControl().getText());
- if (!f.exists())
- f = null;
- File d = getDirectory(f);
- if (d == null)
- return null;
-
- return d.getAbsolutePath();
-}
-/* (non-Javadoc)
- * Method declared on StringFieldEditor.
- * Checks whether the text input field contains a valid directory.
- */
-protected boolean doCheckState() {
- String fileName = getTextControl().getText();
- fileName = fileName.trim();
- if (fileName.length() == 0 && isEmptyStringAllowed())
- return true;
- File file = new File(fileName);
- return file.isDirectory();
-}
-/**
- * Helper that opens the directory chooser dialog.
- */
-private File getDirectory(File startingDirectory) {
-
- DirectoryDialog fileDialog = new DirectoryDialog(getShell(), SWT.OPEN);
- if (startingDirectory != null)
- fileDialog.setFilterPath(startingDirectory.getPath());
- String dir = fileDialog.open();
- if (dir != null) {
- dir = dir.trim();
- if (dir.length() > 0)
- return new File(dir);
- }
-
- return null;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditor.java
deleted file mode 100644
index 774cec0..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditor.java
+++ /dev/null
@@ -1,617 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.FontMetrics;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Abstract base class for all field editors.
- * <p>
- * A field editor presents the value of a preference to the end
- * user. The value is loaded from a preference store; if
- * modified by the end user, the value is validated and eventually
- * stored back to the preference store. A field editor reports
- * an event when the value, or the validity of the value, changes.
- * </p>
- * <p>
- * Field editors should be used in conjunction with a field
- * editor preference page (<code>FieldEditorPreferencePage</code>)
- * which coordinates everything and provides the message line
- * which display messages emanating from the editor.
- * </p>
- * <p>
- * This package contains ready-to-use field editors for various
- * types of preferences:
- * <ul>
- * <li><code>BooleanFieldEditor</code> - booleans</li>
- * <li><code>IntegerFieldEditor</code> - integers</li>
- * <li><code>StringFieldEditor</code> - text strings</li>
- * <li><code>RadioGroupFieldEditor</code> - enumerations</li>
- * <li><code>ColorFieldEditor</code> - RGB colors</li>
- * <li><code>FontFieldEditor</code> - fonts</li>
- * <li><code>DirectoryFieldEditor</code> - directories</li>
- * <li><code>FileFieldEditor</code> - files</li>
- * <li><code>PathEditor</code> - paths</li>
- * </ul>
- * </p>
- */
-public abstract class FieldEditor {
-
- /**
- * Property name constant (value <code>"field_editor_is_valid"</code>)
- * to signal a change in the validity of the value of this field editor.
- */
- public static final String IS_VALID = "field_editor_is_valid";//$NON-NLS-1$
-
- /**
- * Property name constant (value <code>"field_editor_value"</code>)
- * to signal a change in the value of this field editor.
- */
- public static final String VALUE = "field_editor_value";//$NON-NLS-1$
-
- /**
- * Gap between label and control.
- */
- protected static final int HORIZONTAL_GAP = 8;
-
- /**
- * The preference store, or <code>null</code> if none.
- */
- private IPreferenceStore preferenceStore = null;
-
- /**
- * The name of the preference displayed in this field editor.
- */
- private String preferenceName;
-
- /**
- * Indicates whether the default value is currently displayed,
- * initially <code>false</code>.
- */
- private boolean isDefaultPresented = false;
-
- /**
- * The label's text.
- */
- private String labelText;
-
- /**
- * The label control.
- */
- private Label label;
-
- /**
- * Listener, or <code>null</code> if none
- */
- private IPropertyChangeListener propertyChangeListener;
-
- /**
- * The page containing this field editor
- */
- private PreferencePage page;
-/**
- * Creates a new field editor.
- */
-protected FieldEditor() {
-}
-/**
- * Creates a new field editor.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
-protected FieldEditor(String name, String labelText, Composite parent) {
- init(name, labelText);
- createControl(parent);
-}
-/**
- * Adjusts the horizontal span of this field editor's basic controls
- * <p>
- * Subclasses must implement this method to adjust the horizontal span
- * of controls so they appear correct in the given number of columns.
- * </p>
- * <p>
- * The number of columns will always be equal to or greater than the
- * value returned by this editor's <code>getNumberOfControls</code> method.
- *
- * @param numColumns the number of columns
- */
-protected abstract void adjustForNumColumns(int numColumns);
-/**
- * Applies a font.
- * <p>
- * The default implementation of this framework method
- * does nothing. Subclasses should override this method
- * if they want to change the font of the SWT control to
- * a value different than the standard dialog font.
- * </p>
- */
-protected void applyFont() {
-}
-/**
- * Checks if the given parent is the current parent of the
- * supplied control; throws an (unchecked) exception if they
- * are not correctly related.
- *
- * @param control the control
- * @param parent the parent control
- */
-protected void checkParent(Control control, Composite parent) {
- Assert.isTrue(control.getParent() == parent, "Different parents");//$NON-NLS-1$
-}
-/**
- * Clears the error message from the message line.
- */
-protected void clearErrorMessage() {
- if (page != null)
- page.setErrorMessage(null);
-}
-/**
- * Clears the normal message from the message line.
- */
-protected void clearMessage() {
- if (page != null)
- page.setMessage(null);
-}
-/**
- * Returns the number of pixels corresponding to the
- * given number of horizontal dialog units.
- * <p>
- * Clients may call this framework method, but should not override it.
- * </p>
- *
- * @param control the control being sized
- * @param dlus the number of horizontal dialog units
- * @return the number of pixels
- */
-protected int convertHorizontalDLUsToPixels(Control control, int dlus) {
- GC gc= new GC(control);
- gc.setFont(control.getFont());
- int averageWidth= gc.getFontMetrics().getAverageCharWidth();
- gc.dispose();
-
- double horizontalDialogUnitSize = averageWidth * 0.25;
-
- return (int)Math.round(dlus * horizontalDialogUnitSize);
-}
-/**
- * Returns the number of pixels corresponding to the
- * given number of vertical dialog units.
- * <p>
- * Clients may call this framework method, but should not override it.
- * </p>
- *
- * @param control the control being sized
- * @param dlus the number of vertical dialog units
- * @return the number of pixels
- */
-protected int convertVerticalDLUsToPixels(Control control, int dlus) {
- GC gc= new GC(control);
- gc.setFont(control.getFont());
- int height = gc.getFontMetrics().getHeight();
- gc.dispose();
-
- double verticalDialogUnitSize = height * 0.125;
-
- return (int)Math.round(dlus * verticalDialogUnitSize);
-}
-/**
- * Creates this field editor's main control containing all of its
- * basic controls.
- *
- * @param parent the parent control
- */
-protected void createControl(Composite parent) {
- GridLayout layout = new GridLayout();
- layout.numColumns = getNumberOfControls();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = HORIZONTAL_GAP;
- parent.setLayout(layout);
- doFillIntoGrid(parent, layout.numColumns);
-}
-/**
- * Disposes the SWT resources used by this field editor.
- */
-public void dispose() {
- // nothing to dispose
-}
-/**
- * Fills this field editor's basic controls into the given parent.
- * <p>
- * Subclasses must implement this method to create the controls
- * for this field editor.
- * </p>
- *
- * @param parent the composite used as a parent for the basic controls;
- * the parent's layout must be a <code>GridLayout</code>
- * @param numColumns the number of columns
- */
-protected abstract void doFillIntoGrid(Composite parent, int numColumns);
-/**
- * Initializes this field editor with the preference value from
- * the preference store.
- * <p>
- * Subclasses must implement this method to properly initialize
- * the field editor.
- * </p>
- */
-protected abstract void doLoad();
-/**
- * Initializes this field editor with the default preference value from
- * the preference store.
- * <p>
- * Subclasses must implement this method to properly initialize
- * the field editor.
- * </p>
- */
-protected abstract void doLoadDefault();
-/**
- * Stores the preference value from this field editor into
- * the preference store.
- * <p>
- * Subclasses must implement this method to save the entered value
- * into the preference store.
- * </p>
- */
-protected abstract void doStore();
-/**
- * Fills this field editor's basic controls into the given parent.
- *
- * @param parent the composite used as a parent for the basic controls;
- * the parent's layout must be a <code>GridLayout</code>
- * @param numColumns the number of columns
- */
-public void fillIntoGrid(Composite parent, int numColumns) {
- Assert.isTrue(numColumns >= getNumberOfControls());
- Assert.isTrue(parent.getLayout() instanceof GridLayout);
- doFillIntoGrid(parent, numColumns);
-}
-/**
- * Informs this field editor's listener, if it has one, about a change to
- * one of this field editor's boolean-valued properties. Does nothing
- * if the old and new values are the same.
- *
- * @param property the field editor property name,
- * such as <code>VALUE</code> or <code>IS_VALID</code>
- * @param oldValue the old value
- * @param newValue the new value
- */
-protected void fireStateChanged(String property, boolean oldValue, boolean newValue) {
- if (oldValue == newValue)
- return;
- fireValueChanged(property, new Boolean(oldValue), new Boolean(newValue));
-}
-/**
- * Informs this field editor's listener, if it has one, about a change to
- * one of this field editor's properties.
- *
- * @param property the field editor property name,
- * such as <code>VALUE</code> or <code>IS_VALID</code>
- * @param oldValue the old value object, or <code>null</code>
- * @param newValue the new value, or <code>null</code>
- */
-protected void fireValueChanged(String property, Object oldValue, Object newValue) {
- if (propertyChangeListener == null)
- return;
- propertyChangeListener.propertyChange(new PropertyChangeEvent(this, property, oldValue, newValue));
-}
-/**
- * Returns the symbolic font name used by this field editor.
- *
- * @return the symbolic font name
- */
-public String getFieldEditorFontName() {
- return JFaceResources.DIALOG_FONT;
-}
-/**
- * Returns the label control.
- *
- * @return the label control, or <code>null</code>
- * if no label control has been created
- */
-protected Label getLabelControl() {
- return label;
-}
-/**
- * Returns this field editor's label component.
- * <p>
- * The label is created if it does not already exist
- * </p>
- *
- * @param parent the parent
- * @return the label control
- */
-public Label getLabelControl(Composite parent) {
- if (label == null) {
- label = new Label(parent, SWT.LEFT);
- label.setFont(parent.getFont());
- String text = getLabelText();
- if (text != null)
- label.setText(text);
- label.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- label = null;
- }
- });
- } else {
- checkParent(label, parent);
- }
- return label;
-}
-/**
- * Returns this field editor's label text.
- *
- * @return the label text
- */
-public String getLabelText() {
- return labelText;
-}
-/**
- * Returns the number of basic controls this field editor consists of.
- *
- * @return the number of controls
- */
-public abstract int getNumberOfControls();
-/**
- * Returns the name of the preference this field editor operates on.
- *
- * @return the name of the preference
- */
-public String getPreferenceName() {
- return preferenceName;
-}
-/**
- * Returns the preference page in which this field editor
- * appears.
- *
- * @returns the preference page, or <code>null</code> if none
- */
-protected PreferencePage getPreferencePage() {
- return page;
-}
-/**
- * Returns the preference store used by this field editor.
- *
- * @return the preference store, or <code>null</code> if none
- * @see #setPreferenceStore
- */
-public IPreferenceStore getPreferenceStore() {
- return preferenceStore;
-}
-/**
- * Initialize the field editor with the given preference name and label.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- */
-protected void init(String name, String labelText) {
- Assert.isNotNull(name);
- Assert.isNotNull(labelText);
- preferenceName = name;
- this.labelText = labelText;
-}
-/**
- * Returns whether this field editor contains a valid value.
- * <p>
- * The default implementation of this framework method
- * returns <code>true</code>. Subclasses wishing to perform
- * validation should override both this method and
- * <code>refreshValidState</code>.
- * </p>
- *
- * @return <code>true</code> if the field value is valid,
- * and <code>false</code> if invalid
- * @see #refreshValidState
- */
-public boolean isValid() {
- return true;
-}
-/**
- * Initializes this field editor with the preference value from
- * the preference store.
- */
-public void load() {
- if (preferenceStore != null) {
- isDefaultPresented = false;
- doLoad();
- refreshValidState();
- }
-}
-/**
- * Initializes this field editor with the default preference value
- * from the preference store.
- */
-public void loadDefault() {
- if (preferenceStore != null) {
- isDefaultPresented = true;
- doLoadDefault();
- refreshValidState();
- }
-}
-/**
- * Returns whether this field editor currently presents the
- * default value for its preference.
- *
- * @return <code>true</code> if the default value is presented,
- * and <code>false</code> otherwise
- */
-public boolean presentsDefaultValue() {
- return isDefaultPresented;
-}
-/**
- * Refreshes this field editor's valid state after a value change
- * and fires an <code>IS_VALID</code> property change event if
- * warranted.
- * <p>
- * The default implementation of this framework method does
- * nothing. Subclasses wishing to perform validation should override
- * both this method and <code>isValid</code>.
- * </p>
- *
- * @see #isValid
- */
-protected void refreshValidState() {
-}
-/**
- * Sets the focus to this field editor.
- * <p>
- * The default implementation of this framework method
- * does nothing. Subclasses may reimplement.
- * </p>
- */
-public void setFocus() {
- // do nothing;
-}
-/**
- * Sets this field editor's label text.
- * The label is typically presented to the left of the entry field.
- *
- * @param text the label text
- */
-public void setLabelText(String text) {
- Assert.isNotNull(text);
- labelText = text;
- if (label != null)
- label.setText(text);
-}
-/**
- * Sets the name of the preference this field editor operates on.
- * <p>
- * The ability to change this allows the same field editor object
- * to be reused for different preferences.
- * </p>
- * <p>
- * For example: <p>
- * <pre>
- * ...
- * editor.setPreferenceName("font");
- * editor.load();
- * </pre>
- * </p>
- *
- * @param name the name of the preference
- */
-public void setPreferenceName(String name) {
- preferenceName = name;
-}
-/**
- * Sets the preference page in which this field editor
- * appears.
- *
- * @param preferencePage the preference page, or <code>null</code> if none
- */
-public void setPreferencePage(PreferencePage preferencePage) {
- page = preferencePage;
-}
-/**
- * Sets the preference store used by this field editor.
- *
- * @param store the preference store, or <code>null</code> if none
- * @see #getPreferenceStore
- */
-public void setPreferenceStore(IPreferenceStore store) {
- preferenceStore = store;
-}
-/**
- * Sets whether this field editor is presenting the default value.
- *
- * @return <code>true</code> if the default value is being presented,
- * and <code>false</code> otherwise
- */
-protected void setPresentsDefaultValue(boolean b) {
- isDefaultPresented = b;
-}
-/**
- * Sets or removes the property change listener for this field editor.
- * <p>
- * Note that field editors can support only a single listener.
- * </p>
- *
- * @param listener a property change listener, or <code>null</code>
- * to remove
- */
-public void setPropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListener = listener;
-}
-/**
- * Shows the given error message in the page for this
- * field editor if it has one.
- *
- * @param msg the error message
- */
-protected void showErrorMessage(String msg) {
- if (page != null)
- page.setErrorMessage(msg);
-}
-/**
- * Shows the given message in the page for this
- * field editor if it has one.
- *
- * @param msg the message
- */
-protected void showMessage(String msg) {
- if (page != null)
- page.setErrorMessage(msg);
-}
-/**
- * Stores this field editor's value back into the preference store.
- */
-public void store() {
- if (preferenceStore == null)
- return;
-
- if (isDefaultPresented) {
- preferenceStore.setToDefault(preferenceName);
- } else {
- doStore();
- }
-}
-
-/**
- * Set the GridData on button to be one that is spaced for the
- * current font.
- * @param Button
- */
-
-protected void setButtonLayoutData(Button button) {
-
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
-
- // Compute and store a font metric
- GC gc = new GC(button);
- gc.setFont(button.getFont());
- FontMetrics fontMetrics = gc.getFontMetrics();
- gc.dispose();
-
- data.heightHint = org.eclipse.jface.dialogs.Dialog.convertHorizontalDLUsToPixels(fontMetrics,IDialogConstants.BUTTON_HEIGHT);
- int widthHint = org.eclipse.jface.dialogs.Dialog.convertVerticalDLUsToPixels(fontMetrics,IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- button.setLayoutData(data);
-}
-
-/**
- * Set whether or not the controls in the field editor
- * are enabled.
- * @param boolean. The enabled state.
- * @param parent. The parent of the controls in the group.
- * Used to create the controls if required.
- */
-public void setEnabled(boolean enabled, Composite parent){
- getLabelControl(parent).setEnabled(enabled);
-}
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditorPreferencePage.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditorPreferencePage.java
deleted file mode 100644
index b63d82d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditorPreferencePage.java
+++ /dev/null
@@ -1,339 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List; // disambiguate from SWT List
-
-/**
- * A special abstract preference page to host field editors.
- * <p>
- * Subclasses must implement the <code>createFieldEditors</code> method
- * and should override <code>createLayout</code> if a special layout of the field
- * editors is needed.
- * </p>
- */
-public abstract class FieldEditorPreferencePage extends PreferencePage implements IPropertyChangeListener {
-
- /**
- * Layout constant (value <code>0</code>) indicating that
- * each field editor is handled as a single component.
- */
- public static final int FLAT = 0;
-
- /**
- * Layout constant (value <code>1</code>) indicating that
- * the field editors' basic controls are put into a grid layout.
- */
- public static final int GRID = 1;
-
- /**
- * The vertical spacing used by layout styles <code>FLAT</code>
- * and <code>GRID</code>.
- */
- protected static final int VERTICAL_SPACING = 10;
-
- /**
- * The margin width used by layout styles <code>FLAT</code>
- * and <code>GRID</code>.
- */
- protected static final int MARGIN_WIDTH = 0;
-
- /**
- * The margin height used by layout styles <code>FLAT</code>
- * and <code>GRID</code>.
- */
- protected static final int MARGIN_HEIGHT = 0;
-
- /**
- * The field editors, or <code>null</code> if not created yet.
- */
- private List fields = null;
-
- /**
- * The layout style; either <code>FLAT</code> or <code>GRID</code>.
- */
- private int style;
-
- /**
- * The first invalid field editor, or <code>null</code>
- * if all field editors are valid.
- */
- private FieldEditor invalidFieldEditor = null;
-
- /**
- * The parent composite for field editors
- */
- private Composite fieldEditorParent;
-/**
- * Creates a new field editor preference page with the given style,
- * an empty title, and no image.
- *
- * @param style either <code>GRID</code> or <code>FLAT</code>
- */
-protected FieldEditorPreferencePage(int style) {
- super();
- this.style = style;
-}
-/**
- * Creates a new field editor preference page with the given title
- * and style, but no image.
- *
- * @param title the title of this preference page
- * @param style either <code>GRID</code> or <code>FLAT</code>
- */
-protected FieldEditorPreferencePage(String title, int style) {
- super(title);
- this.style = style;
-}
-/**
- * Creates a new field editor preference page with the given title,
- * image, and style.
- *
- * @param title the title of this preference page
- * @param image the image for this preference page, or
- * <code>null</code> if none
- * @param style either <code>GRID</code> or <code>FLAT</code>
- */
-protected FieldEditorPreferencePage(String title, ImageDescriptor image, int style) {
- super(title, image);
- this.style = style;
-}
-/**
- * Adds the given field editor to this page.
- *
- * @param editor the field editor
- */
-protected void addField(FieldEditor editor) {
- if (fields == null)
- fields = new ArrayList();
- fields.add(editor);
-}
-/**
- * Adjust the layout of the field editors so that
- * they are properly aligned.
- */
-protected void adjustGridLayout() {
- int numColumns = calcNumberOfColumns();
- ((GridLayout)fieldEditorParent.getLayout()).numColumns = numColumns;
- if (fields != null) {
- for (int i = 0; i < fields.size(); i++){
- FieldEditor fieldEditor = (FieldEditor)fields.get(i);
- fieldEditor.adjustForNumColumns(numColumns);
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on DialogPage.
- * Forwards the call to the field editors managed by this page.
- */
-protected void applyFont() {
- if (fields != null) {
- Iterator e = fields.iterator();
- while (e.hasNext()) {
- FieldEditor pe = (FieldEditor) e.next();
- pe.applyFont();
- }
- }
-}
-/**
- * Calculates the number of columns needed to host all field editors.
- *
- * @return the number of columns
- */
-private int calcNumberOfColumns() {
- int result = 0;
- if (fields != null) {
- Iterator e = fields.iterator();
- while (e.hasNext()) {
- FieldEditor pe = (FieldEditor) e.next();
- result = Math.max(result, pe.getNumberOfControls());
- }
- }
- return result;
-}
-/**
- * Recomputes the page's error state by calling <code>isValid</code> for
- * every field editor.
- */
-protected void checkState() {
- boolean valid = true;
- invalidFieldEditor = null;
- // The state can only be set to true if all
- // field editors contain a valid value. So we must check them all
- if (fields != null) {
- int size = fields.size();
- for (int i = 0; i < size; i++) {
- FieldEditor editor = (FieldEditor) fields.get(i);
- valid = valid && editor.isValid();
- if (!valid) {
- invalidFieldEditor = editor;
- break;
- }
- }
- }
- setValid(valid);
-}
-/* (non-Javadoc)
- * Method declared on PreferencePage.
- */
-protected Control createContents(Composite parent) {
- fieldEditorParent = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- fieldEditorParent.setLayout(layout);
- fieldEditorParent.setFont(parent.getFont());
-
- createFieldEditors();
-
- if (style == GRID)
- adjustGridLayout();
-
- initialize();
- checkState();
- return fieldEditorParent;
-}
-/**
- * Creates the page's field editors.
- * <p>
- * The default implementation of this framework method
- * does nothing. Subclass must implement this method to
- * create the field editors.
- * </p>
- * <p>
- * Subclasses should call <code>getFieldEditorParent</code>
- * to obtain the parent control for each field editor.
- * This same parent should not be used for more than
- * one editor as the parent may change for each field
- * editor depending on the layout style of the page
- * </p>
- */
-protected abstract void createFieldEditors();
-/**
- * The field editor preference page implementation of an <code>IDialogPage</code>
- * method disposes of this page's controls and images.
- * Subclasses may override to release their own allocated SWT
- * resources, but must call <code>super.dispose</code>.
- */
-public void dispose() {
- super.dispose();
- if (fields != null) {
- Iterator e = fields.iterator();
- while (e.hasNext()) {
- FieldEditor pe = (FieldEditor) e.next();
- pe.setPreferencePage(null);
- pe.setPropertyChangeListener(null);
- pe.setPreferenceStore(null);
- }
- }
-}
-/**
- * Returns a parent composite for a field editor.
- * <p>
- * This value must not be cached since a new parent
- * may be created each time this method called. Thus
- * this method must be called each time a field editor
- * is constructed.
- * </p>
- *
- * @returns a parent
- */
-protected Composite getFieldEditorParent() {
- if (style == FLAT) {
- // Create a new parent for each field editor
- Composite parent = new Composite(fieldEditorParent, SWT.NULL);
- parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- return parent;
- } else {
- // Just return the parent
- return fieldEditorParent;
- }
-}
-/**
- * Initializes all field editors.
- */
-protected void initialize() {
- if (fields != null) {
- Iterator e = fields.iterator();
- while (e.hasNext()) {
- FieldEditor pe = (FieldEditor) e.next();
- pe.setPreferencePage(this);
- pe.setPropertyChangeListener(this);
- pe.setPreferenceStore(getPreferenceStore());
- pe.load();
- }
- }
-}
-/**
- * The field editor preference page implementation of a <code>PreferencePage</code>
- * method loads all the field editors with their default values.
- */
-protected void performDefaults() {
- if (fields != null) {
- Iterator e = fields.iterator();
- while (e.hasNext()) {
- FieldEditor pe = (FieldEditor) e.next();
- pe.loadDefault();
- }
- }
- // Force a recalculation of my error state.
- checkState();
- super.performDefaults();
-}
-/**
- * The field editor preference page implementation of this
- * <code>PreferencePage</code> method saves all field editors by
- * calling <code>FieldEditor.store</code>. Note that this method
- * does not save the preference store itself; it just stores the
- * values back into the preference store.
- *
- * @see FieldEditor#store()
- */
-public boolean performOk() {
- if (fields != null) {
- Iterator e = fields.iterator();
- while (e.hasNext()) {
- FieldEditor pe = (FieldEditor) e.next();
- pe.store();
- }
- }
- return true;
-}
-/**
- * The field editor preference page implementation of this <code>IPreferencePage</code>
- * (and <code>IPropertyChangeListener</code>) method intercepts <code>IS_VALID</code>
- * events but passes other events on to its superclass.
- */
-public void propertyChange(PropertyChangeEvent event) {
-
- if (event.getProperty().equals(FieldEditor.IS_VALID)) {
- boolean newValue = ((Boolean) event.getNewValue()).booleanValue();
- // If the new value is true then we must check all field editors.
- // If it is false, then the page is invalid in any case.
- if (newValue) {
- checkState();
- } else {
- invalidFieldEditor = (FieldEditor) event.getSource();
- setValid(newValue);
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on IDialog.
- */
-public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible && invalidFieldEditor != null) {
- invalidFieldEditor.setFocus();
- }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FileFieldEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FileFieldEditor.java
deleted file mode 100644
index 03ca9fe..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FileFieldEditor.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import java.io.File;
-
-/**
- * A field editor for a file path type preference. A standard file
- * dialog appears when the user presses the change button.
- */
-public class FileFieldEditor extends StringButtonFieldEditor {
-
- /**
- * List of legal file extension suffixes, or <code>null</code>
- * for system defaults.
- */
- private String[] extensions = null;
-
- /**
- * Indicates whether the path must be absolute;
- * <code>false</code> by default.
- */
- private boolean enforceAbsolute = false;
-/**
- * Creates a new file field editor
- */
-protected FileFieldEditor() {
-}
-/**
- * Creates a file field editor.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
-public FileFieldEditor(String name, String labelText, Composite parent) {
- this(name, labelText, false, parent);
-}
-/**
- * Creates a file field editor.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param enforceAbsolute <code>true</code> if the file path
- * must be absolute, and <code>false</code> otherwise
- * @param parent the parent of the field editor's control
- */
-public FileFieldEditor(String name, String labelText, boolean enforceAbsolute, Composite parent) {
- init(name, labelText);
- this.enforceAbsolute = enforceAbsolute;
- setErrorMessage(JFaceResources.getString("FileFieldEditor.errorMessage"));//$NON-NLS-1$
- setChangeButtonText(JFaceResources.getString("openBrowse"));//$NON-NLS-1$
- setValidateStrategy(VALIDATE_ON_FOCUS_LOST);
- createControl(parent);
-}
-/* (non-Javadoc)
- * Method declared on StringButtonFieldEditor.
- * Opens the file chooser dialog and returns the selected file.
- */
-protected String changePressed() {
- File f = new File(getTextControl().getText());
- if (!f.exists())
- f = null;
- File d = getFile(f);
- if (d == null)
- return null;
-
- return d.getAbsolutePath();
-}
-/* (non-Javadoc)
- * Method declared on StringFieldEditor.
- * Checks whether the text input field specifies an existing file.
- */
-protected boolean checkState() {
-
- String msg = null;
-
- String path = getTextControl().getText();
- if (path != null)
- path = path.trim();
- else
- path = "";//$NON-NLS-1$
- if (path.length() == 0) {
- if (!isEmptyStringAllowed())
- msg = getErrorMessage();
- } else {
- File file = new File(path);
- if (file.isFile()) {
- if (enforceAbsolute && !file.isAbsolute())
- msg = JFaceResources.getString("FileFieldEditor.errorMessage2");//$NON-NLS-1$
- } else {
- msg = getErrorMessage();
- }
- }
-
- if (msg != null) { // error
- showErrorMessage(msg);
- return false;
- }
-
- // OK!
- clearErrorMessage();
- return true;
-}
-/**
- * Helper to open the file chooser dialog.
- */
-private File getFile(File startingDirectory) {
-
- FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
- if (startingDirectory != null)
- dialog.setFileName(startingDirectory.getPath());
- if (extensions != null)
- dialog.setFilterExtensions(extensions);
- String file = dialog.open();
- if (file != null) {
- file = file.trim();
- if (file.length() > 0)
- return new File(file);
- }
-
- return null;
-}
-/**
- * Sets this file field editor's file extension filter.
- *
- * @param extension a list of file extension, or <code>null</code>
- * to set the filter to the system's default value
- */
-public void setFileExtensions(String[] extensions) {
- this.extensions = extensions;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FontFieldEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FontFieldEditor.java
deleted file mode 100644
index 8e95b3f..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FontFieldEditor.java
+++ /dev/null
@@ -1,331 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.resource.*;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A field editor for a font type preference.
- */
-public class FontFieldEditor extends FieldEditor {
-
- /**
- * The change font button, or <code>null</code> if none
- * (before creation and after disposal).
- */
- private Button changeFontButton = null;
-
- /**
- * The text for the change font button, or <code>null</code>
- * if missing.
- */
- private String changeButtonText;
-
- /**
- * Font data for the chosen font button, or <code>null</code> if none.
- */
- private FontData chosenFont;
-
- /**
- * The label that displays the selected font, or <code>null</code> if none.
- */
- private Label valueControl;
-
- /**
- * The previewer, or <code>null</code> if none.
- */
- private DefaultPreviewer previewer;
-
- /**
- * Internal font previewer implementation.
- */
- private static class DefaultPreviewer {
- private Text text;
- private String string;
- private Font font;
- public DefaultPreviewer(String s, Composite parent) {
- string= s;
- text= new Text(parent, SWT.READ_ONLY | SWT.BORDER);
- text.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (font != null)
- font.dispose();
- }
- });
- if (string != null)
- text.setText(string);
- }
-
- public Control getControl() {
- return text;
- }
-
- public void setFont(FontData fontData) {
- if (font != null)
- font.dispose();
- font= new Font(text.getDisplay(), fontData);
- text.setFont(font);
- }
- public int getPreferredHeight() {
- return 60;
- }
- }
-/**
- * Creates a new font field editor
- */
-protected FontFieldEditor() {
-}
-/**
- * Creates a font field editor with a preview window.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param previewText the text used for the preview window
- * @param parent the parent of the field editor's control
- */
-public FontFieldEditor(String name, String labelText, String previewText, Composite parent) {
- this(name,labelText,parent);
- Assert.isNotNull(previewText);
- previewer = new DefaultPreviewer(previewText, parent);
-
-}
-/**
- * Creates a font field editor without a preview.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
-public FontFieldEditor(String name, String labelText, Composite parent) {
- init(name, labelText);
- changeButtonText = JFaceResources.getString("openChange");//$NON-NLS-1$
- createControl(parent);
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void adjustForNumColumns(int numColumns) {
- ((GridData)valueControl.getLayoutData()).horizontalSpan = numColumns - 2;
- Control control = getPreviewControl();
- if (control != null) {
- ((GridData)control.getLayoutData()).horizontalSpan = numColumns;
- }
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void applyFont() {
- if (chosenFont != null && previewer != null)
- previewer.setFont(chosenFont);
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doFillIntoGrid(Composite parent, int numColumns) {
- Control control = getLabelControl(parent);
-
- valueControl = getValueControl(parent);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = numColumns - 2;
- valueControl.setLayoutData(gd);
-
- changeFontButton = getChangeControl(parent);
- gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.heightHint = convertVerticalDLUsToPixels(changeFontButton, IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(changeFontButton, IDialogConstants.BUTTON_WIDTH);
- gd.widthHint = Math.max(widthHint, changeFontButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- changeFontButton.setLayoutData(gd);
-
- control = getPreviewControl();
- if (control != null) {
- gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.horizontalSpan = numColumns;
- gd.heightHint = previewer.getPreferredHeight();
- control.setLayoutData(gd);
- }
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doLoad() {
- if (changeFontButton == null)
- return;
- updateFont(PreferenceConverter.getFontDataArray(getPreferenceStore(), getPreferenceName()));
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doLoadDefault() {
- if (changeFontButton == null)
- return;
- updateFont(PreferenceConverter.getDefaultFontDataArray(getPreferenceStore(), getPreferenceName()));
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doStore() {
- PreferenceConverter.setValue(getPreferenceStore(), getPreferenceName(), chosenFont);
-}
-/**
- * Returns the change button for this field editor.
- *
- * @return the change button
- */
-protected Button getChangeControl(Composite parent) {
- if (changeFontButton == null) {
- changeFontButton= new Button(parent, SWT.PUSH);
- if(changeButtonText != null)
- changeFontButton.setText(changeButtonText);
- changeFontButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- FontDialog fontDialog= new FontDialog(changeFontButton.getShell());
- fontDialog.setFontData(chosenFont);
- FontData font= fontDialog.open();
- if (font != null) {
- FontData oldFont= chosenFont;
- setPresentsDefaultValue(false);
- FontData[] newData = new FontData[1];
- newData[0] = font;
- updateFont(newData);
- fireValueChanged(VALUE, oldFont, font);
- }
-
- }
- });
- changeFontButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- changeFontButton= null;
- }
- });
- changeFontButton.setFont(parent.getFont());
- setButtonLayoutData(changeFontButton);
- } else {
- checkParent(changeFontButton, parent);
- }
- return changeFontButton;
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-public int getNumberOfControls() {
- return 3;
-}
-/**
- * Returns the preferred preview height.
- *
- * @return the height, or <code>-1</code> if no previewer
- * is installed
- */
-public int getPreferredPreviewHeight() {
- if (previewer == null)
- return -1;
- return previewer.getPreferredHeight();
-}
-/**
- * Returns the preview control for this field editor.
- *
- * @return the preview control
- */
-public Control getPreviewControl() {
- if (previewer == null)
- return null;
-
- return previewer.getControl();
-}
-/**
- * Returns the value control for this field editor. The value control
- * displays the currently selected font name.
- *
- * @return the value control
- */
-protected Label getValueControl(Composite parent) {
- if (valueControl == null) {
- valueControl = new Label(parent, SWT.LEFT);
- valueControl.setFont(parent.getFont());
- valueControl.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- valueControl = null;
- }
- });
- } else {
- checkParent(valueControl, parent);
- }
- return valueControl;
-}
-/**
- * Sets the text of the change button.
- *
- * @param text the new text
- */
-public void setChangeButtonText(String text) {
- Assert.isNotNull(text);
- changeButtonText = text;
- if (changeFontButton != null)
- changeFontButton.setText(text);
-}
-/**
- * Updates the change font button and the previewer to reflect the
- * newly selected font.
- */
-private void updateFont(FontData font[]) {
- FontData bestFont =
- JFaceResources.getFontRegistry().
- bestData(font,valueControl.getDisplay());
-
- //if we have nothing valid do as best we can
- if(bestFont == null)
- bestFont = getDefaultFontData();
-
- //Now cache this value in the receiver
- this.chosenFont = bestFont;
-
- if (valueControl != null) {
- valueControl.setText(StringConverter.asString(chosenFont));
- }
- if (previewer != null) {
- previewer.setFont(chosenFont);
- }
-}
-/**
- * Store the default preference for the field
- * being edited
- */
-protected void setToDefault(){
- FontData[] defaultFontData =
- PreferenceConverter.getDefaultFontDataArray(getPreferenceStore(),getPreferenceName());
- PreferenceConverter.setValue(
- getPreferenceStore(),
- getPreferenceName(),
- defaultFontData);
-}
-
-/**
- * Get the system default font data.
- */
-private FontData getDefaultFontData(){
- return valueControl.getDisplay().getSystemFont().getFontData()[0];
-}
-
-/*
- * @see FieldEditor.setEnabled(boolean,Composite).
- */
-public void setEnabled(boolean enabled, Composite parent){
- super.setEnabled(enabled,parent);
- getChangeControl(parent).setEnabled(enabled);
- getValueControl(parent).setEnabled(enabled);
-}
-
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferenceNode.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferenceNode.java
deleted file mode 100644
index 2c85931..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferenceNode.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Interface to a node in a preference dialog.
- * A preference node maintains a label and image used to display the
- * node in a preference dialog (usually in the form of a tree),
- * as well as the preference page this node stands for.
- *
- * The node may use lazy creation for its page
- *
- * Note that all preference nodes must be dispose their resources.
- * The node must dispose the page managed by this node, and any SWT resources
- * allocated by this node (Images, Fonts, etc).
- * However the node itself may be reused.
- */
-public interface IPreferenceNode {
-/**
- * Adds the given preference node as a subnode of this
- * preference node.
- *
- * @param node the node to add
- */
-public void add(IPreferenceNode node);
-/**
- * Creates the preference page for this node.
- */
-public void createPage();
-/**
- * Release the page managed by this node, and any SWT resources
- * held onto by this node (Images, Fonts, etc).
- *
- * Note that nodes are reused so this is not a call to dispose the
- * node itself.
- */
-public void disposeResources();
-/**
- * Returns the subnode of this contribution node with the given node id.
- *
- * @param id the preference node id
- * @return the subnode, or <code>null</code> if none
- */
-public IPreferenceNode findSubNode(String id);
-/**
- * Returns the id of this contribution node.
- * This id identifies a contribution node relative to its parent.
- *
- * @return the node id
- */
-public String getId();
-/**
- * Returns the image used to present this node in a preference dialog.
- *
- * @return the image for this node, or <code>null</code>
- * if these is no image for this node
- */
-public Image getLabelImage();
-/**
- * Returns the text label used to present this node in a preference dialog.
- *
- * @return the text label for this node, or <code>null</code>
- * if these is no label for this node
- */
-public String getLabelText();
-/**
- * Returns the preference page for this node.
- *
- * @return the preference page
- */
-public IPreferencePage getPage();
-/**
- * Returns an iterator over the subnodes (immediate children)
- * of this contribution node.
- *
- * @return an IPreferenceNode array containing the child nodes
- */
-public IPreferenceNode[] getSubNodes();
-/**
- * Removes the subnode of this preference node with the given node id.
- *
- * @param id the subnode id
- * @return the removed subnode, or <code>null</code> if none
- */
-public IPreferenceNode remove(String id);
-/**
- * Removes the given preference node from the list of subnodes
- * (immediate children) of this node.
- *
- * @param node the node to remove
- * @return <code>true</code> if the node was removed,
- * and <code>false</code> otherwise
- */
-public boolean remove(IPreferenceNode node);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferencePage.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferencePage.java
deleted file mode 100644
index f2e3837..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferencePage.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.jface.resource.*;
-
-/**
- * An interface for a preference page. This interface
- * is used primarily by the page's container
- */
-public interface IPreferencePage extends IDialogPage {
-
-
-/**
- * Computes a size for this page's UI component.
- *
- * @return the size of the preference page encoded as
- * <code>new Point(width,height)</code>, or
- * <code>(0,0)</code> if the page doesn't currently have any UI component
- */
-public Point computeSize();
-/**
- * Returns whether this dialog page is in a valid state.
- *
- * @return <code>true</code> if the page is in a valid state,
- * and <code>false</code> if invalid
- */
-public boolean isValid();
-/**
- * Checks whether it is alright to leave this page.
- *
- * @return <code>false</code> to abort page flipping and the
- * have the current page remain visible, and <code>true</code>
- * to allow the page flip
- */
-public boolean okToLeave();
-/**
- * Notifies that the container of this preference page has been canceled.
- *
- * @return <code>false</code> to abort the container's cancel
- * procedure and <code>true</code> to allow the cancel to happen
- */
-public boolean performCancel();
-/**
- * Notifies that the OK button of this page's container has been pressed.
- *
- * @return <code>false</code> to abort the container's OK
- * processing and <code>true</code> to allow the OK to happen
- */
-public boolean performOk();
-/**
- * Sets or clears the container of this page.
- *
- * @param preferencePageContainer the preference page container, or <code>null</code>
- */
-public void setContainer(IPreferencePageContainer preferencePageContainer);
-/**
- * Sets the size of this page's UI component.
- *
- * @param size the size of the preference page encoded as
- * <code>new Point(width,height)</code>
- */
-public void setSize(Point size);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferencePageContainer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferencePageContainer.java
deleted file mode 100644
index 0d2521e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferencePageContainer.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * An interface used by a preference page to talk to
- * its dialog.
- */
-public interface IPreferencePageContainer {
-/**
- * Returns the preference store.
- *
- * @return the preference store, or <code>null</code> if none
- */
-public IPreferenceStore getPreferenceStore();
-/**
- * Adjusts the enable state of the OK
- * button to reflect the state of the currently active
- * page in this container.
- * <p>
- * This method is called by the container itself
- * when its preference page changes and may be called
- * by the page at other times to force a button state
- * update.
- * </p>
- */
-public void updateButtons();
-/**
- * Updates the message (or error message) shown in the message line to
- * reflect the state of the currently active page in this container.
- * <p>
- * This method is called by the container itself
- * when its preference page changes and may be called
- * by the page at other times to force a message
- * update.
- * </p>
- */
-public void updateMessage();
-/**
- * Updates the title to reflect the state of the
- * currently active page in this container.
- * <p>
- * This method is called by the container itself
- * when its page changes and may be called
- * by the page at other times to force a title
- * update.
- * </p>
- */
-public void updateTitle();
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferenceStore.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferenceStore.java
deleted file mode 100644
index ef9b9bd..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferenceStore.java
+++ /dev/null
@@ -1,511 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.IPropertyChangeListener;
-
-/**
- * The <code>IPreferenceStore</code> interface represents a table mapping
- * named preferences to values. If there is no value for a given name,
- * then that preferences's default value is returned; and if there is no
- * default value for that preference, then a default-default value is returned.
- * The default-default values for the primitive types are as follows:
- * <ul>
- * <li><code>boolean</code> = <code>false</code></li>
- * <li><code>double</code> = <code>0.0</code></li>
- * <li><code>float</code> = <code>0.0f</code></li>
- * <li><code>int</code> = <code>0</code></li>
- * <li><code>long</code> = <code>0</code></li>
- * <li><code>String</code> = <code>""</code> (the empty string)</li>
- * </ul>
- * <p>
- * Thus a preference store maintains two values for each of a set of
- * names: a current value and a default value.
- * The typical usage is to establish the defaults for all known preferences
- * and then restore previously stored values for preferences whose values
- * were different from their defaults. After the current values of
- * the preferences have been modified, it is a simple matter to write
- * out only those preferences whose values are different from their defaults.
- * This two-tiered approach to saving and restoring preference setting
- * minimized the number of preferences that need to be persisted; indeed,
- * the normal starting state does not require storing any preferences
- * at all.
- * </p>
- * <p>
- * A property change event is reported whenever a preferences current
- * value actually changes (whether through <code>setValue</code>,
- * <code>setToDefault</code>, or other unspecified means). Note, however,
- * that manipulating default values (with <code>setDefault</code>)
- * does not cause such events to be reported.
- * </p>
- * <p>
- * Clients who need a preference store may implement this interface or
- * instantiate the standard implementation <code>PreferenceStore</code>.
- * </p>
- *
- * @see PreferenceStore
- */
-public interface IPreferenceStore {
-
- /**
- * The default-default value for boolean preferences (<code>false</code>).
- */
- public static final boolean BOOLEAN_DEFAULT_DEFAULT = false;
-
- /**
- * The default-default value for double preferences (<code>0.0</code>).
- */
- public static final double DOUBLE_DEFAULT_DEFAULT = 0.0;
-
- /**
- * The default-default value for float preferences (<code>0.0f</code>).
- */
- public static final float FLOAT_DEFAULT_DEFAULT = 0.0f;
-
- /**
- * The default-default value for int preferences (<code>0</code>).
- */
- public static final int INT_DEFAULT_DEFAULT = 0;
-
- /**
- * The default-default value for long preferences (<code>0L</code>).
- */
- public static final long LONG_DEFAULT_DEFAULT = 0L;
-
- /**
- * The default-default value for String preferences (<code>""</code>).
- */
- public static final String STRING_DEFAULT_DEFAULT = "";
-
- /**
- * The string representation used for <code>true</code> (<code>"true"</code>).
- */
- public static final String TRUE = "true"; //$NON-NLS-1$
-
- /**
- * The string representation used for <code>false</code> (<code>"false"</code>).
- */
- public static final String FALSE = "false"; //$NON-NLS-1$
-/**
- * Adds a property change listener to this preference store.
- *
- * @param listener a property change listener
- */
-public void addPropertyChangeListener(IPropertyChangeListener listener);
-/**
- * Returns whether the named preference is known to this preference
- * store.
- *
- * @param name the name of the preference
- * @return <code>true</code> if either a current value or a default
- * value is known for the named preference, and <code>false</code>otherwise
- */
-public boolean contains(String name);
-/**
- * Fires a property change event corresponding to a change to the
- * current value of the preference with the given name.
- * <p>
- * This method is provided on this interface to simplify the implementation
- * of decorators. There is normally no need to call this method since
- * <code>setValue</code> and <code>setToDefault</code> report such
- * events in due course. Implementations should funnel all preference
- * changes through this method.
- * </p>
- *
- * @param name the name of the preference, to be used as the property
- * in the event object
- * @param oldValue the old value
- * @param newValue the new value
- */
-public void firePropertyChangeEvent(String name, Object oldValue, Object newValue);
-/**
- * Returns the current value of the boolean-valued preference with the
- * given name.
- * Returns the default-default value (<code>false</code>) if there
- * is no preference with the given name, or if the current value
- * cannot be treated as a boolean.
- *
- * @param name the name of the preference
- * @return the boolean-valued preference
- */
-public boolean getBoolean(String name);
-/**
- * Returns the default value for the boolean-valued preference
- * with the given name.
- * Returns the default-default value (<code>false</code>) if there
- * is no default preference with the given name, or if the default
- * value cannot be treated as a boolean.
- *
- * @param name the name of the preference
- * @return the default value of the named preference
- */
-public boolean getDefaultBoolean(String name);
-/**
- * Returns the default value for the double-valued preference
- * with the given name.
- * Returns the default-default value (<code>0.0</code>) if there
- * is no default preference with the given name, or if the default
- * value cannot be treated as a double.
- *
- * @param name the name of the preference
- * @return the default value of the named preference
- */
-public double getDefaultDouble(String name);
-/**
- * Returns the default value for the float-valued preference
- * with the given name.
- * Returns the default-default value (<code>0.0f</code>) if there
- * is no default preference with the given name, or if the default
- * value cannot be treated as a float.
- *
- * @param name the name of the preference
- * @return the default value of the named preference
- */
-public float getDefaultFloat(String name);
-/**
- * Returns the default value for the integer-valued preference
- * with the given name.
- * Returns the default-default value (<code>0</code>) if there
- * is no default preference with the given name, or if the default
- * value cannot be treated as an integer.
- *
- * @param name the name of the preference
- * @return the default value of the named preference
- */
-public int getDefaultInt(String name);
-/**
- * Returns the default value for the long-valued preference
- * with the given name.
- * Returns the default-default value (<code>0L</code>) if there
- * is no default preference with the given name, or if the default
- * value cannot be treated as a long.
- *
- * @param name the name of the preference
- * @return the default value of the named preference
- */
-public long getDefaultLong(String name);
-/**
- * Returns the default value for the string-valued preference
- * with the given name.
- * Returns the default-default value (the empty string <code>""</code>)
- * is no default preference with the given name, or if the default
- * value cannot be treated as a string.
- *
- * @param name the name of the preference
- * @return the default value of the named preference
- */
-public String getDefaultString(String name);
-/**
- * Returns the current value of the double-valued preference with the
- * given name.
- * Returns the default-default value (<code>0.0</code>) if there
- * is no preference with the given name, or if the current value
- * cannot be treated as a double.
- *
- * @param name the name of the preference
- * @return the double-valued preference
- */
-public double getDouble(String name);
-/**
- * Returns the current value of the float-valued preference with the
- * given name.
- * Returns the default-default value (<code>0.0f</code>) if there
- * is no preference with the given name, or if the current value
- * cannot be treated as a float.
- *
- * @param name the name of the preference
- * @return the float-valued preference
- */
-public float getFloat(String name);
-/**
- * Returns the current value of the integer-valued preference with the
- * given name.
- * Returns the default-default value (<code>0</code>) if there
- * is no preference with the given name, or if the current value
- * cannot be treated as an integter.
- *
- * @param name the name of the preference
- * @return the int-valued preference
- */
-public int getInt(String name);
-/**
- * Returns the current value of the long-valued preference with the
- * given name.
- * Returns the default-default value (<code>0L</code>) if there
- * is no preference with the given name, or if the current value
- * cannot be treated as a long.
- *
- * @param name the name of the preference
- * @return the long-valued preference
- */
-public long getLong(String name);
-/**
- * Returns the current value of the string-valued preference with the
- * given name.
- * Returns the default-default value (the empty string <code>""</code>)
- * if there is no preference with the given name, or if the current value
- * cannot be treated as a string.
- *
- * @param name the name of the preference
- * @return the string-valued preference
- */
-public String getString(String name);
-/**
- * Returns whether the current value of the preference with the given name
- * has the default value.
- *
- * @param name the name of the preference
- * @return <code>true</code> if the preference has a known default value
- * and its current value is the same, and <code>false</code> otherwise
- * (including the case where the preference is unknown to this store)
- */
-public boolean isDefault(String name);
-/**
- * Returns whether the current values in this property store
- * require saving.
- *
- * @return <code>true</code> if at least one of the preferences
- * known to this store has a current value different from its
- * default value, and <code>false</code> otherwise
- */
-public boolean needsSaving();
-/**
- * Sets the current value of the preference with the given name to
- * the given string value.
- * <p>
- * This method is provided on this interface to simplify the implementation
- * of decorators, and does not report a property change event.
- * Normal clients should instead call <code>setValue</code>.
- * </p>
- *
- * @param name the name of the preference
- * @param value the new current value of the preference
- */
-public void putValue(String name, String value);
-/**
- * Removes the given listener from this preference store.
- * Has no affect if the listener is not registered.
- *
- * @param listener a property change listener
- */
-public void removePropertyChangeListener(IPropertyChangeListener listener);
-/**
- * Sets the default value for the double-valued preference with the
- * given name.
- * <p>
- * Note that the current value of the preference is affected if
- * the preference's current value was its old default value, in which
- * case it changes to the new default value. If the preference's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the preference
- * @param value the new default value for the preference
- */
-public void setDefault(String name, double value);
-/**
- * Sets the default value for the float-valued preference with the
- * given name.
- * <p>
- * Note that the current value of the preference is affected if
- * the preference's current value was its old default value, in which
- * case it changes to the new default value. If the preference's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the preference
- * @param value the new default value for the preference
- */
-public void setDefault(String name, float value);
-/**
- * Sets the default value for the integer-valued preference with the
- * given name.
- * <p>
- * Note that the current value of the preference is affected if
- * the preference's current value was its old default value, in which
- * case it changes to the new default value. If the preference's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the preference
- * @param value the new default value for the preference
- */
-public void setDefault(String name, int value);
-/**
- * Sets the default value for the long-valued preference with the
- * given name.
- * <p>
- * Note that the current value of the preference is affected if
- * the preference's current value was its old default value, in which
- * case it changes to the new default value. If the preference's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the preference
- * @param value the new default value for the preference
- */
-public void setDefault(String name, long value);
-/**
- * Sets the default value for the string-valued preference with the
- * given name.
- * <p>
- * Note that the current value of the preference is affected if
- * the preference's current value was its old default value, in which
- * case it changes to the new default value. If the preference's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the preference
- * @param value the new default value for the preference
- */
-public void setDefault(String name, String defaultObject);
-/**
- * Sets the default value for the boolean-valued preference with the
- * given name.
- * <p>
- * Note that the current value of the preference is affected if
- * the preference's current value was its old default value, in which
- * case it changes to the new default value. If the preference's current
- * is different from its old default value, its current value is
- * unaffected. No property change events are reported by changing default
- * values.
- * </p>
- *
- * @param name the name of the preference
- * @param value the new default value for the preference
- */
-public void setDefault(String name, boolean value);
-/**
- * Sets the current value of the preference with the given name back
- * to its default value.
- * <p>
- * Note that the preferred way of re-initializing a preference to the
- * appropriate default value is to call <code>setToDefault</code>.
- * This is implemented by removing the named value from the store,
- * thereby exposing the default value.
- * </p>
- *
- * @param name the name of the preference
- */
-public void setToDefault(String name);
-/**
- * Sets the current value of the double-valued preference with the
- * given name.
- * <p>
- * A property change event is reported if the current value of the
- * preference actually changes from its previous value. In the event
- * object, the property name is the name of the preference, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * Note that the preferred way of re-initializing a preference to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the preference
- * @param value the new current value of the preference
- */
-public void setValue(String name, double value);
-/**
- * Sets the current value of the float-valued preference with the
- * given name.
- * <p>
- * A property change event is reported if the current value of the
- * preference actually changes from its previous value. In the event
- * object, the property name is the name of the preference, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * Note that the preferred way of re-initializing a preference to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the preference
- * @param value the new current value of the preference
- */
-public void setValue(String name, float value);
-/**
- * Sets the current value of the integer-valued preference with the
- * given name.
- * <p>
- * A property change event is reported if the current value of the
- * preference actually changes from its previous value. In the event
- * object, the property name is the name of the preference, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * Note that the preferred way of re-initializing a preference to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the preference
- * @param value the new current value of the preference
- */
-public void setValue(String name, int value);
-/**
- * Sets the current value of the long-valued preference with the
- * given name.
- * <p>
- * A property change event is reported if the current value of the
- * preference actually changes from its previous value. In the event
- * object, the property name is the name of the preference, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * Note that the preferred way of re-initializing a preference to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the preference
- * @param value the new current value of the preference
- */
-public void setValue(String name, long value);
-/**
- * Sets the current value of the string-valued preference with the
- * given name.
- * <p>
- * A property change event is reported if the current value of the
- * preference actually changes from its previous value. In the event
- * object, the property name is the name of the preference, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * Note that the preferred way of re-initializing a preference to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the preference
- * @param value the new current value of the preference
- */
-public void setValue(String name, String value);
-/**
- * Sets the current value of the boolean-valued preference with the
- * given name.
- * <p>
- * A property change event is reported if the current value of the
- * preference actually changes from its previous value. In the event
- * object, the property name is the name of the preference, and the
- * old and new values are wrapped as objects.
- * </p>
- * <p>
- * Note that the preferred way of re-initializing a preference to its
- * default value is to call <code>setToDefault</code>.
- * </p>
- *
- * @param name the name of the preference
- * @param value the new current value of the preference
- */
-public void setValue(String name, boolean value);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IntegerFieldEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IntegerFieldEditor.java
deleted file mode 100644
index 2ed4ca7..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IntegerFieldEditor.java
+++ /dev/null
@@ -1,131 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A field editor for an integer type preference.
- */
-public class IntegerFieldEditor extends StringFieldEditor {
- private int minValidValue = 0;
- private int maxValidValue = Integer.MAX_VALUE;
- private static final int DEFAULT_TEXT_LIMIT = 10;
-/**
- * Creates a new integer field editor
- */
-protected IntegerFieldEditor() {
-}
-/**
- * Creates an integer field editor.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
-public IntegerFieldEditor(String name, String labelText, Composite parent) {
- this(name,labelText,parent,DEFAULT_TEXT_LIMIT);
-}
-
-/**
- * Creates an integer field editor.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- * @param textLimit the maximum number of characters in the text.
- */
-public IntegerFieldEditor(String name, String labelText, Composite parent,int textLimit) {
- init(name, labelText);
- setTextLimit(textLimit);
- setEmptyStringAllowed(false);
- setErrorMessage(JFaceResources.getString("IntegerFieldEditor.errorMessage"));//$NON-NLS-1$
- createControl(parent);
-}
-
-
-/**
- * Sets the range of valid values for this field.
- *
- * @param min the minimum allowed value (inclusive)
- * @param max the maximum allowed value (inclusive)
- */
-public void setValidRange(int min,int max) {
- minValidValue = min;
- maxValidValue = max;
-}
-/* (non-Javadoc)
- * Method declared on StringFieldEditor.
- * Checks whether the entered String is a valid integer or not.
- */
-protected boolean checkState() {
-
- Text text = getTextControl();
-
- if (text == null)
- return false;
-
- String numberString = text.getText();
- try {
- int number = Integer.valueOf(numberString).intValue();
- if (number >= minValidValue && number <= maxValidValue) {
- clearErrorMessage();
- return true;
- } else {
- showErrorMessage();
- return false;
- }
- } catch (NumberFormatException e1) {
- showErrorMessage();
- }
-
- return false;
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doLoad() {
- Text text = getTextControl();
- if (text != null) {
- int value = getPreferenceStore().getInt(getPreferenceName());
- text.setText("" + value);//$NON-NLS-1$
- }
-
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doLoadDefault() {
- Text text = getTextControl();
- if (text != null) {
- int value = getPreferenceStore().getDefaultInt(getPreferenceName());
- text.setText("" + value);//$NON-NLS-1$
- }
- valueChanged();
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doStore() {
- Text text = getTextControl();
- if (text != null) {
- Integer i = new Integer(text.getText());
- getPreferenceStore().setValue(getPreferenceName(), i.intValue());
- }
-}
-/**
- * Returns this field editor's current value as an integer.
- *
- * @return the value
- * @exception NumberFormatException if the <code>String</code> does not
- * contain a parsable integer
- */
-public int getIntValue() throws NumberFormatException {
- return new Integer(getStringValue()).intValue();
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/JFacePreferences.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/JFacePreferences.java
deleted file mode 100644
index 76fef9b..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/JFacePreferences.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.jface.preference;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-/**
- *
- * JFacePreferences is a class used to administer the preferences
- * used by JFace pbjects.
- */
-public final class JFacePreferences {
-
- //Identifier for the Error Colour
- public static final String ERROR_COLOR = "ERROR_COLOR"; //$NON-NLS-1$
- //Identifier for the Hyperlink Colour
- public static final String HYPERLINK_COLOR = "HYPERLINK_COLOR"; //$NON-NLS-1$
- //Identifier for the Active Hyperlink Colour
- public static final String ACTIVE_HYPERLINK_COLOR = "ACTIVE_HYPERLINK_COLOR"; //$NON-NLS-1$
-
-
- private static IPreferenceStore preferenceStore;
-
- /**
- * Prevent construction.
- */
- private JFacePreferences() {
- }
-
- /**
- * Return the preference store for the receiver.
- * @return IPreferenceStore or null
- */
- public static IPreferenceStore getPreferenceStore(){
- return preferenceStore;
- }
-
- /**
- * Set the preference store for the receiver.
- * @param store IPreferenceStore
- */
- public static void setPreferenceStore(IPreferenceStore store){
- preferenceStore = store;
- }
-
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ListEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ListEditor.java
deleted file mode 100644
index 1b240a3..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ListEditor.java
+++ /dev/null
@@ -1,403 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.Iterator;
-
-/**
- * An abstract field editor that manages a list of input values.
- * The editor displays a list containing the values, buttons for
- * adding and removing values, and Up and Down buttons to adjust
- * the order of elements in the list.
- * <p>
- * Subclasses must implement the <code>parseString</code>,
- * <code>createList</code>, and <code>createNewInputObject</code>
- * framework methods.
- * </p>
- */
-public abstract class ListEditor extends FieldEditor {
-
- /**
- * The list widget; <code>null</code> if none
- * (before creation or after disposal).
- */
- private List list;
-
- /**
- * The button box containing the Add, Remove, Up, and Down buttons;
- * <code>null</code> if none (before creation or after disposal).
- */
- private Composite buttonBox;
-
- /**
- * The Add button.
- */
- private Button addButton;
-
- /**
- * The Remove button.
- */
- private Button removeButton;
-
- /**
- * The Up button.
- */
- private Button upButton;
-
- /**
- * The Down button.
- */
- private Button downButton;
-
- /**
- * The selection listener.
- */
- private SelectionListener selectionListener;
-/**
- * Creates a new list field editor
- */
-protected ListEditor() {
-}
-/**
- * Creates a list field editor.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
-protected ListEditor(String name, String labelText, Composite parent) {
- init(name, labelText);
- createControl(parent);
-}
-/**
- * Notifies that the Add button has been pressed.
- */
-private void addPressed() {
- setPresentsDefaultValue(false);
- String input = getNewInputObject();
-
- if (input != null) {
- int index = list.getSelectionIndex();
- if (index >= 0)
- list.add(input, index + 1);
- else
- list.add(input, 0);
- selectionChanged();
- }
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void adjustForNumColumns(int numColumns) {
- Control control = getLabelControl();
- ((GridData)control.getLayoutData()).horizontalSpan = numColumns;
- ((GridData)list.getLayoutData()).horizontalSpan = numColumns - 1;
-}
-/**
- * Creates the Add, Remove, Up, and Down button in the given button box.
- *
- * @param buttonBox the box for the buttons
- */
-private void createButtons(Composite buttonBox) {
- addButton = createPushButton(buttonBox, "ListEditor.add");//$NON-NLS-1$
- removeButton = createPushButton(buttonBox, "ListEditor.remove");//$NON-NLS-1$
- upButton = createPushButton(buttonBox, "ListEditor.up");//$NON-NLS-1$
- downButton = createPushButton(buttonBox, "ListEditor.down");//$NON-NLS-1$
-}
-/**
- * Combines the given list of items into a single string.
- * This method is the converse of <code>parseString</code>.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @param items the list of items
- * @return the combined string
- * @see #parseString
- */
-protected abstract String createList(String[] items);
-/**
- * Helper method to create a push button.
- *
- * @param parent the parent control
- * @param key the resource name used to supply the button's label text
- */
-private Button createPushButton(Composite parent, String key) {
- Button button = new Button(parent, SWT.PUSH);
- button.setText(JFaceResources.getString(key));
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.heightHint = convertVerticalDLUsToPixels(button, IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(button, IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- button.setLayoutData(data);
- button.addSelectionListener(getSelectionListener());
- return button;
-}
-/**
- * Creates a selection listener.
- */
-public void createSelectionListener() {
- selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- Widget widget = event.widget;
- if (widget == addButton) {
- addPressed();
- } else
- if (widget == removeButton) {
- removePressed();
- } else
- if (widget == upButton) {
- upPressed();
- } else
- if (widget == downButton) {
- downPressed();
- } else
- if (widget == list) {
- selectionChanged();
- }
- }
- };
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doFillIntoGrid(Composite parent, int numColumns) {
- Control control = getLabelControl(parent);
- GridData gd = new GridData();
- gd.horizontalSpan = numColumns;
- control.setLayoutData(gd);
-
- list = getListControl(parent);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.verticalAlignment = GridData.FILL;
- gd.horizontalSpan = numColumns - 1;
- gd.grabExcessHorizontalSpace = true;
- list.setLayoutData(gd);
-
- buttonBox = getButtonBoxControl(parent);
- gd = new GridData();
- gd.verticalAlignment = GridData.BEGINNING;
- buttonBox.setLayoutData(gd);
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doLoad() {
- if (list != null) {
- String s = getPreferenceStore().getString(getPreferenceName());
- String[] array = parseString(s);
- for (int i = 0; i < array.length; i++){
- list.add(array[i]);
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doLoadDefault() {
- if (list != null) {
- list.removeAll();
- String s = getPreferenceStore().getDefaultString(getPreferenceName());
- String[] array = parseString(s);
- for (int i = 0; i < array.length; i++){
- list.add(array[i]);
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doStore() {
- String s = createList(list.getItems());
- if (s != null)
- getPreferenceStore().setValue(getPreferenceName(), s);
-}
-/**
- * Notifies that the Down button has been pressed.
- */
-private void downPressed() {
- swap(false);
-}
-/**
- * Returns this field editor's button box containing the Add, Remove,
- * Up, and Down button.
- *
- * @param parent the parent control
- * @return the button box
- */
-public Composite getButtonBoxControl(Composite parent) {
- if (buttonBox == null) {
- buttonBox = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- buttonBox.setLayout(layout);
- createButtons(buttonBox);
- buttonBox.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- addButton = null;
- removeButton = null;
- upButton = null;
- downButton = null;
- buttonBox = null;
- }
- });
-
- } else {
- checkParent(buttonBox, parent);
- }
-
- selectionChanged();
- return buttonBox;
-}
-/**
- * Returns this field editor's list control.
- *
- * @param parent the parent control
- * @return the list control
- */
-public List getListControl(Composite parent) {
- if (list == null) {
- list = new List(parent, SWT.BORDER | SWT.SINGLE | SWT.V_SCROLL | SWT.H_SCROLL);
- list.addSelectionListener(getSelectionListener());
- list.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- list = null;
- }
- });
- } else {
- checkParent(list, parent);
- }
- return list;
-}
-/**
- * Creates and returns a new item for the list.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @return a new item
- */
-protected abstract String getNewInputObject();
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-public int getNumberOfControls() {
- return 2;
-}
-/**
- * Returns this field editor's selection listener.
- * The listener is created if nessessary.
- *
- * @return the selection listener
- */
-private SelectionListener getSelectionListener() {
- if (selectionListener == null)
- createSelectionListener();
- return selectionListener;
-}
-/**
- * Returns this field editor's shell.
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- *
- * @return the shell
- */
-protected Shell getShell() {
- if (addButton == null)
- return null;
- return addButton.getShell();
-}
-/**
- * Splits the given string into a list of strings.
- * This method is the converse of <code>createList</code>.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @param stringList the string
- * @return an array of <code>String</code>
- * @see #createList
- */
-protected abstract String[] parseString(String stringList);
-/**
- * Notifies that the Remove button has been pressed.
- */
-private void removePressed() {
- setPresentsDefaultValue(false);
- int index = list.getSelectionIndex();
- if (index >= 0) {
- list.remove(index);
- selectionChanged();
- }
-}
-/**
- * Notifies that the list selection has changed.
- */
-private void selectionChanged() {
-
- int index = list.getSelectionIndex();
- int size = list.getItemCount();
-
- removeButton.setEnabled(index >= 0);
- upButton.setEnabled(size > 1 && index > 0);
- downButton.setEnabled(size > 1 && index >= 0 && index < size - 1);
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-public void setFocus() {
- if (list != null) {
- list.setFocus();
- }
-}
-/**
- * Moves the currently selected item up or down.
- *
- * @param up <code>true</code> if the item should move up,
- * and <code>false</code> if it should move down
- */
-private void swap(boolean up) {
- setPresentsDefaultValue(false);
- int index = list.getSelectionIndex();
- int target = up ? index - 1 : index + 1;
-
- if (index >= 0) {
- String[] selection = list.getSelection();
- Assert.isTrue(selection.length == 1);
- list.remove(index);
- list.add(selection[0], target);
- list.setSelection(target);
- }
- selectionChanged();
-}
-/**
- * Notifies that the Up button has been pressed.
- */
-private void upPressed() {
- swap(true);
-}
-
-/*
- * @see FieldEditor.setEnabled(boolean,Composite).
- */
-public void setEnabled(boolean enabled, Composite parent){
- super.setEnabled(enabled,parent);
- getListControl(parent).setEnabled(enabled);
- addButton.setEnabled(enabled);
- removeButton.setEnabled(enabled);
- upButton.setEnabled(enabled);
- downButton.setEnabled(enabled);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PathEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PathEditor.java
deleted file mode 100644
index 04377ab..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PathEditor.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.*;
-import java.io.File;
-import java.util.*;
-import java.util.List; // disambiguate from SWT.List
-
-/**
- * A field editor to edit directory paths.
- */
-public class PathEditor extends ListEditor {
-
- /**
- * The last path, or <code>null</code> if none.
- */
- private String lastPath;
-
- /**
- * The special label text for directory chooser,
- * or <code>null</code> if none.
- */
- private String dirChooserLabelText;
-/**
- * Creates a new path field editor
- */
-protected PathEditor() {
-}
-/**
- * Creates a path field editor.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param dirChooserLabelText the label text displayed for the directory chooser
- * @param parent the parent of the field editor's control
- */
-public PathEditor(String name, String labelText, String dirChooserLabelText, Composite parent) {
- init(name, labelText);
- this.dirChooserLabelText = dirChooserLabelText;
- createControl(parent);
-}
-/* (non-Javadoc)
- * Method declared on ListEditor.
- * Creates a single string from the given array by separating each
- * string with the appropriate OS-specific path separator.
- */
-protected String createList(String[] items) {
- StringBuffer path = new StringBuffer("");//$NON-NLS-1$
-
- for (int i = 0; i < items.length; i++) {
- path.append(items[i]);
- path.append(File.pathSeparator);
- }
- return path.toString();
-}
-/* (non-Javadoc)
- * Method declared on ListEditor.
- * Creates a new path element by means of a directory dialog.
- */
-protected String getNewInputObject() {
-
- DirectoryDialog dialog = new DirectoryDialog(getShell());
- if (dirChooserLabelText != null)
- dialog.setMessage(dirChooserLabelText);
- if (lastPath != null) {
- if (new File(lastPath).exists())
- dialog.setFilterPath(lastPath);
- }
- String dir = dialog.open();
- if (dir != null) {
- dir = dir.trim();
- if (dir.length() == 0)
- return null;
- lastPath = dir;
- }
- return dir;
-}
-/* (non-Javadoc)
- * Method declared on ListEditor.
- */
-protected String[] parseString(String stringList) {
- StringTokenizer st = new StringTokenizer(stringList, File.pathSeparator + "\n\r");//$NON-NLS-1$
- ArrayList v = new ArrayList();
- while (st.hasMoreElements()) {
- v.add(st.nextElement());
- }
- return (String[])v.toArray(new String[v.size()]);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceConverter.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceConverter.java
deleted file mode 100644
index fe69313..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceConverter.java
+++ /dev/null
@@ -1,457 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.jface.resource.*;
-
-import java.util.Arrays;
-import java.util.StringTokenizer;
-
-/**
- * A utility class for dealing with preferences whose values are
- * common SWT objects (color, points, rectangles, and font data).
- * The static methods on this class handle the conversion between
- * the SWT objects and their string representations.
- * <p>
- * Usage:
- * <pre>
- * IPreferenceStore store = ...;
- * PreferenceConverter.setValue(store, "bg", new RGB(127,127,127));
- * ...
- * RBG bgColor = PreferenceConverter.getValue(store, "bg");
- * </pre>
- * </p>
- * <p>
- * This class contains static methods and fields only and cannot
- * be instantiated.
- * </p>
- */
-public class PreferenceConverter {
-
- /**
- * The default-default value for point preferences
- * (the origin, <code>(0,0)</code>).
- */
- public static final Point POINT_DEFAULT_DEFAULT= new Point(0, 0);
- /**
- * The default-default value for rectangle preferences
- * (the empty rectangle <code>(0,0,0,0)</code>).
- */
- public static final Rectangle RECTANGLE_DEFAULT_DEFAULT=
- new Rectangle(0, 0, 0, 0);
- /**
- * The default-default value for color preferences
- * (black, <code>RGB(0,0,0)</code>).
- */
- public static final RGB COLOR_DEFAULT_DEFAULT= new RGB(0, 0, 0);
-
- /**
- * The default-default value for <code>FontData</code> preferences.
- */
- public static final FontData[] FONTDATA_ARRAY_DEFAULT_DEFAULT;
- static {
- Shell shell= new Shell();
- FONTDATA_ARRAY_DEFAULT_DEFAULT = shell.getFont().getFontData();
- shell.dispose();
- }
-
- private static final String ENTRY_SEPARATOR = ";"; //$NON-NLS-1$
-
- /**
- * The default-default value for <code>FontData</code> preferences.
- * This is left in for compatibility purposes. It is recommended that
- * FONTDATA_ARRAY_DEFAULT_DEFAULT is actually used.
- */
- public static final FontData FONTDATA_DEFAULT_DEFAULT;
- static {
- FONTDATA_DEFAULT_DEFAULT= FONTDATA_ARRAY_DEFAULT_DEFAULT[0];
- }
-
-/* (non-Javadoc)
- * private constructor to prevent instantiation.
- */
-private PreferenceConverter() {
-}
-/**
- * Helper method to construct a color from the given string.
- */
-private static RGB basicGetColor(String value) {
-
- if (IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(value))
- return COLOR_DEFAULT_DEFAULT;
-
- RGB color = StringConverter.asRGB(value, null);
- if (color == null)
- return COLOR_DEFAULT_DEFAULT;
- return color;
-}
-/**
- * Helper method to construct a <code>FontData</code> from the given string.
- * String is in the form FontData;FontData; in order that
- * multiple FontDatas can be defined.
- */
-private static FontData[] basicGetFontData(String value) {
- if (IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(value))
- return FONTDATA_ARRAY_DEFAULT_DEFAULT;
-
- //Read in all of them to get the value
- StringTokenizer tokenizer =
- new StringTokenizer(value,ENTRY_SEPARATOR);
- int numTokens = tokenizer.countTokens();
- FontData[] fontData = new FontData[numTokens];
-
- for(int i = 0; i < numTokens; i ++){
- try{
- fontData[i] = new FontData(tokenizer.nextToken());
- } catch (SWTException error) {
- return FONTDATA_ARRAY_DEFAULT_DEFAULT;
- } catch (IllegalArgumentException error) {
- return FONTDATA_ARRAY_DEFAULT_DEFAULT;
- }
- }
- return fontData;
-}
-/**
- * Helper method to construct a point from the given string.
- */
-private static Point basicGetPoint(String value) {
- Point dp = new Point(POINT_DEFAULT_DEFAULT.x, POINT_DEFAULT_DEFAULT.y);
- if (IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(value))
- return dp;
- return StringConverter.asPoint(value, dp);
-}
-/**
- * Helper method to construct a rectangle from the given string.
- */
-private static Rectangle basicGetRectangle(String value) {
- // We can't just return RECTANGLE_DEFAULT_DEFAULT because
- // a rectangle object doesn't have value semantik.
- Rectangle dr=
- new Rectangle(
- RECTANGLE_DEFAULT_DEFAULT.x,
- RECTANGLE_DEFAULT_DEFAULT.y,
- RECTANGLE_DEFAULT_DEFAULT.width,
- RECTANGLE_DEFAULT_DEFAULT.height);
-
- if (IPreferenceStore.STRING_DEFAULT_DEFAULT.equals(value))
- return dr;
- return StringConverter.asRectangle(value, dr);
-}
-/**
- * Returns the current value of the color-valued preference with the
- * given name in the given preference store.
- * Returns the default-default value (<code>COLOR_DEFAULT_DEFAULT</code>)
- * if there is no preference with the given name, or if the current value
- * cannot be treated as a color.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @return the color-valued preference
- */
-public static RGB getColor(IPreferenceStore store, String name) {
- return basicGetColor(store.getString(name));
-}
-/**
- * Returns the default value for the color-valued preference
- * with the given name in the given preference store.
- * Returns the default-default value (<code>COLOR_DEFAULT_DEFAULT</code>)
- * is no default preference with the given name, or if the default
- * value cannot be treated as a color.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @return the default value of the preference
- */
-public static RGB getDefaultColor(IPreferenceStore store, String name) {
- return basicGetColor(store.getDefaultString(name));
-}
-
-/**
- * Returns the default value array for the font-valued preference
- * with the given name in the given preference store.
- * Returns the default-default value (<code>FONTDATA_ARRAY_DEFAULT_DEFAULT</code>)
- * is no default preference with the given name, or if the default
- * value cannot be treated as font data.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @return the default value of the preference
- */
-public static FontData[] getDefaultFontDataArray(IPreferenceStore store, String name) {
- return basicGetFontData(store.getDefaultString(name));
-}
-
-/**
- * Returns a single default value for the font-valued preference
- * with the given name in the given preference store.
- * Returns the default-default value (<code>FONTDATA_DEFAULT_DEFAULT</code>)
- * is no default preference with the given name, or if the default
- * value cannot be treated as font data.
- * This method is provided for backwards compatibility. It is
- * recommended that <code>getDefaultFontDataArray</code> is
- * used instead.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @return the default value of the preference
- */
-public static FontData getDefaultFontData(IPreferenceStore store, String name) {
- return getDefaultFontDataArray(store,name)[0];
-}
-/**
- * Returns the default value for the point-valued preference
- * with the given name in the given preference store.
- * Returns the default-default value (<code>POINT_DEFAULT_DEFAULT</code>)
- * is no default preference with the given name, or if the default
- * value cannot be treated as a point.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @return the default value of the preference
- */
-public static Point getDefaultPoint(IPreferenceStore store, String name) {
- return basicGetPoint(store.getDefaultString(name));
-}
-/**
- * Returns the default value for the rectangle-valued preference
- * with the given name in the given preference store.
- * Returns the default-default value (<code>RECTANGLE_DEFAULT_DEFAULT</code>)
- * is no default preference with the given name, or if the default
- * value cannot be treated as a rectangle.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @return the default value of the preference
- */
-public static Rectangle getDefaultRectangle(IPreferenceStore store, String name) {
- return basicGetRectangle(store.getDefaultString(name));
-}
-/**
- * Returns the current value of the font-valued preference with the
- * given name in the given preference store.
- * Returns the default-default value (<code>FONTDATA_ARRAY_DEFAULT_DEFAULT</code>)
- * if there is no preference with the given name, or if the current value
- * cannot be treated as font data.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @return the font-valued preference
- */
-public static FontData[] getFontDataArray(IPreferenceStore store, String name) {
- return basicGetFontData(store.getString(name));
-}
-
-/**
- * Returns the current value of the first entry of the
- * font-valued preference with the
- * given name in the given preference store.
- * Returns the default-default value (<code>FONTDATA_ARRAY_DEFAULT_DEFAULT</code>)
- * if there is no preference with the given name, or if the current value
- * cannot be treated as font data.
- * This API is provided for backwards compatibility. It is
- * recommended that <code>getFontDataArray</code> is used instead.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @return the font-valued preference
- */
-public static FontData getFontData(IPreferenceStore store, String name) {
- return getFontDataArray(store,name)[0];
-}
-
-/**
- * Returns the current value of the point-valued preference with the
- * given name in the given preference store.
- * Returns the default-default value (<code>POINT_DEFAULT_DEFAULT</code>)
- * if there is no preference with the given name, or if the current value
- * cannot be treated as a point.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @return the point-valued preference
- */
-public static Point getPoint(IPreferenceStore store, String name) {
- return basicGetPoint(store.getString(name));
-}
-/**
- * Returns the current value of the rectangle-valued preference with the
- * given name in the given preference store.
- * Returns the default-default value (<code>RECTANGLE_DEFAULT_DEFAULT</code>)
- * if there is no preference with the given name, or if the current value
- * cannot be treated as a rectangle.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @return the rectangle-valued preference
- */
-public static Rectangle getRectangle(IPreferenceStore store, String name) {
- return basicGetRectangle(store.getString(name));
-}
-/**
- * Sets the default value of the preference with the given name
- * in the given preference store. As FontDatas are stored as
- * arrays this method is only provided for backwards compatibility.
- * Use <code>setDefault(IPreferenceStore, String, FontData[])</code>
- * instead.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @param value the new default value of the preference
- */
-public static void setDefault(IPreferenceStore store, String name, FontData value) {
- FontData[] fontDatas = new FontData[1];
- fontDatas[0] = value;
- setDefault(store,name, fontDatas);
-}
-
-/**
- * Sets the default value of the preference with the given name
- * in the given preference store.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @param value the new default value of the preference
- */
-public static void setDefault(IPreferenceStore store, String name, FontData[] value) {
- store.setDefault(name, getStoredRepresentation(value));
-}
-
-/**
- * Sets the default value of the preference with the given name
- * in the given preference store.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @param value the new defaul value of the preference
- */
-public static void setDefault(IPreferenceStore store, String name, Point value) {
- store.setDefault(name, StringConverter.asString(value));
-}
-/**
- * Sets the default value of the preference with the given name
- * in the given preference store.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @param value the new defaul value of the preference
- */
-public static void setDefault(IPreferenceStore store, String name, Rectangle value) {
- store.setDefault(name, StringConverter.asString(value));
-}
-/**
- * Sets the default value of the preference with the given name
- * in the given preference store.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @param value the new defaul value of the preference
- */
-public static void setDefault(IPreferenceStore store, String name, RGB value) {
- store.setDefault(name, StringConverter.asString(value));
-}
-
-/**
- * Sets the current value of the preference with the given name
- * in the given preference store. Included for backwards compatibility -
- * use <code>setValue(IPreferenceStore,String,FontData[])</code> instead.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @param value the new current value of the preference
- */
-public static void setValue(IPreferenceStore store, String name, FontData value) {
- FontData[] data = new FontData[1];
- data[0] = value;
- setValue(store,name,data);
-}
-
-
-/**
- * Sets the current value of the preference with the given name
- * in the given preference store.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @param value the new current value of the preference
- */
-public static void setValue(IPreferenceStore store, String name, FontData[] value) {
- FontData[] oldValue = getFontDataArray(store, name);
- // see if the font has changed
- if(!Arrays.equals(oldValue, value)){
- store.putValue(name, getStoredRepresentation(value));
- JFaceResources.getFontRegistry().put(name,value);
- store.firePropertyChangeEvent(name, oldValue, value);
- }
-}
-
-/**
- * Return the stored representation of the FontData array.
- * FontDatas are stored in the form FontData;FontData;
- * Only include the non-null entries,
- * @return String - the String that will be stored
- * @param FontData[] - the FontDatas
- */
-
-private static String getStoredRepresentation(FontData[] fontData){
- StringBuffer buffer = new StringBuffer();
- for(int i = 0; i < fontData.length; i++){
- if(fontData[i] != null){
- buffer.append(fontData[i].toString());
- buffer.append(ENTRY_SEPARATOR);
- }
- }
- return buffer.toString();
-}
-
-/**
- * Sets the current value of the preference with the given name
- * in the given preference store.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @param value the new current value of the preference
- */
-public static void setValue(IPreferenceStore store, String name, Point value) {
- Point oldValue= getPoint(store, name);
- if (oldValue == null || !oldValue.equals(value)) {
- store.putValue(name, StringConverter.asString(value));
- store.firePropertyChangeEvent(name, oldValue, value);
- }
-}
-/**
- * Sets the current value of the preference with the given name
- * in the given preference store.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @param value the new current value of the preference
- */
-public static void setValue(IPreferenceStore store, String name, Rectangle value) {
- Rectangle oldValue= getRectangle(store, name);
- if (oldValue == null || !oldValue.equals(value)) {
- store.putValue(name, StringConverter.asString(value));
- store.firePropertyChangeEvent(name, oldValue, value);
- }
-}
-/**
- * Sets the current value of the preference with the given name
- * in the given preference store.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @param value the new current value of the preference
- */
-public static void setValue(IPreferenceStore store, String name, RGB value) {
- RGB oldValue= getColor(store, name);
- if (oldValue == null || !oldValue.equals(value)) {
- store.putValue(name, StringConverter.asString(value));
- store.firePropertyChangeEvent(name, oldValue, value);
- JFaceColors.clearColor(name);
- }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java
deleted file mode 100644
index 66d49f5..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java
+++ /dev/null
@@ -1,1037 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog; // otherwise ambiguous
-import org.eclipse.jface.resource.*;
-import org.eclipse.jface.util.*;
-/**
- * A preference dialog is a hierarchical presentation of preference
- * pages. Each page is represented by a node in the tree shown
- * on the left hand side of the dialog; when a node is selected, the
- * corresponding page is shown on the right hand side.
- */
-public class PreferenceDialog extends Dialog implements IPreferencePageContainer {
- /**
- * Title area fields
- */
- public static final String PREF_DLG_TITLE_IMG = "preference_dialog_title_image";//$NON-NLS-1$
- public static final String PREF_DLG_IMG_TITLE_ERROR = DLG_IMG_MESSAGE_ERROR;//$NON-NLS-1$
-
- //The id of the last page that was selected
- private static String lastPreferenceId = null;
-
- static {
- ImageRegistry reg = JFaceResources.getImageRegistry();
- reg.put(PREF_DLG_TITLE_IMG, ImageDescriptor.createFromFile(PreferenceDialog.class, "images/pref_dialog_title.gif"));//$NON-NLS-1$
- }
-
- private Composite titleArea;
- private CLabel messageLabel;
- private Label titleImage;
- private Color titleAreaColor;
-
- private String message = ""; //$NON-NLS-1$
- private String errorMessage;
- private Color normalMsgAreaBackground;
- private Color errorMsgAreaBackground;
- private Image messageImage;
- private Image errorMsgImage;
- private boolean showingError = false;
- private Point lastShellSize;
-
- /**
- * Preference store, initially <code>null</code> meaning none.
- *
- * @see #setPreferenceStore
- */
- private IPreferenceStore preferenceStore;
-
- /**
- * The current preference page, or <code>null</code> if
- * there is none.
- */
- private IPreferencePage currentPage;
-
- /**
- * The preference manager.
- */
- private PreferenceManager preferenceManager;
-
- /**
- * The main control for this dialog.
- */
- private Composite body;
-
- /**
- * The Composite in which a page is shown.
- */
- private Composite pageContainer;
-
- /**
- * The minimum page size; 400 by 400 by default.
- *
- * @see #setMinimumPageSize
- */
- private Point minimumPageSize = new Point(400,400);
-
- /**
- * The OK button.
- */
- private Button okButton;
-
- /**
- * The Cancel button.
- */
- private Button cancelButton;
-
- /**
- * The Help button; <code>null</code> if none.
- */
- private Button helpButton = null;
-
- /**
- * Indicates whether help is available; <code>false</code> by default.'
- *
- * @see #setHelpAvailable
- */
- private boolean isHelpAvailable = false;
-
- /**
- * The tree control.
- */
- private Tree tree;
-
- /**
- * The current tree item.
- */
- private TreeItem currentTreeItem;
-
- /**
- * Layout for the page container.
- *
- * @see #pageContainer
- */
- private class PageLayout extends Layout {
- public void layout(Composite composite, boolean force) {
- Rectangle rect = composite.getClientArea();
- Control [] children = composite.getChildren();
- for (int i= 0; i < children.length; i++) {
- children[i].setSize(rect.width, rect.height);
- }
- }
- public Point computeSize(Composite composite, int wHint, int hHint, boolean force) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- return new Point(wHint, hHint);
- int x= minimumPageSize.x;
- int y= minimumPageSize.y;
-
- Control[] children= composite.getChildren();
- for (int i= 0; i < children.length; i++) {
- Point size= children[i].computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
- x= Math.max(x, size.x);
- y= Math.max(y, size.y);
- }
- if (wHint != SWT.DEFAULT) x = wHint;
- if (hHint != SWT.DEFAULT) y = hHint;
- return new Point(x, y);
- }
- }
-
-/**
- * Creates a new preference dialog under the control of the given preference
- * manager.
- *
- * @param shell the parent shell
- * @param manager the preference manager
- */
-public PreferenceDialog(Shell parentShell, PreferenceManager manager) {
- super(parentShell);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- preferenceManager = manager;
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void buttonPressed(int buttonId) {
- switch (buttonId) {
- case IDialogConstants.OK_ID : {
- okPressed();
- return;
- }
- case IDialogConstants.CANCEL_ID : {
- cancelPressed();
- return;
- }
- case IDialogConstants.HELP_ID : {
- helpPressed();
- return;
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void cancelPressed() {
- // Inform all pages that we are cancelling
- Iterator nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER).iterator();
- while (nodes.hasNext()) {
- IPreferenceNode node = (IPreferenceNode) nodes.next();
- if (node.getPage() != null) {
- if(!node.getPage().performCancel())
- return;
- }
- }
- setReturnCode(CANCEL);
- close();
-}
-/* (non-Javadoc)
- * Method declared on Window.
- */
-public boolean close() {
- setSelectedNode();
-
- List nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER);
- for (int i = 0; i < nodes.size(); i++){
- IPreferenceNode node = (IPreferenceNode) nodes.get(i);
- node.disposeResources();
- }
- return super.close();
-}
-/* (non-Javadoc)
- * Method declared on Window.
- */
-protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(JFaceResources.getString("PreferenceDialog.title"));//$NON-NLS-1$
-
- // Register help listener on the shell
- newShell.addHelpListener(new HelpListener() {
- public void helpRequested(HelpEvent event) {
- // call perform help on the current page
- if (currentPage != null) {
- currentPage.performHelp();
- }
- }
- });
-
- newShell.addShellListener(new ShellAdapter() {
- public void shellActivated(ShellEvent e) {
- if (lastShellSize == null)
- lastShellSize = getShell().getSize();
- }
- });
-}
-/*(non-Javadoc)
- * Method declared on Window.
- */
-protected void constrainShellSize() {
- super.constrainShellSize();
- // record opening shell size
- if (lastShellSize == null)
- lastShellSize = getShell().getSize();
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void createButtonsForButtonBar(Composite parent) {
- // create OK and Cancel buttons by default
- okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- getShell().setDefaultButton(okButton);
- cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- if (isHelpAvailable) {
- helpButton = createButton(parent, IDialogConstants.HELP_ID, IDialogConstants.HELP_LABEL, false);
- }
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
-
- // Add the first page
- selectSavedItem();
-
- return control;
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- GridData gd;
- Composite composite = (Composite)super.createDialogArea(parent);
- ((GridLayout) composite.getLayout()).numColumns = 2;
- ((GridLayout) composite.getLayout()).horizontalSpacing = 10;
-
- // Build the tree an put it into the composite.
- createTree(composite);
- gd = new GridData(GridData.FILL_VERTICAL);
- gd.widthHint = 150;
- gd.verticalSpan = 2;
- tree.setLayoutData(gd);
-
- // Build the title area and separator line
- Composite titleComposite = new Composite(composite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 0;
- titleComposite.setLayout(layout);
- titleComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- createTitleArea(titleComposite);
-
- Label titleBarSeparator = new Label(titleComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- titleBarSeparator.setLayoutData(gd);
-
- // Build the Page container
- pageContainer = createPageContainer(composite);
- pageContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
- pageContainer.setFont(parent.getFont());
-
- // Build the separator line
- Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- separator.setLayoutData(gd);
-
- return composite;
-}
-/**
- * Creates the inner page container.
- */
-private Composite createPageContainer(Composite parent) {
- Composite result = new Composite(parent, SWT.NULL);
- result.setLayout(new PageLayout());
- return result;
-}
-/**
- * Creates the wizard's title area.
- *
- * @param parent the SWT parent for the title area composite
- * @return the created title area composite
- */
-private Composite createTitleArea(Composite parent) {
- // Create the title area which will contain
- // a title, message, and image.
- titleArea = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 0;
- layout.numColumns = 2;
-
- // Get the background color for the title area
- Display display = parent.getDisplay();
- Color background = JFaceColors.getBannerBackground(display);
- Color foreground = JFaceColors.getBannerForeground(display);
-
- GridData layoutData = new GridData(GridData.FILL_BOTH);
- titleArea.setLayout(layout);
- titleArea.setLayoutData(layoutData);
- titleArea.setBackground(background);
-
- // Add a dispose listener
- titleArea.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (titleAreaColor != null)
- titleAreaColor.dispose();
- if (errorMsgAreaBackground != null)
- errorMsgAreaBackground.dispose();
- }
- });
-
-
- // Message label
- messageLabel = new CLabel(titleArea, SWT.LEFT);
- JFaceColors.setColors(messageLabel,foreground,background);
- messageLabel.setText(" ");//$NON-NLS-1$
- messageLabel.setFont(JFaceResources.getBannerFont());
-
- final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if(JFaceResources.BANNER_FONT.equals(event.getProperty()) ||
- JFaceResources.DIALOG_FONT.equals(event.getProperty())) {
- updateMessage();
- }
- }
- };
-
- messageLabel.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- JFaceResources.getFontRegistry().removeListener(fontListener);
- }
- });
-
- JFaceResources.getFontRegistry().addListener(fontListener);
-
-
- GridData gd = new GridData(GridData.FILL_BOTH);
- messageLabel.setLayoutData(gd);
-
- // Title image
- titleImage = new Label(titleArea, SWT.LEFT);
- titleImage.setBackground(background);
- titleImage.setImage(JFaceResources.getImage(PREF_DLG_TITLE_IMG));
- gd = new GridData();
- gd.horizontalAlignment = GridData.END;
- titleImage.setLayoutData(gd);
-
- return titleArea;
-}
-
-
-/**
- * Creates a Tree/TreeItem structure that reflects the page hierarchy.
- */
-private void createTree(Composite parent) {
- if (tree != null)
- tree.dispose();
-
- tree = new Tree(parent, SWT.BORDER);
- OpenStrategy eventAdapter = new OpenStrategy(tree);
- eventAdapter.addPostSelectionListener(new SelectionAdapter() {
- public void widgetSelected(final SelectionEvent event) {
- BusyIndicator.showWhile(tree.getDisplay(),new Runnable(){
- public void run() {
- Object data = event.item.getData();
- if (data instanceof IPreferenceNode) {
- if (!isCurrentPageValid()) {
- showPageFlippingAbortDialog();
- selectCurrentPageAgain();
- } else
- if (!showPage((IPreferenceNode) data)) {
- // Page flipping wasn't successful
- showPageFlippingAbortDialog();
- selectCurrentPageAgain();
- } else {
- // Everything went well
- currentTreeItem = (TreeItem) event.item;
- }
-
- // Keep focus in tree. See bugs 2692, 2621, and 6775.
- tree.setFocus();
- }
- }
- });
- }
- });
-
- eventAdapter.addSelectionListener(new SelectionAdapter() {
- public void widgetDefaultSelected(final SelectionEvent event) {
- TreeItem[] selection = tree.getSelection();
- if (selection.length > 0)
- selection[0].setExpanded(!selection[0].getExpanded());
- }
- });
-
- IPreferenceNode node = preferenceManager.getRoot();
- IPreferenceNode[] subnodes = node.getSubNodes();
- tree.setFont(parent.getFont());
- for (int i = 0; i < subnodes.length; i++){
- createTreeItemFor(tree, subnodes[i]);
- }
-}
-/**
- * Creates a TreeItem structure that reflects to the page hierarchy.
- */
-private void createTreeItemFor(Widget parent, IPreferenceNode node) {
- TreeItem item = null;
- if (parent instanceof Tree)
- item = new TreeItem((Tree) parent, SWT.DEFAULT);
- else
- item = new TreeItem((TreeItem) parent, SWT.DEFAULT);
-
- item.setData(node);
- item.setText(node.getLabelText());
- Image image = node.getLabelImage();
- if (image != null) {
- item.setImage(image);
- }
-
- IPreferenceNode[] subnodes = node.getSubNodes();
- for (int i = 0; i < subnodes.length; i++){
- createTreeItemFor(item, subnodes[i]);
- }
-}
-/**
- * Returns the preference mananger used by this preference dialog.
- *
- * @return the preference mananger
- */
-public PreferenceManager getPreferenceManager() {
- return preferenceManager;
-}
-/* (non-Javadoc)
- * Method declared on IPreferencePageDialog.
- */
-public IPreferenceStore getPreferenceStore() {
- return preferenceStore;
-}
-/**
- * Save the values specified in the pages.
- * <p>
- * The default implementation of this framework method saves all
- * pages of type <code>PreferencePage</code> (if their store needs saving
- * and is a <code>PreferenceStore</code>).
- * </p>
- * <p>
- * Subclasses may override.
- * </p>
- */
-protected void handleSave() {
- Iterator nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER).iterator();
- while (nodes.hasNext()) {
- IPreferenceNode node = (IPreferenceNode) nodes.next();
- IPreferencePage page = node.getPage();
- if (page instanceof PreferencePage) {
- // Save now in case tbe workbench does not shutdown cleanly
- IPreferenceStore store = ((PreferencePage)page).getPreferenceStore();
- if (store != null
- && store.needsSaving()
- && store instanceof PreferenceStore) {
- try {
- ((PreferenceStore)store).save();
- } catch(IOException e) {
- MessageDialog.openError(
- getShell(),
- JFaceResources.getString("PreferenceDialog.saveErrorTitle"), //$NON-NLS-1$
- JFaceResources.format("PreferenceDialog.saveErrorMessage", new Object[] {page.getTitle(), e.getMessage()})); //$NON-NLS-1$
- }
- }
- }
- }
-}
-/**
- * Notifies that the window's close button was pressed,
- * the close menu was selected, or the ESCAPE key pressed.
- * <p>
- * The default implementation of this framework method
- * sets the window's return code to <code>CANCEL</code>
- * and closes the window using <code>close</code>.
- * Subclasses may extend or reimplement.
- * </p>
- */
-protected void handleShellCloseEvent() {
- // handle the same as pressing cancel
- cancelPressed();
-}
-/**
- * Notifies of the pressing of the Help button.
- * <p>
- * The default implementation of this framework method
- * calls <code>performHelp</code> on the currently active page.
- * </p>
- */
-protected void helpPressed() {
- if (currentPage != null) {
- currentPage.performHelp();
- }
-}
-/**
- * Returns whether the current page is valid.
- *
- * @return <code>false</code> if the current page is not valid, or
- * or <code>true</code> if the current page is valid or there is
- * no current page
-*/
-protected boolean isCurrentPageValid() {
- if (currentPage == null)
- return true;
- else
- return currentPage.isValid();
-}
-/**
- * The preference dialog implementation of this <code>Dialog</code>
- * framework method sends <code>performOk</code> to all pages of the
- * preference dialog, then calls <code>handleSave</code> on this dialog
- * to save any state, and then calls <code>close</code> to close
- * this dialog.
- */
-protected void okPressed() {
- // Notify all the pages and give them a chance to abort
- Iterator nodes = preferenceManager.getElements(PreferenceManager.PRE_ORDER).iterator();
- while (nodes.hasNext()) {
- IPreferenceNode node = (IPreferenceNode) nodes.next();
- IPreferencePage page = node.getPage();
- if (page != null) {
- if(!page.performOk())
- return;
- }
- }
-
- // Give subclasses the choice to save the state of the
- // preference pages.
- handleSave();
-
- close();
-}
-/**
- * Selects the page determined by <code>currentTreeItem</code> in
- * the page hierarchy.
- */
-private void selectCurrentPageAgain() {
- tree.setSelection(new TreeItem[] { currentTreeItem });
- currentPage.setVisible(true);
-}
-/**
- * Selects the saved item in the tree of preference pages.
- * If it cannot do this it saves the first one.
- */
-protected void selectSavedItem() {
- if (tree != null) {
- int count = tree.getItemCount();
- if (count > 0) {
- TreeItem selectedItem = getLastSelectedNode(tree.getItems());
- Object data = selectedItem.getData();
- if (data instanceof IPreferenceNode) {
- tree.setSelection(new TreeItem[] { selectedItem });
- currentTreeItem = selectedItem;
- showPage((IPreferenceNode) data);
-
- // Keep focus in tree. See bugs 2692, 2621, and 6775.
- tree.setFocus();
- }
- }
- //Now clear the selection in case of error
- clearSelectedNode();
- }
-}
-
-/**
- * Get the name of the selected item preference
- */
-protected String getSelectedNodePreference(){
- return lastPreferenceId;
-}
-
-/**
- * Get the name of the selected item preference
- */
-protected void setSelectedNodePreference(String pageId){
- lastPreferenceId = pageId;
-}
-
-
-/**
- * Get the node that was last selected in the dialog store.
- * If there is no match then return the first one,
- */
-private TreeItem getLastSelectedNode(TreeItem[] items){
- String lastSelectedNode = getSelectedNodePreference();
-
- if(lastSelectedNode == null)
- return items[0];
-
- TreeItem selectedItem = findNodeMatching(items, lastSelectedNode);
- if(selectedItem == null)
- return items[0];
- else
- return selectedItem;
-}
-
-/**
- * Find the TreeItem that has data the same id as the nodeId.
- * Search the children recursively.
- * @return TreeItem or null if not found.
- */
-private TreeItem findNodeMatching(TreeItem[] items, String nodeId){
-
- for(int i = 0; i < items.length; i++){
- Object data = items[i].getData();
- if (data instanceof IPreferenceNode) {
- if(((IPreferenceNode) data).getId().equals(nodeId))
- return items[i];
- else{
- TreeItem selectedChild = findNodeMatching(items[i].getItems(), nodeId);
- if(selectedChild != null)
- return selectedChild;
- }
- }
- }
- return null;
-}
-
-
-/**
- * Clear the last selected node. This is so that we not chache
- * the last selection in case of an error.
- */
-private void clearSelectedNode(){
- setSelectedNodePreference(null);
-}
-
-/**
- * Save the currently selected node.
- */
-private void setSelectedNode(){
-
- String storeValue = null;
-
- if(tree.getSelectionCount() == 1){
- TreeItem currentSelection = tree.getSelection()[0];
- Object data = currentSelection.getData();
- if(currentSelection.getData() instanceof IPreferenceNode)
- storeValue = ((IPreferenceNode) data).getId();
- }
-
- setSelectedNodePreference(storeValue);
-}
-
-/**
- * Display the given error message. The currently displayed message
- * is saved and will be redisplayed when the error message is set
- * to <code>null</code>.
- *
- * @param errorMessage the errorMessage to display or <code>null</code>
- */
-public void setErrorMessage(String newErrorMessage) {
- // Any change?
- if (errorMessage == null ? newErrorMessage == null : errorMessage.equals(newErrorMessage))
- return;
-
- errorMessage = newErrorMessage;
- if (errorMessage == null) {
- if (showingError) {
- // we were previously showing an error
- showingError = false;
- messageLabel.setBackground(normalMsgAreaBackground);
- messageLabel.setImage(null);
- titleImage.setImage(JFaceResources.getImage(PREF_DLG_TITLE_IMG));
- }
-
- // avoid calling setMessage in case it is overridden to call setErrorMessage,
- // which would result in a recursive infinite loop
- if (message == null) //this should probably never happen since setMessage does this conversion....
- message = ""; //$NON-NLS-1$
- messageLabel.setText(message);
- messageLabel.setImage(messageImage);
- messageLabel.setToolTipText(message);
- } else {
- messageLabel.setText(errorMessage);
- messageLabel.setToolTipText(errorMessage);
- if (!showingError) {
- // we were not previously showing an error
- showingError = true;
-
- // lazy initialize the error background color and image
- if (errorMsgAreaBackground == null) {
- errorMsgAreaBackground = JFaceColors.getErrorBackground(messageLabel.getDisplay());
- errorMsgImage = JFaceResources.getImage(PREF_DLG_IMG_TITLE_ERROR);
- }
-
- // show the error
- normalMsgAreaBackground = messageLabel.getBackground();
- messageLabel.setBackground(errorMsgAreaBackground);
- messageLabel.setImage(errorMsgImage);
- titleImage.setImage(null);
- }
- }
- titleArea.layout(true);
-}
-/**
- * Sets whether a Help button is available for this dialog.
- * <p>
- * Clients must call this framework method before the dialog's control
- * has been created.
- * <p>
- *
- * @param b <code>true</code> to include a Help button,
- * and <code>false</code> to not include one (the default)
- */
-public void setHelpAvailable(boolean b) {
- isHelpAvailable = b;
-}
-/**
- * Set the message text. If the message line currently displays an error,
- * the message is stored and will be shown after a call to clearErrorMessage
- * <p>
- * Shortcut for <code>setMessage(newMessage, NONE)</code>
- * </p>
- *
- * @param newMessage the message, or <code>null</code> to clear
- * the message
- */
-public void setMessage(String newMessage) {
- setMessage(newMessage, IMessageProvider.NONE);
-}
-/**
- * Sets the message for this dialog 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>.
- * </p>
- * <p>
- * Note that for backward compatibility, a message of type <code>ERROR</code>
- * is different than an error message (set using <code>setErrorMessage</code>).
- * An error message overrides the current message until the error message is
- * cleared. This method replaces the current message and does not affect the
- * error message.
- * </p>
- *
- * @param newMessage the message, or <code>null</code> to clear
- * the message
- * @param newType the message type
- * @since 2.0
- */
-public void setMessage(String newMessage, int newType) {
- Image newImage = null;
-
- if (newMessage != null) {
- switch (newType) {
- case IMessageProvider.NONE :
- break;
- case IMessageProvider.INFORMATION :
- newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_INFO);
- break;
- case IMessageProvider.WARNING :
- newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_WARNING);
- break;
- case IMessageProvider.ERROR :
- newImage = JFaceResources.getImage(DLG_IMG_MESSAGE_ERROR);
- break;
- }
- }
-
- showMessage(newMessage, newImage);
-}
-/**
- * Sets the minimum page size.
- *
- * @param minWidth the minimum page width
- * @param minHeight the minimum page height
- * @see #setMinimumPageSize(org.eclipse.swt.graphics.Point)
- */
-public void setMinimumPageSize(int minWidth, int minHeight) {
- minimumPageSize.x = minWidth;
- minimumPageSize.y = minHeight;
-}
-/**
- * Sets the minimum page size.
- *
- * @param size the page size encoded as
- * <code>new Point(width,height)</code>
- * @see #setMinimumPageSize(int,int)
- */
-public void setMinimumPageSize(Point size) {
- minimumPageSize.x = size.x;
- minimumPageSize.y = size.y;
-}
-/**
- * Sets the preference store for this preference dialog.
- *
- * @param store the preference store
- * @see #getPreferenceStore
- */
-public void setPreferenceStore(IPreferenceStore store) {
- Assert.isNotNull(store);
- preferenceStore = store;
-}
-/**
- * Changes the shell size to the given size, ensuring that
- * it is no larger than the display bounds.
- *
- * @param width the shell width
- * @param height the shell height
- */
-private void setShellSize(int width, int height) {
- getShell().setSize(width, height);
- constrainShellSize();
-}
-/**
- * Show the new message
- */
-private void showMessage(String newMessage, Image newImage) {
- // Any change?
- if (message.equals(newMessage) && messageImage == newImage)
- return;
-
- message = newMessage;
- if (message == null)
- message = "";//$NON-NLS-1$
- messageImage = newImage;
-
- if (!showingError) {
- // we are not showing an error
- messageLabel.setText(message);
- messageLabel.setImage(messageImage);
- messageLabel.setToolTipText(message);
- }
-}
-/**
- * Shows the preference page corresponding to the given preference node.
- * Does nothing if that page is already current.
- *
- * @param node the preference node, or <code>null</code> if none
- * @return <code>true</code> if the page flip was successful, and
- * <code>false</code> is unsuccessful
- */
-protected boolean showPage(IPreferenceNode node) {
- if (node == null)
- return false;
-
- // Create the page if nessessary
- if (node.getPage() == null)
- node.createPage();
-
- if (node.getPage() == null)
- return false;
-
- IPreferencePage newPage = node.getPage();
- if (newPage == currentPage)
- return true;
-
- if (currentPage != null) {
- if (!currentPage.okToLeave())
- return false;
- };
-
- IPreferencePage oldPage = currentPage;
- currentPage = newPage;
-
- // Set the new page's container
- currentPage.setContainer(this);
-
- // Ensure that the page control has been created
- // (this allows lazy page control creation)
- if (currentPage.getControl() == null) {
- currentPage.createControl(pageContainer);
- // the page is responsible for ensuring the created control is accessable
- // via getControl.
- Assert.isNotNull(currentPage.getControl());
- }
-
- // Force calculation of the page's description label because
- // label can be wrapped.
- Point contentSize = currentPage.computeSize();
- // Do we need resizing. Computation not needed if the
- // first page is inserted since computing the dialog's
- // size is done by calling dialog.open().
- // Also prevent auto resize if the user has manually resized
- Shell shell= getShell();
- Point shellSize= shell.getSize();
- if (oldPage != null) {
- Rectangle rect= pageContainer.getClientArea();
- Point containerSize= new Point(rect.width, rect.height);
- int hdiff= contentSize.x - containerSize.x;
- int vdiff= contentSize.y - containerSize.y;
-
- if (hdiff > 0 || vdiff > 0) {
- if (shellSize.equals(lastShellSize)) {
- hdiff= Math.max(0, hdiff);
- vdiff= Math.max(0, vdiff);
- setShellSize(shellSize.x + hdiff, shellSize.y + vdiff);
- lastShellSize = shell.getSize();
- } else {
- currentPage.setSize(containerSize);
- }
- } else if (hdiff < 0 || vdiff < 0) {
- currentPage.setSize(containerSize);
- }
-
- }
-
- // Ensure that all other pages are invisible
- // (including ones that triggered an exception during
- // their creation).
- Control[] children = pageContainer.getChildren();
- Control currentControl = currentPage.getControl();
- for (int i = 0; i < children.length; i++) {
- if (children[i] != currentControl)
- children[i].setVisible(false);
- }
-
- // Make the new page visible
- currentPage.setVisible(true);
- if (oldPage != null)
- oldPage.setVisible(false);
-
- // update the dialog controls
- update();
-
- return true;
-}
-/**
- * Shows the "Page Flipping abort" dialog.
- */
-private void showPageFlippingAbortDialog() {
- MessageDialog.
- openError(
- getShell(),
- JFaceResources.getString("AbortPageFlippingDialog.title"),
- JFaceResources.getString("AbortPageFlippingDialog.message"));
-}
-/**
- * Updates this dialog's controls to reflect the current page.
- */
-protected void update(){
- // Update the title bar
- updateTitle();
-
- // Update the message line
- updateMessage();
-
- // Update the buttons
- updateButtons();
-
- //Saved the selected node in the preferences
- setSelectedNode();
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceContainer
- */
-public void updateButtons() {
- okButton.setEnabled(isCurrentPageValid());
-}
-/* (non-Javadoc)
- * Method declared on IPreferencePageContainer.
- */
-public void updateMessage() {
- String pageMessage = currentPage.getMessage();
- int pageMessageType = IMessageProvider.NONE;
- if (pageMessage != null && currentPage instanceof IMessageProvider)
- pageMessageType = ((IMessageProvider)currentPage).getMessageType();
-
- String pageErrorMessage = currentPage.getErrorMessage();
-
- // Adjust the font
- if (pageMessage == null && pageErrorMessage == null)
- messageLabel.setFont(JFaceResources.getBannerFont());
- else
- messageLabel.setFont(JFaceResources.getDialogFont());
-
- // Set the message and error message
- if (pageMessage == null) {
- setMessage(currentPage.getTitle());
- } else {
- setMessage(pageMessage, pageMessageType);
- }
- setErrorMessage(pageErrorMessage);
-}
-/* (non-Javadoc)
- * Method declared on IPreferencePageContainer.
- */
-public void updateTitle() {
- updateMessage();
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceManager.java
deleted file mode 100644
index b0befb7..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceManager.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import java.util.*;
-/**
- * A preference manager maintains a hierarchy of preference nodes and
- * associated preference pages.
- */
-public class PreferenceManager {
- /**
- * Pre-order traversal means visit the root first,
- * then the children.
- */
- public static final int PRE_ORDER = 0;
-
- /**
- * Post-order means visit the children, and then the root.
- */
- public static final int POST_ORDER = 1;
-
- /**
- * The root node.
- * Note that the root node is a special internal node
- * that is used to collect together all the nodes that
- * have no parent; it is not given out to clients.
- */
- PreferenceNode root = new PreferenceNode("");//$NON-NLS-1$
-
- /**
- * The path separator character.
- */
- String separator;
-/**
- * Creates a new preference manager.
- */
-public PreferenceManager() {
- this('.');
-}
-/**
- * Creates a new preference manager with the given
- * the path separator.
- *
- * @param separatorChar the separator character
- */
-public PreferenceManager(char separatorChar) {
- separator = new String(new char[] { separatorChar });
-}
-/**
- * Adds the given preference node as a subnode of the
- * node at the given path.
- *
- * @param path the path
- * @param node the node to add
- * @return <code>true</code> if the add was successful,
- * and <code>false</code> if there is no contribution at
- * the given path
- */
-public boolean addTo(String path, IPreferenceNode node) {
- IPreferenceNode target = find(path);
- if (target == null)
- return false;
- target.add(node);
- return true;
-}
-/**
- * Adds the given preference node as a subnode of the
- * root.
- *
- * @param node the node to add, which must implement
- * <code>IPreferenceNode</code>
- */
-public void addToRoot(IPreferenceNode node) {
- Assert.isNotNull(node);
- root.add(node);
-}
-/**
- * Recursively enumerates all nodes at or below the given node
- * and adds them to the given list in the given order.
- *
- * @param node the starting node
- * @param sequence a read-write list of preference nodes
- * (element type: <code>IPreferenceNode</code>)
- * in the given order
- * @param order the traversal order, one of
- * <code>PRE_ORDER</code> and <code>POST_ORDER</code>
- */
-protected void buildSequence(IPreferenceNode node, List sequence, int order) {
- if (order == PRE_ORDER)
- sequence.add(node);
- IPreferenceNode[] subnodes = node.getSubNodes();
- for (int i = 0; i < subnodes.length; i++){
- buildSequence(subnodes[i], sequence, order);
- }
- if (order == POST_ORDER)
- sequence.add(node);
-}
-/**
- * Finds and returns the contribution node at the given path.
- *
- * @param path the path
- * @return the node, or <code>null</code> if none
- */
-public IPreferenceNode find(String path) {
- Assert.isNotNull(path);
- StringTokenizer stok = new StringTokenizer(path, separator);
- IPreferenceNode node = root;
- while (stok.hasMoreTokens()) {
- String id = stok.nextToken();
- node = node.findSubNode(id);
- if (node == null)
- return null;
- }
- if (node == root)
- return null;
- return node;
-}
-/**
- * Returns all preference nodes managed by this
- * manager.
- *
- * @param order the traversal order, one of
- * <code>PRE_ORDER</code> and <code>POST_ORDER</code>
- * @return a list of preference nodes
- * (element type: <code>IPreferenceNode</code>)
- * in the given order
- */
-public List getElements(int order) {
- Assert.isTrue(
- order == PRE_ORDER || order == POST_ORDER,
- "invalid traversal order");//$NON-NLS-1$
- ArrayList sequence = new ArrayList();
- IPreferenceNode[] subnodes = getRoot().getSubNodes();
- for (int i = 0; i < subnodes.length; i++)
- buildSequence(subnodes[i], sequence, order);
- return sequence;
-}
-/**
- * Returns the root node.
- * Note that the root node is a special internal node
- * that is used to collect together all the nodes that
- * have no parent; it is not given out to clients.
- *
- * @return the root node
- */
-protected IPreferenceNode getRoot() {
- return root;
-}
-/**
- * Removes the prefernece node at the given path.
- *
- * @param path the path
- * @return the node that was removed, or <code>null</code>
- * if there was no node at the given path
- */
-public IPreferenceNode remove(String path) {
- Assert.isNotNull(path);
- int index = path.lastIndexOf(separator);
- if (index == -1)
- return root.remove(path);
- // Make sure that the last character in the string isn't the "."
- Assert.isTrue(index < path.length() - 1, "Path can not end with a dot");//$NON-NLS-1$
- String parentPath = path.substring(0, index);
- String id = path.substring(index + 1);
- IPreferenceNode parentNode = find(parentPath);
- if (parentNode == null)
- return null;
- return parentNode.remove(id);
-}
-/**
- * Removes the given prefreence node if it is managed by
- * this contribution manager.
- *
- * @param node the node to remove
- * @return <code>true</code> if the node was removed,
- * and <code>false</code> otherwise
- */
-public boolean remove(IPreferenceNode node) {
- Assert.isNotNull(node);
-
- return root.remove(node);
-}
-/**
- * Removes all contribution nodes known to this manager.
- */
-public void removeAll() {
- root = new PreferenceNode("");//$NON-NLS-1$
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceNode.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceNode.java
deleted file mode 100644
index 6000f79..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceNode.java
+++ /dev/null
@@ -1,250 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import java.util.*;
-
-/**
- * A concrete implementation of a node in a preference dialog tree.
- * This class also supports lazy creation of the node's preference page.
-*/
-public class PreferenceNode implements IPreferenceNode {
-
- /**
- * Preference page, or <code>null</code> if not yet loaded.
- */
- private IPreferencePage page;
- /**
- * The list of subnodes (immediate children) of this node
- * (element type: <code>IPreferenceNode</code>).
- */
- private List subNodes;
-
- /**
- * Name of class that implements <code>IPreferenceNode</code>,
- * or <code>null</code> if none.
- */
- private String classname;
- /**
- * The id of this node.
- */
- private String id;
-
-
- /**
- * Text label for this node.
- * Note that this field is only used prior to
- * the creation of the preference page.
- */
- private String label;
-
- /**
- * Image descriptor for this node, or <code>null</code> if none.
- */
- private ImageDescriptor imageDescriptor;
-
- /**
- * Cached image, or <code>null</code> if none.
- */
- private Image image;
-/**
- * Creates a new preference node with the given id. The
- * new node has no subnodes.
- *
- * @param id the node id
- */
-public PreferenceNode(String id) {
- Assert.isNotNull(id);
- this.id = id;
-}
-/**
- * Creates a preference node with the given id, label, and image, and
- * lazily-loaded preference page.
- * The preference node assumes (sole) responsibility for disposing of the
- * image; this will happen when the node is disposed.
- *
- * @param id the node id
- * @param label the label used to display the node in the preference dialog's tree
- * @param image the image displayed left of the label in the preference dialog's tree,
- * or <code>null</code> if none
- * @param className the class name of the preference page; this class must
- * implement <code>IPreferencePage</code>
- */
-public PreferenceNode(
- String id,
- String label,
- ImageDescriptor image,
- String className) {
-
- this(id);
-
- this.imageDescriptor = image;
-
- Assert.isNotNull(label);
- this.label = label;
-
- this.classname = className;
-}
-/**
- * Creates a preference node with the given id and preference page.
- * The title of the preference page is used for the node label.
- * The node will not have an image.
- *
- * @param id the node id
- * @param page the preference page
- */
-public PreferenceNode(String id, IPreferencePage preferencePage) {
- this(id);
- Assert.isNotNull(preferencePage);
- page = preferencePage;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceNode.
- */
-public void add(IPreferenceNode node) {
- if (subNodes == null)
- subNodes = new ArrayList();
- subNodes.add(node);
-}
-/**
- * Creates a new instance of the given class <code>className</code>.
- * @returns new Object or <code>null</code> in case of failures.
- */
-private Object createObject(String className) {
-
- Assert.isNotNull(className);
-
- try {
- Class cl = Class.forName(className);
-
- if (cl != null)
- return cl.newInstance();
- }
- catch (ClassNotFoundException e) {
- return null;
- }
- catch (InstantiationException e) {
- return null;
- }
- catch (IllegalAccessException e) {
- return null;
- }
- catch (NoSuchMethodError e) {
- return null;
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceNode.
- */
-public void createPage() {
- page = (IPreferencePage)createObject(classname);
- if (getLabelImage() != null)
- page.setImageDescriptor(imageDescriptor);
- page.setTitle(label);
-}
-/** (non-Javadoc)
- * Method declared on IPreferenceNode.
- */
-public void disposeResources() {
- if (image != null) {
- image.dispose();
- image = null;
- }
- if (page != null) {
- page.dispose();
- page = null;
- }
-}
-/* (non-Javadoc)
- * Method declared on IContributionNode.
- */
-public IPreferenceNode findSubNode(String id) {
- Assert.isNotNull(id);
- Assert.isTrue(id.length() > 0);
-
- if (subNodes == null)
- return null;
- int size = subNodes.size();
- for (int i = 0; i < size; i++) {
- IPreferenceNode node = (IPreferenceNode) subNodes.get(i);
- if (id.equals(node.getId()))
- return node;
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceNode.
- */
-public String getId() {
- return this.id;
-}
-/**
- * Returns the image descriptor for this node.
- *
- * @return the image descriptor
- */
-protected ImageDescriptor getImageDescriptor() {
- return imageDescriptor;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceNode.
- */
-public Image getLabelImage() {
- if (image == null && imageDescriptor != null) {
- image = imageDescriptor.createImage();
- }
- return image;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceNode.
- */
-public String getLabelText() {
- if (page != null)
- return page.getTitle();
- return label;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceNode.
- */
-public IPreferencePage getPage() {
- return page;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceNode.
- */
-public IPreferenceNode[] getSubNodes() {
- if (subNodes == null)
- return new IPreferenceNode[0];
-
- return (IPreferenceNode[])subNodes.toArray(new IPreferenceNode[subNodes.size()]);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceNode.
- */
-public IPreferenceNode remove(String id) {
- IPreferenceNode node = findSubNode(id);
- if (node != null)
- remove(node);
- return node;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceNode.
- */
-public boolean remove(IPreferenceNode node) {
- if (subNodes == null)
- return false;
- return subNodes.remove(node);
-}
-/**
- * Method declared on IPreferenceNode.
- */
-public void setPage(IPreferencePage newPage) {
- page = newPage;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferencePage.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferencePage.java
deleted file mode 100644
index a181408..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferencePage.java
+++ /dev/null
@@ -1,505 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Abstract base implementation for all preference page implementations.
- * <p>
- * Subclasses must implement the <code>createControl</code> framework
- * method to supply the page's main control.
- * </p>
- * <p>
- * Subclasses should extend the <code>doComputeSize</code> framework
- * method to 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.
- * </p>
- * <p>
- * Subclasses may call the <code>noDefaultAndApplyButton</code> framework
- * method before the page's control has been created to suppress
- * the standard Apply and Defaults buttons.
- * </p>
- */
-public abstract class PreferencePage extends DialogPage implements IPreferencePage {
-
- /**
- * Preference store, or <code>null</code>.
- */
- private IPreferenceStore preferenceStore;
-
- /**
- * Valid state for this page; <code>true</code> by default.
- *
- * @see #isValid
- */
- private boolean isValid = true;
-
- /**
- * Body of page.
- */
- private Control body;
-
- /**
- * Whether this page has the standard Apply and Defaults buttons;
- * <code>true</code> by default.
- *
- * @see #noDefaultAndApplyButton
- */
- private boolean createDefaultAndApplyButton = true;
-
- /**
- * Standard Defaults button, or <code>null</code> if none.
- * This button has id <code>DEFAULTS_ID</code>.
- */
- private Button defaultsButton = null;
- /**
- * The container this preference page belongs to; <code>null</code>
- * if none.
- */
- private IPreferencePageContainer container = null;
-
- /**
- * Standard Apply button, or <code>null</code> if none.
- * This button has id <code>APPLY_ID</code>.
- */
- private Button applyButton = null;
-
- /**
- * Description label.
- *
- * @see #createDescriptionLabel.
- */
- private Label descriptionLabel;
-
- /**
- * Caches size of page.
- */
- private Point size = null;
-
-/**
- * Creates a new preference page with an empty title and no image.
- */
-protected PreferencePage() {
- this("");//$NON-NLS-1$
-}
-/**
- * Creates a new preference page with the given title and no image.
- *
- * @param title the title of this preference page
- */
-protected PreferencePage(String title) {
- super(title);
-}
-/**
- * Creates a new abstract preference page with the given title and image.
- *
- * @param title the title of this preference page
- * @param image the image for this preference page,
- * or <code>null</code> if none
- */
-protected PreferencePage(String title, ImageDescriptor image) {
- super(title, image);
-}
-/**
- * Computes the size for this page's UI control.
- * <p>
- * The default implementation of this <code>IPreferencePage</code>
- * method returns the size set by <code>setSize</code>; if no size
- * has been set, but the page has a UI control, the framework
- * method <code>doComputeSize</code> is called to compute the size.
- * </p>
- *
- * @return the size of the preference page encoded as
- * <code>new Point(width,height)</code>, or
- * <code>(0,0)</code> if the page doesn't currently have any UI component
- */
-public Point computeSize() {
- if (size != null)
- return size;
- Control control = getControl();
- if (control != null) {
- size = doComputeSize();
- return size;
- }
- return new Point(0, 0);
-}
-/**
- * Contributes additional buttons to the given composite.
- * <p>
- * The default implementation of this framework hook method does
- * nothing. Subclasses should override this method to contribute buttons
- * to this page's button bar. For each button a subclass contributes,
- * it must also increase the parent's grid layout number of columns
- * by one; that is,
- * <pre>
- * ((GridLayout) parent.getLayout()).numColumns++);
- * </pre>
- * </p>
- *
- * @param parent the button bar
- */
-protected void contributeButtons(Composite parent) {
-}
-/**
- * Creates and returns the SWT control for the customized body
- * of this preference page under the given parent composite.
- * <p>
- * This framework method must be implemented by concrete subclasses. Any
- * subclass returning a <code>Composite</code> object whose <code>Layout</code>
- * has default margins (for example, a <code>GridLayout</code>) are expected to
- * set the margins of this <code>Layout</code> to 0 pixels.
- * </p>
- *
- * @param parent the parent composite
- * @return the new control
- */
-protected abstract Control createContents(Composite parent);
-/**
- * The <code>PreferencePage</code> implementation of this
- * <code>IDialogPage</code> method creates a description label
- * and button bar for the page. It calls <code>createContents</code>
- * to create the custom contents of the page.
- * <p>
- * If a subclass that overrides this method creates a <code>Composite</code>
- * that has a layout with default margins (for example, a <code>GridLayout</code>)
- * it is expected to set the margins of this <code>Layout</code> to 0 pixels.
- */
-public void createControl(Composite parent) {
-
- GridData gd;
- Composite content= new Composite(parent, SWT.NULL);
- setControl(content);
- Font font = parent.getFont();
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- content.setLayout(layout);
- content.setFont(font);
-
- // initialize the dialog units
- initializeDialogUnits(content);
-
- descriptionLabel= createDescriptionLabel(content);
- if (descriptionLabel != null) {
- descriptionLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
-
- body = createContents(content);
- if (body != null) // null is not a valid return value but support graceful failure
- body.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Composite buttonBar= new Composite(content, SWT.NULL);
- layout= new GridLayout();
- layout.numColumns= 0;
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- buttonBar.setLayout(layout);
- gd= new GridData();
- gd.horizontalAlignment= GridData.END;
- buttonBar.setLayoutData(gd);
-
- contributeButtons(buttonBar);
-
- if (createDefaultAndApplyButton) {
- layout.numColumns= layout.numColumns + 2;
- String[] labels= JFaceResources.getStrings(new String[] {"defaults", "apply"});//$NON-NLS-2$//$NON-NLS-1$
- int heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- defaultsButton= new Button(buttonBar, SWT.PUSH);
- defaultsButton.setFont(font);
- defaultsButton.setText(labels[0]);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.heightHint = heightHint;
- data.widthHint = Math.max(widthHint, defaultsButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- defaultsButton.setLayoutData(data);
- defaultsButton.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- performDefaults();
- }
- }
- );
-
-
- applyButton= new Button(buttonBar, SWT.PUSH);
- applyButton.setFont(font);
- applyButton.setText(labels[1]);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.heightHint = heightHint;
- data.widthHint = Math.max(widthHint, applyButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- applyButton.setLayoutData(data);
- applyButton.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- performApply();
- }
- }
- );
- applyButton.setEnabled(isValid());
- }
- else {
- /* Check if there are any other buttons on the button bar.
- * If not, throw away the button bar composite. Otherwise
- * there is an unusually large button bar.
- */
- if (buttonBar.getChildren().length < 1)
- buttonBar.dispose();
- }
-}
-/**
- * Creates and returns an SWT label under the given composite.
- *
- * @param parent the parent composite
- * @return the new label
- */
-protected Label createDescriptionLabel(Composite parent) {
- Label result = null;
- String description = getDescription();
- if (description != null) {
- result = new Label(parent, SWT.WRAP);
- result.setFont(parent.getFont());
- result.setText(description);
- }
- return result;
-}
-/**
- * Computes the size needed by this page's UI control.
- * <p>
- * All pages should override this method and set the appropriate sizes
- * of their widgets, and then call <code>super.doComputeSize</code>.
- * </p>
- *
- * @return the size of the preference page encoded as
- * <code>new Point(width,height)</code>
- */
-protected Point doComputeSize() {
- if (descriptionLabel != null && body != null) {
- Point size = body.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- GridData gd = (GridData) descriptionLabel.getLayoutData();
- gd.widthHint = size.x;
- descriptionLabel.getParent().layout(true);
- }
- return getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
-}
-/**
- * Returns the preference store of this preference page.
- * <p>
- * This is a framework hook method for subclasses to return a
- * page-specific preference store. The default implementation
- * returns <code>null</code>.
- * </p>
- *
- * @return the preference store, or <code>null</code> if none
- */
-protected IPreferenceStore doGetPreferenceStore() {
- return null;
-}
-/**
- * Returns the container of this page.
- *
- * @return the preference page container, or <code>null</code> if this
- * page has yet to be added to a container
- */
-public IPreferencePageContainer getContainer() {
- return (IPreferencePageContainer)container;
-}
-/**
- * Returns the preference store of this preference page.
- *
- * @return the preference store , or <code>null</code> if none
- */
-public IPreferenceStore getPreferenceStore() {
- if (preferenceStore == null)
- preferenceStore = doGetPreferenceStore();
- if (preferenceStore != null)
- return preferenceStore;
- else
- if (container != null)
- return container.getPreferenceStore();
- return null;
-}
-/**
- * The preference page implementation of an <code>IPreferencePage</code>
- * method returns whether this preference page is valid. Preference
- * pages are considered valid by default; call <code>setValid(false)</code>
- * to make a page invalid.
- */
-public boolean isValid() {
- return isValid;
-}
-/**
- * Suppresses creation of the standard Default and Apply buttons
- * for this page.
- * <p>
- * Subclasses wishing a preference page wihthout these buttons
- * should call this framework method before the page's control
- * has been created.
- * </p>
- */
-protected void noDefaultAndApplyButton() {
- createDefaultAndApplyButton = false;
-}
-/**
- * The <code>PreferencePage</code> implementation of this
- * <code>IPreferencePage</code> method returns <code>true</code>
- * if the page is valid.
- */
-public boolean okToLeave() {
- return isValid();
-}
-/**
- * Performs special processing when this page's Apply button has been pressed.
- * <p>
- * This is a framework hook method for sublcasses to do special things when
- * the Apply button has been pressed.
- * The default implementation of this framework method simply calls
- * <code>performOk</code> to simulate the pressing of the page's OK button.
- * </p>
- *
- * @see #performOk
- */
-protected void performApply() {
- performOk();
-}
-/**
- * The preference page implementation of an <code>IPreferencePage</code>
- * method performs special processing when this page's Cancel button has
- * been pressed.
- * <p>
- * This is a framework hook method for sublcasses to do special things when
- * the Cancel button has been pressed. The default implementation of this
- * framework method does nothing and returns <code>true</code>.
- */
-public boolean performCancel() {
- return true;
-}
-/**
- * Performs special processing when this page's Defaults button has been pressed.
- * <p>
- * This is a framework hook method for sublcasses 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() {
- updateApplyButton();
-}
-/**
- * Method declared on IPreferencePage.
- * Subclasses should override
- */
-public boolean performOk() {
- return true;
-}
-/** (non-Javadoc)
- * Method declared on IPreferencePage.
- */
-public void setContainer(IPreferencePageContainer container) {
- this.container = container;
-}
-/**
- * The <code>PreferencePage</code> implementation of this method
- * declared on <code>DialogPage</code> updates the container.
- */
-public void setErrorMessage(String newMessage) {
- super.setErrorMessage(newMessage);
- if (getContainer() != null) {
- getContainer().updateMessage();
- }
-}
-/**
- * The <code>PreferencePage</code> implementation of this method
- * declared on <code>DialogPage</code> updates the container.
- */
-public void setMessage(String newMessage, int newType) {
- super.setMessage(newMessage, newType);
- if (getContainer() != null) {
- getContainer().updateMessage();
- }
-}
-/**
- * Sets the preference store for this preference page.
- * <p>
- * If preferenceStore is set to null, getPreferenceStore
- * will invoke doGetPreferenceStore the next time it is called.
- * </p>
- *
- * @param store the preference store, or <code>null</code>
- * @see #getPreferenceStore
- */
-public void setPreferenceStore(IPreferenceStore store) {
- preferenceStore = store;
-}
-/* (non-Javadoc)
- * Method declared on IPreferencePage.
- */
-public void setSize(Point uiSize) {
- Control control = getControl();
- if (control != null) {
- control.setSize(uiSize);
- size = uiSize;
- }
-}
-/**
- * The <code>PreferencePage</code> implementation of this <code>IDialogPage</code>
- * method extends the <code>DialogPage</code> implementation to update
- * the preference page container title. Subclasses may extend.
- */
-public void setTitle(String title) {
- super.setTitle(title);
- if (getContainer() != null)
- getContainer().updateTitle();
-}
-/**
- * Sets whether this page is valid.
- * The enable state of the container buttons and the
- * apply button is updated when a page's valid state
- * changes.
- * <p>
- *
- * @param b the new valid state
- */
-public void setValid(boolean b) {
- boolean oldValue = isValid;
- isValid = b;
- if (oldValue != isValid) {
- // update container state
- getContainer().updateButtons();
- // update page state
- updateApplyButton();
- }
-}
-/**
- * Returns a string suitable for debugging purpose only.
- */
-public String toString() {
- return getTitle();
-}
-/**
- * Updates the enabled state of the Apply button to reflect whether
- * this page is valid.
- */
-protected void updateApplyButton() {
- if (applyButton != null)
- applyButton.setEnabled(isValid());
-}
-
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceStore.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceStore.java
deleted file mode 100644
index 2391048..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceStore.java
+++ /dev/null
@@ -1,550 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.*;
-
-/**
- * A concrete preference store implementation based on an internal
- * <code>java.util.Properties</code> object, with support for
- * persisting the non-default preference values to files or streams.
- * <p>
- * This class was not designed to be subclassed.
- * </p>
- *
- * @see IPreferenceStore
- */
-public class PreferenceStore implements IPreferenceStore {
-
- /**
- * List of registered listeners (element type: <code>IPropertyChangeListener</code>).
- * These listeners are to be informed when the current value of a preference changes.
- */
- private ListenerList listeners = new ListenerList();
-
- /**
- * The mapping from preference name to
- * preference value (represented as strings).
- */
- private Properties properties;
-
- /**
- * The mapping from preference name to
- * default preference value (represented as strings);
- * <code>null</code> if none.
- */
- private Properties defaultProperties;
-
- /**
- * Indicates whether a value as been changed by <code>setToDefault</code>
- * or <code>setValue</code>; initially <code>false</code>.
- */
- private boolean dirty = false;
-
- /**
- * The file name used by the <code>load</code> method to load a property
- * file. This filename is used to save the properties file when <code>save</code>
- * is called.
- */
- private String filename;
-/**
- * Creates an empty preference store.
- * <p>
- * Use the methods <code>load(InputStream)</code> and
- * <code>save(InputStream)</code> to load and store this
- * preference store.
- * </p>
- * @see #load(java.io.InputStream)
- * @see #save(java.io.OutputStream)
- */
-public PreferenceStore() {
- defaultProperties = new Properties();
- properties = new Properties(defaultProperties);
-}
-/**
- * Creates an empty preference store that loads from and saves to the
- * a file.
- * <p>
- * Use the methods <code>load()</code> and <code>save()</code> to load and store this
- * preference store.
- * </p>
- *
- * @param filename the file name
- * @see #load()
- * @see #save()
- */
-public PreferenceStore(String filename) {
- this();
- Assert.isNotNull(filename);
- this.filename = filename;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void addPropertyChangeListener(IPropertyChangeListener listener) {
- listeners.add(listener);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public boolean contains(String name) {
- return (properties.containsKey(name) || defaultProperties.containsKey(name));
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void firePropertyChangeEvent(String name, Object oldValue, Object newValue) {
- final Object[] listeners = this.listeners.getListeners();
- // Do we need to fire an event.
- if (listeners.length > 0 && (oldValue == null || !oldValue.equals(newValue))) {
- final PropertyChangeEvent pe = new PropertyChangeEvent(this, name, oldValue, newValue);
-
-// FIXME: need to do this without dependency on org.eclipse.core.runtime
-// Platform.run(new SafeRunnable(JFaceResources.getString("PreferenceStore.changeError")) { //$NON-NLS-1$
-// public void run() {
- for (int i = 0; i < listeners.length; ++i) {
- IPropertyChangeListener l = (IPropertyChangeListener) listeners[i];
- l.propertyChange(pe);
- }
-// }
-// });
- }
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public boolean getBoolean(String name) {
- return getBoolean(properties, name);
-}
-/**
- * Helper function: gets boolean for a given name.
- */
-private boolean getBoolean(Properties p, String name) {
- String value = p != null ? p.getProperty(name) : null;
- if (value == null)
- return BOOLEAN_DEFAULT_DEFAULT;
- if (value.equals(IPreferenceStore.TRUE))
- return true;
- return false;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public boolean getDefaultBoolean(String name) {
- return getBoolean(defaultProperties, name);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public double getDefaultDouble(String name) {
- return getDouble(defaultProperties, name);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public float getDefaultFloat(String name) {
- return getFloat(defaultProperties, name);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public int getDefaultInt(String name) {
- return getInt(defaultProperties, name);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public long getDefaultLong(String name) {
- return getLong(defaultProperties, name);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public String getDefaultString(String name) {
- return getString(defaultProperties, name);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public double getDouble(String name) {
- return getDouble(properties, name);
-}
-/**
- * Helper function: gets double for a given name.
- */
-private double getDouble(Properties p, String name) {
- String value = p != null ? p.getProperty(name) : null;
- if (value == null)
- return DOUBLE_DEFAULT_DEFAULT;
- double ival = DOUBLE_DEFAULT_DEFAULT;
- try {
- ival = new Double(value).doubleValue();
- } catch (NumberFormatException e) {
- }
- return ival;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public float getFloat(String name) {
- return getFloat(properties, name);
-}
-/**
- * Helper function: gets float for a given name.
- */
-private float getFloat(Properties p, String name) {
- String value = p != null ? p.getProperty(name) : null;
- if (value == null)
- return FLOAT_DEFAULT_DEFAULT;
- float ival = FLOAT_DEFAULT_DEFAULT;
- try {
- ival = new Float(value).floatValue();
- } catch (NumberFormatException e) {
- }
- return ival;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public int getInt(String name) {
- return getInt(properties, name);
-}
-/**
- * Helper function: gets int for a given name.
- */
-private int getInt(Properties p, String name) {
- String value = p != null ? p.getProperty(name) : null;
- if (value == null)
- return INT_DEFAULT_DEFAULT;
- int ival = 0;
- try {
- ival = Integer.parseInt(value);
- } catch (NumberFormatException e) {
- }
- return ival;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public long getLong(String name) {
- return getLong(properties, name);
-}
-/**
- * Helper function: gets long for a given name.
- */
-private long getLong(Properties p, String name) {
- String value = p != null ? p.getProperty(name) : null;
- if (value == null)
- return LONG_DEFAULT_DEFAULT;
- long ival = LONG_DEFAULT_DEFAULT;
- try {
- ival = Long.parseLong(value);
- } catch (NumberFormatException e) {
- }
- return ival;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public String getString(String name) {
- return getString(properties, name);
-}
-/**
- * Helper function: gets string for a given name.
- */
-private String getString(Properties p, String name) {
- String value = p != null ? p.getProperty(name) : null;
- if (value == null)
- return STRING_DEFAULT_DEFAULT;
- return value;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public boolean isDefault(String name) {
- return (!properties.containsKey(name) && defaultProperties.containsKey(name));
-}
-/**
- * Prints the contents of this preference store to the given print stream.
- *
- * @param out the print stream
- */
-public void list(PrintStream out) {
- properties.list(out);
-}
-/**
- * Prints the contents of this preference store to the given print writer.
- *
- * @param out the print writer
- */
-public void list(PrintWriter out) {
- properties.list(out);
-}
-/**
- * Loads this preference store from the file established in the constructor
- * <code>PreferenceStore(java.lang.String)</code> (or by <code>setFileName</code>).
- * Default preference values are not affected.
- *
- * @exception java.io.IOException if there is a problem loading this store
- */
-public void load() throws IOException {
- if (filename == null)
- throw new IOException("File name not specified");//$NON-NLS-1$
- FileInputStream in = new FileInputStream(filename);
- load(in);
- in.close();
-}
-/**
- * Loads this preference store from the given input stream. Default preference
- * values are not affected.
- *
- * @param in the input stream
- * @exception java.io.IOException if there is a problem loading this store
- */
-public void load(InputStream in) throws IOException {
- properties.load(in);
- dirty = false;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public boolean needsSaving() {
- return dirty;
-}
-/**
- * Returns an enumeration of all preferences known to this store which
- * have current values other than their default value.
- *
- * @return an array of preference names
- */
-public String[] preferenceNames() {
- ArrayList list = new ArrayList();
- Enumeration enum = properties.propertyNames();
- while (enum.hasMoreElements()) {
- list.add(enum.nextElement());
- }
- return (String[])list.toArray(new String[list.size()]);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void putValue(String name, String value) {
- String oldValue = getString(name);
- if (oldValue == null || !oldValue.equals(value)) {
- setValue(properties, name, value);
- dirty = true;
- }
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void removePropertyChangeListener(IPropertyChangeListener listener) {
- listeners.remove(listener);
-}
-/**
- * Saves the non-default-valued preferences known to this preference
- * store to the file from which they were originally loaded.
- *
- * @exception java.io.IOException if there is a problem saving this store
- */
-public void save() throws IOException {
- if (filename == null)
- throw new IOException("File name not specified");//$NON-NLS-1$
- FileOutputStream out = null;
- try {
- out = new FileOutputStream(filename);
- save(out, null);
- } finally {
- if (out != null)
- out.close();
- }
-}
-/**
- * Saves this preference store to the given output stream. The
- * given string is inserted as header information.
- *
- * @param out the output stream
- * @param header the header
- * @exception java.io.IOException if there is a problem saving this store
- */
-public void save(OutputStream out, String header) throws IOException {
- properties.store(out, header);
- dirty = false;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void setDefault(String name, double value) {
- setValue(defaultProperties, name, value);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void setDefault(String name, float value) {
- setValue(defaultProperties, name, value);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void setDefault(String name, int value) {
- setValue(defaultProperties, name, value);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void setDefault(String name, long value) {
- setValue(defaultProperties, name, value);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void setDefault(String name, String value) {
- setValue(defaultProperties, name, value);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void setDefault(String name, boolean value) {
- setValue(defaultProperties, name, value);
-}
-/**
- * Sets the name of the file used when loading and storing this preference store.
- * <p>
- * Afterward, the methods <code>load()</code> and <code>save()</code> can be used
- * to load and store this preference store.
- * </p>
- *
- * @param filename the file name
- * @see #load()
- * @see #store()
- */
-public void setFilename(String name) {
- filename = name;
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void setToDefault(String name) {
- Object oldValue = properties.get(name);
- properties.remove(name);
- dirty = true;
- Object newValue = null;
- if (defaultProperties != null)
- newValue = defaultProperties.get(name);
- firePropertyChangeEvent(name, oldValue, newValue);
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void setValue(String name, double value) {
- double oldValue = getDouble(name);
- if (oldValue != value) {
- setValue(properties, name, value);
- dirty = true;
- firePropertyChangeEvent(name, new Double(oldValue), new Double(value));
- }
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void setValue(String name, float value) {
- float oldValue = getFloat(name);
- if (oldValue != value) {
- setValue(properties, name, value);
- dirty = true;
- firePropertyChangeEvent(name, new Float(oldValue), new Float(value));
- }
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void setValue(String name, int value) {
- int oldValue = getInt(name);
- if (oldValue != value) {
- setValue(properties, name, value);
- dirty = true;
- firePropertyChangeEvent(name, new Integer(oldValue), new Integer(value));
- }
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void setValue(String name, long value) {
- long oldValue = getLong(name);
- if (oldValue != value) {
- setValue(properties, name, value);
- dirty = true;
- firePropertyChangeEvent(name, new Long(oldValue), new Long(value));
- }
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void setValue(String name, String value) {
- String oldValue = getString(name);
- if (oldValue == null || !oldValue.equals(value)) {
- setValue(properties, name, value);
- dirty = true;
- firePropertyChangeEvent(name, oldValue, value);
- }
-}
-/* (non-Javadoc)
- * Method declared on IPreferenceStore.
- */
-public void setValue(String name, boolean value) {
- boolean oldValue = getBoolean(name);
- if (oldValue != value) {
- setValue(properties, name, value);
- dirty = true;
- firePropertyChangeEvent(name, new Boolean(oldValue), new Boolean(value));
- }
-}
-/**
- * Helper method: sets string for a given name.
- */
-private void setValue(Properties p, String name, double value) {
- Assert.isTrue(p != null);
- p.put(name, Double.toString(value));
-}
-/**
- * Helper method: sets string for a given name.
- */
-private void setValue(Properties p, String name, float value) {
- Assert.isTrue(p != null);
- p.put(name, Float.toString(value));
-}
-/**
- * Helper method: sets string for a given name.
- */
-private void setValue(Properties p, String name, int value) {
- Assert.isTrue(p != null);
- p.put(name, Integer.toString(value));
-}
-/**
- * Helper method: sets string for a given name.
- */
-private void setValue(Properties p, String name, long value) {
- Assert.isTrue(p != null);
- p.put(name, Long.toString(value));
-}
-/**
- * Helper method: sets string for a given name.
- */
-private void setValue(Properties p, String name, String value) {
- Assert.isTrue(p != null && value != null);
- p.put(name, value);
-}
-/**
- * Helper method: sets string for a given name.
- */
-private void setValue(Properties p, String name, boolean value) {
- Assert.isTrue(p != null);
- p.put(name, value == true ? IPreferenceStore.TRUE : IPreferenceStore.FALSE);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/RadioGroupFieldEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/RadioGroupFieldEditor.java
deleted file mode 100644
index e1cce46..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/RadioGroupFieldEditor.java
+++ /dev/null
@@ -1,310 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.MessageFormat;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.util.Assert;
-
-/**
- * A field editor for an enumeration type preference.
- * The choices are presented as a list of radio buttons.
- */
-public class RadioGroupFieldEditor extends FieldEditor {
-
- /**
- * List of radio button entries of the form [label,value].
- */
- private String[][] labelsAndValues;
-
- /**
- * Number of columns into which to arrange the radio buttons.
- */
- private int numColumns;
-
- /**
- * Indent used for the first column of the radion button matrix.
- */
- private int indent = HORIZONTAL_GAP;
-
- /**
- * The current value, or <code>null</code> if none.
- */
- private String value;
-
- /**
- * The box of radio buttons, or <code>null</code> if none
- * (before creation and after disposal).
- */
- private Composite radioBox;
-
- /**
- * The radio buttons, or <code>null</code> if none
- * (before creation and after disposal).
- */
- private Button[] radioButtons;
-
- /**
- * Whether to use a Group control.
- */
- private boolean useGroup;
-/**
- * Creates a new radio group field editor
- */
-protected RadioGroupFieldEditor() {
-}
-/**
- * Creates a radio group field editor.
- * This constructor does not use a <code>Group</code> to contain the radio buttons.
- * It is equivalent to using the following constructor with <code>false</code>
- * for the <code>useGroup</code> argument.
- * <p>
- * Example usage:
- * <pre>
- * RadioGroupFieldEditor editor= new RadioGroupFieldEditor(
- * "GeneralPage.DoubleClick", resName, 1,
- * new String[][] {
- * {"Open Browser", "open"},
- * {"Expand Tree", "expand"}
- * },
- * parent);
- * </pre>
- * </p>
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param numColumns the number of columns for the radio button presentation
- * @param labelAndValues list of radio button [label, value] entries;
- * the value is returned when the radio button is selected
- * @param parent the parent of the field editor's control
- */
-public RadioGroupFieldEditor(String name, String labelText, int numColumns, String[][] labelAndValues, Composite parent) {
- this(name, labelText, numColumns, labelAndValues, parent, false);
-}
-
-/**
- * Creates a radio group field editor.
- * <p>
- * Example usage:
- * <pre>
- * RadioGroupFieldEditor editor= new RadioGroupFieldEditor(
- * "GeneralPage.DoubleClick", resName, 1,
- * new String[][] {
- * {"Open Browser", "open"},
- * {"Expand Tree", "expand"}
- * },
- * parent,
- * true);
- * </pre>
- * </p>
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param numColumns the number of columns for the radio button presentation
- * @param labelAndValues list of radio button [label, value] entries;
- * the value is returned when the radio button is selected
- * @param parent the parent of the field editor's control
- * @param useGroup whether to use a Group control to contain the radio buttons
- */
-public RadioGroupFieldEditor(String name, String labelText, int numColumns, String[][] labelAndValues, Composite parent, boolean useGroup) {
- init(name, labelText);
- Assert.isTrue(checkArray(labelAndValues));
- this.labelsAndValues = labelAndValues;
- this.numColumns = numColumns;
- this.useGroup = useGroup;
- createControl(parent);
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void adjustForNumColumns(int numColumns) {
- Control control = getLabelControl();
- if (control != null) {
- ((GridData)control.getLayoutData()).horizontalSpan = numColumns;
- }
- ((GridData)radioBox.getLayoutData()).horizontalSpan = numColumns;
-}
-/**
- * Checks whether given <code>String[][]</code> is of "type"
- * <code>String[][2]</code>.
- *
- * @return <code>true</code> if it is ok, and <code>false</code> otherwise
- */
-private boolean checkArray(String[][] table) {
- if (table == null)
- return false;
- for (int i = 0; i < table.length; i++) {
- String[] array = table[i];
- if (array == null || array.length != 2)
- return false;
- }
- return true;
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doFillIntoGrid(Composite parent, int numColumns) {
- if (useGroup) {
- Control control = getRadioBoxControl(parent);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- control.setLayoutData(gd);
- }
- else {
- Control control = getLabelControl(parent);
- GridData gd = new GridData();
- gd.horizontalSpan = numColumns;
- control.setLayoutData(gd);
- control = getRadioBoxControl(parent);
- gd = new GridData();
- gd.horizontalSpan = numColumns;
- gd.horizontalIndent = indent;
- control.setLayoutData(gd);
- }
-
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doLoad() {
- updateValue(getPreferenceStore().getString(getPreferenceName()));
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doLoadDefault() {
- updateValue(getPreferenceStore().getDefaultString(getPreferenceName()));
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doStore() {
- if (value == null) {
- getPreferenceStore().setToDefault(getPreferenceName());
- return;
- }
-
- getPreferenceStore().setValue(getPreferenceName(), value);
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-public int getNumberOfControls() {
- return 1;
-}
-/**
- * Returns this field editor's radio group control.
- *
- * @return the radio group control
- */
-public Composite getRadioBoxControl(Composite parent) {
- if (radioBox == null) {
- if (useGroup) {
- Group group = new Group(parent, SWT.NONE);
- String text = getLabelText();
- if (text != null)
- group.setText(text);
- radioBox = group;
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = HORIZONTAL_GAP;
- layout.numColumns = numColumns;
- radioBox.setLayout(layout);
- }
- else {
- radioBox = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = HORIZONTAL_GAP;
- layout.numColumns = numColumns;
- radioBox.setLayout(layout);
- }
-
- radioButtons = new Button[labelsAndValues.length];
- for (int i = 0; i < labelsAndValues.length; i++) {
- Button radio = new Button(radioBox, SWT.RADIO | SWT.LEFT);
- radioButtons[i] = radio;
- String[] labelAndValue = labelsAndValues[i];
- radio.setText(labelAndValue[0]);
- radio.setData(labelAndValue[1]);
- radio.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- String oldValue = value;
- value = (String) event.widget.getData();
- setPresentsDefaultValue(false);
- fireValueChanged(VALUE, oldValue, value);
- }
- });
- }
- radioBox.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- radioBox = null;
- radioButtons = null;
- }
- });
- } else {
- checkParent(radioBox, parent);
- }
- return radioBox;
-}
-/**
- * Sets the indent used for the first column of the radion button matrix.
- *
- * @param indent the indent (in pixels)
- */
-public void setIndent(int indent) {
- if (indent < 0)
- this.indent = 0;
- else
- this.indent = indent;
-}
-
-/**
- * Select the radio button that conforms to the given value.
- *
- * @param selectedValue the selected value
- */
-private void updateValue(String selectedValue) {
- this.value = selectedValue;
- if (radioButtons == null)
- return;
-
- if (this.value != null) {
- boolean found = false;
- for (int i = 0; i < radioButtons.length; i++) {
- Button radio = radioButtons[i];
- boolean selection = false;
- if (((String) radio.getData()).equals(this.value)) {
- selection = true;
- found = true;
- }
- radio.setSelection(selection);
- }
- if (found)
- return;
- }
-
- // We weren't able to find the value. So we select the first
- // radio button as a default.
- if (radioButtons.length > 0) {
- radioButtons[0].setSelection(true);
- this.value = (String) radioButtons[0].getData();
- }
- return;
-}
-
-/*
- * @see FieldEditor.setEnabled(boolean,Composite).
- */
-public void setEnabled(boolean enabled, Composite parent){
- super.setEnabled(enabled,parent);
- for(int i = 0; i < radioButtons.length; i ++){
- radioButtons[i].setEnabled(enabled);
- }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/StringButtonFieldEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/StringButtonFieldEditor.java
deleted file mode 100644
index 5cdb33e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/StringButtonFieldEditor.java
+++ /dev/null
@@ -1,137 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.layout.GridData;
-import java.io.File;
-
-/**
- * An abstract field editor for a string type preference that presents
- * a string input field with a change button to its right to edit the
- * input field's content. When the user presses the change button, the
- * abstract framework method <code>changePressed()</code> gets called
- * to compute a new string.
- */
-public abstract class StringButtonFieldEditor extends StringFieldEditor {
-
- /**
- * The change button, or <code>null</code> if none
- * (before creation and after disposal).
- */
- private Button changeButton;
-
- /**
- * The text for the change button, or <code>null</code> if missing.
- */
- private String changeButtonText;
-/**
- * Creates a new string button field editor
- */
-protected StringButtonFieldEditor() {
-}
-/**
- * Creates a string button field editor.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
-protected StringButtonFieldEditor(String name, String labelText, Composite parent) {
- init(name, labelText);
- createControl(parent);
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void adjustForNumColumns(int numColumns) {
- ((GridData)getTextControl().getLayoutData()).horizontalSpan = numColumns - 2;
-}
-/**
- * Notifies that this field editor's change button has been pressed.
- * <p>
- * Subclasses must implement this method to provide a corresponding
- * new string for the text field. If the returned value is <code>null</code>,
- * the currently displayed value remains.
- * </p>
- *
- * @return the new string to display, or <code>null</code> to leave the
- * old string showing
- */
-protected abstract String changePressed();
-/* (non-Javadoc)
- * Method declared on StringFieldEditor (and FieldEditor).
- */
-protected void doFillIntoGrid(Composite parent, int numColumns) {
- super.doFillIntoGrid(parent, numColumns - 1);
- changeButton = getChangeControl(parent);
- GridData gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.heightHint = convertVerticalDLUsToPixels(changeButton, IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(changeButton, IDialogConstants.BUTTON_WIDTH);
- gd.widthHint = Math.max(widthHint, changeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- changeButton.setLayoutData(gd);
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected Button getChangeControl(Composite parent) {
- if (changeButton == null) {
- changeButton = new Button(parent, SWT.PUSH);
- if (changeButtonText == null)
- changeButtonText = JFaceResources.getString("openChange");//$NON-NLS-1$
- changeButton.setText(changeButtonText);
- changeButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent evt) {
- String newValue = changePressed();
- if (newValue != null) {
- setStringValue(newValue);
- }
- }
- });
- changeButton.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- changeButton = null;
- }
- });
- } else {
- checkParent(changeButton, parent);
- }
- return changeButton;
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-public int getNumberOfControls() {
- return 3;
-}
-/**
- * Returns this field editor's shell.
- *
- * @return the shell
- */
-protected Shell getShell() {
- if (changeButton == null)
- return null;
- return changeButton.getShell();
-}
-/**
- * Sets the text of the change button.
- *
- * @param text the new text
- */
-public void setChangeButtonText(String text) {
- Assert.isNotNull(text);
- changeButtonText = text;
- if (changeButton != null)
- changeButton.setText(text);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/StringFieldEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/StringFieldEditor.java
deleted file mode 100644
index 623833e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/StringFieldEditor.java
+++ /dev/null
@@ -1,476 +0,0 @@
-package org.eclipse.jface.preference;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A field editor for a string type preference.
- * <p>
- * This class may be used as is, or subclassed as required.
- * </p>
- */
-public class StringFieldEditor extends FieldEditor {
-
- /**
- * Validation strategy constant (value <code>0</code>) indicating that
- * the editor should perform validation after every key stroke.
- *
- * @see #setValidateStrategy
- */
- public static final int VALIDATE_ON_KEY_STROKE = 0;
-
- /**
- * Validation strategy constant (value <code>1</code>) indicating that
- * the editor should perform validation only when the text widget
- * loses focus.
- *
- * @see #setValidateStrategy
- */
- public static final int VALIDATE_ON_FOCUS_LOST = 1;
-
- /**
- * Text limit constant (value <code>-1</code>) indicating unlimited
- * text limit and width.
- */
- public static int UNLIMITED = -1;
-
- /**
- * Cached valid state.
- */
- private boolean isValid;
-
- /**
- * Old text value.
- */
- private String oldValue;
-
- /**
- * The text field, or <code>null</code> if none.
- */
- private Text textField;
-
- /**
- * Width of text field in characters; initially unlimited.
- */
- private int widthInChars = UNLIMITED;
-
- /**
- * Text limit of text field in characters; initially unlimited.
- */
- private int textLimit = UNLIMITED;
-
- /**
- * The error message, or <code>null</code> if none.
- */
- private String errorMessage;
-
- /**
- * Indicates whether the empty string is legal;
- * <code>true</code> by default.
- */
- private boolean emptyStringAllowed = true;
-
- /**
- * The validation strategy;
- * <code>VALIDATE_ON_KEY_STROKE</code> by default.
- */
- private int validateStrategy= VALIDATE_ON_KEY_STROKE;
-/**
- * Creates a new string field editor
- */
-protected StringFieldEditor() {
-}
-/**
- * Creates a string field editor.
- * Use the method <code>setTextLimit</code> to limit the text.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param width the width of the text input field in characters,
- * or <code>UNLIMITED</code> for no limit
- * @param strategy either <code>VALIDATE_ON_KEY_STROKE</code> to perform
- * on the fly checking (the default), or <code>VALIDATE_ON_FOCUS_LOST</code> to
- * perform validation only after the text has been typed in
- * @param parent the parent of the field editor's control
- * @since 2.0
- */
-public StringFieldEditor(String name, String labelText, int width, int strategy, Composite parent) {
- init(name, labelText);
- widthInChars = width;
- setValidateStrategy(strategy);
- isValid = false;
- errorMessage = JFaceResources.getString("StringFieldEditor.errorMessage");//$NON-NLS-1$
- createControl(parent);
-}
-/**
- * Creates a string field editor.
- * Use the method <code>setTextLimit</code> to limit the text.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param width the width of the text input field in characters,
- * or <code>UNLIMITED</code> for no limit
- * @param parent the parent of the field editor's control
- */
-public StringFieldEditor(String name, String labelText, int width, Composite parent) {
- this(name, labelText, width, VALIDATE_ON_KEY_STROKE, parent);
-}
-/**
- * Creates a string field editor of unlimited width.
- * Use the method <code>setTextLimit</code> to limit the text.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param parent the parent of the field editor's control
- */
-public StringFieldEditor(String name, String labelText, Composite parent) {
- this(name, labelText, UNLIMITED, parent);
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void adjustForNumColumns(int numColumns) {
- GridData gd = (GridData)textField.getLayoutData();
- gd.horizontalSpan = numColumns - 1;
- // We only grab excess space if we have to
- // If another field editor has more columns then
- // we assume it is setting the width.
- gd.grabExcessHorizontalSpace = gd.horizontalSpan == 1;
-}
-/**
- * Checks whether the text input field contains a valid value or not.
- *
- * @return <code>true</code> if the field value is valid,
- * and <code>false</code> if invalid
- */
-protected boolean checkState() {
- boolean result = false;
- if (emptyStringAllowed)
- result = true;
-
- if (textField == null)
- result = false;
-
- String txt = textField.getText();
-
- if (txt == null)
- result = false;
-
- result = (txt.trim().length() > 0) || emptyStringAllowed;
-
- // call hook for subclasses
- result = result && doCheckState();
-
- if (result)
- clearErrorMessage();
- else
- showErrorMessage(errorMessage);
-
- return result;
-}
-/**
- * Hook for subclasses to do specific state checks.
- * <p>
- * The default implementation of this framework method does
- * nothing and returns <code>true</code>. Subclasses should
- * override this method to specific state checks.
- * </p>
- *
- * @return <code>true</code> if the field value is valid,
- * and <code>false</code> if invalid
- */
-protected boolean doCheckState() {
- return true;
-}
-/**
- * Fills this field editor's basic controls into the given parent.
- * <p>
- * The string field implementation of this <code>FieldEditor</code>
- * framework method contributes the text field. Subclasses may override
- * but must call <code>super.doFillIntoGrid</code>.
- * </p>
- */
-protected void doFillIntoGrid(Composite parent, int numColumns) {
- getLabelControl(parent);
-
- textField = getTextControl(parent);
- GridData gd = new GridData();
- gd.horizontalSpan = numColumns - 1;
- if (widthInChars != UNLIMITED) {
- GC gc = new GC(textField);
- try {
- Point extent = gc.textExtent("X");//$NON-NLS-1$
- gd.widthHint = widthInChars * extent.x;
- } finally {
- gc.dispose();
- }
- } else {
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- }
- textField.setLayoutData(gd);
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doLoad() {
- if (textField != null) {
- String value = getPreferenceStore().getString(getPreferenceName());
- textField.setText(value);
- oldValue = value;
- }
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doLoadDefault() {
- if (textField != null) {
- String value = getPreferenceStore().getDefaultString(getPreferenceName());
- textField.setText(value);
- }
- valueChanged();
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void doStore() {
- getPreferenceStore().setValue(getPreferenceName(), textField.getText());
-}
-/**
- * Returns the error message that will be displayed when and if
- * an error occurs.
- *
- * @return the error message, or <code>null</code> if none
- */
-public String getErrorMessage() {
- return errorMessage;
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-public int getNumberOfControls() {
- return 2;
-}
-/**
- * Returns the field editor's value.
- *
- * @return the current value
- */
-public String getStringValue() {
- if (textField != null)
- return textField.getText();
- else
- return getPreferenceStore().getString(getPreferenceName());
-}
-/**
- * Returns this field editor's text control.
- *
- * @param parent the parent
- * @return the text control, or <code>null</code> if no
- * text field is created yet
- */
-protected Text getTextControl() {
- return textField;
-}
-/**
- * Returns this field editor's text control.
- * <p>
- * The control is created if it does not yet exist
- * </p>
- *
- * @param parent the parent
- * @return the text control
- */
-public Text getTextControl(Composite parent) {
- if (textField == null) {
- textField = new Text(parent, SWT.SINGLE | SWT.BORDER);
- textField.setFont(parent.getFont());
- switch (validateStrategy) {
- case VALIDATE_ON_KEY_STROKE :
- textField.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- valueChanged();
- }
- });
-
- textField.addFocusListener(new FocusAdapter() {
- public void focusGained(FocusEvent e) {
- refreshValidState();
- }
- public void focusLost(FocusEvent e) {
- clearErrorMessage();
- }
- });
- break;
- case VALIDATE_ON_FOCUS_LOST :
- textField.addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- clearErrorMessage();
- }
- });
- textField.addFocusListener(new FocusAdapter() {
- public void focusGained(FocusEvent e) {
- refreshValidState();
- }
- public void focusLost(FocusEvent e) {
- valueChanged();
- clearErrorMessage();
- }
- });
- break;
- default :
- Assert.isTrue(false, "Unknown validate strategy");//$NON-NLS-1$
- }
- textField.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- textField = null;
- }
- });
- if(textLimit > 0){//Only set limits above 0 - see SWT spec
- textField.setTextLimit(textLimit);
- }
- } else {
- checkParent(textField, parent);
- }
- return textField;
-}
-/**
- * Returns whether an empty string is a valid value.
- *
- * @return <code>true</code> if an empty string is a valid value, and
- * <code>false</code> if an empty string is invalid
- * @see #setEmptyStringAllowed
- */
-public boolean isEmptyStringAllowed() {
- return emptyStringAllowed;
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-public boolean isValid() {
- return isValid;
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-protected void refreshValidState() {
- isValid = checkState();
-}
-/**
- * Sets whether the empty string is a valid value or not.
- *
- * @param b <code>true</code> if the empty string is allowed,
- * and <code>false</code> if it is considered invalid
- */
-public void setEmptyStringAllowed(boolean b) {
- emptyStringAllowed = b;
-}
-/**
- * Sets the error message that will be displayed when and if
- * an error occurs.
- *
- * @param message the error message
- */
-public void setErrorMessage(String message) {
- errorMessage = message;
-}
-/* (non-Javadoc)
- * Method declared on FieldEditor.
- */
-public void setFocus() {
- if (textField != null) {
- textField.setFocus();
- }
-}
-/**
- * Sets this field editor's value.
- *
- * @param value the new value, or <code>null</code> meaning the empty string
- */
-public void setStringValue(String value) {
- if (textField != null) {
- if (value == null)
- value = "";//$NON-NLS-1$
- oldValue = textField.getText();
- if (!oldValue.equals(value)) {
- textField.setText(value);
- valueChanged();
- }
- }
-}
-/**
- * Sets this text field's text limit.
- *
- * @param limit the limit on the number of character in the text
- * input field, or <code>UNLIMITED</code> for no limit
-
- */
-public void setTextLimit(int limit) {
- textLimit = limit;
- if (textField != null)
- textField.setTextLimit(limit);
-}
-/**
- * Sets the strategy for validating the text.
- * <p>
- * Calling this method has no effect after <code>createPartControl</code>
- * is called. Thus this method is really only useful for subclasses to call
- * in their constructor. However, it has public visibility for backward
- * compatibility.
- * </p>
- *
- * @param value either <code>VALIDATE_ON_KEY_STROKE</code> to perform
- * on the fly checking (the default), or <code>VALIDATE_ON_FOCUS_LOST</code> to
- * perform validation only after the text has been typed in
- */
-public void setValidateStrategy(int value) {
- Assert.isTrue(value == VALIDATE_ON_FOCUS_LOST || value == VALIDATE_ON_KEY_STROKE);
- validateStrategy = value;
-}
-/**
- * Shows the error message set via <code>setErrorMessage</code>.
- */
-public void showErrorMessage() {
- showErrorMessage(errorMessage);
-}
-/**
- * Informs this field editor's listener, if it has one, about a change
- * to the value (<code>VALUE</code> property) provided that the old and
- * new values are different.
- * <p>
- * This hook is <em>not</em> called when the text is initialized
- * (or reset to the default value) from the preference store.
- * </p>
- */
-protected void valueChanged() {
- setPresentsDefaultValue(false);
- boolean oldState = isValid;
- refreshValidState();
-
- if (isValid != oldState)
- fireStateChanged(IS_VALID, oldState, isValid);
-
- String newValue = textField.getText();
- if (!newValue.equals(oldValue)) {
- fireValueChanged(VALUE, oldValue, newValue);
- oldValue = newValue;
- }
-}
-
-/*
- * @see FieldEditor.setEnabled(boolean,Composite).
- */
-public void setEnabled(boolean enabled, Composite parent){
- super.setEnabled(enabled,parent);
- getTextControl(parent).setEnabled(enabled);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/images/pref_dialog_title.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/images/pref_dialog_title.gif
deleted file mode 100644
index 77bf4bf..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/images/pref_dialog_title.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/package.html b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/package.html
deleted file mode 100644
index 1a8983a..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/package.html
+++ /dev/null
@@ -1,67 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides a framework for preferences.
-<h2>
-Package Specification</h2>
-A <b>preference manager</b> (class <tt>PreferenceManager</tt>) maintains
-a tree of <b>preference nodes</b>. Preferences are presented to the end
-user in a <b>preference dialog</b> consisting of <b>preference pages</b>.
-A preference page consists of multiple preference fields, which can be
-displayed and modified though <b>field editors</b>. The framework contains
-an abstract base class for preference dialogs (<tt>PreferenceDialog</tt>),
-and an abstract preference page class (<tt>FieldEditorPreferencePage</tt>)
-for hosting these field editors.
-<p>The individual preference values are maintained in a <b>preference store</b>
-(<tt>IPreferenceStore</tt>). Each preference has a current value and a
-default value use to (re-)initialize it. The framework provides a concrete
-preference store implementation (<tt>PreferenceStore</tt>) based on an
-internal <tt>java.util.Properties</tt> object, with support for persisting
-the non-default preference values to files or streams.
-<p>A field editor presents the value of a single preference to the end
-user. The value is loaded from the preference store; if modified by the
-end user, the value is validated and eventually stored back to the preference
-store.
-<p>This package contains ready-to-use field editors for various types of
-preferences:
-<ul>
-<li>
-<tt>BooleanFieldEditor</tt> - booleans</li>
-
-<li>
-<tt>IntegerFieldEditor</tt> - integers</li>
-
-<li>
-<tt>StringFieldEditor</tt> - text strings</li>
-
-<li>
-<tt>RadioGroupFieldEditor</tt> - enumerations</li>
-
-<li>
-<tt>ColorFieldEditor</tt> - RGB colors</li>
-
-<li>
-<tt>FontFieldEditor</tt> - fonts</li>
-
-<li>
-<tt>DirectoryFieldEditor</tt> - directories</li>
-
-<li>
-<tt>FileFieldEditor</tt> - files</li>
-
-<li>
-<tt>PathEditor</tt> - paths</li>
-</ul>
-All field editors are subclasses of the abstract base class <tt>FieldEditor</tt>;
-the framework allows new kinds of field editors to be defined by subclassing
-this class or one of its subclasses.
-<p>Note: None of the classes in this package maintain global state.
-<br>
-</body>
-</html>
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/CompositeImageDescriptor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/CompositeImageDescriptor.java
deleted file mode 100644
index c6ed1e7..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/CompositeImageDescriptor.java
+++ /dev/null
@@ -1,203 +0,0 @@
-package org.eclipse.jface.resource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Abstract base class for image descriptors that synthesize
- * an image from other images in order to simulate the effect
- * of custom drawing. For example, this could be used to
- * superimpose a red bar dexter symbol across an image to indicate
- * that something was disallowed.
- * <p>
- * Subclasses must implement the <code>getSize</code> and
- * <code>fill</code> methods. Little or no work happens
- * until the image descriptor's image is actually requested
- * by a call to <code>createImage</code> (or to
- * <code>getImageData</code> directly).
- * </p>
- */
-public abstract class CompositeImageDescriptor extends ImageDescriptor {
-
- /**
- * The image data for this composite image.
- */
- private ImageData imageData;
-
-/**
- * Constructs an uninitialized composite image.
- */
-protected CompositeImageDescriptor() {
-}
-/**
- * Returns the index of a RGB entry in the given map which matches
- * the specified RGB color. If no such entry exists, a new RGB is
- * allocated. If the given array is full, the value 0 is returned
- * (which maps to the transparency value).
- */
-private static int alloc(RGB[] map, int red, int green, int blue) {
- int i;
- RGB c;
-
- // this loops starts at index 1 because index 0 corresponds to the transparency value
- for (i = 1; i < map.length && (c = map[i]) != null; i++)
- if (c.red == red && c.green == green && c.blue == blue)
- return i;
-
- if (i < map.length - 1) {
- map[i] = new RGB(red, green, blue);
- return i;
- }
- return 0;
-}
-/**
- * Draw the composite images.
- * <p>
- * Subclasses must implement this framework method
- * to paint images within the given bounds using
- * one or more calls to the <code>drawImage</code>
- * framework method.
- * </p>
- *
- * @param width the width
- * @param height the height
- */
-protected abstract void drawCompositeImage(int width, int height);
-/**
- * Draws the given source image data into this composite
- * image at the given position.
- * <p>
- * Call this internal framework method to superimpose another
- * image atop this composite image.
- * </p>
- *
- * @param src the source image data
- * @param ox the x position
- * @param oy the y position
- */
-final protected void drawImage(ImageData src, int ox, int oy) {
-
- RGB[] out = imageData.getRGBs();
-
- PaletteData palette = src.palette;
- if (palette.isDirect) {
-
- ImageData mask = src.getTransparencyMask();
-
- for (int y = 0; y < src.height; y++) {
- for (int x = 0; x < src.width; x++) {
- if (mask.getPixel(x, y) != 0) {
- int xx = x + ox;
- int yy = y + oy;
- if (xx >= 0 && xx < imageData.width && yy >= 0 && yy < imageData.height) {
- int pixel = src.getPixel(x, y);
-
- int r = pixel & palette.redMask;
- /* JM: Changed operators from >> to >>> to shift sign bit right */
- r = (palette.redShift < 0) ? r >>> -palette.redShift : r << palette.redShift;
- int g = pixel & palette.greenMask;
- g = (palette.greenShift < 0) ? g >>> -palette.greenShift : g << palette.greenShift;
- int b = pixel & palette.blueMask;
- b = (palette.blueShift < 0) ? b >>> -palette.blueShift : b << palette.blueShift;
-
- pixel = alloc(out, r, g, b);
-
- imageData.setPixel(xx, yy, pixel);
- }
- }
- }
- }
-
- return;
- }
-
- // map maps src pixel values to dest pixel values
- int map[] = new int[256];
- for (int i = 0; i < map.length; i++)
- map[i] = -1;
-
- /* JM: added code to test if the image is an icon */
- if (src.getTransparencyType() == SWT.TRANSPARENCY_MASK) {
- ImageData mask = src.getTransparencyMask();
- for (int y = 0; y < src.height; y++) {
- for (int x = 0; x < src.width; x++) {
- if (mask.getPixel(x, y) != 0) {
- int xx = x + ox;
- int yy = y + oy;
- if (xx >= 0 && xx < imageData.width && yy >= 0 && yy < imageData.height) {
- int pixel = src.getPixel(x, y);
- int newPixel = map[pixel];
- if (newPixel < 0) {
- RGB c = palette.getRGB(pixel);
- map[pixel] = newPixel = alloc(out, c.red, c.green, c.blue);
- }
-
- imageData.setPixel(xx, yy, newPixel);
- }
- }
- }
- }
- return;
- }
-
- int maskPixel = src.transparentPixel;
- for (int y = 0; y < src.height; y++) {
- for (int x = 0; x < src.width; x++) {
- int pixel = src.getPixel(x, y);
- if (maskPixel < 0 || pixel != maskPixel) {
- int xx = x + ox;
- int yy = y + oy;
- if (xx >= 0 && xx < imageData.width && yy >= 0 && yy < imageData.height) {
-
- int newPixel = map[pixel];
- if (newPixel < 0) {
- RGB c = palette.getRGB(pixel);
- map[pixel] = newPixel = alloc(out, c.red, c.green, c.blue);
- }
-
- imageData.setPixel(xx, yy, newPixel);
- }
- }
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on ImageDesciptor.
- */
-public ImageData getImageData() {
-
- Point size = getSize();
-
- RGB black = new RGB(0, 0, 0);
- RGB[] rgbs = new RGB[256];
- rgbs[0] = black; // transparency
- rgbs[1] = black; // black
-
- PaletteData dataPalette = new PaletteData(rgbs);
- imageData = new ImageData(size.x, size.y, 8, dataPalette);
- imageData.transparentPixel = 0;
-
- drawCompositeImage(size.x, size.y);
-
- for (int i = 0; i < rgbs.length; i++)
- if (rgbs[i] == null)
- rgbs[i] = black;
-
- return imageData;
-
-}
-/**
- * Return the size of this composite image.
- * <p>
- * Subclasses must implement this framework method.
- * </p>
- *
- * @return the x and y size of the image expressed as a
- * point object
- */
-protected abstract Point getSize();
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/DataFormatException.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/DataFormatException.java
deleted file mode 100644
index d52ee84..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/DataFormatException.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.jface.resource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * An exception indicating that a string value could not be
- * converted into the requested data type.
- *
- * @see StringConverter
- */
-public class DataFormatException extends IllegalArgumentException {
-/**
- * Creates a new exception.
- */
-public DataFormatException() {
- super();
-}
-/**
- * Creates a new exception.
- *
- * @param message the message
- */
-public DataFormatException(String message) {
- super(message);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FileImageDescriptor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FileImageDescriptor.java
deleted file mode 100644
index 7ca58ba..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FileImageDescriptor.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package org.eclipse.jface.resource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.graphics.*;
-import java.io.*;
-
-/**
- * An image descriptor that loads its image information
- * from a file.
- */
-class FileImageDescriptor extends ImageDescriptor {
-
- /**
- * The class whose resource directory contain the file,
- * or <code>null</code> if none.
- */
- private Class location;
-
- /**
- * The name of the file.
- */
- private String name;
-/**
- * Creates a new file image descriptor.
- * The file has the given file name and is located
- * in the given class's resource directory. If the given
- * class is <code>null</code>, the file name must be absolute.
- * <p>
- * Note that the file is not accessed until its
- * <code>getImageDate</code> method is called.
- * </p>
- *
- * @param clazz class for resource directory, or
- * <code>null</code>
- * @param filename the name of the file
- */
-FileImageDescriptor(Class clazz, String filename) {
- this.location = clazz;
- this.name = filename;
-}
-/* (non-Javadoc)
- * Method declared on Object.
- */
-public boolean equals(Object o) {
- if (!(o instanceof FileImageDescriptor)) {
- return false;
- }
- FileImageDescriptor other = (FileImageDescriptor)o;
- if (location != null) {
- if (!location.equals(other.location)) {
- return false;
- }
- } else {
- if (other.location != null) {
- return false;
- }
- }
- return name.equals(other.name);
-}
-/* (non-Javadoc)
- * Method declared on ImageDesciptor.
- * Returns null if the image data cannot be read.
- */
-public ImageData getImageData() {
- InputStream in = getStream();
- if (in != null) {
- try {
- return new ImageData(in);
- }
- finally {
- try {
- in.close();
- }
- catch (IOException e) {
- return null;
- }
- }
- } else {
- return null;
- }
-}
-/**
- * Returns a stream on the image contents. Returns
- * null if a stream could not be opened.
- */
-private InputStream getStream() {
- InputStream is = null;
-
- if (location != null) {
- is = location.getResourceAsStream(name);
- } else {
- try {
- is = new FileInputStream(name);
- } catch (FileNotFoundException e) {
- return null;
- }
- }
- return is;
-}
-/* (non-Javadoc)
- * Method declared on Object.
- */
-public int hashCode() {
- int code = name.hashCode();
- if (location != null) {
- code += location.hashCode();
- }
- return code;
-}
-/* (non-Javadoc)
- * Method declared on Object.
- */
-/**
- * The <code>FileImageDescriptor</code> implementation of this <code>Object</code> method
- * returns a string representation of this object which is suitable only for debugging.
- */
-public String toString() {
- return "FileImageDescriptor(location=" + location + ", name=" + name + ")";//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java
deleted file mode 100644
index ad09aba..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java
+++ /dev/null
@@ -1,534 +0,0 @@
-package org.eclipse.jface.resource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.*;
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.*;
-
-/**
- * A font registry maintains a mapping between symbolic font names
- * and SWT fonts.
- * <p>
- * A font registry owns all of the font objects registered
- * with it, and automatically disposes of them when the SWT Display
- * that creates the fonts is disposed. Because of this, clients do
- * not need to (indeed, must not attempt to) dispose of font
- * objects themselves.
- * </p>
- * <p>
- * A special constructor is provided for populating a font registry
- * from a property files using the standard Java resource bundle mechanism.
- * </p>
- * <p>
- * Methods are provided for registering listeners that will be kept
- * apprised of changes to list of registed fonts.
- * </p>
- * <p>
- * Clients may instantiate this class (it was not designed to be subclassed).
- * </p>
- */
-public class FontRegistry {
-
- /**
- * List of property change listeners
- * (element type: <code>org.eclipse.jface.util.IPropertyChangeListener</code>).
- */
- private ListenerList listeners = new ListenerList();
-
- /**
- * Table of known fonts, keyed by symbolic font name
- * (key type: <code>String</code>,
- * value type: <code>org.eclipse.swt.graphics.Font</code>.
- */
- private Map stringToFont = new HashMap(7);
- /**
- * Table of known font data, keyed by symbolic font name
- * (key type: <code>String</code>,
- * value type: <code>org.eclipse.swt.graphics.FontData[]</code>).
- */
- private Map stringToFontData = new HashMap(7);
-/**
- * Creates an empty font registry.
- * <p>
- * There must be an SWT Display created in the current
- * thread before calling this method.
- * </p>
- */
-public FontRegistry() {
- Display display = Display.getCurrent();
- Assert.isNotNull(display);
- hookDisplayDispose(display);
-}
-/**
- * Creates a font registry and initializes its content from
- * a property file.
- * <p>
- * There must be an SWT Display created in the current
- * thread before calling this method.
- * </p>
- * <p>
- * The OS name (retrieved using <code>System.getProperty("os.name")</code>)
- * is converted to lowercase, purged of whitespace, and appended
- * as suffix (separated by an underscore <code>'_'</code>) to the given
- * location string to yield the base name of a resource bundle
- * acceptable to <code>ResourceBundle.getBundle</code>.
- * The standard Java resource bundle mechanism is then used to locate
- * and open the appropriate properties file, taking into account
- * locale specific variations.
- * </p>
- * <p>
- * For example, on the Windows 2000 operating system the location string
- * <code>"com.example.myapp.Fonts"</code> yields the base name
- * <code>"com.example.myapp.Fonts_windows2000"</code>. For the US English locale,
- * this further elaborates to the resource bundle name
- * <code>"com.example.myapp.Fonts_windows2000_en_us"</code>.
- * </p>
- * <p>
- * If no appropriate OS-specific resource bundle is found, the
- * process is repeated using the location as the base bundle name.
- * </p>
- * <p>
- * The property file contains entries that look like this:
- * <pre>
- * textfont.0=MS Sans Serif-regular-10
- * textfont.1=Times New Roman-regular-10
- *
- * titlefont.0=MS Sans Serif-regular-12
- * titlefont.1=Times New Roman-regular-12
- * </pre>
- * Each entry maps a symbolic font names (the font registry keys) with
- * a "<code>.<it>n</it></code> suffix to standard font names
- * on the right. The suffix indicated order of preference:
- * "<code>.0</code>" indicates the first choice,
- * "<code>.1</code>" indicates the second choice, and so on.
- * </p>
- * The following example shows how to use the font registry:
- * <pre>
- * FontRegistry registry = new FontRegistry("com.example.myapp.fonts");
- * Font font = registry.get("textfont");
- * control.setFont(font);
- * ...
- * </pre>
- *
- * @param location the name of the resource bundle
- * @param the ClassLoader to use to find the resource bundle
- * @exception MissingResourceException if the resource bundle cannot be found
- * @since 2.1
- */
-public FontRegistry(String location, ClassLoader loader) throws MissingResourceException {
- Display display = Display.getCurrent();
- Assert.isNotNull(display);
- // FIXE: need to respect loader
- //readResourceBundle(location, loader);
- readResourceBundle(location);
-
- hookDisplayDispose(display);
-}
-
-/**
- * Load the FontRegistry using the ClassLoader from the PlatformUI
- * plug-in
- * @see FontRegistry(String,loader)
- */
-public FontRegistry(String location) throws MissingResourceException {
-// FIXE:
-// this(location, WorkbenchPlugin.getDefault().getDescriptor().getPluginClassLoader());
- this(location, null);
-}
-
-/**
- * Read the resource bundle at location. Look for a file with the
- * extension _os_ws first, then _os then just the name.
- * @param location - String - the location of the file.
- */
-
-private void readResourceBundle(String location) {
- String osname = System.getProperty("os.name").trim();//$NON-NLS-1$
- String wsname = SWT.getPlatform();
- osname = StringConverter.removeWhiteSpaces(osname).toLowerCase();
- wsname = StringConverter.removeWhiteSpaces(wsname).toLowerCase();
- String OSLocation = location;
- String WSLocation = location;
- ResourceBundle bundle = null;
- if (osname != null){
- OSLocation = location + "_" + osname;//$NON-NLS-1$
- if (wsname != null)
- WSLocation = OSLocation + "_" + wsname;//$NON-NLS-1$
- }
-
- try{
- bundle = ResourceBundle.getBundle(WSLocation);
- readResourceBundle(bundle, WSLocation);
- }
- catch(MissingResourceException wsException){
- try {
- bundle = ResourceBundle.getBundle(OSLocation);
- readResourceBundle(bundle, WSLocation);
- } catch (MissingResourceException osException) {
- if (location != OSLocation) {
- bundle = ResourceBundle.getBundle(location);
- readResourceBundle(bundle, WSLocation);
- }
- else
- throw osException;
- }
- }
-}
-
-/**
- * Read the resource bundle at location. Look for a file with the
- * extension _os_ws first, then _os then just the name.
- * @param location - String - the location of the file.
- */
-
-private void readResourceBundle(String location, ClassLoader loader) {
- String osname = System.getProperty("os.name").trim();//$NON-NLS-1$
- String wsname = SWT.getPlatform();
- osname = StringConverter.removeWhiteSpaces(osname).toLowerCase();
- wsname = StringConverter.removeWhiteSpaces(wsname).toLowerCase();
- String OSLocation = location;
- String WSLocation = location;
- ResourceBundle bundle = null;
- if (osname != null){
- OSLocation = location + "_" + osname;//$NON-NLS-1$
- if (wsname != null)
- WSLocation = OSLocation + "_" + wsname;//$NON-NLS-1$
- }
-
- try{
- bundle = ResourceBundle.getBundle(WSLocation,Locale.getDefault(),loader);
- readResourceBundle(bundle, WSLocation);
- }
- catch(MissingResourceException wsException){
- try {
- bundle = ResourceBundle.getBundle(OSLocation, Locale.getDefault(),loader);
- readResourceBundle(bundle, WSLocation);
- } catch (MissingResourceException osException) {
- if (location != OSLocation) {
- bundle = ResourceBundle.getBundle(location,Locale.getDefault(),loader);
- readResourceBundle(bundle, WSLocation);
- }
- else
- throw osException;
- }
- }
-}
-/**
- * Creates an empty font registry.
- *
- * @param display the Display
- */
-public FontRegistry(Display display) {
- Assert.isNotNull(display);
- hookDisplayDispose(display);
-}
-/**
- * Adds a property change listener to this registry.
- *
- * @param listener a property change listener
- */
-public void addListener(IPropertyChangeListener listener) {
- listeners.add(listener);
-}
-
-/**
- * Find the first valid fontData in the provided list.
- * If none are valid return the first one regardless.
- * If the list is empty return null.
- * Return null if one cannot be found.
- */
-public FontData bestData(FontData[] fonts, Display display) {
- for (int i = 0; i < fonts.length; i++) {
- FontData fd = fonts[i];
-
- if (fd == null)
- break;
-
- FontData[] fixedFonts = display.getFontList(fd.getName(), false);
- if (isFixedFont(fixedFonts, fd)) {
- return fd;
- }
-
- FontData[] scalableFonts = display.getFontList(fd.getName(), true);
- if (scalableFonts.length > 0) {
- return fd;
- }
- }
-
- //None of the provided datas are valid. Return the
- //first one as it is at least the first choice.
- if (fonts.length > 0)
- return fonts[0];
- else
- //Nothing specified
- return null;
-}
-
-/**
- * Creates a new font with the given font datas or nulk
- * if there is no data.
- */
-private Font createFont(String symbolicName, FontData[] fonts) {
- Display display = Display.getCurrent();
- FontData validData = bestData(fonts,display);
- if(validData == null){
- //Nothing specified
- return null;
- }
- else {
- //Create a font data for updating the registry
- FontData[] newEntry = new FontData[1];
- newEntry[0] = validData;
- //Do not fire the update from creation as it is not a property change
- put(symbolicName,newEntry,false);
- return new Font(display, validData);
- }
-}
-/**
- * Returns the default font. Creates it if necessary.
- */
-Font defaultFont() {
- Display current = Display.getCurrent();
- if(current == null){
- Shell shell = new Shell();
- Font font = shell.getFont();
- shell.dispose();
- return font;
- }
- else
- return current.getSystemFont();
-}
-/**
- * Returns the default font data. Creates it if necessary.
- */
-private FontData[] defaultFontData() {
- return defaultFont().getFontData();
-}
-/**
- * Fires a PropertyChangeEvent.
- */
-private void fireFontMappingChanged(String name) {
- final String finalName = name;
- final Object[] listeners = this.listeners.getListeners();
- if (listeners.length > 0) {
-// FIXME: need to do this without dependency on org.eclipse.core.runtime
-// Platform.run(new SafeRunnable(JFaceResources.getString("FontRegistry.changeError")) { //$NON-NLS-1$
-// public void run() {
- PropertyChangeEvent event = new PropertyChangeEvent(this, finalName, null, null);
- for (int i = 0; i < listeners.length; ++i) {
- ((IPropertyChangeListener) listeners[i]).propertyChange(event);
- }
-// }
-// });
- }
-}
-/**
- * Returns the font data associated with the given symbolic font name.
- * Returns the default font data if there is no special value associated
- * with that name.
- *
- * @param symbolicName symbolic font name
- * @return the font
- */
-public FontData[] getFontData(String symbolicName) {
-
- Assert.isNotNull(symbolicName);
- Object result = stringToFontData.get(symbolicName);
- if (result == null)
- return defaultFontData();
-
- return (FontData[])result;
-}
-/**
- * Returns the font associated with the given symbolic font name.
- * Returns the default font if there is no special value associated
- * with that name.
- *
- * @param symbolicName symbolic font name
- * @return the font
- */
-public Font get(String symbolicName) {
-
- Assert.isNotNull(symbolicName);
- Object result = stringToFont.get(symbolicName);
- if (result != null)
- return (Font)result;
-
- result = stringToFontData.get(symbolicName);
- if (result == null)
- return defaultFont();
-
- // Create the font and update the mapping so it can
- // be shared.
- Font font = createFont(symbolicName,(FontData[])result);
- stringToFont.put(symbolicName, font);
-
- // Note, the font may be null if the create() failed. Put a mapping
- // in for this font to prevent repeated attempts to allocate the
- // same font.
-
- if (font == null)
- return defaultFont();
-
- return font;
-}
-/**
- * Shut downs this resource registry and disposes of all registered fonts.
- */
-private void handleDisplayDispose() {
-
- for (Iterator e = stringToFont.values().iterator(); e.hasNext();) {
- Object next = e.next();
- if (next instanceof Font) {
- ((Font) next).dispose();
- }
- }
- stringToFont.clear();
- listeners.clear();
-}
-/**
- * Hook a dispose listener on the SWT display.
- */
-private void hookDisplayDispose(Display display) {
- display.disposeExec(new Runnable() {
- public void run() {
- handleDisplayDispose();
- }
- });
-}
-/**
- * Checks whether the given font is in the list of fixed fonts.
- */
-private boolean isFixedFont(FontData[] fixedFonts, FontData fd) {
- // Can't use FontData.equals() since some values aren't
- // set if a fontdata isn't used.
- int height = fd.getHeight();
- String name = fd.getName();
- for (int i = 0; i < fixedFonts.length; i++) {
- FontData fixed = fixedFonts[i];
- if (fixed.getHeight() == height && fixed.getName().equals(name))
- return true;
- }
- return false;
-}
-/**
- * Converts a String into a FontData object.
- */
-private FontData makeFontData(String value) throws MissingResourceException {
- try {
- return StringConverter.asFontData(value.trim());
- } catch (DataFormatException e) {
- throw new MissingResourceException("Wrong font data format. Value is: \"" + value + "\"", getClass().getName(), value);//$NON-NLS-2$//$NON-NLS-1$
- }
-}
-
-/**
- * Adds (or replaces) a font to this font registry under the given
- * symbolic name.
- * <p>
- * A property change event is reported whenever the mapping from
- * a symbolic name to a font changes. The source of the event is
- * this registry; the property name is the symbolic font name.
- * </p>
- *
- * @param symbolicName the symbolic font name
- * @param fontData an Array of FontData
- * @param update - fire a font mapping changed if true. False
- * if this method is called from the get method as no setting
- * has changed.
- */
-public void put(String symbolicName, FontData[] fontData) {
- put(symbolicName,fontData,true);
-}
-
-/**
- * Adds (or replaces) a font to this font registry under the given
- * symbolic name.
- * <p>
- * A property change event is reported whenever the mapping from
- * a symbolic name to a font changes. The source of the event is
- * this registry; the property name is the symbolic font name.
- * </p>
- *
- * @param symbolicName the symbolic font name
- * @param fontData an Array of FontData
- * @param update - fire a font mapping changed if true. False
- * if this method is called from the get method as no setting
- * has changed.
- */
-private void put(String symbolicName, FontData[] fontData, boolean update) {
-
- Assert.isNotNull(symbolicName);
- Assert.isNotNull(fontData);
-
- FontData[] existing = (FontData []) stringToFontData.get(symbolicName);
- if(Arrays.equals(existing,fontData))
- return;
-
- Font oldFont = (Font)stringToFont.remove(symbolicName);
- stringToFontData.put(symbolicName, fontData);
- if(update)
- fireFontMappingChanged(symbolicName);
-
- if (oldFont == defaultFont())
- return;
-
- if (oldFont != null )
- oldFont.dispose();
-}
-/**
- * Reads the resource bundle. This puts FontData[] objects
- * in the mapping table. These will lazily be turned into
- * real Font objects when requested.
- */
-private void readResourceBundle(ResourceBundle bundle,String bundleName) throws MissingResourceException {
- Enumeration keys = bundle.getKeys();
- while (keys.hasMoreElements()) {
- String key = (String) keys.nextElement();
- int pos = key.lastIndexOf('.');
- if (pos == -1) {
- stringToFontData.put(key, new FontData[] {
- makeFontData(bundle.getString(key))});
- } else {
- String name = key.substring(0, pos);
- int i = 0;
- try {
- i = Integer.parseInt(key.substring(pos + 1));
- } catch (NumberFormatException e) {
- //Panic the file can not be parsed.
- throw new MissingResourceException("Wrong key format ", bundleName, key);//$NON-NLS-1$
- }
- FontData[] elements = (FontData[]) stringToFontData.get(name);
- if (elements == null) {
- elements = new FontData[8];
- stringToFontData.put(name, elements);
- }
- if (i > elements.length) {
- FontData[] na = new FontData[i + 8];
- System.arraycopy(elements, 0, na, 0, elements.length);
- elements = na;
- stringToFontData.put(name, elements);
- }
- elements[i] = makeFontData(bundle.getString(key));
- }
- }
-}
-/**
- * Removes the given listener from this registry.
- * Has no affect if the listener is not registered.
- *
- * @param listener a property change listener
- */
-public void removeListener(IPropertyChangeListener listener) {
- listeners.remove(listener);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java
deleted file mode 100644
index 516a793..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package org.eclipse.jface.resource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.Display;
-import java.net.URL;
-
-/**
- * An image descriptor is an object that knows how to create
- * an SWT image. It does not hold onto images or cache them,
- * but rather just creates them on demand. An image descriptor
- * is intended to be a lightweight representation of an image
- * that can be manipulated even when no SWT display exists.
- * <p>
- * This package defines a concrete image descriptor implementation
- * which reads an image from a file (<code>FileImageDescriptor</code>).
- * It also provides abstract framework classes (this one and
- * <code>CompositeImageDescriptor</code>) which may be subclassed to define
- * news kinds of image descriptors.
- * </p>
- * <p>
- * Using this abstract class involves defining a concrete subclass
- * and providing an implementation for the <code>getImageData</code>
- * method.
- * </p>
- *
- * @see org.eclipse.swt.graphics.Image
- */
-public abstract class ImageDescriptor {
-
- /**
- * A small red square used to warn that an image cannot be created.
- * <p>
- */
- protected static final ImageData DEFAULT_IMAGE_DATA= new ImageData(6, 6, 1, new PaletteData(new RGB[] { new RGB(255, 0, 0) }));
-/**
- * Constructs an image descriptor.
- */
-protected ImageDescriptor() {
-}
-/**
- * Creates and returns a new image descriptor from a file.
- * Convenience method for
- * <code>new FileImageDescriptor(location,filename)</code>.
- *
- * @param location the class whose resource directory contain the file
- * @param filename the file name
- * @return a new image descriptor
- */
-public static ImageDescriptor createFromFile(Class location, String filename) {
- return new FileImageDescriptor(location, filename);
-}
-/**
- * Creates and returns a new image descriptor from a URL.
- *
- * @param url The URL of the image file.
- * @return a new image descriptor
- */
-public static ImageDescriptor createFromURL(URL url) {
- if (url == null) {
- return getMissingImageDescriptor();
- }
- return new URLImageDescriptor(url);
-}
-/**
- * Creates and returns a new SWT image for this image descriptor.
- * Note that each call returns a new SWT image object.
- *
- * @return a new image
- */
-public Image createImage() {
- return createImage(true);
-}
-/**
- * Creates and returns a new SWT image for this image descriptor.
- * Note that if returnMissingImageOnError is true a default image
- * is returned
- *
- * @param returnMissingImageOnError The flag that determines if a default image is returned on error
- * @return a new image or null if the image could not be created
- */
-public Image createImage(boolean returnMissingImageOnError) {
- return createImage(returnMissingImageOnError, Display.getCurrent());
-}
-/**
- * Creates and returns a new SWT image for this image descriptor.
- *
- * @param device the device on which to create the image
- * @return a new image or null if the image could not be created
- * @since 2.0
- */
-public Image createImage(Device device) {
- return createImage(true, device);
-}
-/**
- * Creates and returns a new SWT image for this image descriptor.
- * Note that if returnMissingImageOnError is true a default image
- * is returned
- *
- * @param returnMissingImageOnError The flag that determines if a default image is returned on error
- * @param device the device on which to create the image
- * @return a new image or null if the image could not be created
- * @since 2.0
- */
-public Image createImage(boolean returnMissingImageOnError, Device device) {
-
- ImageData data = getImageData();
- if (data == null) {
- if (!returnMissingImageOnError) {
- return null;
- } else {
- data = DEFAULT_IMAGE_DATA;
- }
- }
-
- /*
- * Try to create the supplied image. If there is an SWT Exception try and create
- * the default image if that was requested. Return null if this fails.
- */
-
- try {
- if (data.transparentPixel >= 0) {
- ImageData maskData = data.getTransparencyMask();
- return new Image(device, data, maskData);
- }
- return new Image(device, data);
- } catch (SWTException exception) {
- if (returnMissingImageOnError) {
- try {
- return new Image(device, DEFAULT_IMAGE_DATA);
- } catch (SWTException nextException) {
- return null;
- }
- } else
- return null;
- }
-}
-/**
- * Creates and returns a new SWT <code>ImageData</code> object
- * for this image descriptor.
- * Note that each call returns a new SWT image data object.
- * <p>
- * This framework method is declared public so that it is
- * possible to request an image descriptor's image data without
- * creating an SWT image object.
- * </p>
- *
- * @return a new image data
- */
-public abstract ImageData getImageData();
-/**
- * Returns the shared image descriptor for a missing image.
- *
- * @return the missing image descriptor
- */
-public static ImageDescriptor getMissingImageDescriptor() {
- return MissingImageDescriptor.getInstance();
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageRegistry.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageRegistry.java
deleted file mode 100644
index f4e58d2..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageRegistry.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.eclipse.jface.resource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.graphics.Image;
-import java.util.*;
-
-/**
- * An image registry maintains a mapping between symbolic image names
- * and SWT image objects or special image descriptor objects which
- * defer the creation of SWT image objects until they are needed.
- * <p>
- * An image registry owns all of the image objects registered
- * with it, and automatically disposes of them when the SWT Display
- * that creates the images is disposed. Because of this, clients do not
- * need to (indeed, must not attempt to) dispose of these images themselves.
- * </p>
- * <p>
- * Clients may instantiate this class (it was not designed to be subclassed).
- * </p>
- * <p>
- *
- * <p>
- * Unlike the FontRegistry, it is an error to replace images. As a result
- * there are no events that fire when values are changed in the registry
- * </p>
- */
-public class ImageRegistry {
-
- /**
- * Table of known images keyed by symbolic image name
- * (key type: <code>String</code>,
- * value type: <code>org.eclipse.swt.graphics.Image</code>
- * or <code>ImageDescriptor</code>).
- */
- private Map table = new HashMap(10);
-/**
- * Creates an empty image registry.
- * <p>
- * There must be an SWT Display created in the current
- * thread before calling this method.
- * </p>
- */
-public ImageRegistry() {
- Display display = Display.getCurrent();
- Assert.isNotNull(display);
- hookDisplayDispose(display);
-}
-/**
- * Creates an empty image registry.
- */
-public ImageRegistry(Display display) {
- Assert.isNotNull(display);
- hookDisplayDispose(display);
-}
-/**
- * Returns the image associated with the given key in this registry,
- * or <code>null</code> if none.
- *
- * @param key the key
- * @return the image, or <code>null</code> if none
- */
-public Image get(String key) {
- Object entry = table.get(key);
- if (entry == null) {
- return null;
- }
- if (entry instanceof Image) {
- return (Image)entry;
- }
- Image image = ((ImageDescriptor)entry).createImage();
- table.put(key, image);
- return image;
-}
-/**
- * Shut downs this resource registry and disposes of all registered images.
- */
-private void handleDisplayDispose() {
-
- for (Iterator e = table.values().iterator(); e.hasNext();) {
- Object next = e.next();
- if (next instanceof Image) {
- ((Image)next).dispose();
- }
- }
- table = null;
-}
-/**
- * Hook a dispose listener on the SWT display.
- *
- * @param display the Display
- */
-private void hookDisplayDispose(Display display) {
- display.disposeExec(new Runnable() {
- public void run() {
- handleDisplayDispose();
- }
- });
-}
-/**
- * Adds (or replaces) an image descriptor to this registry. The first time
- * this new entry is retrieved, the image descriptor's image will be computed
- * (via </code>ImageDescriptor.createImage</code>) and remembered.
- * This method replaces an existing image descriptor associated with the
- * given key, but fails if there is a real image associated with it.
- *
- * @param key the key
- * @param descriptor the ImageDescriptor
- * @exception IllegalArgumentException if the key already exists
- */
-public void put(String key, ImageDescriptor descriptor) {
- Object entry = table.get(key);
- if (entry == null || entry instanceof ImageDescriptor) {
- //replace with the new descriptor
- table.put(key, descriptor);
- return;
- }
- throw new IllegalArgumentException("ImageRegistry key already in use: " + key);//$NON-NLS-1$
-}
-/**
- * Adds an image to this registry. This method
- * fails if there is already an image with the given key.
- * <p>
- * Note that an image registry owns all of the image objects registered
- * with it, and automatically disposes of them the SWT Display is disposed.
- * Because of this, clients must not register an image object
- * that is managed by another object.
- * </p>
- *
- * @param key the key
- * @param image the image
- * @exception IllegalArgumentException if the key already exists
- */
-public void put(String key, Image image) {
- Object entry = table.get(key);
- if (entry == null || entry instanceof ImageDescriptor) {
- //replace with the new descriptor
- table.put(key, image);
- return;
- }
- throw new IllegalArgumentException("ImageRegistry key already in use: " + key);//$NON-NLS-1$
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceColors.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceColors.java
deleted file mode 100644
index b814bdc..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceColors.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package org.eclipse.jface.resource;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.util.*;
-
-import org.eclipse.jface.preference.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * JFaceColors is the class that stores references
- * to all of the colors used by JFace.
- */
-
-public class JFaceColors {
-
- private static Hashtable colorTable = new Hashtable();
- //Keep a list of the Colors we have allocated seperately
- //as system colors do not need to be disposed.
- private static ArrayList allocatedColors = new ArrayList();
-
- /**
- * Get the Color used for banner backgrounds
- */
-
- public static Color getBannerBackground(Display display) {
- return display.getSystemColor(SWT.COLOR_LIST_BACKGROUND);
- }
-
- /**
- * Get the Color used for banner foregrounds
- */
-
- public static Color getBannerForeground(Display display) {
- return display.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
- }
-
- /**
- * Get the background Color for widgets that
- * display errors.
- */
-
- public static Color getErrorBackground(Display display) {
- return display.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
- }
-
- /**
- * Get the border Color for widgets that
- * display errors.
- */
-
- public static Color getErrorBorder(Display display) {
- return display.getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW);
- }
-
- /**
- * Get the defualt color to use for displaying errors.
- */
- public static Color getErrorText(Display display) {
-
- return getColorSetting(display,JFacePreferences.ERROR_COLOR);
- }
-
- /**
- * Get the default color to use for displaying hyperlinks.
- */
- public static Color getHyperlinkText(Display display) {
-
- return getColorSetting(display,JFacePreferences.HYPERLINK_COLOR);
- }
-
- /**
- * Get the default color to use for displaying active hyperlinks.
- */
- public static Color getActiveHyperlinkText(Display display) {
-
- return getColorSetting(display,JFacePreferences.ACTIVE_HYPERLINK_COLOR);
- }
-
- /**
- * Clear out the cached color for name. This is generally
- * done when the color preferences changed and any cached colors
- * may be disposed. Users of the colors in this class should add a IPropertyChangeListener
- * to detect when any of these colors change.
- */
- public static void clearColor(String colorName){
- colorTable.remove(colorName);
- //We do not dispose here for backwards compatibility
- }
-
- /**
- * Get the color setting for the name.
- */
- private static Color getColorSetting(Display display, String preferenceName) {
-
- if(colorTable.contains(preferenceName))
- return (Color) colorTable.get(preferenceName);
-
- IPreferenceStore store = JFacePreferences.getPreferenceStore();
- if (store == null){
- //Dark blue is the default if there is no store
- Color color = getDefaultColor(display,preferenceName);
- colorTable.put(preferenceName,color);
- return color;
- }
- else{
- Color color = new Color(
- display,
- PreferenceConverter.getColor(store, preferenceName));
- allocatedColors.add(color);
- colorTable.put(preferenceName,color);
- return color;
- }
- }
-
- /**
- * Return the default color for the preferenceName. If there is
- * no setting return the system black.
- */
- private static Color getDefaultColor(Display display,String preferenceName){
-
- if(preferenceName.equals(JFacePreferences.ERROR_COLOR))
- return display.getSystemColor(SWT.COLOR_RED);
- if(preferenceName.equals(JFacePreferences.HYPERLINK_COLOR)){
- Color color = new Color(display,0,0,153);
- allocatedColors.add(color);
- return color;
- }
- if(preferenceName.equals(JFacePreferences.ACTIVE_HYPERLINK_COLOR))
- return display.getSystemColor(SWT.COLOR_BLUE);
- return display.getSystemColor(SWT.COLOR_BLACK);
- }
-
- /**
- * Dispose of all allocated colors. Called on workbench
- * shutdown.
- */
- public static void disposeColors(){
- Iterator colors = allocatedColors.iterator();
- while(colors.hasNext()){
- ((Color) colors.next()).dispose();
- }
- }
-
- /**
- * Set the foreground and background colors of the
- * control to the specified values. If the values are
- * null than ignore them.
- * @param foreground Color
- * @param background Color
- */
- public static void setColors(Control control,Color foreground, Color background){
- if(foreground != null)
- control.setForeground(foreground);
- if(background != null)
- control.setBackground(background);
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceResources.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceResources.java
deleted file mode 100644
index 508cad9..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceResources.java
+++ /dev/null
@@ -1,305 +0,0 @@
-package org.eclipse.jface.resource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.resource.FontRegistry;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import java.io.*;
-import java.util.*;
-import java.text.MessageFormat;
-
-/**
- * Utility methods to access JFace-specific resources.
- * <p>
- * All methods declared on this class are static. This
- * class cannot be instantiated.
- * </p>
- * <p>
- * The following global state is also maintained by this class:
- * <ul>
- * <li>a font registry</li>
- * <li>an image registry</li>
- * <li>a resource bundle</li>
- * </ul>
- * </p>
- */
-public class JFaceResources {
-
- /**
- * The JFace resource bundle; eagerly initialized.
- */
- private static final ResourceBundle bundle=
- ResourceBundle.getBundle("org.eclipse.jface.messages");//$NON-NLS-1$
-
- /**
- * The JFace font registry; <code>null</code> until
- * lazily initialized or explicitly set.
- */
- private static FontRegistry fontRegistry = null;
-
- /**
- * The JFace image registry; <code>null</code> until
- * lazily initialized.
- */
- private static ImageRegistry imageRegistry = null;
-
- /**
- * The symbolic font name for the standard font
- * (value <code>"org.eclipse.jface.defaultfont"</code>).
- */
-
- public static final String DEFAULT_FONT = "org.eclipse.jface.defaultfont";//$NON-NLS-1$
-
- /**
- * The symbolic font name for the dialog font
- * (value <code>"org.eclipse.jface.dialogfont"</code>).
- */
- public static final String DIALOG_FONT = "org.eclipse.jface.dialogfont";//$NON-NLS-1$
-
- /**
- * The symbolic font name for the banner font
- * (value <code>"org.eclipse.jface.bannerfont"</code>).
- */
- public static final String BANNER_FONT = "org.eclipse.jface.bannerfont";//$NON-NLS-1$
-
- /**
- * The symbolic font name for the viewer font
- * (value <code>"org.eclipse.jface.viewerfont"</code>).
- * @deprecated This font is not in use
- */
- public static final String VIEWER_FONT = "org.eclipse.jface.viewerfont";//$NON-NLS-1$
-
- /**
- * The symbolic font name for the header font
- * (value <code>"org.eclipse.jface.headerfont"</code>).
- */
- public static final String HEADER_FONT = "org.eclipse.jface.headerfont";//$NON-NLS-1$
-
-
- /**
- * The symbolic font name for the text font
- * (value <code>"org.eclipse.jface.textfont"</code>).
- */
- public static final String TEXT_FONT = "org.eclipse.jface.textfont";//$NON-NLS-1$
-
- /**
- * The symbolic font name for the window font
- * (value <code>"org.eclipse.jface.windowfont"</code>).
- * @deprecated This font is not in use
- */
- public static final String WINDOW_FONT = "org.eclipse.jface.windowfont";//$NON-NLS-1$
-
-/* (non-Javadoc)
- * Declare a private constructor to block instantiation.
- */
-private JFaceResources() {
-}
-/**
- * Returns the formatted message for the given key in
- * JFace's resource bundle.
- *
- * @param key the resource name
- * @param args the message arguments
- * @return the string
- */
-public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key),args);
-}
-/**
- * Returns the JFace's banner font.
- * Convenience method equivalent to
- * <pre>
- * JFaceResources.getFontRegistry().get(JFaceResources.BANNER_FONT)
- * </pre>
- *
- * @return the font
- */
-public static Font getBannerFont() {
- return getFontRegistry().get(BANNER_FONT);
-}
-/**
- * Returns the resource bundle for JFace itself.
- * The resouble bundle is obtained from
- * <code>ResourceBundle.getBundle("org.eclipse.jface.jface_nls")</code>.
- * <p>
- * Note that several static convenience methods are
- * also provided on this class for directly accessing
- * resources in this bundle.
- * </p>
- *
- * @return the resource bundle
- */
-public static ResourceBundle getBundle() {
- return bundle;
-}
-/**
- * Returns the JFace's standard font.
- * Convenience method equivalent to
- * <pre>
- * JFaceResources.getFontRegistry().get(JFaceResources.DEFAULT_FONT)
- * </pre>
- *
- * @return the font
- */
-public static Font getDefaultFont() {
- return getFontRegistry().defaultFont();
-}
-/**
- * Returns the JFace's dialog font.
- * Convenience method equivalent to
- * <pre>
- * JFaceResources.getFontRegistry().get(JFaceResources.DIALOG_FONT)
- * </pre>
- *
- * @return the font
- */
-public static Font getDialogFont() {
- return getFontRegistry().get(DIALOG_FONT);
-}
-/**
- * Returns the font in JFace's font registry with the given
- * symbolic font name.
- * Convenience method equivalent to
- * <pre>
- * JFaceResources.getFontRegistry().get(symbolicName)
- * </pre>
- *
- * If an error occurs, return the default font.
- *
- * @param symbolicName the symbolic font name
- * @return the font
- */
-public static Font getFont(String symbolicName) {
- return getFontRegistry().get(symbolicName);
-}
-/**
- * Returns the font registry for JFace itself.
- * If the value has not been established by an earlier
- * call to <code>setFontRegistry</code>, is it
- * initialized to
- * <code>new FontRegistry("org.eclipse.jface.resource.jfacefonts")</code>.
- * <p>
- * Note that several static convenience methods are
- * also provided on this class for directly accessing
- * JFace's standard fonts.
- * </p>
- */
-public static FontRegistry getFontRegistry() {
- if (fontRegistry == null) {
- fontRegistry = new FontRegistry("org.eclipse.jface.resource.jfacefonts");//$NON-NLS-1$
- }
- return fontRegistry;
-}
-/**
- * Returns the image in JFace's image registry with the given key,
- * or <code>null</code> if none.
- * Convenience method equivalent to
- * <pre>
- * JFaceResources.getImageRegistry().get(key)
- * </pre>
- *
- * @param key the key
- * @return the image, or <code>null</code> if none
- */
-public static Image getImage(String key) {
- return getImageRegistry().get(key);
-}
-/**
- * Returns the image registry for JFace itself.
- * <p>
- * Note that the static convenience method <code>getImage</code>
- * is also provided on this class.
- * </p>
- */
-public static ImageRegistry getImageRegistry() {
- if (imageRegistry == null)
- imageRegistry = new ImageRegistry();
- return imageRegistry;
-}
-/**
- * Returns the resource object with the given key in
- * JFace's resource bundle. If there isn't any value under
- * the given key, the key is returned.
- *
- * @param key the resource name
- * @return the string
- */
-public static String getString(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- }
-}
-/**
- * Returns a list of string values corresponding to the
- * given list of keys. The lookup is done with <code>getString</code>.
- * The values are in the same order as the keys.
- *
- * @param keys a list of keys
- * @return a list of corresponding string values
- */
-public static String[] getStrings(String[] keys) {
- Assert.isNotNull(keys);
- int length = keys.length;
- String[] result = new String[length];
- for (int i = 0; i < length; i++)
- result[i] = getString(keys[i]);
- return result;
-}
-
-/**
- * Returns the JFace's header font.
- * Convenience method equivalent to
- * <pre>
- * JFaceResources.getFontRegistry().get(JFaceResources.HEADER_FONT)
- * </pre>
- *
- * @return the font
- */
-public static Font getHeaderFont() {
- return getFontRegistry().get(HEADER_FONT);
-}
-
-/**
- * Returns the JFace's text font.
- * Convenience method equivalent to
- * <pre>
- * JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT)
- * </pre>
- *
- * @return the font
- */
-public static Font getTextFont() {
- return getFontRegistry().get(TEXT_FONT);
-}
-/**
- * Returns the JFace's viewer font.
- * Convenience method equivalent to
- * <pre>
- * JFaceResources.getFontRegistry().get(JFaceResources.VIEWER_FONT)
- * </pre>
- *
- * @return the font
- * @deprecated This font is not in use
- */
-public static Font getViewerFont() {
- return getFontRegistry().get(VIEWER_FONT);
-}
-/**
- * Sets JFace's font registry to the given value.
- * This method may only be called once; the call must occur
- * before <code>JFaceResources.getFontRegistry</code>
- * is invoked (either directly or indirectly).
- *
- * @param registry a font registry
- */
-public static void setFontRegistry(FontRegistry registry) {
- Assert.isTrue(fontRegistry == null, "Font registry can only be set once.");//$NON-NLS-1$
- fontRegistry = registry;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/MissingImageDescriptor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/MissingImageDescriptor.java
deleted file mode 100644
index 4952a6d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/MissingImageDescriptor.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.jface.resource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.graphics.ImageData;
-
-/**
- * The image descriptor for a missing image.
- * <p>
- * Use <code>MissingImageDescriptor.getInstance</code> to
- * access the singleton instance maintained in an
- * internal state variable.
- * </p>
- */
-class MissingImageDescriptor extends ImageDescriptor {
- private static MissingImageDescriptor instance;
-/**
- * Constructs a new missing image descriptor.
- */
-private MissingImageDescriptor() {
- super();
-}
-/* (non-Javadoc)
- * Method declared on ImageDesciptor.
- */
-public ImageData getImageData() {
- return DEFAULT_IMAGE_DATA;
-}
-/**
- * Returns the shared missing image descriptor instance.
- *
- * @return the image descriptor for a missing image
- */
-static MissingImageDescriptor getInstance() {
- if (instance == null) {
- instance = new MissingImageDescriptor();
- }
- return instance;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/StringConverter.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/StringConverter.java
deleted file mode 100644
index 4fa6f0e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/StringConverter.java
+++ /dev/null
@@ -1,752 +0,0 @@
-package org.eclipse.jface.resource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.jface.util.Assert;
-
-/**
- * Helper class for converting various data types to and from
- * strings. Supported types include:
- * <ul>
- * <li><code>boolean</code></li>
- * <li><code>int</code></li>
- * <li><code>long</code></li>
- * <li><code>float</code></li>
- * <li><code>double</code></li>
- * <li><code>org.eclipse.swt.graphics.Point</code></li>
- * <li><code>org.eclipse.swt.graphics.Rectangle</code></li>
- * <li><code>org.eclipse.swt.graphics.RGB</code></li>
- * <li><code>org.eclipse.swt.graphics.FontData</code></li>
- * </ul>
- * <p>
- * All methods declared on this class are static. This
- * class cannot be instantiated.
- * </p>
- */
-public class StringConverter {
-
- /**
- * Internal font style constant for regular fonts.
- */
- private static final String REGULAR = "regular";//$NON-NLS-1$
-
- /**
- * Internal font style constant for bold fonts.
- */
- private static final String BOLD = "bold";//$NON-NLS-1$
-
- /**
- * Internal font style constant for italic fonts.
- */
- private static final String ITALIC = "italic";//$NON-NLS-1$
-
- /**
- * Internal font style constant for bold italic fonts.
- */
- private static final String BOLD_ITALIC = "bold italic";//$NON-NLS-1$
-
- /**
- * Internal constant for the separator character used in
- * font specifications.
- */
- private static final char SEPARATOR = '-';
-/* (non-Javadoc)
- * Declare a private constructor to block instantiation.
- */
-private StringConverter() {
-}
-/**
- * Breaks out space-separated words into an array of words.
- * For example: <code>"no comment"</code> into an array
- * <code>a[0]="no"</code> and <code>a[1]= "comment"</code>.
- *
- * @param value the string to be converted
- * @return the list of words
- */
-public static String[] asArray(String value) throws DataFormatException {
- ArrayList list = new ArrayList();
- StringTokenizer stok = new StringTokenizer(value);
- while (stok.hasMoreTokens()) {
- list.add(stok.nextToken());
- }
- String result[] = new String[list.size()];
- list.toArray(result);
- return result;
-}
-/**
-/**
- * Breaks out space-separated words into an array of words.
- * For example: <code>"no comment"</code> into an array
- * <code>a[0]="no"</code> and <code>a[1]= "comment"</code>.
- * Returns the given default value if the value cannot be parsed.
- *
- * @param value the string to be converted
- * @param dflt the default value
- * @return the list of words, or the default value
- */
-public static String[] asArray(String value, String[] dflt) {
- try {
- return asArray(value);
- } catch (DataFormatException e) {
- return dflt;
- }
-}
-/**
- * Converts the given value into a boolean.
- * This method fails if the value does not represent a boolean.
- * <p>
- * Valid representations of <code>true</code> include the strings
- * "<code>t</code>", "<code>true</code>", or equivalent in mixed
- * or upper case.
- * Similarly, valid representations of <code>false</code> include the strings
- * "<code>f</code>", "<code>false</code>", or equivalent in mixed
- * or upper case.
- * </p>
- *
- * @param value the value to be converted
- * @return the value as a boolean
- * @exception DataFormatException if the given value does not represent
- * a boolean
- */
-public static boolean asBoolean(String value) throws DataFormatException {
- String v = value.toLowerCase();
- if (v.equals("t") || v.equals("true"))//$NON-NLS-2$//$NON-NLS-1$
- return true;
- if (value.equals("f") || v.equals("false"))//$NON-NLS-2$//$NON-NLS-1$
- return false;
- throw new DataFormatException("Value " + value + "doesn't represent a boolean");//$NON-NLS-2$//$NON-NLS-1$
-}
-/**
- * Converts the given value into a boolean.
- * Returns the given default value if the
- * value does not represent a boolean.
- *
- * @param value the value to be converted
- * @param dflt the default value
- * @return the value as a boolean, or the default value
- */
-public static boolean asBoolean(String value, boolean dflt) {
- try {
- return asBoolean(value);
- } catch (DataFormatException e) {
- return dflt;
- }
-}
-/**
- * Converts the given value into a double.
- * This method fails if the value does not represent a double.
- *
- * @param value the value to be converted
- * @return the value as a double
- * @exception DataFormatException if the given value does not represent
- * a double
- */
-public static double asDouble(String value) throws DataFormatException {
- try {
- return (Double.valueOf(value)).doubleValue();
- } catch (NumberFormatException e) {
- throw new DataFormatException(e.getMessage());
- }
-}
-/**
- * Converts the given value into a double.
- * Returns the given default value if the
- * value does not represent a double.
- *
- * @param value the value to be converted
- * @param dflt the default value
- * @return the value as a double, or the default value
- */
-public static double asDouble(String value, double dflt) {
- try {
- return asDouble(value);
- } catch (DataFormatException e) {
- return dflt;
- }
-}
-/**
- * Converts the given value into a float.
- * This method fails if the value does not represent a float.
- *
- * @param value the value to be converted
- * @return the value as a float
- * @exception DataFormatException if the given value does not represent
- * a float
- */
-public static float asFloat(String value) throws DataFormatException {
- try {
- return (Float.valueOf(value)).floatValue();
- } catch (NumberFormatException e) {
- throw new DataFormatException(e.getMessage());
- }
-}
-/**
- * Converts the given value into a float.
- * Returns the given default value if the
- * value does not represent a float.
- *
- * @param value the value to be converted
- * @param dflt the default value
- * @return the value as a float, or the default value
- */
-public static float asFloat(String value, float dflt) {
- try {
- return asFloat(value);
- } catch (DataFormatException e) {
- return dflt;
- }
-}
-/**
- * Converts the given value into an SWT font data object.
- * This method fails if the value does not represent font data.
- * <p>
- * A valid font data representation is a string of the form
- * <code><it>fontname</it>-<it>style</it>-<it>height</it></code> where
- * <code><it>fontname</it></code> is the name of a font,
- * <code><it>style</it></code> is a font style (one of
- * <code>"regular"</code>, <code>"bold"</code>,
- * <code>"italic"</code>, or <code>"bold italic"</code>)
- * and <code><it>height</it></code> is an integer representing the
- * font height. Example: <code>Times New Roman-bold-36</code>.
- * </p>
- *
- * @param value the value to be converted
- * @return the value as font data
- * @exception DataFormatException if the given value does not represent
- * font data
- */
-public static FontData asFontData(String value) throws DataFormatException {
- if (value == null)
- throw new DataFormatException("Null doesn't represent a valid font data");//$NON-NLS-1$
- String name = null;
- int height = 0;
- int style = 0;
- try {
- int length = value.length();
- int heightIndex = value.lastIndexOf(SEPARATOR);
- if (heightIndex == -1)
- throw new DataFormatException("No correct font data format \"" + value + "\"");//$NON-NLS-2$//$NON-NLS-1$
- height = StringConverter.asInt(value.substring(heightIndex + 1, length));
- int faceIndex = value.lastIndexOf(SEPARATOR, heightIndex - 1);
- if (faceIndex == -1)
- throw new DataFormatException("No correct font data format \"" + value + "\"");//$NON-NLS-2$//$NON-NLS-1$
- String s = value.substring(faceIndex + 1, heightIndex);
- if (BOLD_ITALIC.equals(s)) {
- style = SWT.BOLD | SWT.ITALIC;
- } else
- if (BOLD.equals(s)) {
- style = SWT.BOLD;
- } else
- if (ITALIC.equals(s)) {
- style = SWT.ITALIC;
- } else
- if (REGULAR.equals(s)) {
- style = SWT.NORMAL;
- } else {
- throw new DataFormatException("Unknown face name \"" + s + "\"");//$NON-NLS-2$//$NON-NLS-1$
- }
- name = value.substring(0, faceIndex);
- } catch (NoSuchElementException e) {
- throw new DataFormatException(e.getMessage());
- }
- return new FontData(name, height, style);
-}
-/**
- * Converts the given value into an SWT font data object.
- * Returns the given default value if the
- * value does not represent a font data object.
- *
- * @param value the value to be converted
- * @param dflt the default value
- * @return the value as a font data object, or the default value
- */
-public static FontData asFontData(String value, FontData dflt) {
- try {
- return asFontData(value);
- } catch (DataFormatException e) {
- return dflt;
- }
-}
-/**
- * Converts the given value into an int.
- * This method fails if the value does not represent an int.
- *
- * @param value the value to be converted
- * @return the value as an int
- * @exception DataFormatException if the given value does not represent
- * an int
- */
-public static int asInt(String value) throws DataFormatException {
- try {
- return Integer.parseInt(value);
- } catch (NumberFormatException e) {
- throw new DataFormatException(e.getMessage());
- }
-}
-/**
- * Converts the given value into an int.
- * Returns the given default value if the
- * value does not represent an int.
- *
- * @param value the value to be converted
- * @param dflt the default value
- * @return the value as an int, or the default value
- */
-public static int asInt(String value, int dflt) {
- try {
- return asInt(value);
- } catch (DataFormatException e) {
- return dflt;
- }
-}
-/**
- * Converts the given value into a long.
- * This method fails if the value does not represent a long.
- *
- * @param value the value to be converted
- * @return the value as a long
- * @exception DataFormatException if the given value does not represent
- * a long
- */
-public static long asLong(String value) throws DataFormatException {
- try {
- return Long.parseLong(value);
- } catch (NumberFormatException e) {
- throw new DataFormatException(e.getMessage());
- }
-}
-/**
- * Converts the given value into a long.
- * Returns the given default value if the
- * value does not represent a long.
- *
- * @param value the value to be converted
- * @param dflt the default value
- * @return the value as a long, or the default value
- */
-public static long asLong(String value, long dflt) {
- try {
- return asLong(value);
- } catch (DataFormatException e) {
- return dflt;
- }
-}
-/**
- * Converts the given value into an SWT point.
- * This method fails if the value does not represent a point.
- * <p>
- * A valid point representation is a string of the form
- * <code><it>x</it>,<it>y</it></code> where
- * <code><it>x</it></code> and <code><it>y</it></code>
- * are valid ints.
- * </p>
- *
- * @param value the value to be converted
- * @return the value as a point
- * @exception DataFormatException if the given value does not represent
- * a point
- */
-public static Point asPoint(String value) throws DataFormatException {
- if (value == null)
- throw new DataFormatException("Null doesn't represent a valid point");//$NON-NLS-1$
- StringTokenizer stok = new StringTokenizer(value, ",");//$NON-NLS-1$
- String x = stok.nextToken();
- String y = stok.nextToken();
- int xval = 0, yval = 0;
- try {
- xval = Integer.parseInt(x);
- yval = Integer.parseInt(y);
- } catch (NumberFormatException e) {
- throw new DataFormatException(e.getMessage());
- }
- return new Point(xval, yval);
-}
-/**
- * Converts the given value into an SWT point.
- * Returns the given default value if the
- * value does not represent a point.
- *
- * @param value the value to be converted
- * @param dflt the default value
- * @return the value as a point, or the default value
- */
-public static Point asPoint(String value, Point dflt) {
- try {
- return asPoint(value);
- } catch (DataFormatException e) {
- return dflt;
- }
-}
-/**
- * Converts the given value into an SWT rectangle.
- * This method fails if the value does not represent a rectangle.
- * <p>
- * A valid rectangle representation is a string of the form
- * <code><it>x</it>,<it>y</it>,<it>width</it>,<it>height</it></code>
- * where <code><it>x</it></code>, <code><it>y</it></code>,
- * <code><it>width</it></code>, and <code><it>height</it></code>
- * are valid ints.
- * </p>
- *
- * @param value the value to be converted
- * @return the value as a rectangle
- * @exception DataFormatException if the given value does not represent
- * a rectangle
- */
-public static Rectangle asRectangle(String value) throws DataFormatException {
- if (value == null)
- throw new DataFormatException("Null doesn't represent a valid rectangle");//$NON-NLS-1$
- StringTokenizer stok = new StringTokenizer(value, ",");//$NON-NLS-1$
- String x = stok.nextToken();
- String y = stok.nextToken();
- String width = stok.nextToken();
- String height = stok.nextToken();
- int xval = 0, yval = 0, wval = 0, hval = 0;
- try {
- xval = Integer.parseInt(x);
- yval = Integer.parseInt(y);
- wval = Integer.parseInt(width);
- hval = Integer.parseInt(height);
- } catch (NumberFormatException e) {
- throw new DataFormatException(e.getMessage());
- }
- return new Rectangle(xval, yval, wval, hval);
-}
-/**
- * Converts the given value into an SWT rectangle.
- * Returns the given default value if the
- * value does not represent a rectangle.
- *
- * @param value the value to be converted
- * @param dflt the default value
- * @return the value as a rectangle, or the default value
- */
-public static Rectangle asRectangle(String value, Rectangle dflt) {
- try {
- return asRectangle(value);
- } catch (DataFormatException e) {
- return dflt;
- }
-}
-/**
- * Converts the given value into an SWT RGB color value.
- * This method fails if the value does not represent an RGB
- * color value.
- * <p>
- * A valid RGB color value representation is a string of the form
- * <code><it>red</it>,<it>green</it></code>,<it>blue</it></code> where
- * <code><it>red</it></code>, <it>green</it></code>, and
- * <code><it>blue</it></code> are valid ints.
- * </p>
- *
- * @param value the value to be converted
- * @return the value as an RGB color value
- * @exception DataFormatException if the given value does not represent
- * an RGB color value
- */
-public static RGB asRGB(String value) throws DataFormatException {
- if (value == null)
- throw new DataFormatException("Null doesn't represent a valid RGB");//$NON-NLS-1$
- StringTokenizer stok = new StringTokenizer(value, ",");//$NON-NLS-1$
- String red = stok.nextToken();
- String green = stok.nextToken();
- String blue = stok.nextToken();
- int rval = 0, gval = 0, bval = 0;
- try {
- rval = Integer.parseInt(red);
- gval = Integer.parseInt(green);
- bval = Integer.parseInt(blue);
- } catch (NumberFormatException e) {
- throw new DataFormatException(e.getMessage());
- }
- return new RGB(rval, gval, bval);
-}
-/**
- * Converts the given value into an SWT RGB color value.
- * Returns the given default value if the
- * value does not represent an RGB color value.
- *
- * @param value the value to be converted
- * @param dflt the default value
- * @return the value as a RGB color value, or the default value
- */
-public static RGB asRGB(String value, RGB dflt) {
- try {
- return asRGB(value);
- } catch (DataFormatException e) {
- return dflt;
- }
-}
-/**
- * Converts the given double value to a string.
- * Equivalent to <code>String.valueOf(value)</code>.
- *
- * @param value the double value
- * @return the string representing the given double
- */
-public static String asString(double value) {
- return String.valueOf(value);
-}
-/**
- * Converts the given float value to a string.
- * Equivalent to <code>String.valueOf(value)</code>.
- *
- * @param value the float value
- * @return the string representing the given float
- */
-public static String asString(float value) {
- return String.valueOf(value);
-}
-/**
- * Converts the given int value to a string.
- * Equivalent to <code>String.valueOf(value)</code>.
- *
- * @param value the int value
- * @return the string representing the given int
- */
-public static String asString(int value) {
- return String.valueOf(value);
-}
-/**
- * Converts the given long value to a string.
- * Equivalent to <code>String.valueOf(value)</code>.
- *
- * @param value the long value
- * @return the string representing the given long
- */
-public static String asString(long value) {
- return String.valueOf(value);
-}
-/**
- * Converts the given boolean object to a string.
- * Equivalent to <code>String.valueOf(value.booleanValue())</code>.
- *
- * @param value the boolean object
- * @return the string representing the given boolean value
- */
-public static String asString(Boolean value) {
- Assert.isNotNull(value);
- return String.valueOf(value.booleanValue());
-}
-/**
- * Converts the given double object to a string.
- * Equivalent to <code>String.valueOf(value.doubleValue())</code>.
- *
- * @param value the double object
- * @return the string representing the given double value
- */
-public static String asString(Double value) {
- Assert.isNotNull(value);
- return String.valueOf(value.doubleValue());
-}
-/**
- * Converts the given float object to a string.
- * Equivalent to <code>String.valueOf(value.floatValue())</code>.
- *
- * @param value the float object
- * @return the string representing the given float value
- */
-public static String asString(Float value) {
- Assert.isNotNull(value);
- return String.valueOf(value.floatValue());
-}
-/**
- * Converts the given integer object to a string.
- * Equivalent to <code>String.valueOf(value.intValue())</code>.
- *
- * @param value the integer object
- * @return the string representing the given integer value
- */
-public static String asString(Integer value) {
- Assert.isNotNull(value);
- return String.valueOf(value.intValue());
-}
-/**
- * Converts the given long object to a string.
- * Equivalent to <code>String.valueOf(value.longValue())</code>.
- *
- * @param value the long object
- * @return the string representing the given long value
- */
-public static String asString(Long value) {
- Assert.isNotNull(value);
- return String.valueOf(value.longValue());
-}
-/**
- * Converts a font data object to a string. The string representation is
- * "font name-style-height" (for example "Times New Roman-bold-36").
- * @param value The font data.
- * @return The string representation of the font data object.
- */
-public static String asString(FontData value) {
- Assert.isNotNull(value);
- StringBuffer buffer = new StringBuffer();
- buffer.append(value.getName());
- buffer.append(SEPARATOR);
- int style = value.getStyle();
- boolean bold = (style & SWT.BOLD) == SWT.BOLD;
- boolean italic = (style & SWT.ITALIC) == SWT.ITALIC;
- if (bold && italic) {
- buffer.append(BOLD_ITALIC);
- } else
- if (bold) {
- buffer.append(BOLD);
- } else
- if (italic) {
- buffer.append(ITALIC);
- } else {
- buffer.append(REGULAR);
- }
-
- buffer.append(SEPARATOR);
- buffer.append(value.getHeight());
- return buffer.toString();
-}
-/**
- * Converts the given SWT point object to a string.
- * <p>
- * The string representation of a point has the form
- * <code><it>x</it>,<it>y</it></code> where
- * <code><it>x</it></code> and <code><it>y</it></code>
- * are string representations of integers.
- * </p>
- *
- * @param value the point object
- * @return the string representing the given point
- */
-public static String asString(Point value) {
- Assert.isNotNull(value);
- StringBuffer buffer = new StringBuffer();
- buffer.append(value.x);
- buffer.append(',');
- buffer.append(value.y);
- return buffer.toString();
-}
-/**
- * Converts the given SWT rectangle object to a string.
- * <p>
- * The string representation of a rectangle has the form
- * <code><it>x</it>,<it>y</it>,<it>width</it>,<it>height</it></code>
- * where <code><it>x</it></code>, <code><it>y</it></code>,
- * <code><it>width</it></code>, and <code><it>height</it></code>
- * are string representations of integers.
- * </p>
- *
- * @param value the rectangle object
- * @return the string representing the given rectangle
- */
-public static String asString(Rectangle value) {
- Assert.isNotNull(value);
- StringBuffer buffer = new StringBuffer();
- buffer.append(value.x);
- buffer.append(',');
- buffer.append(value.y);
- buffer.append(',');
- buffer.append(value.width);
- buffer.append(',');
- buffer.append(value.height);
- return buffer.toString();
-}
-/**
- * Converts the given SWT RGB color value object to a string.
- * <p>
- * The string representation of an RGB color value has the form
- * <code><it>red</it>,<it>green</it></code>,<it>blue</it></code> where
- * <code><it>red</it></code>, <it>green</it></code>, and
- * <code><it>blue</it></code> are string representations of integers.
- * </p>
- *
- * @param value the RGB color value object
- * @return the string representing the given RGB color value
- */
-public static String asString(RGB value) {
- Assert.isNotNull(value);
- StringBuffer buffer = new StringBuffer();
- buffer.append(value.red);
- buffer.append(',');
- buffer.append(value.green);
- buffer.append(',');
- buffer.append(value.blue);
- return buffer.toString();
-}
-/**
- * Converts the given boolean value to a string.
- * Equivalent to <code>String.valueOf(value)</code>.
- *
- * @param value the boolean value
- * @return the string representing the given boolean
- */
-public static String asString(boolean value) {
- return String.valueOf(value);
-}
-/**
- * Returns the given string with all whitespace characters removed.
- * <p>
- * All characters that have codes less than or equal to <code>'\u0020'</code>
- * (the space character) are considered to be a white space.
- * </p>
- *
- * @param s the source string
- * @return the string with all whitespace characters removed
- */
-public static String removeWhiteSpaces(String s) {
- //check for no whitespace (common case)
- boolean found = false;
- int wsIndex = -1;
- int size = s.length();
- for (int i = 0; i < size; i++) {
- found = Character.isWhitespace(s.charAt(i));
- if (found) {
- wsIndex = i;
- break;
- }
- }
- if (!found)
- return s;
-
- StringBuffer result = new StringBuffer(s.substring(0, wsIndex));
- for (int i = wsIndex + 1; i < size; i++) {
- char ch = s.charAt(i);
- if (!Character.isWhitespace(ch))
- result.append(ch);
- }
- return result.toString();
-}
-/**
- * Converts a font data object to a string representation for display.
- * The string representation is
- * "font name-style-height" (for example "Times New Roman-bold-36").
- * @param value The font data.
- * @return The string representation of the font data object.
- */
-public static String asDisplayableString(FontData value) {
- Assert.isNotNull(value);
- StringBuffer buffer = new StringBuffer();
- buffer.append(value.getName());
- buffer.append(SEPARATOR);
- int style = value.getStyle();
- boolean bold = (style & SWT.BOLD) == SWT.BOLD;
- boolean italic = (style & SWT.ITALIC) == SWT.ITALIC;
- if (bold && italic) {
- buffer.append(JFaceResources.getString("BoldItalicFont")); //$NON-NLS-1$
- } else
- if (bold) {
- buffer.append(JFaceResources.getString("BoldFont")); //$NON-NLS-1$
- } else
- if (italic) {
- buffer.append(JFaceResources.getString("ItalicFont")); //$NON-NLS-1$
- } else {
- buffer.append(JFaceResources.getString("RegularFont")); //$NON-NLS-1$
- }
- buffer.append(SEPARATOR);
- buffer.append(value.getHeight());
- return buffer.toString();
-
-}
-
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/URLImageDescriptor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/URLImageDescriptor.java
deleted file mode 100644
index fe2bed2..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/URLImageDescriptor.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.eclipse.jface.resource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.graphics.ImageData;
-import java.io.InputStream;
-import java.io.IOException;
-import java.net.URL;
-/**
- * An ImageDescriptor that gets its information from a URL.
- * This class is not public API. Use ImageDescriptor#createFromURL
- * to create a descriptor that uses a URL.
- */
-class URLImageDescriptor extends ImageDescriptor {
- private URL url;
-/**
- * Creates a new URLImageDescriptor.
- * @param url The URL to load the image from. Must be non-null.
- */
-URLImageDescriptor(URL url) {
- this.url = url;
-}
-/* (non-Javadoc)
- * Method declared on Object.
- */
-public boolean equals(Object o) {
- if (!(o instanceof URLImageDescriptor)) {
- return false;
- }
- return ((URLImageDescriptor)o).url.equals(this.url);
-}
-/* (non-Javadoc)
- * Method declared on ImageDesciptor.
- * Returns null if the image data cannot be read.
- */
-public ImageData getImageData() {
- InputStream in = getStream();
- if (in != null) {
- try {
- return new ImageData(in);
- }
- finally {
- try {
- in.close();
- }
- catch (IOException e) {
- return null;
- }
- }
- } else {
- return null;
- }
-}
-/**
- * Returns a stream on the image contents. Returns
- * null if a stream could not be opened.
- */
-protected InputStream getStream() {
- try {
- return url.openStream();
- } catch (IOException e) {
- return null;
- }
-}
-/* (non-Javadoc)
- * Method declared on Object.
- */
-public int hashCode() {
- return url.hashCode();
-}
-/* (non-Javadoc)
- * Method declared on Object.
- */
-/**
- * The <code>URLImageDescriptor</code> implementation of this <code>Object</code> method
- * returns a string representation of this object which is suitable only for debugging.
- */
-public String toString() {
- return "URLImageDescriptor(" + url + ")"; //$NON-NLS-1$ //$NON-NLS-2$
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts.properties b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts.properties
deleted file mode 100644
index 9e5bab0..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts.properties
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_aix.properties b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_aix.properties
deleted file mode 100644
index 0075d0f..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_aix.properties
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_hp-ux.properties b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_hp-ux.properties
deleted file mode 100644
index d3cea95..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_hp-ux.properties
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_linux.properties b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_linux.properties
deleted file mode 100644
index 573721f..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_linux.properties
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_linux_gtk.properties b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_linux_gtk.properties
deleted file mode 100644
index 0fcff07..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_linux_gtk.properties
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_qnx.properties b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_qnx.properties
deleted file mode 100644
index 11c67e2..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_qnx.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-#############################################################
-#
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-#
-#############################################################
-# QNX font file for JFace
-#############################################################
-org.eclipse.jface.bannerfont.0=TextFont-bold-14
-org.eclipse.jface.defaultfont.0=TextFont-regular-8
-org.eclipse.jface.dialogfont.0=TextFont-regular-8
-org.eclipse.jface.headerfont.0=TextFont-bold-18
-org.eclipse.jface.textfont.0=FixedFont-regular-8
-org.eclipse.jface.viewerfont.0=FixedFont-regular-8
-org.eclipse.jface.windowfont.0=TextFont-bold-10
-
-
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_sunos.properties b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_sunos.properties
deleted file mode 100644
index c228084..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_sunos.properties
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windows2000.properties b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windows2000.properties
deleted file mode 100644
index 39eebbe..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windows2000.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#############################################################
-#
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-#
-#############################################################
-# NLS font file for JFace when running under Windows NT
-#############################################################
-# Standard Windows font. Need not to be specified
-# Specify it for now because SWT does not provide API for
-# accessing the platform's default font
-org.eclipse.jface.defaultfont.0=MS Sans Serif-regular-8
-
-# Standard Windows font. Need not to be specified
-# org.eclipse.jface.viewerfont.0=MS Sans Serif-regular-8
-
-org.eclipse.jface.bannerfont.0=Tahoma-bold-8
-
-org.eclipse.jface.headerfont.0=Tahoma-bold-12
-
-org.eclipse.jface.textfont.0=Courier-regular-10
-org.eclipse.jface.textfont.1=Lucida Console-regular-9
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windows98.properties b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windows98.properties
deleted file mode 100644
index 739fb94..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windows98.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#############################################################
-#
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-#
-#############################################################
-# NLS font file for JFace when running under Windows NT
-#############################################################
-# Standard Windows font. Need not to be specified
-# Specify it for now because SWT does not provide API for
-# accessing the platform's default font
-org.eclipse.jface.defaultfont.0=MS Sans Serif-regular-8
-
-# Standard Windows font. Need not to be specified
-# org.eclipse.jface.viewerfont.0=MS Sans Serif-regular-8
-
-org.eclipse.jface.bannerfont.0=MS Sans Serif-bold-8
-
-org.eclipse.jface.headerfont.0=MS Sans Serif-bold-12
-
-org.eclipse.jface.textfont.0=Courier-regular-10
-org.eclipse.jface.textfont.1=Lucida Console-regular-9
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windowsnt.properties b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windowsnt.properties
deleted file mode 100644
index 739fb94..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windowsnt.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#############################################################
-#
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-#
-#############################################################
-# NLS font file for JFace when running under Windows NT
-#############################################################
-# Standard Windows font. Need not to be specified
-# Specify it for now because SWT does not provide API for
-# accessing the platform's default font
-org.eclipse.jface.defaultfont.0=MS Sans Serif-regular-8
-
-# Standard Windows font. Need not to be specified
-# org.eclipse.jface.viewerfont.0=MS Sans Serif-regular-8
-
-org.eclipse.jface.bannerfont.0=MS Sans Serif-bold-8
-
-org.eclipse.jface.headerfont.0=MS Sans Serif-bold-12
-
-org.eclipse.jface.textfont.0=Courier-regular-10
-org.eclipse.jface.textfont.1=Lucida Console-regular-9
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windowsxp.properties b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windowsxp.properties
deleted file mode 100644
index 39eebbe..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windowsxp.properties
+++ /dev/null
@@ -1,22 +0,0 @@
-#############################################################
-#
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-#
-#############################################################
-# NLS font file for JFace when running under Windows NT
-#############################################################
-# Standard Windows font. Need not to be specified
-# Specify it for now because SWT does not provide API for
-# accessing the platform's default font
-org.eclipse.jface.defaultfont.0=MS Sans Serif-regular-8
-
-# Standard Windows font. Need not to be specified
-# org.eclipse.jface.viewerfont.0=MS Sans Serif-regular-8
-
-org.eclipse.jface.bannerfont.0=Tahoma-bold-8
-
-org.eclipse.jface.headerfont.0=Tahoma-bold-12
-
-org.eclipse.jface.textfont.0=Courier-regular-10
-org.eclipse.jface.textfont.1=Lucida Console-regular-9
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/package.html b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/package.html
deleted file mode 100644
index b409a46..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/package.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides support for managing resources such as SWT
-fonts and images.
-<h2>
-Package Specification</h2>
-This package contains support for managing resources, including:
-<ul>
-<li>
-font registries (<tt>FontRegistry</tt>) - for hanging on to the SWT font
-objects needed by an application</li>
-
-<li>
-image registries (<tt>ImageRegistry</tt>) - for hanging on to the SWT image
-objects needed by an application</li>
-
-<li>
-image descriptors (<tt>ImageDescriptor</tt>) - surrogate object for creating
-SWT images</li>
-
-<li>
-string conversion (<tt>StringConverter</tt>) - for parsing property files</li>
-</ul>
-The JFace resources module is an independent JFace module requiring a basic
-knowledge of SWT and the JFace property change event mechanism. Familiarity
-with other JFace modules is not required.
-<p>Image descriptors are objects that knows how to create an image on demand.
-They serve as a lightweight representation of images in situations where
-no SWT display exists yet, and are used mainly in conjunction with image
-registries. This package contains the image descriptor framework, which
-is a simple hierarchy rooted at the abstract class <tt>ImageDescriptor</tt>.
-The framework includes abstract subclasses for composing images (<tt>CompositeImageDescriptor</tt>)
-as well as a ready-made concrete subclass for loading images from files
-(<tt>FileImageDescriptor</tt>).
-<p>The class <tt>JFaceResources</tt> maintains global state on behalf of
-JFace itself consisting of JFace's own image registry, font registry, resource
-bundle, and preference store.
-<br>
-</body>
-</html>
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/Assert.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/Assert.java
deleted file mode 100644
index 49b7fe6..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/Assert.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.eclipse.jface.util;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * <code>Assert</code> is useful for for embedding runtime sanity checks
- * in code. The static predicate methods all test a condition and throw some
- * type of unchecked exception if the condition does not hold.
- * <p>
- * Assertion failure exceptions, like most runtime exceptions, are
- * thrown when something is misbehaving. Assertion failures are invariably
- * unspecified behavior; consequently, clients should never rely on
- * these being thrown (or not thrown). <b>If you find yourself in the
- * position where you need to catch an assertion failure, you have most
- * certainly written your program incorrectly.</b>
- * </p>
- * <p>
- * Note that an <code>assert</code> statement is slated to be added to the
- * Java language in JDK 1.4, rending this class obsolete.
- * </p>
- */
-public final class Assert {
-
- /**
- * <code>AssertionFailedException</code> is a runtime exception thrown
- * by some of the methods in <code>Assert</code>.
- * <p>
- * This class is not declared public to prevent some misuses; programs that catch
- * or otherwise depend on assertion failures are susceptible to unexpected
- * breakage when assertions in the code are added or removed.
- * </p>
- */
- private static class AssertionFailedException extends RuntimeException {
-
- /**
- * Constructs a new exception.
- */
- public AssertionFailedException() {
- }
-
- /**
- * Constructs a new exception with the given message.
- */
- public AssertionFailedException(String detail) {
- super(detail);
- }
- }
-/* This class is not intended to be instantiated. */
-private Assert() {
-}
-/**
- * Asserts that an argument is legal. If the given boolean is
- * not <code>true</code>, an <code>IllegalArgumentException</code>
- * is thrown.
- *
- * @param expression the outcome of the check
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- * @exception IllegalArgumentException if the legality test failed
- */
-public static boolean isLegal(boolean expression) {
- // succeed as quickly as possible
- if (expression) {
- return true;
- }
- return isLegal(expression, "");//$NON-NLS-1$
-}
-/**
- * Asserts that an argument is legal. If the given boolean is
- * not <code>true</code>, an <code>IllegalArgumentException</code>
- * is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param expression the outcome of the check
- * @param message the message to include in the exception
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- * @exception IllegalArgumentException if the legality test failed
- */
-public static boolean isLegal(boolean expression, String message) {
- if (!expression)
- throw new IllegalArgumentException("assertion failed; " + message); //$NON-NLS-1$
- return expression;
-}
-/**
- * Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * <p>
- * As a general rule, parameters passed to API methods must not be
- * <code>null</code> unless <b>explicitly</b> allowed in the method's
- * specification. Similarly, results returned from API methods are never
- * <code>null</code> unless <b>explicitly</b> allowed in the method's
- * specification. Implementations are encouraged to make regular use of
- * <code>Assert.isNotNull</code> to ensure that <code>null</code>
- * parameters are detected as early as possible.
- * </p>
- *
- * @param object the value to test
- * @exception Throwable an unspecified unchecked exception if the object
- * is <code>null</code>
- */
-public static void isNotNull(Object object) {
- // succeed as quickly as possible
- if (object != null) {
- return;
- }
- isNotNull(object, "");//$NON-NLS-1$
-}
-/**
- * Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * The given message is included in that exception, to aid debugging.
- * <p>
- * As a general rule, parameters passed to API methods must not be
- * <code>null</code> unless <b>explicitly</b> allowed in the method's
- * specification. Similarly, results returned from API methods are never
- * <code>null</code> unless <b>explicitly</b> allowed in the method's
- * specification. Implementations are encouraged to make regular use of
- * <code>Assert.isNotNull</code> to ensure that <code>null</code>
- * parameters are detected as early as possible.
- * </p>
- *
- * @param object the value to test
- * @param message the message to include in the exception
- * @exception Throwable an unspecified unchecked exception if the object
- * is <code>null</code>
- */
-public static void isNotNull(Object object, String message) {
- if (object == null)
- throw new AssertionFailedException("null argument;" + message);//$NON-NLS-1$
-}
-/**
- * Asserts that the given boolean is <code>true</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- *
- * @param expression the outcome of the check
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- */
-public static boolean isTrue(boolean expression) {
- // succeed as quickly as possible
- if (expression) {
- return true;
- }
- return isTrue(expression, "");//$NON-NLS-1$
-}
-/**
- * Asserts that the given boolean is <code>true</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param expression the outcome of the check
- * @param message the message to include in the exception
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- */
-public static boolean isTrue(boolean expression, String message) {
- if (!expression)
- throw new AssertionFailedException("Assertion failed: "+message);//$NON-NLS-1$
- return expression;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/IOpenEventListener.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/IOpenEventListener.java
deleted file mode 100644
index c816c40..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/IOpenEventListener.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.jface.util;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import org.eclipse.swt.events.SelectionEvent;
-/**
- * Listener for open events which are generated on selection
- * of default selection depending on the user preferences.
- *
- * <p>
- * Usage:
- * <pre>
- * OpenStrategy handler = new OpenStrategy(control);
- * handler.addOpenListener(new IOpenEventListener() {
- * public void handleOpen(SelectionEvent e) {
- * ... // code to handle the open event.
- * }
- * });
- * </pre>
- * </p>
- *
- * @see OpenStrategy
- */
-public interface IOpenEventListener {
- /**
- * Called when a selection or default selection occurs
- * depending on the user preference.
- */
- public void handleOpen(SelectionEvent e);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/IPropertyChangeListener.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/IPropertyChangeListener.java
deleted file mode 100644
index 1d4db16..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/IPropertyChangeListener.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.jface.util;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.EventListener;
-
-/**
- * Listener for property changes.
- * <p>
- * Usage:
- * <pre>
- * IPropertyChangeListener listener =
- * new IPropertyChangeListener() {
- * public void propertyChange(PropertyChangeEvent event) {
- * ... // code to deal with occurrence of property change
- * }
- * };
- * emitter.addPropertyChangeListener(listener);
- * ...
- * emitter.removePropertyChangeListener(listener);
- * </pre>
- * </p>
- */
-public interface IPropertyChangeListener extends EventListener {
-/**
- * Notification that a property has changed.
- * <p>
- * This method gets called when the observed object fires a property
- * change event.
- * </p>
- *
- * @param event the property change event object describing which property
- * changed and how
- */
-public void propertyChange(PropertyChangeEvent event);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/ListenerList.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/ListenerList.java
deleted file mode 100644
index f706b45..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/ListenerList.java
+++ /dev/null
@@ -1,168 +0,0 @@
-package org.eclipse.jface.util;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-
-/**
- * This class is used to maintain a list of listeners, and
- * is used in the implementations of several classes within JFace
- * which allow you to register listeners of various kinds.
- * It is a fairly lightweight object, occupying minimal space when
- * no listeners are registered.
- * <p>
- * Note that the <code>add</code> method checks for and eliminates
- * duplicates based on identity (not equality). Likewise, the
- * <code>remove</code> method compares based on identity.
- * </p>
- * <p>
- * Use the <code>getListeners</code> method when notifying listeners.
- * Note that no garbage is created if no listeners are registered.
- * The recommended code sequence for notifying all registered listeners
- * of say, <code>FooListener.eventHappened</code>, is:
- * <pre>
- * Object[] listeners = myListenerList.getListeners();
- * for (int i = 0; i < listeners.length; ++i) {
- * ((FooListener) listeners[i]).eventHappened(event);
- * }
- * </pre>
- * </p>
- */
-public class ListenerList {
- /**
- * The initial capacity of the list. Always >= 1.
- */
- private int capacity;
-
- /**
- * The current number of listeners.
- * Maintains invariant: 0 <= size <= listeners.length.
- */
- private int size;
-
- /**
- * The list of listeners. Initially <code>null</code> but initialized
- * to an array of size capacity the first time a listener is added.
- * Maintains invariant: listeners != null IFF size != 0
- */
- private Object[] listeners = null;
-
- /**
- * The empty array singleton instance, returned by getListeners()
- * when size == 0.
- */
- private static final Object[] EmptyArray = new Object[0];
-
- /**
- * Creates a listener list with an initial capacity of 3.
- */
- public ListenerList() {
- this(3);
- }
-
- /**
- * Creates a listener list with the given initial capacity.
- *
- * @param capacity the number of listeners which this list can initially accept
- * without growing its internal representation; must be at least 1
- */
- public ListenerList(int capacity) {
- Assert.isTrue(capacity >= 1);
- this.capacity = capacity;
- }
-
- /**
- * Adds the given listener to this list. Has no effect if an identical listener
- * is already registered.
- *
- * @param listener the listener
- */
- public void add(Object listener) {
- Assert.isNotNull(listener);
- if (size == 0) {
- listeners = new Object[capacity];
- } else {
- // check for duplicates using identity
- for (int i = 0; i < size; ++i) {
- if (listeners[i] == listener) {
- return;
- }
- }
- // grow array if necessary
- if (size == listeners.length) {
- System.arraycopy(listeners, 0, listeners = new Object[size * 2 + 1], 0, size);
- }
- }
- listeners[size++] = listener;
- }
-
- /**
- * Removes all listeners from this list.
- */
- public void clear() {
- size = 0;
- listeners = null;
- }
-
- /**
- * Returns an array containing all the registered listeners.
- * The resulting array is unaffected by subsequent adds or removes.
- * If there are no listeners registered, the result is an empty array
- * singleton instance (no garbage is created).
- * Use this method when notifying listeners, so that any modifications
- * to the listener list during the notification will have no effect on the
- * notification itself.
- *
- * @return the list of registered listeners
- */
- public Object[] getListeners() {
- if (size == 0)
- return EmptyArray;
- Object[] result = new Object[size];
- System.arraycopy(listeners, 0, result, 0, size);
- return result;
- }
-
- /**
- * Returns whether this listener list is empty.
- *
- * @return <code>true</code> if there are no registered listeners, and
- * <code>false</code> otherwise
- */
- public boolean isEmpty() {
- return size == 0;
- }
-
- /**
- * Removes the given listener from this list. Has no effect if an identical
- * listener was not already registered.
- *
- * @param listener the listener
- */
- public void remove(Object listener) {
- Assert.isNotNull(listener);
- for (int i = 0; i < size; ++i) {
- if (listeners[i] == listener) {
- if (size == 1) {
- listeners = null;
- size = 0;
- } else {
- System.arraycopy(listeners, i + 1, listeners, i, --size - i);
- listeners[size] = null;
- }
- return;
- }
- }
- }
-
- /**
- * Returns the number of registered listeners.
- *
- * @return the number of registered listeners
- */
- public int size() {
- return size;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/OpenStrategy.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/OpenStrategy.java
deleted file mode 100644
index 1d1d9b8..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/OpenStrategy.java
+++ /dev/null
@@ -1,382 +0,0 @@
-package org.eclipse.jface.util;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.TableTree;
-import org.eclipse.swt.custom.TableTreeItem;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Point;
-/**
- * Implementation of single-click and double-click strategies.
- * <p>
- * Usage:
- * <pre>
- * OpenStrategy handler = new OpenStrategy(control);
- * handler.addOpenListener(new IOpenEventListener() {
- * public void handleOpen(SelectionEvent e) {
- * ... // code to handle the open event.
- * }
- * });
- * </pre>
- * </p>
- */
-public class OpenStrategy {
- /**
- * Default behavior. Double click to open the item.
- */
- public static final int DOUBLE_CLICK = 0;
- /**
- * Single click will open the item.
- */
- public static final int SINGLE_CLICK = 1;
- /**
- * Hover will select the item.
- */
- public static final int SELECT_ON_HOVER = 1 << 1;
- /**
- * Open item when using arrow keys
- */
- public static final int ARROW_KEYS_OPEN = 1 << 2;
- /** A single click will generate
- * an open event but key arrows will not do anything.
- *
- * @deprecated
- */
- public static final int NO_TIMER = SINGLE_CLICK;
- /** A single click will generate an open
- * event and key arrows will generate an open event after a
- * small time.
- *
- * @deprecated
- */
- public static final int FILE_EXPLORER = SINGLE_CLICK | ARROW_KEYS_OPEN;
- /** Pointing to an item will change the selection
- * and a single click will gererate an open event
- *
- * @deprecated
- */
- public static final int ACTIVE_DESKTOP = SINGLE_CLICK | SELECT_ON_HOVER;
-
- // Time used in FILE_EXPLORER and ACTIVE_DESKTOP
- private static final int TIME = 500;
-
- /* SINGLE_CLICK or DOUBLE_CLICK;
- * In case of SINGLE_CLICK, the bits SELECT_ON_HOVER and ARROW_KEYS_OPEN
- * my be set as well. */
- private static int CURRENT_METHOD = DOUBLE_CLICK;
-
- private Listener eventHandler;
-
- private ListenerList openEventListeners = new ListenerList(1);
- private ListenerList selectionEventListeners = new ListenerList(1);
- private ListenerList postSelectionEventListeners = new ListenerList(1);
-
- public OpenStrategy(Control control) {
- initializeHandler(control.getDisplay());
- addListener(control);
- }
- /**
- * Adds an IOpenEventListener to the collection of openEventListeners
- */
- public void addOpenListener(IOpenEventListener listener) {
- openEventListeners.add(listener);
- }
- /**
- * Removes an IOpenEventListener to the collection of openEventListeners
- */
- public void removeOpenListener(IOpenEventListener listener) {
- openEventListeners.remove(listener);
- }
- /**
- * Adds an SelectionListener to the collection of selectionEventListeners
- */
- public void addSelectionListener(SelectionListener listener) {
- selectionEventListeners.add(listener);
- }
- /**
- * Removes an SelectionListener to the collection of selectionEventListeners
- */
- public void removeSelectionListener(SelectionListener listener) {
- selectionEventListeners.remove(listener);
- }
- /**
- * Adds an SelectionListener to the collection of selectionEventListeners
- */
- public void addPostSelectionListener(SelectionListener listener) {
- postSelectionEventListeners.add(listener);
- }
- /**
- * Removes an SelectionListener to the collection of selectionEventListeners
- */
- public void removePostSelectionListener(SelectionListener listener) {
- postSelectionEventListeners.remove(listener);
- }
- /**
- * Returns the current used single/double-click method
- *
- * This method is internal to the framework; it should not be implemented outside
- * the framework.
- */
- public static int getOpenMethod() {
- return CURRENT_METHOD;
- }
- /**
- * Set the current used single/double-click method.
- *
- * This method is internal to the framework; it should not be implemented outside
- * the framework.
- */
- public static void setOpenMethod(int method) {
- if(method == DOUBLE_CLICK) {
- CURRENT_METHOD = method;
- return;
- }
- if((method & SINGLE_CLICK) == 0)
- throw new IllegalArgumentException("Invalid open mode"); //$NON-NLS-1$
- if((method & (SINGLE_CLICK | SELECT_ON_HOVER | ARROW_KEYS_OPEN)) == 0)
- throw new IllegalArgumentException("Invalid open mode"); //$NON-NLS-1$
- CURRENT_METHOD = method;
- }
- /**
- * Return true if editors should be activated when opened.
- */
- public static boolean activateOnOpen() {
- return getOpenMethod() == DOUBLE_CLICK;
- }
- /*
- * Adds all needed listener to the control in order to implement
- * single-click/double-click strategies.
- */
- private void addListener(Control c) {
- c.addListener(SWT.MouseEnter,eventHandler);
- c.addListener(SWT.MouseExit,eventHandler);
- c.addListener(SWT.MouseMove,eventHandler);
- c.addListener(SWT.MouseDown, eventHandler);
- c.addListener(SWT.MouseUp, eventHandler);
- c.addListener(SWT.KeyDown, eventHandler);
- c.addListener(SWT.Selection, eventHandler);
- c.addListener(SWT.DefaultSelection, eventHandler);
- }
- /*
- * Fire the selection event to all selectionEventListeners
- */
- private void fireSelectionEvent(SelectionEvent e) {
- if(e.item != null && e.item.isDisposed())
- return;
- Object l[] = selectionEventListeners.getListeners();
- for (int i = 0; i < l.length; i++) {
- ((SelectionListener)l[i]).widgetSelected(e);
- }
- }
- /*
- * Fire the default selection event to all selectionEventListeners
- */
- private void fireDefaultSelectionEvent(SelectionEvent e) {
- Object l[] = selectionEventListeners.getListeners();
- for (int i = 0; i < l.length; i++) {
- ((SelectionListener)l[i]).widgetDefaultSelected(e);
- }
- }
- /*
- * Fire the post selection event to all postSelectionEventListeners
- */
- private void firePostSelectionEvent(SelectionEvent e) {
- if(e.item != null && e.item.isDisposed())
- return;
- Object l[] = postSelectionEventListeners.getListeners();
- for (int i = 0; i < l.length; i++) {
- ((SelectionListener)l[i]).widgetSelected(e);
- }
- }
- /*
- * Fire the open event to all openEventListeners
- */
- private void fireOpenEvent(SelectionEvent e) {
- if(e.item != null && e.item.isDisposed())
- return;
- Object l[] = openEventListeners.getListeners();
- for (int i = 0; i < l.length; i++) {
- ((IOpenEventListener)l[i]).handleOpen(e);
- }
- }
-
- //Initialize event handler.
- private void initializeHandler(final Display display) {
- eventHandler = new Listener() {
- boolean timerStarted = false;
- Event mouseUpEvent = null;
- Event mouseMoveEvent = null;
- SelectionEvent selectionPendent = null;
- boolean enterKeyDown = false;
- SelectionEvent defaultSelectionPendent = null;
-
- boolean arrowKeyDown = false;
- final int[] count = new int[1];
-
- long startTime = System.currentTimeMillis();
-
- public void handleEvent(final Event e) {
- if(e.type == SWT.DefaultSelection) {
- SelectionEvent event = new SelectionEvent(e);
- fireDefaultSelectionEvent(event);
- if(CURRENT_METHOD == DOUBLE_CLICK) {
- fireOpenEvent(event);
- } else {
- if(enterKeyDown) {
- fireOpenEvent(event);
- enterKeyDown = false;
- defaultSelectionPendent = null;
- } else {
- defaultSelectionPendent = event;
- }
- }
- return;
- }
-
- switch (e.type) {
- case SWT.MouseEnter:
- case SWT.MouseExit:
- mouseUpEvent = null;
- mouseMoveEvent = null;
- selectionPendent = null;
- break;
- case SWT.MouseMove:
- if((CURRENT_METHOD & SELECT_ON_HOVER) == 0)
- return;
- if(e.stateMask != 0)
- return;
- if(e.widget.getDisplay().getFocusControl() != e.widget)
- return;
- mouseMoveEvent = e;
- final Runnable runnable[] = new Runnable[1];
- runnable[0] = new Runnable() {
- public void run() {
- long time = System.currentTimeMillis();
- int diff = (int)(time - startTime);
- if(diff <= TIME) {
- display.timerExec(diff * 2 / 3,runnable[0]);
- } else {
- timerStarted = false;
- setSelection(mouseMoveEvent);
- }
- }
- };
- startTime = System.currentTimeMillis();
- if(!timerStarted) {
- timerStarted = true;
- display.timerExec(TIME * 2 / 3,runnable[0]);
- }
- break;
- case SWT.MouseDown :
- arrowKeyDown = false;
- break;
- case SWT.MouseUp:
- mouseMoveEvent = null;
- if((e.button != 1) || ((e.stateMask & ~SWT.BUTTON1) != 0))
- return;
- if(selectionPendent != null)
- mouseSelectItem(selectionPendent);
- else
- mouseUpEvent = e;
- break;
- case SWT.KeyDown:
- mouseMoveEvent = null;
- mouseUpEvent = null;
- arrowKeyDown = ((e.keyCode == SWT.ARROW_UP) || (e.keyCode == SWT.ARROW_DOWN)) && e.stateMask == 0;
- if(e.character == SWT.CR) {
- if(defaultSelectionPendent != null) {
- fireOpenEvent(new SelectionEvent(e));
- enterKeyDown = false;
- defaultSelectionPendent = null;
- } else {
- enterKeyDown = true;
- }
- }
- break;
- case SWT.Selection:
- SelectionEvent event = new SelectionEvent(e);
- fireSelectionEvent(event);
- mouseMoveEvent = null;
- if (mouseUpEvent != null)
- mouseSelectItem(event);
- else
- selectionPendent = event;
- count[0]++;
- // In the case of arrowUp/arrowDown when in the arrowKeysOpen mode, we
- // want to delay any selection until the last arrowDown/Up occurs. This
- // handles the case where the user presses arrowDown/Up successively.
- // We only want to open an editor for the last selected item.
- display.asyncExec(new Runnable() {
- public void run() {
- if (arrowKeyDown) {
- display.timerExec(TIME, new Runnable() {
- int id = count[0];
- public void run() {
- if (id == count[0]) {
- firePostSelectionEvent(new SelectionEvent(e));
- if((CURRENT_METHOD & ARROW_KEYS_OPEN) != 0)
- fireOpenEvent(new SelectionEvent(e));
- }
- }
- });
- } else {
- firePostSelectionEvent(new SelectionEvent(e));
- }
- }
- });
- break;
- }
- }
-
- void mouseSelectItem(SelectionEvent e) {
- if((CURRENT_METHOD & SINGLE_CLICK) != 0)
- fireOpenEvent(e);
- mouseUpEvent = null;
- selectionPendent = null;
- }
- void setSelection(Event e) {
- if(e == null)
- return;
- Widget w = e.widget;
- if(w.isDisposed())
- return;
-
- SelectionEvent selEvent = new SelectionEvent(e);
-
- /*ISSUE: May have to create a interface with method:
- setSelection(Point p) so that user's custom widgets
- can use this class. If we keep this option. */
- if(w instanceof Tree) {
- Tree tree = (Tree)w;
- TreeItem item = tree.getItem(new Point(e.x,e.y));
- if(item != null)
- tree.setSelection(new TreeItem[]{item});
- selEvent.item = item;
- } else if(w instanceof Table) {
- Table table = (Table)w;
- TableItem item = table.getItem(new Point(e.x,e.y));
- if(item != null)
- table.setSelection(new TableItem[]{item});
- selEvent.item = item;
- } else if(w instanceof TableTree) {
- TableTree table = (TableTree)w;
- TableTreeItem item = table.getItem(new Point(e.x,e.y));
- if(item != null)
- table.setSelection(new TableTreeItem[]{item});
- selEvent.item = item;
- } else {
- return;
- }
- if(selEvent.item == null)
- return;
- fireSelectionEvent(selEvent);
- firePostSelectionEvent(selEvent);
- }
- };
- }
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/PropertyChangeEvent.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/PropertyChangeEvent.java
deleted file mode 100644
index 445e2ad..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/PropertyChangeEvent.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.eclipse.jface.util;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.EventObject;
-
-/**
- * An event object describing a change to a named property.
- * <p>
- * This concrete class was designed to be instantiated, but may
- * also be subclassed if required.
- * </p>
- * <p>
- * The JFace frameworks contain classes that report property
- * change events for internal state changes that may be of interest
- * to external parties. A special listener interface
- * (<code>IPropertyChangeListener</code>) is defined for this purpose,
- * and a typical class allow listeners to be registered via
- * an <code>addPropertyChangeListener</code> method.
- * </p>
- *
- * @see IPropertyChangeListener
- */
-public class PropertyChangeEvent extends EventObject {
-
- /**
- * The name of the changed property.
- */
- private String propertyName;
-
- /**
- * The old value of the changed property, or <code>null</code> if
- * not known or not relevant.
- */
- private Object oldValue;
-
- /**
- * The new value of the changed property, or <code>null</code> if
- * not known or not relevant.
- */
- private Object newValue;
-/**
- * Creates a new property change event.
- *
- * @param source the object whose property has changed
- * @param property the property that has changed (must not be <code>null</code>)
- * @param oldValue the old value of the property, or <code>null</code> if none
- * @param newValue the new value of the property, or <code>null</code> if none
- */
-public PropertyChangeEvent(Object source, String property, Object oldValue, Object newValue) {
- super(source);
- Assert.isNotNull(property);
- this.propertyName = property;
- this.oldValue = oldValue;
- this.newValue = newValue;
-}
-/**
- * Returns the new value of the property.
- *
- * @return the new value, or <code>null</code> if not known
- * or not relevant
- */
-public Object getNewValue() {
- return newValue;
-}
-/**
- * Returns the old value of the property.
- *
- * @return the old value, or <code>null</code> if not known
- * or not relevant
- */
-public Object getOldValue() {
- return oldValue;
-}
-/**
- * Returns the name of the property that changed.
- * <p>
- * Warning: there is no guarantee that the property name returned
- * is a constant string. Callers must compare property names using
- * equals, not ==.
- * </p>
- *
- * @return the name of the property that changed
- */
-public String getProperty() {
- return propertyName;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/package.html b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/package.html
deleted file mode 100644
index ef2e922..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/package.html
+++ /dev/null
@@ -1,15 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides useful building blocks used throughout JFace,
-including property change events, a listener list implementation, and runtime
-checked assertions.
-<br>
-</body>
-</html>
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java
deleted file mode 100644
index e68d5de..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java
+++ /dev/null
@@ -1,1329 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List; // Otherwise ambiguous
-
-/**
- * Abstract base implementation for tree-structure-oriented viewers
- * (trees and table trees).
- * <p>
- * Nodes in the tree can be in either an expanded or a collapsed state,
- * depending on whether the children on a node are visible. This class
- * introduces public methods for controlling the expanding and collapsing
- * of nodes.
- * </p>
- * <p>
- * Content providers for abstract tree viewers must implement the <code>ITreeContentProvider</code>
- * interface.
- * </p>
- *
- * @see TreeViewer
- * @see TableTreeViewer
- */
-public abstract class AbstractTreeViewer extends StructuredViewer {
-
- /**
- * Constant indicating that all levels of the tree should be expanded or collapsed.
- *
- * @see #expandToLevel
- * @see #collapseToLevel
- */
- public static final int ALL_LEVELS= -1;
-
- /**
- * List of registered tree listeners (element type: <code>TreeListener</code>).
- */
- private ListenerList treeListeners = new ListenerList(1);
-
- /**
- * The level to which the tree is automatically expanded each time
- * the viewer's input is changed (that is, by <code>setInput</code>).
- * A value of 0 means that auto-expand is off.
- *
- * @see setAutoExpandLevel
- */
- private int expandToLevel = 0;
-/**
- * Creates an abstract tree viewer. The viewer has no input, no content provider, a
- * default label provider, no sorter, no filters, and has auto-expand turned off.
- */
-protected AbstractTreeViewer() {
-}
-/**
- * Adds the given child elements to this viewer as children of the given parent element.
- * If this viewer does not have a sorter, the elements are added at the end of the
- * parent's list of children in the order given; otherwise, the elements are inserted
- * at the appropriate positions.
- * <p>
- * This method should be called (by the content provider) when elements
- * have been added to the model, in order to cause the viewer to accurately
- * reflect the model. This method only affects the viewer, not the model.
- * </p>
- *
- * @param parentElement the parent element
- * @param childElements the child elements to add
- */
-public void add(Object parentElement, Object[] childElements) {
- Assert.isNotNull(parentElement);
- Assert.isNotNull(childElements);
- Widget widget = findItem(parentElement);
- // If parent hasn't been realized yet, just ignore the add.
- if (widget == null)
- return;
-
- Control tree = getControl();
-
- // optimization!
- // if the widget is not expanded we just invalidate the subtree
- if (widget instanceof Item) {
- Item ti= (Item) widget;
- if (!getExpanded(ti)) {
- boolean needDummy = isExpandable(parentElement);
- boolean haveDummy = false;
- // remove all children
- Item[] items= getItems(ti);
- for (int i = 0; i < items.length; i++) {
- if (items[i].getData() != null) {
- disassociate(items[i]);
- items[i].dispose();
- }
- else {
- if (needDummy && !haveDummy) {
- haveDummy = true;
- }
- else {
- items[i].dispose();
- }
- }
- }
- // append a dummy if necessary
- if (needDummy && !haveDummy) {
- newItem(ti, SWT.NULL, -1);
- } else {
- // XXX: Workaround (PR missing)
- tree.redraw();
- }
-
- return;
- }
- }
-
- if (childElements.length > 0) {
- List children = Arrays.asList(getSortedChildren(parentElement));
- for (int cc = 0; cc < childElements.length; cc++) {
-
- int ix = children.indexOf(childElements[cc]);
- if (ix < 0) // child not found: ignore
- continue;
-
- Item[] ch = getChildren(widget);
- if (ch.length + 1 == children.size()) {
- createTreeItem(widget, childElements[cc], ix); // insert child at position
- if (ch.length == 0) {
- //System.out.println("WORKAROUND setRedraw");
- tree.setRedraw(false); // WORKAROUND
- tree.setRedraw(true); // WORKAROUND
- }
- continue;
- }
-
- // couldn't handle this child:
- // skip other children and do general case
- // call refresh rather than internalRefresh to preserve selection
- refresh(parentElement);
- return;
- }
- }
-}
-/**
- * Adds the given child element to this viewer as a child of the given parent element.
- * If this viewer does not have a sorter, the element is added at the end of the
- * parent's list of children; otherwise, the element is inserted at the appropriate position.
- * <p>
- * This method should be called (by the content provider) when a single element
- * has been added to the model, in order to cause the viewer to accurately
- * reflect the model. This method only affects the viewer, not the model.
- * Note that there is another method for efficiently processing the simultaneous
- * addition of multiple elements.
- * </p>
- *
- * @param parentElement the parent element
- * @param childElement the child element
- */
-public void add(Object parentElement, Object childElement) {
- add(parentElement, new Object[] { childElement });
-}
-/**
- * Adds the given SWT selection listener to the given SWT control.
- *
- * @param control the SWT control
- * @param listener the SWT selection listener
- *
- * @deprecated
- */
-protected void addSelectionListener(Control control, SelectionListener listener) {}
-/**
- * Adds a listener for expand and collapse events in this viewer.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a tree viewer listener
- */
-public void addTreeListener(ITreeViewerListener listener) {
- treeListeners.add(listener);
-}
-/**
- * Adds the given SWT tree listener to the given SWT control.
- *
- * @param control the SWT control
- * @param listener the SWT tree listener
- */
-protected abstract void addTreeListener(Control control, TreeListener listener);
-/**
- * Collapses all nodes of the viewer's tree, starting with the root.
- * This method is equivalent to <code>collapseToLevel(ALL_LEVELS)</code>.
- */
-public void collapseAll() {
- collapseToLevel(getRoot(), ALL_LEVELS);
-}
-/**
- * Collapses the subtree rooted at the given element to the given level.
- *
- * @param element the element
- * @param level non-negative level, or <code>ALL_LEVELS</code> to collapse
- * all levels of the tree
- */
-public void collapseToLevel(Object element, int level) {
- Widget w = findItem(element);
- if (w != null)
- internalCollapseToLevel(w, level);
-}
-/**
- * Creates all children for the given widget.
- * <p>
- * The default implementation of this framework method assumes
- * that <code>widget.getData()</code> returns the element corresponding
- * to the node. Note: the node is not visually expanded! You may have to
- * call <code>parent.setExpanded(true)</code>.
- * </p>
- *
- * @param widget the widget
- */
-protected void createChildren(Widget widget) {
- Item[] tis = getChildren(widget);
- if (tis != null && tis.length > 0) {
- Object data = tis[0].getData();
- if (data != null)
- return; // children already there!
-
- // dummies are identified by not having client data
- // assert that there is only a single child!
- //Assert.isTrue(tis.length == 1);
- //
- //tis[0].dispose(); // remove dummy
-
- // fix for PR 1FW89L7:
- // don't complain and remove all "dummies" ...
- for (int i = 0; i < tis.length; i++)
- tis[i].dispose();
- }
- Object d = widget.getData();
- if (d != null) {
- Object parentElement = d;
- Object[] children = getSortedChildren(parentElement);
- for (int i = 0; i < children.length; i++) {
- createTreeItem(widget, children[i], -1);
- }
- }
-}
-/**
- * Creates a single item for the given parent and synchronizes it with
- * the given element.
- *
- * @param parent the parent widget
- * @param element the element
- * @param index if non-negative, indicates the position to insert the item
- * into its parent
- */
-protected void createTreeItem(Widget parent, Object element, int index) {
- Item item = newItem(parent, SWT.NULL, index);
- updateItem(item, element);
- updatePlus(item, element);
-}
-/**
- * The <code>AbstractTreeViewer</code> implementation of this method
- * also recurses over children of the corresponding element.
- */
-protected void disassociate(Item item) {
- super.disassociate(item);
- // recursively unmapping the items is only required when
- // the hash map is used. In the other case disposing
- // an item will recursively dispose its children.
- if (usingElementMap())
- disassociateChildren(item);
-}
-/**
- * Disassociates the children of the given SWT item from their
- * corresponding elements.
- *
- * @param item the widget
- */
-private void disassociateChildren(Item item) {
- Item[] items = getChildren(item);
- for (int i = 0; i < items.length; i++) {
- if (items[i].getData() != null)
- disassociate(items[i]);
- }
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected Widget doFindInputItem(Object element) {
- // compare with root
- Object root= getRoot();
- if (root == null)
- return null;
-
- if (root.equals(element))
- return getControl();
- return null;
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected Widget doFindItem(Object element) {
- // compare with root
- Object root= getRoot();
- if (root == null)
- return null;
-
- Item[] items= getChildren(getControl());
- if (items != null) {
- for (int i= 0; i < items.length; i++) {
- Widget o= internalFindItem(items[i], element);
- if (o != null)
- return o;
- }
- }
- return null;
-}
-/**
- * Copies the attributes of the given element into the given SWT item.
- *
- * @param item the SWT item
- * @param element the element
- */
-protected abstract void doUpdateItem(Item item, Object element);
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected void doUpdateItem(Widget widget, Object element, boolean fullMap) {
- if (widget instanceof Item) {
- Item item = (Item) widget;
-
- // ensure that backpointer is correct
- if (fullMap) {
-
- Object data = widget.getData();
- if (data != null && data != element && data.equals(element)) {
- // workaround for PR 1FV62BT
- // assumption: elements are equal but not identical
- // -> remove from map but don't touch children
- unmapElement(data, item);
- item.setData(element);
- mapElement(element, item);
- } else {
- // recursively disassociate all
- associate(element, item);
- }
-
- } else {
- item.setData(element);
- mapElement(element, item);
- }
-
- // update icon and label
- doUpdateItem(item,element);
- }
-}
-/**
- * Expands all nodes of the viewer's tree, starting with the root.
- * This method is equivalent to <code>expandToLevel(ALL_LEVELS)</code>.
- */
-public void expandAll() {
- expandToLevel(ALL_LEVELS);
-}
-/**
- * Expands the root of the viewer's tree to the given level.
- *
- * @param level non-negative level, or <code>ALL_LEVELS</code> to expand
- * all levels of the tree
- */
-public void expandToLevel(int level) {
- expandToLevel(getRoot(), level);
-}
-/**
- * Expands all ancestors of the given element so that the given element
- * becomes visible in this viewer's tree control, and then expands the
- * subtree rooted at the given element to the given level.
- *
- * @param element the element
- * @param level non-negative level, or <code>ALL_LEVELS</code> to expand
- * all levels of the tree
- */
-public void expandToLevel(Object element, int level) {
- Widget w = internalExpand(element, true);
- if (w != null)
- internalExpandToLevel(w, level);
-}
-/**
- * Fires a tree collapsed event.
- * Only listeners registered at the time this method is called are notified.
- *
- * @param event the tree expansion event
- *
- * @see ITreeViewerListener#treeCollapsed
- */
-protected void fireTreeCollapsed(TreeExpansionEvent event) {
- Object[] listeners = treeListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ITreeViewerListener) listeners[i]).treeCollapsed(event);
- }
-}
-/**
- * Fires a tree expanded event.
- * Only listeners registered at the time this method is called are notified.
- *
- * @param event the tree expansion event
- *
- * @see ITreeViewerListener#treeExpanded
- */
-protected void fireTreeExpanded(TreeExpansionEvent event) {
- Object[] listeners = treeListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ITreeViewerListener) listeners[i]).treeExpanded(event);
- }
-}
-/**
- * Returns the auto-expand level.
- *
- * @return non-negative level, or <code>EXPAND_ALL</code> if
- * all levels of the tree are expanded automatically
- * @see #setAutoExpandLevel
- */
-public int getAutoExpandLevel() {
- return expandToLevel;
-}
-/**
- * Returns the SWT child items for the given SWT widget.
- *
- * @param widget the widget
- * @return the child items
- */
-protected abstract Item[] getChildren(Widget widget);
-/**
- * Returns whether the given SWT item is expanded or collapsed.
- *
- * @param item the item
- * @return <code>true</code> if the item is considered expanded
- * and <code>false</code> if collapsed
- */
-protected abstract boolean getExpanded(Item item);
-/**
- * Returns a list of elements corresponding to expanded nodes in this
- * viewer's tree, including currently hidden ones that are marked as
- * expanded but are under a collapsed ancestor.
- * <p>
- * This method is typically used when preserving the interesting
- * state of a viewer; <code>setExpandedElements</code> is used during the restore.
- * </p>
- *
- * @return the array of expanded elements
- *
- * @see #setExpandedElements
- */
-public Object[] getExpandedElements() {
- ArrayList v= new ArrayList();
- internalCollectExpanded(v, getControl());
- return v.toArray();
-}
-/**
- * Returns whether the node corresponding to the given element is expanded or collapsed.
- *
- * @param element the element
- * @return <code>true</code> if the node is expanded, and <code>false</code> if collapsed
- */
-public boolean getExpandedState(Object element) {
- Widget item = findItem(element);
- if (item instanceof Item)
- return getExpanded((Item) item);
- return false;
-}
-/**
- * Returns the number of child items of the given SWT control.
- *
- * @param control the control
- * @return the number of children
- */
-protected abstract int getItemCount(Control control);
-/**
- * Returns the number of child items of the given SWT item.
- *
- * @param item the item
- * @return the number of children
- */
-protected abstract int getItemCount(Item item);
-/**
- * Returns the child items of the given SWT item.
- *
- * @param item the item
- * @return the child items
- */
-protected abstract Item[] getItems(Item item);
-/**
- * Returns the item after the given item in the tree, or
- * <code>null</code> if there is no next item.
- *
- * @param item the item
- * @param includeChildren <code>true</code> if the children are
- * considered in determining which item is next, and <code>false</code>
- * if subtrees are ignored
- * @return the next item, or <code>null</code> if none
- */
-protected Item getNextItem(Item item, boolean includeChildren) {
- if (item == null) {
- return null;
- }
- if (includeChildren && getExpanded(item)) {
- Item[] children = getItems(item);
- if (children != null && children.length > 0) {
- return children[0];
- }
- }
-
- //next item is either next sibling or next sibling of first
- //parent that has a next sibling.
- Item parent = getParentItem(item);
- if (parent == null) {
- return null;
- }
- Item[] siblings = getItems(parent);
- if (siblings != null && siblings.length <= 1) {
- return getNextItem(parent, false);
- }
- for (int i = 0; i < siblings.length; i++) {
- if (siblings[i] == item && i < (siblings.length - 1)) {
- return siblings[i+1];
- }
- }
- return getNextItem(parent, false);
-}
-/**
- * Returns the parent item of the given item in the tree, or
- * <code>null</code> if there is parent item.
- *
- * @param item the item
- * @return the parent item, or <code>null</code> if none
- */
-protected abstract Item getParentItem(Item item);
-/**
- * Returns the item before the given item in the tree, or
- * <code>null</code> if there is no previous item.
- *
- * @param item the item
- * @return the previous item, or <code>null</code> if none
- */
-protected Item getPreviousItem(Item item) {
- //previous item is either right-most visible descendent of previous
- //sibling or parent
- Item parent = getParentItem(item);
- if (parent == null) {
- return null;
- }
- Item[] siblings = getItems(parent);
- if (siblings.length == 0 || siblings[0] == item) {
- return parent;
- }
- Item previous = siblings[0];
- for (int i = 1; i < siblings.length; i++) {
- if (siblings[i] == item) {
- return rightMostVisibleDescendent(previous);
- }
- previous = siblings[i];
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected Object[] getRawChildren(Object parent) {
- if (parent != null) {
- if (parent.equals(getRoot()))
- return super.getRawChildren(parent);
- Object[] result = ((ITreeContentProvider) getContentProvider()).getChildren(parent);
- if (result != null)
- return result;
- }
- return new Object[0];
-}
-/**
- * Returns all selected items for the given SWT control.
- *
- * @param control the control
- * @return the list of selected items
- */
-protected abstract Item[] getSelection(Control control);
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected List getSelectionFromWidget() {
- Widget[] items = getSelection(getControl());
- ArrayList list = new ArrayList(items.length);
- for (int i = 0; i < items.length; i++) {
- Widget item = items[i];
- Object e = item.getData();
- if (e != null)
- list.add(e);
- }
- return list;
-}
-/**
- * Handles a tree collapse event from the SWT widget.
- *
- * @param event the SWT tree event
- */
-protected void handleTreeCollapse(TreeEvent event) {
- if (event.item.getData() != null) {
- fireTreeCollapsed(new TreeExpansionEvent(this, event.item.getData()));
- }
-}
-/**
- * Handles a tree expand event from the SWT widget.
- *
- * @param event the SWT tree event
- */
-protected void handleTreeExpand(TreeEvent event) {
- createChildren(event.item);
- if (event.item.getData() != null) {
- fireTreeExpanded(new TreeExpansionEvent(this, event.item.getData()));
- }
-}
-/* (non-Javadoc)
- * Method declared on Viewer.
- */
-protected void hookControl(Control control) {
- super.hookControl(control);
- addTreeListener(control,new TreeListener() {
- public void treeExpanded(TreeEvent event) {
- handleTreeExpand(event);
- }
- public void treeCollapsed(TreeEvent event) {
- handleTreeCollapse(event);
- }
- });
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- * Builds the initial tree and handles the automatic expand feature.
- */
-protected void inputChanged(Object input, Object oldInput) {
- preservingSelection(new Runnable() {
- public void run() {
- Control tree = getControl();
- boolean useRedraw = true; // (size > REDRAW_THRESHOLD) || (table.getItemCount() > REDRAW_THRESHOLD);
- if (useRedraw)
- tree.setRedraw(false);
- removeAll(tree);
- tree.setData(getRoot());
- createChildren(tree);
- internalExpandToLevel(tree, expandToLevel);
- if (useRedraw)
- tree.setRedraw(true);
- }
- });
-}
-/**
- * Recursively collapses the subtree rooted at the given widget to the
- * given level.
- * <p>
- * </p>
- * Note that the default implementation of this method does not call
- * <code>setRedraw</code>.
- *
- * @param widget the widget
- * @param level non-negative level, or <code>ALL_LEVELS</code> to collapse
- * all levels of the tree
- */
-protected void internalCollapseToLevel(Widget widget, int level) {
- if (level == ALL_LEVELS || level > 0) {
-
- if (widget instanceof Item)
- setExpanded((Item) widget, false);
-
- if (level == ALL_LEVELS || level > 1) {
- Item[] children = getChildren(widget);
- if (children != null) {
- int nextLevel = (level == ALL_LEVELS ? ALL_LEVELS : level - 1);
- for (int i = 0; i < children.length; i++)
- internalCollapseToLevel(children[i], nextLevel);
- }
- }
- }
-}
-/**
- * Recursively collects all expanded elements from the given widget.
- *
- * @param result a list (element type: <code>Object</code>) into which
- * to collect the elements
- * @param widget the widget
- */
-private void internalCollectExpanded(List result, Widget widget) {
- Item[] items = getChildren(widget);
- for (int i = 0; i < items.length; i++) {
- Item item = items[i];
- if (getExpanded(item)) {
- Object data = item.getData();
- if (data != null)
- result.add(data);
- }
- internalCollectExpanded(result, item);
- }
-}
-/**
- * Tries to create a path of tree items for the given element.
- * This method recursively walks up towards the root of the tree
- * and assumes that <code>getParent</code> returns the correct
- * parent of an element.
- *
- * @param element the element
- * @param expand <code>true</code> if all nodes on the path should be expanded,
- * and <code>false</code> otherwise
- */
-protected Widget internalExpand(Object element, boolean expand) {
-
- if (element == null)
- return null;
-
- Widget w= findItem(element);
- if (w == null) {
- if (element.equals(getRoot())) // stop at root
- return null;
- // my parent has to create me
- Object parent= ((ITreeContentProvider) getContentProvider()).getParent(element);
- if (parent != null) {
- Widget pw= internalExpand(parent, expand);
- if (pw != null) {
- // let my parent create me
- createChildren(pw);
- // expand parent and find me
- if (pw instanceof Item) {
- Item item= (Item)pw;
- if (expand)
- setExpanded(item, true);
- w= internalFindChild(item, element);
- }
- }
- }
- }
- return w;
-}
-/**
- * Recursively expands the subtree rooted at the given widget to the
- * given level.
- * <p>
- * </p>
- * Note that the default implementation of this method does not call
- * <code>setRedraw</code>.
- *
- * @param widget the widget
- * @param level non-negative level, or <code>ALL_LEVELS</code> to collapse
- * all levels of the tree
- */
-protected void internalExpandToLevel(Widget widget, int level) {
- if (level == ALL_LEVELS || level > 0) {
- createChildren(widget);
- if (widget instanceof Item)
- setExpanded((Item) widget, true);
- if (level == ALL_LEVELS || level > 1) {
- Item[] children = getChildren(widget);
- if (children != null) {
- int newLevel = (level == ALL_LEVELS ? ALL_LEVELS : level - 1);
- for (int i = 0; i < children.length; i++)
- internalExpandToLevel(children[i], newLevel);
- }
- }
- }
-}
-/**
- * Non-recursively tries to find the given element as a child of the given parent item.
- *
- * @param parent the parent item
- * @param element the element
- */
-private Widget internalFindChild(Item parent, Object element) {
- Item[] items = getChildren(parent);
- for (int i = 0; i < items.length; i++) {
- Item item = items[i];
- Object data = item.getData();
- if (data != null && data.equals(element))
- return item;
- }
- return null;
-}
-/**
- * Recursively tries to find the given element.
- *
- * @param parent the parent item
- * @param element the element
- */
-private Widget internalFindItem(Item parent, Object element) {
-
- // compare with node
- Object data= parent.getData();
- if (data != null) {
- if (data.equals(element))
- return parent;
- }
- // recurse over children
- Item[] items= getChildren(parent);
- for (int i= 0; i < items.length; i++) {
- Item item= items[i];
- Widget o= internalFindItem(item, element);
- if (o != null)
- return o;
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-public void internalRefresh(Object element) {
- // If element is null, do a full refresh.
- if (element == null) {
- internalRefresh(getControl(), getRoot(), true);
- return;
- }
- Widget item = findItem(element);
- if (item != null) {
- // pick up structure changes too
- internalRefresh(item, element, true);
- }
-}
-/**
- * Refreshes the tree starting at the given widget.
- *
- * @param widget the widget
- * @param element the element
- * @param doStruct <code>true</code> if structural changes are to be picked up,
- * and <code>false</code> if only label provider changes are of interest
- */
-private void internalRefresh(Widget widget, Object element, boolean doStruct) {
-
- if (widget instanceof Item) {
- if (doStruct) {
- updatePlus((Item)widget, element);
- }
- updateItem((Item)widget, element);
- }
-
- if (doStruct) {
- // pass null for children, to allow updateChildren to get them only if needed
- updateChildren(widget, element, null);
- }
- // recurse
- Item[] children= getChildren(widget);
- if (children != null) {
- for (int i= 0; i < children.length; i++) {
- Widget item= children[i];
- Object data= item.getData();
- if (data != null)
- internalRefresh(item, data, doStruct);
- }
- }
-}
-/**
- * Removes the given elements from this viewer.
- *
- * @param elements the elements to remove
- */
-private void internalRemove(Object[] elements) {
- Object input = getInput();
- Set parentItems = new HashSet(5);
- for (int i = 0; i < elements.length; ++i) {
- if (elements[i].equals(input)) {
- setInput(null);
- return;
- }
- Widget childItem = findItem(elements[i]);
- if (childItem instanceof Item) {
- Item parentItem = getParentItem((Item) childItem);
- if (parentItem != null) {
- parentItems.add(parentItem);
- }
- disassociate((Item) childItem);
- childItem.dispose();
- }
- }
- Control tree = getControl();
- for (Iterator i = parentItems.iterator(); i.hasNext();) {
- Item parentItem = (Item) i.next();
- if (!getExpanded(parentItem) && getItemCount(parentItem) == 0) {
- // append a dummy if necessary
- if (isExpandable(parentItem.getData())) {
- newItem(parentItem, SWT.NULL, -1);
- } else {
- // XXX: Workaround (PR missing)
- tree.redraw();
- }
- }
- }
-}
-/**
- * Sets the expanded state of all items to correspond to the given set of expanded elements.
- *
- * @param expandedElements the set (element type: <code>Object</code>) of elements which are expanded
- * @param widget the widget
- */
-private void internalSetExpanded(Set expandedElements, Widget widget) {
- Item[] items = getChildren(widget);
- for (int i = 0; i < items.length; i++) {
- Item item = items[i];
- Object data = item.getData();
- if (data != null) {
- boolean expanded = expandedElements.contains(data);
- if (expanded != getExpanded(item)) {
- if (expanded) {
- createChildren(item);
- }
- setExpanded(item, expanded);
- }
- }
- internalSetExpanded(expandedElements, item);
- }
-}
-/**
- * Return whether the tree node representing the given element
- * can be expanded.
- * <p>
- * The default implementation of this framework method calls
- * <code>hasChildren</code> on this viewer's content provider.
- * It may be overridden if necessary.
- * </p>
- *
- * @param element the element
- * @return <code>true</code> if the tree node representing
- * the given element can be expanded, or <code>false</code> if not
- */
-public boolean isExpandable(Object element) {
- return ((ITreeContentProvider) getContentProvider()).hasChildren(element);
-}
-/* (non-Javadoc)
- * Method declared on Viewer.
- */
-protected void labelProviderChanged() {
- // we have to walk the (visible) tree and update every item
- Control tree= getControl();
- tree.setRedraw(false);
- // don't pick up structure changes
- internalRefresh(tree, getRoot(), false);
- tree.setRedraw(true);
-}
-/**
- * Creates a new item.
- *
- * @param parent the parent widget
- * @param style SWT style bits
- * @param index if non-negative, indicates the position to insert the item
- * into its parent
- * @return the newly-created item
- */
-protected abstract Item newItem(Widget parent, int style, int index);
-/**
- * Removes the given elements from this viewer.
- * The selection is updated if required.
- * <p>
- * This method should be called (by the content provider) when elements
- * have been removed from the model, in order to cause the viewer to accurately
- * reflect the model. This method only affects the viewer, not the model.
- * </p>
- *
- * @param elements the elements to remove
- */
-public void remove(final Object[] elements) {
- preservingSelection(new Runnable() {
- public void run() {
- internalRemove(elements);
- }
- });
-}
-/**
- * Removes the given element from the viewer.
- * The selection is updated if necessary.
- * <p>
- * This method should be called (by the content provider) when a single element
- * has been removed from the model, in order to cause the viewer to accurately
- * reflect the model. This method only affects the viewer, not the model.
- * Note that there is another method for efficiently processing the simultaneous
- * removal of multiple elements.
- * </p>
- *
- * @param element the element
- */
-public void remove(Object element) {
- remove(new Object[] { element });
-}
-/**
- * Removes all items from the given control.
- *
- * @param control the control
- */
-protected abstract void removeAll(Control control);
-/**
- * Removes a listener for expand and collapse events in this viewer.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a tree viewer listener
- */
-public void removeTreeListener(ITreeViewerListener listener) {
- treeListeners.remove(listener);
-}
-/*
- * Non-Javadoc.
- * Method defined on StructuredViewer.
- */
-public void reveal(Object element) {
- Widget w = internalExpand(element, true);
- if (w instanceof Item)
- showItem((Item) w);
-}
-/**
- * Returns the rightmost visible descendent of the given item.
- * Returns the item itself if it has no children.
- *
- * @param item the item to compute the descendent of
- * @return the rightmost visible descendent or the item iself
- * if it has no children
- */
-private Item rightMostVisibleDescendent(Item item) {
- Item[] children = getItems(item);
- if (getExpanded(item) && children != null && children.length > 0) {
- return rightMostVisibleDescendent(children[children.length-1]);
- } else {
- return item;
- }
-}
-/* (non-Javadoc)
- * Method declared on Viewer.
- */
-public Item scrollDown(int x, int y) {
- Item current = (Item)getItem(x, y);
- if (current != null) {
- Item next = getNextItem(current, true);
- showItem(next == null ? current : next);
- return next;
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on Viewer.
- */
-public Item scrollUp(int x, int y) {
- Item current = (Item)getItem(x, y);
- if (current != null) {
- Item previous = getPreviousItem(current);
- showItem(previous == null ? current : previous);
- return previous;
- }
- return null;
-}
-/**
- * Sets the auto-expand level.
- * The value 0 means that the root's children are not visible;
- * 1 means that the root is expanded so that its children are visible,
- * but the root's grandchildren are not; and so on.
- * The value <code>EXPAND_ALL</code> means that all subtrees should be
- * expanded.
- *
- * @param level non-negative level, or <code>EXPAND_ALL</code> to expand
- * all levels of the tree
- */
-public void setAutoExpandLevel(int level) {
- expandToLevel = level;
-}
-/**
- * The <code>AbstractTreeViewer</code> implementation of this method
- * checks to ensure that the content provider is an <code>ITreeContentProvider</code>.
- */
-public void setContentProvider(IContentProvider provider) {
- Assert.isTrue(provider instanceof ITreeContentProvider);
- super.setContentProvider(provider);
-}
-/**
- * Sets the expand state of the given item.
- *
- * @param item the item
- * @param expand the expand state of the item
- */
-protected abstract void setExpanded(Item item, boolean expand);
-/**
- * Sets which nodes are expanded in this viewer's tree.
- * The given list contains the elements that are to be expanded;
- * all other nodes are to be collapsed.
- * <p>
- * This method is typically used when restoring the interesting
- * state of a viewer captured by an earlier call to <code>getExpandedElements</code>.
- * </p>
- *
- * @param elements the array of expanded elements
- * @see #getExpandedElements
- */
-public void setExpandedElements(Object[] elements) {
- Set expandedElements = new HashSet(elements.length*2+1);
- for (int i = 0; i < elements.length; ++i) {
- // Ensure item exists for element
- internalExpand(elements[i], false);
- expandedElements.add(elements[i]);
- }
- internalSetExpanded(expandedElements, getControl());
-}
-/**
- * Sets whether the node corresponding to the given element is expanded or collapsed.
- *
- * @param element the element
- * @param expanded <code>true</code> if the node is expanded, and <code>false</code> if collapsed
- */
-public void setExpandedState(Object element, boolean expanded) {
- Widget item = internalExpand(element, false);
- if (item instanceof Item) {
- if (expanded) {
- createChildren(item);
- }
- setExpanded((Item) item, expanded);
- }
-}
-/**
- * Sets the selection to the given list of items.
- *
- * @param items list of items (element type: <code>org.eclipse.swt.widgets.Item</code>)
- */
-protected abstract void setSelection(List items);
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected void setSelectionToWidget(List v, boolean reveal) {
- if (v == null) {
- setSelection(new ArrayList(0));
- return;
- }
- int size = v.size();
- List newSelection = new ArrayList(size);
- for (int i = 0; i < size; ++i) {
- // Use internalExpand since item may not yet be created. See 1G6B1AR.
- Widget w = internalExpand(v.get(i), true);
- if (w instanceof Item) {
- newSelection.add(w);
- }
- }
- setSelection(newSelection);
- if (reveal && newSelection.size() > 0) {
- showItem((Item) newSelection.get(0));
- }
-}
-/**
- * Shows the given item.
- *
- * @param item the item
- */
-protected abstract void showItem(Item item);
-/**
- * Updates the tree items to correspond to the child elements of the given parent element.
- * If null is passed for the children, this method obtains them (only if needed).
- *
- * @param widget the widget
- * @param parent the parent element
- * @param elementChildren the child elements, or null
- */
-protected void updateChildren(Widget widget, Object parent, Object[] elementChildren) {
- // optimization! prune collapsed subtrees
- if (widget instanceof Item) {
- Item ti= (Item) widget;
- if (!getExpanded(ti)) {
- // need a dummy node if element is expandable;
- // but try to avoid recreating the dummy node
- boolean needDummy = isExpandable(parent);
- boolean haveDummy = false;
- // remove all children
- Item[] items= getItems(ti);
- for (int i= 0; i < items.length; i++) {
- if (items[i].getData() != null) {
- disassociate(items[i]);
- items[i].dispose();
- }
- else {
- if (needDummy && !haveDummy) {
- haveDummy = true;
- }
- else {
- items[i].dispose();
- }
- }
- }
- if (needDummy && !haveDummy) {
- newItem(ti, SWT.NULL, -1);
- }
-
- return;
- }
- }
-
- // If the children weren't passed in, get them now since they're needed below.
- if (elementChildren == null) {
- elementChildren = getSortedChildren(parent);
- }
-
- Control tree = getControl();
-
- // WORKAROUND
- int oldCnt= -1;
- if (widget == tree)
- oldCnt= getItemCount(tree);
-
- Item[] items = getChildren(widget);
- int min = Math.min(elementChildren.length, items.length);
-
- // Note: In the code below, doing disassociate calls before associate calls is important,
- // since a later disassociate can undo an earlier associate,
- // if items are changing position.
-
- // dispose of all items beyond the end of the current elements
- for (int i = items.length; --i >= min;) {
- if (items[i].getData() != null) {
- disassociate(items[i]);
- }
- items[i].dispose();
- }
-
- // compare first min items, and update item if necessary
- // need to do it in two passes:
- // 1: disassociate old items
- // 2: associate and update new items
- // because otherwise a later disassociate can remove a mapping made for a previous associate,
- // making the map inconsistent
- for (int i = 0; i < min; ++i) {
- Item item = items[i];
- Object oldElement = item.getData();
- if (oldElement != null) {
- Object newElement = elementChildren[i];
- if (newElement != oldElement) {
- if (newElement.equals(oldElement)) {
- // update the data to be the new element, since although the elements
- // may be equal, they may still have different labels or children
- item.setData(newElement);
- mapElement(newElement, item);
- } else {
- disassociate(item);
- }
- }
- }
- }
- for (int i = 0; i < min; ++i) {
- Item item = items[i];
- if (item.getData() == null) {
- Object newElement = elementChildren[i];
- associate(newElement, item);
- updatePlus(item, newElement);
- updateItem(item, newElement);
- }
- }
-
- // add any remaining elements
- for (int i = min; i < elementChildren.length; ++i) {
- createTreeItem(widget, elementChildren[i], i);
- }
-
- // WORKAROUND
- if (widget == tree && oldCnt == 0 && getItemCount(tree) != 0) {
- //System.out.println("WORKAROUND setRedraw");
- tree.setRedraw(false);
- tree.setRedraw(true);
- }
-}
-/**
- * Updates the "+"/"-" icon of the tree node from the given element.
- * It calls <code>isExpandable</code> to determine whether
- * an element is expandable.
- *
- * @param item the item
- * @param element the element
- */
-protected void updatePlus(Item item, Object element) {
- boolean hasPlus = getItemCount(item) > 0;
- boolean needsPlus = isExpandable(element);
- boolean removeAll = false;
- boolean addDummy = false;
- Object data = item.getData();
- if (data != null && element.equals(data)) {
- // item shows same element
- if (hasPlus != needsPlus) {
- if (needsPlus)
- addDummy = true;
- else
- removeAll = true;
- }
- } else {
- // item shows different element
- removeAll = true;
- addDummy = needsPlus;
-
- // we cannot maintain expand state so collapse it
- setExpanded(item, false);
- }
- if (removeAll) {
- // remove all children
- Item[] items = getItems(item);
- for (int i = 0; i < items.length; i++) {
- if (items[i].getData() != null)
- disassociate(items[i]);
- items[i].dispose();
- }
- }
- if (addDummy)
- newItem(item, SWT.NULL, -1); // append a dummy
-}
-
-/**
- * Get the expanded elements that are visible
- * to the user. An expanded element is only
- * visible if the parent is expanded.
- * @return Collection of Object
- * @since 2.0
- */
-public Object[] getVisibleExpandedElements() {
- ArrayList v= new ArrayList();
- internalCollectVisibleExpanded(v, getControl());
- return v.toArray();
-}
-
-private void internalCollectVisibleExpanded(Collection result, Widget widget){
- Item[] items = getChildren(widget);
- for (int i = 0; i < items.length; i++) {
- Item item = items[i];
- if (getExpanded(item)) {
- Object data = item.getData();
- if (data != null)
- result.add(data);
- //Only recurse if it is expanded - if
- //not then the children aren't visible
- internalCollectVisibleExpanded(result, item);
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CellEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CellEditor.java
deleted file mode 100644
index 5f78890..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CellEditor.java
+++ /dev/null
@@ -1,682 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.*;
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List; // disambiguate from SWT List
-
-/**
- * Abstract base class for cell editors. Implements property change listener handling,
- * and SWT window management.
- * <p>
- * Subclasses implement particular kinds of cell editors. This package contains various
- * specialized cell editors:
- * <ul>
- * <li><code>TextCellEditor</code> - for simple text strings</li>
- * <li><code>ColorCellEditor</code> - for colors</li>
- * <li><code>ComboBoxCellEditor</code> - value selected from drop-down combo box</li>
- * <li><code>CheckboxCellEditor</code> - boolean valued checkbox</li>
- * <li><code>DialogCellEditor</code> - value from arbitrary dialog</li>
- * </ul>
- * </p>
- */
-public abstract class CellEditor {
-
- /**
- * List of cell editor listeners (element type: <code>ICellEditorListener</code>).
- */
- private ListenerList listeners = new ListenerList(3);
- /**
- * List of cell editor property change listeners
- * (element type: <code>IPropertyChangeListener</code>).
- */
- private ListenerList propertyChangeListeners = new ListenerList(3);
-
- /**
- * Indicates whether this cell editor's current value is valid.
- */
- private boolean valid = false;
-
- /**
- * Optional cell editor validator; <code>null</code> if none.
- */
- private ICellEditorValidator validator = null;
-
- /**
- * The error message string to display for invalid values;
- * <code>null</code> if none (that is, the value is valid).
- */
- private String errorMessage = null;
-
- /**
- * Indicates whether this cell editor has been changed recently.
- */
- private boolean dirty = false;
-
- /**
- * This cell editor's control, or <code>null</code>
- * if not created yet.
- */
- private Control control = null;
-
- /**
- * Struct-like layout data for cell editors, with reasonable defaults
- * for all fields.
- */
- public static class LayoutData {
- /**
- * Horizontal alignment; <code>SWT.LEFT</code> by default.
- */
- public int horizontalAlignment = SWT.LEFT;
-
- /**
- * Indicates control grabs additional space; <code>true</code> by default.
- */
- public boolean grabHorizontal = true;
-
- /**
- * Minimum width in pixels; <code>50</code> pixels by default.
- */
- public int minimumWidth = 50;
- }
-
- /**
- * Property name for the copy action
- */
- public static final String COPY = "copy"; //$NON-NLS-1$
-
- /**
- * Property name for the cut action
- */
- public static final String CUT = "cut"; //$NON-NLS-1$
-
- /**
- * Property name for the delete action
- */
- public static final String DELETE = "delete"; //$NON-NLS-1$
-
- /**
- * Property name for the find action
- */
- public static final String FIND = "find"; //$NON-NLS-1$
-
- /**
- * Property name for the paste action
- */
- public static final String PASTE = "paste"; //$NON-NLS-1$
-
- /**
- * Property name for the redo action
- */
- public static final String REDO = "redo"; //$NON-NLS-1$
-
- /**
- * Property name for the select all action
- */
- public static final String SELECT_ALL = "selectall"; //$NON-NLS-1$
-
- /**
- * Property name for the undo action
- */
- public static final String UNDO = "undo"; //$NON-NLS-1$
-/**
- * Creates a new cell editor under the given parent control.
- * The cell editor has no cell validator.
- *
- * @param parent the parent control
- */
-protected CellEditor(Composite parent) {
- control = createControl(parent);
-
- // See 1GD5CA6: ITPUI:ALL - TaskView.setSelection does not work
- // Control is created with isVisible()==true by default.
- // This causes composite.setFocus() to work incorrectly.
- // The cell editor's control grabs focus instead, even if it is not active.
- // Make the control invisible here by default.
- deactivate();
-}
-/**
- * Activates this cell editor.
- * <p>
- * The default implementation of this framework method
- * does nothing. Subclasses may reimplement.
- * </p>
- */
-public void activate() {
-}
-/**
- * Adds a listener to this cell editor.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a cell editor listener
- */
-public void addListener(ICellEditorListener listener) {
- listeners.add(listener);
-}
-/**
- * Adds a property change listener to this cell editor.
- * Has no effect if an identical property change listener
- * is already registered.
- *
- * @param listener a property change listener
- */
-public void addPropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.add(listener);
-}
-/**
- * Creates the control for this cell editor under the given parent control.
- * <p>
- * This framework method must be implemented by concrete
- * subclasses.
- * </p>
- *
- * @param parent the parent control
- * @return the new control, or <code>null</code> if this cell editor has no control
- */
-protected abstract Control createControl(Composite parent);
-/**
- * Hides this cell editor's control. Does nothing if this
- * cell editor is not visible.
- */
-public void deactivate() {
- if (control != null && !control.isDisposed())
- control.setVisible(false);
-}
-/**
- * Disposes of this cell editor and frees any associated SWT resources.
- */
-public void dispose() {
- // XXX: Should not need to check if we are already disposed but this
- // was occuring in the property sheet.
- if (control != null && !control.isDisposed()) {
- control.dispose();
- }
-}
-/**
- * Returns this cell editor's value.
- * <p>
- * This framework method must be implemented by concrete subclasses.
- * </p>
- *
- * @return the value of this cell editor
- * @see #getValue
- */
-protected abstract Object doGetValue();
-/**
- * Sets the focus to the cell editor's control.
- * <p>
- * This framework method must be implemented by concrete subclasses.
- * </p>
- *
- * @see #setFocus
- */
-protected abstract void doSetFocus();
-/**
- * Sets this cell editor's value.
- * <p>
- * This framework method must be implemented by concrete subclasses.
- * </p>
- *
- * @param value the value of this cell editor
- * @see #setValue
- */
-protected abstract void doSetValue(Object value);
-/**
- * Notifies all registered cell editor listeners of an apply event.
- * Only listeners registered at the time this method is called are notified.
- *
- * @see ICellEditorListener#applyEditorValue
- */
-protected void fireApplyEditorValue() {
- Object[] listeners = this.listeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ICellEditorListener) listeners[i]).applyEditorValue();
- }
-}
-/**
- * Notifies all registered cell editor listeners that editing has been
- * canceled.
- *
- * @see ICellEditorListener#cancelEditor
- */
-protected void fireCancelEditor() {
- Object[] listeners = this.listeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ICellEditorListener) listeners[i]).cancelEditor();
- }
-}
-/**
- * Notifies all registered cell editor listeners of a value change.
- *
- * @param oldValidState the valid state before the end user changed the value
- * @param newValidState the current valid state
- * @see ICellEditorListener#editorValueChanged
- */
-protected void fireEditorValueChanged(boolean oldValidState, boolean newValidState) {
- Object[] listeners = this.listeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ICellEditorListener) listeners[i]).editorValueChanged(oldValidState, newValidState);
- }
-}
-/**
- * Notifies all registered property listeners
- * of an enablement change.
- *
- * @param actionId the id indicating what action's enablement has changed.
- */
-protected void fireEnablementChanged(String actionId) {
- Object[] listeners = propertyChangeListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((IPropertyChangeListener) listeners[i]).propertyChange(new PropertyChangeEvent(this, actionId, null, null));
- }
-}
-/**
- * Returns the control used to implement this cell editor.
- *
- * @return the control, or <code>null</code> if this cell editor has no control
- */
-public Control getControl() {
- return control;
-}
-/**
- * Returns the current error message for this cell editor.
- *
- * @return the error message if the cell editor is in an invalid state,
- * and <code>null</code> if the cell editor is valid
- */
-public String getErrorMessage() {
- return errorMessage;
-}
-/**
- * Returns a layout data object for this cell editor.
- * This is called each time the cell editor is activated
- * and controls the layout of the SWT table editor.
- * <p>
- * The default implementation of this method sets the
- * minimum width to the control's preferred width.
- * Subclasses may extend or reimplement.
- * </p>
- *
- * @return the layout data object
- */
-public LayoutData getLayoutData() {
- LayoutData result = new LayoutData();
- Control control = getControl();
- if (control != null) {
- result.minimumWidth = control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x;
- }
- return result;
-}
-/**
- * Returns the input validator for this cell editor.
- *
- * @return the input validator, or <code>null</code> if none
- */
-public ICellEditorValidator getValidator() {
- return validator;
-}
-/**
- * Returns this cell editor's value provided that it has a valid one.
- *
- * @return the value of this cell editor, or <code>null</code>
- * if the cell editor does not contain a valid value
- */
-public final Object getValue() {
- if (!valid)
- return null;
-
- return doGetValue();
-}
-/**
- * Returns whether this cell editor is activated.
- *
- * @return <code>true</code> if this cell editor's control is
- * currently visible, and <code>false</code> if not visible
- */
-public boolean isActivated() {
- return control != null && control.isVisible();
-}
-/**
- * Returns <code>true</code> if this cell editor is
- * able to perform the copy action.
- * <p>
- * This default implementation always returns
- * <code>false</code>.
- * </p>
- * <p>
- * Subclasses may override
- * </p>
- * @return <code>true</code> if copy is possible,
- * <code>false</code> otherwise
- */
-public boolean isCopyEnabled() {
- return false;
-}
-/**
- * Returns whether the given value is valid for this cell editor.
- * This cell editor's validator (if any) makes the actual determination.
- *
- * @return <code>true</code> if the value is valid, and <code>false</code>
- * if invalid
- */
-protected boolean isCorrect(Object value) {
- errorMessage = null;
- if (validator == null)
- return true;
-
- errorMessage = validator.isValid(value);
- return (errorMessage == null || errorMessage.equals(""));//$NON-NLS-1$
-}
-/**
- * Returns <code>true</code> if this cell editor is
- * able to perform the cut action.
- * <p>
- * This default implementation always returns
- * <code>false</code>.
- * </p>
- * <p>
- * Subclasses may override
- * </p>
- * @return <code>true</code> if cut is possible,
- * <code>false</code> otherwise
- */
-public boolean isCutEnabled() {
- return false;
-}
-/**
- * Returns <code>true</code> if this cell editor is
- * able to perform the delete action.
- * <p>
- * This default implementation always returns
- * <code>false</code>.
- * </p>
- * <p>
- * Subclasses may override
- * </p>
- * @return <code>true</code> if delete is possible,
- * <code>false</code> otherwise
- */
-public boolean isDeleteEnabled() {
- return false;
-}
-/**
- * Returns whether the value of this cell editor has changed since the
- * last call to <code>setValue</code>.
- *
- * @return <code>true</code> if the value has changed, and <code>false</code>
- * if unchanged
- */
-public boolean isDirty() {
- return dirty;
-}
-/**
- * Returns <code>true</code> if this cell editor is
- * able to perform the find action.
- * <p>
- * This default implementation always returns
- * <code>false</code>.
- * </p>
- * <p>
- * Subclasses may override
- * </p>
- * @return <code>true</code> if find is possible,
- * <code>false</code> otherwise
- */
-public boolean isFindEnabled() {
- return false;
-}
-/**
- * Returns <code>true</code> if this cell editor is
- * able to perform the paste action.
- * <p>
- * This default implementation always returns
- * <code>false</code>.
- * </p>
- * <p>
- * Subclasses may override
- * </p>
- * @return <code>true</code> if paste is possible,
- * <code>false</code> otherwise
- */
-public boolean isPasteEnabled() {
- return false;
-}
-/**
- * Returns <code>true</code> if this cell editor is
- * able to perform the redo action.
- * <p>
- * This default implementation always returns
- * <code>false</code>.
- * </p>
- * <p>
- * Subclasses may override
- * </p>
- * @return <code>true</code> if redo is possible,
- * <code>false</code> otherwise
- */
-public boolean isRedoEnabled() {
- return false;
-}
-/**
- * Returns <code>true</code> if this cell editor is
- * able to perform the select all action.
- * <p>
- * This default implementation always returns
- * <code>false</code>.
- * </p>
- * <p>
- * Subclasses may override
- * </p>
- * @return <code>true</code> if select all is possible,
- * <code>false</code> otherwise
- */
-public boolean isSelectAllEnabled() {
- return false;
-}
-/**
- * Returns <code>true</code> if this cell editor is
- * able to perform the undo action.
- * <p>
- * This default implementation always returns
- * <code>false</code>.
- * </p>
- * <p>
- * Subclasses may override
- * </p>
- * @return <code>true</code> if undo is possible,
- * <code>false</code> otherwise
- */
-public boolean isUndoEnabled() {
- return false;
-}
-/**
- * Returns whether this cell editor has a valid value.
- * The default value is false.
- *
- * @return <code>true</code> if the value is valid, and <code>false</code>
- * if invalid
- *
- * @see #setValueValid
- */
-public boolean isValueValid() {
- return valid;
-}
-/**
- * Processes a key release event that occurred in this cell editor.
- * <p>
- * The default implementation of this framework method interprets
- * the ESC key as canceling editing, and the RETURN key
- * as applying the current value. Subclasses should call this method
- * at appropriate times. Subclasses may also extend or reimplement.
- * </p>
- *
- * @param keyEvent the key event
- */
-protected void keyReleaseOccured(KeyEvent keyEvent) {
- if (keyEvent.character == '\u001b') { // Escape character
- fireCancelEditor();
- return;
- } else if (keyEvent.character == '\r') { // Return key
- fireApplyEditorValue();
- return;
- }
-}
-/**
- * Performs the copy action.
- * This default implementation does nothing.
- * <p>
- * Subclasses may override
- * </p>
- */
-public void performCopy() {
-}
-/**
- * Performs the cut action.
- * This default implementation does nothing.
- * <p>
- * Subclasses may override
- * </p>
- */
-public void performCut() {
-}
-/**
- * Performs the delete action.
- * This default implementation does nothing.
- * <p>
- * Subclasses may override
- * </p>
- */
-public void performDelete() {
-}
-/**
- * Performs the find action.
- * This default implementation does nothing.
- * <p>
- * Subclasses may override
- * </p>
- */
-public void performFind() {
-}
-/**
- * Performs the paste action.
- * This default implementation does nothing.
- * <p>
- * Subclasses may override
- * </p>
- */
-public void performPaste() {
-}
-/**
- * Performs the redo action.
- * This default implementation does nothing.
- * <p>
- * Subclasses may override
- * </p>
- */
-public void performRedo() {
-}
-/**
- * Performs the select all action.
- * This default implementation does nothing.
- * <p>
- * Subclasses may override
- * </p>
- */
-public void performSelectAll() {
-}
-/**
- * Performs the undo action.
- * This default implementation does nothing.
- * <p>
- * Subclasses may override
- * </p>
- */
-public void performUndo() {
-}
-/**
- * Removes the given listener from this cell editor.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a cell editor listener
- */
-public void removeListener(ICellEditorListener listener) {
- listeners.remove(listener);
-}
-/**
- * Removes the given property change listener from this cell editor.
- * Has no affect if an identical property change listener is not
- * registered.
- *
- * @param listener a property change listener
- */
-public void removePropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.remove(listener);
-}
-/**
- * Sets or clears the current error message for this cell editor.
- *
- * @param message the error message, or <code>null</code> to clear
- */
-protected void setErrorMessage(String message) {
- errorMessage = message;
-}
-/**
- * Sets the focus to the cell editor's control.
- */
-public void setFocus() {
- doSetFocus();
-}
-/**
- * Sets the input validator for this cell editor.
- *
- * @param validator the input validator, or <code>null</code> if none
- */
-public void setValidator(ICellEditorValidator validator) {
- this.validator = validator;
-}
-/**
- * Sets this cell editor's value.
- *
- * @param value the value of this cell editor
- */
-public final void setValue(Object value) {
- valid = isCorrect(value);
- dirty = false;
- doSetValue(value);
-}
-/**
- * Sets the valid state of this cell editor.
- * The default value is false.
- * Subclasses should call this method on construction.
- *
- * @param valid <code>true</code> if the current valie is valid,
- * and <code>false</code> if invalid
- *
- * @see #isValueValid
- */
-protected void setValueValid(boolean valid) {
- this.valid = valid;
-}
-/**
- * The value has changed.
- * Updates the valid state flag, marks this cell editor as dirty,
- * and notifies all registered cell editor listeners of a value change.
- *
- * @param oldValidState the valid state before the end user changed the value
- * @param newValidState the current valid state
- * @see ICellEditorListener#editorValueChanged
- */
-protected void valueChanged(boolean oldValidState, boolean newValidState) {
- valid = newValidState;
- dirty = true;
- fireEditorValueChanged(oldValidState, newValidState);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckStateChangedEvent.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckStateChangedEvent.java
deleted file mode 100644
index b2258d7..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckStateChangedEvent.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.EventObject;
-
-/**
- * Event object describing a change to the checked state
- * of a viewer element.
- *
- * @see ICheckStateListener
- */
-public class CheckStateChangedEvent extends EventObject {
-
- /**
- * The viewer element.
- */
- private Object element;
-
- /**
- * The checked state.
- */
- private boolean state;
-/**
- * Creates a new event for the given source, element, and checked state.
- *
- * @param source the source
- * @param element the element
- * @param state the checked state
- */
-public CheckStateChangedEvent(ICheckable source, Object element, boolean state) {
- super(source);
- this.element = element;
- this.state = state;
-}
-/**
- * Returns the checkable that is the source of this event.
- *
- * @return the originating checkable
- */
-public ICheckable getCheckable() {
- return (ICheckable) source;
-}
-/**
- * Returns the checked state of the element.
- *
- * @return the checked state
- */
-public boolean getChecked() {
- return state;
-}
-/**
- * Returns the element whose check state changed.
- *
- * @return the element
- */
-public Object getElement() {
- return element;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxCellEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxCellEditor.java
deleted file mode 100644
index bc1fc8e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxCellEditor.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A cell editor that manages a checkbox.
- * The cell editor's value is a boolean.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * <p>
- * Note that this implementation simply fakes it and does does not create
- * any new controls. The mere activation of this editor means that the value
- * of the check box is being toggled by the end users; the listener method
- * <code>applyEditorValue</code> is immediately called to signal the change.
- * </p>
- */
-public class CheckboxCellEditor extends CellEditor {
-
- /**
- * The checkbox value.
- */
- /* package */ boolean value = false;
-/**
- * Creates a new checkbox cell editor parented under the given control.
- * The cell editor value is a boolean value, which is initially <code>false</code>.
- * Initially, the cell editor has no cell validator.
- *
- * @param parent the parent control
- */
-public CheckboxCellEditor(Composite parent) {
- super(parent);
-}
-/**
- * The <code>CheckboxCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method simulates
- * the toggling of the checkbox control and notifies
- * listeners with <code>ICellEditorListener.applyEditorValue</code>.
- */
-public void activate() {
- value = !value;
- fireApplyEditorValue();
-}
-/**
- * The <code>CheckboxCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method does
- * nothing and returns <code>null</code>.
- */
-protected Control createControl(Composite parent) {
- return null;
-}
-/**
- * The <code>CheckboxCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method returns
- * the checkbox setting wrapped as a <code>Boolean</code>.
- *
- * @return the Boolean checkbox value
- */
-protected Object doGetValue() {
- return new Boolean(value);
-}
-/* (non-Javadoc)
- * Method declared on CellEditor.
- */
-protected void doSetFocus() {
- // Ignore
-}
-/**
- * The <code>CheckboxCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method accepts
- * a value wrapped as a <code>Boolean</code>.
- *
- * @param value a Boolean value
- */
-protected void doSetValue(Object value) {
- Assert.isTrue(value instanceof Boolean);
- this.value = ((Boolean) value).booleanValue();
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxTableViewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxTableViewer.java
deleted file mode 100644
index 1364b68..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxTableViewer.java
+++ /dev/null
@@ -1,397 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.custom.TableEditor;
-import org.eclipse.jface.*;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.SWT;
-import java.util.*;
-import java.util.List;
-
-/**
- * A concrete viewer based on an SWT <code>Table</code>
- * control with checkboxes on each node.
- * <p>
- * This class is not intended to be subclassed outside the viewer framework.
- * It is designed to be instantiated with a pre-existing SWT table control and configured
- * with a domain-specific content provider, label provider, element filter (optional),
- * and element sorter (optional).
- * </p>
- */
-public class CheckboxTableViewer extends TableViewer implements ICheckable {
-
- /**
- * List of check state listeners (element type: <code>ICheckStateListener</code>).
- */
- private ListenerList checkStateListeners = new ListenerList(3);
-/**
- * Creates a table viewer on a newly-created table control under the given parent.
- * The table control is created using the SWT style bits:
- * <code>SWT.CHECK</code> and <code>SWT.BORDER</code>.
- * The table has one column.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- * <p>
- * This is equivalent to calling <code>new CheckboxTableViewer(parent, SWT.BORDER)</code>.
- * See that constructor for more details.
- * </p>
- *
- * @param parent the parent control
- *
- * @deprecated use newCheckList(Composite, int) or new CheckboxTableViewer(Table)
- * instead (see below for details)
- */
-public CheckboxTableViewer(Composite parent) {
- this(parent, SWT.BORDER);
-}
-/**
- * Creates a table viewer on a newly-created table control under the given parent.
- * The table control is created using the given SWT style bits, plus the
- * <code>SWT.CHECK</code> style bit.
- * The table has one column.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- * <p>
- * This also adds a <code>TableColumn</code> for the single column,
- * and sets a <code>TableLayout</code> on the table which sizes the column to fill
- * the table for its initial sizing, but does nothing on subsequent resizes.
- * </p>
- * <p>
- * If the caller just needs to show a single column with no header,
- * it is preferable to use the <code>newCheckList</code> factory method instead,
- * since SWT properly handles the initial sizing and subsequent resizes in this case.
- * </p>
- * <p>
- * If the caller adds its own columns, uses <code>Table.setHeadersVisible(true)</code>,
- * or needs to handle dynamic resizing of the table, it is recommended to
- * create the <code>Table</code> itself, specifying the <code>SWT.CHECK</code> style bit
- * (along with any other style bits needed), and use <code>new CheckboxTableViewer(Table)</code>
- * rather than this constructor.
- * </p>
- *
- * @param parent the parent control
- * @param style SWT style bits
- *
- * @deprecated use newCheckList(Composite, int) or new CheckboxTableViewer(Table)
- * instead (see above for details)
- */
-public CheckboxTableViewer(Composite parent, int style) {
- this(createTable(parent, style));
-}
-
-/**
- * Creates a table viewer on a newly-created table control under the given parent.
- * The table control is created using the given SWT style bits, plus the
- * <code>SWT.CHECK</code> style bit.
- * The table shows its contents in a single column, with no header.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- * <p>
- * No <code>TableColumn</code> is added. SWT does not require a
- * <code>TableColumn</code> if showing only a single column with no header.
- * SWT correctly handles the initial sizing and subsequent resizes in this case.
- *
- * @param parent the parent control
- * @param style SWT style bits
- *
- * @since 2.0
- */
-public static CheckboxTableViewer newCheckList(Composite parent, int style) {
- Table table = new Table(parent, SWT.CHECK | style);
- return new CheckboxTableViewer(table);
-}
-
-/**
- * Creates a table viewer on the given table control.
- * The <code>SWT.CHECK</code> style bit must be set on the given table control.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param table the table control
- */
-public CheckboxTableViewer(Table table) {
- super(table);
-}
-/* (non-Javadoc)
- * Method declared on ICheckable.
- */
-public void addCheckStateListener(ICheckStateListener listener) {
- checkStateListeners.add(listener);
-}
-/**
- * Creates a new table control with one column.
- *
- * @param parent the parent control
- * @param style style bits
- * @return a new table control
- */
-protected static Table createTable(Composite parent, int style) {
- Table table = new Table(parent, SWT.CHECK | style);
-
- // Although this table column is not needed, and can cause resize problems,
- // it can't be removed since this would be a breaking change against R1.0.
- // See bug 6643 for more details.
- new TableColumn(table, SWT.NONE);
- TableLayout layout = new TableLayout();
- layout.addColumnData(new ColumnWeightData(100));
- table.setLayout(layout);
-
- return table;
-}
-
-/**
- * Notifies any check state listeners that a check state changed has been received.
- * Only listeners registered at the time this method is called are notified.
- *
- * @param event a check state changed event
- *
- * @see ICheckStateListener#checkStateChanged
- */
-private void fireCheckStateChanged(CheckStateChangedEvent event) {
- Object[] listeners = checkStateListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ICheckStateListener) listeners[i]).checkStateChanged(event);
- }
-}
-/* (non-Javadoc)
- * Method declared on ICheckable.
- */
-public boolean getChecked(Object element) {
- Widget widget = findItem(element);
- if (widget instanceof TableItem) {
- return ((TableItem) widget).getChecked();
- }
- return false;
-}
-/**
- * Returns a list of elements corresponding to checked table items in this
- * viewer.
- * <p>
- * This method is typically used when preserving the interesting
- * state of a viewer; <code>setCheckedElements</code> is used during the restore.
- * </p>
- *
- * @return the array of checked elements
- * @see #setCheckedElements
- */
-public Object[] getCheckedElements() {
- TableItem[] children = getTable().getItems();
- ArrayList v = new ArrayList(children.length);
- for (int i = 0; i < children.length; i++) {
- TableItem item = children[i];
- if (item.getChecked())
- v.add(item.getData());
- }
- return v.toArray();
-}
-/**
- * Returns the grayed state of the given element.
- *
- * @param element the element
- * @return <code>true</code> if the element is grayed,
- * and <code>false</code> if not grayed
- */
-public boolean getGrayed(Object element) {
- Widget widget = findItem(element);
- if (widget instanceof TableItem) {
- return ((TableItem) widget).getGrayed();
- }
- return false;
-}
-/**
- * Returns a list of elements corresponding to grayed nodes in this
- * viewer.
- * <p>
- * This method is typically used when preserving the interesting
- * state of a viewer; <code>setGrayedElements</code> is used during the restore.
- * </p>
- *
- * @return the array of grayed elements
- * @see #setGrayedElements
- */
-public Object[] getGrayedElements() {
- TableItem[] children = getTable().getItems();
- List v = new ArrayList(children.length);
- for (int i = 0; i < children.length; i++) {
- TableItem item = children[i];
- if (item.getGrayed())
- v.add(item.getData());
- }
- return v.toArray();
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-public void handleSelect(SelectionEvent event) {
- if (event.detail == SWT.CHECK) {
- super.handleSelect(event); // this will change the current selection
-
- TableItem item = (TableItem) event.item;
- Object data = item.getData();
- if (data != null) {
- fireCheckStateChanged(new CheckStateChangedEvent(this, data, item.getChecked()));
- }
- } else
- super.handleSelect(event);
-}
-/* (non-Javadoc)
- * Method declared on Viewer.
- */
-protected void preservingSelection(Runnable updateCode) {
-
- TableItem[] children = getTable().getItems();
- Set checked = new HashSet(children.length);
- Set grayed = new HashSet(children.length);
-
- for (int i = 0; i < children.length; i++) {
- TableItem item = children[i];
- Object data = item.getData();
- if (data != null) {
- if (item.getChecked())
- checked.add(data);
- if (item.getGrayed())
- grayed.add(data);
- }
- }
-
- super.preservingSelection(updateCode);
-
- children = getTable().getItems();
- for (int i = 0; i < children.length; i++) {
- TableItem item = children[i];
- Object data = item.getData();
- if (data != null) {
- item.setChecked(checked.contains(data));
- item.setGrayed(grayed.contains(data));
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on ICheckable.
- */
-public void removeCheckStateListener(ICheckStateListener listener) {
- checkStateListeners.remove(listener);
-}
-/**
- * Sets to the given value the checked state for all elements in this viewer.
- *
- * @param state <code>true</code> if the element should be checked,
- * and <code>false</code> if it should be unchecked
- */
-public void setAllChecked(boolean state) {
- TableItem[] children = getTable().getItems();
- for (int i = 0; i < children.length; i++) {
- TableItem item = children[i];
- item.setChecked(state);
- }
-}
-/**
- * Sets to the given value the grayed state for all elements in this viewer.
- *
- * @param state <code>true</code> if the element should be grayed,
- * and <code>false</code> if it should be ungrayed
- */
-public void setAllGrayed(boolean state) {
- TableItem[] children = getTable().getItems();
- for (int i = 0; i < children.length; i++) {
- TableItem item = children[i];
- item.setGrayed(state);
- }
-}
-/* (non-Javadoc)
- * Method declared on ICheckable.
- */
-public boolean setChecked(Object element, boolean state) {
- Widget widget = findItem(element);
- if (widget instanceof TableItem) {
- ((TableItem) widget).setChecked(state);
- return true;
- }
- return false;
-}
-/**
- * Sets which nodes are checked in this viewer.
- * The given list contains the elements that are to be checked;
- * all other nodes are to be unchecked.
- * <p>
- * This method is typically used when restoring the interesting
- * state of a viewer captured by an earlier call to <code>getCheckedElements</code>.
- * </p>
- *
- * @param elements the list of checked elements (element type: <code>Object</code>)
- * @see #getCheckedElements
- */
-public void setCheckedElements(Object[] elements) {
- Set set = new HashSet(elements.length*2+1);
- for (int i = 0; i < elements.length; ++i) {
- set.add(elements[i]);
- }
- TableItem[] items = getTable().getItems();
- for (int i = 0; i < items.length; ++i) {
- TableItem item = items[i];
- Object element = item.getData();
- if (element != null) {
- boolean check = set.contains(element);
- // only set if different, to avoid flicker
- if (item.getChecked() != check) {
- item.setChecked(check);
- }
- }
- }
-}
-/**
- * Sets the grayed state for the given element in this viewer.
- *
- * @param element the element
- * @param state <code>true</code> if the item should be grayed,
- * and <code>false</code> if it should be ungrayed
- * @return <code>true</code> if the element is visible and the gray
- * state could be set, and <code>false</code> otherwise
- */
-public boolean setGrayed(Object element, boolean state) {
- Widget widget = findItem(element);
- if (widget instanceof TableItem) {
- ((TableItem) widget).setGrayed(state);
- return true;
- }
- return false;
-}
-/**
- * Sets which nodes are grayed in this viewer.
- * The given list contains the elements that are to be grayed;
- * all other nodes are to be ungrayed.
- * <p>
- * This method is typically used when restoring the interesting
- * state of a viewer captured by an earlier call to <code>getGrayedElements</code>.
- * </p>
- *
- * @param elements the array of grayed elements
- *
- * @see #getGrayedElements
- */
-public void setGrayedElements(Object[] elements) {
- Set set = new HashSet(elements.length*2+1);
- for (int i = 0; i < elements.length; ++i) {
- set.add(elements[i]);
- }
- TableItem[] items = getTable().getItems();
- for (int i = 0; i < items.length; ++i) {
- TableItem item = items[i];
- Object element = item.getData();
- if (element != null) {
- boolean gray = set.contains(element);
- // only set if different, to avoid flicker
- if (item.getGrayed() != gray) {
- item.setGrayed(gray);
- }
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxTreeViewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxTreeViewer.java
deleted file mode 100644
index 71558eb..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxTreeViewer.java
+++ /dev/null
@@ -1,499 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.*;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.SWT;
-import java.util.*;
-import java.util.List;
-
-/**
- * A concrete tree-structured viewer based on an SWT <code>Tree</code>
- * control with checkboxes on each node.
- * <p>
- * This class is not intended to be subclassed outside the viewer framework.
- * It is designed to be instantiated with a pre-existing SWT tree control and configured
- * with a domain-specific content provider, label provider, element filter (optional),
- * and element sorter (optional).
- * </p>
- */
-public class CheckboxTreeViewer extends TreeViewer implements ICheckable {
-
- /**
- * List of check state listeners (element type: <code>ICheckStateListener</code>).
- */
- private ListenerList checkStateListeners = new ListenerList(3);
-
- /**
- * Last item clicked on, or <code>null</code> if none.
- */
- private TreeItem lastClickedItem = null;
-/**
- * Creates a tree viewer on a newly-created tree control under the given parent.
- * The tree control is created using the SWT style bits: <code>CHECK</code> and <code>BORDER</code>.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param parent the parent control
- */
-public CheckboxTreeViewer(Composite parent) {
- this(parent, SWT.BORDER);
-}
-/**
- * Creates a tree viewer on a newly-created tree control under the given parent.
- * The tree control is created using the given SWT style bits, plus the <code>CHECK</code> style bit.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param parent the parent control
- * @param style the SWT style bits
- */
-public CheckboxTreeViewer(Composite parent, int style) {
- this(new Tree(parent, SWT.CHECK | style));
-}
-/**
- * Creates a tree viewer on the given tree control.
- * The <code>SWT.CHECK</code> style bit must be set on the given tree control.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param tree the tree control
- */
-public CheckboxTreeViewer(Tree tree) {
- super(tree);
-}
-/* (non-Javadoc)
- * Method declared on ICheckable.
- */
-public void addCheckStateListener(ICheckStateListener listener) {
- checkStateListeners.add(listener);
-}
-/**
- * Applies the checked and grayed states of the given widget and its
- * descendents.
- *
- * @param checked a set of elements (element type: <code>Object</code>)
- * @param grayed a set of elements (element type: <code>Object</code>)
- * @param widget the widget
- */
-private void applyState(Set checked, Set grayed, Widget widget) {
- Item[] items = getChildren(widget);
- for (int i = 0; i < items.length; i++) {
- Item item = items[i];
- if (item instanceof TreeItem) {
- Object data = item.getData();
- if (data != null) {
- TreeItem ti = (TreeItem) item;
- ti.setChecked(checked.contains(data));
- ti.setGrayed(grayed.contains(data));
- }
- }
- applyState(checked, grayed, item);
- }
-}
-/**
- * Notifies any check state listeners that the check state of an element has changed.
- * Only listeners registered at the time this method is called are notified.
- *
- * @param event a check state changed event
- *
- * @see ICheckStateListener#checkStateChanged
- */
-protected void fireCheckStateChanged(CheckStateChangedEvent event) {
- Object[] listeners = checkStateListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ICheckStateListener) listeners[i]).checkStateChanged(event);
- }
-}
-/**
- * Gathers the checked and grayed states of the given widget and its
- * descendents.
- *
- * @param checked a writeable set of elements (element type: <code>Object</code>)
- * @param grayed a writeable set of elements (element type: <code>Object</code>)
- * @param widget the widget
- */
-private void gatherState(Set checked, Set grayed, Widget widget) {
- Item[] items = getChildren(widget);
- for (int i = 0; i < items.length; i++) {
- Item item = items[i];
- if (item instanceof TreeItem) {
- Object data = item.getData();
- if (data != null) {
- TreeItem ti = (TreeItem) item;
- if (ti.getChecked())
- checked.add(data);
- if (ti.getGrayed())
- grayed.add(data);
- }
- }
- gatherState(checked, grayed, item);
- }
-}
-/* (non-Javadoc)
- * Method declared on ICheckable.
- */
-public boolean getChecked(Object element) {
- Widget widget = findItem(element);
- if (widget instanceof TreeItem)
- return ((TreeItem) widget).getChecked();
- return false;
-}
-/**
- * Returns a list of checked elements in this viewer's tree,
- * including currently hidden ones that are marked as
- * checked but are under a collapsed ancestor.
- * <p>
- * This method is typically used when preserving the interesting
- * state of a viewer; <code>setCheckedElements</code> is used during the restore.
- * </p>
- *
- * @return the array of checked elements
- *
- * @see #setCheckedElements
- */
-public Object[] getCheckedElements() {
- ArrayList v = new ArrayList();
- Control tree = getControl();
- internalCollectChecked(v, tree);
- return v.toArray();
-}
-/**
- * Returns the grayed state of the given element.
- *
- * @param element the element
- * @return <code>true</code> if the element is grayed,
- * and <code>false</code> if not grayed
- */
-public boolean getGrayed(Object element) {
- Widget widget = findItem(element);
- if (widget instanceof TreeItem) {
- return ((TreeItem) widget).getGrayed();
- }
- return false;
-}
-/**
- * Returns a list of grayed elements in this viewer's tree,
- * including currently hidden ones that are marked as
- * grayed but are under a collapsed ancestor.
- * <p>
- * This method is typically used when preserving the interesting
- * state of a viewer; <code>setGrayedElements</code> is used during the restore.
- * </p>
- *
- * @return the array of grayed elements
- *
- * @see #setGrayedElements
- */
-public Object[] getGrayedElements() {
- List result = new ArrayList();
- internalCollectGrayed(result, getControl());
- return result.toArray();
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected void handleDoubleSelect(SelectionEvent event) {
-
- if (lastClickedItem != null) {
- TreeItem item = lastClickedItem;
- Object data = item.getData();
- if (data != null) {
- boolean state = item.getChecked();
- setChecked(data, !state);
- fireCheckStateChanged(new CheckStateChangedEvent(this, data, !state));
- }
- lastClickedItem = null;
- } else
- super.handleDoubleSelect(event);
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected void handleSelect(SelectionEvent event) {
-
- lastClickedItem = null;
- if (event.detail == SWT.CHECK) {
- TreeItem item = (TreeItem) event.item;
- lastClickedItem = item;
- super.handleSelect(event);
-
- Object data = item.getData();
- if (data != null) {
- fireCheckStateChanged(new CheckStateChangedEvent(this, data, item.getChecked()));
- }
- } else
- super.handleSelect(event);
-}
-/**
- * Gathers the checked states of the given widget and its
- * descendents, following a pre-order traversal of the tree.
- *
- * @param result a writeable list of elements (element type: <code>Object</code>)
- * @param widget the widget
- */
-private void internalCollectChecked(List result, Widget widget) {
- Item[] items = getChildren(widget);
- for (int i = 0; i < items.length; i++) {
- Item item = items[i];
- if (item instanceof TreeItem && ((TreeItem) item).getChecked()) {
- Object data = item.getData();
- if (data != null)
- result.add(data);
- }
- internalCollectChecked(result, item);
- }
-}
-/**
- * Gathers the grayed states of the given widget and its
- * descendents, following a pre-order traversal of the tree.
- *
- * @param result a writeable list of elements (element type: <code>Object</code>)
- * @param widget the widget
- */
-private void internalCollectGrayed(List result, Widget widget) {
- Item[] items = getChildren(widget);
- for (int i = 0; i < items.length; i++) {
- Item item = items[i];
- if (item instanceof TreeItem && ((TreeItem) item).getGrayed()) {
- Object data = item.getData();
- if (data != null)
- result.add(data);
- }
- internalCollectGrayed(result, item);
- }
-}
-/**
- * Sets the checked state of all items to correspond to the given set of checked elements.
- *
- * @param checkedElements the set (element type: <code>Object</code>) of elements which are checked
- * @param widget the widget
- */
-private void internalSetChecked(Set checkedElements, Widget widget) {
- Item[] items = getChildren(widget);
- for (int i = 0; i < items.length; i++) {
- TreeItem item = (TreeItem) items[i];
- Object data = item.getData();
- if (data != null) {
- boolean checked = checkedElements.contains(data);
- if (checked != item.getChecked()) {
- item.setChecked(checked);
- }
- }
- internalSetChecked(checkedElements, item);
- }
-}
-/**
- * Sets the grayed state of all items to correspond to the given set of grayed elements.
- *
- * @param grayedElements the set (element type: <code>Object</code>) of elements which are grayed
- * @param widget the widget
- */
-private void internalSetGrayed(Set grayedElements, Widget widget) {
- Item[] items = getChildren(widget);
- for (int i = 0; i < items.length; i++) {
- TreeItem item = (TreeItem) items[i];
- Object data = item.getData();
- if (data != null) {
- boolean grayed = grayedElements.contains(data);
- if (grayed != item.getGrayed()) {
- item.setGrayed(grayed);
- }
- }
- internalSetGrayed(grayedElements, item);
- }
-}
-/* (non-Javadoc)
- * Method declared on Viewer.
- */
-protected void preservingSelection(Runnable updateCode) {
-
- int n = getItemCount(getControl());
- Set checkedNodes = new HashSet(n);
- Set grayedNodes = new HashSet(n);
-
- gatherState(checkedNodes, grayedNodes, getControl());
-
- super.preservingSelection(updateCode);
-
- applyState(checkedNodes, grayedNodes, getControl());
-}
-/* (non-Javadoc)
- * Method declared on ICheckable.
- */
-public void removeCheckStateListener(ICheckStateListener listener) {
- checkStateListeners.remove(listener);
-}
-/* (non-Javadoc)
- * Method declared on ICheckable.
- */
-public boolean setChecked(Object element, boolean state) {
- Widget widget = internalExpand(element, false);
- if (widget instanceof TreeItem) {
- ((TreeItem) widget).setChecked(state);
- return true;
- }
- return false;
-}
-/**
- * Sets the checked state for the children of the given item.
- *
- * @param item the item
- * @param state <code>true</code> if the item should be checked,
- * and <code>false</code> if it should be unchecked
- */
-private void setCheckedChildren(Item item, boolean state) {
- createChildren(item);
- Item[] items = getChildren(item);
- if (items != null) {
- for (int i = 0; i < items.length; i++) {
- Item it = items[i];
- if (it.getData() != null && (it instanceof TreeItem)) {
- TreeItem treeItem = (TreeItem) it;
- treeItem.setChecked(state);
- setCheckedChildren(treeItem, state);
- }
- }
- }
-}
-/**
- * Sets which elements are checked in this viewer's tree.
- * The given list contains the elements that are to be checked;
- * all other elements are to be unchecked.
- * <p>
- * This method is typically used when restoring the interesting
- * state of a viewer captured by an earlier call to <code>getCheckedElements</code>.
- * </p>
- *
- * @param elements the array of checked elements
- * @see #getCheckedElements
- */
-public void setCheckedElements(Object[] elements) {
- Set checkedElements = new HashSet(elements.length*2+1);
- for (int i = 0; i < elements.length; ++i) {
- // Ensure item exists for element
- internalExpand(elements[i], false);
- checkedElements.add(elements[i]);
- }
- Control tree = getControl();
- tree.setRedraw(false);
- internalSetChecked(checkedElements, tree);
- tree.setRedraw(true);
-}
-/**
- * Sets the grayed state for the given element in this viewer.
- *
- * @param element the element
- * @param state <code>true</code> if the item should be grayed,
- * and <code>false</code> if it should be ungrayed
- * @return <code>true</code> if the gray state could be set,
- * and <code>false</code> otherwise
- */
-public boolean setGrayed(Object element, boolean state) {
- Widget widget = internalExpand(element, false);
- if (widget instanceof TreeItem) {
- ((TreeItem) widget).setGrayed(state);
- return true;
- }
- return false;
-}
-
-/**
- * Check and gray the selection rather than calling both
- * setGrayed and setChecked as an optimization.
- * @param element the item being checked
- * @param state a boolean indicating selection or deselection
- * @return boolean indicating success or failure.
- */
-public boolean setGrayChecked(Object element, boolean state) {
- Widget widget = internalExpand(element, false);
- if (widget instanceof TreeItem) {
- TreeItem item = (TreeItem) widget;
- item.setChecked(state);
- item.setGrayed(state);
- return true;
- }
- return false;
-}
-
-/**
- * Sets which elements are grayed in this viewer's tree.
- * The given list contains the elements that are to be grayed;
- * all other elements are to be ungrayed.
- * <p>
- * This method is typically used when restoring the interesting
- * state of a viewer captured by an earlier call to <code>getGrayedElements</code>.
- * </p>
- *
- * @param elements the array of grayed elements
- *
- * @see #getGrayedElements
- */
-public void setGrayedElements(Object[] elements) {
- Set grayedElements = new HashSet(elements.length*2+1);
- for (int i = 0; i < elements.length; ++i) {
- // Ensure item exists for element
- internalExpand(elements[i], false);
- grayedElements.add(elements[i]);
- }
- Control tree = getControl();
- tree.setRedraw(false);
- internalSetGrayed(grayedElements, tree);
- tree.setRedraw(true);
-}
-/**
- * Sets the grayed state for the given element and its parents
- * in this viewer.
- *
- * @param element the element
- * @param state <code>true</code> if the item should be grayed,
- * and <code>false</code> if it should be ungrayed
- * @return <code>true</code> if the element is visible and the gray
- * state could be set, and <code>false</code> otherwise
- * @see #setGrayed
- */
-public boolean setParentsGrayed(Object element, boolean state) {
- Widget widget = internalExpand(element, false);
- if (widget instanceof TreeItem) {
- TreeItem item = (TreeItem) widget;
- item.setGrayed(state);
- item = item.getParentItem();
- while (item != null) {
- item.setGrayed(state);
- item = item.getParentItem();
- }
- return true;
- }
- return false;
-}
-/**
- * Sets the checked state for the given element and its visible
- * children in this viewer.
- * Assumes that the element has been expanded before. To enforce
- * that the item is expanded, call <code>expandToLevel</code>
- * for the element.
- *
- * @param element the element
- * @param state <code>true</code> if the item should be checked,
- * and <code>false</code> if it should be unchecked
- * @return <code>true</code> if the checked state could be set,
- * and <code>false</code> otherwise
- */
-public boolean setSubtreeChecked(Object element, boolean state) {
- Widget widget = internalExpand(element, false);
- if (widget instanceof TreeItem) {
- TreeItem item = (TreeItem) widget;
- item.setChecked(state);
- setCheckedChildren(item, state);
- return true;
- }
- return false;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColorCellEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColorCellEditor.java
deleted file mode 100644
index ae6cf8d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColorCellEditor.java
+++ /dev/null
@@ -1,202 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.custom.TableTree;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A cell editor that manages a color field.
- * The cell editor's value is the color (an SWT <code>RBG</code>).
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class ColorCellEditor extends DialogCellEditor {
-
- /**
- * The default extent in pixels.
- */
- private static final int DEFAULT_EXTENT= 16;
-
- /**
- * Gap between between image and text in pixels.
- */
- private static final int GAP = 6;
-
- /**
- * The composite widget containing the color and RGB label widgets
- */
- private Composite composite;
-
- /**
- * The label widget showing the current color.
- */
- private Label colorLabel;
-
- /**
- * The label widget showing the RGB values.
- */
- private Label rgbLabel;
-
- /**
- * The image.
- */
- private Image image;
-
- /**
- * Internal class for laying out this cell editor.
- */
- private class ColorCellLayout extends Layout {
- public Point computeSize(
- Composite editor,
- int wHint,
- int hHint,
- boolean force) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- return new Point(wHint, hHint);
- Point colorSize = colorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
- Point rgbSize = rgbLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
- return new Point(
- colorSize.x + GAP + rgbSize.x,
- Math.max(colorSize.y, rgbSize.y));
- }
- public void layout(Composite editor, boolean force) {
- Rectangle bounds = editor.getClientArea();
- Point colorSize = colorLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
- Point rgbSize = rgbLabel.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
- int ty = (bounds.height - rgbSize.y) / 2;
- if (ty < 0)
- ty = 0;
- colorLabel.setBounds(-1, 0, colorSize.x, colorSize.y);
- rgbLabel.setBounds(
- colorSize.x + GAP - 1,
- ty,
- bounds.width - colorSize.x - GAP,
- bounds.height);
- }
- }
-/**
- * Creates a new color cell editor parented under the given control.
- * The cell editor value is black (<code>RGB(0,0,0)</code>) initially, and has no
- * validator.
- *
- * @param parent the parent control
- */
-public ColorCellEditor(Composite parent) {
- super(parent);
- doSetValue(new RGB(0, 0, 0));
-}
-/**
- * Creates and returns the color image data for the given control
- * and RGB value. The image's size is either the control's item extent
- * or the cell editor's default extent, which is 16 pixels square.
- *
- * @param w the control
- * @param color the color
- */
-private ImageData createColorImage(Control w, RGB color) {
-
- GC gc = new GC(w);
- FontMetrics fm = gc.getFontMetrics();
- int size = fm.getAscent();
- gc.dispose();
-
- int indent = 6;
- int extent = DEFAULT_EXTENT;
- if (w instanceof Table)
- extent = ((Table) w).getItemHeight() - 1;
- else if (w instanceof Tree)
- extent = ((Tree) w).getItemHeight() - 1;
- else if (w instanceof TableTree)
- extent = ((TableTree) w).getItemHeight() - 1;
-
- if (size > extent)
- size = extent;
-
- int width = indent + size;
- int height = extent;
-
- int xoffset = indent;
- int yoffset = (height - size) / 2;
-
- RGB black = new RGB(0, 0, 0);
- PaletteData dataPalette = new PaletteData(new RGB[] {black, black, color});
- ImageData data = new ImageData(width, height, 4, dataPalette);
- data.transparentPixel = 0;
-
- int end = size - 1;
- for (int y = 0; y < size; y++) {
- for (int x = 0; x < size; x++) {
- if (x == 0 || y == 0 || x == end || y == end)
- data.setPixel(x + xoffset, y + yoffset, 1);
- else
- data.setPixel(x + xoffset, y + yoffset, 2);
- }
- }
-
- return data;
-}
-/* (non-Javadoc)
- * Method declared on DialogCellEditor.
- */
-protected Control createContents(Composite cell) {
- Color bg = cell.getBackground();
- composite = new Composite(cell, SWT.NONE);
- composite.setBackground(bg);
- composite.setLayout(new ColorCellLayout());
- colorLabel = new Label(composite, SWT.LEFT);
- colorLabel.setBackground(bg);
- rgbLabel = new Label(composite, SWT.LEFT);
- rgbLabel.setBackground(bg);
- rgbLabel.setFont(cell.getFont());
- return composite;
-}
-/* (non-Javadoc)
- * Method declared on CellEditor.
- */
-public void dispose() {
- if (image != null) {
- image.dispose();
- image = null;
- }
- super.dispose();
-}
-/* (non-Javadoc)
- * Method declared on DialogCellEditor.
- */
-protected Object openDialogBox(Control cellEditorWindow) {
- ColorDialog dialog = new ColorDialog(cellEditorWindow.getShell());
- Object value = getValue();
- if (value != null)
- dialog.setRGB((RGB) value);
- value = dialog.open();
- return dialog.getRGB();
-}
-/* (non-Javadoc)
- * Method declared on DialogCellEditor.
- */
-protected void updateContents(Object value) {
- RGB rgb = (RGB) value;
- // XXX: We don't have a value the first time this method is called".
- if (rgb == null) {
- rgb = new RGB(0, 0, 0);
- }
- // XXX: Workaround for 1FMQ0P3: SWT:ALL - TableItem.setImage doesn't work if using the identical image."
- if (image != null)
- image.dispose();
-
- ImageData id = createColorImage(colorLabel.getParent().getParent(), rgb);
- ImageData mask = id.getTransparencyMask();
- image = new Image(colorLabel.getDisplay(), id, mask);
- colorLabel.setImage(image);
-
- rgbLabel.setText("(" + rgb.red + "," + rgb.green + "," + rgb.blue + ")");//$NON-NLS-4$//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnLayoutData.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnLayoutData.java
deleted file mode 100644
index 4dd2dac..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnLayoutData.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * An abstract column layout data describing the information needed
- * (by <code>TableLayout</code>) to properly lay out a table.
- * <p>
- * This class is not intended to be subclassed outside the framework.
- * </p>
- */
-public abstract class ColumnLayoutData {
-
- /**
- * Indicates whether the column is resizable.
- */
- public boolean resizable;
-/**
- * Creates a new column layout data object.
- *
- * @param resizable <code>true</code> if the column is resizable, and <code>false</code> if not
- */
-protected ColumnLayoutData(boolean resizable) {
- this.resizable = resizable;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnPixelData.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnPixelData.java
deleted file mode 100644
index 2aebd60..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnPixelData.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-
-/**
- * Describes the width of a table column in pixels, and
- * whether the column is resizable.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class ColumnPixelData extends ColumnLayoutData {
-
- /**
- * The column's width in pixels.
- */
- public int width;
-/**
- * Creates a resizable column width of the given number of pixels.
- *
- * @param widthInPixels the width of column in pixels
- */
-public ColumnPixelData(int widthInPixels) {
- this(widthInPixels, true);
-}
-/**
- * Creates a column width of the given number of pixels.
- *
- * @param widthInPixels the width of column in pixels
- * @param resizable <code>true</code> if the column is resizable,
- * and <code>false</code> if size of the column is fixed
- */
-public ColumnPixelData(int widthInPixels, boolean resizable) {
- super(resizable);
- Assert.isTrue(widthInPixels >= 0);
- this.width = widthInPixels;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnWeightData.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnWeightData.java
deleted file mode 100644
index e45071b..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnWeightData.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-
-/**
- * Describes the width of a table column in terms of a weight,
- * a minimum width, and whether the column is resizable.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class ColumnWeightData extends ColumnLayoutData {
-
- /**
- * Default width of a column (in pixels).
- */
- public static final int MINIMUM_WIDTH = 20;
-
- /**
- * The column's minimum width in pixels.
- */
- public int minimumWidth;
-
- /**
- * The column's weight.
- */
- public int weight;
-/**
- * Creates a resizable column width with the given weight and a default
- * minimum width.
- *
- * @param weight the weight of the column
- */
-public ColumnWeightData(int weight) {
- this(weight, true);
-}
-/**
- * Creates a resizable column width with the given weight and minimum width.
- *
- * @param weight the weight of the column
- * @param minimumWidth the minimum width of the column in pixels
- */
-public ColumnWeightData(int weight, int minimumWidth) {
- this(weight, minimumWidth, true);
-}
-/**
- * Creates a column width with the given weight and minimum width.
- *
- * @param weight the weight of the column
- * @param minimumWidth the minimum width of the column in pixels
- * @param resizable <code>true</code> if the column is resizable,
- * and <code>false</code> if size of the column is fixed
- */
-public ColumnWeightData(int weight, int minimumWidth, boolean resizable) {
- super(resizable);
- Assert.isTrue(weight >= 0);
- Assert.isTrue(minimumWidth >= 0);
- this.weight = weight;
- this.minimumWidth = minimumWidth;
-}
-/**
- * Creates a column width with the given weight and a default
- * minimum width.
- *
- * @param weight the weight of the column
- * @param resizable <code>true</code> if the column is resizable,
- * and <code>false</code> if size of the column is fixed
- */
-public ColumnWeightData(int weight, boolean resizable) {
- this(weight, MINIMUM_WIDTH, resizable);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ComboBoxCellEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ComboBoxCellEditor.java
deleted file mode 100644
index 7f47778..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ComboBoxCellEditor.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CCombo;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.text.MessageFormat;
-
-/**
- * A cell editor that presents a list of items in a combo box.
- * The cell editor's value is the zero-based index of the selected
- * item.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class ComboBoxCellEditor extends CellEditor {
-
- /**
- * The list of items to present in the combo box.
- */
- private String[] items;
-
- /**
- * The zero-based index of the selected item.
- */
- private int selection;
-
- /**
- * The custom combo box control.
- */
- private CCombo comboBox;
-
-/**
- * Creates a new cell editor with a combo containing the given
- * list of choices and parented under the given control. The cell
- * editor value is the zero-based index of the selected item.
- * Initially, the cell editor has no cell validator and
- * the first item in the list is selected.
- *
- * @param parent the parent control
- * @param items the list of strings for the combo box
- */
-public ComboBoxCellEditor(Composite parent, String[] items) {
- super(parent);
- Assert.isNotNull(items);
- this.items = items;
- selection = 0;
- populateComboBoxItems();
-}
-/* (non-Javadoc)
- * Method declared on CellEditor.
- */
-protected Control createControl(Composite parent) {
-
- comboBox = new CCombo(parent, SWT.NONE);
- comboBox.setFont(parent.getFont());
-
- comboBox.addKeyListener(new KeyAdapter() {
- // hook key pressed - see PR 14201
- public void keyPressed(KeyEvent e) {
- keyReleaseOccured(e);
- }
- });
-
- comboBox.addSelectionListener(new SelectionAdapter() {
- public void widgetDefaultSelected(SelectionEvent event) {
- // must set the selection before getting value
- selection = comboBox.getSelectionIndex();
- Object newValue = doGetValue();
- boolean newValidState = isCorrect(newValue);
- if (newValidState) {
- doSetValue(newValue);
- } else {
- // try to insert the current value into the error message.
- setErrorMessage(
- MessageFormat.format(getErrorMessage(), new Object[] {items[selection]}));
- }
- fireApplyEditorValue();
- }
- });
-
- comboBox.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
- e.doit = false;
- }
- }
- });
-
- return comboBox;
-}
-/**
- * The <code>ComboBoxCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method returns
- * the zero-based index of the current selection.
- *
- * @return the zero-based index of the current selection wrapped
- * as an <code>Integer</code>
- */
-protected Object doGetValue() {
- return new Integer(selection);
-}
-/* (non-Javadoc)
- * Method declared on CellEditor.
- */
-protected void doSetFocus() {
- comboBox.setFocus();
-}
-/**
- * The <code>ComboBoxCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method sets the
- * minimum width of the cell to 50 pixels to make sure the
- * arrow button and some text is visible. The list of CCombo
- * will be wide enough to show its longest item.
- */
-public LayoutData getLayoutData() {
- LayoutData layoutData = super.getLayoutData();
- layoutData.minimumWidth = 50;
- return layoutData;
-}
-/**
- * The <code>ComboBoxCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method
- * accepts a zero-based index of a selection.
- *
- * @param value the zero-based index of the selection wrapped
- * as an <code>Integer</code>
- */
-protected void doSetValue(Object value) {
- Assert.isTrue(comboBox != null && (value instanceof Integer));
- selection = ((Integer) value).intValue();
- comboBox.select(selection);
-}
-/**
- * Add the items to the combo box.
- */
-private void populateComboBoxItems() {
- if (comboBox != null && items != null) {
- for (int i = 0; i < items.length; i++)
- comboBox.add(items[i], i);
-
- setValueValid(true);
- }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ContentViewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ContentViewer.java
deleted file mode 100644
index 6de9236..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ContentViewer.java
+++ /dev/null
@@ -1,271 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Item;
-import java.util.*;
-
-/**
- * A content viewer is a model-based adapter on a widget which accesses its
- * model by means of a content provider and a label provider.
- * <p>
- * A viewer's model consists of elements, represented by objects.
- * A viewer defines and implements generic infrastructure for handling model
- * input, updates, and selections in terms of elements.
- * Input is obtained by querying an <code>IContentProvider</code> which returns
- * elements. The elements themselves are not displayed directly. They are
- * mapped to labels, containing text and/or an image, using the viewer's
- * <code>ILabelProvider</code>.
- * </p>
- * <p>
- * Implementing a concrete content viewer typically involves the following steps:
- * <ul>
- * <li>
- * create SWT controls for viewer (in constructor) (optional)
- * </li>
- * <li>
- * initialize SWT controls from input (inputChanged)
- * </li>
- * <li>
- * define viewer-specific update methods
- * </li>
- * <li>
- * support selections (<code>setSelection</code>, <code>getSelection</code>)
- * </ul>
- * </p>
- */
-public abstract class ContentViewer extends Viewer {
-
- /**
- * This viewer's content provider, or <code>null</code> if none.
- */
- private IContentProvider contentProvider = null;
-
- /**
- * This viewer's input, or <code>null</code> if none.
- * The viewer's input provides the "model" for the viewer's content.
- */
- private Object input = null;
-
- /**
- * This viewer's label provider. Initially <code>null</code>, but
- * lazily initialized (to a <code>SimpleLabelProvider</code>).
- */
- private IBaseLabelProvider labelProvider = null;
-
- /**
- * This viewer's label provider listener.
- * Note: Having a viewer register a label provider listener with
- * a label provider avoids having to define public methods
- * for internal events.
- */
- private final ILabelProviderListener labelProviderListener = new ILabelProviderListener() {
- public void labelProviderChanged(LabelProviderChangedEvent event) {
- ContentViewer.this.handleLabelProviderChanged(event);
- }
- };
-/**
- * Creates a content viewer with no input, no content provider, and a
- * default label provider.
- */
-protected ContentViewer() {
-}
-/**
- * Returns the content provider used by this viewer,
- * or <code>null</code> if this view does not yet have a content
- * provider.
- * <p>
- * The <code>ContentViewer</code> implementation of this method returns the content
- * provider recorded is an internal state variable.
- * Overriding this method is generally not required;
- * however, if overriding in a subclass,
- * <code>super.getContentProvider</code> must be invoked.
- * </p>
- *
- * @return the content provider, or <code>null</code> if none
- */
-public IContentProvider getContentProvider() {
- return contentProvider;
-}
-/**
- * The <code>ContentViewer</code> implementation of this <code>IInputProvider</code>
- * method returns the current input of this viewer, or <code>null</code>
- * if none. The viewer's input provides the "model" for the viewer's
- * content.
- */
-public Object getInput() {
- return input;
-}
-/**
- * Returns the label provider used by this viewer.
- * <p>
- * The <code>ContentViewer</code> implementation of this method returns the label
- * provider recorded in an internal state variable; if none has been
- * set (with <code>setLabelProvider</code>) a <code>SimpleLabelProvider</code>
- * will be created, remembered, and returned.
- * Overriding this method is generally not required;
- * however, if overriding in a subclass,
- * <code>super.getLabelProvider</code> must be invoked.
- * </p>
- *
- * @return a label provider
- */
-public IBaseLabelProvider getLabelProvider() {
- if (labelProvider == null)
- labelProvider = new LabelProvider();
- return labelProvider;
-}
-/**
- * Handles a dispose event on this viewer's control.
- * <p>
- * The <code>ContentViewer</code> implementation of this method disposes of this
- * viewer's label provider and content provider (if it has one).
- * Subclasses should override this method to perform any additional
- * cleanup of resources; however, overriding methods must invoke
- * <code>super.handleDispose</code>.
- * </p>
- *
- * @param event a dispose event
- */
-protected void handleDispose(DisposeEvent event) {
- if (contentProvider != null) {
- contentProvider.inputChanged(this, getInput(), null);
- contentProvider.dispose();
- contentProvider = null;
- }
- if (labelProvider != null) {
- labelProvider.removeListener(labelProviderListener);
- labelProvider.dispose();
- labelProvider = null;
- }
-}
-/**
- * Handles a label provider changed event.
- * <p>
- * The <code>ContentViewer</code> implementation of this method calls <code>labelProviderChanged()</code>
- * to cause a complete refresh of the viewer.
- * Subclasses may reimplement or extend.
- * </p>
- */
-protected void handleLabelProviderChanged(LabelProviderChangedEvent event) {
- labelProviderChanged();
-}
-/**
- * Adds event listener hooks to the given control.
- * <p>
- * All subclasses must call this method when their control is
- * first established.
- * </p>
- * <p>
- * The <code>ContentViewer</code> implementation of this method hooks
- * dispose events for the given control.
- * Subclasses may override if they need to add other control hooks;
- * however, <code>super.hookControl</code> must be invoked.
- * </p>
- *
- * @param control the control
- */
-protected void hookControl(Control control) {
- control.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- handleDispose(event);
- }
- });
-}
-/**
- * Notifies that the label provider has changed.
- * <p>
- * The <code>ContentViewer</code> implementation of this method calls <code>refresh()</code>.
- * Subclasses may reimplement or extend.
- * </p>
- */
-protected void labelProviderChanged() {
- refresh();
-}
-/**
- * Sets the content provider used by this viewer.
- * <p>
- * The <code>ContentViewer</code> implementation of this method records the
- * content provider in an internal state variable.
- * Overriding this method is generally not required;
- * however, if overriding in a subclass,
- * <code>super.setContentProvider</code> must be invoked.
- * </p>
- *
- * @param contentProvider the content provider
- * @see #getContentProvider
- */
-public void setContentProvider(IContentProvider contentProvider) {
- Assert.isNotNull(contentProvider);
- IContentProvider oldContentProvider = this.contentProvider;
- this.contentProvider = contentProvider;
- if (oldContentProvider != null) {
- Object currentInput = getInput();
- oldContentProvider.inputChanged(this, currentInput, null);
- oldContentProvider.dispose();
- contentProvider.inputChanged(this, null, currentInput);
- refresh();
- }
-}
-/**
- * The <code>ContentViewer</code> implementation of this <code>Viewer</code>
- * method invokes <code>inputChanged</code> on the content provider and then the
- * <code>inputChanged</code> hook method. This method fails if this viewer does
- * not have a content provider. Subclassers are advised to override
- * <code>inputChanged</code> rather than this method, but may extend this method
- * if required.
- */
-public void setInput(Object input) {
- Assert.isTrue(
- getContentProvider() != null,
- "ContentViewer must have a content provider when input is set."); //$NON-NLS-1$
-
- Object oldInput = getInput();
- contentProvider.inputChanged(this, oldInput, input);
- this.input = input;
-
- // call input hook
- inputChanged(this.input, oldInput);
-}
-/**
- * Sets the label provider for this viewer.
- * <p>
- * The <code>ContentViewer</code> implementation of this method ensures that the
- * given label provider is connected to this viewer and the
- * former label provider is disconnected from this viewer.
- * Overriding this method is generally not required;
- * however, if overriding in a subclass,
- * <code>super.setLabelProvider</code> must be invoked.
- * </p>
- *
- * @param labelProvider the label provider, or <code>null</code> if none
- */
-public void setLabelProvider(IBaseLabelProvider labelProvider) {
- IBaseLabelProvider oldProvider = this.labelProvider;
- // If it hasn't changed, do nothing.
- // This also ensures that the provider is not disposed
- // if set a second time.
- if (labelProvider == oldProvider) {
- return;
- }
- if (oldProvider != null) {
- oldProvider.removeListener(this.labelProviderListener);
- }
- this.labelProvider = labelProvider;
- if (labelProvider != null) {
- labelProvider.addListener(this.labelProviderListener);
- }
- refresh();
-
- // Dispose old provider after refresh, so that items never refer to stale images.
- if (oldProvider != null) {
- oldProvider.dispose();
- }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DecoratingLabelProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DecoratingLabelProvider.java
deleted file mode 100644
index 6e12b87..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DecoratingLabelProvider.java
+++ /dev/null
@@ -1,165 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.ListenerList;
-
-/**
- * A decorating label provider is a label provider which combines
- * a nested label provider and an optional decorator.
- * The decorator decorates the label text and image provided by the nested label provider.
- */
-public class DecoratingLabelProvider extends LabelProvider implements ILabelProvider{
- private ILabelProvider provider;
- private ILabelDecorator decorator;
- // Need to keep our own list of listeners
- private ListenerList listeners = new ListenerList();
-/**
- * Creates a decorating label provider which uses the given label decorator
- * to decorate labels provided by the given label provider.
- *
- * @param provider the nested label provider
- * @param decorator the label decorator, or <code>null</code> if no decorator is to be used initially
- */
-public DecoratingLabelProvider(ILabelProvider provider, ILabelDecorator decorator) {
- Assert.isNotNull(provider);
- this.provider = provider;
- this.decorator = decorator;
-}
-
-
-/**
- * The <code>DecoratingLabelProvider</code> implementation of this <code>IBaseLabelProvider</code> method
- * adds the listener to both the nested label provider and the label decorator.
- *
- * @param listener a label provider listener
- */
-public void addListener(ILabelProviderListener listener) {
- super.addListener(listener);
- provider.addListener(listener);
- if (decorator != null) {
- decorator.addListener(listener);
- }
- listeners.add(listener);
-}
-/**
- * The <code>DecoratingLabelProvider</code> implementation of this <code>IBaseLabelProvider</code> method
- * disposes both the nested label provider and the label decorator.
- */
-public void dispose() {
- provider.dispose();
- if (decorator != null) {
- decorator.dispose();
- }
-}
-/**
- * The <code>DecoratingLabelProvider</code> implementation of this
- * <code>ILabelProvider</code> method returns the image provided
- * by the nested label provider's <code>getImage</code> method,
- * decorated with the decoration provided by the label decorator's
- * <code>decorateImage</code> method.
- */
-public Image getImage(Object element) {
- Image image = provider.getImage(element);
- if (decorator != null) {
- Image decorated = decorator.decorateImage(image, element);
- if (decorated != null) {
- return decorated;
- }
- }
- return image;
-}
-/**
- * Returns the label decorator, or <code>null</code> if none has been set.
- *
- * @return the label decorator, or <code>null</code> if none has been set.
- */
-public ILabelDecorator getLabelDecorator() {
- return decorator;
-}
-/**
- * Returns the nested label provider.
- *
- * @return the nested label provider
- */
-public ILabelProvider getLabelProvider() {
- return provider;
-}
-/**
- * The <code>DecoratingLabelProvider</code> implementation of this
- * <code>ILabelProvider</code> method returns the text label provided
- * by the nested label provider's <code>getText</code> method,
- * decorated with the decoration provided by the label decorator's
- * <code>decorateText</code> method.
- */
-public String getText(Object element) {
- String text = provider.getText(element);
- if (decorator != null) {
- String decorated = decorator.decorateText(text, element);
- if (decorated != null) {
- return decorated;
- }
- }
- return text;
-}
-/**
- * The <code>DecoratingLabelProvider</code> implementation of this
- * <code>IBaseLabelProvider</code> method returns <code>true</code> if the corresponding method
- * on the nested label provider returns <code>true</code> or if the corresponding method on the
- * decorator returns <code>true</code>.
- */
-public boolean isLabelProperty(Object element, String property) {
- if (provider.isLabelProperty(element, property))
- return true;
- if (decorator != null && decorator.isLabelProperty(element, property))
- return true;
- return false;
-}
-/**
- * The <code>DecoratingLabelProvider</code> implementation of this <code>IBaseLabelProvider</code> method
- * removes the listener from both the nested label provider and the label decorator.
- *
- * @param listener a label provider listener
- */
-public void removeListener(ILabelProviderListener listener) {
- super.removeListener(listener);
- provider.removeListener(listener);
- if (decorator != null) {
- decorator.removeListener(listener);
- }
- listeners.remove(listener);
-}
-/**
- * Sets the label decorator.
- * Removes all known listeners from the old decorator, and adds all known listeners to the new decorator.
- * The old decorator is not disposed.
- * Fires a label provider changed event indicating that all labels should be updated.
- * Has no effect if the given decorator is identical to the current one.
- *
- * @param decorator the label decorator, or <code>null</code> if no decorations are to be applied
- */
-public void setLabelDecorator(ILabelDecorator decorator) {
- ILabelDecorator oldDecorator = this.decorator;
- if (oldDecorator != decorator) {
- Object[] listeners = this.listeners.getListeners();
- if (oldDecorator != null) {
- for (int i = 0; i < listeners.length; ++i) {
- oldDecorator.removeListener((ILabelProviderListener) listeners[i]);
- }
- }
- this.decorator = decorator;
- if (decorator != null) {
- for (int i = 0; i < listeners.length; ++i) {
- decorator.addListener((ILabelProviderListener) listeners[i]);
- }
- }
- fireLabelProviderChanged(new LabelProviderChangedEvent(this));
- }
-}
-
-
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DialogCellEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DialogCellEditor.java
deleted file mode 100644
index 75b7309..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DialogCellEditor.java
+++ /dev/null
@@ -1,252 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.MessageFormat;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * An abstract cell editor that uses a dialog.
- * Dialog cell editors usually have a label control on the left and a button on
- * the right. Pressing the button opens a dialog window (for example, a color dialog
- * or a file dialog) to change the cell editor's value.
- * The cell editor's value is the value of the dialog.
- * <p>
- * Subclasses may override the following method:
- * <ul>
- * <li><code>createButton</code>: creates the cell editor's button control</li>
- * <li><code>openDialogBox</code>: opens the dialog box when the end user presses
- * the button</li>
- * <li><code>updateLabel</code>: updates the cell editor's label after its
- * value has changed</li>
- * </ul>
- * </p>
- */
-public abstract class DialogCellEditor extends CellEditor {
-
- /**
- * Image registry key for three dot image (value <code>"cell_editor_dots_button_image"</code>).
- */
- public static final String CELL_EDITOR_IMG_DOTS_BUTTON = "cell_editor_dots_button_image";//$NON-NLS-1$
-
- /**
- * The editor control.
- */
- private Composite editor;
-
- /**
- * The current contents.
- */
- private Control contents;
-
- /**
- * The label that gets reused by <code>updateLabel</code>.
- */
- private Label defaultLabel;
-
- /**
- * The button.
- */
- private Button button;
-
- /**
- * The value of this cell editor; initially <code>null</code>.
- */
- private Object value = null;
-
- static {
- ImageRegistry reg = JFaceResources.getImageRegistry();
- reg.put(CELL_EDITOR_IMG_DOTS_BUTTON, ImageDescriptor.createFromFile(DialogCellEditor.class, "images/dots_button.gif"));//$NON-NLS-1$
- }
-
- /**
- * Internal class for laying out the dialog.
- */
- private class DialogCellLayout extends Layout {
- public void layout(Composite editor, boolean force) {
- Rectangle bounds = editor.getClientArea();
- Point size = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
- if (contents != null)
- contents.setBounds(0, 0, bounds.width-size.x, bounds.height);
- button.setBounds(bounds.width-size.x, 0, size.x, bounds.height);
- }
- public Point computeSize(Composite editor, int wHint, int hHint, boolean force) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- return new Point(wHint, hHint);
- Point contentsSize = contents.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
- Point buttonSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, force);
- // Just return the button width to ensure the button is not clipped
- // if the label is long.
- // The label will just use whatever extra width there is
- Point result = new Point(buttonSize.x,
- Math.max(contentsSize.y, buttonSize.y));
- return result;
- }
- }
-/**
- * Creates a new dialog cell editor parented under the given control.
- * The cell editor value is <code>null</code> initially, and has no
- * validator.
- *
- * @param parent the parent control
- */
-protected DialogCellEditor(Composite parent) {
- super(parent);
-}
-/**
- * Creates the button for this cell editor under the given parent control.
- * <p>
- * The default implementation of this framework method creates the button
- * display on the right hand side of the dialog cell editor. Subclasses
- * may extend or reimplement.
- * </p>
- *
- * @param parent the parent control
- * @return the new button control
- */
-protected Button createButton(Composite parent) {
- Button result = new Button(parent, SWT.DOWN);
- result.setText("..."); //$NON-NLS-1$
- return result;
-}
-/**
- * Creates the controls used to show the value of this cell editor.
- * <p>
- * The default implementation of this framework method creates
- * a label widget, using the same font and background color as the parent control.
- * </p>
- * <p>
- * Subclasses may reimplement. If you reimplement this method, you
- * should also reimplement <code>updateContents</code>.
- * </p>
- *
- * @param cell the control for this cell editor
- */
-protected Control createContents(Composite cell) {
- defaultLabel = new Label(cell, SWT.LEFT);
- defaultLabel.setFont(cell.getFont());
- defaultLabel.setBackground(cell.getBackground());
- return defaultLabel;
-}
-/* (non-Javadoc)
- * Method declared on CellEditor.
- */
-protected Control createControl(Composite parent) {
-
- Font font = parent.getFont();
- Color bg = parent.getBackground();
-
- editor = new Composite(parent, SWT.NONE);
- editor.setFont(font);
- editor.setBackground(bg);
- editor.setLayout(new DialogCellLayout());
-
- contents = createContents(editor);
- updateContents(value);
-
- button = createButton(editor);
- button.setFont(font);
-
- button.addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent e) {
- if (e.character == '\u001b') { // Escape
- fireCancelEditor();
- }
- }
- });
-
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- Object newValue = openDialogBox(editor);
- if (newValue != null) {
- boolean newValidState = isCorrect(newValue);
- if (newValidState) {
- doSetValue(newValue);
- } else {
- // try to insert the current value into the error message.
- setErrorMessage(MessageFormat.format(getErrorMessage(), new Object[] { newValue.toString()}));
- }
- fireApplyEditorValue();
- }
- }
- });
-
- setValueValid(true);
-
- return editor;
-}
-/* (non-Javadoc)
- * Method declared on CellEditor.
- */
-protected Object doGetValue() {
- return value;
-}
-/* (non-Javadoc)
- * Method declared on CellEditor.
- * The focus is set to the cell editor's button.
- */
-protected void doSetFocus() {
- button.setFocus();
-}
-/* (non-Javadoc)
- * Method declared on CellEditor.
- */
-protected void doSetValue(Object value) {
- this.value = value;
- updateContents(value);
-}
-/**
- * Returns the default label widget created by <code>createContents</code>.
- *
- * @return the default label widget
- */
-protected Label getDefaultLabel() {
- return defaultLabel;
-}
-/**
- * Opens a dialog box under the given parent control and returns the
- * dialog's value when it closes.
- * <p>
- * This framework method must be implemented by concrete subclasses.
- * It is called when the user has pressed the button and the dialog
- * box must pop up.
- * </p>
- *
- * @param cellEditorWindow the parent control cell editor's window
- * so that a subclass can adjust the dialog box accordingly
- * @return the selected value
- */
-protected abstract Object openDialogBox(Control cellEditorWindow);
-/**
- * Updates the controls showing the value of this cell editor.
- * <p>
- * The default implementation of this framework method just converts
- * the passed object to a string using <code>toString</code> and
- * sets this as the text of the label widget.
- * </p>
- * <p>
- * Subclasses may reimplement. If you reimplement this method, you
- * should also reimplement <code>createContents</code>.
- * </p>
- *
- * @param value the new value of this cell editor
- */
-protected void updateContents(Object value) {
- if (defaultLabel == null)
- return;
-
- String text = "";//$NON-NLS-1$
- if (value != null)
- text = value.toString();
- defaultLabel.setText(text);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DoubleClickEvent.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DoubleClickEvent.java
deleted file mode 100644
index 5b1d521..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DoubleClickEvent.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import java.util.EventObject;
-
-/**
- * Event object describing a double-click. The source of these
- * events is a viewer.
- *
- * @see IDoubleClickListener
- */
-public class DoubleClickEvent extends EventObject {
-
- /**
- * The selection.
- */
- protected ISelection selection;
-/**
- * Creates a new event for the given source and selection.
- *
- * @param source the viewer
- * @param selection the selection
- */
-public DoubleClickEvent(Viewer source, ISelection selection) {
- super(source);
- Assert.isNotNull(selection);
- this.selection = selection;
-}
-/**
- * Returns the selection.
- *
- * @return the selection
- */
-public ISelection getSelection() {
- return selection;
-}
-/**
- * Returns the viewer that is the source of this event.
- *
- * @return the originating viewer
- */
-public Viewer getViewer() {
- return (Viewer) getSource();
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IBaseLabelProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IBaseLabelProvider.java
deleted file mode 100644
index e104a54..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IBaseLabelProvider.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A label provider maps an element of the viewer's model to
- * an optional image and optional text string used to display
- * the element in the viewer's control. Certain label providers
- * may allow multiple labels per element.
- * This is an "abstract interface", defining methods common
- * to all label providers, but does not actually define the methods
- * to get the label(s) for an element. This interface should never
- * be directly implemented.
- * Most viewers will take either an <code>ILabelProvider</code> or
- * an <code>ITableLabelProvider</code>.
- * <p>
- * A label provider must not be shared between viewers
- * since a label provider generally manages SWT resources (images),
- * which must be disposed when the viewer is disposed.
- * To simplify life cycle management, the current label provider
- * of a viewer is disposed when the viewer is disposed.
- * </p>
- * <p>
- * Label providers can be used outside the context of viewers wherever
- * images are needed. When label providers are used in this fashion
- * it is the responsibility of the user to ensure <code>dispose</code>
- * is called when the provider is no longer needed.
- * </p>
- *
- * @see ILabelProvider
- * @see ITableLabelProvider
- */
-public interface IBaseLabelProvider {
-/**
- * Adds a listener to this label provider.
- * Has no effect if an identical listener is already registered.
- * <p>
- * Label provider listeners are informed about state changes
- * that affect the rendering of the viewer that uses this label provider.
- * </p>
- *
- * @param listener a label provider listener
- */
-public void addListener(ILabelProviderListener listener);
-/**
- * Disposes of this label provider. When a label provider is
- * attached to a viewer, the viewer will automatically call
- * this method when the viewer is being closed. When label providers
- * are used outside of the context of a viewer, it is the client's
- * responsibility to ensure that this method is called when the
- * provider is no longer needed.
- */
-public void dispose();
-/**
- * Returns whether the label would be affected
- * by a change to the given property of the given element.
- * This can be used to optimize a non-structural viewer update.
- * If the property mentioned in the update does not affect the label,
- * then the viewer need not update the label.
- *
- * @param element the element
- * @param property the property
- * @return <code>true</code> if the label would be affected,
- * and <code>false</code> if it would be unaffected
- */
-public boolean isLabelProperty(Object element, String property);
-/**
- * Removes a listener to this label provider.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a label provider listener
- */
-public void removeListener(ILabelProviderListener listener);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IBasicPropertyConstants.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IBasicPropertyConstants.java
deleted file mode 100644
index cc45300..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IBasicPropertyConstants.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Predefined property names used for elements displayed in viewers.
- *
- * @see StructuredViewer#update(Object, String[])
- * @see StructuredViewer#update(Object[], String[])
- * @see IBaseLabelProvider#isLabelProperty
- * @see ViewerSorter#isSorterProperty
- * @see ViewerFilter#isFilterProperty
- */
-public interface IBasicPropertyConstants {
-
- /**
- * Property name constant (value <code>"org.eclipse.jface.text"</code>)
- * for an element's label text.
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getText
- */
- public static final String P_TEXT = "org.eclipse.jface.text"; //$NON-NLS-1$
-
-
- /**
- * Property name constant (value <code>"org.eclipse.jface.image"</code>)
- * for an element's label image.
- *
- * @see org.eclipse.jface.viewers.ILabelProvider#getImage
- */
- public static final String P_IMAGE = "org.eclipse.jface.image"; //$NON-NLS-1$
-
-
- /**
- * Property name constant (value <code>"org.eclipse.jface.children"</code>)
- * for an element's children.
- */
- public static final String P_CHILDREN = "org.eclipse.jface.children"; //$NON-NLS-1$
-
- /**
- * Property name constant (value <code>"org.eclipse.jface.parent"</code>)
- * for an element's parent object.
- */
- public static final String P_PARENT = "org.eclipse.jface.parent"; //$NON-NLS-1$
-
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellEditorListener.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellEditorListener.java
deleted file mode 100644
index 7ca0059..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellEditorListener.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A listener which is notified of significant events in the
- * life of a cell editor.
- * <p>
- * This interface should be implemented by classes that wish to
- * react to cell editor activity.
- * </p>
- * <p>
- * Note: the cell editor is not passed as a parameter to any
- * of these methods; so the assumption is that the listener
- * knows which cell editor is talking to it.
- * </p>
- */
-public interface ICellEditorListener {
-/**
- * Notifies that the end user has requested applying a value.
- * All cell editors send this notification.
- * <p>
- * The normal reaction is to update the model with the current cell editor value.
- * However, if the value is not valid, it should not be applied.
- * A typical text-based cell editor would send this message
- * when the end user hits Return, whereas other editors would
- * send it whenever their value changes.
- * </p>
- */
-public void applyEditorValue();
-/**
- * Notifies that the end user has canceled editing.
- * All cell editors send this notification.
- * A listener should <b>not</b> update the model based on this
- * notification; see <code>applyEditorValue</code>.
- */
-public void cancelEditor();
-/**
- * Notifies that the end user has changed the value in the cell editor.
- * This notification is normally sent only by text-based editors
- * in response to a keystroke, so that interested party may show an
- * error message reflecting the current valid state. A listener should
- * <b>not</b> update the model based on this notification; see
- * <code>applyEditorValue</code>.
- * <p>
- * If the <code>newValidState</code> parameter is <code>true</code>,
- * the new value may be retrieved by calling <code>ICellEditor.getValue</code>
- * on the appropriate cell editor.
- * </p>
- *
- * @param oldValidState the valid state before the end user changed the value
- * @param newValidState the current valid state
- */
-public void editorValueChanged(boolean oldValidState, boolean newValidState);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellEditorValidator.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellEditorValidator.java
deleted file mode 100644
index 68ff1a5..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellEditorValidator.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * An interface for validating a cell editor's input.
- * <p>
- * This interface should be implemented by classes that wish to
- * act as cell editor validators.
- * </p>
- */
-public interface ICellEditorValidator {
-/**
- * Returns a string indicating whether the given value is valid;
- * <code>null</code> means valid, and non-<code>null</code> means
- * invalid, with the result being the error message to display
- * to the end user.
- *
- * @param value the value to be validated
- * @return the error message, or <code>null</code> indicating
- * that the value is valid
- */
-public String isValid(Object value);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellModifier.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellModifier.java
deleted file mode 100644
index 74748ef..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellModifier.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A cell modifier is used to access the data model from a cell
- * editor in an abstract way. It offers methods to:
- * <ul>
- * <li>to check if a a model element's property can be edited or not</li>
- * <li>retrieve a value a model element's property</li>
- * <li>to store a cell editor's value back into the model
- * element's property</li>
- * </ul>
- * <p>
- * This interface should be implemented by classes that wish to
- * act as cell modifiers.
- * </p>
- */
-public interface ICellModifier {
-/**
- * Checks whether the given property of the given element can be
- * modified.
- *
- * @param element the element
- * @param property the property
- * @return <code>true</code> if the property can be modified,
- * and <code>false</code> if it is not modifiable
- */
-public boolean canModify(Object element, String property);
-/**
- * Returns the value for the given property of the given element.
- * Returns <code>null</code> if the element does not have the given property.
- *
- * @param element the element
- * @param property the property
- * @return the property value
- */
-public Object getValue(Object element, String property);
-/**
- * Modifies the value for the given property of the given element.
- * Has no effect if the element does not have the given property,
- * or if the property cannot be modified.
- * <p>
- * Note that it is possible for an SWT Item to be passed instead of
- * the model element. To handle this case in a safe way, use:
- * <pre>
- * if (element instanceof Item) {
- * element = ((Item) element).getData();
- * }
- * // modify the element's property here
- * </pre>
- * </p>
- *
- * @param element the model element or SWT Item (see above)
- * @param property the property
- * @param value the new property value
- *
- * @see org.eclipse.swt.widgets.Item
- */
-public void modify(Object element, String property, Object value);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICheckStateListener.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICheckStateListener.java
deleted file mode 100644
index 8e361b4..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICheckStateListener.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A listener which is notified of changes to the checked
- * state of items in checkbox viewers.
- *
- * @see CheckStateChangedEvent
- */
-public interface ICheckStateListener {
-/**
- * Notifies of a change to the checked state of an element.
- *
- * @param event event object describing the change
- */
-void checkStateChanged(CheckStateChangedEvent event);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICheckable.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICheckable.java
deleted file mode 100644
index dab8d32..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICheckable.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.EventObject;
-
-/**
- * Interface for objects that support elements with a checked state.
- *
- * @see ICheckStateListener
- * @see CheckStateChangedEvent
- */
-public interface ICheckable {
-/**
- * Adds a listener for changes to the checked state of elements
- * in this viewer.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a check state listener
- */
-public void addCheckStateListener(ICheckStateListener listener);
-/**
- * Returns the checked state of the given element.
- *
- * @param element the element
- * @return <code>true</code> if the element is checked,
- * and <code>false</code> if not checked
- */
-public boolean getChecked(Object element);
-/**
- * Removes the given check state listener from this viewer.
- * Has no effect if an identical listener is not registered.
- *
- * @param listener a check state listener
- */
-public void removeCheckStateListener(ICheckStateListener listener);
-/**
- * Sets the checked state for the given element in this viewer.
- *
- * @param element the element
- * @param state <code>true</code> if the item should be checked,
- * and <code>false</code> if it should be unchecked
- * @return <code>true</code> if the checked state could be set,
- * and <code>false</code> otherwise
- */
-public boolean setChecked(Object element, boolean state);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IContentProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IContentProvider.java
deleted file mode 100644
index 3181c11..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IContentProvider.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A content provider mediates between the viewer's model
- * and the viewer itself.
- *
- * @see IViewer#setContentProvider
- */
-public interface IContentProvider {
-/**
- * Disposes of this content provider.
- * This is called by the viewer when it is disposed.
- * <p>
- * The viewer should not updated during this call, as it is in the process
- * of being disposed.
- * </p>
- */
-public void dispose();
-/**
- * Notifies this content provider that the given viewer's input
- * has been switched to a different element.
- * <p>
- * A typical use for this method is registering the content provider as a listener
- * to changes on the new input (using model-specific means), and deregistering the viewer
- * from the old input. In response to these change notifications, the content provider
- * should update the viewer (see the add, remove, update and refresh methods on the viewers).
- * </p>
- * <p>
- * The viewer should not updated during this call, as it might be in the process
- * of being disposed.
- * </p>
- *
- * @param viewer the viewer
- * @param oldInput the old input element, or <code>null</code> if the viewer
- * did not previously have an input
- * @param newInput the new input element, or <code>null</code> if the viewer
- * does not have an input
- */
-public void inputChanged(Viewer viewer, Object oldInput, Object newInput);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IDoubleClickListener.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IDoubleClickListener.java
deleted file mode 100644
index 2f92d53..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IDoubleClickListener.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A listener which is notified of double-click events on viewers.
- */
-public interface IDoubleClickListener {
-/**
- * Notifies of a double click.
- *
- * @param event event object describing the double-click
- */
-public void doubleClick(DoubleClickEvent event);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IInputProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IInputProvider.java
deleted file mode 100644
index 4107b66..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IInputProvider.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Interface common to all objects that provide an input.
- */
-public interface IInputProvider {
-/**
- * Returns the input.
- *
- * @return the input object
- */
-public Object getInput();
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IInputSelectionProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IInputSelectionProvider.java
deleted file mode 100644
index 2278bd2..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IInputSelectionProvider.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Interface common to all objects that provide both an input and
- * a selection.
- */
-public interface IInputSelectionProvider extends IInputProvider, ISelectionProvider {
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelDecorator.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelDecorator.java
deleted file mode 100644
index 683f95c..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelDecorator.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * A label decorator decorates the label text and image for some element.
- * The original label text and image are obtained by some other means,
- * for example by a label provider.
- *
- * @see ILabelProvider
- */
-public interface ILabelDecorator extends IBaseLabelProvider {
-/**
- * Returns an image that is based on the given image,
- * but decorated with additional information relating to the state
- * of the provided element.
- *
- * @param image the input image to decorate, or <code>null</code> if the element has no image
- * @param element the element whose image is being decorated
- * @return the decorated image, or <code>null</code> if no decoration is to be applied
- *
- * @see org.eclipse.jface.resource.CompositeImageDescriptor
- */
-public Image decorateImage(Image image, Object element);
-/**
- * Returns a text label that is based on the given text label,
- * but decorated with additional information relating to the state
- * of the provided element.
- *
- * @param text the input text label to decorate
- * @param element the element whose image is being decorated
- * @return the decorated text label, or <code>null</code> if no decoration is to be applied
- */
-public String decorateText(String text, Object element);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelProvider.java
deleted file mode 100644
index 0f9e239..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelProvider.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Extends <code>IBaseLabelProvider</code> with the methods
- * to provide the text and/or image for the label of a given element.
- * Used by most structured viewers, except table viewers.
- */
-public interface ILabelProvider extends IBaseLabelProvider {
-/**
- * Returns the image for the label of the given element. The image
- * is owned by the label provider and must not be disposed directly.
- * Instead, dispose the label provider when no longer needed.
- *
- * @param element the element for which to provide the label image
- * @return the image used to label the element, or <code>null</code>
- * if these is no image for the given object
- */
-public Image getImage(Object element);
-/**
- * Returns the text for the label of the given element.
- *
- * @param element the element for which to provide the label text
- * @return the text string used to label the element, or <code>null</code>
- * if these is no text label for the given object
- */
-public String getText(Object element);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelProviderListener.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelProviderListener.java
deleted file mode 100644
index 4adf655..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelProviderListener.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A listener which is notified when a label provider's state changes.
- *
- * @see IBaseLabelProvider#addListener
- * @see IBaseLabelProvider#removeListener
- */
-public interface ILabelProviderListener {
-/**
- * Notifies this listener that the state of the label provider
- * has changed in a way that affects the labels it computes.
- * <p>
- * A typical response would be to refresh all labels by
- * re-requesting them from the label provider.
- * </p>
- *
- * @param event the label provider change event
- */
-public void labelProviderChanged(LabelProviderChangedEvent event);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IOpenListener.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IOpenListener.java
deleted file mode 100644
index d5e33c7..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IOpenListener.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A listener which is notified of open events on viewers.
- */
-public interface IOpenListener {
-/**
- * Notifies of an open event.
- *
- * @param event event object describing the open event
- */
-public void open(OpenEvent event);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelection.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelection.java
deleted file mode 100644
index 71e5db9..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelection.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * Interface for a selection.
- *
- * @see ISelectionProvider
- * @see ISelectionChangedListener
- * @see SelectionChangedEvent
- */
-public interface ISelection {
-
-/**
- * Returns whether this selection is empty.
- *
- * @return <code>true</code> if this selection is empty,
- * and <code>false</code> otherwise
- */
-public boolean isEmpty();
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelectionChangedListener.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelectionChangedListener.java
deleted file mode 100644
index c085ffe..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelectionChangedListener.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A listener which is notified when a viewer's selection changes.
- *
- * @see ISelection
- * @see ISelectionProvider
- * @see SelectionChangedEvent
- */
-public interface ISelectionChangedListener {
-/**
- * Notifies that the selection has changed.
- *
- * @param event event object describing the change
- */
-public void selectionChanged(SelectionChangedEvent event);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelectionProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelectionProvider.java
deleted file mode 100644
index 16697a7..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelectionProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Interface common to all objects that provide a selection.
- *
- * @see ISelection
- * @see ISelectionChangedListener
- * @see SelectionChangedEvent
- */
-public interface ISelectionProvider {
-/**
- * Adds a listener for selection changes in this selection provider.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a selection changed listener
- */
-public void addSelectionChangedListener(ISelectionChangedListener listener);
-/**
- * Returns the current selection for this provider.
- *
- * @return the current selection
- */
-public ISelection getSelection();
-/**
- * Removes the given selection change listener from this selection provider.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a selection changed listener
- */
-public void removeSelectionChangedListener(ISelectionChangedListener listener);
-/**
- * Sets the current selection for this selection provider.
- *
- * @param selection the new selection
- */
-public void setSelection(ISelection selection);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IStructuredContentProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IStructuredContentProvider.java
deleted file mode 100644
index bc4c272..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IStructuredContentProvider.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Iterator;
-
-/**
- * An interface to content providers for structured viewers.
- *
- * @see StructuredViewer
- */
-public interface IStructuredContentProvider extends IContentProvider {
-/**
- * Returns the elements to display in the viewer
- * when its input is set to the given element.
- * These elements can be presented as rows in a table, items in a list, etc.
- * The result is not modified by the viewer.
- *
- * @param inputElement the input element
- * @return the array of elements to display in the viewer
- */
-public Object[] getElements(Object inputElement);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IStructuredSelection.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IStructuredSelection.java
deleted file mode 100644
index 2e17a2a..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IStructuredSelection.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * A selection containing elements.
- */
-public interface IStructuredSelection extends ISelection {
-/**
- * Returns the first element in this selection, or <code>null</code>
- * if the selection is empty.
- *
- * @return an element, or <code>null</code> if none
- */
-public Object getFirstElement();
-/**
- * Returns an iterator over the elements of this selection.
- *
- * @return an iterator over the selected elements
- */
-public Iterator iterator();
-/**
- * Returns the number of elements selected in this selection.
- *
- * @return the number of elements selected
- */
-public int size();
-/**
- * Returns the elements in this selection as an array.
- *
- * @return the selected elements as an array
- */
-public Object[] toArray();
-/**
- * Returns the elements in this selection as a <code>List</code>.
- *
- * @return the selected elements as a list
- */
-public List toList();
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITableLabelProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITableLabelProvider.java
deleted file mode 100644
index fbdb89d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITableLabelProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Extends <code>IBaseLabelProvider</code> with the methods
- * to provide the text and/or image for each column of a given element.
- * Used by table viewers.
- *
- * @see TableViewer
- */
-public interface ITableLabelProvider extends IBaseLabelProvider {
-/**
- * Returns the label image for the given column of the given element.
- *
- * @param element the object representing the entire row, or
- * <code>null</code> indicating that no input object is set
- * in the viewer
- * @param columnIndex the zero-based index of the column in which
- * the label appears
- */
-public Image getColumnImage(Object element, int columnIndex);
-/**
- * Returns the label text for the given column of the given element.
- *
- * @param element the object representing the entire row, or
- * <code>null</code> indicating that no input object is set
- * in the viewer
- * @param columnIndex the zero-based index of the column in which the label appears
- */
-public String getColumnText(Object element, int columnIndex);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITreeContentProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITreeContentProvider.java
deleted file mode 100644
index 946c0ee..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITreeContentProvider.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Iterator;
-
-/**
- * An interface to content providers for tree-structure-oriented
- * viewers.
- *
- * @see AbstractTreeViewer
- */
-public interface ITreeContentProvider extends IStructuredContentProvider {
-/**
- * Returns the child elements of the given parent element.
- * <p>
- * The difference between this method and <code>IStructuredContentProvider.getElements</code>
- * is that <code>getElements</code> is called to obtain the
- * tree viewer's root elements, whereas <code>getChildren</code> is used
- * to obtain the children of a given parent element in the tree (including a root).
- * </p>
- * The result is not modified by the viewer.
- *
- * @param parentElement the parent element
- * @return an array of child elements
- */
-public Object[] getChildren(Object parentElement);
-/**
- * Returns the parent for the given element, or <code>null</code>
- * indicating that the parent can't be computed.
- * In this case the tree-structured viewer can't expand
- * a given node correctly if requested.
- *
- * @param element the element
- * @return the parent element, or <code>null</code> if it
- * has none or if the parent cannot be computed
- */
-public Object getParent(Object element);
-/**
- * Returns whether the given element has children.
- * <p>
- * Intended as an optimization for when the viewer does not
- * need the actual children. Clients may be able to implement
- * this more efficiently than <code>getChildren</code>.
- * </p>
- *
- * @param element the element
- * @return <code>true</code> if the given element has children,
- * and <code>false</code> if it has no children
- */
-public boolean hasChildren(Object element);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITreeViewerListener.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITreeViewerListener.java
deleted file mode 100644
index 8f50cb5..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITreeViewerListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A listener which is notified when a tree viewer expands or collapses
- * a node.
- */
-public interface ITreeViewerListener {
-/**
- * Notifies that a node in the tree has been collapsed.
- *
- * @param event event object describing details
- */
-public void treeCollapsed(TreeExpansionEvent event);
-/**
- * Notifies that a node in the tree has been expanded.
- *
- * @param event event object describing details
- */
-public void treeExpanded(TreeExpansionEvent event);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/LabelProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/LabelProvider.java
deleted file mode 100644
index 899627c..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/LabelProvider.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.swt.graphics.Image;
-import java.util.*;
-
-/**
- * A label provider implementation which, by default, uses an element's
- * <code>toString</code> value for its text and <code>null</code> for its image.
- * <p>
- * This class may be used as is, or subclassed to provide richer labels.
- * Subclasses may override any of the following methods:
- * <ul>
- * <li><code>isLabelProperty</code></li>
- * <li><code>getImage</code></li>
- * <li><code>getText</code></li>
- * <li><code>dispose</code></li>
- * </ul>
- * </p>
- */
-public class LabelProvider implements ILabelProvider {
- private ListenerList listeners = new ListenerList(1);
-/**
- * Creates a new label provider.
- */
-public LabelProvider() {
-}
-/* (non-Javadoc)
- * Method declared on IBaseLabelProvider.
- */
-public void addListener(ILabelProviderListener listener) {
- listeners.add(listener);
-}
-/**
- * The <code>LabelProvider</code> implementation of this
- * <code>IBaseLabelProvider</code> method does nothing. Subclasses may extend.
- */
-public void dispose() {
-}
-/**
- * Fires a label provider changed event to all registered listeners
- * Only listeners registered at the time this method is called are notified.
- *
- * @param event a label provider changed event
- *
- * @see ILabelProviderListener#labelProviderChanged
- */
-protected void fireLabelProviderChanged(LabelProviderChangedEvent event) {
- Object[] listeners = this.listeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ILabelProviderListener) listeners[i]).labelProviderChanged(event);
- }
-}
-/**
- * The <code>LabelProvider</code> implementation of this
- * <code>ILabelProvider</code> method returns <code>null</code>. Subclasses may
- * override.
- */
-public Image getImage(Object element) {
- return null;
-}
-/**
- * The <code>LabelProvider</code> implementation of this
- * <code>ILabelProvider</code> method returns the element's <code>toString</code>
- * string. Subclasses may override.
- */
-public String getText(Object element) {
- return element == null ? "" : element.toString();//$NON-NLS-1$
-}
-/**
- * The <code>LabelProvider</code> implementation of this
- * <code>IBaseLabelProvider</code> method returns <code>true</code>. Subclasses may
- * override.
- */
-public boolean isLabelProperty(Object element, String property) {
- return true;
-}
-/* (non-Javadoc)
- * Method declared on IBaseLabelProvider.
- */
-public void removeListener(ILabelProviderListener listener) {
- listeners.remove(listener);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/LabelProviderChangedEvent.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/LabelProviderChangedEvent.java
deleted file mode 100644
index 04cebe9..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/LabelProviderChangedEvent.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.EventObject;
-
-/**
- * Event object describing a label provider state change.
- *
- * @see ILabelProviderListener
- */
-public class LabelProviderChangedEvent extends EventObject {
-
- /**
- * The elements whose labels need to be updated or <code>null</code>.
- */
- private Object[] elements;
-
- /**
- * Creates a new event for the given source, indicating that all labels
- * provided by the source are no longer valid and should be updated.
- *
- * @param source the label provider
- */
- public LabelProviderChangedEvent(IBaseLabelProvider source) {
- super(source);
- }
-
- /**
- * Creates a new event for the given source, indicating that the label
- * provided by the source for the given elements is no longer valid and should be updated.
- *
- * @param source the label provider
- * @param elements the element whose labels have changed
- */
- public LabelProviderChangedEvent(
- IBaseLabelProvider source,
- Object[] elements) {
- super(source);
- this.elements = elements;
- }
-
- /**
- * Creates a new event for the given source, indicating that the label
- * provided by the source for the given element is no longer valid and should be updated.
- *
- * @param source the label provider
- * @param element the element whose label needs to be updated
- */
- public LabelProviderChangedEvent(IBaseLabelProvider source, Object element) {
- super(source);
- this.elements = new Object[1];
- this.elements[0] = element;
- }
-
- /**
- * Returns the first element whose label needs to be updated,
- * or <code>null</code> if all labels need to be updated.
- *
- * @return the element whose label needs to be updated or <code>null</code>
- */
- public Object getElement() {
- if (this.elements == null || this.elements.length == 0)
- return null;
- else
- return this.elements[0];
- }
-
- /**
- * Returns the elements whose labels need to be updated,
- * or <code>null</code> if all labels need to be updated.
- *
- * @return the element whose labels need to be updated or <code>null</code>
- */
- public Object[] getElements() {
- if (this.elements == null)
- return null;
- else
- return this.elements;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ListViewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ListViewer.java
deleted file mode 100644
index 740774d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ListViewer.java
+++ /dev/null
@@ -1,379 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List; // Otherwise ambiguous
-
-/**
- * A concrete viewer based on an SWT <code>List</code> control.
- * <p>
- * This class is not intended to be subclassed. It is designed to be
- * instantiated with a pre-existing SWT list control and configured
- * with a domain-specific content provider, label provider, element filter (optional),
- * and element sorter (optional).
- * </p>
- */
-public class ListViewer extends StructuredViewer {
-
- /**
- * This viewer's list control.
- */
- private org.eclipse.swt.widgets.List list;
-
- /**
- * A list of viewer elements (element type: <code>Object</code>).
- */
- private java.util.List listMap = new ArrayList();
-/**
- * Creates a list viewer on a newly-created list control under the given parent.
- * The list control is created using the SWT style bits <code>MULTI, H_SCROLL, V_SCROLL,</code> and <code>BORDER</code>.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param parent the parent control
- */
-public ListViewer(Composite parent) {
- this(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
-}
-/**
- * Creates a list viewer on a newly-created list control under the given parent.
- * The list control is created using the given SWT style bits.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param parent the parent control
- * @param style the SWT style bits
- */
-public ListViewer(Composite parent, int style) {
- this(new org.eclipse.swt.widgets.List(parent, style));
-}
-/**
- * Creates a list viewer on the given list control.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param list the list control
- */
-public ListViewer(org.eclipse.swt.widgets.List list) {
- this.list = list;
- hookControl(list);
-}
-/**
- * Adds the given elements to this list viewer.
- * If this viewer does not have a sorter, the elements are added at the end
- * in the order given; otherwise the elements are inserted at appropriate positions.
- * <p>
- * This method should be called (by the content provider) when elements
- * have been added to the model, in order to cause the viewer to accurately
- * reflect the model. This method only affects the viewer, not the model.
- * </p>
- *
- * @param elements the elements to add
- */
-public void add(Object[] elements) {
- Object[] filtered = filter(elements);
- ILabelProvider labelProvider = (ILabelProvider) getLabelProvider();
- for (int i = 0; i < filtered.length; i++){
- Object element = filtered[i];
- int ix = indexForElement(element);
- list.add(labelProvider.getText(element), ix);
- listMap.add(ix, element);
- mapElement(element, list); // must map it, since findItem only looks in map, if enabled
- }
-}
-/**
- * Adds the given element to this list viewer.
- * If this viewer does not have a sorter, the element is added at the end;
- * otherwise the element is inserted at the appropriate position.
- * <p>
- * This method should be called (by the content provider) when a single element
- * has been added to the model, in order to cause the viewer to accurately
- * reflect the model. This method only affects the viewer, not the model.
- * Note that there is another method for efficiently processing the simultaneous
- * addition of multiple elements.
- * </p>
- *
- * @param element the element
- */
-public void add(Object element) {
- add(new Object[] { element });
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- * Since SWT.List doesn't use items we always return the List itself.
- */
-protected Widget doFindInputItem(Object element) {
- if (element != null && element.equals(getRoot()))
- return getList();
- return null;
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- * Since SWT.List doesn't use items we always return the List itself.
- */
-protected Widget doFindItem(Object element) {
- if (element != null) {
- if (listMap.contains(element))
- return getList();
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected void doUpdateItem(Widget data, Object element, boolean fullMap) {
- if (element != null) {
- int ix = listMap.indexOf(element);
- if (ix >= 0) {
- ILabelProvider labelProvider = (ILabelProvider) getLabelProvider();
- list.setItem(ix, labelProvider.getText(element));
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on Viewer.
- */
-public Control getControl() {
- return list;
-}
-/**
- * Returns the element with the given index from this list viewer.
- * Returns <code>null</code> if the index is out of range.
- *
- * @param index the zero-based index
- * @return the element at the given index, or <code>null</code> if the
- * index is out of range
- */
-public Object getElementAt(int index) {
- if (index >= 0 && index < listMap.size())
- return listMap.get(index);
- return null;
-}
-/**
- * The list viewer implementation of this <code>Viewer</code> framework
- * method returns the label provider, which in the case of list
- * viewers will be an instance of <code>ILabelProvider</code>.
- */
-public IBaseLabelProvider getLabelProvider() {
- return super.getLabelProvider();
-}
-/**
- * Returns this list viewer's list control.
- *
- * @return the list control
- */
-public org.eclipse.swt.widgets.List getList() {
- return list;
-}
-/* (non-Javadoc)
- * Method declared on Viewer.
- */
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected List getSelectionFromWidget() {
- int[] ixs = getList().getSelectionIndices();
- ArrayList list = new ArrayList(ixs.length);
- for (int i = 0; i < ixs.length; i++) {
- Object e = getElementAt(ixs[i]);
- if (e != null)
- list.add(e);
- }
- return list;
-}
-/*
- * Returns the index where the item should be inserted.
-*/
-protected int indexForElement(Object element) {
- ViewerSorter sorter = getSorter();
- if(sorter == null)
- return list.getItemCount();
- int count = list.getItemCount();
- int min = 0, max = count - 1;
- while (min <= max) {
- int mid = (min + max) / 2;
- Object data = listMap.get(mid);
- int compare = sorter.compare(this, data, element);
- if (compare == 0) {
- // find first item > element
- while (compare == 0) {
- ++mid;
- if (mid >= count) {
- break;
- }
- data = listMap.get(mid);
- compare = sorter.compare(this, data, element);
- }
- return mid;
- }
- if (compare < 0)
- min = mid + 1;
- else
- max = mid - 1;
- }
- return min;
-}
-/* (non-Javadoc)
- * Method declared on Viewer.
- */
-protected void inputChanged(Object input, Object oldInput) {
- listMap.clear();
- Object[] children = getSortedChildren(getRoot());
- int size = children.length;
- org.eclipse.swt.widgets.List list = getList();
- list.removeAll();
- String[] labels = new String[size];
- for (int i = 0; i < size; i++) {
- Object el = children[i];
- labels[i] = ((ILabelProvider) getLabelProvider()).getText(el);
- listMap.add(el);
- mapElement(el, list); // must map it, since findItem only looks in map, if enabled
- }
- list.setItems(labels);
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected void internalRefresh(Object element) {
-
- if (element == null || element.equals(getRoot())) {
- // the parent
- if (listMap != null)
- listMap.clear();
- unmapAllElements();
- List selection = getSelectionFromWidget();
- list.setRedraw(false);
- list.removeAll();
- Object[] children = getSortedChildren(getRoot());
- ILabelProvider labelProvider= (ILabelProvider) getLabelProvider();
- for (int i= 0; i < children.length; i++) {
- Object el = children[i];
- list.add(labelProvider.getText(el), i);
- listMap.add(el);
- mapElement(el, list); // must map it, since findItem only looks in map, if enabled
- }
- list.setRedraw(true);
- setSelectionToWidget(selection, false);
- } else {
- doUpdateItem(list, element, true);
- }
-}
-/**
- * Removes the given elements from this list viewer.
- *
- * @param elements the elements to remove
- */
-private void internalRemove(final Object[] elements) {
- Object input = getInput();
- for (int i = 0; i < elements.length; ++i) {
- if (elements[i].equals(input)) {
- setInput(null);
- return;
- }
- int ix = listMap.indexOf(elements[i]);
- if (ix >= 0) {
- list.remove(ix);
- listMap.remove(ix);
- unmapElement(elements[i], list);
- }
- }
-}
-/**
- * Removes the given elements from this list viewer.
- * The selection is updated if required.
- * <p>
- * This method should be called (by the content provider) when elements
- * have been removed from the model, in order to cause the viewer to accurately
- * reflect the model. This method only affects the viewer, not the model.
- * </p>
- *
- * @param elements the elements to remove
- */
-public void remove(final Object[] elements) {
- preservingSelection(new Runnable() {
- public void run() {
- internalRemove(elements);
- }
- });
-}
-/**
- * Removes the given element from this list viewer.
- * The selection is updated if necessary.
- * <p>
- * This method should be called (by the content provider) when a single element
- * has been removed from the model, in order to cause the viewer to accurately
- * reflect the model. This method only affects the viewer, not the model.
- * Note that there is another method for efficiently processing the simultaneous
- * removal of multiple elements.
- * </p>
- *
- * @param element the element
- */
-public void remove(Object element) {
- remove(new Object[] { element });
-}
-/*
- * Non-Javadoc.
- * Method defined on StructuredViewer.
- */
-public void reveal(Object element) {
- int index = listMap.indexOf(element);
- if (index == -1)
- return;
- // algorithm patterned after List.showSelection()
- int count = list.getItemCount();
- if (count == 0)
- return;
- int height = list.getItemHeight();
- Rectangle rect = list.getClientArea();
- int topIndex = list.getTopIndex();
- int visibleCount = Math.max ((rect.x + rect.height) / height, 1);
- int bottomIndex = Math.min (topIndex + visibleCount + 1, count - 1);
- if ((topIndex <= index) && (index <= bottomIndex)) return;
- int newTop = Math.min (Math.max (index - (visibleCount / 2), 0), count - 1);
- list.setTopIndex(newTop);
-}
-/**
- * The list viewer implementation of this <code>Viewer</code> framework
- * method ensures that the given label provider is an instance
- * of <code>ILabelProvider</code>.
- */
-public void setLabelProvider(IBaseLabelProvider labelProvider) {
- Assert.isTrue(labelProvider instanceof ILabelProvider);
- super.setLabelProvider(labelProvider);
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected void setSelectionToWidget(List in, boolean reveal) {
- org.eclipse.swt.widgets.List list = getList();
- if (in == null || in.size() == 0) { // clear selection
- list.deselectAll();
- } else {
- int n = in.size();
- int[] ixs = new int[n];
- int count = 0;
- for (int i = 0; i < n; ++i) {
- Object el = in.get(i);
- int ix = listMap.indexOf(el);
- if (ix >= 0)
- ixs[count++] = ix;
- }
- if (count < n) {
- System.arraycopy(ixs, 0, ixs = new int[count], 0, count);
- }
- list.setSelection(ixs);
- if (reveal) {
- list.showSelection();
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/OpenEvent.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/OpenEvent.java
deleted file mode 100644
index 21f4c47..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/OpenEvent.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import java.util.EventObject;
-
-/**
- * Event object describing an open which may be generated from a
- * selection or default selection event. The source of these
- * events is a viewer.
- *
- * @see IOpenListener
- */
-public class OpenEvent extends EventObject {
-
- /**
- * The selection.
- */
- protected ISelection selection;
-/**
- * Creates a new event for the given source and selection.
- *
- * @param source the viewer
- * @param selection the selection
- */
-public OpenEvent(Viewer source, ISelection selection) {
- super(source);
- Assert.isNotNull(selection);
- this.selection = selection;
-}
-/**
- * Returns the selection.
- *
- * @return the selection
- */
-public ISelection getSelection() {
- return selection;
-}
-/**
- * Returns the viewer that is the source of this event.
- *
- * @return the originating viewer
- */
-public Viewer getViewer() {
- return (Viewer) getSource();
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/SelectionChangedEvent.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/SelectionChangedEvent.java
deleted file mode 100644
index 9fa2912..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/SelectionChangedEvent.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import java.util.EventObject;
-
-/**
- * Event object describing a selection change. The source of these
- * events is a selection provider.
- *
- * @see ISelection
- * @see ISelectionProvider
- * @see ISelectionChangedListener
- */
-public class SelectionChangedEvent extends EventObject {
-
- /**
- * The selection.
- */
- protected ISelection selection;
-/**
- * Creates a new event for the given source and selection.
- *
- * @param source the selection provider
- * @param selection the selection
- */
-public SelectionChangedEvent(ISelectionProvider source, ISelection selection) {
- super(source);
- Assert.isNotNull(selection);
- this.selection = selection;
-}
-/**
- * Returns the selection.
- *
- * @return the selection
- */
-public ISelection getSelection() {
- return selection;
-}
-/**
- * Returns the selection provider that is the source of this event.
- *
- * @return the originating selection provider
- */
-public ISelectionProvider getSelectionProvider() {
- return (ISelectionProvider) getSource();
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredSelection.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredSelection.java
deleted file mode 100644
index 7db841c..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredSelection.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.resource.JFaceResources;
-import java.util.*;
-
-/**
- * A concrete implementation of the <code>IStructuredSelection</code> interface,
- * suitable for instantiating or subclassing.
- * <p>
- * This class is not intended to be subclassed.
- * </p>
- */
-public class StructuredSelection implements IStructuredSelection {
-
- /**
- * The element that make up this structured selection.
- */
- private Object[] elements;
-
- /**
- * The canonical empty selection. This selection should be used instead of
- * <code>null</code>.
- */
- public static final StructuredSelection EMPTY = new StructuredSelection();
-/**
- * Creates a new empty selection.
- * See also the static field <code>EMPTY</code> which contains an empty selection singleton.
- *
- * @see #EMPTY
- */
-public StructuredSelection() {
-}
-/**
- * Creates a structured selection from the given elements.
- *
- * @param elements an array of elements
- */
-public StructuredSelection(Object[] elements) {
- this.elements= new Object[elements.length];
- System.arraycopy(elements, 0, this.elements, 0, elements.length);
-}
-/**
- * Creates a structured selection containing a single object.
- * The object must not be <code>null</code>.
- *
- * @param element the element
- */
-public StructuredSelection(Object element) {
- Assert.isNotNull(element);
- elements= new Object[] { element };
-}
-/**
- * Creates a structured selection from the given <code>List</code>.
- */
-public StructuredSelection(List elements) {
- Assert.isNotNull(elements);
- this.elements = elements.toArray();
-}
-/**
- * Returns whether this structured selection is equal to given object.
- * Two structured selections are equal iff they contain the same elements
- * in the same order.
- *
- * @param o the other object
- * @return <code>true</code> if they are equal, and <code>false</code> otherwise
- */
-public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- //null and other classes
- if (!(o instanceof StructuredSelection)) {
- return false;
- }
- StructuredSelection s2 = (StructuredSelection)o;
-
- //null elements
- if (elements == null) {
- return s2.elements == null;
- }
- if (s2.elements == null) {
- return false;
- }
-
- //size
- int myLen = elements.length;
- if (myLen != s2.elements.length) {
- return false;
- }
- //element comparison
- for (int i = 0; i < myLen; i++) {
- if (!elements[i].equals(s2.elements[i])) {
- return false;
- }
- }
- return true;
-}
-/* (non-Javadoc)
- * Method declared in IStructuredSelection.
- */
-public Object getFirstElement() {
- return isEmpty() ? null : elements[0];
-}
-/* (non-Javadoc)
- * Method declared in ISelection.
- */
-public boolean isEmpty() {
- return elements == null || elements.length == 0;
-}
-/* (non-Javadoc)
- * Method declared in IStructuredSelection.
- */
-public Iterator iterator() {
- return Arrays.asList(elements == null ? new Object[0] : elements).iterator();
-}
-/* (non-Javadoc)
- * Method declared in IStructuredSelection.
- */
-public int size() {
- return elements == null ? 0 : elements.length;
-}
-/* (non-Javadoc)
- * Method declared in IStructuredSelection.
- */
-public Object[] toArray() {
- return elements == null ? new Object[0] : (Object[]) elements.clone();
-}
-/* (non-Javadoc)
- * Method declared in IStructuredSelection.
- */
-public List toList() {
- return Arrays.asList(elements == null ? new Object[0] : elements);
-}
-/**
- * Internal method which returns a string representation of this
- * selection suitable for debug purposes only.
- *
- * @return debug string
- */
-public String toString() {
- return isEmpty() ? JFaceResources.getString("<empty_selection>") : toList().toString(); //$NON-NLS-1$
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java
deleted file mode 100644
index b292d12..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java
+++ /dev/null
@@ -1,1172 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.IOpenEventListener;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.OpenStrategy;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List; // Otherwise ambiguous
-
-/**
- * Abstract base implementation for structure-oriented viewers (trees, lists, tables).
- * Supports custom sorting, filtering, and rendering.
- * <p>
- * Any number of viewer filters can be added to this viewer (using <code>addFilter</code>).
- * When the viewer receives an update, it asks each of its filters if it is out of date,
- * and refilters elements as required.
- * </p>
- * @see ViewerFilter
- * @see ViewerSorter
- */
-public abstract class StructuredViewer extends ContentViewer {
-
- /**
- * A map from the viewer's model elements to SWT widgets.
- * (key type: <code>Object</code>, value type: <code>Widget</code>).
- * <code>null</code> means that the element map is disabled.
- */
- private Map elementMap;
-
- /**
- * This viewer's sorter.
- * <code>null</code> means there is no sorter.
- */
- private ViewerSorter sorter;
-
- /**
- * This viewer's filters (element type: <code>ViewerFilter</code>).
- * <code>null</code> means there are no filters.
- */
- private List filters;
-
- /**
- * Indicates whether a selection change is in progress on this
- * viewer.
- *
- * @see #setSelection(ISelection, boolean)
- */
- private boolean inChange;
-
- /**
- * Used while a selection change is in progress on this viewer
- * to indicates whether the selection should be restored.
- *
- * @see #setSelection(ISelection, boolean)
- */
- private boolean restoreSelection;
-
- /**
- * List of double-click state listeners (element type: <code>IDoubleClickListener</code>).
- * @see #fireDoubleClick
- */
- private ListenerList doubleClickListeners = new ListenerList(1);
- /**
- * List of open listeners (element type: <code>ISelectionActivateListener</code>).
- * @see #fireOpen
- */
- private ListenerList openListeners = new ListenerList(1);
- /**
- * List of post selection listeners (element type: <code>ISelectionActivateListener</code>).
- * @see #firePostSelectionChanged
- */
- private ListenerList postSelectionChangedListeners = new ListenerList(1);
-
-/**
- * Creates a structured element viewer. The viewer has no input,
- * no content provider, a default label provider, no sorter, and no filters.
- */
-protected StructuredViewer() {
-}
-/**
- * Adds a listener for double-clicks in this viewer.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a double-click listener
- */
-public void addDoubleClickListener(IDoubleClickListener listener) {
- doubleClickListeners.add(listener);
-}
-/**
- * Adds a listener for selection-open in this viewer.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a double-click listener
- */
-public void addOpenListener(IOpenListener listener) {
- openListeners.add(listener);
-}
-/**
- * Adds a listener for post selection in this viewer.
- * 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.
- *
- * @param listener a double-click listener
- */
-public void addPostSelectionChangedListener(ISelectionChangedListener listener) {
- postSelectionChangedListeners.add(listener);
-}
-/**
- * Adds support for dragging items out of this viewer via
- * a user drag-and-drop operation.
- *
- * @param operations a bitwise OR of the supported drag and drop operation
- * types (<code>DROP_COPY</code>, <code>DROP_LINK</code>, and <code>DROP_MOVE</code>)
- * @param transferTypes the transfer types that are supported by the drag operation
- * @param listener the callback that will be invoked to set the drag
- * data and to cleanup after the drag and drop operation finishes
- * @see org.eclipse.swt.dnd.DND
- */
-public void addDragSupport(
- int operations,
- Transfer[] transferTypes,
- DragSourceListener listener) {
-
- Control myControl = getControl();
- final DragSource dragSource = new DragSource(myControl, operations);
- dragSource.setTransfer(transferTypes);
- dragSource.addDragListener(listener);
-}
-/**
- * Adds support for dropping items into this viewer via
- * a user drag-and-drop operation.
- *
- * @param operations a bitwise OR of the supported drag and drop operation
- * types (<code>DROP_COPY</code>, <code>DROP_LINK</code>, and <code>DROP_MOVE</code>)
- * @param transferTypes the transfer types that are supported by the drop operation
- * @param listener the callback that will be invoked after the drag and drop operation finishes
- * @see org.eclipse.swt.dnd.DND
- */
-public void addDropSupport(int operations, Transfer[] transferTypes, final DropTargetListener listener) {
- Control control = getControl();
- DropTarget dropTarget = new DropTarget(control, operations);
- dropTarget.setTransfer(transferTypes);
- dropTarget.addDropListener(listener);
-}
-/**
- * Adds the given filter to this viewer,
- * and triggers refiltering and resorting of the elements.
- *
- * @param filter a viewer filter
- */
-public void addFilter(ViewerFilter filter) {
- if (filters == null)
- filters = new ArrayList();
- filters.add(filter);
- refresh();
-}
-/**
- * Associates the given element with the given widget.
- * Sets the given item's data to be the element, and maps
- * the element to the item in the element map (if enabled).
- *
- * @param element the element
- * @param item the widget
- */
-protected void associate(Object element, Item item) {
- Object data = item.getData();
- if (data != element) {
- if (data != null)
- disassociate(item);
- item.setData(element);
- }
- // Always map the element, even if data == element,
- // since unmapAllElements() can leave the map inconsistent
- // See bug 2741 for details.
- mapElement(element, item);
-}
-/**
- * Disassociates the given SWT item from its corresponding element.
- * Sets the item's data to <code>null</code> and removes the element
- * from the element map (if enabled).
- *
- * @param item the widget
- */
-protected void disassociate(Item item) {
- Object element = item.getData();
- Assert.isNotNull(element);
- item.setData(null);
- unmapElement(element, item);
-}
-/**
- * Returns the widget in this viewer's control which
- * represents the given element if it is the viewer's input.
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- *
- * @param the element
- * @return the corresponding widget, or <code>null</code> if none
- */
-protected abstract Widget doFindInputItem(Object element);
-/**
- * Returns the widget in this viewer's control which represent the given element.
- * This method searchs all the children of the input element.
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- *
- * @param the element
- * @return the corresponding widget, or <code>null</code> if none
- */
-protected abstract Widget doFindItem(Object element);
-/**
- * Copies the attributes of the given element into the given SWT item.
- * The element map is updated according to the value of <code>fullMap</code>.
- * If <code>fullMap</code> is <code>true</code> then the current mapping
- * from element to widgets is removed and the new mapping is added.
- * If fullmap is <code>false</code> then only the new map gets installed.
- * Installing only the new map is necessary in cases where only
- * the order of elements changes but not the set of elements.
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- *
- * @param item
- * @param element the element
- * @param fullMap <code>true</code> if mappings are added and removed,
- * and <code>false</code> if only the new map gets installed
- */
-protected abstract void doUpdateItem(
- Widget item,
- Object element,
- boolean fullMap);
-/**
- * Returns the result of running the given elements through the filters.
- *
- * @param elements the elements to filter
- * @return only the elements which all filters accept
- */
-protected Object[] filter(Object[] elements) {
- if (filters != null) {
- ArrayList filtered = new ArrayList(elements.length);
- Object root = getRoot();
- for (int i = 0; i < elements.length; i++) {
- boolean add = true;
- for (int j = 0; j < filters.size(); j++) {
- add = ((ViewerFilter) filters.get(j)).select(this, root, elements[i]);
- if (!add)
- break;
- }
- if (add)
- filtered.add(elements[i]);
- }
- return filtered.toArray();
- }
- return elements;
-}
-/**
- * Finds the widget which represents the given element.
- * <p>
- * The default implementation of this method tries first to
- * find the widget for the given element assuming that it is
- * the viewer's input; this is done by calling <code>doFindInputItem</code>.
- * If it is not found there, it is looked up in the internal element
- * map provided that this feature has been enabled.
- * If the element map is disabled, the widget is found via
- * <code>doFindInputItem</code>.
- * </p>
- *
- * @param element the element
- * @return the corresponding widget, or <code>null</code> if none
- */
-protected final Widget findItem(Object element) {
- Widget result= doFindInputItem(element);
- if (result != null)
- return result;
- // if we have an element map use it, otherwise search for the item.
- if (elementMap != null)
- return (Widget)elementMap.get(element);
- return doFindItem(element);
-}
-/**
- * Notifies any double-click listeners that a double-click has been received.
- * Only listeners registered at the time this method is called are notified.
- *
- * @param event a double-click event
- *
- * @see IDoubleClickListener#doubleClick
- */
-protected void fireDoubleClick(DoubleClickEvent event) {
- Object[] listeners = doubleClickListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((IDoubleClickListener) listeners[i]).doubleClick(event);
- }
-}
-/**
- * Notifies any open event listeners that a open event has been received.
- * Only listeners registered at the time this method is called are notified.
- *
- * @param event a double-click event
- *
- * @see IOpenListener#doubleClick
- */
-protected void fireOpen(OpenEvent event) {
- Object[] listeners = openListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((IOpenListener)listeners[i]).open(event);
- }
-}
-/**
- * Notifies any post selection listeners that a post selection event has been received.
- * Only listeners registered at the time this method is called are notified.
- *
- * @param event a selection changed event
- *
- * @see addPostSelectionChangedListener
- */
-protected void firePostSelectionChanged(SelectionChangedEvent event) {
- Object[] listeners = postSelectionChangedListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ISelectionChangedListener)listeners[i]).selectionChanged(event);
- }
-}
-/**
- * Returns the filtered array of children of the given element.
- * The resulting array must not be modified,
- * as it may come directly from the model's internal state.
- *
- * @param parent the parent element
- * @return a filtered array of child elements
- */
-protected Object[] getFilteredChildren(Object parent) {
- Object[] result = getRawChildren(parent);
- if (filters != null) {
- for (Iterator iter = filters.iterator(); iter.hasNext();) {
- ViewerFilter f = (ViewerFilter) iter.next();
- result = f.filter(this, parent, result);
- }
- }
- return result;
-}
-/**
- * Returns this viewer's filters.
- *
- * @return an array of viewer filters
- */
-public ViewerFilter[] getFilters() {
- if (filters == null)
- return new ViewerFilter[0];
- ViewerFilter[] result = new ViewerFilter[filters.size()];
- filters.toArray(result);
- return result;
-}
-/**
- * Returns the item at the given display-relative coordinates, or
- * <code>null</code> if there is no item at that location.
- * <p>
- * The default implementation of this method returns <code>null</code>.
- * </p>
- *
- * @param x horizontal coordinate
- * @param y vertical coordinate
- * @return the item, or <code>null</code> if there is no item at the
- * given coordinates
- */
-protected Item getItem(int x, int y) {
- return null;
-}
-/**
- * Returns the children of the given parent without sorting and
- * filtering them.
- * The resulting array must not be modified,
- * as it may come directly from the model's internal state.
- * <p>
- * Returns an empty array if the given parent is <code>null</code>.
- * </p>
- *
- * @param parent the parent element
- * @return the child elements
- */
-protected Object[] getRawChildren(Object parent) {
- Object[] result = null;
- if (parent != null) {
- result = ((IStructuredContentProvider) getContentProvider()).getElements(parent);
- Assert.isNotNull(result);
- }
- return (result != null) ? result : new Object[0];
-}
-/**
- * Returns the root element.
- * <p>
- * The default implementation of this framework method forwards to
- * <code>getInput</code>.
- * Override if the root element is different from the viewer's input
- * element.
- * </p>
- *
- * @return the root element, or <code>null</code> if none
- */
-protected Object getRoot() {
- return getInput();
-}
-/**
- * The <code>StructuredViewer</code> implementation of this method
- * returns the result as a <code>StructuredSelection</code>.
- * <p>
- * Subclasses do not typically override this method, but implement
- * <code>getSelectionFromWidget(List)</code> instead.
- * <p>
- */
-public ISelection getSelection() {
- Control control = getControl();
- if (control == null || control.isDisposed()) {
- return StructuredSelection.EMPTY;
- }
- List list = getSelectionFromWidget();
- return new StructuredSelection(list);
-}
-/**
- * Retrieves the selection, as a <code>List</code>, from the underlying widget.
- *
- * @return the list of selected elements
- */
-protected abstract List getSelectionFromWidget();
-/**
- * Returns the sorted and filtered set of children of the given element.
- * The resulting array must not be modified,
- * as it may come directly from the model's internal state.
- *
- * @param parent the parent element
- * @return a sorted and filtered array of child elements
- */
-protected Object[] getSortedChildren(Object parent) {
- Object[] result = getFilteredChildren(parent);
- if (sorter != null) {
- // be sure we're not modifying the original array from the model
- result = (Object[]) result.clone();
- sorter.sort(this, result);
- }
- return result;
-}
-/**
- * Returns this viewer's sorter, or <code>null</code> if it does not have one.
- *
- * @return a viewer sorter, or <code>null</code> if none
- */
-public ViewerSorter getSorter() {
- return sorter;
-}
-/**
- * Handles a double-click select event from the widget.
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- *
- * @param event the SWT selection event
- */
-protected void handleDoubleSelect(SelectionEvent event) {
- // handle case where an earlier selection listener disposed the control.
- Control control = getControl();
- if (control != null && !control.isDisposed()) {
- ISelection selection = getSelection();
- updateSelection(selection);
- fireDoubleClick(new DoubleClickEvent(this, selection));
- }
-}
-/**
- * Handles an open event from the OpenStrategy.
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- *
- * @param event the SWT selection event
- */
-protected void handleOpen(SelectionEvent event) {
- Control control = getControl();
- if (control != null && !control.isDisposed()) {
- ISelection selection = getSelection();
- fireOpen(new OpenEvent(this, selection));
- }
-}
-/**
- * Handles an invalid selection.
- * <p>
- * This framework method is called if a model change picked up by a viewer
- * results in an invalid selection. For instance if an element contained
- * in the selection has been removed from the viewer, the viewer is free
- * to either remove the element from the selection or to pick another element
- * as its new selection.
- * The default implementation of this method calls <code>updateSelection</code>.
- * Subclasses may override it to implement a different strategy for picking
- * a new selection when the old selection becomes invalid.
- * </p>
- *
- * @param invalidSelection the selection before the viewer was updated
- * @param newSelection the selection after the update, or <code>null</code> if none
- */
-protected void handleInvalidSelection(ISelection invalidSelection, ISelection newSelection) {
- updateSelection(newSelection);
-}
-/**
- * The <code>StructuredViewer</code> implementation of this <code>ContentViewer</code> method calls <code>update</code>
- * if the event specifies that the label of a given element has changed, otherwise it calls super.
- * Subclasses may reimplement or extend.
- * </p>
- */
-protected void handleLabelProviderChanged(LabelProviderChangedEvent event) {
- Object[] elements = event.getElements();
- if (elements != null) {
- update(elements, null);
- }
- else {
- super.handleLabelProviderChanged(event);
- }
-}
-/**
- * Handles a select event from the widget.
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- *
- * @param event the SWT selection event
- */
-protected void handleSelect(SelectionEvent event) {
- // handle case where an earlier selection listener disposed the control.
- Control control = getControl();
- if (control != null && !control.isDisposed()) {
- updateSelection(getSelection());
- }
-}
-/**
- * Handles a post select event from the widget.
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- *
- * @param event the SWT selection event
- */
-protected void handlePostSelect(SelectionEvent e) {
- SelectionChangedEvent event = new SelectionChangedEvent(this, getSelection());
- firePostSelectionChanged(event);
-}
-/* (non-Javadoc)
- * Method declared on Viewer.
- */
-protected void hookControl(Control control) {
- super.hookControl(control);
- OpenStrategy handler = new OpenStrategy(control);
- handler.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- handleSelect(e);
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- handleDoubleSelect(e);
- }
- });
- handler.addPostSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handlePostSelect(e);
- }
- });
- handler.addOpenListener(new IOpenEventListener() {
- public void handleOpen(SelectionEvent e) {
- StructuredViewer.this.handleOpen(e);
- }
- });
-}
-/**
- * Returns whether this viewer has any filters.
- */
-protected boolean hasFilters() {
- return filters != null && filters.size() > 0;
-}
-/**
- * Refreshes this viewer starting at the given element.
- *
- * @param element the element
- */
-protected abstract void internalRefresh(Object element);
-
-/**
- * Refreshes this viewer starting at the given element.
- * Labels are updated as described in <code>refresh(boolean updateLabels)</code>.
- * <p>
- * The default implementation simply calls <code>internalRefresh(element)</code>,
- * ignoring <code>updateLabels</code>.
- * <p>
- * If this method is overridden to do the actual refresh, then
- * <code>internalRefresh(Object element)</code> should simply
- * call <code>internalRefresh(element, true)</code>.
- *
- * @param element the element
- * @param updateLabels <code>true</code> to update labels for existing elements,
- * <code>false</code> to only update labels as needed, assuming that labels
- * for existing elements are unchanged.
- *
- * @since 2.0
- */
-protected void internalRefresh(Object element, boolean updateLabels) {
- internalRefresh(element);
-}
-
-/**
- * Adds the element item pair to the element map
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- *
- * @param element the element
- * @param item the corresponding widget
- */
-protected void mapElement(Object element, Widget item) {
- if (elementMap != null)
- elementMap.put(element, item);
-}
-/**
- * Determines whether a change to the given property of the given element
- * would require refiltering and/or resorting.
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- *
- * @param element the element
- * @param property the property
- * @return <code>true</code> if refiltering is required, and <code>false</code>
- * otherwise
- */
-protected boolean needsRefilter(Object element, String property) {
- if (sorter != null && sorter.isSorterProperty(element, property))
- return true;
-
- if (filters != null) {
- for (int i = 0; i < filters.size(); ++i) {
- ViewerFilter filter = (ViewerFilter) filters.get(i);
- if (filter.isFilterProperty(element, property))
- return true;
- }
- }
- return false;
-}
-/**
- * Attempts to preserves the current selection across a run of
- * the given code.
- * <p>
- * The default implementation of this method:
- * <ul>
- * <li>discovers the old selection (via <code>getSelection</code>)</li>
- * <li>runs the given runnable</li>
- * <li>attempts to restore the old selection
- * (using <code>setSelectionToWidget</code></li>
- * <li>rediscovers the resulting selection (via <code>getSelection</code>)</li>
- * <li>calls <code>handleInvalidSelection</code> if the selection
- * did not take</li>
- * <li>calls <code>postUpdateHook</code></li>
- * </ul>
- * </p>
- *
- * @param updateCode the code to run
- */
-protected void preservingSelection(Runnable updateCode) {
-
- ISelection oldSelection= null;
- try {
- // preserve selection
- oldSelection= getSelection();
- inChange= restoreSelection= true;
-
- // perform the update
- updateCode.run();
-
- } finally {
- inChange= false;
-
- // restore selection
- if (restoreSelection)
- setSelectionToWidget(oldSelection, false);
-
- // send out notification if old and new differ
- ISelection newSelection= getSelection();
- if (! newSelection.equals(oldSelection))
- handleInvalidSelection(oldSelection, newSelection);
- }
-}
-/*
- * Non-Javadoc.
- * Method declared on Viewer.
- */
-public void refresh() {
- refresh(getRoot());
-}
-
-/**
- * Refreshes this viewer with information freshly obtained from this
- * viewer's model. If <code>updateLabels</code> is <code>true</code>
- * then labels for otherwise unaffected elements are updated as well.
- * Otherwise, it assumes labels for existing elements are unchanged,
- * and labels are only obtained as needed (for example, for new elements).
- * <p>
- * Calling <code>refresh(true)</code> has the same effect as <code>refresh()</code>.
- * <p>
- * Note that the implementation may still obtain labels for existing elements
- * even if <code>updateLabels</code> is false. The intent is simply to allow
- * optimization where possible.
- *
- * @param updateLabels <code>true</code> to update labels for existing elements,
- * <code>false</code> to only update labels as needed, assuming that labels
- * for existing elements are unchanged.
- *
- * @since 2.0
- */
-public void refresh(boolean updateLabels) {
- refresh(getRoot(), updateLabels);
-}
-
-/**
- * Refreshes this viewer starting with the given element.
- * <p>
- * Unlike the <code>update</code> methods, this handles structural changes
- * to the given element (e.g. addition or removal of children).
- * If only the given element needs updating, it is more efficient to use
- * the <code>update</code> methods.
- * </p>
- *
- * @param element the element
- */
-public void refresh(final Object element) {
- preservingSelection(new Runnable() {
- public void run() {
- internalRefresh(element);
- }
- });
-}
-
-/**
- * Refreshes this viewer starting with the given element.
- * Labels are updated as described in <code>refresh(boolean updateLabels)</code>.
- * <p>
- * Unlike the <code>update</code> methods, this handles structural changes
- * to the given element (e.g. addition or removal of children).
- * If only the given element needs updating, it is more efficient to use
- * the <code>update</code> methods.
- * </p>
- *
- * @param element the element
- * @param updateLabels <code>true</code> to update labels for existing elements,
- * <code>false</code> to only update labels as needed, assuming that labels
- * for existing elements are unchanged.
- *
- * @since 2.0
- */
-public void refresh(final Object element, final boolean updateLabels) {
- preservingSelection(new Runnable() {
- public void run() {
- internalRefresh(element, updateLabels);
- }
- });
-}
-
-/**
- * Refreshes the given TableItem with the given element.
- * Calls <code>doUpdateItem(..., false)</code>.
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- */
-protected final void refreshItem(Widget widget, Object element) {
- doUpdateItem(widget, element, false);
-}
-/**
- * Removes the given open listener from this viewer.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a double-click listener
- */
-public void removeOpenListener(IOpenListener listener) {
- openListeners.remove(listener);
-}
-/**
- * Removes the given post selection listener from this viewer.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a double-click listener
- */
-public void removePostSelectionChangedListener(ISelectionChangedListener listener) {
- postSelectionChangedListeners.remove(listener);
-}
-/**
- * Removes the given double-click listener from this viewer.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a double-click listener
- */
-public void removeDoubleClickListener(IDoubleClickListener listener) {
- doubleClickListeners.remove(listener);
-}
-/**
- * Removes the given filter from this viewer,
- * and triggers refiltering and resorting of the elements if required.
- * Has no effect if the identical filter is not registered.
- *
- * @param filter a viewer filter
- */
-public void removeFilter(ViewerFilter filter) {
- Assert.isNotNull(filter);
- if (filters != null) {
- // Note: can't use List.remove(Object). Use identity comparison instead.
- for (Iterator i = filters.iterator(); i.hasNext();) {
- Object o = i.next();
- if (o == filter) {
- i.remove();
- refresh();
- if (filters.size() == 0)
- filters = null;
- return;
- }
- }
- }
-}
-/**
- * Discards this viewer's filters and triggers refiltering and resorting
- * of the elements.
- */
-public void resetFilters() {
- if (filters != null) {
- filters = null;
- refresh();
- }
-}
-/**
- * Ensures that the given element is visible, scrolling the viewer if necessary.
- * The selection is unchanged.
- *
- * @param element the element to reveal
- */
-public abstract void reveal(Object element);
-/**
- * The <code>StructuredViewer</code> implementation of this method
- * checks to ensure that the content provider is an <code>IStructuredContentProvider</code>.
- */
-public void setContentProvider(IContentProvider provider) {
- Assert.isTrue(provider instanceof IStructuredContentProvider);
- super.setContentProvider(provider);
-}
-/* (non-Javadoc)
- * Method declared in Viewer.
- * This implementatation additionaly unmaps all the elements.
- */
-public final void setInput(Object input) {
-
- try {
-// fInChange= true;
-
- unmapAllElements();
-
- super.setInput(input);
-
- } finally {
-// fInChange= false;
- }
-}
-/**
- * The <code>StructuredViewer</code> implementation of this method does the following.
- * <p>
- * If the new selection differs from the current
- * selection the hook <code>updateSelection</code> is called.
- * </p>
- * <p>
- * If <code>setSelection</code> is called from
- * within <code>preserveSelection</code>, the call to <code>updateSelection</code>
- * is delayed until the end of <code>preserveSelection</code>.
- * </p>
- * <p>
- * Subclasses do not typically override this method, but implement <code>setSelectionToWidget</code> instead.
- * </p>
- */
-public void setSelection(ISelection selection, boolean reveal) {
- Control control = getControl();
- if (control == null || control.isDisposed()) {
- return;
- }
- if (!inChange) {
- setSelectionToWidget(selection, reveal);
- ISelection sel = getSelection();
- updateSelection(sel);
- firePostSelectionChanged(new SelectionChangedEvent(this, sel));
- } else {
- restoreSelection = false;
- setSelectionToWidget(selection, reveal);
- }
-}
-/**
- * Parlays the given list of selected elements into selections
- * on this viewer's control.
- * <p>
- * Subclasses should override to set their selection based on the
- * given list of elements.
- * </p>
- *
- * @param l list of selected elements (element type: <code>Object</code>)
- * or <code>null</code> if the selection is to be cleared
- * @param reveal <code>true</code> if the selection is to be made
- * visible, and <code>false</code> otherwise
- */
-protected abstract void setSelectionToWidget(List l, boolean reveal);
-/**
- * Converts the selection to a <code>List</code> and calls <code>setSelectionToWidget(List, boolean)</code>.
- * The selection is expected to be an <code>IStructuredSelection</code> of elements.
- * If not, the selection is cleared.
- * <p>
- * Subclasses do not typically override this method, but implement <code>setSelectionToWidget(List, boolean)</code> instead.
- *
- * @param selection an IStructuredSelection of elements
- * @param reveal <code>true</code> to reveal the first element in the selection, or <code>false</code> otherwise
- */
-protected void setSelectionToWidget(ISelection selection, boolean reveal) {
- if (selection instanceof IStructuredSelection)
- setSelectionToWidget(((IStructuredSelection) selection).toList(), reveal);
- else
- setSelectionToWidget((List) null, reveal);
-}
-/**
- * Sets this viewer's sorter and triggers refiltering and resorting
- * of this viewer's element. Passing <code>null</code> turns sorting off.
- *
- * @param sorter a viewer sorter, or <code>null</code> if none
- */
-public void setSorter(ViewerSorter sorter) {
- if (this.sorter != sorter) {
- this.sorter = sorter;
- refresh();
- }
-}
-/**
- * Configures whether this structured viewer uses an internal hash table to
- * speeds up the mapping between elements and SWT items.
- * This must be called before the viewer is given an input (via <code>setInput</code>).
- *
- * @param enable <code>true</code> to enable hash lookup, and <code>false</code> to disable it
- */
-public void setUseHashlookup(boolean enable) {
- Assert.isTrue(getInput() == null, "Can only enable the hash look up before input has been set");//$NON-NLS-1$
- if (enable) {
- elementMap= new HashMap();
- } else {
- elementMap= null;
- }
-}
-/**
- * Hook for testing.
- */
-public Widget testFindItem(Object element) {
- return findItem(element);
-}
-/**
- * Removes all elements from the map
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- */
-protected void unmapAllElements() {
- if (elementMap != null) {
- elementMap = new HashMap();
- }
-}
-/**
- * Removes the given element from the internal element to widget map.
- * Does nothing if mapping is disabled.
- * If mapping is enabled, the given element must be present.
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- *
- * @param element the element
- */
-protected void unmapElement(Object element) {
- if (elementMap != null) {
- elementMap.remove(element);
- }
-}
-/**
- * Removes the given association from the internal element to widget map.
- * Does nothing if mapping is disabled, or if the given element does not map
- * to the given item.
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * </p>
- *
- * @param element the element
- * @since 2.0
- */
-protected void unmapElement(Object element, Widget item) {
- // double-check that the element actually maps to the given item before unmapping it
- if (elementMap != null && elementMap.get(element) == item) {
- // call unmapElement for backwards compatibility
- unmapElement(element);
- }
-}
-
-/**
- * Updates the given elements' presentation when one or more of their properties change.
- * Only the given elements are updated.
- * <p>
- * This does not handle structural changes (e.g. addition or removal of elements),
- * and does not update any other related elements (e.g. child elements).
- * To handle structural changes, use the <code>refresh</code> methods instead.
- * </p>
- * <p>
- * This should be called when an element has changed in the model, in order to have the viewer
- * accurately reflect the model. This method only affects the viewer, not the model.
- * </p>
- * <p>
- * Specifying which properties are affected may allow the viewer to optimize the update.
- * For example, if the label provider is not affected by changes to any of these properties,
- * an update may not actually be required. Specifing <code>properties</code> as
- * <code>null</code> forces a full update of the given elements.
- * </p>
- * <p>
- * If the viewer has a sorter which is affected by a change to one of the properties,
- * the elements' positions are updated to maintain the sort order.
- * </p>
- * <p>
- * If the viewer has a filter which is affected by a change to one of the properties,
- * elements may appear or disappear if the change affects whether or not they are
- * filtered out.
- * </p>
- *
- * @param elements the elements
- * @param properties the properties that have changed, or <code>null</code> to indicate unknown
- */
-public void update(Object[] elements, String[] properties) {
- for (int i = 0; i < elements.length; ++i)
- update(elements[i], properties);
-}
-/**
- * Updates the given element's presentation when one or more of its properties changes.
- * Only the given element is updated.
- * <p>
- * This does not handle structural changes (e.g. addition or removal of elements),
- * and does not update any other related elements (e.g. child elements).
- * To handle structural changes, use the <code>refresh</code> methods instead.
- * </p>
- * <p>
- * This should be called when an element has changed in the model, in order to have the viewer
- * accurately reflect the model. This method only affects the viewer, not the model.
- * </p>
- * <p>
- * Specifying which properties are affected may allow the viewer to optimize the update.
- * For example, if the label provider is not affected by changes to any of these properties,
- * an update may not actually be required. Specifing <code>properties</code> as
- * <code>null</code> forces a full update of the element.
- * </p>
- * <p>
- * If the viewer has a sorter which is affected by a change to one of the properties,
- * the element's position is updated to maintain the sort order.
- * </p>
- * <p>
- * If the viewer has a filter which is affected by a change to one of the properties,
- * the element may appear or disappear if the change affects whether or not the element
- * is filtered out.
- * </p>
- *
- * @param element the element
- * @param properties the properties that have changed, or <code>null</code> to indicate unknown
- */
-public void update(Object element, String[] properties) {
- Assert.isNotNull(element);
- Widget item = findItem(element);
- if (item == null)
- return;
-
- boolean needsRefilter = false;
- if (properties != null) {
- for (int i = 0; i < properties.length; ++i) {
- needsRefilter = needsRefilter(element, properties[i]);
- if (needsRefilter)
- break;
- }
- }
- if (needsRefilter) {
- refresh();
- return;
- }
-
- boolean needsUpdate;
- if (properties == null) {
- needsUpdate = true;
- }
- else {
- needsUpdate = false;
- IBaseLabelProvider labelProvider = getLabelProvider();
- for (int i = 0; i < properties.length; ++i) {
- needsUpdate = labelProvider.isLabelProperty(element, properties[i]);
- if (needsUpdate)
- break;
- }
- }
- if (needsUpdate) {
- updateItem(item, element);
- }
-}
-/**
- * Copies attributes of the given element into the given widget.
- * <p>
- * This method is internal to the framework; subclassers should not call
- * this method.
- * Calls <code>doUpdateItem(widget, element, true)</code>.
- * </p>
- *
- * @param widget the widget
- * @param element the element
- */
-protected final void updateItem(Widget widget, Object element) {
- doUpdateItem(widget, element, true);
-}
-/**
- * Updates the selection of this viewer.
- * <p>
- * This framework method should be called when the selection
- * in the viewer widget changes.
- * </p>
- * <p>
- * The default implementation of this method notifies all
- * selection change listeners recorded in an internal state variable.
- * Overriding this method is generally not required;
- * however, if overriding in a subclass,
- * <code>super.updateSelection</code> must be invoked.
- * </p>
- * @param selection the selection, or <code>null</code> if none
- */
-protected void updateSelection(ISelection selection) {
- SelectionChangedEvent event = new SelectionChangedEvent(this, selection);
- fireSelectionChanged(event);
-}
-/**
- * Returns whether this structured viewer is configured to use an internal
- * map to speed up the mapping between elements and SWT items.
- * <p>
- * The default implementation of this framework method checks whether the
- * internal map has been initialized.
- * </p>
- *
- * @return <code>true</code> if the element map is enabled, and <code>false</code> if disabled
- */
-protected boolean usingElementMap() {
- return elementMap != null;
-}
-
-
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableLayout.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableLayout.java
deleted file mode 100644
index 8cb534e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableLayout.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List; // disambiguate from SWT List
-
-/**
- * A layout for a table.
- * Call <code>addColumnData</code> to add columns.
- */
-public class TableLayout extends Layout {
-
- /**
- * The list of column layout data (element type:
- * <code>ColumnLayoutData</code>).
- */
- private List columns = new ArrayList();
-
- /**
- * Indicates whether <code>layout</code> has yet to be called.
- */
- private boolean firstTime = true;
-/**
- * Creates a new table layout.
- */
-public TableLayout() {
-}
-/**
- * Adds a new column of data to this table layout.
- *
- * @param data the column layout data
- */
-public void addColumnData(ColumnLayoutData data) {
- columns.add(data);
-}
-/* (non-Javadoc)
- * Method declared on Layout.
- */
-public Point computeSize(Composite c, int wHint, int hHint, boolean flush) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- return new Point(wHint, hHint);
-
- Table table = (Table) c;
- // To avoid recursions.
- table.setLayout(null);
- // Use native layout algorithm
- Point result = table.computeSize(wHint, hHint, flush);
- table.setLayout(this);
-
- int width = 0;
- int size = columns.size();
- for (int i = 0; i < size; ++i) {
- ColumnLayoutData layoutData = (ColumnLayoutData) columns.get(i);
- if (layoutData instanceof ColumnPixelData) {
- ColumnPixelData col = (ColumnPixelData) layoutData;
- width += col.width;
- }
- else if (layoutData instanceof ColumnWeightData) {
- ColumnWeightData col = (ColumnWeightData) layoutData;
- width += col.minimumWidth;
- } else {
- Assert.isTrue(false, "Unknown column layout data");//$NON-NLS-1$
- }
- }
- if (width > result.x)
- result.x = width;
- return result;
-}
-/* (non-Javadoc)
- * Method declared on Layout.
- */
-public void layout(Composite c, boolean flush) {
- // Only do initial layout. Trying to maintain proportions when resizing is too hard,
- // causes lots of widget flicker, causes scroll bars to appear and occasionally stick around (on Windows),
- // requires hooking column resizing as well, and may not be what the user wants anyway.
- if (!firstTime)
- return;
-
- Table table = (Table) c;
- int width = table.getClientArea().width;
-
- // XXX: Layout is being called with an invalid value the first time
- // it is being called on Linux. This method resets the
- // Layout to null so we make sure we run it only when
- // the value is OK.
- if (width <= 1)
- return;
-
- TableColumn[] tableColumns = table.getColumns();
- int size = Math.min(columns.size(), tableColumns.length);
- int[] widths = new int[size];
- int fixedWidth = 0;
- int numberOfWeightColumns = 0;
- int totalWeight = 0;
-
- // First calc space occupied by fixed columns
- for (int i = 0; i < size; i++) {
- ColumnLayoutData col = (ColumnLayoutData) columns.get(i);
- if (col instanceof ColumnPixelData) {
- int pixels = ((ColumnPixelData) col).width;
- widths[i] = pixels;
- fixedWidth += pixels;
- } else if (col instanceof ColumnWeightData) {
- ColumnWeightData cw = (ColumnWeightData) col;
- numberOfWeightColumns++;
- // first time, use the weight specified by the column data, otherwise use the actual width as the weight
- // int weight = firstTime ? cw.weight : tableColumns[i].getWidth();
- int weight = cw.weight;
- totalWeight += weight;
- } else {
- Assert.isTrue(false, "Unknown column layout data");//$NON-NLS-1$
- }
- }
-
- // Do we have columns that have a weight
- if (numberOfWeightColumns > 0) {
- // Now distribute the rest to the columns with weight.
- int rest = width - fixedWidth;
- int totalDistributed = 0;
- for (int i = 0; i < size; ++i) {
- ColumnLayoutData col = (ColumnLayoutData) columns.get(i);
- if (col instanceof ColumnWeightData) {
- ColumnWeightData cw = (ColumnWeightData) col;
- // calculate weight as above
- // int weight = firstTime ? cw.weight : tableColumns[i].getWidth();
- int weight = cw.weight;
- int pixels = totalWeight == 0 ? 0 : weight * rest / totalWeight;
- if (pixels < cw.minimumWidth)
- pixels = cw.minimumWidth;
- totalDistributed += pixels;
- widths[i] = pixels;
- }
- }
-
- // Distribute any remaining pixels to columns with weight.
- int diff = rest - totalDistributed;
- for (int i = 0; diff > 0; ++i) {
- if (i == size)
- i = 0;
- ColumnLayoutData col = (ColumnLayoutData) columns.get(i);
- if (col instanceof ColumnWeightData) {
- ++widths[i];
- --diff;
- }
- }
- }
-
-// System.out.print("Width: " + width);
-// int total = 0;
-// for (int i = 0; i < widths.length; i++) {
-// System.out.print(" " + widths[i]);
-// total += widths[i];
-// }
-// System.out.println(" Total: " + total);
-
- firstTime = false;
-
- for (int i = 0; i < size; i++) {
- tableColumns[i].setWidth(widths[i]);
- }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableTreeViewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableTreeViewer.java
deleted file mode 100644
index a83d809..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableTreeViewer.java
+++ /dev/null
@@ -1,416 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List; // Otherwise ambiguous
-
-/**
- * A concrete viewer based on a SWT <code>TableTree</code> control.
- * <p>
- * This class is not intended to be subclassed outside the viewer framework.
- * It is designed to be instantiated with a pre-existing SWT table tree control and configured
- * with a domain-specific content provider, label provider, element filter (optional),
- * and element sorter (optional).
- * </p>
- * <p>
- * Content providers for table tree viewers must implement the <code>ITreeContentProvider</code>
- * interface.
- * </p>
- * <p>
- * Label providers for table tree viewers must implement either the <code>ITableLabelProvider</code>
- * or the <code>ILabelProvider</code> interface (see <code>TableTreeViewer.setLabelProvider</code>
- * for more details).
- * </p>
- */
-public class TableTreeViewer extends AbstractTreeViewer {
- /**
- * Internal table viewer implementation.
- */
- private TableViewerImpl tableViewerImpl;
-
- /**
- * This viewer's table tree control.
- */
- private TableTree tableTree;
-
- /**
- * This viewer's table tree editor.
- */
- private TableTreeEditor tableTreeEditor;
-
- /**
- * Private implementation class.
- */
- class TableTreeViewerImpl extends TableViewerImpl {
- Rectangle getBounds(Item item, int columnNumber) {
- return ((TableTreeItem)item).getBounds(columnNumber);
- }
- int getColumnCount() {
- //getColumnCount() should be a API in TableTree.
- return getTableTree().getTable().getColumnCount();
- }
- Item[] getSelection() {
- return getTableTree().getSelection();
- }
- void setEditor(Control w, Item item, int columnNumber) {
- tableTreeEditor.setEditor(w, (TableTreeItem)item, columnNumber);
- }
- void setSelection(StructuredSelection selection, boolean b) {
- TableTreeViewer.this.setSelection(selection,b);
- }
- void showSelection() {
- getTableTree().showSelection();
- }
- void setLayoutData(CellEditor.LayoutData layoutData) {
- tableTreeEditor.horizontalAlignment = layoutData.horizontalAlignment;
- tableTreeEditor.grabHorizontal = layoutData.grabHorizontal;
- tableTreeEditor.minimumWidth = layoutData.minimumWidth;
- }
- }
-/**
- * Creates a table tree viewer on the given table tree control.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param tree the table tree control
- */
-public TableTreeViewer(TableTree tree) {
- super();
- tableTree = tree;
- hookControl(tree);
- tableTreeEditor = new TableTreeEditor(tableTree);
- tableViewerImpl = new TableTreeViewerImpl();
-}
-/**
- * Creates a table tree viewer on a newly-created table tree control under the given parent.
- * The table tree control is created using the SWT style bits <code>MULTI, H_SCROLL, V_SCROLL, and BORDER</code>.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param parent the parent control
- */
-public TableTreeViewer(Composite parent) {
- this(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
-}
-/**
- * Creates a table tree viewer on a newly-created table tree control under the given parent.
- * The table tree control is created using the given SWT style bits.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param parent the parent control
- * @param style the SWT style bits
- */
-public TableTreeViewer(Composite parent, int style) {
- this(new TableTree(parent, style));
-}
-/* (non-Javadoc)
- * Method declared on AbstractTreeViewer.
- */
-protected void addTreeListener(Control c, TreeListener listener) {
- ((TableTree)c).addTreeListener(listener);
-}
-/**
- * Cancels a currently active cell editor. All changes already done in the cell
- * editor are lost.
- */
-public void cancelEditing() {
- tableViewerImpl.cancelEditing();
-}
-/* (non-Javadoc)
- * Method declared on AbstractTreeViewer.
- */
-protected void doUpdateItem(Item item, Object element) {
- // update icon and label
- // Similar code in TableTreeViewer.doUpdateItem()
- IBaseLabelProvider prov = getLabelProvider();
- ITableLabelProvider tprov = null;
- ILabelProvider lprov = null;
- if (prov instanceof ITableLabelProvider)
- tprov = (ITableLabelProvider) prov;
- else
- lprov = (ILabelProvider) prov;
- int columnCount = tableTree.getTable().getColumnCount();
- // Also enter loop if no columns added. See 1G9WWGZ: JFUIF:WINNT - TableViewer with 0 columns does not work
- for (int column = 0; column < columnCount || column == 0; column++) {
- TableTreeItem ti = (TableTreeItem)item;
- String text = "";//$NON-NLS-1$
- Image image = null;
- if (tprov != null) {
- text = tprov.getColumnText(element, column);
- image = tprov.getColumnImage(element, column);
- }
- else {
- if (column == 0) {
- text = lprov.getText(element);
- image = lprov.getImage(element);
- }
- }
- ti.setText(column, text);
- // Apparently a problem to setImage to null if already null
- if (image != null || ti.getImage(column) != null)
- ti.setImage(column, image);
- }
-}
-/**
- * Starts editing the given element.
- *
- * @param element the element
- * @param column the column number
- */
-public void editElement(Object element, int column) {
- tableViewerImpl.editElement(element,column);
-}
-/**
- * Returns the cell editors of this viewer.
- *
- * @return the list of cell editors
- */
-public CellEditor[] getCellEditors() {
- return tableViewerImpl.getCellEditors();
-}
-/**
- * Returns the cell modifier of this viewer.
- *
- * @return the cell modifier
- */
-public ICellModifier getCellModifier() {
- return tableViewerImpl.getCellModifier();
-}
-/* (non-Javadoc)
- * Method declared on AbstractTreeViewer.
- */
-protected Item[] getChildren(Widget o) {
- if (o instanceof TableTreeItem)
- return ((TableTreeItem)o).getItems();
- if (o instanceof TableTree)
- return ((TableTree)o).getItems();
- return null;
-}
-/**
- * Returns the column properties of this viewer.
- * The properties must correspond with the columns of the table control.
- * They are used to identify the column in a cell modifier.
- *
- * @return the list of column properties
- */
-public Object[] getColumnProperties() {
- return tableViewerImpl.getColumnProperties();
-}
-/* (non-Javadoc)
- * Method declared on Viewer.
- */
-public Control getControl() {
- return tableTree;
-}
-/**
- * Returns the element with the given index from this viewer.
- * Returns <code>null</code> if the index is out of range.
- * <p>
- * This method is internal to the framework.
- * </p>
- *
- * @param index the zero-based index
- * @return the element at the given index, or <code>null</code> if the
- * index is out of range
- */
-public Object getElementAt(int index) {
- // XXX: Workaround for 1GBCSB1: SWT:WIN2000 - TableTree should have getItem(int index)
- TableTreeItem i = tableTree.getItems()[index];
- if(i != null)
- return i.getData();
- return null;
-}
-/* (non-Javadoc)
- * Method declared on AbstractTreeViewer.
- */
-protected boolean getExpanded(Item item) {
- return ((TableTreeItem) item).getExpanded();
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected Item getItem(int x, int y) {
- // XXX: Workaround for 1GBCSHG: SWT:WIN2000 - TableTree should have getItem(Point point)
- return getTableTree().getTable().getItem(getTableTree().toControl(new Point(x, y)));
-}
-/* (non-Javadoc)
- * Method declared on AbstractTreeViewer.
- */
-protected int getItemCount(Control widget) {
- return ((TableTree) widget).getItemCount();
-}
-/* (non-Javadoc)
- * Method declared on AbstractTreeViewer.
- */
-protected int getItemCount(Item item) {
- return ((TableTreeItem) item).getItemCount();
-}
-/* (non-Javadoc)
- * Method declared on AbstractTreeViewer.
- */
-protected org.eclipse.swt.widgets.Item[] getItems(org.eclipse.swt.widgets.Item item) {
- return ((TableTreeItem)item).getItems();
-}
-/**
- * The table tree viewer implementation of this <code>Viewer</code> framework
- * method returns the label provider, which in the case of table tree
- * viewers will be an instance of either <code>ITableLabelProvider</code>
- * or <code>ILabelProvider</code>.
- * If it is an <code>ITableLabelProvider</code>, then it provides a
- * separate label text and image for each column. If it is an
- * <code>ILabelProvider</code>, then it provides only the label text
- * and image for the first column, and any remaining columns are blank.
- */
-public IBaseLabelProvider getLabelProvider() {
- return super.getLabelProvider();
-}
-/* (non-Javadoc)
- * Method declared on AbstractTreeViewer.
- */
-protected Item getParentItem(Item item) {
- return ((TableTreeItem)item).getParentItem();
-}
-/* (non-Javadoc)
- * Method declared on AbstractTreeViewer.
- */
-protected Item[] getSelection(Control widget) {
- return ((TableTree) widget).getSelection();
-}
-/**
- * Returns this table tree viewer's table tree control.
- *
- * @return the table tree control
- */
-public TableTree getTableTree() {
- return tableTree;
-}
-/* (non-Javadoc)
- * Method declared on AbstractTreeViewer.
- */
-protected void hookControl(Control control) {
- super.hookControl(control);
- tableTree.getTable().addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- /* If user clicked on the [+] or [-], do not activate CellEditor. */
- //XXX: This code should not be here. SWT should either have support to see
- //if the user clicked on the [+]/[-] or manage the table editor
- //activation
- org.eclipse.swt.widgets.TableItem[] items = tableTree.getTable().getItems();
- for (int i = 0; i < items.length; i++) {
- Rectangle rect = items[i].getImageBounds(0);
- if (rect.contains(e.x, e.y))
- return;
- }
-
- tableViewerImpl.handleMouseDown(e);
- }
- public void mouseDoubleClick(MouseEvent e) {
- tableViewerImpl.handleMouseDoubleClick(e);
- }
-
- });
-}
-/**
- * Returns whether there is an active cell editor.
- *
- * @return <code>true</code> if there is an active cell editor, and
- * <code>false</code> otherwise
- */
-public boolean isCellEditorActive() {
- return tableViewerImpl.isCellEditorActive();
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected Item newItem(Widget parent, int flags, int ix) {
- TableTreeItem item;
- if (ix >= 0) {
- if (parent instanceof TableTreeItem)
- item = new TableTreeItem((TableTreeItem) parent, flags, ix);
- else
- item = new TableTreeItem((TableTree) parent, flags, ix);
- } else {
- if (parent instanceof TableTreeItem)
- item = new TableTreeItem((TableTreeItem) parent, flags);
- else
- item = new TableTreeItem((TableTree) parent, flags);
- }
- return item;
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected void removeAll(Control widget) {
- ((TableTree) widget).removeAll();
-}
-/**
- * Sets the cell editors of this table viewer.
- *
- * @param editors the list of cell editors
- */
-public void setCellEditors(CellEditor[] editors) {
- tableViewerImpl.setCellEditors(editors);
-}
-/**
- * Sets the cell modifier of this table viewer.
- *
- * @param modifier the cell modifier
- */
-public void setCellModifier(ICellModifier modifier) {
- tableViewerImpl.setCellModifier(modifier);
-}
-/**
- * Sets the column properties of this table viewer.
- * The properties must correspond with the columns of the table control.
- * They are used to identify the column in a cell modifier.
- *
- * @param columnProperties the list of column properties
- */
-public void setColumnProperties(String[] columnProperties) {
- tableViewerImpl.setColumnProperties(columnProperties);
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected void setExpanded(Item node, boolean expand) {
- ((TableTreeItem) node).setExpanded(expand);
-}
-/**
- * The table tree viewer implementation of this <code>Viewer</code> framework
- * method ensures that the given label provider is an instance
- * of either <code>ITableLabelProvider</code> or <code>ILabelProvider</code>.
- * If it is an <code>ITableLabelProvider</code>, then it provides a
- * separate label text and image for each column. If it is an
- * <code>ILabelProvider</code>, then it provides only the label text
- * and image for the first column, and any remaining columns are blank.
- */
-public void setLabelProvider(IBaseLabelProvider labelProvider) {
- Assert.isTrue(labelProvider instanceof ITableLabelProvider || labelProvider instanceof ILabelProvider );
- super.setLabelProvider(labelProvider);
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected void setSelection(List items) {
- TableTreeItem[] newItems = new TableTreeItem[items.size()];
- items.toArray(newItems);
- getTableTree().setSelection(newItems);
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected void showItem(Item item) {
- getTableTree().showItem((TableTreeItem)item);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewer.java
deleted file mode 100644
index 3265e9d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewer.java
+++ /dev/null
@@ -1,633 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TableEditor;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List; // Otherwise ambiguous
-
-/**
- * A concrete viewer based on a SWT <code>Table</code> control.
- * <p>
- * This class is not intended to be subclassed outside the viewer framework.
- * It is designed to be instantiated with a pre-existing SWT table control and configured
- * with a domain-specific content provider, table label provider, element filter (optional),
- * and element sorter (optional).
- * </p>
- * <p>
- * Label providers for table viewers must implement either the <code>ITableLabelProvider</code>
- * or the <code>ILabelProvider</code> interface (see <code>TableViewer.setLabelProvider</code>
- * for more details).
- * </p>
- */
-public class TableViewer extends StructuredViewer {
-
- /**
- * Internal table viewer implementation.
- */
- private TableViewerImpl tableViewerImpl;
-
- /**
- * This viewer's table control.
- */
- private Table table;
-
- /**
- * This viewer's table editor.
- */
- private TableEditor tableEditor;
-/**
- * Creates a table viewer on a newly-created table control under the given parent.
- * The table control is created using the SWT style bits <code>MULTI, H_SCROLL, V_SCROLL,</code> and <code>BORDER</code>.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters. The table has no columns.
- *
- * @param parent the parent control
- */
-public TableViewer(Composite parent) {
- this(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
-}
-/**
- * Creates a table viewer on a newly-created table control under the given parent.
- * The table control is created using the given style bits.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters. The table has no columns.
- *
- * @param parent the parent control
- * @param style SWT style bits
- */
-public TableViewer(Composite parent, int style) {
- this(new Table(parent, style));
-}
-/**
- * Creates a table viewer on the given table control.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param table the table control
- */
-public TableViewer(Table table) {
- this.table = table;
- hookControl(table);
- tableEditor = new TableEditor(table);
- initTableViewerImpl();
-}
-/**
- * Adds the given elements to this table viewer.
- * If this viewer does not have a sorter, the elements are added at the end
- * in the order given; otherwise the elements are inserted at appropriate positions.
- * <p>
- * This method should be called (by the content provider) when elements
- * have been added to the model, in order to cause the viewer to accurately
- * reflect the model. This method only affects the viewer, not the model.
- * </p>
- *
- * @param elements the elements to add
- */
-public void add(Object[] elements) {
- Object[] filtered = filter(elements);
- for (int i = 0; i < filtered.length; i++){
- Object element = filtered[i];
- int index = indexForElement(element);
- updateItem(new TableItem(getTable(), SWT.NONE, index), element);
- }
-}
-/**
- * Adds the given element to this table viewer.
- * If this viewer does not have a sorter, the element is added at the end;
- * otherwise the element is inserted at the appropriate position.
- * <p>
- * This method should be called (by the content provider) when a single element
- * has been added to the model, in order to cause the viewer to accurately
- * reflect the model. This method only affects the viewer, not the model.
- * Note that there is another method for efficiently processing the simultaneous
- * addition of multiple elements.
- * </p>
- *
- * @param element the element to add
- */
-public void add(Object element) {
- add(new Object[] { element });
-}
-/**
- * Cancels a currently active cell editor. All changes already done in the cell
- * editor are lost.
- */
-public void cancelEditing() {
- tableViewerImpl.cancelEditing();
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected Widget doFindInputItem(Object element) {
- if (element.equals(getRoot()))
- return getTable();
- return null;
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected Widget doFindItem(Object element) {
- TableItem[] children = table.getItems();
- for (int i = 0; i < children.length; i++) {
- TableItem item = children[i];
- Object data = item.getData();
- if (data != null && data.equals(element))
- return item;
- }
-
- return null;
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected void doUpdateItem(Widget widget, Object element, boolean fullMap) {
- if (widget instanceof TableItem) {
- TableItem item = (TableItem) widget;
-
- // remember element we are showing
- if (fullMap) {
- associate(element, item);
- } else {
- item.setData(element);
- mapElement(element, item);
- }
-
- IBaseLabelProvider prov = getLabelProvider();
- ITableLabelProvider tprov = null;
- ILabelProvider lprov = null;
- if (prov instanceof ITableLabelProvider) {
- tprov = (ITableLabelProvider) prov;
- }
- else {
- lprov = (ILabelProvider) prov;
- }
- int columnCount = table.getColumnCount();
- // Also enter loop if no columns added. See 1G9WWGZ: JFUIF:WINNT - TableViewer with 0 columns does not work
- for (int column = 0; column < columnCount || column == 0; column++) {
- // Similar code in TableTreeViewer.doUpdateItem()
- TableItem ti = (TableItem) item;
- String text = "";//$NON-NLS-1$
- Image image = null;
- if (tprov != null) {
- text = tprov.getColumnText(element, column);
- image = tprov.getColumnImage(element, column);
- }
- else {
- if (column == 0) {
- text = lprov.getText(element);
- image = lprov.getImage(element);
- }
- }
- ti.setText(column, text);
- if (ti.getImage(column) != image) {
- ti.setImage(column, image);
- }
- }
- }
-}
-/**
- * Starts editing the given element.
- *
- * @param element the element
- * @param column the column number
- */
-public void editElement(Object element, int column) {
- tableViewerImpl.editElement(element,column);
-}
-/**
- * Returns the cell editors of this table viewer.
- *
- * @return the list of cell editors
- */
-public CellEditor[] getCellEditors() {
- return tableViewerImpl.getCellEditors();
-}
-/**
- * Returns the cell modifier of this table viewer.
- *
- * @return the cell modifier
- */
-public ICellModifier getCellModifier() {
- return tableViewerImpl.getCellModifier();
-}
-/**
- * Returns the column properties of this table viewer.
- * The properties must correspond with the columns of the table control.
- * They are used to identify the column in a cell modifier.
- *
- * @return the list of column properties
- */
-public Object[] getColumnProperties() {
- return tableViewerImpl.getColumnProperties();
-}
-/* (non-Javadoc)
- * Method declared on Viewer.
- */
-public Control getControl() {
- return table;
-}
-/**
- * Returns the element with the given index from this table viewer.
- * Returns <code>null</code> if the index is out of range.
- * <p>
- * This method is internal to the framework.
- * </p>
- *
- * @param index the zero-based index
- * @return the element at the given index, or <code>null</code> if the
- * index is out of range
- */
-public Object getElementAt(int index) {
- if (index >= 0 && index < table.getItemCount()) {
- TableItem i = table.getItem(index);
- if(i != null)
- return i.getData();
- }
- return null;
-}
-/**
- * The table viewer implementation of this <code>Viewer</code> framework
- * method returns the label provider, which in the case of table
- * viewers will be an instance of either <code>ITableLabelProvider</code>
- * or <code>ILabelProvider</code>.
- * If it is an <code>ITableLabelProvider</code>, then it provides a
- * separate label text and image for each column. If it is an
- * <code>ILabelProvider</code>, then it provides only the label text
- * and image for the first column, and any remaining columns are blank.
- */
-public IBaseLabelProvider getLabelProvider() {
- return super.getLabelProvider();
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected List getSelectionFromWidget() {
- Widget[] items = table.getSelection();
- ArrayList list = new ArrayList(items.length);
- for (int i = 0; i < items.length; i++) {
- Widget item = items[i];
- Object e = item.getData();
- if (e != null)
- list.add(e);
- }
- return list;
-}
-/**
- * Returns this table viewer's table control.
- *
- * @return the table control
- */
-public Table getTable() {
- return table;
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected void hookControl(Control control) {
- super.hookControl(control);
- Table tableControl = (Table)control;
- tableControl.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- tableViewerImpl.handleMouseDown(e);
- }
- public void mouseDoubleClick(MouseEvent e) {
- tableViewerImpl.handleMouseDoubleClick(e);
- }
- });
-}
-/*
- * Returns the index where the item should be inserted.
-*/
-protected int indexForElement(Object element) {
- ViewerSorter sorter = getSorter();
- if(sorter == null)
- return table.getItemCount();
- int count = table.getItemCount();
- int min = 0, max = count - 1;
- while (min <= max) {
- int mid = (min + max) / 2;
- Object data = table.getItem(mid).getData();
- int compare = sorter.compare(this, data, element);
- if (compare == 0) {
- // find first item > element
- while (compare == 0) {
- ++mid;
- if (mid >= count) {
- break;
- }
- data = table.getItem(mid).getData();
- compare = sorter.compare(this, data, element);
- }
- return mid;
- }
- if (compare < 0)
- min = mid + 1;
- else
- max = mid - 1;
- }
- return min;
-}
-/**
- * Initializes the table viewer implementation.
- */
-private void initTableViewerImpl() {
- tableViewerImpl = new TableViewerImpl() {
- Rectangle getBounds(Item item, int columnNumber) {
- return ((TableItem)item).getBounds(columnNumber);
- }
- int getColumnCount() {
- return getTable().getColumnCount();
- }
- Item[] getSelection() {
- return getTable().getSelection();
- }
- void setEditor(Control w, Item item, int columnNumber) {
- tableEditor.setEditor(w, (TableItem)item, columnNumber);
- }
- void setSelection(StructuredSelection selection, boolean b) {
- TableViewer.this.setSelection(selection,b);
- }
- void showSelection() {
- getTable().showSelection();
- }
- void setLayoutData(CellEditor.LayoutData layoutData) {
- tableEditor.grabHorizontal = layoutData.grabHorizontal;
- tableEditor.horizontalAlignment = layoutData.horizontalAlignment;
- tableEditor.minimumWidth = layoutData.minimumWidth;
- }
- };
-}
-/* (non-Javadoc)
- * Method declared on Viewer.
- */
-protected void inputChanged(Object input, Object oldInput) {
- getControl().setRedraw(false);
- try {
- // refresh() attempts to preserve selection, which we want here
- refresh();
- }
- finally {
- getControl().setRedraw(true);
- }
-}
-/**
- * Inserts the given element into this table viewer at the given position.
- * If this viewer has a sorter, the position is ignored and the element is inserted
- * at the correct position in the sort order.
- * <p>
- * This method should be called (by the content provider) when elements
- * have been added to the model, in order to cause the viewer to accurately
- * reflect the model. This method only affects the viewer, not the model.
- * </p>
- *
- * @param element the element
- * @param position a 0-based position relative to the model, or -1 to indicate the last position
- */
-public void insert(Object element, int position) {
- tableViewerImpl.applyEditorValue();
- if (getSorter() != null || hasFilters()) {
- add(element);
- return;
- }
- if (position == -1)
- position = table.getItemCount();
- updateItem(new TableItem(table, SWT.NONE, position), element);
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected void internalRefresh(Object element) {
- internalRefresh(element, true);
-}
-
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected void internalRefresh(Object element, boolean updateLabels) {
- tableViewerImpl.applyEditorValue();
- if (element == null || element.equals(getRoot())) {
- // the parent
-
- // in the code below, it is important to do all disassociates
- // before any associates, since a later disassociate can undo an earlier associate
- // e.g. if (a, b) is replaced by (b, a), the disassociate of b to item 1 could undo
- // the associate of b to item 0.
-
- Object[] children = getSortedChildren(getRoot());
- TableItem[] items = table.getItems();
- int min = Math.min(children.length, items.length);
- for (int i = 0; i < min; ++i) {
- // if the element is unchanged, update its label if appropriate
- if (children[i].equals(items[i].getData())) {
- if (updateLabels) {
- updateItem(items[i], children[i]);
- }
- }
- else {
- // updateItem does an associate(...), which can mess up
- // the associations if the order of elements has changed.
- // E.g. (a, b) -> (b, a) first replaces a->0 with b->0, then replaces b->1 with a->1, but this actually removes b->0.
- // So, if the object associated with this item has changed,
- // just disassociate it for now, and update it below.
- disassociate(items[i]);
- }
- }
-
- // dispose of all items beyond the end of the current elements
- if (min < items.length) {
- for (int i = items.length; --i >= min;) {
- disassociate(items[i]);
- }
- table.remove(min, items.length-1);
- }
-
- // Workaround for 1GDGN4Q: ITPUI:WIN2000 - TableViewer icons get scrunched
- if (table.getItemCount() == 0) {
- table.removeAll();
- }
-
- // Update items which were removed above
- for (int i = 0; i < min; ++i) {
- if (items[i].getData() == null) {
- updateItem(items[i], children[i]);
- }
- }
-
- // add any remaining elements
- for (int i = min; i < children.length; ++i) {
- updateItem(new TableItem(table, SWT.NONE, i), children[i]);
- }
- }
- else {
- Widget w = findItem(element);
- if (w != null) {
- updateItem(w, element);
- }
- }
-}
-/**
- * Removes the given elements from this table viewer.
- *
- * @param elements the elements to remove
- */
-private void internalRemove(final Object[] elements) {
- Object input = getInput();
- for (int i = 0; i < elements.length; ++i) {
- if (elements[i].equals(input)) {
- setInput(null);
- return;
- }
- }
- // use remove(int[]) rather than repeated TableItem.dispose() calls
- // to allow SWT to optimize multiple removals
- int[] indices = new int[elements.length];
- int count = 0;
- for (int i = 0; i < elements.length; ++i) {
- Widget w = findItem(elements[i]);
- if (w instanceof TableItem) {
- TableItem item = (TableItem) w;
- disassociate(item);
- indices[count++] = table.indexOf(item);
- }
- }
- if (count < indices.length) {
- System.arraycopy(indices, 0, indices = new int[count], 0, count);
- }
- table.remove(indices);
-
- // Workaround for 1GDGN4Q: ITPUI:WIN2000 - TableViewer icons get scrunched
- if (table.getItemCount() == 0) {
- table.removeAll();
- }
-}
-/**
- * Returns whether there is an active cell editor.
- *
- * @return <code>true</code> if there is an active cell editor, and
- * <code>false</code> otherwise
- */
-public boolean isCellEditorActive() {
- return tableViewerImpl.isCellEditorActive();
-}
-/**
- * Removes the given elements from this table viewer.
- * The selection is updated if required.
- * <p>
- * This method should be called (by the content provider) when elements
- * have been removed from the model, in order to cause the viewer to accurately
- * reflect the model. This method only affects the viewer, not the model.
- * </p>
- *
- * @param elements the elements to remove
- */
-public void remove(final Object[] elements) {
- preservingSelection(new Runnable() {
- public void run() {
- internalRemove(elements);
- }
- });
-}
-/**
- * Removes the given element from this table viewer.
- * The selection is updated if necessary.
- * <p>
- * This method should be called (by the content provider) when a single element
- * has been removed from the model, in order to cause the viewer to accurately
- * reflect the model. This method only affects the viewer, not the model.
- * Note that there is another method for efficiently processing the simultaneous
- * removal of multiple elements.
- * </p>
- *
- * @param element the element
- */
-public void remove(Object element) {
- remove(new Object[] { element });
-}
-/*
- * Non-Javadoc.
- * Method defined on StructuredViewer.
- */
-public void reveal(Object element) {
- Widget w = findItem(element);
- if (w instanceof TableItem)
- getTable().showItem((TableItem) w);
-}
-/**
- * Sets the cell editors of this table viewer.
- *
- * @param editors the list of cell editors
- */
-public void setCellEditors(CellEditor[] editors) {
- tableViewerImpl.setCellEditors(editors);
-}
-/**
- * Sets the cell modifier of this table viewer.
- *
- * @param modifier the cell modifier
- */
-public void setCellModifier(ICellModifier modifier) {
- tableViewerImpl.setCellModifier(modifier);
-}
-/**
- * Sets the column properties of this table viewer.
- * The properties must correspond with the columns of the table control.
- * They are used to identify the column in a cell modifier.
- *
- * @param columnProperties the list of column properties
- */
-public void setColumnProperties(String[] columnProperties) {
- tableViewerImpl.setColumnProperties(columnProperties);
-}
-/**
- * The table viewer implementation of this <code>Viewer</code> framework
- * method ensures that the given label provider is an instance
- * of either <code>ITableLabelProvider</code> or <code>ILabelProvider</code>.
- * If it is an <code>ITableLabelProvider</code>, then it provides a
- * separate label text and image for each column. If it is an
- * <code>ILabelProvider</code>, then it provides only the label text
- * and image for the first column, and any remaining columns are blank.
- */
-public void setLabelProvider(IBaseLabelProvider labelProvider) {
- Assert.isTrue(labelProvider instanceof ITableLabelProvider || labelProvider instanceof ILabelProvider );
- super.setLabelProvider(labelProvider);
-}
-/* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
-protected void setSelectionToWidget(List list, boolean reveal) {
- if (list == null) {
- table.deselectAll();
- return;
- }
- int size = list.size();
- TableItem[] items = new TableItem[size];
- TableItem firstItem = null;
- int count = 0;
- for (int i = 0; i < size; ++i) {
- Object o = list.get(i);
- Widget w = findItem(o);
- if (w instanceof TableItem) {
- TableItem item = (TableItem) w;
- items[count++] = item;
- if (firstItem == null)
- firstItem = item;
- }
- }
- if (count < size) {
- System.arraycopy(items, 0, items = new TableItem[count], 0, count);
- }
- table.setSelection(items);
-
- if (reveal && firstItem != null) {
- table.showItem(firstItem);
- }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewerImpl.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewerImpl.java
deleted file mode 100644
index c683bf9..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewerImpl.java
+++ /dev/null
@@ -1,285 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.TableEditor;
-import java.util.*;
-
-/**
- * Internal table viewer implementation.
- */
-/* package */ abstract class TableViewerImpl {
-
- private boolean isActivating = false;
- private CellEditor cellEditor;
- private CellEditor[] cellEditors;
- private ICellModifier cellModifier;
- private String[] columnProperties;
- private Item tableItem;
- private int columnNumber;
- private ICellEditorListener cellEditorListener;
- private FocusListener focusListener;
-
-
-TableViewerImpl() {
- initCellEditorListener();
-}
-/**
- * Activate a cell editor for the given column.
- */
-private void activateCellEditor() {
- if (cellEditors != null) {
- if(cellEditors[columnNumber] != null && cellModifier != null) {
- Object element = tableItem.getData();
- String property = columnProperties[columnNumber];
- if (cellModifier.canModify(element, property)) {
- cellEditor = cellEditors[columnNumber];
- //table.showSelection();
- cellEditor.addListener(cellEditorListener);
- Object value = cellModifier.getValue(element, property);
- cellEditor.setValue(value);
- // Tricky flow of control here:
- // activate() can trigger callback to cellEditorListener which will clear cellEditor
- // so must get control first, but must still call activate() even if there is no control.
- Control control = cellEditor.getControl();
- cellEditor.activate();
- if (control == null)
- return;
- setLayoutData(cellEditor.getLayoutData());
- setEditor(control, tableItem, columnNumber);
- cellEditor.setFocus();
- if(focusListener == null) {
- focusListener = new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- applyEditorValue();
- }
- };
- }
- control.addFocusListener(focusListener);
- }
- }
- }
-}
-/**
- * Activate a cell editor for the given mouse position.
- */
-private void activateCellEditor(MouseEvent event) {
- if (tableItem == null || tableItem.isDisposed()) {
- //item no longer exists
- return;
- }
- int columnToEdit;
- int columns = getColumnCount();
- if (columns == 0) {
- // If no TableColumn, Table acts as if it has a single column
- // which takes the whole width.
- columnToEdit = 0;
- }
- else {
- columnToEdit = -1;
- for (int i = 0; i < columns; i++) {
- Rectangle bounds = getBounds(tableItem, i);
- if (bounds.contains(event.x, event.y)) {
- columnToEdit = i;
- break;
- }
- }
- if (columnToEdit == -1) {
- return;
- }
- }
-
- columnNumber = columnToEdit;
- activateCellEditor();
-}
-/**
- * Deactivates the currently active cell editor.
- */
-public void applyEditorValue() {
- CellEditor c = this.cellEditor;
- if (c != null) {
- // null out cell editor before calling save
- // in case save results in applyEditorValue being re-entered
- // see 1GAHI8Z: ITPUI:ALL - How to code event notification when using cell editor ?
- this.cellEditor = null;
- Item t = this.tableItem;
- // don't null out table item -- same item is still selected
- if (t != null && !t.isDisposed()) {
- saveEditorValue(c, t);
- }
- setEditor(null, null, 0);
- c.removeListener(cellEditorListener);
- c.deactivate();
- }
-}
-/**
- * Cancels the active cell editor, without saving the value
- * back to the domain model.
- */
-public void cancelEditing() {
- if (cellEditor != null) {
- setEditor(null, null, 0);
- cellEditor.removeListener(cellEditorListener);
- CellEditor oldEditor = cellEditor;
- cellEditor = null;
- oldEditor.deactivate();
- }
-}
-/**
- * Start editing the given element.
- */
-public void editElement(Object element, int column) {
- if (cellEditor != null)
- applyEditorValue();
-
- setSelection(new StructuredSelection(element), true);
- Item[] selection = getSelection();
- if (selection.length != 1)
- return;
-
- tableItem = selection[0];
-
- // Make sure selection is visible
- showSelection();
- columnNumber = column;
- activateCellEditor();
-
-}
-abstract Rectangle getBounds(Item item, int columnNumber);
-public CellEditor[] getCellEditors() {
- return cellEditors;
-}
-public ICellModifier getCellModifier() {
- return cellModifier;
-}
-abstract int getColumnCount();
-public Object[] getColumnProperties() {
- return columnProperties;
-}
-abstract Item[] getSelection();
-/**
- * Handles the double click event.
- */
-public void handleMouseDoubleClick(MouseEvent event) {
- //The last mouse down was a double click. Cancel
- //the cell editor activation.
- isActivating = false;
-}
-/**
- * Handles the mouse down event.
- * Activates the cell editor if it is not a double click.
- *
- * This implementation must:
- * i) activate the cell editor when clicking over the item's text or over the item's image.
- * ii) activate it only if the item is already selected.
- * iii) do NOT activate it on a double click (whether the item is selected or not).
- */
-public void handleMouseDown(MouseEvent event) {
- if (event.button != 1)
- return;
-
- boolean wasActivated = isCellEditorActive();
- if (wasActivated)
- applyEditorValue();
-
- Item[] items = getSelection();
- // Do not edit if more than one row is selected.
- if (items.length != 1) {
- tableItem = null;
- return;
- }
-
- if(tableItem != items[0]) {
- //This mouse down was a selection. Keep the selection and return;
- tableItem = items[0];
- return;
- }
-
- //It may be a double click. If so, the activation was started by the first click.
- if(isActivating || wasActivated)
- return;
-
- isActivating = true;
- //Post the activation. So it may be canceled if it was a double click.
- postActivation(event);
-}
-private void initCellEditorListener() {
- cellEditorListener = new ICellEditorListener() {
- public void editorValueChanged(boolean oldValidState, boolean newValidState) {
- // Ignore.
- }
-
- public void cancelEditor() {
- TableViewerImpl.this.cancelEditing();
- }
-
- public void applyEditorValue() {
- TableViewerImpl.this.applyEditorValue();
- }
- };
-}
-/**
- * Returns <code>true</code> if there is an active cell editor; otherwise
- * <code>false</code> is returned.
- */
-public boolean isCellEditorActive() {
- return cellEditor != null;
-}
-/**
- * Handle the mouse down event.
- * Activate the cell editor if it is not a doble click.
- */
-private void postActivation(final MouseEvent event) {
- if(!isActivating)
- return;
-
- (new Thread() {
- public void run() {
- try { Thread.sleep(400); } catch (Exception e){}
- if(isActivating) {
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- activateCellEditor(event);
- isActivating = false;
- }
- });
- }
- }
- }).start();
-}
-/**
- * Saves the value of the currently active cell editor,
- * by delegating to the cell modifier.
- */
-private void saveEditorValue(CellEditor cellEditor, Item tableItem) {
- if (cellModifier != null) {
- if (!cellEditor.isValueValid()) {
- ///Do what ???
- }
- String property = null;
- if (columnProperties != null && columnNumber < columnProperties.length)
- property = columnProperties[columnNumber];
- cellModifier.modify(tableItem, property, cellEditor.getValue());
- }
-}
-public void setCellEditors(CellEditor[] editors) {
- this.cellEditors = editors;
-}
-public void setCellModifier(ICellModifier modifier) {
- this.cellModifier = modifier;
-}
-public void setColumnProperties(String[] columnProperties) {
- this.columnProperties = columnProperties;
-}
-abstract void setEditor(Control w, Item item, int fColumnNumber);
-abstract void setLayoutData(CellEditor.LayoutData layoutData);
-abstract void setSelection(StructuredSelection selection, boolean b);
-abstract void showSelection();
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TextCellEditor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TextCellEditor.java
deleted file mode 100644
index 851d83d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TextCellEditor.java
+++ /dev/null
@@ -1,335 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.text.MessageFormat;
-
-/**
- * A cell editor that manages a text entry field.
- * The cell editor's value is the text string itself.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class TextCellEditor extends CellEditor {
-
- /**
- * The text control; initially <code>null</code>.
- */
- protected Text text;
-
- private ModifyListener modifyListener;
-
- /**
- * State information for updating action enablement
- */
- private boolean isSelection = false;
- private boolean isDeleteable = false;
- private boolean isSelectable = false;
-/**
- * Creates a new text string cell editor parented under the given control.
- * The cell editor value is the string itself, which is initially the empty string.
- * Initially, the cell editor has no cell validator.
- *
- * @param parent the parent control
- */
-public TextCellEditor(Composite parent) {
- super(parent);
-}
-/**
- * Checks to see if the "deleteable" state (can delete/
- * nothing to delete) has changed and if so fire an
- * enablement changed notification.
- */
-private void checkDeleteable() {
- boolean oldIsDeleteable = isDeleteable;
- isDeleteable = isDeleteEnabled();
- if (oldIsDeleteable != isDeleteable) {
- fireEnablementChanged(DELETE);
- }
-}
-/**
- * Checks to see if the "selectable" state (can select)
- * has changed and if so fire an enablement changed notification.
- */
-private void checkSelectable() {
- boolean oldIsSelectable = isSelectable;
- isSelectable = isSelectAllEnabled();
- if (oldIsSelectable != isSelectable) {
- fireEnablementChanged(SELECT_ALL);
- }
-}
-/**
- * Checks to see if the selection state (selection /
- * no selection) has changed and if so fire an
- * enablement changed notification.
- */
-private void checkSelection() {
- boolean oldIsSelection = isSelection;
- isSelection = text.getSelectionCount() > 0;
- if (oldIsSelection != isSelection) {
- fireEnablementChanged(COPY);
- fireEnablementChanged(CUT);
- }
-}
-/* (non-Javadoc)
- * Method declared on CellEditor.
- */
-protected Control createControl(Composite parent) {
- // specify no borders on text widget as cell outline in
- // table already provides the look of a border.
- text = new Text(parent, SWT.SINGLE);
- text.addKeyListener(new KeyAdapter() {
- // hook key pressed - see PR 14201
- public void keyPressed(KeyEvent e) {
- keyReleaseOccured(e);
- // as a result of processing the above call, clients may have
- // disposed this cell editor
- if ((getControl() == null) || getControl().isDisposed())
- return;
- checkSelection(); // see explaination below
- checkDeleteable();
- checkSelectable();
- }
- });
- text.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
- e.doit = false;
- }
- }
- });
- // We really want a selection listener but it is not supported so we
- // use a key listener and a mouse listener to know when selection changes
- // may have occured
- text.addMouseListener(new MouseAdapter() {
- public void mouseUp(MouseEvent e) {
- checkSelection();
- checkDeleteable();
- checkSelectable();
- }
- });
- text.setFont(parent.getFont());
- text.setBackground(parent.getBackground());
- text.setText("");//$NON-NLS-1$
- text.addModifyListener(getModifyListener());
- return text;
-}
-/**
- * The <code>TextCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method returns
- * the text string.
- *
- * @return the text string
- */
-protected Object doGetValue() {
- return text.getText();
-}
-/* (non-Javadoc)
- * Method declared on CellEditor.
- */
-protected void doSetFocus() {
- if (text != null) {
- text.selectAll();
- text.setFocus();
- checkSelection();
- checkDeleteable();
- checkSelectable();
- }
-}
-/**
- * The <code>TextCellEditor</code> implementation of
- * this <code>CellEditor</code> framework method accepts
- * a text string (type <code>String</code>).
- *
- * @param value a text string (type <code>String</code>)
- */
-protected void doSetValue(Object value) {
- Assert.isTrue(text != null && (value instanceof String));
- text.removeModifyListener(getModifyListener());
- text.setText((String) value);
- text.addModifyListener(getModifyListener());
-}
-/**
- * Processes a modify event that occurred in this text cell editor.
- * This framework method performs validation and sets the error message
- * accordingly, and then reports a change via <code>fireEditorValueChanged</code>.
- * Subclasses should call this method at appropriate times. Subclasses
- * may extend or reimplement.
- *
- * @param e the SWT modify event
- */
-protected void editOccured(ModifyEvent e) {
- String value = text.getText();
- if (value == null)
- value = "";//$NON-NLS-1$
- Object typedValue = value;
- boolean oldValidState = isValueValid();
- boolean newValidState = isCorrect(typedValue);
- if (typedValue == null && newValidState)
- Assert.isTrue(false, "Validator isn't limiting the cell editor's type range");//$NON-NLS-1$
- if (!newValidState) {
- // try to insert the current value into the error message.
- setErrorMessage(MessageFormat.format(getErrorMessage(), new Object[] {value}));
- }
- valueChanged(oldValidState, newValidState);
-}
-/**
- * Since a text editor field is scrollable we don't
- * set a minimumSize.
- */
-public LayoutData getLayoutData() {
- return new LayoutData();
-}
-/**
- * Return the modify listener.
- */
-private ModifyListener getModifyListener() {
- if (modifyListener == null) {
- modifyListener = new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- editOccured(e);
- }
- };
- }
- return modifyListener;
-}
-/**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method returns <code>true</code> if
- * the current selection is not empty.
- */
-public boolean isCopyEnabled() {
- if (text == null || text.isDisposed())
- return false;
- return text.getSelectionCount() > 0;
-}
-/**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method returns <code>true</code> if
- * the current selection is not empty.
- */
-public boolean isCutEnabled() {
- if (text == null || text.isDisposed())
- return false;
- return text.getSelectionCount() > 0;
-}
-/**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method returns <code>true</code>
- * if there is a selection or if the caret is not positioned
- * at the end of the text.
- */
-public boolean isDeleteEnabled() {
- if (text == null || text.isDisposed())
- return false;
- return text.getSelectionCount() > 0 || text.getCaretPosition() < text.getCharCount();
-}
-/**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method always returns <code>true</code>.
- */
-public boolean isPasteEnabled() {
- if (text == null || text.isDisposed())
- return false;
- return true;
-}
-/**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method always returns <code>true</code>.
- */
-public boolean isSaveAllEnabled() {
- if (text == null || text.isDisposed())
- return false;
- return true;
-}
-/**
- * Returns <code>true</code> if this cell editor is
- * able to perform the select all action.
- * <p>
- * This default implementation always returns
- * <code>false</code>.
- * </p>
- * <p>
- * Subclasses may override
- * </p>
- * @return <code>true</code> if select all is possible,
- * <code>false</code> otherwise
- */
-public boolean isSelectAllEnabled() {
- if (text == null || text.isDisposed())
- return false;
- return text.getCharCount() > 0;
-}
-/**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method copies the
- * current selection to the clipboard.
- */
-public void performCopy() {
- text.copy();
-}
-/**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method cuts the
- * current selection to the clipboard.
- */
-public void performCut() {
- text.cut();
- checkSelection();
- checkDeleteable();
- checkSelectable();
-}
-/**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method deletes the
- * current selection or, if there is no selection,
- * the character next character from the current position.
- */
-public void performDelete() {
- if (text.getSelectionCount() > 0)
- // remove the contents of the current selection
- text.insert(""); //$NON-NLS-1$
- else {
- // remove the next character
- int pos = text.getCaretPosition();
- if (pos < text.getCharCount()) {
- text.setSelection(pos, pos + 1);
- text.insert(""); //$NON-NLS-1$
- }
- }
- checkSelection();
- checkDeleteable();
- checkSelectable();
-}
-/**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method pastes the
- * the clipboard contents over the current selection.
- */
-public void performPaste() {
- text.paste();
- checkSelection();
- checkDeleteable();
- checkSelectable();
-}
-/**
- * The <code>TextCellEditor</code> implementation of this
- * <code>CellEditor</code> method selects all of the
- * current text.
- */
-public void performSelectAll() {
- text.selectAll();
- checkSelection();
- checkDeleteable();
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeExpansionEvent.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeExpansionEvent.java
deleted file mode 100644
index e081cb3..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeExpansionEvent.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.EventObject;
-
-/**
- * Event object describing a tree node being expanded
- * or collapsed. The source of these events is the tree viewer.
- *
- * @see ITreeViewerListener
- */
-public class TreeExpansionEvent extends EventObject {
-
- /**
- * The element that was expanded or collapsed.
- */
- private Object element;
-/**
- * Creates a new event for the given source and element.
- *
- * @param source the tree viewer
- * @param element the element
- */
-public TreeExpansionEvent(AbstractTreeViewer source, Object element) {
- super(source);
- this.element = element;
-}
-/**
- * Returns the element that got expanded or collapsed.
- *
- * @return the element
- */
-public Object getElement() {
- return element;
-}
-/**
- * Returns the originator of the event.
- *
- * @return the originating tree viewer
- */
-public AbstractTreeViewer getTreeViewer() {
- return (AbstractTreeViewer) source;
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java
deleted file mode 100644
index 5b9a0fe..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List; // Otherwise ambiguous
-
-/**
- * A concrete viewer based on an SWT <code>Tree</code> control.
- * <p>
- * This class is not intended to be subclassed outside the viewer framework.
- * It is designed to be instantiated with a pre-existing SWT tree control and configured
- * with a domain-specific content provider, label provider, element filter (optional),
- * and element sorter (optional).
- * </p>
- * <p>
- * Content providers for tree viewers must implement the <code>ITreeContentProvider</code>
- * interface.
- * </p>
- */
-public class TreeViewer extends AbstractTreeViewer {
-
- /**
- * This viewer's control.
- */
- private Tree tree;
-/**
- * Creates a tree viewer on a newly-created tree control under the given parent.
- * The tree control is created using the SWT style bits <code>MULTI, H_SCROLL, V_SCROLL,</code> and <code>BORDER</code>.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param parent the parent control
- */
-public TreeViewer(Composite parent) {
- this(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
-}
-/**
- * Creates a tree viewer on a newly-created tree control under the given parent.
- * The tree control is created using the given SWT style bits.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- * The tree control has the MULTI, H_SCROLL, V_SCROLL and BORDER style bits set.
- *
- * @param parent the parent control
- * @param style the SWT style bits
- */
-public TreeViewer(Composite parent, int style) {
- this(new Tree(parent, style));
-}
-/**
- * Creates a tree viewer on the given tree control.
- * The viewer has no input, no content provider, a default label provider,
- * no sorter, and no filters.
- *
- * @param tree the tree control
- */
-public TreeViewer(Tree tree) {
- super();
- this.tree = tree;
- hookControl(tree);
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected void addTreeListener(Control c, TreeListener listener) {
- ((Tree)c).addTreeListener(listener);
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected void doUpdateItem(Item item, Object element) {
- // update icon and label
- ILabelProvider provider = (ILabelProvider) getLabelProvider();
- item.setText(provider.getText(element));
- Image image = provider.getImage(element);
- if (image != null) {
- item.setImage(image);
- }
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected Item[] getChildren(Widget o) {
- if (o instanceof TreeItem)
- return ((TreeItem) o).getItems();
- if (o instanceof Tree)
- return ((Tree) o).getItems();
- return null;
-}
-/* (non-Javadoc)
- * Method declared in Viewer.
- */
-public Control getControl() {
- return tree;
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected boolean getExpanded(Item item) {
- return ((TreeItem) item).getExpanded();
-}
-/* (non-Javadoc)
- * Method declared in StructuredViewer.
- */
-protected Item getItem(int x, int y) {
- return getTree().getItem(getTree().toControl(new Point(x, y)));
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected int getItemCount(Control widget) {
- return ((Tree) widget).getItemCount();
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected int getItemCount(Item item) {
- return ((TreeItem) item).getItemCount();
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected Item[] getItems(Item item) {
- return ((TreeItem) item).getItems();
-}
-/**
- * The tree viewer implementation of this <code>Viewer</code> framework
- * method returns the label provider, which in the case of tree
- * viewers will be an instance of <code>ILabelProvider</code>.
- */
-public IBaseLabelProvider getLabelProvider() {
- return super.getLabelProvider();
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected Item getParentItem(Item item) {
- return ((TreeItem)item).getParentItem();
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected Item[] getSelection(Control widget) {
- return ((Tree) widget).getSelection();
-}
-/**
- * Returns this tree viewer's tree control.
- *
- * @return the tree control
- */
-public Tree getTree() {
- return tree;
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected Item newItem(Widget parent, int flags, int ix) {
- TreeItem item;
- if (ix >= 0) {
- if (parent instanceof TreeItem)
- item = new TreeItem((TreeItem) parent, flags, ix);
- else
- item = new TreeItem((Tree) parent, flags, ix);
- } else {
- if (parent instanceof TreeItem)
- item = new TreeItem((TreeItem) parent, flags);
- else
- item = new TreeItem((Tree) parent, flags);
- }
- return item;
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected void removeAll(Control widget) {
- ((Tree) widget).removeAll();
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected void setExpanded(Item node, boolean expand) {
- ((TreeItem) node).setExpanded(expand);
-}
-/**
- * The tree viewer implementation of this <code>Viewer</code> framework
- * method ensures that the given label provider is an instance
- * of <code>ILabelProvider</code>.
- */
-public void setLabelProvider(IBaseLabelProvider labelProvider) {
- Assert.isTrue(labelProvider instanceof ILabelProvider);
- super.setLabelProvider(labelProvider);
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected void setSelection(List items) {
- TreeItem[] newItems = new TreeItem[items.size()];
- items.toArray(newItems);
- getTree().setSelection(newItems);
-}
-/* (non-Javadoc)
- * Method declared in AbstractTreeViewer.
- */
-protected void showItem(Item item) {
- getTree().showItem((TreeItem)item);
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/Viewer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/Viewer.java
deleted file mode 100644
index c1c0a16..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/Viewer.java
+++ /dev/null
@@ -1,355 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Item;
-import java.util.*;
-
-/**
- * A viewer is a model-based adapter on a widget.
- * <p>
- * A viewer can be created as an adapter on a pre-existing control (e.g.,
- * creating a <code>ListViewer</code> on an existing <code>List</code> control).
- * All viewers also provide a convenience constructor for creating the control.
- * </p>
- * <p>
- * Implementing a concrete viewer typically involves the following steps:
- * <ul>
- * <li>
- * create SWT controls for viewer (in constructor) (optional)
- * </li>
- * <li>
- * initialize SWT controls from input (inputChanged)
- * </li>
- * <li>
- * define viewer-specific update methods
- * </li>
- * <li>
- * support selections (<code>setSelection</code>, <code>getSelection</code>)
- * </li>
- * </ul>
- * </p>
- */
-public abstract class Viewer implements IInputSelectionProvider {
-
- /**
- * List of selection change listeners (element type: <code>ISelectionChangedListener</code>).
- *
- * @see #fireSelectionChanged
- */
- private ListenerList selectionChangedListeners = new ListenerList(3);
-
- /**
- * List of help request listeners (element type: <code>org.eclipse.swt.events.HelpListener</code>).
- * Help request listeners.
- *
- * @see #handleHelpRequest
- */
- private ListenerList helpListeners = new ListenerList(1);
-
- /**
- * The names of this viewer's properties.
- * <code>null</code> if this viewer has no properties.
- *
- * @see #setData
- */
- private String[] keys;
-
- /**
- * The values of this viewer's properties.
- * <code>null</code> if this viewer has no properties.
- * This array parallels the value of the <code>keys</code> field.
- *
- * @see #setData
- */
- private Object[] values;
-
- /**
- * Remembers whether we've hooked the help listener on the control or not.
- */
- private boolean helpHooked = false;
-
- /**
- * Help listener for the control, created lazily when client's first help listener is added.
- */
- private HelpListener helpListener = null;
-
- /**
- * Unique key for associating element data with widgets.
- * @see Widget#setData(String, Object)
- */
- protected static final String WIDGET_DATA_KEY = "org.eclipse.jface.viewers.WIDGET_DATA";//$NON-NLS-1$
-/**
- * Creates a new viewer.
- */
-protected Viewer() {
-}
-/**
- * Adds a listener for help requests in this viewer.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a help listener
- */
-public void addHelpListener(HelpListener listener) {
- helpListeners.add(listener);
- if (!helpHooked) {
- Control control = getControl();
- if (control != null && !control.isDisposed()) {
- if (this.helpListener == null) {
- this.helpListener = new HelpListener() {
- public void helpRequested(HelpEvent event) {
- handleHelpRequest(event);
- }
- };
- }
- control.addHelpListener(this.helpListener);
- helpHooked = true;
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
-public void addSelectionChangedListener(ISelectionChangedListener listener) {
- selectionChangedListeners.add(listener);
-}
-/**
- * Notifies any help listeners that help has been requested.
- * Only listeners registered at the time this method is called are notified.
- *
- * @param event a help event
- *
- * @see HelpListener#helpRequested
- */
-protected void fireHelpRequested(HelpEvent event) {
- Object[] listeners = helpListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((HelpListener) listeners[i]).helpRequested(event);
- }
-}
-/**
- * Notifies any selection changed listeners that the viewer's selection has changed.
- * Only listeners registered at the time this method is called are notified.
- *
- * @param event a selection changed event
- *
- * @see ISelectionChangedListener#selectionChanged
- */
-protected void fireSelectionChanged(SelectionChangedEvent event) {
- Object[] listeners = selectionChangedListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ISelectionChangedListener) listeners[i]).selectionChanged(event);
- }
-}
-/**
- * Returns the primary control associated with this viewer.
- *
- * @return the SWT control which displays this viewer's content
- */
-public abstract Control getControl();
-/**
- * Returns the value of the property with the given name,
- * or <code>null</code> if the property is not found.
- * <p>
- * The default implementation performs a (linear) search of
- * an internal table. Overriding this method is generally not
- * required if the number of different keys is small. If a more
- * efficient representation of a viewer's properties is required,
- * override both <code>getData</code> and <code>setData</code>.
- * </p>
- *
- * @param key the property name
- * @return the property value, or <code>null</code> if
- * the property is not found
- */
-public Object getData(String key) {
- Assert.isNotNull(key);
- if (keys == null)
- return null;
- for (int i=0; i < keys.length; i++) {
- if (keys[i].equals(key))
- return values[i];
- }
- return null;
-}
-/* (non-Javadoc)
- * Copy-down of method declared on <code>IInputProvider</code>.
- */
-public abstract Object getInput();
-/* (non-Javadoc)
- * Copy-down of method declared on <code>ISelectionProvider</code>.
- */
-public abstract ISelection getSelection();
-/**
- * Handles a help request from the underlying SWT control.
- * The default behavior is to fire a help request,
- * with the event's data modified to hold this viewer.
- */
-protected void handleHelpRequest(HelpEvent event) {
- Object oldData = event.data;
- event.data = this;
- fireHelpRequested(event);
- event.data = oldData;
-}
-/**
- * Internal hook method called when the input to this viewer is
- * initially set or subsequently changed.
- * <p>
- * The default implementation does nothing. Subclassers may override
- * this method to do something when a viewer's input is set.
- * A typical use is populate the viewer.
- * </p>
- *
- * @param input the new input of this viewer, or <code>null</code> if none
- * @param oldInput the old input element or <code>null</code> if there
- * was previously no input
- */
-protected void inputChanged(Object input, Object oldInput) {
-}
-/**
- * Refreshes this viewer completely with information freshly obtained from this
- * viewer's model.
- */
-public abstract void refresh();
-/**
- * Removes the given help listener from this viewer.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a help listener
- */
-public void removeHelpListener(HelpListener listener) {
- helpListeners.remove(listener);
- if (helpListeners.size() == 0) {
- Control control = getControl();
- if (control != null && !control.isDisposed()) {
- control.removeHelpListener(this.helpListener);
- helpHooked = false;
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
-public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- selectionChangedListeners.remove(listener);
-}
-/**
- * Scrolls the viewer's control down by one item from the given
- * display-relative coordinates. Returns the newly revealed Item,
- * or <code>null</code> if no scrolling occurred or if the viewer
- * doesn't represent an item-based widget.
- *
- * @param x horizontal coordinate
- * @param y vertical coordinate
- */
-public Item scrollDown(int x, int y) {
- return null;
-}
-/**
- * Scrolls the viewer's control up by one item from the given
- * display-relative coordinates. Returns the newly revealed Item,
- * or <code>null</code> if no scrolling occurred or if the viewer
- * doesn't represent an item-based widget.
- *
- * @param x horizontal coordinate
- * @param y vertical coordinate
- */
-public Item scrollUp(int x, int y) {
- return null;
-}
-/**
- * Sets the value of the property with the given name to the
- * given value, or to <code>null</code> if the property is to be
- * removed. If this viewer has such a property, its value is
- * replaced; otherwise a new property is added.
- * <p>
- * The default implementation records properties in an internal
- * table which is searched linearly. Overriding this method is generally not
- * required if the number of different keys is small. If a more
- * efficient representation of a viewer's properties is required,
- * override both <code>getData</code> and <code>setData</code>.
- * </p>
- *
- * @param key the property name
- * @return the property value, or <code>null</code> if
- * the property is not found
- */
-public void setData (String key, Object value) {
- Assert.isNotNull(key);
- /* Remove the key/value pair */
- if (value == null) {
- if (keys == null) return;
- int index = 0;
- while (index < keys.length && !keys[index].equals (key)) index++;
- if (index == keys.length) return;
- if (keys.length == 1) {
- keys = null;
- values = null;
- } else {
- String [] newKeys = new String[keys.length - 1];
- Object [] newValues = new Object[values.length - 1];
- System.arraycopy(keys, 0, newKeys, 0, index);
- System.arraycopy(keys, index + 1, newKeys, index, newKeys.length - index);
- System.arraycopy(values, 0, newValues, 0, index);
- System.arraycopy(values, index + 1, newValues, index, newValues.length - index);
- keys = newKeys;
- values = newValues;
- }
- return;
- }
-
- /* Add the key/value pair */
- if (keys == null) {
- keys = new String[] {key};
- values = new Object[] {value};
- return;
- }
- for (int i=0; i < keys.length; i++) {
- if (keys [i].equals(key)) {
- values [i] = value;
- return;
- }
- }
- String [] newKeys = new String[keys.length + 1];
- Object [] newValues = new Object[values.length + 1];
- System.arraycopy(keys, 0, newKeys, 0, keys.length);
- System.arraycopy(values, 0, newValues, 0, values.length);
- newKeys [keys.length] = key;
- newValues [values.length] = value;
- keys = newKeys;
- values = newValues;
-}
-/**
- * Sets or clears the input for this viewer.
- *
- * @param input the input of this viewer, or <code>null</code> if none
- */
-public abstract void setInput(Object input);
-/**
- * The viewer implementation of this <code>ISelectionProvider</code>
- * method make the new selection for this viewer without making it visible.
- * <p>
- * This method is equivalent to <code>setSelection(selection,false)</code>.
- * </p>
- */
-public void setSelection(ISelection selection) {
- setSelection(selection, false);
-}
-/**
- * Sets a new selection for this viewer and optionally makes it visible.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @param selection the new selection
- * @param reveal <code>true</code> if the selection is to be made
- * visible, and <code>false</code> otherwise
- */
-public abstract void setSelection(ISelection selection, boolean reveal);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerDropAdapter.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerDropAdapter.java
deleted file mode 100644
index 2f19779..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerDropAdapter.java
+++ /dev/null
@@ -1,416 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.TreeItem;
-
-/**
- * This adapter class provides generic drag-and-drop support for a viewer.
- * <p>
- * Subclasses must implement the following methods:
- * <ul>
- * <li><code>validateDrop</code> - identifies valid drop targets in viewer</li>
- * <li><code>performDrop</code> - carries out a drop into a viewer</li>
- * </ul>
- * The <code>setFeedbackEnabled</code> method can be called to turn on and off
- * visual insertion feedback (on by default).
- * </p>
- */
-public abstract class ViewerDropAdapter extends DropTargetAdapter {
-
- /**
- * Constant describing the position of the cursor relative
- * to the target object. This means the mouse is positioned
- * slightly before the target.
- * @see #getLocation
- */
- public static final int LOCATION_BEFORE = 1;
-
- /**
- * Constant describing the position of the cursor relative
- * to the target object. This means the mouse is positioned
- * slightly after the target.
- * @see #getLocation
- */
- public static final int LOCATION_AFTER = 2;
-
- /**
- * Constant describing the position of the cursor relative
- * to the target object. This means the mouse is positioned
- * directly on the target.
- * @see #getLocation
- */
- public static final int LOCATION_ON = 3;
-
- /**
- * Constant describing the position of the cursor relative
- * to the target object. This means the mouse is not positioned
- * over or near any valid target.
- * @see #getLocation
- */
- public static final int LOCATION_NONE = 4;
-
- /**
- * The viewer to which this drop support has been added.
- */
- private Viewer viewer;
-
- /**
- * The current operation.
- */
- private int currentOperation = DND.DROP_NONE;
-
- /**
- * The last valid operation.
- */
- private int lastValidOperation = DND.DROP_NONE;
-
- /**
- * The data item currently under the mouse.
- */
- private Object currentTarget;
-
- /**
- * Information about the position of the mouse relative to the
- * target (before, on, or after the target. Location is one of
- * the <code>LOCATION_* </code> constants defined in this type.
- */
- private int currentLocation;
-
- /**
- * A flag that allows adapter users to turn the insertion
- * feedback on or off. Default is <code>true</code>.
- */
- private boolean feedbackEnabled = true;
-
- /**
- * A flag that allows adapter users to turn auto scrolling
- * and expanding on or off. Default is <code>true</code>.
- */
- private boolean scrollExpandEnabled = true;
-
-/**
- * Creates a new drop adapter for the given viewer.
- *
- * @param viewer the viewer
- */
-protected ViewerDropAdapter(Viewer viewer) {
- this.viewer = viewer;
-}
-/**
- * Returns the position of the given event's coordinates relative to its target.
- * The position is determined to be before, after, or on the item, based on
- * some threshold value.
- *
- * @param event the event
- * @return one of the <code>LOCATION_* </code>constants defined in this class
- */
-protected int determineLocation(DropTargetEvent event) {
- if (!(event.item instanceof Item)) {
- return LOCATION_NONE;
- }
- Item item = (Item)event.item;
- Point coordinates = new Point(event.x, event.y);
- coordinates = viewer.getControl().toControl(coordinates);
- if (item != null) {
- Rectangle bounds = getBounds(item);
- if (bounds == null) {
- return LOCATION_NONE;
- }
- if ((coordinates.y - bounds.y) < 5) {
- return LOCATION_BEFORE;
- }
- if ((bounds.y + bounds.height - coordinates.y) < 5 ){
- return LOCATION_AFTER;
- }
- }
- return LOCATION_ON;
-}
-/**
- * Returns the target item of the given drop event.
- *
- * @param event the event
- * @return The target of the drop, may be <code>null</code>.
- */
-protected Object determineTarget(DropTargetEvent event) {
- return event.item == null ? null : event.item.getData();
-}
-/* (non-Javadoc)
- * Method declared on DropTargetAdapter.
- * The mouse has moved over the drop target. If the
- * target item has changed, notify the action and check
- * that it is still enabled.
- */
-private void doDropValidation(DropTargetEvent event) {
- //update last valid operation
- if (event.detail != DND.DROP_NONE) {
- lastValidOperation = event.detail;
- }
- //valid drop and set event detail accordingly
- if (validateDrop(currentTarget, event.detail, event.currentDataType)) {
- currentOperation = lastValidOperation;
- } else {
- currentOperation = DND.DROP_NONE;
- }
- event.detail = currentOperation;
-}
-/* (non-Javadoc)
- * Method declared on DropTargetAdapter.
- * The drag has entered this widget's region. See
- * if the drop should be allowed.
- */
-public void dragEnter(DropTargetEvent event) {
- try {
- currentTarget = determineTarget(event);
- doDropValidation(event);
- } catch (Throwable t) {
- handleException(t, event);
- }
-}
-/* (non-Javadoc)
- * Method declared on DropTargetAdapter.
- * The drop operation has changed, see if the action
- * should still be enabled.
- */
-public void dragOperationChanged(DropTargetEvent event) {
- try {
- currentTarget = determineTarget(event);
- doDropValidation(event);
- } catch (Throwable t) {
- handleException(t, event);
- }
-}
-/* (non-Javadoc)
- * Method declared on DropTargetAdapter.
- * The mouse has moved over the drop target. If the
- * target item has changed, notify the action and check
- * that it is still enabled.
- */
-public void dragOver(DropTargetEvent event) {
- try {
- //use newly revealed item as target if scrolling occurs
- Object target = determineTarget(event);
-
- //set the location feedback
- int oldLocation = currentLocation;
- currentLocation = determineLocation(event);
- setFeedback(event, currentLocation);
-
- //see if anything has really changed before doing validation.
- if (target != currentTarget || currentLocation != oldLocation) {
- currentTarget = target;
- doDropValidation(event);
- }
- } catch (Throwable t) {
- handleException(t, event);
- }
-}
-/* (non-Javadoc)
- * Method declared on DropTargetAdapter.
- * The user has dropped something on the desktop viewer.
- */
-public void drop(DropTargetEvent event) {
- try {
- currentLocation = determineLocation(event);
-
- //perform the drop behaviour
- if (!performDrop(event.data)) {
- event.detail = DND.DROP_NONE;
- }
- currentOperation = event.detail;
- } catch (Throwable t) {
- handleException(t, event);
- }
-}
-/* (non-Javadoc)
- * Method declared on DropTargetAdapter.
- * Last chance for the action to disable itself
- */
-public void dropAccept(DropTargetEvent event) {
- try {
- if (!validateDrop(currentTarget, event.detail, event.currentDataType)) {
- event.detail = DND.DROP_NONE;
- }
- } catch (Throwable t) {
- handleException(t, event);
- }
-}
-/**
- * Returns the bounds of the given SWT tree or table item.
- *
- * @param item the SWT Item
- * @return the bounds, or <code>null</code> if it is not a known type of item
- */
-protected Rectangle getBounds(Item item) {
- if (item instanceof TreeItem) {
- return ((TreeItem)item).getBounds();
- }
- if (item instanceof TableItem) {
- return ((TableItem)item).getBounds(0);
- }
- return null;
-}
-/**
- * Returns a constant describing the position of the mouse relative to the
- * target (before, on, or after the target.
- *
- * @return one of the <code>LOCATION_* </code> constants defined in this type
- */
-protected int getCurrentLocation() {
- return currentLocation;
-}
-/**
- * Returns the current operation.
- *
- * @return a <code>DROP_*</code> constant from class <code>DND</code>
- *
- * @see DND#DROP_COPY
- * @see DND#DROP_MOVE
- * @see DND#DROP_LINK
- * @see DND#DROP_NONE
- */
-protected int getCurrentOperation() {
- return currentOperation;
-}
-/**
- * Returns the target object currently under the mouse.
- *
- * @return the current target object
- */
-protected Object getCurrentTarget() {
- return currentTarget;
-}
-/**
- * Returns whether visible insertion feedback should be presented to the user.
- * <p>
- * Typical insertion feedback is the horizontal insertion bars that appear
- * between adjacent items while dragging.
- * </p>
- *
- * @return <code>true</code> if visual feedback is desired, and <code>false</code> if not
- */
-public boolean getFeedbackEnabled() {
- return feedbackEnabled;
-}
-/**
- * Returns the object currently selected by the viewer.
- *
- * @return the selected object, or <code>null</code> if either no object or
- * multiple objects are selected
- */
-protected Object getSelectedObject() {
- ISelection selection = viewer.getSelection();
- if (selection instanceof IStructuredSelection && !selection.isEmpty()) {
- IStructuredSelection structured = (IStructuredSelection)selection;
- return structured.getFirstElement();
- }
- return null;
-}
-/**
- * Returns the viewer to which this drop support has been added.
- */
-protected Viewer getViewer() {
- return viewer;
-}
-/**
- * Handles any exception that occurs during callback, including
- * rethrowing behavior.
- * <p>
- * [Issue: Implementation prints stack trace and eats exception to avoid
- * crashing VA/J.
- * Consider conditionalizing the implementation to do one thing in VAJ
- * and something more reasonable in other operating environments.
- * ]
- * </p>
- *
- * @param exception the exception
- * @param event the event
- */
-protected void handleException(Throwable exception, DropTargetEvent event) {
- // Currently we never rethrow because VA/Java crashes if an SWT
- // callback throws anything. Generally catching Throwable is bad, but in
- // this cases it's better than hanging the image.
- exception.printStackTrace();
- event.detail = DND.DROP_NONE;
-}
-/**
- * Performs any work associated with the drop.
- * <p>
- * Subclasses must implement this method to provide drop behavior.
- * </p>
- *
- * @param data the drop data
- * @return <code>true</code> if the drop was successful, and
- * <code>false</code> otherwise
- */
-public abstract boolean performDrop(Object data);
-/* (non-Javadoc)
- * Method declared on DropTargetAdapter.
- * The mouse has moved over the drop target. If the
- * target item has changed, notify the action and check
- * that it is still enabled.
- */
-private void setFeedback(DropTargetEvent event, int location) {
- if (scrollExpandEnabled)
- event.feedback |= DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
- if (feedbackEnabled) {
- switch (location) {
- case LOCATION_BEFORE:
- event.feedback |= DND.FEEDBACK_INSERT_BEFORE;
- break;
- case LOCATION_AFTER:
- event.feedback |= DND.FEEDBACK_INSERT_AFTER;
- break;
- case LOCATION_ON:
- default:
- event.feedback |= DND.FEEDBACK_SELECT;
- break;
- }
- }
-}
-/**
- * Sets whether visible insertion feedback should be presented to the user.
- * <p>
- * Typical insertion feedback is the horizontal insertion bars that appear
- * between adjacent items while dragging.
- * </p>
- *
- * @param value <code>true</code> if visual feedback is desired, and
- * <code>false</code> if not
- */
-public void setFeedbackEnabled(boolean value) {
- feedbackEnabled = value;
-}
-/**
- * Sets whether auto scrolling and expanding should be provided during dragging.
- *
- * @param value <code>true</code> if scrolling and expanding is desired, and
- * <code>false</code> if not
- * @since 2.0
- */
-public void setScrollExpandEnabled(boolean value) {
- scrollExpandEnabled = value;
-}
-/**
- * Validates dropping on the given object. This method is called whenever some
- * aspect of the drop operation changes.
- * <p>
- * Subclasses must implement this method to define which drops make sense.
- * </p>
- *
- * @param target the object that the mouse is currently hovering over, or
- * <code>null</code> if the mouse is hovering over empty space
- * @param operation the current drag operation (copy, move, etc.)
- * @param transferType the current transfer type
- * @return <code>true</code> if the drop is valid, and <code>false</code>
- * otherwise
- */
-public abstract boolean validateDrop(Object target, int operation, TransferData transferType);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerFilter.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerFilter.java
deleted file mode 100644
index a9606cc..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerFilter.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-import java.util.List; // disambiguate from SWT List
-
-/**
- * A viewer filter is used by a structured viewer to
- * extract a subset of elements provided by its content provider.
- * <p>
- * Subclasses must implement the <code>select</code> method
- * and may implement the <code>isFilterProperty</code> method.
- * </p>
- * @see IStructuredContentProvider
- * @see StructuredViewer
- */
-public abstract class ViewerFilter {
-/**
- * Creates a new viewer filter.
- */
-protected ViewerFilter() {
-}
-/**
- * Filters the given elements for the given viewer.
- * The input array is not modified.
- * <p>
- * The default implementation of this method calls
- * <code>select</code> on each element in the array,
- * and returns only those elements for which <code>select</code>
- * returns <code>true</code>.
- * </p>
- * @param viewer the viewer
- * @param parent the parent element
- * @param elements the elements to filter
- * @return the filtered elements
- */
-public Object[] filter(Viewer viewer, Object parent, Object[] elements) {
- int size = elements.length;
- ArrayList out = new ArrayList(size);
- for (int i = 0; i < size; ++i) {
- Object element = elements[i];
- if (select(viewer, parent, element))
- out.add(element);
- }
- return out.toArray();
-}
-/**
- * Returns whether this viewer filter would be affected
- * by a change to the given property of the given element.
- * <p>
- * The default implementation of this method returns <code>false</code>.
- * Subclasses should reimplement.
- * </p>
- *
- * @param element the element
- * @param property the property
- * @return <code>true</code> if the filtering would be affected,
- * and <code>false</code> if it would be unaffected
- */
-public boolean isFilterProperty(Object element, String property) {
- return false;
-}
-/**
- * Returns whether the given element makes it through this filter.
- *
- * @param viewer the viewer
- * @param parentElement the parent element
- * @param element the element
- * @return <code>true</code> if element is included in the
- * filtered set, and <code>false</code> if excluded
- */
-public abstract boolean select(Viewer viewer, Object parentElement, Object element);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerSorter.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerSorter.java
deleted file mode 100644
index 4b7e190..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerSorter.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package org.eclipse.jface.viewers;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.Collator;
-import java.util.*;
-
-/**
- * A viewer sorter is used by a structured viewer to
- * reorder the elements provided by its content provider.
- * <p>
- * The default <code>compare</code> method compares elements using two steps.
- * The first step uses the values returned from <code>category</code>.
- * By default, all elements are in the same category.
- * The second level is based on a case insensitive compare of the strings obtained
- * from the content viewer's label provider via <code>ILabelProvider.getText</code>.
- * </p>
- * <p>
- * Subclasses may implement the <code>isSorterProperty</code> method;
- * they may reimplement the <code>category</code> method to provide
- * categorization; and they may override the <code>compare</code> methods
- * to provide a totally different way of sorting elements.
- * </p>
- * @see IStructuredContentProvider
- * @see StructuredViewer
- */
-public abstract class ViewerSorter {
- /**
- * The collator used to sort strings.
- */
- protected Collator collator;
-/**
- * Creates a new viewer sorter, which uses the default collator
- * to sort strings.
- */
-protected ViewerSorter() {
- this(Collator.getInstance());
-}
-/**
- * Creates a new viewer sorter, which uses the given collator
- * to sort strings.
- *
- * @param collator the collator to use to sort strings
- */
-protected ViewerSorter(Collator collator) {
- this.collator = collator;
-}
-/**
- * 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
- * <code>0</code>. Subclasses may reimplement this method to provide
- * non-trivial categorization.
- * </p>
- *
- * @param element the element
- * @return the category
- */
-public int category(Object element) {
- return 0;
-}
-/**
- * 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, either
- * as computed by the content viewer's label provider, or their
- * <code>toString</code> values in other cases. Subclasses may override.
- * </p>
- *
- * @param viewer the viewer
- * @param e1 the first element
- * @param e2 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
- */
-public int compare(Viewer viewer, Object e1, Object e2) {
-
- int cat1 = category(e1);
- int cat2 = category(e2);
-
- if (cat1 != cat2)
- return cat1 - cat2;
-
- // cat1 == cat2
-
- String name1;
- String name2;
-
- if (viewer == null || !(viewer instanceof ContentViewer)) {
- name1 = e1.toString();
- name2 = e2.toString();
- } else {
- IBaseLabelProvider prov = ((ContentViewer) viewer).getLabelProvider();
- if (prov instanceof ILabelProvider) {
- ILabelProvider lprov = (ILabelProvider) prov;
- name1 = lprov.getText(e1);
- name2 = lprov.getText(e2);
- } else {
- name1 = e1.toString();
- name2 = e2.toString();
- }
- }
- if (name1 == null)
- name1 = "";//$NON-NLS-1$
- if (name2 == null)
- name2 = "";//$NON-NLS-1$
- return collator.compare(name1, name2);
-}
-/**
- * Returns the collator used to sort strings.
- *
- * @return the collator used to sort strings
- */
-public Collator getCollator() {
- return collator;
-}
-/**
- * Returns whether this viewer sorter would be affected
- * by a change to the given property of the given element.
- * <p>
- * The default implementation of this method returns <code>false</code>.
- * Subclasses may reimplement.
- * </p>
- *
- * @param element the element
- * @param property the property
- * @return <code>true</code> if the sorting would be affected,
- * and <code>false</code> if it would be unaffected
- */
-public boolean isSorterProperty(Object element, String property) {
- return false;
-}
-/**
- * Sorts the given elements in-place, modifying the given array.
- * <p>
- * The default implementation of this method uses the JDK 1.2
- * <code>Collections.sort</code> algorithm on the given array,
- * calling <code>compare</code> to compare elements.
- * </p>
- * <p>
- * Subclasses may reimplement this method to provide a more optimized implementation.
- * </p>
- *
- * @param viewer the viewer
- * @param elements the elements to sort
- */
-public void sort(final Viewer viewer, Object[] elements) {
- Arrays.sort(elements, new Comparator() {
- public int compare(Object a, Object b) {
- return ViewerSorter.this.compare(viewer, a, b);
- }
- });
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/package.html b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/package.html
deleted file mode 100644
index e156512..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/package.html
+++ /dev/null
@@ -1,70 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides a framework for viewers, which are model-based
-content adapters for SWT widgets.
-<h2>
-Package Specification</h2>
-A viewer is a model-based adapter on an SWT widget. Each viewer has
-four parts:
-<blockquote>
-<li>
-an <b>input</b> - the object that serves as the viewer's model</li>
-
-<li>
-a <b>widget</b> - the SWT control through which the viewer's model is displayed</li>
-
-<li>
-a <b>content provider</b> - mediates between the model and viewer</li>
-
-<li>
-a <b>label provider</b> - maps model objects to displayable labels containing
-text and/or an image</li>
-</blockquote>
-This package contains the viewer framework. The viewer framework is an
-independent JFace module. Using it requires a knowledge of SWT, but does
-not require familiarity with any of the other JFace modules. The framework
-consists of abstract base classes for viewers (<tt>Viewer</tt>, <tt>StructuredViewer</tt>,
-<tt>AbstractTreeViewer</tt>) together with concrete viewer classes (<tt>ListViewer</tt>,
-<tt>TreeViewer</tt>,
-<tt>TableViewer</tt>,
-<tt>TableTreeViewer</tt>, <tt>CheckboxTreeViewer</tt>,
-and <tt>CheckboxTableViewer</tt>),
-and various lesser support classes. The concrete structured viewer classes
-are ready-to-use and have built-in support for drag-and-drop, filtering
-(<tt>IViewerFilter</tt> and <tt>ViewerFilter</tt>), and sorting (<tt>IViewerSorter</tt>
-and <tt>ViewerSorter</tt>); these classes may also be subclassed further
-if required.
-<p>In general terms, creating a viewer involves the following steps:
-<ul>
-<li>
-instantiating a viewer on some pre-existing SWT widget,</li>
-
-<li>
-setting the viewer's content provider (an object implementing <tt>IContentProvider</tt>),</li>
-
-<li>
-setting the viewer's label provider (an object implementing
-<tt>ILabelProvider</tt>),</li>
-
-<li>
-and, finally, setting the viewer's input.</li>
-</ul>
-Once a viewer's input is set, the viewer becomes active. As the model changes,
-it is the content provider's responsibility to respond to changes to the
-model by telling the viewer what to change (done by calling add and remove
-methods on the viewer). An existing viewer may be retargeted by giving
-it a different object as input; the viewer is responsible for informing
-the content provider of these kinds of wholesale changes (<tt>IContentProvider.inputChanged</tt>).
-Also, each viewer registers with its label provider for notification of
-changes that would affect what the viewer displays (see <tt>ILabelProviderListener.stateChanged</tt>).
-<p>Note: None of the classes in this package maintain global state.
-<br>
-</body>
-</html>
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/window/Window.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/window/Window.java
deleted file mode 100644
index 1b09c12..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/window/Window.java
+++ /dev/null
@@ -1,654 +0,0 @@
-package org.eclipse.jface.window;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.GridLayout;
-
-/**
- * A JFace window is an object that has no visual representation (no widgets)
- * until it is told to open.
- * <p>
- * Creating a window involves the following steps:
- * <ul>
- * <li>creating an instance of a concrete subclass of <code>Window</code>
- * </li>
- * <li>creating the window's shell and widget tree by calling
- * <code>create</code> (optional)
- * </li>
- * <li>assigning the window to a window manager using
- * <code>WindowManager.add</code> (optional)
- * </li>
- * <li>opening the window by calling <code>open</code>
- * </li>
- * </ul>
- * Opening the window will create its shell and widget tree if they have not
- * already been created. When the window is closed, the shell and widget tree
- * are disposed of and are no longer referenced, and the window is automatically
- * removed from its window manager. A window may be reopened.
- * </p>
- * <p>
- * The JFace window framework (this package) consists of this class,
- * <code>Window</code>, the abstract base of all windows, and one concrete
- * window classes (<code>ApplicationWindow</code>) which may also be subclassed.
- * Clients may define additional window subclasses as required.
- * </p>
- * <p>
- * The <code>Window</code> class provides the following methods which subclasses
- * may override:
- * <ul>
- * <li><code>close</code> - extend to free other SWT resources</li>
- * <li><code>configureShell</code> - extend or reimplement to set shell
- * properties before window opens</li>
- * <li><code>createContents</code> - extend or reimplement to create
- * controls before window opens</li>
- * <li><code>getInitialSize</code> - reimplement to give the initial
- * size for the shell</li>
- * <li><code>getInitialLocation</code> - reimplement to give the initial
- * location for the shell</li>
- * <li><code>getShellListener</code> - extend or reimplement to receive
- * shell events</li>
- * <li><code>getToolTipText</code> - reimplement to add tool tips</li>
- * <li><code>handleFontChange</code> - reimplement to respond to font
- * changes</li>
- * <li><code>handleShellCloseEvent</code> - extend or reimplement to handle
- * shell closings</li>
- * </ul>
- * </p>
- */
-public abstract class Window {
-
- /**
- * Standard return code constant (value 0) indicating that the
- * window was opened.
- *
- * @see #open
- */
- public static final int OK = 0;
-
- /**
- * Standard return code constant (value 1) indicating that the
- * window was canceled.
- *
- * @see #open
- */
- public static final int CANCEL = 1;
-
- /**
- * Default title image, or <code>null</code> if none.
- *
- * @see #setDefaultImage
- */
- private static Image defaultImage;
- /**
- * This interface defines a Exception Handler which
- * can be set as a global handler and will be called
- * if an exception happens in the event loop.
- */
- public static interface IExceptionHandler {
- public void handleException(Throwable t);
- }
- /**
- * Defines a default exception handler.
- */
- private static class DefaultExceptionHandler implements IExceptionHandler {
- public void handleException(Throwable t) {
- if(t instanceof ThreadDeath)
- // Don't catch ThreadDeath as this is a normal occurrence when the thread dies
- throw (ThreadDeath)t;
- else
- // Try to keep running.
- t.printStackTrace();
- }
- }
- /**
- * The exception handler for this application.
- */
- private static IExceptionHandler exceptionHandler = new DefaultExceptionHandler();
-
- /**
- * The parent shell.
- */
- private Shell parentShell;
-
- /**
- * Shell style bits.
- *
- * @see #setShellStyle
- */
- private int shellStyle = SWT.SHELL_TRIM;
-
- /**
- * Window manager, or <code>null</code> if none.
- *
- * @see #setWindowManager
- */
- private WindowManager windowManager;
-
- /**
- * Window shell, or <code>null</code> if none.
- */
- private Shell shell;
-
- /**
- * Top level SWT control, or <code>null</code> if none
- */
- private Control contents;
-
- /**
- * Window return code; initially <code>OK</code>.
- *
- * @see #setReturnCode
- */
- private int returnCode = OK;
-
- /**
- * Last recorded window return code; initially <code>OK</code>.
- */
- private static int globalReturnCode = OK;
-
- /**
- * <code>true</code> if the <code>open</code> method should
- * not return until the window closes, and <code>false</code> if the
- * <code>open</code> method should return immediately;
- * initially <code>false</code> (non-blocking).
- *
- * @see #setBlockOnOpen
- */
- private boolean block = false;
-
- /**
- * Internal class for informing this window when fonts change.
- */
- private class FontChangeListener implements IPropertyChangeListener {
- public void propertyChange(PropertyChangeEvent event) {
- handleFontChange(event);
- }
- }
-
- /**
- * Internal font change listener.
- */
- private FontChangeListener fontChangeListener;
-
- /**
- * Internal fields to detect if shell size has been set
- */
- private boolean resizeHasOccurred = false;
- private Listener resizeListener;
-
-/**
- * Creates a window instance, whose shell will be created under the
- * given parent shell.
- * Note that the window will have no visual representation until it is told
- * to open. By default, <code>open</code> does not block.
- *
- * @param parentShell the parent shell, or <code>null</code> to create a top-level shell
- * @see #setBlockOnOpen
- */
-protected Window(Shell parentShell) {
- this.parentShell = parentShell;
-}
-/**
- * Closes this window, disposes its shell, and removes this
- * window from its window manager (if it has one).
- * <p>
- * This framework method may be extended (<code>super.close</code> must be
- * called).
- * </p>
- *
- * @return <code>true</code> if the window is (or was already) closed,
- * and <code>false</code> if it is still open
- */
-public boolean close() {
- if (shell == null || shell.isDisposed())
- return true;
-
- // stop listening for font changes
- if (fontChangeListener != null) {
- JFaceResources.getFontRegistry().removeListener(fontChangeListener);
- fontChangeListener = null;
- }
-
- // If we "close" the shell recursion will occur.
- // Instead, we need to "dispose" the shell to remove it from the display.
- shell.dispose();
- shell = null;
- contents = null;
-
- if (windowManager != null) {
- windowManager.remove(this);
- windowManager = null;
- }
- return true;
-}
-/**
- * Configures the given shell in preparation for opening this window
- * in it.
- * <p>
- * The default implementation of this framework method
- * sets the shell's image and gives it a grid layout.
- * Subclasses may extend or reimplement.
- * </p>
- *
- * @param newShell the shell
- */
-protected void configureShell(Shell newShell) {
-
- if (defaultImage != null) {
- newShell.setImage(defaultImage);
- }
-
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- newShell.setLayout(layout);
-}
-/**
- * Constrain the shell size to be no larger than the display bounds.
- *
- * @since 2.0
- */
-protected void constrainShellSize() {
- // limit the shell size to the display size
- Point size = shell.getSize();
- Rectangle bounds = shell.getDisplay().getClientArea();
- int newX = Math.min(size.x, bounds.width);
- int newY = Math.min(size.y, bounds.height);
- if (size.x != newX || size.y != newY)
- shell.setSize(newX, newY);
-}
-/**
- * Creates this window's widgetry in a new top-level shell.
- * <p>
- * The default implementation of this framework method
- * creates this window's shell (by calling <code>createShell</code>),
- * and its controls (by calling <code>createContents</code>),
- * then initializes this window's shell bounds
- * (by calling <code>initializeBounds</code>).
- * </p>
- */
-public void create() {
- shell = createShell();
- contents = createContents(shell);
-
- //initialize the bounds of the shell to that appropriate for the contents
- initializeBounds();
-}
-/**
- * Creates and returns this window's contents.
- * <p>
- * The default implementation of this framework method
- * creates an instance of <code>Composite</code>.
- * Subclasses may override.
- * </p>
- *
- * @return the control
- */
-protected Control createContents(Composite parent) {
- // by default, just create a composite
- return new Composite(parent, SWT.NONE);
-}
-/**
- * Creates and returns this window's shell.
- * <p>
- * The default implementation of this framework method creates
- * a new shell and configures it using <code/>configureShell</code>. Rather
- * than override this method, subclasses should instead override
- * <code/>configureShell</code>.
- * </p>
- *
- * @return the shell
- */
-protected final Shell createShell() {
-
- //Create the shell
- Shell newShell = new Shell(getParentShell(), getShellStyle());
-
- resizeListener = new Listener() {
- public void handleEvent(Event e) {
- resizeHasOccurred = true;
- }
- };
-
- newShell.addListener(SWT.Resize,resizeListener);
- newShell.setData(this);
-
- //Add a listener
- newShell.addShellListener(getShellListener());
-
- //Set the layout
- configureShell(newShell);
-
- //Register for font changes
- if (fontChangeListener == null) {
- fontChangeListener= new FontChangeListener();
- }
- JFaceResources.getFontRegistry().addListener(fontChangeListener);
-
- return newShell;
-}
-/**
- * Returns the top level control for this window.
- * The parent of this control is the shell.
- *
- * @return the top level control, or <code>null</code> if this window's
- * control has not been created yet
- */
-protected Control getContents() {
- return contents;
-}
-/**
- * Returns the default image. This is the image that will
- * be used for windows that have no shell image at the time they
- * are opened. There is no default image unless one is
- * installed via <code>setDefaultImage</code>.
- *
- * @return the default image, or <code>null</code> if none
- * @see #setDefaultImage
- */
-public static Image getDefaultImage() {
- return defaultImage;
-}
-/**
- * Returns the initial location to use for the shell.
- * The default implementation centers the shell horizontally
- * (1/2 of the difference to the left and 1/2 to the right)
- * and vertically (1/3 above and 2/3 below) relative to the parent shell,
- * or display bounds if there is no parent shell.
- *
- * @param initialSize the initial size of the shell, as returned by <code>getInitialSize</code>.
- * @return the initial location of the shell
- */
-protected Point getInitialLocation(Point initialSize) {
- Composite parentShell = shell.getParent();
- Rectangle containerBounds = (parentShell != null) ? parentShell.getBounds() : shell.getDisplay().getClientArea();
- int x = Math.max(0, containerBounds.x + (containerBounds.width - initialSize.x) / 2);
- int y = Math.max(0, containerBounds.y + (containerBounds.height - initialSize.y) / 3);
- return new Point(x, y);
-}
-/**
- * Returns the initial size to use for the shell.
- * The default implementation returns the preferred size of the shell,
- * using <code>Shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true)</code>.
- *
- * @return the initial size of the shell
- */
-protected Point getInitialSize() {
- return shell.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
-}
-/**
- * Returns parent shell, under which this window's shell is created.
- *
- * @return the parent shell, or <code>null</code> if there is no parent shell
- */
-protected Shell getParentShell() {
- return parentShell;
-}
-/**
- * Returns this window's return code.
- * A window's return codes are window-specific, although two standard
- * return codes are predefined: <code>OK</code> and <code>CANCEL</code>.
- *
- * @return the return code
- */
-public int getReturnCode() {
- return returnCode;
-}
-/**
- * Returns this window's shell.
- *
- * @return this window's shell, or <code>null</code> if this window's
- * shell has not been created yet
- */
-public Shell getShell() {
- return shell;
-}
-/**
- * Returns a shell listener. This shell listener gets registered
- * with this window's shell.
- * <p>
- * The default implementation of this framework method
- * returns a new listener that makes this window the
- * active window for its window manager (if it has one)
- * when the shell is activated, and calls the framework
- * method <code>handleShellCloseEvent</code> when the
- * shell is closed. Subclasses may extend or reimplement.
- * </p>
- *
- * @return a shell listener
- */
-protected ShellListener getShellListener() {
- return new ShellAdapter() {
- public void shellClosed(ShellEvent event) {
- event.doit= false; // don't close now
- handleShellCloseEvent();
- }
- };
-}
-/**
- * Returns the shell style bits.
- * <p>
- * The default value is <code>SWT.CLOSE|SWT.MIN|SWT.MAX|SWT.RESIZE</code>.
- * Subclassers should call <code>setShellStyle</code> to
- * change this value, rather than overriding this method.
- * </p>
- *
- * @return the shell style bits
- */
-protected int getShellStyle() {
- return shellStyle;
-}
-/**
- * Returns the window manager of this window.
- *
- * @return the WindowManager, or <code>null</code> if none
- */
-public WindowManager getWindowManager() {
- return windowManager;
-}
-/**
- * Notifies of a font property change.
- * <p>
- * The default implementation of this framework method
- * does nothing. Subclasses may reimplement.
- * </p>
- *
- * @param event the property change event detailing what changed
- */
-protected void handleFontChange(PropertyChangeEvent event) {
- // do nothing
-}
-/**
- * Notifies that the window's close button was pressed,
- * the close menu was selected, or the ESCAPE key pressed.
- * <p>
- * The default implementation of this framework method
- * sets the window's return code to <code>CANCEL</code>
- * and closes the window using <code>close</code>.
- * Subclasses may extend or reimplement.
- * </p>
- */
-protected void handleShellCloseEvent() {
- setReturnCode(CANCEL);
- close();
-}
-/**
- * Initializes the location and size of this window's SWT shell
- * after it has been created.
- * <p>
- * This framework method is called by the <code>create</code> framework method.
- * The default implementation calls <code>getInitialSize</code> and
- * <code>getInitialLocation</code> and passes the results to <code>Shell.setBounds</code>.
- * This is only done if the bounds of the shell have not already been modified.
- * Subclasses may extend or reimplement.
- * </p>
- */
-protected void initializeBounds() {
-
-
- if (resizeListener != null) {
- shell.removeListener(SWT.Resize,resizeListener);
- }
-
- if (resizeHasOccurred) { // Check if shell size has been set already.
- return;
- }
-
- Point size = getInitialSize();
- Point location = getInitialLocation(size);
-
- shell.setBounds(location.x, location.y, size.x, size.y);
-}
-/**
- * Opens this window, creating it first if it has not yet been created.
- * <p>
- * If this window has been configured to block on open
- * (<code>setBlockOnOpen</code>), this method waits until
- * the window is closed by the end user, and then it returns the window's
- * return code; otherwise, this method returns immediately.
- * A window's return codes are window-specific, although two standard
- * return codes are predefined: <code>OK</code> and <code>CANCEL</code>.
- * </p>
- *
- * @return the return code
- *
- * @see #create()
- */
-public int open() {
-
- if (shell == null) {
- // create the window
- create();
- }
-
- // limit the shell size to the display size
- constrainShellSize();
-
- // open the window
- shell.open();
-
- // run the event loop if specified
- if (block)
- runEventLoop(shell);
-
- return returnCode;
-}
-/**
- * Runs the event loop for the given shell.
- *
- * @param shell the shell
- */
-private void runEventLoop(Shell shell) {
-
- //Use the display provided by the shell if possible
- Display display;
- if(shell == null)
- display = Display.getCurrent();
- else
- display = shell.getDisplay();
-
- while (shell != null && ! shell.isDisposed()) {
- try {
- if (!display.readAndDispatch())
- display.sleep();
- } catch (Throwable e) {
- exceptionHandler.handleException(e);
- }
- }
- display.update();
-}
-/**
- * Sets whether the <code>open</code> method should block
- * until the window closes.
- *
- * @param shouldBlock <code>true</code> if the
- * <code>open</code> method should not return
- * until the window closes, and <code>false</code> if the
- * <code>open</code> method should return immediately
- */
-public void setBlockOnOpen(boolean shouldBlock) {
- block = shouldBlock;
-}
-/**
- * Sets the default image. This is the image that will
- * be used for windows that have no shell image at the time they
- * are opened. There is no default image unless one is
- * installed via this method.
- *
- * @param image the default image, or <code>null</code> if none
- */
-public static void setDefaultImage(Image image) {
- defaultImage= image;
-}
-/**
- * Sets this window's return code. The return code is automatically returned
- * by <code>open</code> if block on open is enabled. For non-blocking
- * opens, the return code needs to be retrieved manually using
- * <code>getReturnCode</code>.
- *
- * @param code the return code
- */
-protected void setReturnCode(int code) {
- returnCode = code;
- globalReturnCode = code;
-}
-/**
- * Sets the shell style bits.
- * This method has no effect after the shell is created.
- * <p>
- * The shell style bits are used by the framework method
- * <code>createShell</code> when creating this window's shell.
- * </p>
- *
- * @param newShellStyle the new shell style bits
- */
-protected void setShellStyle(int newShellStyle) {
- shellStyle = newShellStyle;
-}
-/**
- * Sets the window manager of this window.
- * <p>
- * Note that this method is used by <code>WindowManager</code> to maintain a
- * backpointer. Clients must not call the method directly.
- * </p>
- *
- * @param manager the window manager, or <code>null</code> if none
- */
-public void setWindowManager(WindowManager manager) {
- windowManager = manager;
-
- // Code to detect invalid usage
-
- if (manager != null) {
- Window[] windows = manager.getWindows();
- for (int i = 0; i < windows.length; i++) {
- if (windows[i] == this)
- return;
- }
- manager.add(this);
- }
-}
-/**
- * Sets the exception handler for this application.
- * <p>
- * Note that only one handler may be set. Other calls to this method will be ignored.
- * <p>
- * @param the exception handler for the application.
- */
-public static void setExceptionHandler(IExceptionHandler handler) {
- if(exceptionHandler instanceof DefaultExceptionHandler)
- exceptionHandler = handler;
-}
-
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/window/WindowManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/window/WindowManager.java
deleted file mode 100644
index 4736cd2..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/window/WindowManager.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.jface.window;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-import java.util.List; // to make unambiguous
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.util.Assert;
-
-/**
- * A manager for a group of windows. Window managers are an optional JFace
- * feature used in applications which create many different windows (dialogs,
- * wizards, etc.) in addition to a main window. A window manager can be used to
- * remember all the windows that an application has created (independent of
- * whether they are presently open or closed). There can be several window
- * managers, and they can be arranged into a tree. This kind of organization
- * makes it simple to close whole subgroupings of windows.
- * <p>
- * Creating a window manager is as simple as creating an instance of
- * <code>WindowManager</code>. Associating a window with a window manager is
- * done with <code>WindowManager.add(Window)</code>. A window is automatically
- * removed from its window manager as a side effect of closing the window.
- * </p>
- *
- * @see Window
- */
-public class WindowManager {
-
- /**
- * List of windows managed by this window manager
- * (element type: <code>Window</code>).
- */
- private ArrayList windows= new ArrayList();
-
-
- /**
- * Parent window manager, or <code>null</code> if none.
- */
- private WindowManager parentManager;
-
- /**
- * List of window managers who have this window manager
- * as their parent (element type: <code>WindowManager</code>).
- */
- private List subManagers;
-/**
- * Creates an empty window manager without a parent window
- * manager (that is, a root window manager).
- */
-public WindowManager() {
-}
-/**
- * Creates an empty window manager with the given
- * window manager as parent.
- *
- * @param parent the parent window manager
- */
-public WindowManager(WindowManager parent) {
- Assert.isNotNull(parent);
- parent.addWindowManager(this);
-}
-/**
- * Adds the given window to the set of windows managed by
- * this window manager. Does nothing is this window is
- * already managed by this window manager.
- *
- * @param window the window
- */
-public void add(Window window) {
- if (!windows.contains(window)) {
- windows.add(window);
- window.setWindowManager(this);
- }
-}
-/**
- * Adds the given window manager to the list of
- * window managers that have this one as a parent.
- * </p>
- * @param wm the child window manager
- */
-private void addWindowManager(WindowManager wm) {
- if (subManagers == null)
- subManagers = new ArrayList();
- if (!subManagers.contains(wm)) {
- subManagers.add(wm);
- wm.parentManager = this;
- }
-}
-/**
- * Attempts to close all windows managed by this window manager,
- * as well as windows managed by any descendent window managers.
- *
- * @return <code>true</code> if all windows were sucessfully closed,
- * and <code>false</code> if any window refused to close
- */
-public boolean close() {
- List t= (List) windows.clone(); // make iteration robust
- Iterator e= t.iterator();
- while (e.hasNext()) {
- Window window= (Window) e.next();
- boolean closed = window.close();
- if (!closed)
- return false;
- }
- if (subManagers != null) {
- e= subManagers.iterator();
- while (e.hasNext()) {
- WindowManager wm= (WindowManager)e.next();
- boolean closed = wm.close();
- if (!closed)
- return false;
- }
- }
- return true;
-}
-/**
- * Returns this window manager's set of windows.
- *
- * @return a possibly empty list of window
- */
-public Window[] getWindows() {
- Window bs[] = new Window[windows.size()];
- windows.toArray(bs);
- return bs;
-}
-/**
- * Removes the given window from the set of windows managed by
- * this window manager. Does nothing is this window is
- * not managed by this window manager.
- *
- * @param window the window
- */
-public final void remove(Window window) {
- if (windows.contains(window)) {
- windows.remove(window);
- window.setWindowManager(null);
- }
-}
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/window/package.html b/bundles/org.eclipse.jface/src/org/eclipse/jface/window/package.html
deleted file mode 100644
index 7667685..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/window/package.html
+++ /dev/null
@@ -1,31 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides a general framework for creating and managing
-windows.
-<h2>
-Package Specification</h2>
-A JFace window is an object that has no visual representation (no widgets)
-until it is told to open. All JFace windows, including dialogs, are instances
-of the abstract class <tt>Window</tt> or a subclass. This package contains
-the base window classes:
-<tt>Window</tt> itself, which provides support
-for a basic windows; and <tt>ApplicationWindow</tt>, which provides ready-to-use
-support for a high-level "main window" with standard menus, tool bar, and
-status line. Both of these classes may be subclassed to define additional
-types of window as required.
-<p>This package also contains <tt>WindowManager</tt>, instance of which
-are used for managing a group of windows. Window managers are useful in
-applications which create many different windows (dialogs, wizards, etc.)
-in addition to a main window. Window managers are not required for simple
-applications.
-<p>The only global state maintained by classes in this package is a default
-image for window title bars (<tt>Window.setDefaultImage</tt>).
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.views/.classpath b/bundles/org.eclipse.ui.views/.classpath
deleted file mode 100644
index bd0df32..0000000
--- a/bundles/org.eclipse.ui.views/.classpath
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="src" path="extensions"/>
- <classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry kind="src" path="/org.eclipse.help"/>
- <classpathentry kind="src" path="/org.eclipse.jface"/>
- <classpathentry kind="src" path="/org.eclipse.ui.workbench"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="src" path="/org.eclipse.core.boot"/>
- <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.ui.views/.cvsignore b/bundles/org.eclipse.ui.views/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- a/bundles/org.eclipse.ui.views/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.ui.views/.project b/bundles/org.eclipse.ui.views/.project
deleted file mode 100644
index 9d91d9c..0000000
--- a/bundles/org.eclipse.ui.views/.project
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.views</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.help</project>
- <project>org.eclipse.jface</project>
- <project>org.eclipse.ui.workbench</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.ui.views/build.properties b/bundles/org.eclipse.ui.views/build.properties
deleted file mode 100644
index 514616a..0000000
--- a/bundles/org.eclipse.ui.views/build.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-bin.includes = plugin.properties,\
- plugin.xml,\
- *.jar
-source.views.jar = extensions/,\
- src/
diff --git a/bundles/org.eclipse.ui.views/extensions/org/eclipse/ui/actions/AddTaskAction.java b/bundles/org.eclipse.ui.views/extensions/org/eclipse/ui/actions/AddTaskAction.java
deleted file mode 100644
index 7eefeb2..0000000
--- a/bundles/org.eclipse.ui.views/extensions/org/eclipse/ui/actions/AddTaskAction.java
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.views/plugin.properties b/bundles/org.eclipse.ui.views/plugin.properties
deleted file mode 100644
index ba8840f..0000000
--- a/bundles/org.eclipse.ui.views/plugin.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-pluginName= Views
-providerName= Eclipse.org
diff --git a/bundles/org.eclipse.ui.views/plugin.xml b/bundles/org.eclipse.ui.views/plugin.xml
deleted file mode 100644
index 20bef60..0000000
--- a/bundles/org.eclipse.ui.views/plugin.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.ui.views"
- name="%pluginName"
- version="2.1.0"
- provider-name="%providerName">
-
- <runtime>
- <library name="views.jar">
- <export name="*"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.help"/>
- <import plugin="org.eclipse.jface"/>
- <import plugin="org.eclipse.ui.workbench"/>
- </requires>
-
-
-</plugin>
diff --git a/bundles/org.eclipse.ui.views/scripts/exportplugin.xml b/bundles/org.eclipse.ui.views/scripts/exportplugin.xml
deleted file mode 100644
index 5e71e54..0000000
--- a/bundles/org.eclipse.ui.views/scripts/exportplugin.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<project name="Eclipse Views" default="export" basedir="..">
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="plugin" value="org.eclipse.ui.views" />
- <property name="version" value="_2.1.0" />
- <property name="dest" value="${destdir}/${plugin}${version}" />
- </target>
-
- <target name="build" depends="init">
- <eclipse.incrementalBuild project="${plugin}" kind="incr"/>
- </target>
-
- <target name="export" depends="build">
- <mkdir dir="${destdir}" />
- <delete dir="${dest}" />
- <mkdir dir="${dest}" />
- <jar
- jarfile="${dest}/views.jar"
- basedir="bin"
- />
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <zip zipfile="${dest}/viewssrc.zip">
- <fileset dir="src" />
- <fileset dir="extensions" />
- </zip>
- </target>
-</project>
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkAction.java
deleted file mode 100644
index 9e82500..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkAction.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.ui.views.bookmarkexplorer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.actions.SelectionProviderAction;
-import org.eclipse.jface.viewers.*;
-
-/**
- * An abstract class for all bookmark view actions.
- */
-/* package */ abstract class BookmarkAction extends SelectionProviderAction {
- private BookmarkNavigator view;
-/**
- * Creates a bookmark action.
- */
-protected BookmarkAction(BookmarkNavigator view, String label) {
- super(view.getViewer(), label);
- this.view = view;
-}
-/**
- * Returns the bookmarks view.
- */
-public BookmarkNavigator getView() {
- return view;
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkContentProvider.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkContentProvider.java
deleted file mode 100644
index 74ed2e5..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkContentProvider.java
+++ /dev/null
@@ -1,160 +0,0 @@
-package org.eclipse.ui.views.bookmarkexplorer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import java.util.*;
-
-/**
- * Task list content provider returns elements that should be
- * in the task list depending on the selection mode.
- * It goes directly to the marker manager and retreives
- * tasks and problems.
- */
-/* package */ class BookmarkContentProvider implements ITreeContentProvider,
- IResourceChangeListener, IBasicPropertyConstants
-{
- private BookmarkNavigator bookmarksView;
- private IResource input;
- private Viewer viewer;
-/**
- * The constructor.
- */
-public BookmarkContentProvider(BookmarkNavigator bookmarksView) {
- this.bookmarksView = bookmarksView;
-}
-/**
- * The visual part that is using this content provider is about
- * to be disposed. Deallocate all allocated SWT resources.
- */
-public void dispose() {
- IResource resource = (IResource) viewer.getInput();
- if (resource != null) {
- resource.getWorkspace().removeResourceChangeListener(this);
- }
-}
-/**
- * Returns all the bookmarks that should be shown for
- * the current settings.
- */
-Object[] getBookmarks(IResource resource) {
- try {
- return resource.findMarkers(IMarker.BOOKMARK, true, IResource.DEPTH_INFINITE);
- } catch (CoreException e) {
- return new Object[0];
- }
-}
-public Object[] getChildren(Object element) {
- // If the input element is a workbench return a list
- // of the existing bookmarks. Otherwise, return an empty list.
- if (element instanceof IResource)
- return getBookmarks((IResource) element);
- else
- return new Object[0];
-}
-public Object[] getElements(Object element) {
- return getChildren(element);
-}
-/**
- * Recursively walks over the resource delta and gathers all marker deltas. Marker
- * deltas are placed into one of the three given vectors depending on
- * the type of delta (add, remove, or change).
- */
-void getMarkerDeltas(IResourceDelta delta, List additions, List removals, List changes) {
- IMarkerDelta[] markerDeltas = delta.getMarkerDeltas();
- for (int i = 0; i < markerDeltas.length; i++) {
- IMarkerDelta markerDelta = markerDeltas[i];
- IMarker marker = markerDelta.getMarker();
- switch (markerDelta.getKind()) {
- case IResourceDelta.ADDED:
- if (markerDelta.isSubtypeOf(IMarker.BOOKMARK)) {
- additions.add(marker);
- }
- break;
- case IResourceDelta.REMOVED:
- if (markerDelta.isSubtypeOf(IMarker.BOOKMARK)) {
- removals.add(marker);
- }
- break;
- case IResourceDelta.CHANGED:
- if (markerDelta.isSubtypeOf(IMarker.BOOKMARK)) {
- changes.add(marker);
- }
- break;
- }
- }
-
- //recurse on child deltas
- IResourceDelta[] children = delta.getAffectedChildren();
- for (int i = 0; i < children.length; i++) {
- getMarkerDeltas(children[i], additions, removals, changes);
- }
-}
-/* (non-Javadoc)
- * Method declared on ITreeContentProvider,
- */
-public Object getParent(Object element) {
- return input;
-}
-/**
- * hasChildren method comment.
- */
-public boolean hasChildren(Object element) {
- if (element instanceof IWorkspace)
- return true;
- else
- return false;
-}
-public void inputChanged(Viewer newViewer, Object oldInput, Object newInput) {
- if (oldInput == null) {
- IResource resource = (IResource) newInput;
- resource.getWorkspace().addResourceChangeListener(this);
- }
- this.viewer = newViewer;
- this.input = (IResource) newInput;
-}
-/**
- * The workbench has changed. Process the delta and issue updates to the viewer,
- * inside the UI thread.
- *
- * @see IResourceChangeListener#resourceChanged
- */
-public void resourceChanged(final IResourceChangeEvent event) {
-
- // gather all marker changes from the delta.
- // be sure to do this in the calling thread,
- // as the delta is destroyed when this method returns
- final List additions = new ArrayList();
- final List removals = new ArrayList();
- final List changes = new ArrayList();
-
- IResourceDelta delta = event.getDelta();
- if(delta == null) return;
- getMarkerDeltas(delta, additions, removals, changes);
-
- // update the viewer based on the marker changes, in the UI thread
- if (additions.size() + removals.size() + changes.size() > 0) {
- viewer.getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- // This method runs inside an asyncExec. The widget may have been destroyed
- // by the time this is run. Check for this and do nothing if so.
- Control ctrl = viewer.getControl();
- if (ctrl == null || ctrl.isDisposed())
- return;
-
- // Be conservative for now, and refresh once if there are any changes.
- // Can improve once the following PRs are addressed:
- // 1G8OUTD: ITPCORE:ALL - Marker deltas should be composed
- // 1G8OU65: ITPCORE:ALL - IMarkerDelta.getType() doesn't allow subtype comparisons
- viewer.refresh();
- }
- });
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkLabelProvider.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkLabelProvider.java
deleted file mode 100644
index 6187ab0..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkLabelProvider.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.ui.views.bookmarkexplorer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.resource.*;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-import java.net.*;
-
-/**
- * Returns the label text and image for bookmarks in the bookmarks viewer.
- */
-/* package */ class BookmarkLabelProvider extends LabelProvider {
- private Image image;
-/**
- * BookmarkLabelProvider constructor comment.
- */
-public BookmarkLabelProvider(BookmarkNavigator view) {
- ImageDescriptor desc = view.getImageDescriptor("obj16/bkmrk_tsk.gif");//$NON-NLS-1$
- image = desc.createImage();
-}
-/* (non-Javadoc)
- * Method declared on LabelProvider.
- */
-public void dispose() {
- if (image != null) {
- image.dispose();
- image = null;
- }
-}
-/* (non-Javadoc)
- * Method declared on LabelProvider.
- */
-public Image getImage(Object element) {
- return image;
-}
-/* (non-Javadoc)
- * Method declared on LabelProvider.
- */
-public String getText(Object element) {
- IMarker marker = (IMarker) element;
- IResource resource = marker.getResource();
- IResource container = resource.getParent();
- String msg = marker.getAttribute(IMarker.MESSAGE, "");//$NON-NLS-1$
- if (container != null) {
- return BookmarkMessages.format("BookmarkLabel.textHasContainer", new Object[] {msg,resource.getName(),container.getFullPath().makeRelative()});//$NON-NLS-1$
- } else {
- return BookmarkMessages.format("BookmarkLabel.textNoContainer", new Object[] {msg,resource.getName()});//$NON-NLS-1$
- }
-}
-
-
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkMessages.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkMessages.java
deleted file mode 100644
index f6d4dad..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkMessages.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.ui.views.bookmarkexplorer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps managing messages
- */
-class BookmarkMessages {
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.views.bookmarkexplorer.messages";//$NON-NLS-1$
- private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
-private BookmarkMessages(){
- // prevent instantiation of class
-}
-/**
- * Returns the formatted message for the given key in
- * the resource bundle.
- *
- * @param key the resource name
- * @param args the message arguments
- * @return the string
- */
-public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key),args);
-}
-/**
- * Returns the resource object with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the key is returned.
- *
- * @param key the resource name
- * @return the string
- */
-public static String getString(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkNavigator.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkNavigator.java
deleted file mode 100644
index 5de03c1..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkNavigator.java
+++ /dev/null
@@ -1,347 +0,0 @@
-package org.eclipse.ui.views.bookmarkexplorer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.MarkerTransfer;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.views.navigator.ShowInNavigatorAction;
-
-/**
- * Main class for the bookmark navigator for displaying bookmarks on
- * resources and opening an editor on the bookmarked resource when the user
- * commands.
- * <p>
- * This standard view has id <code>"org.eclipse.ui.views.BookmarkNavigator"</code>.
- * </p>
- * <p>
- * The workbench will automatically instantiate this class when a bookmark
- * navigator is needed for a workbench window. This class is not intended
- * to be instantiated or subclassed by clients.
- * </p>
- */
-public class BookmarkNavigator extends ViewPart {
- private StructuredViewer viewer;
- private OpenBookmarkAction openAction;
- private CopyBookmarkAction copyAction;
- private RemoveBookmarkAction removeAction;
- private SelectAllAction selectAllAction;
- private ShowInNavigatorAction showInNavigatorAction;
- private IMemento memento;
-
- // Persistance tags.
- private static final String TAG_SELECTION = "selection"; //$NON-NLS-1$
- private static final String TAG_ID = "id";//$NON-NLS-1$
- private static final String TAG_MARKER = "marker";//$NON-NLS-1$
- private static final String TAG_RESOURCE = "resource";//$NON-NLS-1$
- private static final String TAG_VERTICAL_POSITION = "verticalPosition";//$NON-NLS-1$
- private static final String TAG_HORIZONTAL_POSITION = "horizontalPosition";//$NON-NLS-1$
-
-/**
- * Creates the bookmarks view.
- */
-public BookmarkNavigator() {
- super();
-}
-/**
- * Adds this views contributions to the workbench.
- */
-void addContributions() {
- // Create the actions.
- openAction = new OpenBookmarkAction(this);
- openAction.setHoverImageDescriptor(getImageDescriptor("clcl16/gotoobj_tsk.gif"));//$NON-NLS-1$
- openAction.setImageDescriptor(getImageDescriptor("elcl16/gotoobj_tsk.gif"));//$NON-NLS-1$
-
- copyAction = new CopyBookmarkAction(this);
- copyAction.setImageDescriptor(getImageDescriptor("ctool16/copy_edit.gif"));//$NON-NLS-1$
-
- removeAction = new RemoveBookmarkAction(this);
- removeAction.setHoverImageDescriptor(getImageDescriptor("clcl16/remtsk_tsk.gif"));//$NON-NLS-1$
- removeAction.setImageDescriptor(getImageDescriptor("elcl16/remtsk_tsk.gif"));//$NON-NLS-1$
- removeAction.setDisabledImageDescriptor(getImageDescriptor("dlcl16/remtsk_tsk.gif"));//$NON-NLS-1$
-
- selectAllAction = new SelectAllAction(this);
- showInNavigatorAction = new ShowInNavigatorAction(getViewSite().getPage(), viewer);
-
- // initializes action enabled state
- handleSelectionChanged(StructuredSelection.EMPTY);
-
- // Create dynamic menu mgr. Dynamic is currently required to
- // support action contributions.
- MenuManager mgr = new MenuManager();
- mgr.setRemoveAllWhenShown(true);
- mgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager mgr) {
- fillContextMenu(mgr);
- }
- });
- Menu menu = mgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- getSite().registerContextMenu(mgr, viewer);
-
- // Add actions to the local tool bar
- IToolBarManager tbm = getViewSite().getActionBars().getToolBarManager();
- tbm.add(removeAction);
- tbm.add(openAction);
- tbm.update(false);
-
- // Register with action service.
- IActionBars actionBars = getViewSite().getActionBars();
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.COPY, copyAction);
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.DELETE, removeAction);
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.SELECT_ALL, selectAllAction);
-
- // Set the double click action.
- viewer.addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- openAction.run();
- }
- });
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChanged((IStructuredSelection) event.getSelection());
- }
- });
- viewer.getControl().addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- handleKeyPressed(e);
- }
- });
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
-public void createPartControl(Composite parent) {
- viewer = new TreeViewer(new Tree(parent, SWT.MULTI));
- viewer.setContentProvider(new BookmarkContentProvider(this));
- viewer.setLabelProvider(new BookmarkLabelProvider(this));
- viewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
- addContributions();
- initDragAndDrop();
-
- if(memento != null) restoreState(memento);
- memento = null;
-
- WorkbenchHelp.setHelp(viewer.getControl(), IBookmarkHelpContextIds.BOOKMARK_VIEW);
-}
-/**
- * Notifies this listener that the menu is about to be shown by
- * the given menu manager.
- *
- * @param manager the menu manager
- */
-void fillContextMenu(IMenuManager manager) {
- manager.add(openAction);
- manager.add(copyAction);
- manager.add(removeAction);
- manager.add(selectAllAction);
- manager.add(showInNavigatorAction);
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-}
-/**
- * Returns the image descriptor with the given relative path.
- */
-ImageDescriptor getImageDescriptor(String relativePath) {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- URL installURL = getPlugin().getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + relativePath);
- return ImageDescriptor.createFromURL(url);
- }
- catch (MalformedURLException e) {
- Assert.isTrue(false);
- return null;
- }
-}
-/**
- * Returns the UI plugin for the bookmarks view.
- */
-static AbstractUIPlugin getPlugin() {
- return (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
-}
-/**
- * Returns the shell.
- */
-Shell getShell() {
- return getViewSite().getShell();
-}
-/**
- * Returns the viewer used to display bookmarks.
- *
- * @return the viewer, or <code>null</code> if this view's controls
- * have not been created yet
- */
-StructuredViewer getViewer() {
- return viewer;
-}
-/**
- * Returns the workspace.
- */
-IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
-}
-/**
- * Handles key events in viewer.
- */
-void handleKeyPressed(KeyEvent event) {
- if (event.character == SWT.DEL && event.stateMask == 0
- && removeAction.isEnabled())
- removeAction.run();
-}
-/**
- * Handles a selection change.
- *
- * @param selection the new selection
- */
-void handleSelectionChanged(IStructuredSelection selection) {
- //update the actions
- openAction.selectionChanged(selection);
- removeAction.selectionChanged(selection);
- selectAllAction.selectionChanged(selection);
- showInNavigatorAction.selectionChanged(selection);
-}
-/* (non-Javadoc)
- * Method declared on IViewPart.
- */
-public void init(IViewSite site,IMemento memento) throws PartInitException {
- super.init(site,memento);
- this.memento = memento;
-}
-/**
- * Adds drag and drop support to the bookmark navigator.
- */
-protected void initDragAndDrop() {
- int operations = DND.DROP_COPY;
- Transfer[] transferTypes = new Transfer[]{
- MarkerTransfer.getInstance(),
- TextTransfer.getInstance()};
- DragSourceListener listener = new DragSourceAdapter() {
- public void dragSetData(DragSourceEvent event){
- performDragSetData(event);
- }
- public void dragFinished(DragSourceEvent event){
- }
- };
- viewer.addDragSupport(operations, transferTypes, listener);
-}
-/**
- * The user is attempting to drag marker data. Add the appropriate
- * data to the event depending on the transfer type.
- */
-void performDragSetData(DragSourceEvent event) {
- if (MarkerTransfer.getInstance().isSupportedType(event.dataType)) {
- event.data = ((IStructuredSelection) viewer.getSelection()).toArray();
- return;
- }
- if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
- Object[] markers = ((IStructuredSelection) viewer.getSelection()).toArray();
- if (markers != null) {
- StringBuffer buffer = new StringBuffer();
- ILabelProvider provider = (ILabelProvider)getViewer().getLabelProvider();
- for (int i = 0; i < markers.length; i++) {
- if (i > 0)
- buffer.append(System.getProperty("line.separator")); //$NON-NLS-1$
- buffer.append(provider.getText((IMarker)markers[i]));
- }
- event.data = buffer.toString();
- }
- return;
- }
-}
-void restoreState(IMemento memento) {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IMemento selectionMem = memento.getChild(TAG_SELECTION);
- if(selectionMem != null) {
- ArrayList selectionList = new ArrayList();
- IMemento markerMems[] = selectionMem.getChildren(TAG_MARKER);
- for (int i = 0; i < markerMems.length; i++){
- try {
- long id = new Long(markerMems[i].getString(TAG_ID)).longValue();
- IResource resource = root.findMember(markerMems[i].getString(TAG_RESOURCE));
- if(resource != null) {
- IMarker marker = resource.findMarker(id);
- if(marker != null)
- selectionList.add(marker);
- }
- } catch (CoreException e) {}
- }
- viewer.setSelection(new StructuredSelection(selectionList));
- }
-
- Scrollable scrollable = (Scrollable)viewer.getControl();
- //save vertical position
- ScrollBar bar = scrollable.getVerticalBar();
- if (bar != null) {
- try {
- String posStr = memento.getString(TAG_VERTICAL_POSITION);
- int position;
- position = new Integer(posStr).intValue();
- bar.setSelection(position);
- } catch (NumberFormatException e){}
- }
- bar = scrollable.getHorizontalBar();
- if (bar != null) {
- try {
- String posStr = memento.getString(TAG_HORIZONTAL_POSITION);
- int position;
- position = new Integer(posStr).intValue();
- bar.setSelection(position);
- } catch (NumberFormatException e){}
- }
-}
-public void saveState(IMemento memento) {
- if(viewer == null) {
- if(this.memento != null) //Keep the old state;
- memento.putMemento(this.memento);
- return;
- }
-
- Scrollable scrollable = (Scrollable)viewer.getControl();
- Object markers[] = ((IStructuredSelection)viewer.getSelection()).toArray();
- if(markers.length > 0) {
- IMemento selectionMem = memento.createChild(TAG_SELECTION);
- for (int i = 0; i < markers.length; i++) {
- IMemento elementMem = selectionMem.createChild(TAG_MARKER);
- IMarker marker = (IMarker)markers[i];
- elementMem.putString(TAG_RESOURCE,marker.getResource().getFullPath().toString());
- elementMem.putString(TAG_ID,String.valueOf(marker.getId()));
- }
- }
-
- //save vertical position
- ScrollBar bar = scrollable.getVerticalBar();
- int position = bar != null ? bar.getSelection():0;
- memento.putString(TAG_VERTICAL_POSITION,String.valueOf(position));
- //save horizontal position
- bar = scrollable.getHorizontalBar();
- position = bar != null ? bar.getSelection():0;
- memento.putString(TAG_HORIZONTAL_POSITION,String.valueOf(position));
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
-public void setFocus() {
- if (viewer != null)
- viewer.getControl().setFocus();
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/CopyBookmarkAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/CopyBookmarkAction.java
deleted file mode 100644
index f4d2259..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/CopyBookmarkAction.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.ui.views.bookmarkexplorer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.part.MarkerTransfer;
-
-
-/**
- * Copies a task to the clipboard.
- */
-/*package*/ class CopyBookmarkAction extends BookmarkAction {
- /**
- * System clipboard
- */
- private Clipboard clipboard;
-
- /**
- * Creates the action.
- */
- public CopyBookmarkAction(BookmarkNavigator bookmarkNavigator) {
- super(bookmarkNavigator, BookmarkMessages.getString("CopyBookmark.text")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IBookmarkHelpContextIds.COPY_BOOKMARK_ACTION);
- setEnabled(false);
- clipboard = new Clipboard(Display.getCurrent());
- }
-
- /**
- * Performs this action.
- */
- public void run() {
- // Get the selected markers
- BookmarkNavigator bookmarkNavigator = getView();
- StructuredViewer viewer = bookmarkNavigator.getViewer();
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- if (selection.isEmpty()) {
- return;
- }
- List list = selection.toList();
- IMarker[] markers = new IMarker[list.size()];
- list.toArray(markers);
-
- // Place the markers on the clipboard
- StringBuffer buffer = new StringBuffer();
- ILabelProvider provider = (ILabelProvider)bookmarkNavigator.getViewer().getLabelProvider();
- for (int i = 0; i < markers.length; i++) {
- if (i > 0)
- buffer.append(System.getProperty("line.separator")); //$NON-NLS-1$
- buffer.append(provider.getText(markers[i]));
- }
-
- setClipboard(markers, buffer.toString());
- }
-
- /**
- * Updates enablement based on the current selection
- */
- public void selectionChanged(IStructuredSelection sel) {
- setEnabled(!sel.isEmpty());
- }
-
- private void setClipboard(IMarker[] markers, String markerReport) {
- try {
- // Place the markers on the clipboard
- Object[] data = new Object[] {
- markers,
- markerReport};
- Transfer[] transferTypes = new Transfer[] {
- MarkerTransfer.getInstance(),
- TextTransfer.getInstance()};
-
- // set the clipboard contents
- clipboard.setContents(data, transferTypes);
- } catch (SWTError e){
- if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
- throw e;
- if (MessageDialog.openQuestion(getView().getShell(), WorkbenchMessages.getString("CopyToClipboardProblemDialog.title"), WorkbenchMessages.getString("CopyToClipboardProblemDialog.message"))) //$NON-NLS-1$ //$NON-NLS-2$
- setClipboard(markers, markerReport);
- }
- }
-}
-
-
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/IBookmarkHelpContextIds.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/IBookmarkHelpContextIds.java
deleted file mode 100644
index f844d86..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/IBookmarkHelpContextIds.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.ui.views.bookmarkexplorer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Help context ids for the bookmark view.
- * <p>
- * This interface contains constants only; it is not intended to be implemented
- * or extended.
- * </p>
- *
- */
-/*package*/ interface IBookmarkHelpContextIds {
- public static final String PREFIX = PlatformUI.PLUGIN_ID + "."; //$NON-NLS-1$
-
- // Actions
- public static final String COPY_BOOKMARK_ACTION = PREFIX + "copy_bookmark_action_context"; //$NON-NLS-1$
- public static final String REMOVE_BOOKMARK_ACTION = PREFIX + "remove_bookmark_action_context"; //$NON-NLS-1$
- public static final String OPEN_BOOKMARK_ACTION = PREFIX + "open_bookmark_action_context"; //$NON-NLS-1$
- public static final String SELECT_ALL_BOOKMARK_ACTION = PREFIX + "select_all_bookmark_action_context"; //$NON-NLS-1$
-
- // Views
- public static final String BOOKMARK_VIEW = PREFIX + "bookmark_view_context"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/OpenBookmarkAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/OpenBookmarkAction.java
deleted file mode 100644
index 9909c15..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/OpenBookmarkAction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.ui.views.bookmarkexplorer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.OpenStrategy;
-import org.eclipse.jface.viewers.*;
-
-import java.util.*;
-
-/**
- * Action to open an editor on the selected bookmarks.
- */
-/* package */ class OpenBookmarkAction extends BookmarkAction {
-public OpenBookmarkAction(BookmarkNavigator view) {
- super(view, BookmarkMessages.getString("OpenBookmark.text")); //$NON-NLS-1$
- setToolTipText(BookmarkMessages.getString("OpenBookmark.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IBookmarkHelpContextIds.OPEN_BOOKMARK_ACTION);
- setEnabled(false);
-}
-public void run() {
- IWorkbenchPage page = getView().getSite().getPage();
- for (Iterator i = getStructuredSelection().iterator(); i.hasNext();) {
- IMarker marker = (IMarker) i.next();
- try {
- page.openEditor(marker,OpenStrategy.activateOnOpen());
- } catch (PartInitException e) {
- // Open an error style dialog for PartInitException by
- // including any extra information from the nested
- // CoreException if present.
-
- // Check for a nested CoreException
- CoreException nestedException = null;
- IStatus status = e.getStatus();
- if (status != null && status.getException() instanceof CoreException)
- nestedException = (CoreException)status.getException();
-
- if (nestedException != null) {
- // Open an error dialog and include the extra
- // status information from the nested CoreException
- ErrorDialog.openError(
- getView().getShell(),
- BookmarkMessages.getString("OpenBookmark.errorTitle"), //$NON-NLS-1$
- e.getMessage(),
- nestedException.getStatus());
- } else {
- // Open a regular error dialog since there is no
- // extra information to display
- MessageDialog.openError(
- getView().getShell(),
- BookmarkMessages.getString("OpenBookmark.errorTitle"), //$NON-NLS-1$
- e.getMessage());
- }
- }
- }
-}
-public void selectionChanged(IStructuredSelection sel) {
- setEnabled(!sel.isEmpty());
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/RemoveBookmarkAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/RemoveBookmarkAction.java
deleted file mode 100644
index 42e440a..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/RemoveBookmarkAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.ui.views.bookmarkexplorer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.help.*;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.*;
-import java.util.*;
-
-/**
- * Action to remove the selected bookmarks.
- */
-/* package */ class RemoveBookmarkAction extends BookmarkAction {
-public RemoveBookmarkAction(BookmarkNavigator view) {
- super(view, BookmarkMessages.getString("RemoveBookmark.text")); //$NON-NLS-1$
- setToolTipText(BookmarkMessages.getString("RemoveBookmark.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IBookmarkHelpContextIds.REMOVE_BOOKMARK_ACTION);
- setEnabled(false);
-}
-/**
- * Delete the marker selection.
- */
-public void run() {
- final IStructuredSelection sel = getStructuredSelection();
- if (sel.isEmpty())
- return;
- try {
- getView().getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (Iterator iter = sel.iterator(); iter.hasNext();) {
- Object o = iter.next();
- if (o instanceof IMarker) {
- IMarker marker = (IMarker) o;
- marker.delete();
- }
- }
- }
- }, null);
- } catch (CoreException e) {
- ErrorDialog.openError(getView().getShell(), BookmarkMessages.getString("RemoveBookmark.errorTitle"), null, e.getStatus()); //$NON-NLS-1$
- }
-}
-public void selectionChanged(IStructuredSelection sel) {
- setEnabled(!sel.isEmpty());
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/SelectAllAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/SelectAllAction.java
deleted file mode 100644
index 8eb8ff9..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/SelectAllAction.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.ui.views.bookmarkexplorer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Action to select all bookmarks.
- */
-/* package */ class SelectAllAction extends BookmarkAction {
-public SelectAllAction(BookmarkNavigator view) {
- super(view, BookmarkMessages.getString("SelectAll.text")); //$NON-NLS-1$
- setToolTipText(BookmarkMessages.getString("SelectAll.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IBookmarkHelpContextIds.SELECT_ALL_BOOKMARK_ACTION);
- setEnabled(true);
-}
-public void run() {
- Viewer viewer = getView().getViewer();
- Control control = viewer.getControl();
- if (control instanceof Tree) {
- ((Tree) control).selectAll();
- viewer.setSelection(viewer.getSelection(), false);
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/messages.properties b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/messages.properties
deleted file mode 100644
index 69dad58..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/messages.properties
+++ /dev/null
@@ -1,26 +0,0 @@
-# ==============================================================================
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-# ==============================================================================
-
-# package: org.eclipse.ui.views.bookmarkexplorer
-
-
-# ==============================================================================
-# Bookmarks View
-# ==============================================================================
-BookmarkLabel.textHasContainer = {0} (on {1} in {2})
-BookmarkLabel.textNoContainer = {0} (on {1})
-
-CopyBookmark.text = &Copy
-
-OpenBookmark.text = &Go To
-OpenBookmark.toolTip = Go To
-OpenBookmark.errorTitle = Problems Opening Editor
-
-RemoveBookmark.text = &Delete
-RemoveBookmark.toolTip = Delete
-RemoveBookmark.errorTitle = Error deleting bookmarks
-
-SelectAll.text = Select A&ll
-SelectAll.toolTip = Select All
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/package.html b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/package.html
deleted file mode 100644
index 9d24b87..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/package.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides the standard Bookmarks view which displays
-bookmarks on resources.
-<br>
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutline.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutline.java
deleted file mode 100644
index 22e2bed..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutline.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package org.eclipse.ui.views.contentoutline;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Main class for the Content Outline View.
- * <p>
- * This standard view has id <code>"org.eclipse.ui.views.ContentOutline"</code>.
- * </p>
- * When a <b>content outline view</b> notices an editor being activated, it
- * asks the editor whether it has a <b>content outline page</b> to include
- * in the outline view. This is done using <code>getAdapter</code>:
- * <pre>
- * IEditorPart editor = ...;
- * IContentOutlinePage outlinePage = (IContentOutlinePage) editor.getAdapter(IContentOutlinePage.class);
- * if (outlinePage != null) {
- * // editor wishes to contribute outlinePage to content outline view
- * }
- * </pre>
- * If the editor supports a content outline page, the editor instantiates
- * and configures the page, and returns it. This page is then added to the
- * content outline view (a pagebook which presents one page at a time) and
- * immediately made the current page (the content outline view need not be
- * visible). If the editor does not support a content outline page, the content
- * outline view shows a special default page which makes it clear to the user
- * that the content outline view is disengaged. A content outline page is free
- * to report selection events; the content outline view forwards these events
- * along to interested parties. When the content outline view notices a
- * different editor being activated, it flips to the editor's corresponding
- * content outline page. When the content outline view notices an editor being
- * closed, it destroys the editor's corresponding content outline page.
- * </p>
- * <p>
- * The workbench will automatically instantiate this class when a Content
- * Outline view is needed for a workbench window. This class was not intended
- * to be instantiated or subclassed by clients.
- * </p>
- */
-public class ContentOutline extends PageBookView implements ISelectionProvider, ISelectionChangedListener {
-
- private static java.util.ResourceBundle resoutline_nls = java.util.ResourceBundle.getBundle("org.eclipse.ui.views.contentoutline.messages"); //$NON-NLS-1$
- public static final String PREFIX = PlatformUI.PLUGIN_ID + "."; //$NON-NLS-1$
-
- /**
- * Help context id used for the content outline view
- * (value <code>"org.eclipse.ui.content_outline_context"</code>).
- */
- public static final String CONTENT_OUTLINE_VIEW_HELP_CONTEXT_ID = PREFIX + "content_outline_context";//$NON-NLS-1$
-
- /**
- * Message to show on the default page.
- */
- private String defaultText = resoutline_nls.getString("ContentOutline.noOutline"); //$NON-NLS-1$
-
-/**
- * Creates a content outline view with no content outline pages.
- */
-public ContentOutline() {
- super();
-}
-/* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
-public void addSelectionChangedListener(ISelectionChangedListener listener) {
- getSelectionProvider().addSelectionChangedListener(listener);
-}
-/* (non-Javadoc)
- * Method declared on PageBookView.
- */
-protected IPage createDefaultPage(PageBook book) {
- MessagePage page = new MessagePage();
- initPage(page);
- page.createControl(book);
- page.setMessage(defaultText);
- return page;
-}
-/**
- * The <code>PageBookView</code> implementation of this <code>IWorkbenchPart</code>
- * method creates a <code>PageBook</code> control with its default page showing.
- */
-public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- WorkbenchHelp.setHelp(getPageBook(), CONTENT_OUTLINE_VIEW_HELP_CONTEXT_ID);
-}
-/* (non-Javadoc)
- * Method declared on PageBookView.
- */
-protected PageRec doCreatePage(IWorkbenchPart part)
-{
- // Try to get an outline page.
- Object obj = part.getAdapter(IContentOutlinePage.class);
- if (obj instanceof IContentOutlinePage) {
- IContentOutlinePage page = (IContentOutlinePage)obj;
- if (page instanceof IPageBookViewPage)
- initPage((IPageBookViewPage)page);
- page.createControl(getPageBook());
- return new PageRec(part, page);
- }
- // There is no content outline
- return null;
-}
-/* (non-Javadoc)
- * Method declared on PageBookView.
- */
-protected void doDestroyPage(IWorkbenchPart part, PageRec rec) {
- IContentOutlinePage page = (IContentOutlinePage) rec.page;
- page.dispose();
- rec.dispose();
-}
-/* (non-Javadoc)
- * Method declared on IAdaptable.
- */
-public Object getAdapter(Class key) {
- if (key == IContributedContentsView.class)
- return new IContributedContentsView () {
- public IWorkbenchPart getContributingPart() {
- return getContributingEditor();
- }
- };
- return null;
-}
-/* (non-Javadoc)
- * Method declared on PageBookView.
- */
-protected IWorkbenchPart getBootstrapPart() {
- IWorkbenchPage page = getSite().getPage();
- if (page != null)
- return page.getActiveEditor();
- else
- return null;
-}
-/**
- * Returns the editor which contributed the current
- * page to this view.
- *
- * @return the editor which contributed the current page
- * or <code>null</code> if no editor contributed the current page
- */
-private IWorkbenchPart getContributingEditor() {
- return getCurrentContributingPart();
-}
-/* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
-public ISelection getSelection() {
- // get the selection from the selection provider
- return getSelectionProvider().getSelection();
-}
-/* (non-Javadoc)
- * Method declared on PageBookView.
- * We only want to track editors.
- */
-protected boolean isImportant(IWorkbenchPart part) {
- //We only care about editors
- return (part instanceof IEditorPart);
-}
-/* (non-Javadoc)
- * Method declared on IViewPart.
- * Treat this the same as part activation.
- */
-public void partBroughtToTop(IWorkbenchPart part) {
- partActivated(part);
-}
-/* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
-public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- getSelectionProvider().removeSelectionChangedListener(listener);
-}
-/* (non-Javadoc)
- * Method declared on ISelectionChangedListener.
- */
-public void selectionChanged(SelectionChangedEvent event) {
- getSelectionProvider().selectionChanged(event);
-}
-/* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
-public void setSelection(ISelection selection) {
- getSelectionProvider().setSelection(selection);
-}
-/**
- * The <code>ContentOutline</code> implementation of this <code>PageBookView</code> method
- * extends the behavior of its parent to use the current page as a selection provider.
- *
- * @param pageRec the page record containing the page to show
- */
-protected void showPageRec(PageRec pageRec) {
- IPageSite pageSite = getPageSite(pageRec.page);
- ISelectionProvider provider = pageSite.getSelectionProvider();
- if (provider == null && (pageRec.page instanceof IContentOutlinePage))
- // This means that the page did not set a provider during its initialization
- // so for backward compatibility we will set the page itself as the provider.
- pageSite.setSelectionProvider((IContentOutlinePage)pageRec.page);
- super.showPageRec(pageRec);
-}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutlinePage.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutlinePage.java
deleted file mode 100644
index cf806e0..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutlinePage.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.eclipse.ui.views.contentoutline;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.part.Page;
-
-/**
- * An abstract base class for content outline pages.
- * <p>
- * Clients who are defining an editor may elect to provide a corresponding
- * content outline page. This content outline page will be presented to the
- * user via the standard Content Outline View (the user decides whether their
- * workbench window contains this view) whenever that editor is active.
- * This class should be subclassed.
- * </p>
- * <p>
- * Internally, each content outline page consists of a standard tree viewer;
- * selections made in the tree viewer are reported as selection change events
- * by the page (which is a selection provider). The tree viewer is not created
- * until <code>createPage</code> is called; consequently, subclasses must extend
- * <code>createControl</code> to configure the tree viewer with a proper content
- * provider, label provider, and input element.
- * </p>
- * <p>
- * Note that those wanting to use a control other than internally created
- * <code>TreeViewer</code> will need to implement
- * <code>IContentOutlinePage</code> directly rather than subclassing this class.
- * </p>
- */
-public abstract class ContentOutlinePage extends Page implements IContentOutlinePage, ISelectionChangedListener {
- private ListenerList selectionChangedListeners = new ListenerList();
- private TreeViewer treeViewer;
-/**
- * Create a new content outline page.
- */
-protected ContentOutlinePage() {
- super();
-}
-/* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
-public void addSelectionChangedListener(ISelectionChangedListener listener) {
- selectionChangedListeners.add(listener);
-}
-/**
- * The <code>ContentOutlinePage</code> implementation of this
- * <code>IContentOutlinePage</code> method creates a tree viewer. Subclasses
- * must extend this method configure the tree viewer with a proper content
- * provider, label provider, and input element.
- */
-public void createControl(Composite parent) {
- treeViewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- treeViewer.addSelectionChangedListener(this);
-}
-/**
- * Fires a selection changed event.
- *
- * @param selction the new selection
- */
-protected void fireSelectionChanged(ISelection selection) {
- // create an event
- SelectionChangedEvent event = new SelectionChangedEvent(this, selection);
-
- // fire the event
- Object[] listeners = selectionChangedListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ISelectionChangedListener) listeners[i]).selectionChanged(event);
- }
-}
-/* (non-Javadoc)
- * Method declared on IPage (and Page).
- */
-public Control getControl() {
- if (treeViewer == null)
- return null;
- return treeViewer.getControl();
-}
-/* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
-public ISelection getSelection() {
- if (treeViewer == null)
- return StructuredSelection.EMPTY;
- return treeViewer.getSelection();
-}
-/**
- * Returns this page's tree viewer.
- *
- * @return this page's tree viewer, or <code>null</code> if
- * <code>createControl</code> has not been called yet
- */
-protected TreeViewer getTreeViewer() {
- return treeViewer;
-}
-/**
- * The <code>ContentOutlinePage</code> implementation of this
- * <code>IPageBookViewPage</code> method registers itself as a selection
- * provider with the site.
- */
-public void init(IPageSite pageSite) {
- super.init(pageSite);
- pageSite.setSelectionProvider(this);
-}
-/* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
-public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- selectionChangedListeners.remove(listener);
-}
-/* (non-Javadoc)
- * Method declared on ISelectionChangeListener.
- * Gives notification that the tree selection has changed.
- */
-public void selectionChanged(SelectionChangedEvent event) {
- fireSelectionChanged(event.getSelection());
-}
-/**
- * Sets focus to a part in the page.
- */
-public void setFocus() {
- treeViewer.getControl().setFocus();
-}
-/* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
-public void setSelection(ISelection selection) {
- if (treeViewer != null)
- treeViewer.setSelection(selection);
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/IContentOutlinePage.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/IContentOutlinePage.java
deleted file mode 100644
index 5377f9d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/IContentOutlinePage.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.ui.views.contentoutline;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.part.IPage;
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-/**
- * Marker-style interface for a content outline page. This interface defines
- * the minimum requirement for pages within the content outline view, namely
- * they must be pages (implement <code>IPage</code>) and provide selections
- * (implement <code>ISelectionProvider</code>).
- * <p>
- * Access to a content outline page begins when an editor is activated. When
- * activation occurs, the content outline view will ask the editor for its
- * content outline page. This is done by invoking
- * <code>getAdapter(IContentOutlinePage.class)</code> on the editor.
- * If the editor returns a page, the view then creates the controls for that
- * page (using <code>createControl</code>) and makes the page visible.
- * </p>
- * <p>
- * Clients may implement this interface from scratch, or subclass the
- * abstract base class <code>ContentOutlinePage</code>.
- * </p>
- * <p>
- * Note that this interface extents <code>ISelectionProvider</code>.
- * This is no longer required in the case of implementors who also
- * implement <code>IPageBookViewPage</code> (or extend <code>Page</code>)
- * as they are now passed an <code>IPageSite</code> during their initialization
- * and this site can be configured with a selection provider.
- * However to avoid a breaking change
- * 1) this interface will continue to extend ISelectionProvider
- * 2) if an IContentOutlinePage does not set a selection provider for its
- * site, the ContentOutline will continue to use the page itself for
- * this purpose.
- * </p>
- *
- * @see ContentOutlinePage
- */
-public interface IContentOutlinePage extends IPage, ISelectionProvider {
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/messages.properties b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/messages.properties
deleted file mode 100644
index 0540824..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/messages.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-# ==============================================================================
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-# ==============================================================================
-
-# package: org.eclipse.ui.views.contentoutline
-
-
-# ==============================================================================
-# Outline View
-# ==============================================================================
-ContentOutline.noOutline = An outline is not available.
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/package.html b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/package.html
deleted file mode 100644
index 70d2165..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/package.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides the standard Content Outline view which can
-show the active editor's custom outline for the document being edited.
-<br>
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/BackAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/BackAction.java
deleted file mode 100644
index 410af39..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/BackAction.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.ui.views.framelist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Generic "Back" action which goes back one frame,
- */
-public class BackAction extends FrameAction {
-
- /**
- * Constructs a new action for the specified frame list.
- *
- * @param frameList the frame list
- */
- public BackAction(FrameList frameList) {
- super(frameList);
- setText(FrameListMessages.getString("Back.text")); //$NON-NLS-1$
- setHoverImageDescriptor(getImageDescriptor("clcl16/backward_nav.gif")); //$NON-NLS-1$
- setImageDescriptor(getImageDescriptor("elcl16/backward_nav.gif")); //$NON-NLS-1$
- setDisabledImageDescriptor(getImageDescriptor("dlcl16/backward_nav.gif")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IFrameListHelpContextIds.BACK_ACTION);
- update();
- }
-
- private Frame getPreviousFrame() {
- FrameList list = getFrameList();
- return list.getFrame(list.getCurrentIndex() - 1);
- }
-
- private String getToolTipText(Frame previousFrame) {
- if (previousFrame != null) {
- String text = previousFrame.getToolTipText();
- if (text != null && text.length() > 0) {
- return FrameListMessages.format("Back.toolTipOneArg", new Object[] { text }); //$NON-NLS-1$
- }
- }
- return FrameListMessages.getString("Back.toolTip"); //$NON-NLS-1$
- }
-
- /**
- * Calls <code>back()</code> on the frame list.
- */
- public void run() {
- getFrameList().back();
- }
-
- /**
- * Updates this action's enabled state and tool tip text.
- * This action is enabled only when there is a previous frame in the frame list.
- * The tool tip text is "Back to " plus the tool tip text for the previous frame.
- */
- public void update() {
- super.update();
- Frame previousFrame = getPreviousFrame();
- setEnabled(previousFrame != null);
- setToolTipText(getToolTipText(previousFrame));
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/ForwardAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/ForwardAction.java
deleted file mode 100644
index 9f434d8..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/ForwardAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.ui.views.framelist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Generic "Forward" action which goes forward one frame.
- */
-public class ForwardAction extends FrameAction {
-
- /**
- * Constructs a new action for the specified frame list.
- *
- * @param frameList the frame list
- */
- public ForwardAction(FrameList frameList) {
- super(frameList);
- setText(FrameListMessages.getString("Forward.text")); //$NON-NLS-1$
- setHoverImageDescriptor(getImageDescriptor("clcl16/forward_nav.gif")); //$NON-NLS-1$
- setImageDescriptor(getImageDescriptor("elcl16/forward_nav.gif")); //$NON-NLS-1$
- setDisabledImageDescriptor(getImageDescriptor("dlcl16/forward_nav.gif")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IFrameListHelpContextIds.FORWARD_ACTION);
- update();
- }
-
- private Frame getNextFrame() {
- FrameList list = getFrameList();
- return list.getFrame(list.getCurrentIndex() + 1);
- }
-
- private String getToolTipText(Frame nextFrame) {
- if (nextFrame != null) {
- String text = nextFrame.getToolTipText();
- if (text != null && text.length() > 0) {
- return FrameListMessages.format("Forward.toolTipOneArg", new Object[] { text }); //$NON-NLS-1$
- }
- }
- return FrameListMessages.getString("Forward.toolTip"); //$NON-NLS-1$
- }
-
- /**
- * Calls <code>forward()</code> on the frame list.
- */
- public void run() {
- getFrameList().forward();
- }
-
- /**
- * Updates this action's enabled state and tool tip text.
- * This action is enabled only when there is a next frame in the frame list.
- * The tool tip text is "Forward to " plus the tool tip text for the next
- * frame.
- */
- public void update() {
- super.update();
- Frame nextFrame = getNextFrame();
- setEnabled(nextFrame != null);
- setToolTipText(getToolTipText(nextFrame));
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/Frame.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/Frame.java
deleted file mode 100644
index e5fa6c9..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/Frame.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.eclipse.ui.views.framelist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-/**
- * Generic frame, which captures the state for one frame in the frame list.
- * Clients may subclass this frame to add their own state.
- */
-public class Frame {
-
- private int index = -1;
- private FrameList parent;
- private String name = ""; //$NON-NLS-1$
- private String toolTipText;
-
- /**
- * Constructs a new frame. <p>
- *
- * This implementation does nothing.
- */
- public Frame() {
- }
-
- /**
- * Returns the index of the frame in the frame list.
- * Only valid once the frame has been added to the frame list.
- *
- * @return the index of the frame in the frame list.
- */
- public int getIndex() {
- return index;
- }
-
- /**
- * Returns the displayable name for the frame.
- *
- * @return the displayable name for the frame.
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns the frame list.
- *
- * @return the frame list
- */
- public FrameList getParent() {
- return parent;
- }
-
- /**
- * Returns the tool tip text to show for the frame.
- * This can form part of the tool tip for actions like the back and forward
- * actions.
- *
- * @return the tool tip text to show for the frame
- */
- public String getToolTipText() {
- return toolTipText;
- }
-
- /**
- * Sets the index of the frame in the frame list.
- * Should only be called by the frame list.
- *
- * @param index the index of the frame in the frame list
- */
- public void setIndex(int index) {
- this.index = index;
- }
-
- /**
- * Sets the displayable name for the frame.
- *
- * @param name the displayable name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Sets the frame list.
- *
- * @param parent the frame list
- */
- public void setParent(FrameList parent) {
- this.parent = parent;
- }
-
- /**
- * Sets the tool tip text to show for the frame.
- * This can form part of the tool tip for actions like the back and forward
- * actions.
- *
- * @param toolTipText the tool tip text to show for the frame.
- */
- public void setToolTipText(String toolTipText) {
- this.toolTipText = toolTipText;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameAction.java
deleted file mode 100644
index 6c9d310..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameAction.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.eclipse.ui.views.framelist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * Abstract superclass for actions dealing with frames or a frame list.
- * This listens for changes to the frame list and updates itself
- * accordingly.
- */
-public abstract class FrameAction extends Action {
- private FrameList frameList;
-
- private IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- FrameAction.this.handlePropertyChange(event);
- }
- };
-
- /**
- * Constructs a new action for the specified frame list.
- * and adds a property change listener on it.
- *
- * @param frameList the frame list
- */
- protected FrameAction(FrameList frameList) {
- this.frameList = frameList;
- frameList.addPropertyChangeListener(propertyChangeListener);
- }
-
- /**
- * Disposes this frame action.
- * This implementation removes the property change listener from the frame list.
- */
- public void dispose() {
- frameList.removePropertyChangeListener(propertyChangeListener);
- }
-
- /**
- * Returns the frame list.
- */
- public FrameList getFrameList() {
- return frameList;
- }
-
- /**
- * Returns the image descriptor with the given relative path.
- */
- static ImageDescriptor getImageDescriptor(String relativePath) {
- String iconPath = "icons/full/"; //$NON-NLS-1$
- try {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- URL installURL = plugin.getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + relativePath);
- return ImageDescriptor.createFromURL(url);
- } catch (MalformedURLException e) {
- // should not happen
- return ImageDescriptor.getMissingImageDescriptor();
- }
- }
-
- /**
- * Handles a property change event from the frame list.
- * This implementation calls <code>update()</code>.
- */
- protected void handlePropertyChange(PropertyChangeEvent event) {
- update();
- }
-
- /**
- * Updates this action. This implementation does nothing.
- * Most implementations will override this method.
- */
- public void update() {
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameList.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameList.java
deleted file mode 100644
index 25b2c9e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameList.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package org.eclipse.ui.views.framelist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import java.util.*;
-
-/**
- * Supports a web-browser style of navigation by maintaining a list
- * of frames. Each frame holds a snapshot of a view at some point
- * in time.
- * <p>
- * The frame list obtains a snapshot of the current frame from a frame source
- * on creation, and whenever switching to a different frame.
- * </p>
- * <p>
- * A property change notification is sent whenever the current page changes.
- * </p>
- */
-public class FrameList {
-
- /** Property name constant for the current frame. */
- public static final String P_CURRENT_FRAME = "currentFrame"; //$NON-NLS-1$
-
- private IFrameSource source;
- private List frames;
- private int current;
- private ListenerList propertyListeners = new ListenerList();
-
- /**
- * Creates a new frame list with the given source.
- *
- * @param source the frame source
- */
- public FrameList(IFrameSource source) {
- this.source = source;
- Frame frame = source.getFrame(IFrameSource.CURRENT_FRAME, 0);
- frame.setParent(this);
- frame.setIndex(0);
- frames = new ArrayList();
- frames.add(frame);
- current = 0;
- }
-
- /**
- * Adds a property change listener.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a property change listener
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- propertyListeners.add(listener);
- }
-
- /**
- * Moves the frame pointer back by one.
- * Has no effect if there is no frame before the current one.
- * Fires a <code>P_CURRENT_FRAME</code> property change event.
- */
- public void back() {
- if (current > 0) {
- setCurrent(current - 1);
- }
- }
-
- /**
- * 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
- *
- * @see IPropertyChangeListener#propertyChange
- */
- protected void firePropertyChange(PropertyChangeEvent event) {
- Object[] listeners = propertyListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((IPropertyChangeListener) listeners[i]).propertyChange(event);
- }
- }
-
- /**
- * Moves the frame pointer forward by one.
- * Has no effect if there is no frame after the current one.
- * Fires a <code>P_CURRENT_FRAME</code> property change event.
- */
- public void forward() {
- if (current < frames.size() - 1) {
- setCurrent(current + 1);
- }
- }
-
- /**
- * Returns the current frame.
- * Returns <code>null</code> if there is no current frame.
- *
- * @return the current frame, or <code>null</code>
- */
- public Frame getCurrentFrame() {
- return getFrame(current);
- }
-
- /**
- * Returns the index of the current frame.
- *
- * @return the index of the current frame
- */
- public int getCurrentIndex() {
- return current;
- }
-
- /**
- * Returns the frame at the given index, or <code>null</code>
- * if the index is ≤ 0 or ≥ <code>size()</code>.
- *
- * @param index the index of the requested frame
- * @return the frame at the given index or <code>null</code>
- */
- public Frame getFrame(int index) {
- if (index < 0 || index >= frames.size())
- return null;
- return (Frame) frames.get(index);
- }
-
- /**
- * Returns the frame source.
- */
- public IFrameSource getSource() {
- return source;
- }
-
- /**
- * Adds the given frame after the current frame,
- * and advances the pointer to the new frame.
- * Before doing so, updates the current frame, and removes any frames following the current frame.
- * Fires a <code>P_CURRENT_FRAME</code> property change event.
- *
- * @param frame the frame to add
- */
- public void gotoFrame(Frame frame) {
- for (int i = frames.size(); --i > current;) {
- frames.remove(i);
- }
- frame.setParent(this);
- int index = frames.size();
- frame.setIndex(index);
- frames.add(frame);
- setCurrent(index);
- }
-
- /**
- * Removes a property change listener.
- * Has no effect if an identical listener is not registered.
- *
- * @param listener a property change listener
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- propertyListeners.remove(listener);
- }
-
- /**
- * Sets the current frame to the one with the given index.
- * Updates the old current frame, and fires a <code>P_CURRENT_FRAME</code> property change event
- * if the current frame changes.
- *
- * @param newCurrent the index of the frame
- */
- void setCurrent(int newCurrent) {
- Assert.isTrue(newCurrent >= 0 && newCurrent < frames.size());
- int oldCurrent = this.current;
- if (oldCurrent != newCurrent) {
- updateCurrentFrame();
- this.current = newCurrent;
- firePropertyChange(
- new PropertyChangeEvent(this, P_CURRENT_FRAME, getFrame(oldCurrent), getFrame(newCurrent)));
- }
- }
-
- /**
- * Sets the current frame to the frame with the given index.
- * Fires a <code>P_CURRENT_FRAME</code> property change event
- * if the current frame changes.
- */
- public void setCurrentIndex(int index) {
- if (index != -1 && index != current)
- setCurrent(index);
- }
-
- /**
- * Returns the number of frames in the frame list.
- */
- public int size() {
- return frames.size();
- }
-
- /**
- * Replaces the current frame in this list with the current frame
- * from the frame source. No event is fired.
- */
- public void updateCurrentFrame() {
- Assert.isTrue(current >= 0);
- Frame frame = source.getFrame(IFrameSource.CURRENT_FRAME, IFrameSource.FULL_CONTEXT);
- frame.setParent(this);
- frame.setIndex(current);
- frames.set(current, frame);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameListMessages.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameListMessages.java
deleted file mode 100644
index f09b7ee..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameListMessages.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.ui.views.framelist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps with managing messages.
- */
-class FrameListMessages {
-
- private static final String RESOURCE_BUNDLE = "org.eclipse.ui.views.framelist.messages"; //$NON-NLS-1$
- private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private FrameListMessages() {
- // prevent instantiation of class
- }
-
- /**
- * Returns the formatted message for the given key in
- * the resource bundle.
- *
- * @param key the resource name
- * @param args the message arguments
- * @return the string
- */
- public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key), args);
- }
-
- /**
- * Returns the resource object with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the key is returned.
- *
- * @param key the resource name
- * @return the string
- */
- public static String getString(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/GoIntoAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/GoIntoAction.java
deleted file mode 100644
index 7e00828..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/GoIntoAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.ui.views.framelist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Generic "Go Into" action which goes to the frame for the current selection.
- */
-public class GoIntoAction extends FrameAction {
-
- /**
- * Constructs a new action for the specified frame list.
- *
- * @param frameList the frame list
- */
- public GoIntoAction(FrameList frameList) {
- super(frameList);
- setText(FrameListMessages.getString("GoInto.text")); //$NON-NLS-1$
- setToolTipText(FrameListMessages.getString("GoInto.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IFrameListHelpContextIds.GO_INTO_ACTION);
- update();
- }
-
- private Frame getSelectionFrame(int flags) {
- return getFrameList().getSource().getFrame(IFrameSource.SELECTION_FRAME, flags);
- }
-
- /**
- * Calls <code>gotoFrame</code> on the frame list with a frame
- * representing the currently selected container.
- */
- public void run() {
- Frame selectionFrame = getSelectionFrame(IFrameSource.FULL_CONTEXT);
- if (selectionFrame != null) {
- getFrameList().gotoFrame(selectionFrame);
- }
- }
-
- /**
- * Updates this action's enabled state.
- * This action is enabled only when there is a frame for the current selection.
- */
- public void update() {
- super.update();
- Frame selectionFrame = getSelectionFrame(0);
- setEnabled(selectionFrame != null);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/IFrameListHelpContextIds.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/IFrameListHelpContextIds.java
deleted file mode 100644
index 9a99023..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/IFrameListHelpContextIds.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.ui.views.framelist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Help context ids for the frame list.
- * <p>
- * This interface contains constants only; it is not intended to be implemented
- * or extended.
- * </p>
- *
- */
-/*package*/ interface IFrameListHelpContextIds {
- public static final String PREFIX = PlatformUI.PLUGIN_ID + "."; //$NON-NLS-1$
-
- // Actions
- public static final String BACK_ACTION = PREFIX + "back_action_context"; //$NON-NLS-1$
- public static final String FORWARD_ACTION = PREFIX + "forward_action_context"; //$NON-NLS-1$
- public static final String GO_INTO_ACTION = PREFIX + "go_into_action_context"; //$NON-NLS-1$
- public static final String UP_ACTION = PREFIX + "up_action_context"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/IFrameSource.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/IFrameSource.java
deleted file mode 100644
index aff69c1..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/IFrameSource.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.eclipse.ui.views.framelist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-/**
- * A frame source is the source of frames which appear in a frame list.
- * The frame list asks for the current frame whenever it switches
- * to another frame, so that the context can be restored when the
- * frame becomes current again.
- *
- * @see FrameList
- */
-public interface IFrameSource {
-
- /**
- * Frame constant indicating the current frame.
- */
- public static final int CURRENT_FRAME = 0x0001;
-
- /**
- * Frame constant indicating the frame for the selection.
- */
- public static final int SELECTION_FRAME = 0x0002;
-
- /**
- * Frame constant indicating the parent frame.
- */
- public static final int PARENT_FRAME = 0x0003;
-
- /**
- * Flag constant indicating that the full context should be captured.
- */
- public static final int FULL_CONTEXT = 0x0001;
-
- /**
- * Returns a new frame describing the state of the source.
- * If the <code>FULL_CONTEXT</code> flag is specified, then the full
- * context of the source should be captured by the frame.
- * Otherwise, only the visible aspects of the frame, such as the name and tool tip text,
- * will be used.
- *
- * @param frame one of the frame constants defined in this interface
- * @param flags a bit-wise OR of the flag constants defined in this interface
- * @return a new frame describing the current state of the source
- */
- public Frame getFrame(int whichFrame, int flags);
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/TreeFrame.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/TreeFrame.java
deleted file mode 100644
index 65b706e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/TreeFrame.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.ui.views.framelist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import org.eclipse.jface.viewers.*;
-
-/**
- * Frame for tree viewers. This capture the viewer's input element, selection,
- * and expanded elements.
- */
-public class TreeFrame extends Frame {
-
- private AbstractTreeViewer viewer;
- private Object input;
- private ISelection selection;
- private Object[] expandedElements;
-
- /**
- * Constructs a frame for the specified tree viewer.
- * The frame's input, name and tool tip text are not set.
- *
- * @param viewer the tree viewer
- */
- public TreeFrame(AbstractTreeViewer viewer) {
- this.viewer = viewer;
- }
-
- /**
- * Constructs a frame for the specified tree viewer.
- * The frame's input element is set to the specified input element.
- * The frame's name and tool tip text are set to the text for the input
- * element, as provided by the viewer's label provider.
- *
- * @param viewer the tree viewer
- * @param input the input element
- */
- public TreeFrame(AbstractTreeViewer viewer, Object input) {
- this(viewer);
- setInput(input);
- ILabelProvider provider = (ILabelProvider) viewer.getLabelProvider();
- String name = provider.getText(input);
- setName(name);
- setToolTipText(name);
- }
-
- /**
- * Returns the expanded elements.
- *
- * @return the expanded elements
- */
- public Object[] getExpandedElements() {
- return expandedElements;
- }
-
- /**
- * Returns the input element.
- *
- * @return the input element
- */
- public Object getInput() {
- return input;
- }
-
- /**
- * Returns the selection.
- *
- * @return the selection
- */
- public ISelection getSelection() {
- return selection;
- }
-
- /**
- * Returns the tree viewer.
- *
- * @return the tree viewer
- */
- public AbstractTreeViewer getViewer() {
- return viewer;
- }
-
- /**
- * Sets the input element.
- *
- * @param input the input element
- */
- public void setInput(Object input) {
- this.input = input;
- }
-
- /**
- * Sets the expanded elements.
- *
- * @param expandedElements the expanded elements
- */
- public void setExpandedElements(Object[] expandedElements) {
- this.expandedElements = expandedElements;
- }
-
- /**
- * Sets the selection.
- *
- * @param selection the selection
- */
- public void setSelection(ISelection selection) {
- this.selection = selection;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/TreeViewerFrameSource.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/TreeViewerFrameSource.java
deleted file mode 100644
index 2ae2c5a..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/TreeViewerFrameSource.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package org.eclipse.ui.views.framelist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-
-/**
- * Frame source for tree viewers, which uses <code>TreeFrame</code> to capture
- * the state of the tree viewer.
- *
- * @see TreeFrame
- */
-public class TreeViewerFrameSource implements IFrameSource {
-
- private AbstractTreeViewer viewer;
-
- /**
- * Constructs a new tree viewer frame source for the specified tree viewer.
- *
- * @param viewer the tree viewer
- */
- public TreeViewerFrameSource(AbstractTreeViewer viewer) {
- this.viewer = viewer;
- }
-
- /**
- * Connects this source as a listener on the frame list,
- * so that when the current frame changes, the viewer is updated.
- */
- public void connectTo(FrameList frameList) {
- frameList.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- TreeViewerFrameSource.this.handlePropertyChange(event);
- }
- });
- }
-
- /**
- * Returns a new tree frame capturing the specified input element.
- *
- * @param input the input element
- * @return the tree frame
- */
- protected TreeFrame createFrame(Object input) {
- return new TreeFrame(viewer, input);
- }
-
- /**
- * Updates the viewer in response to the current frame changing.
- *
- * @param frame the new value for the current frame
- */
- protected void frameChanged(TreeFrame frame) {
- viewer.getControl().setRedraw(false);
- viewer.setInput(frame.getInput());
- viewer.setExpandedElements(frame.getExpandedElements());
- viewer.setSelection(frame.getSelection(), true);
- viewer.getControl().setRedraw(true);
- }
-
- /**
- * Returns the current frame.
- *
- * @param flags a bit-wise OR of the frame source flag constants
- * @return the current frame
- */
- protected Frame getCurrentFrame(int flags) {
- Object input = viewer.getInput();
- TreeFrame frame = createFrame(input);
- if ((flags & IFrameSource.FULL_CONTEXT) != 0) {
- frame.setSelection(viewer.getSelection());
- frame.setExpandedElements(viewer.getExpandedElements());
- }
- return frame;
- }
-
- /* (non-Javadoc)
- * Method declared on IFrameSource.
- */
- public Frame getFrame(int whichFrame, int flags) {
- switch (whichFrame) {
- case IFrameSource.CURRENT_FRAME :
- return getCurrentFrame(flags);
- case IFrameSource.PARENT_FRAME :
- return getParentFrame(flags);
- case IFrameSource.SELECTION_FRAME :
- return getSelectionFrame(flags);
- default :
- return null;
- }
- }
-
- /**
- * Returns the parent frame, or <code>null</code> if there is no parent frame.
- *
- * @param flags a bit-wise OR of the frame source flag constants
- * @return the parent frame, or <code>null</code>
- */
- protected Frame getParentFrame(int flags) {
- Object input = viewer.getInput();
- ITreeContentProvider provider = (ITreeContentProvider) viewer.getContentProvider();
- Object parent = provider.getParent(input);
- if (parent == null) {
- return null;
- } else {
- TreeFrame frame = createFrame(parent);
- if ((flags & IFrameSource.FULL_CONTEXT) != 0) {
- frame.setSelection(viewer.getSelection());
- // include current input in expanded set
- Object[] expanded = viewer.getExpandedElements();
- Object[] newExpanded = new Object[expanded.length + 1];
- System.arraycopy(expanded, 0, newExpanded, 0, expanded.length);
- newExpanded[newExpanded.length - 1] = input;
- frame.setExpandedElements(newExpanded);
- }
- return frame;
- }
- }
-
- /**
- * Returns the frame for the selection, or <code>null</code> if there is no
- * frame for the selection.
- *
- * @param flags a bit-wise OR of the frame source flag constants
- * @return the selection frame, or <code>null</code>
- */
- protected Frame getSelectionFrame(int flags) {
- IStructuredSelection sel = (IStructuredSelection) viewer.getSelection();
- if (sel.size() == 1) {
- Object o = sel.getFirstElement();
- if (viewer.isExpandable(o)) {
- TreeFrame frame = createFrame(o);
- if ((flags & IFrameSource.FULL_CONTEXT) != 0) {
- frame.setSelection(viewer.getSelection());
- frame.setExpandedElements(viewer.getExpandedElements());
- }
- return frame;
- }
- }
- return null;
- }
-
- /**
- * Returns the tree viewer.
- *
- * @return the tree viewer
- */
- public AbstractTreeViewer getViewer() {
- return viewer;
- }
-
- /**
- * Handles a property change event from the frame list.
- * Calls <code>frameChanged</code> when the current frame changes.
- */
- protected void handlePropertyChange(PropertyChangeEvent event) {
- if (FrameList.P_CURRENT_FRAME.equals(event.getProperty())) {
- frameChanged((TreeFrame) event.getNewValue());
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/UpAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/UpAction.java
deleted file mode 100644
index 4ccb533..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/UpAction.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.ui.views.framelist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Generic "Up" action which goes to the parent frame for the current frame.
- */
-public class UpAction extends FrameAction {
-
- /**
- * Constructs a new action for the specified frame list.
- *
- * @param frameList the frame list
- */
- public UpAction(FrameList frameList) {
- super(frameList);
- setText(FrameListMessages.getString("Up.text")); //$NON-NLS-1$
- setHoverImageDescriptor(getImageDescriptor("clcl16/up_nav.gif")); //$NON-NLS-1$
- setImageDescriptor(getImageDescriptor("elcl16/up_nav.gif")); //$NON-NLS-1$
- setDisabledImageDescriptor(getImageDescriptor("dlcl16/up_nav.gif")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IFrameListHelpContextIds.UP_ACTION);
- update();
- }
-
- Frame getParentFrame(int flags) {
- return getFrameList().getSource().getFrame(IFrameSource.PARENT_FRAME, flags);
- }
-
- String getToolTipText(Frame parentFrame) {
- if (parentFrame != null) {
- String text = parentFrame.getToolTipText();
- if (text != null && text.length() > 0) {
- return FrameListMessages.format("Up.toolTipOneArg", new Object[] { text }); //$NON-NLS-1$
- }
- }
- return FrameListMessages.getString("Up.toolTip"); //$NON-NLS-1$
-
- }
-
- /**
- * Calls <code>gotoFrame</code> on the frame list with a frame
- * representing the parent of the current input.
- */
- public void run() {
- Frame parentFrame = getParentFrame(IFrameSource.FULL_CONTEXT);
- if (parentFrame != null) {
- getFrameList().gotoFrame(parentFrame);
- }
- }
-
- /**
- * Updates this action's enabled state and tool tip text.
- * This action is enabled only when there is a parent frame for the current
- * frame in the frame list.
- * The tool tip text is "Up to " plus the tool tip text for the parent
- * frame.
- */
- public void update() {
- super.update();
- Frame parentFrame = getParentFrame(0);
- setEnabled(parentFrame != null);
- setToolTipText(getToolTipText(parentFrame));
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/messages.properties b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/messages.properties
deleted file mode 100644
index f61d33f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/messages.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-# ==============================================================================
-# (c) Copyright IBM Corp. 2000, 2001, 2002.
-# All Rights Reserved.
-# ==============================================================================
-
-# package: org.eclipse.ui.views.framelist
-
-
-# ==============================================================================
-# FrameList
-# ==============================================================================
-Back.text = &Back
-Back.toolTip = Back
-Back.toolTipOneArg = Back to {0}
-
-Forward.text = &Forward
-Forward.toolTip = Forward
-Forward.toolTipOneArg = Forward to {0}
-
-GoInto.text = Go &Into
-GoInto.toolTip = Go Into
-
-Up.text = &Up One Level
-Up.toolTip = Up
-Up.toolTipOneArg = Up to {0}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/package.html b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/package.html
deleted file mode 100644
index 2ca0f96..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/package.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-<p>Provides support for a web-browser style of navigation within a view by maintaining a list
-of frames. Each frame holds a snapshot of a view at some point in time.
-Includes support for use with a tree viewer.</p>
-<p>
-<br> </p>
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/CopyAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/CopyAction.java
deleted file mode 100644
index 33fe043..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/CopyAction.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.SelectionListenerAction;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.part.ResourceTransfer;
-
-/**
- * Standard action for copying the currently selected resources to the clipboard.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- *
- * @since 2.0
- */
-/*package*/ class CopyAction extends SelectionListenerAction {
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".CopyAction"; //$NON-NLS-1$
-
- /**
- * The shell in which to show any dialogs.
- */
- private Shell shell;
-
- /**
- * System clipboard
- */
- private Clipboard clipboard;
-
- /**
- * Associated paste action. May be <code>null</code>
- */
- private PasteAction pasteAction;
-
-/**
- * Creates a new action.
- *
- * @param shell the shell for any dialogs
- * @param clipboard a platform clipboard
- */
-public CopyAction(Shell shell, Clipboard clipboard) {
- super(ResourceNavigatorMessages.getString("CopyAction.title")); //$NON-NLS-1$
- Assert.isNotNull(shell);
- Assert.isNotNull(clipboard);
- this.shell = shell;
- this.clipboard = clipboard;
- setToolTipText(ResourceNavigatorMessages.getString("CopyAction.toolTip")); //$NON-NLS-1$
- setId(CopyAction.ID);
- WorkbenchHelp.setHelp(this, INavigatorHelpContextIds.COPY_ACTION);
-}
-/**
- * Creates a new action.
- *
- * @param shell the shell for any dialogs
- * @param clipboard a platform clipboard
- * @param pasteAction a paste action
- *
- * @since 2.0
- */
-public CopyAction(Shell shell, Clipboard clipboard, PasteAction pasteAction) {
- this(shell, clipboard);
- this.pasteAction = pasteAction;
-}
-/**
- * The <code>CopyAction</code> implementation of this method defined
- * on <code>IAction</code> copies the selected resources to the
- * clipboard.
- */
-public void run(){
- List selectedResources = getSelectedResources();
- IResource[] resources = (IResource[]) selectedResources.toArray(new IResource[selectedResources.size()]);
-
- // Get the file names and a string representation
- int len = resources.length;
- String[] fileNames = new String[len];
- StringBuffer buf = new StringBuffer();
- for (int i = 0, length = len; i < length; i++) {
- fileNames[i] = resources[i].getLocation().toOSString();
- if (i > 0)
- buf.append("\n"); //$NON-NLS-1$
- buf.append(resources[i].getName());
- }
- setClipboard(resources, fileNames, buf.toString());
-
- // update the enablement of the paste action
- // workaround since the clipboard does not suppot callbacks
- if (pasteAction != null && pasteAction.getStructuredSelection() != null)
- pasteAction.selectionChanged(pasteAction.getStructuredSelection());
-}
-/**
- * Set the clipboard contents. Prompt to retry if clipboard is busy.
- *
- * @param resources the resources to copy to the clipboard
- * @param fileNames file names of the resources to copy to the clipboard
- * @param names string representation of all names
- */
-private void setClipboard(IResource[] resources, String[] fileNames, String names) {
- try {
- // set the clipboard contents
- clipboard.setContents(
- new Object[]{
- resources,
- fileNames,
- names},
- new Transfer[]{
- ResourceTransfer.getInstance(),
- FileTransfer.getInstance(),
- TextTransfer.getInstance()});
- } catch (SWTError e){
- if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
- throw e;
- if (MessageDialog.openQuestion(shell, WorkbenchMessages.getString("CopyToClipboardProblemDialog.title"), WorkbenchMessages.getString("CopyToClipboardProblemDialog.message"))) //$NON-NLS-1$ //$NON-NLS-2$
- setClipboard(resources, fileNames, names);
- }
-}
-/**
- * The <code>CopyAction</code> implementation of this
- * <code>SelectionListenerAction</code> method enables this action if
- * one or more resources of compatible types are selected.
- */
-protected boolean updateSelection(IStructuredSelection selection) {
- if (!super.updateSelection(selection))
- return false;
-
- if (getSelectedNonResources().size() > 0)
- return false;
-
- List selectedResources = getSelectedResources();
- if (selectedResources.size() == 0)
- return false;
-
- boolean projSelected = selectionIsOfType(IResource.PROJECT);
- boolean fileFoldersSelected = selectionIsOfType(IResource.FILE | IResource.FOLDER);
- if (!projSelected && !fileFoldersSelected)
- return false;
-
- // selection must be homogeneous
- if (projSelected && fileFoldersSelected)
- return false;
-
- // must have a common parent
- IContainer firstParent = ((IResource) selectedResources.get(0)).getParent();
- if (firstParent == null)
- return false;
-
- Iterator resourcesEnum = selectedResources.iterator();
- while (resourcesEnum.hasNext()) {
- IResource currentResource = (IResource) resourcesEnum.next();
- if (!currentResource.getParent().equals(firstParent)) {
- return false;
- }
- }
-
- return true;
-}
-
-}
-
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/FilterSelectionAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/FilterSelectionAction.java
deleted file mode 100644
index f1a54a8..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/FilterSelectionAction.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.*;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.ResourceWorkingSetFilter;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.dialogs.FilterDialog;
-
-/**
- * The FilterSelectionAction opens the filters dialog.
- */
-public class FilterSelectionAction extends ResourceNavigatorAction {
- private static final String FILTER_TOOL_TIP = ResourceNavigatorMessages.getString("FilterSelection.toolTip"); //$NON-NLS-1$
- private static final String FILTER_SELECTION_MESSAGE = ResourceNavigatorMessages.getString("FilterSelection.message"); //$NON-NLS-1$
- private static final String FILTER_TITLE_MESSAGE = ResourceNavigatorMessages.getString("FilterSelection.title"); //$NON-NLS-1$
-
-/**
- * Creates the action.
- *
- * @param navigator the resource navigator
- * @param label the label for the action
- */
-public FilterSelectionAction(IResourceNavigator navigator, String label) {
- super(navigator, label);
- setToolTipText(FILTER_TOOL_TIP);
- WorkbenchHelp.setHelp(this, INavigatorHelpContextIds.FILTER_SELECTION_ACTION);
- setEnabled(true);
-}
-
-/*
- * Implementation of method defined on <code>IAction</code>.
- */
-public void run() {
- IResourceNavigator navigator = getNavigator();
- ResourcePatternFilter filter = navigator.getPatternFilter();
- FiltersContentProvider contentProvider = new FiltersContentProvider(filter);
- IWorkingSet workingSet = navigator.getWorkingSet();
-
- FilterDialog dialog =
- new FilterDialog(
- getShell(),
- getViewer(),
- contentProvider,
- new LabelProvider(),
- FILTER_SELECTION_MESSAGE);
-
- dialog.setTitle(FILTER_TITLE_MESSAGE);
- dialog.setInitialSelections(contentProvider.getInitialSelections());
- dialog.setWorkingSet(workingSet);
- dialog.open();
- if (dialog.getReturnCode() == Dialog.OK) {
- Object[] results = dialog.getResult();
- String[] selectedPatterns = new String[results.length];
- IWorkingSetManager workingSetManager = WorkbenchPlugin.getDefault().getWorkingSetManager();
-
- System.arraycopy(results, 0, selectedPatterns, 0, results.length);
- filter.setPatterns(selectedPatterns);
- workingSet = dialog.getWorkingSet();
- navigator.setWorkingSet(workingSet);
- if (workingSet != null) {
- workingSetManager.addRecentWorkingSet(workingSet);
- }
-
- navigator.setFiltersPreference(selectedPatterns);
- Viewer viewer = getViewer();
- viewer.getControl().setRedraw(false);
- viewer.refresh();
- viewer.getControl().setRedraw(true);
- }
- else
- if (navigator.getWorkingSet() != workingSet) {
- navigator.setWorkingSet(workingSet);
- }
-}
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/FiltersContentProvider.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/FiltersContentProvider.java
deleted file mode 100644
index ddb5f05..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/FiltersContentProvider.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * The FiltersContentProvider provides the elements for use by the list dialog
- * for selecting the patterns to apply.
- */
-/* package */ class FiltersContentProvider implements IStructuredContentProvider {
-
- private static List definedFilters;
- private static List defaultFilters;
-
-
- private ResourcePatternFilter resourceFilter;
-/**
- * Create a FiltersContentProvider using the selections from the suppliec
- * resource filter.
- */
-public FiltersContentProvider(ResourcePatternFilter filter) {
- this.resourceFilter = filter;
-}
-/* (non-Javadoc)
- * Method declared on IContentProvider.
- */
-public void dispose() {}
-/**
- * Returns the filters which are enabled by default.
- *
- * @return a list of strings
- */
-public static List getDefaultFilters() {
- if (defaultFilters == null) {
- readFilters();
- }
- return defaultFilters;
-}
-/**
- * Returns the filters currently defined for the navigator.
- *
- * @return a list of strings
- */
-public static List getDefinedFilters() {
- if (definedFilters == null) {
- readFilters();
- }
- return definedFilters;
-}
-/* (non-Javadoc)
- * Method declared on IStructuredContentProvider.
- */
-public Object[] getElements(Object inputElement) {
- return getDefinedFilters().toArray();
-}
-/**
- * Return the initially selected elements.
- */
-public String[] getInitialSelections() {
- return this.resourceFilter.getPatterns();
-}
-/* (non-Javadoc)
- * Method declared on IContentProvider.
- */
-public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-}
-/**
- * Reads the filters currently defined for the workbench.
- */
-private static void readFilters() {
- definedFilters = new ArrayList();
- defaultFilters = new ArrayList();
- AbstractUIPlugin plugin =
- (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- if (plugin != null) {
- IExtensionPoint extension = plugin.getDescriptor().getExtensionPoint(ResourcePatternFilter.FILTERS_TAG);
- if (extension != null) {
- IExtension[] extensions = extension.getExtensions();
- for(int i = 0; i < extensions.length; i++){
- IConfigurationElement [] configElements = extensions[i].getConfigurationElements();
- for(int j = 0; j < configElements.length; j++){
- String pattern = configElements[j].getAttribute("pattern");//$NON-NLS-1$
- if (pattern != null)
- definedFilters.add(pattern);
- String selected = configElements[j].getAttribute("selected");//$NON-NLS-1$
- if (selected != null && selected.equalsIgnoreCase("true"))//$NON-NLS-1$
- defaultFilters.add(pattern);
- }
- }
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoActionGroup.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoActionGroup.java
deleted file mode 100644
index c8fdd77..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoActionGroup.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import org.eclipse.core.resources.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.views.framelist.*;
-
-/**
- * This is the action group for the goto actions.
- */
-public class GotoActionGroup extends ResourceNavigatorActionGroup {
-
- private BackAction backAction;
- private ForwardAction forwardAction;
- private GoIntoAction goIntoAction;
- private UpAction upAction;
- private GotoResourceAction gotoResourceAction;
- private IResourceChangeListener resourceChangeListener;
-
- public GotoActionGroup(IResourceNavigator navigator) {
- super(navigator);
-
- // Listen for project open/close changes. Fixes bug 5958
- resourceChangeListener = new IResourceChangeListener() {
- public void resourceChanged(IResourceChangeEvent event) {
- updateActionBars();
- }
- };
- ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener);
- }
-
- /**
- * @see org.eclipse.ui.actions.ActionGroup#dispose()
- */
- public void dispose() {
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);
- super.dispose();
- }
-
- public void fillContextMenu(IMenuManager menu) {
- IStructuredSelection selection =
- (IStructuredSelection) getContext().getSelection();
- if (selection.size() == 1) {
- if (ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.FOLDER)) {
- menu.add(goIntoAction);
- } else {
- IStructuredSelection resourceSelection = ResourceSelectionUtil.allResources(selection, IResource.PROJECT);
- if (resourceSelection != null && !resourceSelection.isEmpty()) {
- IProject project = (IProject)resourceSelection.getFirstElement();
- if (project.isOpen())
- menu.add(goIntoAction);
- }
- }
- }
- MenuManager gotoMenu =
- new MenuManager(ResourceNavigatorMessages.getString("ResourceNavigator.goto")); //$NON-NLS-1$
- menu.add(gotoMenu);
- gotoMenu.add(backAction);
- gotoMenu.add(forwardAction);
- gotoMenu.add(upAction);
- gotoMenu.add(gotoResourceAction);
- }
-
- public void fillActionBars(IActionBars actionBars) {
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.GO_INTO,
- goIntoAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.BACK,
- backAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.FORWARD,
- forwardAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.UP,
- upAction);
-
- IToolBarManager toolBar = actionBars.getToolBarManager();
- toolBar.add(backAction);
- toolBar.add(forwardAction);
- toolBar.add(upAction);
- }
-
- protected void makeActions() {
- FrameList frameList = navigator.getFrameList();
- goIntoAction = new GoIntoAction(frameList);
- backAction = new BackAction(frameList);
- forwardAction = new ForwardAction(frameList);
- upAction = new UpAction(frameList);
- gotoResourceAction =
- new GotoResourceAction(
- navigator,
- ResourceNavigatorMessages.getString("ResourceNavigator.resourceText")); //$NON-NLS-1$
- }
-
- public void updateActionBars() {
- IStructuredSelection selection =
- (IStructuredSelection) getContext().getSelection();
- boolean enable = false;
-
- if (selection.size() == 1) {
- Object object = selection.getFirstElement();
- if (object instanceof IProject) {
- enable = ((IProject) object).isOpen();
- }
- else
- if (object instanceof IFolder) {
- enable = true;
- }
- }
- goIntoAction.setEnabled(enable);
- // the rest of the actions update by listening to frame list changes
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoResourceAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoResourceAction.java
deleted file mode 100644
index dd52447..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoResourceAction.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.help.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.resources.*;
-import org.eclipse.jface.viewers.*;
-import java.util.*;
-
-/**
- * Implements the go to resource action. Opens a dialog and set
- * the navigator selection with the resource selected by
- * the user.
- */
-public class GotoResourceAction extends ResourceNavigatorAction {
-/**
- * Creates a new instance of the class.
- * @since 2.0
- */
-public GotoResourceAction(IResourceNavigator navigator, String label) {
- super(navigator, label);
- WorkbenchHelp.setHelp(this, INavigatorHelpContextIds.GOTO_RESOURCE_ACTION);
-}
-/**
- * Collect all resources in the workbench and add them to the <code>resources</code>
- * list.
- */
-private void collectAllResources(IContainer container,ArrayList resources,ResourcePatternFilter filter) {
- try {
- IResource members[] = container.members();
- for (int i = 0; i < members.length; i++){
- IResource r = members[i];
- if(filter.select(getNavigator().getViewer(),null,r))
- resources.add(r);
- if(r.getType() != IResource.FILE)
- collectAllResources((IContainer)r,resources,filter);
- }
- } catch (CoreException e) {
- }
-}
-/**
- * Collect all resources in the workbench open a dialog asking
- * the user to select a resource and change the selection in
- * the navigator.
- */
-public void run() {
- IContainer cont = (IContainer)getViewer().getInput();
- ArrayList resources = new ArrayList();
- collectAllResources(cont,resources,getNavigator().getPatternFilter());
- IResource resourcesArray[] = new IResource[resources.size()];
- resources.toArray(resourcesArray);
- GotoResourceDialog dialog = new GotoResourceDialog(getShell(),resourcesArray);
- dialog.open();
- IResource selection = dialog.getSelection();
- if(selection == null)
- return;
- getViewer().setSelection(new StructuredSelection(selection),true);
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoResourceDialog.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoResourceDialog.java
deleted file mode 100644
index aad4c2d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoResourceDialog.java
+++ /dev/null
@@ -1,343 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.core.resources.*;
-import org.eclipse.ui.dialogs.*;
-
-import java.text.Collator;
-import java.util.*;
-import org.eclipse.ui.model.*;
-import org.eclipse.ui.help.*;
-
-/**
- * Shows a list of resources to the user with a text entry field
- * for a string pattern used to filter the list of resources.
- *
- */
-/*package*/ class GotoResourceDialog extends SelectionDialog {
- Text pattern;
- Table resourceNames;
- Table folderNames;
- String patternString;
- IResource selection;
- private static Collator collator = Collator.getInstance();
-
- StringMatcher stringMatcher;
-
- UpdateThread updateThread;
- ResourceDescriptor descriptors[];
- int descriptorsSize;
-
- WorkbenchLabelProvider labelProvider = new WorkbenchLabelProvider();
- static class ResourceDescriptor implements Comparable {
- String label;
- ArrayList resources = new ArrayList(1);
- public int compareTo(Object o) {
- return collator.compare(label,((ResourceDescriptor)o).label);
- }
- }
-
- class UpdateThread extends Thread {
- boolean stop = false;
- int firstMatch = 0;
- int lastMatch = descriptorsSize - 1;
-
- public void run() {
- Display display = resourceNames.getDisplay();
- final int itemIndex[] = {0};
- final int itemCount[] = {0};
- display.syncExec(new Runnable(){
- public void run() {
- itemCount[0] = resourceNames.getItemCount();
- }
- });
- int last = lastMatch;
- boolean setFirstMatch = true;
- for (int i = firstMatch; i <= lastMatch;i++) {
- if(i % 50 == 0) {
- try { Thread.sleep(10); } catch(InterruptedException e){}
- }
- if(stop || resourceNames.isDisposed()) return;
- final int index = i;
- if(match(descriptors[index].label)) {
- if(setFirstMatch) {
- setFirstMatch = false;
- firstMatch = index;
- }
- last = index;
- display.syncExec(new Runnable() {
- public void run() {
- if(stop || resourceNames.isDisposed()) return;
- updateItem(index,itemIndex[0],itemCount[0]);
- itemIndex[0]++;
- }
- });
- }
- }
- lastMatch = last;
- display.syncExec(new Runnable() {
- public void run() {
- itemCount[0] = resourceNames.getItemCount();
- if(itemIndex[0] < itemCount[0]) {
- resourceNames.setRedraw(false);
- resourceNames.remove(itemIndex[0],itemCount[0] -1);
- resourceNames.setRedraw(true);
- }
- // If no resources, remove remaining folder entries
- if(resourceNames.getItemCount() == 0) {
- folderNames.removeAll();
- }
- }
- });
- }
- };
-/**
- * Creates a new instance of the class.
- */
-protected GotoResourceDialog(Shell parentShell,IResource resources[]) {
- super(parentShell);
- setTitle(ResourceNavigatorMessages.getString("Goto.title")); //$NON-NLS-1$
- setShellStyle(getShellStyle() | SWT.RESIZE);
- initDescriptors(resources);
-}
-public boolean close() {
- boolean r = super.close();
- labelProvider.dispose();
- return r;
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- WorkbenchHelp.setHelp(shell, INavigatorHelpContextIds.GOTO_RESOURCE_DIALOG);
-}
-public void create() {
- super.create();
- pattern.setFocus();
-}
-/**
- * Creates the contents of this dialog, initializes the
- * listener and the update thread.
- */
-protected Control createDialogArea(Composite parent) {
-
- Composite dialogArea = (Composite)super.createDialogArea(parent);
- Label l = new Label(dialogArea,SWT.NONE);
- l.setText(ResourceNavigatorMessages.getString("Goto.label")); //$NON-NLS-1$
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- l.setLayoutData(data);
-
- l = new Label(dialogArea,SWT.NONE);
- l.setText(ResourceNavigatorMessages.getString("Goto.pattern")); //$NON-NLS-1$
- data = new GridData(GridData.FILL_HORIZONTAL);
- l.setLayoutData(data);
- pattern = new Text(dialogArea,SWT.SINGLE|SWT.BORDER);
- pattern.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- l = new Label(dialogArea,SWT.NONE);
- l.setText(ResourceNavigatorMessages.getString("Goto.matching")); //$NON-NLS-1$
- data = new GridData(GridData.FILL_HORIZONTAL);
- l.setLayoutData(data);
- resourceNames = new Table(dialogArea,SWT.SINGLE|SWT.BORDER|SWT.V_SCROLL);
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = 12 * resourceNames.getItemHeight();
- resourceNames.setLayoutData(data);
-
- l = new Label(dialogArea,SWT.NONE);
- l.setText(ResourceNavigatorMessages.getString("Goto.folders")); //$NON-NLS-1$
- data = new GridData(GridData.FILL_HORIZONTAL);
- l.setLayoutData(data);
-
- folderNames = new Table(dialogArea,SWT.SINGLE|SWT.BORDER|SWT.V_SCROLL|SWT.H_SCROLL);
- data = new GridData(GridData.FILL_BOTH);
- data.widthHint = 300;
- data.heightHint = 4 * folderNames.getItemHeight();
- folderNames.setLayoutData(data);
-
- updateThread = new UpdateThread();
- updateThread.start();
-
- pattern.addKeyListener(new KeyAdapter(){
- public void keyPressed(KeyEvent e) {
- textChanged();
- }
- });
-
- resourceNames.addSelectionListener(new SelectionAdapter(){
- public void widgetSelected(SelectionEvent e) {
- updateFolders((ResourceDescriptor)e.item.getData());
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- okPressed();
- }
- });
-
- folderNames.addSelectionListener(new SelectionAdapter(){
- public void widgetDefaultSelected(SelectionEvent e) {
- okPressed();
- }
- });
-
- return dialogArea;
-}
-/**
- * Create a new table item if there is no item otherwise update one
- * exitent item with the new info.
- */
-private void updateItem(int index, int itemPos,int itemCount) {
- ResourceDescriptor desc = descriptors[index];
- TableItem item;
- if(itemPos < itemCount) {
- item = resourceNames.getItem(itemPos);
- if(item.getData() != desc) {
- item.setText(desc.label);
- item.setData(desc);
- item.setImage(getImage(desc));
- if (itemPos == 0) {
- resourceNames.setSelection(0);
- updateFolders(desc);
- }
- }
- } else {
- item = new TableItem(resourceNames, SWT.NONE);
- item.setText(desc.label);
- item.setData(desc);
- item.setImage(getImage(desc));
- if (itemPos == 0) {
- resourceNames.setSelection(0);
- updateFolders(desc);
- }
- }
-}
-/**
- * Return a image for a resource.
- */
-private Image getImage(ResourceDescriptor desc) {
- IResource r = (IResource)desc.resources.get(0);
- return labelProvider.getImage(r);
-}
-/**
- * Returns the IResource selected by the user or null if the
- * cancel was pressed.
- */
-public IResource getSelection() {
- return selection;
-}
-/**
- * Creates a ResourceDescriptor for each IResource
- * sort them and remove the duplicated ones.
- */
-private void initDescriptors(IResource resources[]) {
- descriptors = new ResourceDescriptor[resources.length];
- for (int i = 0; i < resources.length; i++){
- IResource r = resources[i];
- ResourceDescriptor d = new ResourceDescriptor();
- //TDB: Should use the label provider and compare performance.
- d.label = r.getName();
- d.resources.add(r);
- descriptors[i] = d;
- }
- Arrays.sort(descriptors);
- descriptorsSize = descriptors.length;
-
- //Merge the resource descriptor with the same label and type.
- int index = 0;
- if(descriptorsSize < 2)
- return;
- ResourceDescriptor current = descriptors[index];
- IResource currentResource = (IResource)current.resources.get(0);
- for (int i = 1; i < descriptorsSize; i++){
- ResourceDescriptor next = descriptors[i];
- IResource nextResource = (IResource)next.resources.get(0);
- if((next.label.equals(current.label)) && (nextResource.getType() == currentResource.getType())) {
- current.resources.add(next.resources.get(0));
- } else {
- descriptors[index + 1] = descriptors[i];
- index++;
- current = descriptors[index];
- currentResource = (IResource)current.resources.get(0);
- }
- }
- descriptorsSize = index + 1;
-}
-/**
- * Return true if the label matchs the choosen pattern.
- */
-private boolean match(String label) {
- if((patternString == null) || (patternString.equals("")) || (patternString.equals("*")))//$NON-NLS-2$//$NON-NLS-1$
- return true;
- return stringMatcher.match(label);
-}
-/**
- * The user has selected a resource and the dialog is closing.
- */
-protected void okPressed() {
- TableItem items[] = folderNames.getSelection();
- if(items.length != 1)
- selection = null;
- else
- selection = (IResource)items[0].getData();
- super.okPressed();
-}
-
-/**
- * The text in the pattern text entry has changed.
- * Create a new string matcher and start a new
- * update tread.
- */
-private void textChanged() {
- String oldPattern = patternString;
- patternString = pattern.getText().trim();
- if(!patternString.endsWith("*"))//$NON-NLS-1$
- patternString = patternString + "*";//$NON-NLS-1$
- if(patternString.equals(oldPattern))
- return;
-
- updateThread.stop = true;
- stringMatcher = new StringMatcher(patternString,true,false);
- UpdateThread oldThread = updateThread;
- updateThread = new UpdateThread();
- if(oldPattern == null ||
- (oldPattern.length() == 0) ||
- (!patternString.regionMatches(0,oldPattern,0,oldPattern.length() - 1))) {
- updateThread.firstMatch = 0;
- updateThread.lastMatch = descriptorsSize - 1;
- } else {
- updateThread.firstMatch = oldThread.firstMatch;
- updateThread.lastMatch = oldThread.lastMatch;
- }
- updateThread.start();
-}
-/**
- * A new resource has been selected. Change the contents
- * of the folder names list.
- */
-private void updateFolders(ResourceDescriptor desc) {
- folderNames.removeAll();
- for (int i = 0; i < desc.resources.size(); i++){
- TableItem newItem = new TableItem(folderNames,SWT.NONE);
- IResource r = (IResource) desc.resources.get(i);
- IResource parent = r.getParent();
- String text;
- if (parent.getType() == IResource.ROOT) {
- // XXX: Get readable name for workspace root ("Workspace"), without duplicating language-specific string here.
- text = labelProvider.getText(parent);
- }
- else {
- text = parent.getFullPath().makeRelative().toString();
- }
- newItem.setText(text);
- newItem.setImage(labelProvider.getImage(r.getParent()));
- newItem.setData(r);
- }
- folderNames.setSelection(0);
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/INavigatorHelpContextIds.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/INavigatorHelpContextIds.java
deleted file mode 100644
index 44d5920..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/INavigatorHelpContextIds.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Help context ids for the resource navigator view.
- * <p>
- * This interface contains constants only; it is not intended to be implemented
- * or extended.
- * </p>
- *
- */
-/*package*/ interface INavigatorHelpContextIds {
- public static final String PREFIX = PlatformUI.PLUGIN_ID + "."; //$NON-NLS-1$
-
- // Actions
- public static final String FILTER_SELECTION_ACTION = PREFIX + "filter_selection_action_context"; //$NON-NLS-1$
- public static final String GOTO_RESOURCE_ACTION = PREFIX + "goto_resource_action_context"; //$NON-NLS-1$
- public static final String RESOURCE_NAVIGATOR_MOVE_ACTION = PREFIX + "resource_navigator_move_action_context"; //$NON-NLS-1$
- public static final String RESOURCE_NAVIGATOR_RENAME_ACTION = PREFIX + "resource_navigator_rename_action_context"; //$NON-NLS-1$
- public static final String SHOW_IN_NAVIGATOR_ACTION = PREFIX + "show_in_navigator_action_context"; //$NON-NLS-1$
- public static final String SORT_VIEW_ACTION = PREFIX + "sort_view_action_context"; //$NON-NLS-1$
- public static final String COPY_ACTION = PREFIX + "resource_navigator_copy_action_context"; //$NON-NLS-1$
- public static final String PASTE_ACTION = PREFIX + "resource_navigator_paste_action_context"; //$NON-NLS-1$
-
-
- // Dialogs
- public static final String GOTO_RESOURCE_DIALOG = PREFIX + "goto_resource_dialog_context"; //$NON-NLS-1$
-
- // Views
- public static final String RESOURCE_VIEW = PREFIX + "resource_view_context"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/IResourceNavigator.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/IResourceNavigator.java
deleted file mode 100644
index 5015b87..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/IResourceNavigator.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.jface.viewers.TreeViewer;
-
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.views.framelist.FrameList;
-
-/**
- * This interface defines the API for the resource navigator.
- * The action groups should restrict themselves to using this API.
- *
- * @since 2.0
- */
-public interface IResourceNavigator extends IViewPart {
-
- /**
- * Returns the pattern filter.
- *
- * @return the pattern filter
- */
- ResourcePatternFilter getPatternFilter();
-
- /**
- * Returns the active working set, or <code>null<code> if none.
- *
- * @return the active working set, or <code>null<code> if none
- * @since 2.0
- */
- IWorkingSet getWorkingSet();
-
- /**
- * Returns the current sorter.
- */
- ResourceSorter getSorter();
-
- /**
- * Sets the current sorter.
- */
- void setSorter(ResourceSorter sorter);
-
- /**
- * Sets the values of the filter preference to be the
- * strings in preference values
- */
- void setFiltersPreference(String[] patterns);
-
- /**
- * Returns the viewer which shows the resource tree.
- */
- TreeViewer getViewer();
-
- /**
- * Returns the frame list for this navigator.
- */
- FrameList getFrameList();
-
- /**
- * Sets the working set for this view, or <code>null</code> to clear it.
- *
- * @param workingSet the working set, or <code>null</code> to clear it
- * @since 2.0
- */
- void setWorkingSet(IWorkingSet workingSet);
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/MainActionGroup.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/MainActionGroup.java
deleted file mode 100644
index 067b113..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/MainActionGroup.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.*;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-
-/**
- * The main action group for the navigator.
- * This contains a few actions and several subgroups.
- */
-public class MainActionGroup extends ResourceNavigatorActionGroup {
-
- protected AddBookmarkAction addBookmarkAction;
- protected AddTaskAction addTaskAction;
- protected NewWizardAction newWizardAction;
- protected PropertyDialogAction propertyDialogAction;
- protected ImportResourcesAction importAction;
- protected ExportResourcesAction exportAction;
-
- protected GotoActionGroup gotoGroup;
- protected OpenActionGroup openGroup;
- protected RefactorActionGroup refactorGroup;
- protected SortAndFilterActionGroup sortAndFilterGroup;
- protected WorkspaceActionGroup workspaceGroup;
-
- /**
- * Constructs the main action group.
- */
- public MainActionGroup(IResourceNavigator navigator) {
- super(navigator);
- makeSubGroups();
- }
-
- /**
- * Makes the actions contained directly in this action group.
- */
- protected void makeActions() {
- Shell shell = navigator.getSite().getShell();
- IWorkbench workbench = navigator.getSite().getWorkbenchWindow().getWorkbench();
- addBookmarkAction = new AddBookmarkAction(shell);
- addTaskAction = new AddTaskAction(shell);
- newWizardAction = new NewWizardAction();
- propertyDialogAction =
- new PropertyDialogAction(shell, navigator.getViewer());
- importAction = new ImportResourcesAction(workbench);
- exportAction = new ExportResourcesAction(workbench);
- }
-
- /**
- * Makes the sub action groups.
- */
- protected void makeSubGroups() {
- gotoGroup = new GotoActionGroup(navigator);
- openGroup = new OpenActionGroup(navigator);
- refactorGroup = new RefactorActionGroup(navigator);
- sortAndFilterGroup = new SortAndFilterActionGroup(navigator);
- workspaceGroup = new WorkspaceActionGroup(navigator);
- }
-
- /**
- * Extends the superclass implementation to set the context in the subgroups.
- */
- public void setContext(ActionContext context) {
- super.setContext(context);
- gotoGroup.setContext(context);
- openGroup.setContext(context);
- refactorGroup.setContext(context);
- sortAndFilterGroup.setContext(context);
- workspaceGroup.setContext(context);
- }
-
- /**
- * Fills the context menu with the actions contained in this group
- * and its subgroups.
- *
- * @param menu the context menu
- */
- public void fillContextMenu(IMenuManager menu) {
- IStructuredSelection selection =
- (IStructuredSelection) getContext().getSelection();
- boolean onlyFilesSelected =
- !selection.isEmpty()
- && ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.FILE);
-
-
- MenuManager newMenu =
- new MenuManager(ResourceNavigatorMessages.getString("ResourceNavigator.new")); //$NON-NLS-1$
- menu.add(newMenu);
- new NewWizardMenu(newMenu, navigator.getSite().getWorkbenchWindow(), false);
-
- gotoGroup.fillContextMenu(menu);
- openGroup.fillContextMenu(menu);
- menu.add(new Separator());
-
- refactorGroup.fillContextMenu(menu);
- menu.add(new Separator());
-
- menu.add(importAction);
- menu.add(exportAction);
- importAction.selectionChanged(selection);
- exportAction.selectionChanged(selection);
- menu.add(new Separator());
-
- if (onlyFilesSelected) {
- addBookmarkAction.selectionChanged(selection);
- menu.add(addBookmarkAction);
- }
- menu.add(new Separator());
-
- workspaceGroup.fillContextMenu(menu);
-
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "-end")); //$NON-NLS-1$
- menu.add(new Separator());
-
- if (selection.size() == 1) {
- propertyDialogAction.selectionChanged(selection);
- menu.add(propertyDialogAction);
- }
- }
-
- /**
- * Adds the actions in this group and its subgroups to the action bars.
- */
- public void fillActionBars(IActionBars actionBars) {
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.PROPERTIES,
- propertyDialogAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.BOOKMARK,
- addBookmarkAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.ADD_TASK,
- addTaskAction);
-
- gotoGroup.fillActionBars(actionBars);
- openGroup.fillActionBars(actionBars);
- refactorGroup.fillActionBars(actionBars);
- sortAndFilterGroup.fillActionBars(actionBars);
- workspaceGroup.fillActionBars(actionBars);
- }
-
- /**
- * Updates the actions which were added to the action bars,
- * delegating to the subgroups as necessary.
- */
- public void updateActionBars() {
- IStructuredSelection selection =
- (IStructuredSelection) getContext().getSelection();
- propertyDialogAction.setEnabled(selection.size() == 1);
- addBookmarkAction.selectionChanged(selection);
- addTaskAction.selectionChanged(selection);
-
- gotoGroup.updateActionBars();
- openGroup.updateActionBars();
- refactorGroup.updateActionBars();
- sortAndFilterGroup.updateActionBars();
- workspaceGroup.updateActionBars();
- }
-
- /**
- * Runs the default action (open file) by delegating the open group.
- */
- public void runDefaultAction(IStructuredSelection selection) {
- openGroup.runDefaultAction(selection);
- }
-
- /**
- * Handles a key pressed event by invoking the appropriate action,
- * delegating to the subgroups as necessary.
- */
- public void handleKeyPressed(KeyEvent event) {
- refactorGroup.handleKeyPressed(event);
- workspaceGroup.handleKeyPressed(event);
- }
-
- /**
- * Extends the superclass implementation to dispose the subgroups.
- */
- public void dispose() {
- gotoGroup.dispose();
- openGroup.dispose();
- refactorGroup.dispose();
- sortAndFilterGroup.dispose();
- workspaceGroup.dispose();
- super.dispose();
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorDragAdapter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorDragAdapter.java
deleted file mode 100644
index 79f605e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorDragAdapter.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.ui.actions.ReadOnlyStateChecker;
-import org.eclipse.ui.part.ResourceTransfer;
-
-/**
- * Implements drag behaviour when items are dragged out of the
- * resource navigator.
- *
- * @since 2.0
- */
-public class NavigatorDragAdapter extends DragSourceAdapter {
- ISelectionProvider selectionProvider;
-
- private static final String CHECK_MOVE_TITLE = ResourceNavigatorMessages.getString("DragAdapter.title"); //$NON-NLS-1$
- private static final String CHECK_MOVE_MESSAGE = ResourceNavigatorMessages.getString("DragAdapter.checkMoveMessage"); //$NON-NLS-1$
- private static final String CHECK_DELETE_MESSAGE = ResourceNavigatorMessages.getString("DragAdapter.checkDeleteMessage"); //$NON-NLS-1$
-
- /**
- * Constructs a new drag adapter.
- */
- public NavigatorDragAdapter(ISelectionProvider provider) {
- selectionProvider = provider;
- }
- /**
- * @see DragSourceListener#dragFinished
- */
- public void dragFinished(DragSourceEvent event) {
- if (event.doit == false) {
- return;
- }
- final int typeMask = IResource.FOLDER | IResource.FILE;
- if (event.detail == DND.DROP_MOVE) {
- IResource[] resources = getSelectedResources(typeMask);
- DragSource dragSource = (DragSource) event.widget;
- Control control = dragSource.getControl();
- Shell shell = control.getShell();
- ReadOnlyStateChecker checker;
-
- if (resources == null || resources.length == 0)
- return;
-
- checker = new ReadOnlyStateChecker(shell, CHECK_MOVE_TITLE, CHECK_DELETE_MESSAGE);
- resources = checker.checkReadOnlyResources(resources);
- //delete the old elements
- for (int i = 0; i < resources.length; i++) {
- try {
- resources[i].delete(IResource.KEEP_HISTORY | IResource.FORCE, null);
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
- } else if (event.detail == DND.DROP_TARGET_MOVE) {
- IResource[] resources = getSelectedResources(typeMask);
-
- // file moved for us by OS, no need to delete the resources, just
- // update the view
- if (resources == null)
- return;
- for (int i = 0; i < resources.length; i++) {
- try {
- resources[i].refreshLocal(IResource.DEPTH_INFINITE, null);
- } catch (CoreException e) {
- e.printStackTrace();
- }
- }
- }
- }
- /**
- * @see DragSourceListener#dragSetData
- */
- public void dragSetData(DragSourceEvent event) {
- final int typeMask = IResource.FILE | IResource.FOLDER;
- IResource[] resources = getSelectedResources(typeMask);
-
- if (resources == null || resources.length == 0)
- return;
-
- //use resource transfer if possible
- if (ResourceTransfer.getInstance().isSupportedType(event.dataType)) {
- event.data = resources;
- return;
- }
-
- //resort to a file transfer
- if (!FileTransfer.getInstance().isSupportedType(event.dataType))
- return;
-
- // Get the path of each file and set as the drag data
- final int len = resources.length;
- String[] fileNames = new String[len];
- for (int i = 0, length = len; i < length; i++) {
- fileNames[i] = resources[i].getLocation().toOSString();
- }
- event.data = fileNames;
- }
-
- /**
- * @see DragSourceListener#dragStart
- */
- public void dragStart(DragSourceEvent event) {
- // Workaround for 1GEUS9V
- DragSource dragSource = (DragSource) event.widget;
- Control control = dragSource.getControl();
- if (control != control.getDisplay().getFocusControl()) {
- event.doit = false;
- return;
- }
-
- IStructuredSelection selection =
- (IStructuredSelection) selectionProvider.getSelection();
- for (Iterator i = selection.iterator(); i.hasNext();) {
- Object next = i.next();
- if (!(next instanceof IFile || next instanceof IFolder)) {
- event.doit = false;
- return;
- }
- }
- event.doit = true;
- }
-
- private IResource[] getSelectedResources(int resourceTypes) {
- List resources = new ArrayList();
- IResource[] result = new IResource[0];
-
- ISelection selection = selectionProvider.getSelection();
- if (!(selection instanceof IStructuredSelection) || selection.isEmpty()) {
- return null;
- }
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- if (structuredSelection == null)
- return null;
-
- // loop through list and look for matching items
- Iterator enum = structuredSelection.iterator();
- while (enum.hasNext()) {
- Object obj = enum.next();
- if (obj instanceof IResource) {
- IResource res = (IResource) obj;
- if ((res.getType() & resourceTypes) == res.getType()) {
- resources.add(res);
- }
- }
- }
- result = new IResource[resources.size()];
- resources.toArray(result);
- return result;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorDropAdapter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorDropAdapter.java
deleted file mode 100644
index db8557c..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorDropAdapter.java
+++ /dev/null
@@ -1,432 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.*;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.part.PluginDropAdapter;
-import org.eclipse.ui.part.ResourceTransfer;
-
-/**
- * Implements drop behaviour for drag and drop operations
- * that land on the resource navigator.
- *
- * @since 2.0
- */
-public class NavigatorDropAdapter
- extends PluginDropAdapter
- implements IOverwriteQuery {
-
- /**
- * The time the mouse first started hovering over the current target
- */
- private long hoverStart = 0;
- /**
- * The amount of time to hover over a tree item before expanding it
- */
- private static final long hoverThreshold = 1500;
-
- /**
- * A flag indicating that the drop has been cancelled by the user.
- */
- private boolean isCanceled = false;
- /**
- * A flag indicating that overwrites should always occur.
- */
- private boolean alwaysOverwrite = false;
-
- /**
- * The selected resources if the drag and drop operation takes place
- * within the same widget.
- */
- private IResource[] sourceResources;
-
- /**
- * The last valid operation.
- */
- private int lastValidOperation = DND.DROP_NONE;
-
- /**
- * Constructs a new drop adapter.
- */
- public NavigatorDropAdapter(StructuredViewer viewer) {
- super(viewer);
- }
-
- /**
- * @see org.eclipse.swt.dnd.DropTargetListener#dragEnter(DropTargetEvent)
- */
- public void dragEnter(DropTargetEvent event) {
- if (event.getSource() == event.widget) {
- IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
- List sourceList = selection.toList();
- sourceResources = (IResource[]) sourceList.toArray(new IResource[sourceList.size()]);
- }
- else {
- sourceResources = null;
- }
- super.dragEnter(event);
- }
- /**
- * @see org.eclipse.swt.dnd.DropTargetListener#dragLeave(DropTargetEvent)
- */
- public void dragLeave(DropTargetEvent event) {
- sourceResources = null;
- super.dragLeave(event);
- }
- /**
- * @see DropTargetListener#dragOver
- */
- public void dragOver(DropTargetEvent event) {
- try {
- //this method implements the UI behaviour that when the user hovers
- //over an unexpanded tree item long enough, it will auto-expand.
- Object oldTarget = getCurrentTarget();
- super.dragOver(event);
- if (oldTarget != getCurrentTarget()) {
- hoverStart = System.currentTimeMillis();
- } else {
- //if we've been hovering over this item awhile, expand it.
- if (hoverStart > 0
- && (System.currentTimeMillis() - hoverStart) > hoverThreshold) {
- expandSelection((TreeItem) event.item);
- hoverStart = 0;
- }
- }
- } catch (Throwable t) {
- handleException(t, event);
- }
- }
-
- /**
- * Returns an error status with the given info.
- */
- private IStatus error(String message) {
- return error(message, null);
- }
-
- /**
- * Returns an error status with the given info.
- */
- private IStatus error(String message, Throwable exception) {
- return new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, message, exception);
- }
-
- /**
- * Returns an error status, indicating why the given source
- * could not be copied or moved.
- */
- private IStatus error(IResource source, String message) {
- if (getCurrentOperation() == DND.DROP_COPY) {
- return error(ResourceNavigatorMessages.format("DropAdapter.canNotCopy", new Object[] { source.getName(), message }), null); //$NON-NLS-1$
- } else {
- return error(ResourceNavigatorMessages.format("DropAdapter.canNotMove", new Object[] { source.getName(), message }), null); //$NON-NLS-1$
- }
- }
-
- /**
- * Expands the selection of the given tree viewer.
- */
- private void expandSelection(TreeItem selection) {
- if (selection == null)
- return;
- if (!selection.getExpanded()) {
- TreeViewer treeViewer = (TreeViewer) getViewer();
- treeViewer.expandToLevel(selection.getData(), 1);
- }
- }
-
- /**
- * Returns the actual target of the drop, given the resource
- * under the mouse. If the mouse target is a file, then the drop actually
- * occurs in its parent. If the drop location is before or after the
- * mouse target and feedback is enabled, the target is also the parent.
- */
- private IContainer getActualTarget(IResource mouseTarget) {
- /* if cursor is before or after mouseTarget, set target to parent */
- if (getFeedbackEnabled()) {
- if (getCurrentLocation() == LOCATION_BEFORE
- || getCurrentLocation() == LOCATION_AFTER) {
- return mouseTarget.getParent();
- }
- }
- /* if cursor is on a file, return the parent */
- if (mouseTarget.getType() == IResource.FILE) {
- return mouseTarget.getParent();
- }
- /* otherwise the mouseTarget is the real target */
- return (IContainer) mouseTarget;
- }
-
-
- /**
- * Returns the display
- */
- private Display getDisplay() {
- return getViewer().getControl().getDisplay();
- }
-
- /**
- * Returns the shell
- */
- private Shell getShell() {
- return getViewer().getControl().getShell();
- }
-
- /**
- * Returns an error status with the given info.
- */
- private IStatus info(String message) {
- return new Status(IStatus.INFO, PlatformUI.PLUGIN_ID, 0, message, null);
- }
-
- /**
- * Adds the given status to the list of problems. Discards
- * OK statuses. If the status is a multi-status, only its children
- * are added.
- */
- private void mergeStatus(MultiStatus status, IStatus toMerge) {
- if (!toMerge.isOK()) {
- status.merge(toMerge);
- }
- }
-
- /**
- * Creates a status object from the given list of problems.
- */
- private IStatus multiStatus(List problems, String message) {
- IStatus[] children = new IStatus[problems.size()];
- problems.toArray(children);
- if (children.length == 1) {
- return children[0];
- } else {
- return new MultiStatus(PlatformUI.PLUGIN_ID, 0, children, message, null);
- }
- }
-
- /**
- * Returns an status indicating success.
- */
- private IStatus ok() {
- return new Status(Status.OK, PlatformUI.PLUGIN_ID, 0, ResourceNavigatorMessages.getString("DropAdapter.ok"), null); //$NON-NLS-1$
- }
-
- /**
- * Opens an error dialog if necessary. Takes care of
- * complex rules necessary for making the error dialog look nice.
- */
- private void openError(IStatus status) {
- if (status == null)
- return;
-
- String genericTitle = ResourceNavigatorMessages.getString("DropAdapter.title"); //$NON-NLS-1$
- int codes = IStatus.ERROR | IStatus.WARNING;
-
- //simple case: one error, not a multistatus
- if (!status.isMultiStatus()) {
- ErrorDialog.openError(getShell(), genericTitle, null, status, codes);
- return;
- }
-
- //one error, single child of multistatus
- IStatus[] children = status.getChildren();
- if (children.length == 1) {
- ErrorDialog.openError(
- getShell(),
- status.getMessage(),
- null,
- children[0],
- codes);
- return;
- }
- //several problems
- ErrorDialog.openError(getShell(), genericTitle, null, status, codes);
- }
-
- /**
- * @see DropTargetListener#performDrop
- */
- public boolean performDrop(final Object data) {
- isCanceled = false;
- alwaysOverwrite = false;
- if (getCurrentTarget() == null || data == null) {
- return false;
- }
- boolean result;
- IStatus status = null;
- TransferData currentTransfer = getCurrentTransfer();
- if (ResourceTransfer.getInstance().isSupportedType(currentTransfer)) {
- if (getCurrentOperation() == DND.DROP_COPY) {
- status = performResourceCopy(getShell(), data);
- //always return false because we don't want the source to clean up
- result = false;
- }
- else {
- status = performResourceMove(data);
- //always return false because we don't want the source to clean up
- result = false;
- }
- } else if (FileTransfer.getInstance().isSupportedType(currentTransfer)) {
- status = performFileDrop(data);
- result = status.isOK();
- } else {
- result = NavigatorDropAdapter.super.performDrop(data);
- }
- openError(status);
- return result;
- }
-
- /**
- * Performs a drop using the FileTransfer transfer type.
- */
- private IStatus performFileDrop(Object data) {
- MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 0, ResourceNavigatorMessages.getString("DropAdapter.problemImporting"), null); //$NON-NLS-1$
- mergeStatus(problems, validateTarget(getCurrentTarget(), getCurrentTransfer()));
-
- final IContainer target = getActualTarget((IResource) getCurrentTarget());
- final String[] names = (String[]) data;
- // Run the import operation asynchronously.
- // Otherwise the drag source (e.g., Windows Explorer) will be blocked
- // while the operation executes. Fixes bug 16478.
- Display.getCurrent().asyncExec(new Runnable() {
- public void run() {
- getShell().forceActive();
- CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(getShell());
- operation.copyFiles(names, target);
- }
- });
- return problems;
- }
-
- /**
- * Performs a resource copy
- */
- private IStatus performResourceCopy(Shell shell, Object data) {
- MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 1, ResourceNavigatorMessages.getString("DropAdapter.problemsMoving"), null); //$NON-NLS-1$
- mergeStatus(problems, validateTarget(getCurrentTarget(), getCurrentTransfer()));
-
- IContainer target = getActualTarget((IResource) getCurrentTarget());
- IResource[] sources = (IResource[]) data;
- CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell);
- operation.copyResources(sources, target);
-
- return problems;
- }
-
- /**
- * Performs a resource move
- */
- private IStatus performResourceMove(Object data) {
- MultiStatus problems = new MultiStatus(PlatformUI.PLUGIN_ID, 1, ResourceNavigatorMessages.getString("DropAdapter.problemsMoving"), null); //$NON-NLS-1$
- mergeStatus(problems, validateTarget(getCurrentTarget(), getCurrentTransfer()));
-
- IContainer target = getActualTarget((IResource) getCurrentTarget());
- IResource[] sources = (IResource[]) data;
- ReadOnlyStateChecker checker = new ReadOnlyStateChecker(
- getShell(),
- WorkbenchMessages.getString("MoveResourceAction.title"), //$NON-NLS-1$
- WorkbenchMessages.getString("MoveResourceAction.checkMoveMessage"));//$NON-NLS-1$
- sources = checker.checkReadOnlyResources(sources);
- MoveFilesAndFoldersOperation operation = new MoveFilesAndFoldersOperation(getShell());
- operation.copyResources(sources, target);
-
- return problems;
- }
-
- /**
- * @see IOverwriteQuery#queryOverwrite
- */
- public String queryOverwrite(String pathString) {
- if (alwaysOverwrite)
- return ALL;
-
- final String returnCode[] = { CANCEL };
- final String msg = ResourceNavigatorMessages.format("DropAdapter.overwriteQuery", new Object[] { pathString }); //$NON-NLS-1$
- final String[] options =
- {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL };
- getDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog dialog = new MessageDialog(getShell(), ResourceNavigatorMessages.getString("DropAdapter.question"), null, msg, MessageDialog.QUESTION, options, 0); //$NON-NLS-1$
- dialog.open();
- int returnVal = dialog.getReturnCode();
- String[] returnCodes = { YES, ALL, NO, CANCEL };
- returnCode[0] = returnVal < 0 ? CANCEL : returnCodes[returnVal];
- }
- });
- if (returnCode[0] == ALL)
- alwaysOverwrite = true;
- return returnCode[0];
- }
-
- /**
- * This method is used to notify the action that some aspect of
- * the drop operation has changed.
- */
- public boolean validateDrop(
- Object target,
- int dragOperation,
- TransferData transferType) {
- if (dragOperation != DND.DROP_NONE) {
- lastValidOperation = dragOperation;
- }
- if (super.validateDrop(target, dragOperation, transferType)) {
- return true;
- }
- return validateTarget(target, transferType).isOK();
- }
-
- /**
- * Ensures that the drop target meets certain criteria
- */
- private IStatus validateTarget(Object target, TransferData transferType) {
- if (!(target instanceof IResource)) {
- return info(ResourceNavigatorMessages.getString("DropAdapter.targetMustBeResource")); //$NON-NLS-1$
- }
- IResource resource = (IResource) target;
- if (!resource.isAccessible()) {
- return error(ResourceNavigatorMessages.getString("DropAdapter.canNotDropIntoClosedProject")); //$NON-NLS-1$
- }
- IContainer destination = getActualTarget(resource);
- if (destination.getType() == IResource.ROOT) {
- return error(ResourceNavigatorMessages.getString("DropAdapter.resourcesCanNotBeSiblings")); //$NON-NLS-1$
- }
- String message = null;
- // file import?
- if (FileTransfer.getInstance().isSupportedType(transferType)) {
- String[] sourceNames = (String[]) FileTransfer.getInstance().nativeToJava(transferType);
- CopyFilesAndFoldersOperation copyOperation = new CopyFilesAndFoldersOperation(getShell());
- message = copyOperation.validateImportDestination(destination, sourceNames);
- } // drag within same viewer?
- else if (sourceResources != null) {
- CopyFilesAndFoldersOperation operation;
- if (lastValidOperation == DND.DROP_COPY) {
- operation = new CopyFilesAndFoldersOperation(getShell());
- }
- else {
- operation = new MoveFilesAndFoldersOperation(getShell());
- }
- message = operation.validateDestination(destination, sourceResources);
- }
- if (message != null) {
- return error(message);
- }
- return ok();
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorFrameSource.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorFrameSource.java
deleted file mode 100644
index d902dcb..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorFrameSource.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.views.framelist.TreeFrame;
-import org.eclipse.ui.views.framelist.TreeViewerFrameSource;
-
-/**
- * Frame source for the resource navigator.
- */
-public class NavigatorFrameSource extends TreeViewerFrameSource {
-
- private ResourceNavigator navigator;
-
-/**
- * Constructs a new frame source for the specified resource navigator.
- *
- * @param navigator the resource navigator
- */
-public NavigatorFrameSource(ResourceNavigator navigator) {
- super(navigator.getTreeViewer());
- this.navigator = navigator;
-}
-
-/**
- * Returns a new frame. This implementation extends the super implementation
- * by setting the frame's tool tip text to show the full path for the input
- * element.
- */
-protected TreeFrame createFrame(Object input) {
- TreeFrame frame = super.createFrame(input);
- frame.setName(navigator.getFrameName(input));
- frame.setToolTipText(navigator.getFrameToolTipText(input));
- return frame;
-}
-
-/**
- * Also updates the navigator's title.
- */
-protected void frameChanged(TreeFrame frame) {
- super.frameChanged(frame);
- navigator.updateTitle();
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/OpenActionGroup.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/OpenActionGroup.java
deleted file mode 100644
index 7fadcaf..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/OpenActionGroup.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import org.eclipse.core.resources.*;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.*;
-
-/**
- * This is the action group for the open actions.
- */
-public class OpenActionGroup extends ResourceNavigatorActionGroup {
-
- private OpenFileAction openFileAction;
-
- /**
- * The id for the Open With submenu.
- */
- public static final String OPEN_WITH_ID = PlatformUI.PLUGIN_ID + ".OpenWithSubMenu"; //$NON-NLS-1$
-
- public OpenActionGroup(IResourceNavigator navigator) {
- super(navigator);
- }
-
- protected void makeActions() {
- openFileAction = new OpenFileAction(navigator.getSite().getPage());
- }
-
- public void fillContextMenu(IMenuManager menu) {
- IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
-
- boolean anyResourceSelected =
- !selection.isEmpty()
- && ResourceSelectionUtil.allResourcesAreOfType(
- selection,
- IResource.PROJECT | IResource.FOLDER | IResource.FILE);
- boolean onlyFilesSelected =
- !selection.isEmpty() && ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.FILE);
-
- if (onlyFilesSelected) {
- openFileAction.selectionChanged(selection);
- menu.add(openFileAction);
- fillOpenWithMenu(menu, selection);
- }
-
- if (anyResourceSelected) {
- addNewWindowAction(menu, selection);
- }
- }
-
- /**
- * Adds the OpenWith submenu to the context menu.
- *
- * @param menu the context menu
- * @param selection the current selection
- */
- private void fillOpenWithMenu(IMenuManager menu, IStructuredSelection selection) {
-
- // Only supported if exactly one file is selected.
- if (selection.size() != 1)
- return;
- Object element = selection.getFirstElement();
- if (!(element instanceof IFile))
- return;
-
- MenuManager submenu =
- new MenuManager(ResourceNavigatorMessages.getString("ResourceNavigator.openWith"), OPEN_WITH_ID); //$NON-NLS-1$
- submenu.add(new OpenWithMenu(navigator.getSite().getPage(), (IFile) element));
- menu.add(submenu);
- }
-
- /**
- * Adds the Open in New Window action to the context menu.
- *
- * @param menu the context menu
- * @param selection the current selection
- */
- private void addNewWindowAction(IMenuManager menu, IStructuredSelection selection) {
-
- // Only supported if exactly one container (i.e open project or folder) is selected.
- if (selection.size() != 1)
- return;
- Object element = selection.getFirstElement();
- if (!(element instanceof IContainer))
- return;
- if (element instanceof IProject && !(((IProject)element).isOpen()))
- return;
-
- menu.add(new OpenInNewWindowAction(navigator.getSite().getWorkbenchWindow(), (IContainer) element));
- }
-
- /**
- * Runs the default action (open file).
- */
- public void runDefaultAction(IStructuredSelection selection) {
- Object element = selection.getFirstElement();
- if (element instanceof IFile) {
- openFileAction.selectionChanged(selection);
- openFileAction.run();
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/PasteAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/PasteAction.java
deleted file mode 100644
index f45b92a..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/PasteAction.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.*;
-import org.eclipse.ui.actions.SelectionListenerAction;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.ResourceTransfer;
-
-/**
- * Standard action for pasting resources on the clipboard to the selected resource's location.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- *
- * @since 2.0
- */
-/*package*/ class PasteAction extends SelectionListenerAction {
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".PasteAction";//$NON-NLS-1$
-
- /**
- * The shell in which to show any dialogs.
- */
- private Shell shell;
-
- /**
- * System clipboard
- */
- private Clipboard clipboard;
-
-/**
- * Creates a new action.
- *
- * @param shell the shell for any dialogs
- */
-public PasteAction(Shell shell, Clipboard clipboard) {
- super(ResourceNavigatorMessages.getString("PasteAction.title")); //$NON-NLS-1$
- Assert.isNotNull(shell);
- Assert.isNotNull(clipboard);
- this.shell = shell;
- this.clipboard = clipboard;
- setToolTipText(ResourceNavigatorMessages.getString("PasteAction.toolTip")); //$NON-NLS-1$
- setId(PasteAction.ID);
- WorkbenchHelp.setHelp(this, INavigatorHelpContextIds.PASTE_ACTION);
-}
-/**
- * Implementation of method defined on <code>IAction</code>.
- */
-public void run() {
- // try a resource transfer
- ResourceTransfer resTransfer = ResourceTransfer.getInstance();
- IResource[] resourceData = (IResource[])clipboard.getContents(resTransfer);
-
- if (resourceData != null) {
- if (resourceData[0].getType() == IResource.PROJECT){
- CopyProjectOperation operation = new CopyProjectOperation(this.shell);
- operation.copyProject((IProject) resourceData[0]);
- } else {
- // enablement should ensure that we always have access to a container
- IContainer container = getContainer();
-
- CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(this.shell);
- operation.copyResources(resourceData, container);
- }
- return;
- }
-
- // try a file transfer
- FileTransfer fileTransfer = FileTransfer.getInstance();
- String[] fileData = (String[])clipboard.getContents(fileTransfer);
-
- if (fileData != null) {
- // enablement should ensure that we always have access to a container
- IContainer container = getContainer();
-
- CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(this.shell);
- operation.copyFiles(fileData, container);
- }
-}
-
-/**
- * Returns the container to hold the pasted resources.
- */
-private IContainer getContainer() {
- List selection = getSelectedResources();
- if (selection.get(0) instanceof IFile)
- return ((IFile)selection.get(0)).getParent();
- else
- return (IContainer)selection.get(0);
-}
-
-/**
- * The <code>PasteAction</code> implementation of this
- * <code>SelectionListenerAction</code> method enables this action if
- * a resource compatible with what is on the clipboard is selected.
- */
-protected boolean updateSelection(IStructuredSelection selection) {
- if (!super.updateSelection(selection))
- return false;
-
- // clipboard must have resources or files
- ResourceTransfer resTransfer = ResourceTransfer.getInstance();
- IResource[] resourceData = (IResource[])clipboard.getContents(resTransfer);
- FileTransfer fileTransfer = FileTransfer.getInstance();
- String[] fileData = (String[])clipboard.getContents(fileTransfer);
- if (resourceData == null && fileData == null)
- return false;
-
- // can paste an open project regardless of selection
- if (resourceData != null
- && resourceData.length == 1
- && resourceData[0].getType() == IResource.PROJECT) {
- if (((IProject)resourceData[0]).isOpen())
- return true;
- else
- return false;
- }
-
- // can paste files and folders to a single selection (project must be open)
- // or multiple file selection with the same parent
- if (getSelectedNonResources().size() > 0)
- return false;
- List selectedResources = getSelectedResources();
- IResource targetResource = null;
- if (selectedResources.size() == 1) {
- targetResource = (IResource)selectedResources.get(0);
- if (targetResource instanceof IProject && !((IProject)targetResource).isOpen())
- return false;
- } else if (selectedResources.size() > 1) {
- for (int i = 0; i < selectedResources.size(); i++) {
- IResource resource = (IResource)selectedResources.get(i);
- if (resource.getType() != IResource.FILE)
- return false;
- if (targetResource == null)
- targetResource = resource.getParent();
- else if (!targetResource.equals(resource.getParent()))
- return false;
- }
- } else {
- // no selection
- return false;
- }
- if (targetResource != null &&
- targetResource.getType() == IResource.FOLDER &&
- resourceData != null) {
- // don't try to copy folder to self
- for (int i = 0; i < resourceData.length; i++) {
- if (targetResource.equals(resourceData[i]))
- return false;
- }
- }
- return true;
-}
-
-}
-
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/RefactorActionGroup.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/RefactorActionGroup.java
deleted file mode 100644
index daf5cfd..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/RefactorActionGroup.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.DeleteResourceAction;
-import org.eclipse.ui.actions.TextActionHandler;
-
-/**
- * This is the action group for refactor actions,
- * including global action handlers for copy, paste and delete.
- *
- * @since 2.0
- */
-public class RefactorActionGroup extends ResourceNavigatorActionGroup {
- private Clipboard clipboard;
-
- private CopyAction copyAction;
- private DeleteResourceAction deleteAction;
- private PasteAction pasteAction;
- private ResourceNavigatorRenameAction renameAction;
- private ResourceNavigatorMoveAction moveAction;
- private TextActionHandler textActionHandler;
-
- public RefactorActionGroup(IResourceNavigator navigator) {
- super(navigator);
- }
-
- protected void makeActions() {
- TreeViewer treeViewer = (TreeViewer) navigator.getViewer();
- Shell shell = navigator.getSite().getShell();
- clipboard = new Clipboard(shell.getDisplay());
- pasteAction = new PasteAction(shell, clipboard);
- copyAction = new CopyAction(shell, clipboard, pasteAction);
- moveAction = new ResourceNavigatorMoveAction(shell, treeViewer);
- renameAction = new ResourceNavigatorRenameAction(shell, treeViewer);
- deleteAction = new DeleteResourceAction(shell);
- }
-
- public void fillContextMenu(IMenuManager menu) {
- IStructuredSelection selection =
- (IStructuredSelection) getContext().getSelection();
-
- boolean anyResourceSelected =
- !selection.isEmpty()
- && ResourceSelectionUtil.allResourcesAreOfType(
- selection,
- IResource.PROJECT | IResource.FOLDER | IResource.FILE);
-
- copyAction.selectionChanged(selection);
- menu.add(copyAction);
- pasteAction.selectionChanged(selection);
- menu.add(pasteAction);
-
- if (anyResourceSelected) {
- deleteAction.selectionChanged(selection);
- menu.add(deleteAction);
- moveAction.selectionChanged(selection);
- menu.add(moveAction);
- renameAction.selectionChanged(selection);
- menu.add(renameAction);
- }
- }
-
- public void fillActionBars(IActionBars actionBars) {
- textActionHandler = new TextActionHandler(actionBars); // hooks handlers
- textActionHandler.setCopyAction(copyAction);
- textActionHandler.setPasteAction(pasteAction);
- textActionHandler.setDeleteAction(deleteAction);
- renameAction.setTextActionHandler(textActionHandler);
-
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.MOVE, moveAction);
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.RENAME, renameAction);
- }
-
- public void updateActionBars() {
- IStructuredSelection selection =
- (IStructuredSelection) getContext().getSelection();
-
- copyAction.selectionChanged(selection);
- pasteAction.selectionChanged(selection);
- deleteAction.selectionChanged(selection);
- moveAction.selectionChanged(selection);
- renameAction.selectionChanged(selection);
- }
-
- /**
- * Handles a key pressed event by invoking the appropriate action.
- */
- public void handleKeyPressed(KeyEvent event) {
- if (event.character == SWT.DEL && event.stateMask == 0) {
- if (deleteAction.isEnabled()) {
- deleteAction.run();
- }
- }
- else if (event.keyCode == SWT.F2 && event.stateMask == 0) {
- if (renameAction.isEnabled()) {
- renameAction.run();
- }
- }
- }
-
- public void dispose() {
- if (clipboard != null) {
- clipboard.dispose();
- clipboard = null;
- }
- super.dispose();
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigator.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigator.java
deleted file mode 100644
index 9bc7f0e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigator.java
+++ /dev/null
@@ -1,1014 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.*;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.views.framelist.FrameList;
-
-/**
- * Implements the Resource Navigator view.
- */
-public class ResourceNavigator
- extends ViewPart
- implements ISetSelectionTarget, IResourceNavigator {
-
- private TreeViewer viewer;
- private IDialogSettings settings;
- private IMemento memento;
- private FrameList frameList;
- private ResourceNavigatorActionGroup actionGroup;
- private ResourcePatternFilter patternFilter = new ResourcePatternFilter();
- private ResourceWorkingSetFilter workingSetFilter =
- new ResourceWorkingSetFilter();
-
- /** Settings constant for sort order. */
- private static final String STORE_SORT_TYPE = "ResourceViewer.STORE_SORT_TYPE"; //$NON-NLS-1$
-
- /** Settings constant for working set. */
- private static final String STORE_WORKING_SET = "ResourceWorkingSetFilter.STORE_WORKING_SET"; //$NON-NLS-1$
-
- /**
- * @deprecated No longer used but preserved to avoid an api change.
- */
- public static final String NAVIGATOR_VIEW_HELP_ID =
- INavigatorHelpContextIds.RESOURCE_VIEW;
-
- /**
- * Preference name constant for linking editor switching to navigator selection.
- *
- * [Issue: We're cheating here, by referencing a preference which is actually defined
- * on the Workbench's preference page. The Navigator should eventually have its own
- * preference page with this preference on it, instead of on the Workbench's.
- * The value must be the same as IWorkbenchPreferenceConstants.LINK_NAVIGATOR_TO_EDITOR.]
- */
- private static final String LINK_NAVIGATOR_TO_EDITOR = "LINK_NAVIGATOR_TO_EDITOR"; //$NON-NLS-1$
-
- // Persistance tags.
- private static final String TAG_SORTER = "sorter"; //$NON-NLS-1$
- private static final String TAG_FILTERS = "filters"; //$NON-NLS-1$
- private static final String TAG_FILTER = "filter"; //$NON-NLS-1$
- private static final String TAG_SELECTION = "selection"; //$NON-NLS-1$
- private static final String TAG_EXPANDED = "expanded"; //$NON-NLS-1$
- private static final String TAG_ELEMENT = "element"; //$NON-NLS-1$
- private static final String TAG_IS_ENABLED = "isEnabled"; //$NON-NLS-1$
- private static final String TAG_PATH = "path"; //$NON-NLS-1$
-
- private IPartListener partListener = new IPartListener() {
- public void partActivated(IWorkbenchPart part) {
- if (part instanceof IEditorPart)
- editorActivated((IEditorPart) part);
- }
- public void partBroughtToTop(IWorkbenchPart part) {
- }
- public void partClosed(IWorkbenchPart part) {
- }
- public void partDeactivated(IWorkbenchPart part) {
- }
- public void partOpened(IWorkbenchPart part) {
- }
- };
-
- private IPropertyChangeListener propertyChangeListener =
- new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- Object newValue = event.getNewValue();
- Object oldValue = event.getOldValue();
- IWorkingSet filterWorkingSet = workingSetFilter.getWorkingSet();
-
- if (IWorkingSetManager.CHANGE_WORKING_SET_REMOVE.equals(property)
- && oldValue == filterWorkingSet) {
- setWorkingSet(null);
- } else if (
- IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE.equals(property)
- && newValue == filterWorkingSet) {
- updateTitle();
- } else if (
- IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE.equals(property)
- && newValue == filterWorkingSet) {
- getViewer().refresh();
- }
- }
- };
-
- /**
- * Constructs a new resource navigator view.
- */
- public ResourceNavigator() {
- IDialogSettings workbenchSettings = getPlugin().getDialogSettings();
- settings = workbenchSettings.getSection("ResourceNavigator"); //$NON-NLS-1$
- if (settings == null)
- settings = workbenchSettings.addNewSection("ResourceNavigator"); //$NON-NLS-1$
- }
-
- /**
- * Converts the given selection into a form usable by the viewer,
- * where the elements are resources.
- */
- private StructuredSelection convertSelection(ISelection selection) {
- ArrayList list = new ArrayList();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ssel = (IStructuredSelection) selection;
- for (Iterator i = ssel.iterator(); i.hasNext();) {
- Object o = i.next();
- IResource resource = null;
- if (o instanceof IResource) {
- resource = (IResource) o;
- } else {
- if (o instanceof IAdaptable) {
- resource = (IResource) ((IAdaptable) o).getAdapter(IResource.class);
- }
- }
- if (resource != null) {
- list.add(resource);
- }
- }
- }
- return new StructuredSelection(list);
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
- public void createPartControl(Composite parent) {
- TreeViewer viewer = createViewer(parent);
- this.viewer = viewer;
-
- if (memento != null)
- restoreFilters();
- frameList = createFrameList();
- initDragAndDrop();
- updateTitle();
-
- initContextMenu();
-
- makeActions();
- initResourceSorter();
- initWorkingSetFilter();
-
- viewer.setInput(getInitialInput());
-
- // Fill the action bars and update the global action handlers'
- // enabled state to match the current selection.
- getActionGroup().fillActionBars(getViewSite().getActionBars());
- updateActionBars((IStructuredSelection) viewer.getSelection());
-
- getSite().setSelectionProvider(viewer);
- getSite().getPage().addPartListener(partListener);
- IWorkingSetManager workingSetManager =
- getPlugin().getWorkbench().getWorkingSetManager();
- workingSetManager.addPropertyChangeListener(propertyChangeListener);
-
- if (memento != null)
- restoreState(memento);
- memento = null;
-
- // Set help for the view
- WorkbenchHelp.setHelp(viewer.getControl(), getHelpContextId());
- }
-
- /**
- * Returns the help context id to use for this view.
- *
- * @since 2.0
- */
- protected String getHelpContextId() {
- return INavigatorHelpContextIds.RESOURCE_VIEW;
- }
-
- /**
- * Initializes and registers the context menu.
- *
- * @since 2.0
- */
- protected void initContextMenu() {
- MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- ResourceNavigator.this.fillContextMenu(manager);
- }
- });
- TreeViewer viewer = getTreeViewer();
- Menu menu = menuMgr.createContextMenu(viewer.getTree());
- viewer.getTree().setMenu(menu);
- getSite().registerContextMenu(menuMgr, viewer);
- }
-
- /**
- * Creates the viewer.
- *
- * @param parent the parent composite
- * @since 2.0
- */
- protected TreeViewer createViewer(Composite parent) {
- TreeViewer viewer =
- new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- viewer.setUseHashlookup(true);
- initContentProvider(viewer);
- initLabelProvider(viewer);
- initFilters(viewer);
- initListeners(viewer);
-
- return viewer;
- }
-
- /**
- * Sets the content provider for the viewer.
- *
- * @param viewer the viewer
- * @since 2.0
- */
- protected void initContentProvider(TreeViewer viewer) {
- viewer.setContentProvider(new WorkbenchContentProvider());
- }
-
- /**
- * Sets the label provider for the viewer.
- *
- * @param viewer the viewer
- * @since 2.0
- */
- protected void initLabelProvider(TreeViewer viewer) {
- viewer.setLabelProvider(
- new DecoratingLabelProvider(
- new WorkbenchLabelProvider(),
- getPlugin().getWorkbench().getDecoratorManager().getLabelDecorator()));
- }
-
- /**
- * Adds the filters to the viewer.
- *
- * @param viewer the viewer
- * @since 2.0
- */
- protected void initFilters(TreeViewer viewer) {
- viewer.addFilter(patternFilter);
- viewer.addFilter(workingSetFilter);
- }
-
- /**
- * Adds the listeners to the viewer.
- *
- * @param viewer the viewer
- * @since 2.0
- */
- protected void initListeners(TreeViewer viewer) {
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChanged(event);
- }
- });
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClick(event);
- }
- });
- viewer.addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- handleOpen(event);
- }
- });
- viewer.getControl().addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent event) {
- handleKeyPressed(event);
- }
- public void keyReleased(KeyEvent event) {
- handleKeyReleased(event);
- }
- });
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
- public void dispose() {
- getSite().getPage().removePartListener(partListener);
-
- IWorkingSetManager workingSetManager =
- getPlugin().getWorkbench().getWorkingSetManager();
- workingSetManager.removePropertyChangeListener(propertyChangeListener);
-
- if (getActionGroup() != null) {
- getActionGroup().dispose();
- }
- super.dispose();
- }
-
- /**
- * An editor has been activated. Sets the selection in this navigator
- * to be the editor's input, if linking is enabled.
- *
- * @since 2.0
- */
- protected void editorActivated(IEditorPart editor) {
- if (!isLinkingEnabled())
- return;
-
- IEditorInput input = editor.getEditorInput();
- if (input instanceof IFileEditorInput) {
- IFileEditorInput fileInput = (IFileEditorInput) input;
- IFile file = fileInput.getFile();
- ISelection newSelection = new StructuredSelection(file);
- if (!getTreeViewer().getSelection().equals(newSelection)) {
- getTreeViewer().setSelection(newSelection);
- }
- }
-
- }
-
- /**
- * Called when the context menu is about to open.
- * Delegates to the action group using the viewer's selection as the action context.
- * @since 2.0
- */
- protected void fillContextMenu(IMenuManager menu) {
- IStructuredSelection selection =
- (IStructuredSelection) getViewer().getSelection();
- getActionGroup().setContext(new ActionContext(selection));
- getActionGroup().fillContextMenu(menu);
- }
-
- /**
- * @see IResourceNavigatorPart
- * @since 2.0
- */
- public FrameList getFrameList() {
- return frameList;
- }
-
- /**
- * Returns the initial input for the viewer.
- * Tries to convert the page input to a resource, either directly or via IAdaptable.
- * If the resource is a container, it uses that.
- * If the resource is a file, it uses its parent folder.
- * If a resource could not be obtained, it uses the workspace root.
- *
- * @since 2.0
- */
- protected IAdaptable getInitialInput() {
- IAdaptable input = getSite().getPage().getInput();
- if (input != null) {
- IResource resource = null;
- if (input instanceof IResource) {
- resource = (IResource) input;
- } else {
- resource = (IResource) input.getAdapter(IResource.class);
- }
- if (resource != null) {
- switch (resource.getType()) {
- case IResource.FILE :
- return resource.getParent();
- case IResource.FOLDER :
- case IResource.PROJECT :
- case IResource.ROOT :
- return (IContainer) resource;
- default :
- // Unknown resource type. Fall through.
- break;
- }
- }
- }
- return ResourcesPlugin.getWorkspace().getRoot();
- }
-
- /**
- * Returns the pattern filter for this view.
- *
- * @return the pattern filter
- * @since 2.0
- */
- public ResourcePatternFilter getPatternFilter() {
- return this.patternFilter;
- }
-
- /**
- * Returns the working set for this view.
- *
- * @return the working set
- * @since 2.0
- */
- public IWorkingSet getWorkingSet() {
- return workingSetFilter.getWorkingSet();
- }
-
- /**
- * Returns the navigator's plugin.
- */
- public AbstractUIPlugin getPlugin() {
- return (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- }
-
- /**
- * Returns the sorter.
- * @since 2.0
- */
- public ResourceSorter getSorter() {
- return (ResourceSorter) getTreeViewer().getSorter();
- }
-
- /**
- * Returns the resource viewer which shows the resource hierarchy.
- * @since 2.0
- */
- public TreeViewer getViewer() {
- return viewer;
- }
-
- /**
- * Returns the tree viewer which shows the resource hierarchy.
- * @since 2.0
- */
- public TreeViewer getTreeViewer() {
- return viewer;
- }
-
- /**
- * Returns the shell to use for opening dialogs.
- * Used in this class, and in the actions.
- *
- * @deprecated use getViewSite().getShell()
- */
- public Shell getShell() {
- return getViewSite().getShell();
- }
-
- /**
- * Returns the message to show in the status line.
- *
- * @param selection the current selection
- * @return the status line message
- * @since 2.0
- */
- protected String getStatusLineMessage(IStructuredSelection selection) {
- if (selection.size() == 1) {
- Object o = selection.getFirstElement();
- if (o instanceof IResource) {
- return ((IResource) o).getFullPath().makeRelative().toString();
- } else {
- return ResourceNavigatorMessages.getString("ResourceNavigator.oneItemSelected"); //$NON-NLS-1$
- }
- }
- if (selection.size() > 1) {
- return ResourceNavigatorMessages.format("ResourceNavigator.statusLine", //$NON-NLS-1$
- new Object[] { new Integer(selection.size())});
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Returns the name for the given element.
- * Used as the name for the current frame.
- */
- String getFrameName(Object element) {
- if (element instanceof IResource) {
- return ((IResource) element).getName();
- } else {
- return ((ILabelProvider) getTreeViewer().getLabelProvider()).getText(element);
- }
- }
-
- /**
- * Returns the tool tip text for the given element.
- * Used as the tool tip text for the current frame, and for the view title tooltip.
- */
- String getFrameToolTipText(Object element) {
- if (element instanceof IResource) {
- IPath path = ((IResource) element).getFullPath();
- if (path.isRoot()) {
- return ResourceNavigatorMessages.getString("ResourceManager.toolTip"); //$NON-NLS-1$
- } else {
- return path.makeRelative().toString();
- }
- } else {
- return ((ILabelProvider) getTreeViewer().getLabelProvider()).getText(element);
- }
- }
-
- /**
- * Handles an open event from the viewer.
- * Opens an editor on the selected file.
- *
- * @param event the open event
- * @since 2.0
- */
- protected void handleOpen(OpenEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- getActionGroup().runDefaultAction(selection);
- }
-
- /**
- * Handles a double-click event from the viewer.
- * Expands or collapses a folder when double-clicked.
- *
- * @param event the double-click event
- * @since 2.0
- */
- protected void handleDoubleClick(DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- Object element = selection.getFirstElement();
-
- // 1GBZIA0: ITPUI:WIN2000 - Double-clicking in navigator should expand/collapse containers
- TreeViewer viewer = getTreeViewer();
- if (viewer.isExpandable(element)) {
- viewer.setExpandedState(element, !viewer.getExpandedState(element));
- }
-
- }
-
- /**
- * Handles a selection changed event from the viewer.
- * Updates the status line and the action bars, and links to editor (if option enabled).
- *
- * @param event the selection event
- * @since 2.0
- */
- protected void handleSelectionChanged(SelectionChangedEvent event) {
- IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- updateStatusLine(sel);
- updateActionBars(sel);
- linkToEditor(sel);
- }
-
- /**
- * Handles a key press event from the viewer.
- * Delegates to the action group.
- *
- * @param event the key event
- * @since 2.0
- */
- protected void handleKeyPressed(KeyEvent event) {
- getActionGroup().handleKeyPressed(event);
- }
-
- /**
- * Handles a key release in the viewer. Does nothing by default.
- *
- * @param event the key event
- * @since 2.0
- */
- protected void handleKeyReleased(KeyEvent event) {
- }
-
- /* (non-Javadoc)
- * Method declared on IViewPart.
- */
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- this.memento = memento;
- }
-
- /**
- * Adds drag and drop support to the navigator.
- *
- * @since 2.0
- */
- protected void initDragAndDrop() {
- int ops = DND.DROP_COPY | DND.DROP_MOVE;
- Transfer[] transfers =
- new Transfer[] {
- ResourceTransfer.getInstance(),
- FileTransfer.getInstance(),
- PluginTransfer.getInstance()};
- TreeViewer viewer = getTreeViewer();
- viewer.addDragSupport(
- ops,
- transfers,
- new NavigatorDragAdapter((ISelectionProvider) viewer));
- NavigatorDropAdapter adapter = new NavigatorDropAdapter(viewer);
- adapter.setFeedbackEnabled(false);
- viewer.addDropSupport(ops | DND.DROP_DEFAULT, transfers, adapter);
- }
-
- /**
- * Creates the frame source and frame list, and connects them.
- *
- * @since 2.0
- */
- protected FrameList createFrameList() {
- NavigatorFrameSource frameSource = new NavigatorFrameSource(this);
- FrameList frameList = new FrameList(frameSource);
- frameSource.connectTo(frameList);
- return frameList;
- }
-
- /**
- * Initializes the sorter.
- */
- protected void initResourceSorter() {
- int sortType = ResourceSorter.NAME;
- try {
- int sortInt = 0;
- if (memento != null) {
- String sortStr = memento.getString(TAG_SORTER);
- if (sortStr != null)
- sortInt = new Integer(sortStr).intValue();
- } else {
- sortInt = settings.getInt(STORE_SORT_TYPE);
- }
- if (sortInt == ResourceSorter.NAME || sortInt == ResourceSorter.TYPE)
- sortType = sortInt;
- } catch (NumberFormatException e) {
- }
- setSorter(new ResourceSorter(sortType));
- }
-
- /**
- * Restores the working set filter from the persistence store.
- */
- void initWorkingSetFilter() {
- String workingSetName = settings.get(STORE_WORKING_SET);
-
- if (workingSetName != null && workingSetName.equals("") == false) {
- IWorkingSetManager workingSetManager =
- getPlugin().getWorkbench().getWorkingSetManager();
- IWorkingSet workingSet = workingSetManager.getWorkingSet(workingSetName);
-
- if (workingSet != null) {
- setWorkingSet(workingSet);
- }
- }
- }
-
- /**
- * Returns whether the preference to link navigator selection to active editor is enabled.
- *
- * @since 2.0
- */
- protected boolean isLinkingEnabled() {
- return WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean(LINK_NAVIGATOR_TO_EDITOR);
- }
-
- /**
- * Links to editor (if option enabled).
- *
- * @since 2.0
- */
- protected void linkToEditor(IStructuredSelection selection) {
- if (!isLinkingEnabled())
- return;
-
- Object obj = selection.getFirstElement();
- if (obj instanceof IFile && selection.size() == 1) {
- IFile file = (IFile) obj;
- IWorkbenchPage page = getSite().getPage();
- //Using internal WorkbenchPage. Must change.
- IEditorPart editor = page.findEditor(new FileEditorInput(file));
- if(editor != null) {
- page.bringToTop(editor);
- return;
- }
- }
- }
-
- /**
- * Creates the action group, which encapsulates all actions for the view.
- */
- protected void makeActions() {
- setActionGroup(new MainActionGroup(this));
- }
-
- /**
- * Restores the saved filter settings.
- */
- private void restoreFilters() {
- IMemento filtersMem = memento.getChild(TAG_FILTERS);
-
- if (filtersMem != null) { //filters have been defined
- IMemento children[] = filtersMem.getChildren(TAG_FILTER);
-
- // check if first element has new tag defined, indicates new version
- if (children[0].getString(TAG_IS_ENABLED) != null) {
- ArrayList selectedFilters = new ArrayList();
- ArrayList unSelectedFilters = new ArrayList();
- for (int i = 0; i < children.length; i++) {
- if (children[i].getString(TAG_IS_ENABLED).equals(String.valueOf(true)))
- selectedFilters.add(children[i].getString(TAG_ELEMENT));
- else //enabled == false
- unSelectedFilters.add(children[i].getString(TAG_ELEMENT));
- }
-
- /* merge filters from Memento with selected = true filters from plugins
- * ensure there are no duplicates & don't override user preferences */
- List pluginFilters = FiltersContentProvider.getDefaultFilters();
- for (Iterator iter = pluginFilters.iterator(); iter.hasNext();) {
- String element = (String) iter.next();
- if (!selectedFilters.contains(element) && !unSelectedFilters.contains(element))
- selectedFilters.add(element);
- }
-
- //Convert to an array of Strings
- String[] patternArray = new String[selectedFilters.size()];
- selectedFilters.toArray(patternArray);
- getPatternFilter().setPatterns(patternArray);
-
- } else { //filters defined, old version: ignore filters from plugins
- String filters[] = new String[children.length];
- for (int i = 0; i < children.length; i++) {
- filters[i] = children[i].getString(TAG_ELEMENT);
- }
- getPatternFilter().setPatterns(filters);
- }
- } else { //no filters defined, old version: ignore filters from plugins
- getPatternFilter().setPatterns(new String[0]);
- }
- }
-
- /**
- * Restores the state of the receiver to the state described in the specified memento.
- *
- * @param memento the memento
- * @since 2.0
- */
- protected void restoreState(IMemento memento) {
- TreeViewer viewer = getTreeViewer();
- IContainer container = ResourcesPlugin.getWorkspace().getRoot();
- IMemento childMem = memento.getChild(TAG_EXPANDED);
- if (childMem != null) {
- ArrayList elements = new ArrayList();
- IMemento[] elementMem = childMem.getChildren(TAG_ELEMENT);
- for (int i = 0; i < elementMem.length; i++) {
- Object element = container.findMember(elementMem[i].getString(TAG_PATH));
- elements.add(element);
- }
- viewer.setExpandedElements(elements.toArray());
- }
- childMem = memento.getChild(TAG_SELECTION);
- if (childMem != null) {
- ArrayList list = new ArrayList();
- IMemento[] elementMem = childMem.getChildren(TAG_ELEMENT);
- for (int i = 0; i < elementMem.length; i++) {
- Object element = container.findMember(elementMem[i].getString(TAG_PATH));
- list.add(element);
- }
- viewer.setSelection(new StructuredSelection(list));
- }
- }
-
- /**
- * @see ViewPart#saveState
- */
- public void saveState(IMemento memento) {
- TreeViewer viewer = getTreeViewer();
- if (viewer == null) {
- if (this.memento != null) //Keep the old state;
- memento.putMemento(this.memento);
- return;
- }
-
- //save sorter
- memento.putInteger(TAG_SORTER, getSorter().getCriteria());
-
- //save filters
- String filters[] = getPatternFilter().getPatterns();
- List selectedFilters = Arrays.asList(filters);
- List allFilters = FiltersContentProvider.getDefinedFilters();
- IMemento filtersMem = memento.createChild(TAG_FILTERS);
- for (Iterator iter = allFilters.iterator(); iter.hasNext();) {
- String element = (String) iter.next();
- IMemento child = filtersMem.createChild(TAG_FILTER);
- child.putString(TAG_ELEMENT, element);
- child.putString(TAG_IS_ENABLED, String.valueOf(selectedFilters.contains(element)));
- }
-
- //save visible expanded elements
- Object expandedElements[] = viewer.getVisibleExpandedElements();
- if (expandedElements.length > 0) {
- IMemento expandedMem = memento.createChild(TAG_EXPANDED);
- for (int i = 0; i < expandedElements.length; i++) {
- IMemento elementMem = expandedMem.createChild(TAG_ELEMENT);
- elementMem.putString(
- TAG_PATH,
- ((IResource) expandedElements[i]).getFullPath().toString());
- }
- }
-
- //save selection
- Object elements[] = ((IStructuredSelection) viewer.getSelection()).toArray();
- if (elements.length > 0) {
- IMemento selectionMem = memento.createChild(TAG_SELECTION);
- for (int i = 0; i < elements.length; i++) {
- IMemento elementMem = selectionMem.createChild(TAG_ELEMENT);
- elementMem.putString(
- TAG_PATH,
- ((IResource) elements[i]).getFullPath().toString());
- }
- }
- }
-
- /**
- * Selects and reveals the specified elements.
- */
- public void selectReveal(ISelection selection) {
- StructuredSelection ssel = convertSelection(selection);
- if (!ssel.isEmpty()) {
- getViewer().getControl().setRedraw(false);
- getViewer().setSelection(ssel, true);
- getViewer().getControl().setRedraw(true);
- }
- }
-
- /**
- * Saves the filters defined as strings in <code>patterns</code>
- * in the preference store.
- */
- public void setFiltersPreference(String[] patterns) {
-
- StringBuffer sb = new StringBuffer();
-
- for (int i = 0; i < patterns.length; i++) {
- if (i != 0)
- sb.append(ResourcePatternFilter.COMMA_SEPARATOR);
- sb.append(patterns[i]);
- }
-
- WorkbenchPlugin.getDefault().getPreferenceStore().setValue(
- ResourcePatternFilter.FILTERS_TAG,
- sb.toString());
- }
-
- /**
- * @see IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- getTreeViewer().getTree().setFocus();
- }
-
- /**
- * Note: For experimental use only.
- * Sets the decorator for the navigator.
- * <p>
- * As of 2.0, this method no longer has any effect.
- * </p>
- *
- * @param decorator a label decorator or <code>null</code> for no decorations.
- * @deprecated use the decorators extension point instead; see IWorkbench.getDecoratorManager()
- */
- public void setLabelDecorator(ILabelDecorator decorator) {
- // do nothing
- }
-
- /**
- * Sets the resource sorter.
- *
- * @param sorter the resource sorter
- * @since 2.0
- */
- public void setSorter(ResourceSorter sorter) {
- TreeViewer viewer = getTreeViewer();
- viewer.getControl().setRedraw(false);
- viewer.setSorter(sorter);
- viewer.getControl().setRedraw(true);
- settings.put(STORE_SORT_TYPE, sorter.getCriteria());
-
- // update the sort actions' checked state
- updateActionBars((IStructuredSelection) viewer.getSelection());
- }
-
- /**
- * Implements IResourceNavigatorPart
- *
- * @see org.eclipse.ui.views.navigator.IResourceNavigatorPart#setWorkingSet(IWorkingSet)
- * @since 2.0
- */
- public void setWorkingSet(IWorkingSet workingSet) {
- TreeViewer treeViewer = getTreeViewer();
- Object[] expanded = treeViewer.getExpandedElements();
- ISelection selection = treeViewer.getSelection();
-
- workingSetFilter.setWorkingSet(workingSet);
- if (workingSet != null) {
- settings.put(STORE_WORKING_SET, workingSet.getName());
- }
- else {
- settings.put(STORE_WORKING_SET, "");
- }
- updateTitle();
- treeViewer.refresh();
- treeViewer.setExpandedElements(expanded);
- if (selection.isEmpty() == false && selection instanceof IStructuredSelection) {
- IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- treeViewer.reveal(structuredSelection.getFirstElement());
- }
- }
-
- /**
- * Updates the action bar actions.
- *
- * @param selection the current selection
- * @since 2.0
- */
- protected void updateActionBars(IStructuredSelection selection) {
- getActionGroup().setContext(new ActionContext(selection));
- getActionGroup().updateActionBars();
- }
-
- /**
- * Updates the message shown in the status line.
- *
- * @param selection the current selection
- */
- protected void updateStatusLine(IStructuredSelection selection) {
- String msg = getStatusLineMessage(selection);
- getViewSite().getActionBars().getStatusLineManager().setMessage(msg);
- }
-
- /**
- * Updates the title text and title tool tip.
- * Called whenever the input of the viewer changes.
- * Called whenever the input of the viewer changes.
- *
- * @since 2.0
- */
- public void updateTitle() {
- Object input = getViewer().getInput();
- String viewName = getConfigurationElement().getAttribute("name"); //$NON-NLS-1$
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IWorkingSet workingSet = workingSetFilter.getWorkingSet();
-
- if (input == null
- || input.equals(workspace)
- || input.equals(workspace.getRoot())) {
- setTitle(viewName);
- if (workingSet != null) {
- setTitleToolTip(ResourceNavigatorMessages.format(
- "ResourceNavigator.workingSetToolTip", //$NON-NLS-1$
- new Object[] {workingSet.getName()}));
- }
- else {
- setTitleToolTip(""); //$NON-NLS-1$
- }
- }
- else {
- ILabelProvider labelProvider = (ILabelProvider) getTreeViewer().getLabelProvider();
- String inputToolTip = getFrameToolTipText(input);
-
- setTitle(ResourceNavigatorMessages.format(
- "ResourceNavigator.title", //$NON-NLS-1$
- new Object[] {viewName, labelProvider.getText(input)}));
- if (workingSet != null) {
- setTitleToolTip(ResourceNavigatorMessages.format(
- "ResourceNavigator.workingSetInputToolTip", //$NON-NLS-1$
- new Object[] {inputToolTip, workingSet.getName()}));
- }
- else {
- setTitleToolTip(inputToolTip);
- }
- }
- }
-
- /**
- * Returns the action group.
- *
- * @return the action group
- */
- protected ResourceNavigatorActionGroup getActionGroup() {
- return actionGroup;
- }
-
- /**
- * Sets the action group.
- *
- * @param actionGroup the action group
- */
- protected void setActionGroup(ResourceNavigatorActionGroup actionGroup) {
- this.actionGroup = actionGroup;
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorAction.java
deleted file mode 100644
index d75b0c7..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.SelectionProviderAction;
-
-/**
- * Superclass of all actions provided by the resource navigator.
- */
-public abstract class ResourceNavigatorAction extends SelectionProviderAction {
-
- private IResourceNavigator navigator;
-
- /**
- * Creates a new instance of the class.
- */
- public ResourceNavigatorAction(
- IResourceNavigator navigator,
- String label) {
- super(navigator.getViewer(), label);
- this.navigator = navigator;
- }
-
- /**
- * Returns the resource navigator for which this action was created.
- */
- public IResourceNavigator getNavigator() {
- return navigator;
- }
-
- /**
- * Returns the resource viewer
- */
- protected Viewer getViewer() {
- return getNavigator().getViewer();
- }
-
- /**
- * Returns the shell to use within actions.
- */
- protected Shell getShell() {
- return getNavigator().getSite().getShell();
- }
-
- /**
- * Returns the workbench.
- */
- protected IWorkbench getWorkbench() {
- return PlatformUI.getWorkbench();
- }
-
- /**
- * Returns the workbench window.
- */
- protected IWorkbenchWindow getWorkbenchWindow() {
- return getNavigator().getSite().getWorkbenchWindow();
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorActionGroup.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorActionGroup.java
deleted file mode 100644
index 96cce2b..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorActionGroup.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import org.eclipse.swt.events.KeyEvent;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.actions.ActionGroup;
-
-/**
- * This is the action group for all the resource navigator actions.
- * It delegates to several subgroups for most of the actions.
- *
- * @see GotoActionGroup
- * @see OpenActionGroup
- * @see RefactorActionGroup
- * @see SortAndFilterActionGroup
- * @see WorkspaceActionGroup
- *
- * @since 2.0
- */
-public abstract class ResourceNavigatorActionGroup extends ActionGroup {
-
- /**
- * The resource navigator.
- */
- protected IResourceNavigator navigator;
-
- /**
- * Constructs a new navigator action group and creates its actions.
- *
- * @param navigator the resource navigator
- */
- public ResourceNavigatorActionGroup(IResourceNavigator navigator) {
- this.navigator = navigator;
- makeActions();
- }
-
- /**
- * Returns the resource navigator.
- */
- public IResourceNavigator getNavigator() {
- return navigator;
- }
-
- /**
- * Makes the actions contained in this action group.
- */
- protected abstract void makeActions();
-
- /**
- * Runs the default action in the group.
- * Does nothing by default.
- *
- * @param selection the current selection
- */
- public void runDefaultAction(IStructuredSelection selection) {
- }
-
- /**
- * Handles a key pressed event by invoking the appropriate action.
- * Does nothing by default.
- */
- public void handleKeyPressed(KeyEvent event) {
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorMessages.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorMessages.java
deleted file mode 100644
index 2c08fb6..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorMessages.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps managing messages
- * @since 2.0
- */
-public class ResourceNavigatorMessages {
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.views.navigator.messages";//$NON-NLS-1$
- private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
-private ResourceNavigatorMessages(){
- // prevent instantiation of class
-}
-/**
- * Returns the formatted message for the given key in
- * the resource bundle.
- *
- * @param key the resource name
- * @param args the message arguments
- * @return the string
- */
-public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key),args);
-}
-/**
- * Returns the resource object with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the key is returned.
- *
- * @param key the resource name
- * @return the string
- */
-public static String getString(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorMoveAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorMoveAction.java
deleted file mode 100644
index 763d0fd..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorMoveAction.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.IPath;
-
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.ui.actions.MoveProjectAction;
-import org.eclipse.ui.actions.MoveResourceAction;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * The ResourceNavigatorMoveAction is a resource move that aso updates the navigator
- * to show the result of the move.
- * It also delegates to MoveProjectAction as needed.
- *
- * @since 2.0
- */
-public class ResourceNavigatorMoveAction extends MoveResourceAction {
- private StructuredViewer viewer;
- private MoveProjectAction moveProjectAction;
-
-/**
- * Create a ResourceNavigatorMoveAction and use the supplied viewer to update the UI.
- * @param shell Shell
- * @param structureViewer StructuredViewer
- */
-public ResourceNavigatorMoveAction(Shell shell, StructuredViewer structureViewer) {
- super(shell);
- WorkbenchHelp.setHelp(this, INavigatorHelpContextIds.RESOURCE_NAVIGATOR_MOVE_ACTION);
- this.viewer = structureViewer;
- this.moveProjectAction = new MoveProjectAction(shell);
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void run() {
- if (moveProjectAction.isEnabled()) {
- moveProjectAction.run();
- return;
- }
-
- super.run();
- List destinations = getDestinations();
- if (destinations != null && destinations.isEmpty() == false) {
- IWorkspaceRoot root = WorkbenchPlugin.getPluginWorkspace().getRoot();
- List resources = new ArrayList();
- Iterator iterator = destinations.iterator();
-
- while (iterator.hasNext()) {
- IResource newResource = root.findMember((IPath) iterator.next());
- if (newResource != null)
- resources.add(newResource);
- }
-
- this.viewer.setSelection(new StructuredSelection(resources), true);
- }
-
-}
-
-protected boolean updateSelection(IStructuredSelection selection) {
- moveProjectAction.selectionChanged(selection);
- return super.updateSelection(selection) || moveProjectAction.isEnabled();
-}
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorRenameAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorRenameAction.java
deleted file mode 100644
index 89d3fd6..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorRenameAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.actions.RenameResourceAction;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * The ResourceNavigatorRenameAction is the rename action used by the
- * ResourceNavigator that also allows updating after rename.
- * @since 2.0
- */
-public class ResourceNavigatorRenameAction extends RenameResourceAction {
- private TreeViewer viewer;
- /**
- * Create a ResourceNavigatorRenameAction and use the tree of the supplied viewer
- * for editing.
- * @param shell Shell
- * @param treeViewer TreeViewer
- */
- public ResourceNavigatorRenameAction(Shell shell, TreeViewer treeViewer) {
- super(shell, treeViewer.getTree());
- WorkbenchHelp.setHelp(
- this,
- INavigatorHelpContextIds.RESOURCE_NAVIGATOR_RENAME_ACTION);
- this.viewer = treeViewer;
- }
- /* (non-Javadoc)
- * Run the action to completion using the supplied path.
- */
- protected void runWithNewPath(IPath path, IResource resource) {
- IWorkspaceRoot root = resource.getProject().getWorkspace().getRoot();
- super.runWithNewPath(path, resource);
- if (this.viewer != null) {
- IResource newResource = root.findMember(path);
- if (newResource != null)
- this.viewer.setSelection(new StructuredSelection(newResource), true);
- }
- }
- /**
- * Handle the key release
- */
- public void handleKeyReleased(KeyEvent event) {
- if (event.keyCode == SWT.F2 && event.stateMask == 0 && isEnabled()) {
- run();
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourcePatternFilter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourcePatternFilter.java
deleted file mode 100644
index bbb0f39..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourcePatternFilter.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import java.io.StringBufferInputStream;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-/**
- * Filter used to determine whether resources are to be shown or not.
- *
- * @since 2.0
- */
-public class ResourcePatternFilter extends ViewerFilter {
- private String[] patterns;
- private StringMatcher[] matchers;
-
- static final String COMMA_SEPARATOR = ",";//$NON-NLS-1$
- static final String FILTERS_TAG = "resourceFilters";//$NON-NLS-1$
-/**
- * Creates a new resource pattern filter.
- */
-public ResourcePatternFilter() {
- super();
-}
-/**
- * Return the currently configured StringMatchers. If there aren't any look
- * them up.
- */
-private StringMatcher[] getMatchers() {
-
- if (this.matchers == null)
- initializeFromPreferences();
-
- return this.matchers;
-}
-/**
- * Gets the patterns for the receiver. Returns the cached values if there
- * are any - if not look it up.
- */
-public String[] getPatterns() {
-
- if (this.patterns == null)
- initializeFromPreferences();
-
- return this.patterns;
-
-}
-/**
- * Initializes the filters from the preference store.
- */
-private void initializeFromPreferences() {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- // get the filters that were saved by ResourceNavigator.setFiltersPreference
- String storedPatterns = plugin.getPreferenceStore().getString(FILTERS_TAG);
-
- if (storedPatterns.length() == 0) {
- // revert to all filter extensions with selected == "true"
- // if there are no filters in the preference store
- List defaultFilters = FiltersContentProvider.getDefaultFilters();
- String[] patterns = new String[defaultFilters.size()];
- defaultFilters.toArray(patterns);
- setPatterns(patterns);
- return;
- }
-
- //Get the strings separated by a comma and filter them from the currently
- //defined ones
- List definedFilters = FiltersContentProvider.getDefinedFilters();
- StringTokenizer entries = new StringTokenizer(storedPatterns, COMMA_SEPARATOR);
- List patterns = new ArrayList();
-
- while (entries.hasMoreElements()) {
- String nextToken = entries.nextToken();
- if (definedFilters.indexOf(nextToken) > -1)
- patterns.add(nextToken);
- }
-
- //Convert to an array of Strings
- String[] patternArray = new String[patterns.size()];
- patterns.toArray(patternArray);
- setPatterns(patternArray);
-
-}
-/* (non-Javadoc)
- * Method declared on ViewerFilter.
- */
-public boolean select(Viewer viewer, Object parentElement, Object element) {
- IResource resource = null;
- if (element instanceof IResource) {
- resource = (IResource) element;
- } else
- if (element instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable) element;
- resource = (IResource) adaptable.getAdapter(IResource.class);
- }
- if (resource != null) {
- String name = resource.getName();
- StringMatcher[] testMatchers = getMatchers();
- for (int i = 0; i < testMatchers.length; i++) {
- if (testMatchers[i].match(name))
- return false;
- }
- return true;
- }
- return true;
-}
-/**
- * Sets the patterns to filter out for the receiver.
- */
-public void setPatterns(String[] newPatterns) {
-
- this.patterns = newPatterns;
- this.matchers = new StringMatcher[newPatterns.length];
- for (int i = 0; i < newPatterns.length; i++) {
- //Reset the matchers to prevent constructor overhead
- matchers[i] = new StringMatcher(newPatterns[i], true, false);
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceSelectionUtil.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceSelectionUtil.java
deleted file mode 100644
index 677c47b..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceSelectionUtil.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-/**
- * Provides utilities for checking the validity of selections.
- * <p>
- * This class provides static methods only; it is not intended to be instantiated
- * or subclassed.
- * @since 2.0
- * </p>
- */
-public class ResourceSelectionUtil {
-/* (non-Javadoc)
- * Private constructor to block instantiation.
- */
-private ResourceSelectionUtil(){
-}
-/**
- * Returns whether the types of the resources in the given selection are among
- * the specified resource types.
- *
- * @param selection the selection
- * @param resourceMask resource mask formed by bitwise OR of resource type
- * constants (defined on <code>IResource</code>)
- * @return <code>true</code> if all selected elements are resources of the right
- * type, and <code>false</code> if at least one element is either a resource
- * of some other type or a non-resource
- * @see IResource#getType
- */
-public static boolean allResourcesAreOfType(IStructuredSelection selection, int resourceMask) {
- Iterator resources = selection.iterator();
- while (resources.hasNext()) {
- Object next = resources.next();
- if (!(next instanceof IResource))
- return false;
- if (!resourceIsType((IResource)next, resourceMask))
- return false;
- }
- return true;
-}
-
-/**
- * Returns the selection adapted to IResource. Returns null
- * if any of the entries are not adaptable.
- *
- * @param selection the selection
- * @param resourceMask resource mask formed by bitwise OR of resource type
- * constants (defined on <code>IResource</code>)
- * @return IStructuredSelection or null if any of the entries are not adaptable.
- * @see IResource#getType
- */
-public static IStructuredSelection allResources(IStructuredSelection selection, int resourceMask) {
- Iterator adaptables = selection.iterator();
- List result = new ArrayList();
- while (adaptables.hasNext()) {
- Object next = adaptables.next();
- if(next instanceof IAdaptable){
- Object resource = ((IAdaptable) next).getAdapter(IResource.class);
- if(resource == null)
- return null;
- else if (resourceIsType((IResource)resource, resourceMask))
- result.add(resource);
- }
- else
- return null;
- }
- return new StructuredSelection(result);
-
-}
-
-/**
- * Returns whether the type of the given resource is among the specified
- * resource types.
- *
- * @param resource the resource
- * @param resourceMask resource mask formed by bitwise OR of resource type
- * constants (defined on <code>IResource</code>)
- * @return <code>true</code> if the resources has a matching type, and
- * <code>false</code> otherwise
- * @see IResource#getType
- */
-public static boolean resourceIsType(IResource resource, int resourceMask) {
- return (resource.getType() & resourceMask) != 0;
-}
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceSorter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceSorter.java
deleted file mode 100644
index 686d51a..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceSorter.java
+++ /dev/null
@@ -1,179 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-/**
- * Sorter for viewers that display items of type <code>IResource</code>.
- * The sorter supports two sort criteria:
- * <p>
- * <code>NAME</code>: Folders are given order precedence, followed by files.
- * Within these two groups resources are ordered by name. All name comparisons
- * are case-insensitive.
- * </p>
- * <p>
- * <code>TYPE</code>: Folders are given order precedence, followed by files.
- * Within these two groups resources are ordered by extension. All extension
- * comparisons are case-insensitive.
- * </p>
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class ResourceSorter extends ViewerSorter {
-
- /**
- * Constructor argument value that indicates to sort items by name.
- */
- public final static int NAME = 1;
-
- /**
- * Constructor argument value that indicates to sort items by extension.
- */
- public final static int TYPE = 2;
-
- private int criteria;
-
- /**
- * Creates a resource sorter that will use the given sort criteria.
- *
- * @param criteria the sort criterion to use: one of <code>NAME</code> or
- * <code>TYPE</code>
- */
- public ResourceSorter(int criteria) {
- super();
- this.criteria = criteria;
- }
-
- /**
- * Returns an integer value representing the relative sort priority of the
- * given element based on its class.
- * <p>
- * <ul>
- * <li>resources (<code>IResource</code>) - 2</li>
- * <li>project references (<code>ProjectReference</code>) - 1</li>
- * <li>everything else - 0</li>
- * </ul>
- * </p>
- *
- * @param element the element
- * @return the sort priority (larger numbers means more important)
- */
- protected int classComparison(Object element) {
- if (element instanceof IResource) {
- return 2;
- }
- return 0;
- }
-
- /* (non-Javadoc)
- * Method declared on ViewerSorter.
- */
- public int compare(Viewer viewer, Object o1, Object o2) {
- //have to deal with non-resources in navigator
- //if one or both objects are not resources, returned a comparison
- //based on class.
- if (!(o1 instanceof IResource && o2 instanceof IResource)) {
- return compareClass(o1, o2);
- }
- IResource r1 = (IResource) o1;
- IResource r2 = (IResource) o2;
-
- if (r1 instanceof IContainer && r2 instanceof IContainer)
- return compareNames(r1, r2);
- else if (r1 instanceof IContainer)
- return -1;
- else if (r2 instanceof IContainer)
- return 1;
- else if (criteria == NAME)
- return compareNames(r1, r2);
- else if (criteria == TYPE)
- return compareTypes(r1, r2);
- else
- return 0;
- }
-
- /**
- * Returns a number reflecting the collation order of the given elements
- * based on their class.
- *
- * @param element1 the first element to be ordered
- * @param element2 the second element to be ordered
- * @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
- */
- protected int compareClass(Object element1, Object element2) {
- return classComparison(element1) - classComparison(element2);
- }
-
- /**
- * Returns a number reflecting the collation order of the given resources
- * based on their resource names.
- *
- * @param resource1 the first resource element to be ordered
- * @param resource2 the second resource element to be ordered
- * @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
- */
- protected int compareNames(IResource resource1, IResource resource2) {
- return collator.compare(resource1.getName(), resource2.getName());
- }
-
- /**
- * Returns a number reflecting the collation order of the given resources
- * based on their respective file extensions. Resources with the same file
- * extension will be collated based on their names.
- *
- * @param resource1 the first resource element to be ordered
- * @param resource2 the second resource element to be ordered
- * @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
- */
- protected int compareTypes(IResource resource1, IResource resource2) {
- String ext1 = getExtensionFor(resource1);
- String ext2 = getExtensionFor(resource2);
-
- // Compare extensions. If they're different then return a value that
- // indicates correct extension ordering. If they're the same then
- // return a value that indicates the correct NAME ordering.
- int result = collator.compare(ext1, ext2);
-
- if (result != 0) // ie.- different extensions
- return result;
-
- return compareNames(resource1, resource2);
- }
-
- /**
- * Returns the sort criteria of this this sorter.
- *
- * @return the sort criterion: one of <code>NAME</code> or <code>TYPE</code>
- */
- public int getCriteria() {
- return criteria;
- }
-
- /**
- * Returns the extension portion of the given resource.
- *
- * @param resource the resource
- * @return the file extension, possibily the empty string
- */
- private String getExtensionFor(IResource resource) {
- String ext = resource.getFileExtension();
- return ext == null ? "" : ext; //$NON-NLS-1$
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ShowInNavigatorAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ShowInNavigatorAction.java
deleted file mode 100644
index 3cfef10..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ShowInNavigatorAction.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.actions.SelectionProviderAction;
-import org.eclipse.ui.part.ISetSelectionTarget;
-import org.eclipse.ui.help.*;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * An action which shows the current selection in the Navigator view.
- * For each element in the selection, if it is an <code>IResource</code>
- * it uses it directly, otherwise if it is an <code>IMarker</code> it uses the marker's resource,
- * otherwise if it is an <code>IAdaptable</code>, it tries to get the <code>IResource.class</code> adapter.
- */
-public class ShowInNavigatorAction extends SelectionProviderAction {
- private IWorkbenchPage page;
- public ShowInNavigatorAction(IWorkbenchPage page, ISelectionProvider viewer) {
- super(viewer, ResourceNavigatorMessages.getString("ShowInNavigator.text")); //$NON-NLS-1$
- Assert.isNotNull(page);
- this.page = page;
- setDescription(ResourceNavigatorMessages.getString("ShowInNavigator.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, INavigatorHelpContextIds.SHOW_IN_NAVIGATOR_ACTION);
- }
-/**
- * Returns the resources in the given selection.
- *
- * @return a list of <code>IResource</code>
- */
-List getResources(IStructuredSelection selection) {
- List v = new ArrayList();
- for (Iterator i = selection.iterator(); i.hasNext();) {
- Object o = i.next();
- if (o instanceof IResource) {
- v.add(o);
- } else if (o instanceof IMarker) {
- IResource resource = ((IMarker) o).getResource();
- v.add(resource);
- } else if (o instanceof IAdaptable) {
- IResource resource = (IResource) ((IAdaptable) o).getAdapter(IResource.class);
- if (resource != null) {
- v.add(resource);
- }
- }
- }
- return v;
-}
-/*
- * (non-Javadoc)
- * Method declared on IAction.
- */
-/**
- * Shows the Navigator view and sets its selection to the resources
- * selected in this action's selection provider.
- */
-public void run() {
- List v = getResources(getStructuredSelection());
- if (v.isEmpty())
- return;
- try {
- IViewPart view = page.showView(IPageLayout.ID_RES_NAV);
- if (view instanceof ISetSelectionTarget) {
- ISelection selection = new StructuredSelection(v);
- ((ISetSelectionTarget) view).selectReveal(selection);
- }
- } catch (PartInitException e) {
- ErrorDialog.openError(
- page.getWorkbenchWindow().getShell(),
- ResourceNavigatorMessages.getString("ShowInNavigator.errorMessage"), //$NON-NLS-1$
- e.getMessage(),
- e.getStatus());
- }
-}
-/*
- * (non-Javadoc)
- * Method declared on SelectionProviderAction.
- */
-public void selectionChanged(IStructuredSelection selection) {
- setEnabled(!getResources(selection).isEmpty());
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/SortAndFilterActionGroup.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/SortAndFilterActionGroup.java
deleted file mode 100644
index 3a93e88..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/SortAndFilterActionGroup.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-
-import org.eclipse.ui.IActionBars;
-
-/**
- * This is the action group for the sort and filter actions.
- */
-public class SortAndFilterActionGroup extends ResourceNavigatorActionGroup {
-
- private SortViewAction sortByTypeAction;
- private SortViewAction sortByNameAction;
- private FilterSelectionAction filterAction;
-
- public SortAndFilterActionGroup(IResourceNavigator navigator) {
- super(navigator);
- }
-
- protected void makeActions() {
- sortByNameAction = new SortViewAction(navigator, false);
- sortByTypeAction = new SortViewAction(navigator, true);
- filterAction =
- new FilterSelectionAction(
- navigator,
- ResourceNavigatorMessages.getString("ResourceNavigator.filterText")); //$NON-NLS-1$
- }
-
- public void fillActionBars(IActionBars actionBars) {
- IMenuManager menu = actionBars.getMenuManager();
- IMenuManager submenu =
- new MenuManager(ResourceNavigatorMessages.getString("ResourceNavigator.sort")); //$NON-NLS-1$
- menu.add(submenu);
- submenu.add(sortByNameAction);
- submenu.add(sortByTypeAction);
- menu.add(filterAction);
- }
-
- public void updateActionBars() {
- int criteria = navigator.getSorter().getCriteria();
- sortByNameAction.setChecked(criteria == ResourceSorter.NAME);
- sortByTypeAction.setChecked(criteria == ResourceSorter.TYPE);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/SortViewAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/SortViewAction.java
deleted file mode 100644
index c5b7136..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/SortViewAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.help.*;
-
-/**
- * Implementation of the view sorting actions.
- * @since 2.0
- */
-public class SortViewAction extends ResourceNavigatorAction {
- private boolean sort = true;
-/**
- * Creates the action.
- *
- * @param navigator the resource navigator
- * @param sortByType <code>true</code> for sort by type, <code>false</code> for sort by name
- */
-public SortViewAction(IResourceNavigator navigator, boolean sortByType) {
- super(navigator, sortByType ? ResourceNavigatorMessages.getString("SortView.byType") : ResourceNavigatorMessages.getString("SortView.byName")); //$NON-NLS-2$ //$NON-NLS-1$
- if (sortByType) {
- setToolTipText(ResourceNavigatorMessages.getString("SortView.toolTipByType")); //$NON-NLS-1$
- } else {
- setToolTipText(ResourceNavigatorMessages.getString("SortView.toolTipByName")); //$NON-NLS-1$
- }
- setEnabled(true);
- this.sort = sortByType;
- WorkbenchHelp.setHelp(this, INavigatorHelpContextIds.SORT_VIEW_ACTION);
-}
-public void run() {
- if (sort)
- getNavigator().setSorter(new ResourceSorter(ResourceSorter.TYPE));
- else
- getNavigator().setSorter(new ResourceSorter(ResourceSorter.NAME));
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/StringMatcher.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/StringMatcher.java
deleted file mode 100644
index 2101958..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/StringMatcher.java
+++ /dev/null
@@ -1,383 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-/**
- * A string pattern matcher, suppporting * and ? wildcards.
- */
-/* package */ class StringMatcher {
- protected String fPattern;
- protected int fLength; // pattern length
- protected boolean fIgnoreWildCards;
- protected boolean fIgnoreCase;
- protected boolean fHasLeadingStar;
- protected boolean fHasTrailingStar;
- protected String fSegments[]; //the given pattern is split into * separated segments
-
- /* boundary value beyond which we don't need to search in the text */
- protected int fBound = 0;
-
-
- protected static final char fSingleWildCard = '\u0000';
-
- 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();
-
- if (fIgnoreWildCards) {
- parseNoWildCards();
- } else {
- parseWildCards();
- }
- }
- /**
- * Find the first occurrence of the pattern between <code>start</code)(inclusive)
- * and <code>end</code>(exclusive).
- * @param <code>text</code>, the String object to search in
- * @param <code>start</code>, the starting index of the search range, inclusive
- * @param <code>end</code>, the ending index of the search range, exclusive
- * @return an <code>StringMatcher.Position</code> object that keeps the starting
- * (inclusive) and ending positions (exclusive) of the first occurrence of the
- * pattern in the specified range of the text; return null if not found or subtext
- * is empty (start==end). A pair of zeros is returned if pattern is empty string
- * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc"
- * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned
- */
- public StringMatcher.Position find(String text, int start, int end) {
- if (text == null)
- throw new IllegalArgumentException();
-
- int tlen = text.length();
- if (start < 0)
- start = 0;
- if (end > tlen)
- end = tlen;
- if (end < 0 ||start >= end )
- return null;
- if (fLength == 0)
- return new Position(start, start);
- if (fIgnoreWildCards) {
- int x = posIn(text, start, end);
- if (x < 0)
- return null;
- return new Position(x, x+fLength);
- }
-
- int segCount = fSegments.length;
- if (segCount == 0)//pattern contains only '*'(s)
- return new Position (start, end);
-
- int curPos = start;
- int matchStart = -1;
- int i;
- for (i = 0; i < segCount && curPos < end; ++i) {
- String current = fSegments[i];
- int nextMatch = regExpPosIn(text, curPos, end, current);
- if (nextMatch < 0 )
- return null;
- if(i == 0)
- matchStart = nextMatch;
- curPos = nextMatch + current.length();
- }
- if (i < segCount) // Ensure all segments match
- return null;
- return new Position(matchStart, curPos);
- }
- /**
- * match the given <code>text</code> with the pattern
- * @return true if matched eitherwise false
- * @param <code>text</code>, a String object
- */
- public boolean match(String text) {
- return match(text, 0, text.length());
- }
- /**
- * Given the starting (inclusive) and the ending (exclusive) poisitions 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 String <code>text</code>, a String object that contains the substring to match
- * @param int <code>start<code> marks the starting position (inclusive) of the substring
- * @param int <code>end<code> marks the ending index (exclusive) of the substring
- */
- public boolean match(String text, int start, int end) {
- if (null == text)
- throw new IllegalArgumentException();
-
- if (start > end)
- return false;
-
- if (fIgnoreWildCards)
- return (end - start == fLength) && fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength);
- int segCount = fSegments.length;
- if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) // pattern contains only '*'(s)
- return true;
- if (start == end)
- return fLength == 0;
- if (fLength == 0)
- return start == end;
-
- int tlen = text.length();
- if (start < 0)
- start = 0;
- if (end > tlen)
- end = tlen;
-
- int tCurPos = start;
- int bound = end - fBound;
- if ( bound < 0)
- return false;
- int i=0;
- String current = fSegments[i];
- int segLength = current.length();
-
- /* process first segment */
- if (!fHasLeadingStar){
- if(!regExpRegionMatches(text, start, current, 0, segLength)) {
- return false;
- } else {
- ++i;
- tCurPos = tCurPos + segLength;
- }
- }
-
- /* process middle segments */
- for ( ; i < segCount && tCurPos <= bound; ++i) {
- current = fSegments[i];
- int currentMatch;
- int k = current.indexOf(fSingleWildCard);
- if (k < 0) {
- currentMatch = textPosIn(text, tCurPos, end, current);
- if (currentMatch < 0)
- return false;
- } else {
- currentMatch = regExpPosIn(text, tCurPos, end, current);
- if (currentMatch < 0)
- return false;
- }
- tCurPos = currentMatch + current.length();
- }
-
- /* process final segment */
- if (!fHasTrailingStar && tCurPos != end) {
- int clen = current.length();
- return regExpRegionMatches(text, end - clen, current, 0, clen);
- }
- return i == segCount ;
- }
- /**
- * 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() {
- fSegments = new String[1];
- fSegments[0] = fPattern;
- fBound = fLength;
- }
- /**
- * Parses the given pattern into segments seperated by wildcard '*' characters.
- * @param p, a String object that is a simple regular expression with ‘*’ and/or ‘?’
- */
- private void parseWildCards() {
- if(fPattern.startsWith("*"))//$NON-NLS-1$
- fHasLeadingStar = true;
- if(fPattern.endsWith("*")) {//$NON-NLS-1$
- /* make sure it's not an escaped wildcard */
- if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') {
- fHasTrailingStar = true;
- }
- }
-
- Vector temp = new Vector();
-
- int pos = 0;
- StringBuffer buf = new StringBuffer();
- while (pos < fLength) {
- char c = fPattern.charAt(pos++);
- switch (c) {
- case '\\':
- if (pos >= fLength) {
- buf.append(c);
- } else {
- char next = fPattern.charAt(pos++);
- /* if it's an escape sequence */
- if (next == '*' || next == '?' || next == '\\') {
- buf.append(next);
- } else {
- /* not an escape sequence, just insert literally */
- buf.append(c);
- buf.append(next);
- }
- }
- break;
- case '*':
- if (buf.length() > 0) {
- /* new segment */
- temp.addElement(buf.toString());
- fBound += buf.length();
- buf.setLength(0);
- }
- break;
- case '?':
- /* append special character representing single match wildcard */
- buf.append(fSingleWildCard);
- break;
- default:
- buf.append(c);
- }
- }
-
- /* add last buffer to segment list */
- if (buf.length() > 0) {
- temp.addElement(buf.toString());
- fBound += buf.length();
- }
-
- fSegments = new String[temp.size()];
- temp.copyInto(fSegments);
- }
- /**
- * @param <code>text</code>, a string which contains no wildcard
- * @param <code>start</code>, the starting index in the text for search, inclusive
- * @param <code>end</code>, 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)
- return -1;
- return i;
- }
-
- for (int i = start; i <= max; ++i) {
- if (text.regionMatches(true, i, fPattern, 0, fLength))
- return i;
- }
-
- return -1;
- }
- /**
- * @param <code>text</code>, a simple regular expression that may only contain '?'(s)
- * @param <code>start</code>, the starting index in the text for search, inclusive
- * @param <code>end</code>, the stopping point of search, exclusive
- * @param <code>p</code>, a simple regular expression that may contains '?'
- * @param <code>caseIgnored</code>, wether the pattern is not casesensitive
- * @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 boolean
- * @param <code>text</code>, a String to match
- * @param <code>start</code>, int that indicates the starting index of match, inclusive
- * @param <code>end</code> int that indicates the ending index of match, exclusive
- * @param <code>p</code>, String, String, a simple regular expression that may contain '?'
- * @param <code>ignoreCase</code>, boolean indicating wether 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)
- continue;
- 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
- if (Character.toLowerCase(tchar) == Character.toLowerCase(pchar))
- continue;
- }
- return false;
- }
- return true;
- }
- /**
- * @param <code>text</code>, the string to match
- * @param <code>start</code>, the starting index in the text for search, inclusive
- * @param <code>end</code>, the stopping point of search, exclusive
- * @param code>p</code>, a string that has no wildcard
- * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
- * @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;
- }
-
- for (int i = 0; i <= max; ++i) {
- if (text.regionMatches(true, i, p, 0, plen))
- return i;
- }
-
- return -1;
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/WorkspaceActionGroup.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/WorkspaceActionGroup.java
deleted file mode 100644
index 66e5b32..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/WorkspaceActionGroup.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import org.eclipse.core.resources.*;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.*;
-
-/**
- * This is the action group for workspace actions such as Build, Refresh Local,
- * and Open/Close Project.
- */
-public class WorkspaceActionGroup extends ResourceNavigatorActionGroup {
-
- private BuildAction buildAction;
- private BuildAction rebuildAction;
- private OpenResourceAction openProjectAction;
- private CloseResourceAction closeProjectAction;
- private RefreshAction refreshAction;
-
- public WorkspaceActionGroup(IResourceNavigator navigator) {
- super(navigator);
- }
-
- protected void makeActions() {
- Shell shell = navigator.getSite().getShell();
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- openProjectAction = new OpenResourceAction(shell);
- workspace.addResourceChangeListener(openProjectAction, IResourceChangeEvent.POST_CHANGE);
- closeProjectAction = new CloseResourceAction(shell);
- workspace.addResourceChangeListener(closeProjectAction, IResourceChangeEvent.POST_CHANGE);
- refreshAction = new RefreshAction(shell);
- buildAction =
- new BuildAction(shell, IncrementalProjectBuilder.INCREMENTAL_BUILD);
- rebuildAction = new BuildAction(shell, IncrementalProjectBuilder.FULL_BUILD);
- }
-
- public void fillContextMenu(IMenuManager menu) {
- IStructuredSelection selection =
- (IStructuredSelection) getContext().getSelection();
-
- boolean onlyProjectsSelected =
- !selection.isEmpty()
- && ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT);
-
- if (!selection.isEmpty()) {
- // Allow manual incremental build only if auto build is off.
- if (!ResourcesPlugin.getWorkspace().isAutoBuilding()) {
- buildAction.selectionChanged(selection);
- menu.add(buildAction);
- }
- rebuildAction.selectionChanged(selection);
- menu.add(rebuildAction);
- }
-
- if (onlyProjectsSelected) {
- openProjectAction.selectionChanged(selection);
- menu.add(openProjectAction);
- closeProjectAction.selectionChanged(selection);
- menu.add(closeProjectAction);
- }
-
- menu.add(new Separator());
-
- refreshAction.selectionChanged(selection);
- menu.add(refreshAction);
- }
-
- public void fillActionBars(IActionBars actionBars) {
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.REFRESH,
- refreshAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.BUILD_PROJECT,
- buildAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.REBUILD_PROJECT,
- rebuildAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.OPEN_PROJECT,
- openProjectAction);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.CLOSE_PROJECT,
- closeProjectAction);
- }
-
- public void updateActionBars() {
- IStructuredSelection selection =
- (IStructuredSelection) getContext().getSelection();
- refreshAction.selectionChanged(selection);
- buildAction.selectionChanged(selection);
- rebuildAction.selectionChanged(selection);
- openProjectAction.selectionChanged(selection);
- closeProjectAction.selectionChanged(selection);
- }
-
- /**
- * Handles a key pressed event by invoking the appropriate action.
- */
- public void handleKeyPressed(KeyEvent event) {
- if (event.keyCode == SWT.F5 && event.stateMask == 0) {
- refreshAction.refreshAll();
- }
- }
-
- public void dispose() {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- workspace.removeResourceChangeListener(openProjectAction);
- workspace.removeResourceChangeListener(closeProjectAction);
- super.dispose();
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/messages.properties b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/messages.properties
deleted file mode 100644
index a8e0978..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/messages.properties
+++ /dev/null
@@ -1,79 +0,0 @@
-# ==============================================================================
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-# ==============================================================================
-
-# package: org.eclipse.ui.views.navigator
-
-
-# ==============================================================================
-# Navigator View
-# ==============================================================================
-ResourceNavigator.title = {0} : {1}
-ResourceNavigator.oneItemSelected = 1 item selected
-ResourceNavigator.statusLine = {0} items selected
-ResourceNavigator.workingSetToolTip = Working Set: {0}
-ResourceNavigator.workingSetInputToolTip = {0} - Working Set: {1}
-ResourceManager.toolTip = Workspace
-ShowInNavigator.errorMessage = Can't open navigator
-
-# --- Actions ---
-ResourceNavigator.sort = &Sort
-SortView.byType = by &Type
-SortView.toolTipByType = Sort By Type
-SortView.byName = by &Name
-SortView.toolTipByName = Sort By Name
-ResourceNavigator.filterText = &Filters...
-
-ResourceNavigator.new = Ne&w
-ResourceNavigator.goto = &Go To
-ResourceNavigator.resourceText = &Resource...
-ResourceNavigator.openPerspective = Open &Perspective
-ResourceNavigator.openWith = Open Wit&h
-
-ShowInNavigator.text = Show in &Navigator
-ShowInNavigator.toolTip = Show Selected Objects in Navigator View
-
-CopyAction.title = &Copy
-CopyAction.toolTip = Copy
-
-PasteAction.title=&Paste
-PasteAction.toolTip = Paste
-
-# --- Dialogs ---
-Goto.title = Go To Resource
-Goto.label = Choose a resource:
-Goto.pattern = &Pattern (? = any character, * = any string):
-Goto.matching = &Matching Resources:
-Goto.folders = In &Folders:
-
-FilterSelection.message = Select the &filters to apply (matching files will be hidden):
-FilterSelection.toolTip = Apply Filters
-FilterSelection.title = Navigator Filters
-
-DecoratorMenu.title = &Decorators
-
-# --- Drop Adapter ---
-DropAdapter.sameSourceAndDestination = Source and destination are the same.
-DropAdapter.destinationASubFolder = Destination is a sub-folder of the source.
-DropAdapter.title = Drag and Drop Problem
-DropAdapter.problemImporting = Problems occurred while importing resources.
-DropAdapter.canNotDropOntoSelf = Cannot drop a resource onto itself
-DropAdapter.cancelled = Operation Cancelled
-DropAdapter.problemsMoving = Problems occurred while moving resources.
-DropAdapter.question = Question
-DropAdapter.targetMustBeResource = Target must be a resource
-DropAdapter.canNotDropIntoClosedProject = Cannot drop a resource into closed project
-DropAdapter.resourcesCanNotBeSiblings = Resources cannot be siblings of projects
-DropAdapter.canNotCopy = Cannot copy \"{0}\". {1}
-DropAdapter.canNotMove = Cannot move \"{0}\". {1}
-DropAdapter.ok = ok
-DropAdapter.dropOperationError = An error occurred during the drop operation: {0}
-DropAdapter.overwriteQuery = {0} already exists. Would you like to overwrite it?
-DropAdapter.copyNameTwoArgs = Copy ({0}) of {1}
-DropAdapter.copyNameOneArg = Copy of {0}
-
-DragAdapter.title = Check Move
-DragAdapter.checkMoveMessage = {0} is read only. Do you still wish to move it?
-DragAdapter.checkDeleteMessage = {0} is read only. Do you still wish to delete it?
-
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/package.html b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/package.html
deleted file mode 100644
index 35b201e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/package.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides the standard Resource Navigator view which
-presents the tree of resources in the workspace.
-<br>
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CategoriesAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CategoriesAction.java
deleted file mode 100644
index d44fee1..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CategoriesAction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.help.*;
-
-/**
- * This action hides or shows categories in the <code>PropertySheetViewer</code>.
- */
-/*package*/ class CategoriesAction extends PropertySheetAction {
-/**
- * Creates the Categories action. This action is used to show
- * or hide categories properties.
- */
-public CategoriesAction(PropertySheetViewer viewer, String name) {
- super(viewer, name);
- WorkbenchHelp.setHelp(this, IPropertiesHelpContextIds.CATEGORIES_ACTION);
-}
-/**
- * Toggles the display of categories for the properties.
- */
-public void run() {
- PropertySheetViewer ps = getPropertySheet();
- ps.deactivateCellEditor();
- if (isChecked()) {
- ps.showCategories();
- } else {
- ps.hideCategories();
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ColorPropertyDescriptor.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ColorPropertyDescriptor.java
deleted file mode 100644
index feaa584..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ColorPropertyDescriptor.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColorCellEditor;
-
-/**
- * Descriptor for a property that has a color value which should be edited
- * with a color cell editor.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * <p>
- * Example:
- * <pre>
- * IPropertyDescriptor pd = new ColorPropertyDescriptor("fg", "Foreground Color");
- * </pre>
- * </p>
- */
-public class ColorPropertyDescriptor extends PropertyDescriptor {
-/**
- * Creates an property descriptor with the given id and display name.
- *
- * @param id the id of the property
- * @param displayName the name to display for the property
- */
-public ColorPropertyDescriptor(Object id, String displayName) {
- super(id, displayName);
-}
-/**
- * The <code>ColorPropertyDescriptor</code> implementation of this
- * <code>IPropertyDescriptor</code> method creates and returns a new
- * <code>ColorCellEditor</code>.
- * <p>
- * The editor is configured with the current validator if there is one.
- * </p>
- */
-public CellEditor createPropertyEditor(Composite parent) {
- CellEditor editor = new ColorCellEditor(parent);
- if (getValidator() != null)
- editor.setValidator(getValidator());
- return editor;
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java
deleted file mode 100644
index c2d264d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-
-/**
- * Descriptor for a property that has a value which should be edited
- * with a combo box cell editor.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * <p>
- * Example:
- * <pre>
- * String[] values = {"Top left", "Top right", "Bottom left", "Bottom right"};
- * IPropertyDescriptor pd = new ComboBoxPropertyDescriptor("origin", "Origin", values);
- * </pre>
- * </p>
- */
-public class ComboBoxPropertyDescriptor extends PropertyDescriptor {
-
- /**
- * The list of possible values to display in the combo box
- */
- private String[] values;
-/**
- * Creates an property descriptor with the given id, display name, and list
- * of value labels to display in the combo box cell editor.
- *
- * @param id the id of the property
- * @param displayName the name to display for the property
- * @param valuesArray the list of possible values to display in the combo box
- */
-public ComboBoxPropertyDescriptor(Object id, String displayName, String[] valuesArray) {
- super(id, displayName);
- values = valuesArray;
-}
-/**
- * The <code>ComboBoxPropertyDescriptor</code> implementation of this
- * <code>IPropertyDescriptor</code> method creates and returns a new
- * <code>ComboBoxCellEditor</code>.
- * <p>
- * The editor is configured with the current validator if there is one.
- * </p>
- */
-public CellEditor createPropertyEditor(Composite parent) {
- CellEditor editor = new ComboBoxCellEditor(parent, values);
- if (getValidator() != null)
- editor.setValidator(getValidator());
- return editor;
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CopyPropertyAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CopyPropertyAction.java
deleted file mode 100644
index 4f3eb44..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CopyPropertyAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Copies a property to the clipboard.
- */
-/*package*/ class CopyPropertyAction extends PropertySheetAction {
- /**
- * System clipboard
- */
- private Clipboard clipboard;
-
- /**
- * Creates the action.
- */
- public CopyPropertyAction(PropertySheetViewer viewer, String name) {
- super(viewer, PropertiesMessages.getString("CopyProperty.text")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IPropertiesHelpContextIds.COPY_PROPERTY_ACTION);
- clipboard = new Clipboard(Display.getCurrent());
- }
-
- /**
- * Performs this action.
- */
- public void run() {
- // Get the selected property
- IStructuredSelection selection = (IStructuredSelection)getPropertySheet().getSelection();
- if (selection.isEmpty())
- return;
- // Assume single selection
- IPropertySheetEntry entry = (IPropertySheetEntry)selection.getFirstElement();
-
- // Place text on the clipboard
- StringBuffer buffer = new StringBuffer();
- buffer.append(entry.getDisplayName());
- buffer.append("\t"); //$NON-NLS-1$
- buffer.append(entry.getValueAsString());
-
- setClipboard(buffer.toString());
- }
-
- /**
- * Updates enablement based on the current selection
- */
- public void selectionChanged(IStructuredSelection sel) {
- setEnabled(!sel.isEmpty());
- }
-
- private void setClipboard(String text) {
- try {
- Object[] data = new Object[] {text};
- Transfer[] transferTypes = new Transfer[] {TextTransfer.getInstance()};
- clipboard.setContents(data, transferTypes);
- } catch (SWTError e){
- if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
- throw e;
- if (MessageDialog.openQuestion(getPropertySheet().getControl().getShell(), WorkbenchMessages.getString("CopyToClipboardProblemDialog.title"), WorkbenchMessages.getString("CopyToClipboardProblemDialog.message"))) //$NON-NLS-1$ //$NON-NLS-2$
- setClipboard(text);
- }
- }
-}
-
-
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/DefaultsAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/DefaultsAction.java
deleted file mode 100644
index c1a5a7f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/DefaultsAction.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.help.*;
-
-/**
- * This action resets the <code>PropertySheetViewer</code> values back
- * to the default values.
- *
- * [Issue: should listen for selection changes in the viewer and set enablement]
- */
-/*package*/ class DefaultsAction extends PropertySheetAction {
-/**
- * Create the Defaults action. This action is used to set
- * the properties back to their default values.
- */
-public DefaultsAction(PropertySheetViewer viewer, String name) {
- super(viewer, name);
- setToolTipText(PropertiesMessages.getString("DefaultAction.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IPropertiesHelpContextIds.DEFAULTS_ACTION);
-}
-/**
- * Reset the properties to their default values.
- */
-public void run() {
- getPropertySheet().deactivateCellEditor();
- getPropertySheet().resetProperties();
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/FilePropertySource.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/FilePropertySource.java
deleted file mode 100644
index 686a7b9..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/FilePropertySource.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-
-import java.io.File;
-
-/**
- * The FilePropertySource gives the extra information that is shown for files
- */
-public class FilePropertySource extends ResourcePropertySource {
-
- // last modified state
- private static IPropertyDescriptor[] fileDescriptors;
-/**
- * Creates an property source for a file resource.
- * @param file the file resource
- */
-public FilePropertySource(IFile file) {
- super(file);
-}
-/**
- * Get a PropertyDescriptor that defines the size property
- * @return the PropertyDescriptor
- */
-private static PropertyDescriptor getInitialPropertyDescriptor() {
- PropertyDescriptor descriptor =
- new PropertyDescriptor(
- IResourcePropertyConstants.P_SIZE_RES,
- IResourcePropertyConstants.P_DISPLAY_SIZE);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
- return descriptor;
-
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource.
- */
-public IPropertyDescriptor[] getPropertyDescriptors() {
- if (fileDescriptors == null)
- initializeFileDescriptors();
- return fileDescriptors;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource.
- */
-public Object getPropertyValue(Object key) {
-
- Object returnValue = super.getPropertyValue(key);
-
- if(returnValue != null)
- return returnValue;
-
- if (key.equals(IResourcePropertyConstants.P_SIZE_RES))
- return getSizeString((IFile) element);
-
- return null;
-}
-/**
- * Return a String that indicates the size of the supplied file.
- */
-private String getSizeString(IFile file) {
- if (!file.isLocal(IResource.DEPTH_ZERO))
- return NOT_LOCAL_TEXT;
- else {
- File localFile = getFile(file);
- if(localFile == null)
- return FILE_NOT_FOUND;
- else
- return Long.toString(localFile.length());
- }
-}
-
-/**
- * Return the Property Descriptors for the file type.
- */
-private void initializeFileDescriptors() {
-
- IPropertyDescriptor[] superDescriptors = super.getPropertyDescriptors();
- int superLength = superDescriptors.length;
- fileDescriptors = new IPropertyDescriptor[superLength + 1];
- System.arraycopy(superDescriptors, 0, fileDescriptors, 0, superLength);
- fileDescriptors[superLength] = getInitialPropertyDescriptor();
-
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/FilterAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/FilterAction.java
deleted file mode 100644
index fd76109..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/FilterAction.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.help.*;
-
-/**
- * This action hides or shows expert properties in the <code>PropertySheetViewer</code>.
- */
-/*package*/ class FilterAction extends PropertySheetAction {
-/**
- * Create the Filter action. This action is used to show
- * or hide expert properties.
- */
-public FilterAction(PropertySheetViewer viewer, String name) {
- super(viewer, name);
- setToolTipText(PropertiesMessages.getString("Filter.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IPropertiesHelpContextIds.FILTER_ACTION);
-}
-/**
- * Toggle the display of expert properties.
- */
-
-public void run() {
- PropertySheetViewer ps = getPropertySheet();
- ps.deactivateCellEditor();
- if (isChecked()) {
- ps.showExpert();
- } else {
- ps.hideExpert();
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ICellEditorActivationListener.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ICellEditorActivationListener.java
deleted file mode 100644
index 47f4525..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ICellEditorActivationListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.CellEditor;
-/**
- * A listener which is notified when a cell editor is
- * activated/deactivated
- */
-/*package*/ interface ICellEditorActivationListener {
-/**
- * Notifies that the cell editor has been activated
- *
- * @param cellEditor the cell editor which has been activated
- */
-public void cellEditorActivated(CellEditor cellEditor);
-/**
- * Notifies that the cell editor has been deactivated
- *
- * @param cellEditor the cell editor which has been deactivated
- */
-public void cellEditorDeactivated(CellEditor cellEditor);
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertiesHelpContextIds.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertiesHelpContextIds.java
deleted file mode 100644
index 74635de..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertiesHelpContextIds.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Help context ids for the properties view.
- * <p>
- * This interface contains constants only; it is not intended to be implemented
- * or extended.
- * </p>
- *
- */
-/*package*/ interface IPropertiesHelpContextIds {
- public static final String PREFIX = PlatformUI.PLUGIN_ID + "."; //$NON-NLS-1$
-
- // Actions
- public static final String CATEGORIES_ACTION = PREFIX + "properties_categories_action_context"; //$NON-NLS-1$
- public static final String DEFAULTS_ACTION = PREFIX + "properties_defaults_action_context"; //$NON-NLS-1$
- public static final String FILTER_ACTION = PREFIX + "properties_filter_action_context"; //$NON-NLS-1$
- public static final String COPY_PROPERTY_ACTION = PREFIX + "properties_copy_action_context"; //$NON-NLS-1$
-
- // Views
- public static final String PROPERTY_SHEET_VIEW = PREFIX + "property_sheet_view_context"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertyDescriptor.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertyDescriptor.java
deleted file mode 100644
index 7bb4b01..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertyDescriptor.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.swt.widgets.Composite;
-/**
- * A descriptor for a property to be presented by a standard property sheet page
- * (<code>PropertySheetPage</code>). These descriptors originate with property
- * sources (<code>IPropertySource</code>).
- * <p>
- * A property descriptor carries the following information:
- * <ul>
- * <li>property id (required)</li>
- * <li>display name (required)</li>
- * <li>brief description of the property (optional)</li>
- * <li>category for grouping related properties (optional)</li>
- * <li>label provider used to display the property value (optional)</li>
- * <li>cell editor for changing the property value (optional)</li>
- * <li>help context id (optional)</li>
- * </ul>
- * </p>
- * <p>
- * Clients may implement this interface to provide specialized property
- * descriptors; however, there are standard implementations declared in
- * this package that take care of the most common cases:
- * <ul>
- * <li><code>PropertyDescriptor - read-only property</li>
- * <li><code>TextPropertyDescriptor</code> - edits with a
- * <code>TextCellEditor</code></li>
- * <li><code>CheckboxPropertyDescriptor - edits with a
- * <code>CheckboxCellEditor</code></code></li>
- * <li><code>ComboBoxPropertyDescriptor - edits with a
- * <code>ComboBoxCellEditor</code></code></li>
- * <li><code>ColorPropertyDescriptor - edits with a
- * <code>ColorCellEditor</code></code></li>
- * </ul>
- * </p>
- *
- * @see IPropertySource#getPropertyDescriptors
- */
-public interface IPropertyDescriptor {
-/**
- * Creates and returns a new cell editor for editing this property. Returns
- * <code>null</code> if the property is not editable.
- *
- * @param parent the parent widget for the cell editor
- * @return the cell editor for this property, or <code>null</code> if this
- * property cannot be edited
- */
-public CellEditor createPropertyEditor(Composite parent);
-/**
- * Returns the name of the category to which this property belongs. Properties
- * belonging to the same category are grouped together visually. This localized
- * string is shown to the user
- *
- * @return the category name, or <code>null</code> if the default category is to
- * be used
- */
-public String getCategory();
-/**
- * Returns a brief description of this property. This localized string is shown
- * to the user when this property is selected.
- *
- * @return a brief description, or <code>null</code> if none
- */
-public String getDescription();
-/**
- * Returns the display name for this property. This localized string is shown to
- * the user as the name of this property.
- *
- * @return a displayable name
- */
-public String getDisplayName();
-/**
- * Returns a list of filter types to which this property belongs.
- * The user is able to toggle the filters to show/hide properties belonging to
- * a filter type.
- * <p>
- * Valid values for these flags are declared as constants on
- * <code>IPropertySheetEntry</code>
- * </p>
- * @return a list of filter types to which this property belongs, or
- * <code>null</code> if none
- */
-public String[] getFilterFlags();
-/**
- * Returns the help context id for this property or
- * <code>null</code> if this property has no help context id.
- * <p>
- * NOTE: Help support system API's changed since 2.0 and arrays
- * of contexts are no longer supported.
- * </p>
- * <p>
- * Thus the only valid non-<code>null</code> return type for this method
- * is a <code>String</code> representing a context id. The previously
- * valid return types are deprecated. The plural name for this method
- * is unfortunate.
- * </p>
- *
- * @return the help context id for this entry
- */
-public Object getHelpContextIds();
-/**
- * Returns the id for this property. This object is
- * used internally to distinguish one property descriptor
- * from another.
- *
- * @return the property id
- */
-public Object getId();
-/**
- * Returns the label provider for this property. The label provider is used
- * to obtain the text (and possible image) for displaying the <it>value</it>
- * of this property.
- *
- * @return the label provider used to display this property
- */
-public ILabelProvider getLabelProvider();
-/**
- * Returns whether this property descriptor and the given one are compatible.
- * <p>
- * The property sheet uses this method during multiple selection to determine
- * whether two property descriptors with the same id are in fact the same
- * property and can be displayed as a single entry in the property sheet.
- * </p>
- *
- * @param anotherProperty the other property descriptor
- * @return <code>true</code> if the property descriptors are compatible, and
- * <code>false</code> otherwise
- */
-public boolean isCompatibleWith(IPropertyDescriptor anotherProperty);
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntry.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntry.java
deleted file mode 100644
index ce0a8db..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntry.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-/**
- * <code>IPropertySheetEntry</code> describes the model interface for the
- * property sheet.
- * <p>
- * May be implemented when supplying a custom root entry
- * to a property page.
- * </p>
- */
-public interface IPropertySheetEntry {
- /**
- * The filter id for expert properties
- */
- public String FILTER_ID_EXPERT = "org.eclipse.ui.views.properties.expert"; //$NON-NLS-1$
-/**
- * Adds the given listener to this entry's collection
- * of listeners.
- *
- * @param listener the listener to add
- */
-public void addPropertySheetEntryListener(IPropertySheetEntryListener listener);
-/**
- * Apply the current cell editor value.
- */
-public void applyEditorValue();
-/**
- * Called when the entry is no longer needed
- */
-public void dispose();
-/**
- * Returns the entry's category.
- *
- * @return the entry's category
- */
-public String getCategory();
-/**
- * Returns the child entries for this entry.
- *
- * @return the child entries for this entry
- */
-public IPropertySheetEntry[] getChildEntries();
-/**
- * Return a short description of the property sheet entry.
- * Typically this description is shown in a status line
- * when the entry is selected.
- *
- * @return the entry's description
- */
-public String getDescription();
-/**
- * Returns the name used to display the property.
- *
- * @return the name used to display the property
- */
-public String getDisplayName();
-/**
- * Return the <code>CellEditor</code> used to edit the property.
- *
- * @param parent the parent widget for the editor
- * @return the <code>CellEditor</code> used to edit the property
- */
-CellEditor getEditor(Composite parent);
-/**
- * Returns the error text to display if the value is invalid.
- *
- * @return the error text to display when the value is invalid
- * or <code>null</code>
- */
-public String getErrorText();
-/**
- * Return the filter ids used to group entries into levels such as Expert.
- * Valid values are defined as constants on this interface.
- *
- * @return the filter ids used to group entries into levels such as Expert.
- */
-public String[] getFilters();
-/**
- * Returns the help context id for this entry,
- * or <code>null</code> if this entry has no help context id.
- * <p>
- * NOTE: Help support system API's changed since 2.0 and arrays
- * of contexts are no longer supported.
- * </p>
- * <p>
- * Thus the only valid non-<code>null</code> return type for this method
- * is a <code>String</code> representing a context id. The previously
- * valid return types are deprecated. The plural name for this method
- * is unfortunate.
- * </p>
- *
- * @return the help context id for this entry
- */
-public Object getHelpContextIds();
-/**
- * Returns the image for the property value, if there is one.
- * This image is managed by the entry it came from. Callers
- * of this method must never dispose the returned image.
- *
- * @return the image for this property value or <code>null</code>
- */
-public Image getImage();
-/**
- * Returns the value of the objects expressed as a String.
- *
- * @return the value of the objects expressed as a String
- */
-public String getValueAsString();
-/**
- * Returns <code>true</code> if the entry has children.
- *
- * @return <code>true</code> if the entry has children
- */
-public boolean hasChildEntries();
-/**
- * Removes the given listener from this entry's collection
- * of listeners.
- *
- * @param listener the listener to remove
- */
-public void removePropertySheetEntryListener(IPropertySheetEntryListener listener);
-/**
- * Resets the property value to its default value if it has been changed.
- */
-void resetPropertyValue();
-/*
- * Sets the objects which represent the property values for
- * this entry. In the case of the root entry these objects
- * are the input to the viewer.
- *
- * @param values the values for this entry
- */
-public void setValues(Object[] values);
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntryListener.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntryListener.java
deleted file mode 100644
index 93b4863..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntryListener.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * Listener for changes in objects of type
- * <code>IPropertySheetEntry</code>.
- * <p>
- * This interface is public since it appears in the api
- * of <code>IPropertySheetEntry</code>. It in not intended
- * to be implemented outside of this package
- * <p>
- */
-public interface IPropertySheetEntryListener {
-/**
- * A node's children have changed (children added or removed)
- *
- * @param node the node whose's children have changed
- */
-void childEntriesChanged(IPropertySheetEntry node);
-/**
- * A entry's error message has changed
- *
- * @param entry the entry whose's error message has changed
- */
-void errorMessageChanged(IPropertySheetEntry entry);
-/**
- * A entry's value has changed
- *
- * @param entry the entry whose's value has changed
- */
-void valueChanged(IPropertySheetEntry entry);
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetPage.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetPage.java
deleted file mode 100644
index 6fddef4..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetPage.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.part.IPage;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.IStatusLineManager;
-
-/**
- * Interface for a property sheet page that appears in a property sheet view.
- * This interface defines the minimum requirement for pages within the
- * property sheet view, namely they must be pages (implement <code>IPage</code>)
- * be prepared to contribute actions to the property sheet view's tool bar
- * and status line, and listen for selection changes in the active part.
- * <p>
- * Clients may implement this interface from scratch if the property sheet
- * viewer's default page is unsuitable for displaying a part's properties.
- * </p>
- *
- * @see PropertySheetPage
- */
-public interface IPropertySheetPage extends IPage, ISelectionListener {
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySource.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySource.java
deleted file mode 100644
index e649f31..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySource.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.List;
-
-/**
- * Interface to an object capable of supplying properties for display by the
- * standard property sheet page implementation (<code>PropertySheetPage</code>).
- * <p>
- * This interface should be implemented by clients.
- * <code>PropertySheetPage</code> discovers the properties to display from
- * currently selected elements. Elements that implement <code>IPropertySource</code>
- * directly are included, as are elements that implement <code>IAdaptable</code>
- * and have an <code>IPropertySource</code> adapter. Clients should implement
- * this interface for any newly-defined elements that are to have properties
- * displayable by <code>PropertySheetPage</code>. Note that in the latter case,
- * the client will also need to register a suitable adapter factory with the
- * platform's adapter manager (<code>Platform.getAdapterManager</code>).
- * </p>
- *
- * @see org.eclipse.core.runtime.IAdaptable
- * @see org.eclipse.core.runtime.Platform#getAdapterManager
- * @see PropertySheetPage
- */
-public interface IPropertySource {
-
-/**
- * Returns a value for this property source that can be edited in a
- * property sheet.
- * <p>
- * This value is used when this <code>IPropertySource</code> is appearing
- * in the property sheet as the value of a property of some other
- * <code>IPropertySource</code>
- * </p>
- * <p>
- * This value is passed as the input to a cell editor opening on an
- * <code>IPropertySource</code>.
- * </p>
- * <p>
- * This value is also used when an <code>IPropertySource</code> is being
- * used as the value in a <code>setPropertyValue</code> message. The reciever
- * of the message would then typically use the editable value to update the
- * original property source or construct a new instance.
- * </p>
- * <p>
- * For example an email address which is a property source may have an
- * editable value which is a string so that it can be edited in a text
- * cell editor. The email address would also have a constructor or setter
- * that takes the edited string so that an appropriate instance can be created
- * or the original instance modified when the edited value is set.
- * </p>
- * <p>
- * This behavior is important for another reason. When the property sheet is
- * showing properties for more than one object (multiple selection), a property
- * sheet entry will display and edit a single value (typically coming from
- * the first selected object). After a property has been edited in a cell editor,
- * the same value is set as the property value for all of the objects. This is
- * fine for primitive types but otherwise all of the objects end up with a
- * reference to the same value. Thus by creating an editable value and using it
- * to update the state of the original property source object, one is able to
- * edit several property source objects at once (multiple selection).
-
- * @return a value that can be edited
- */
-public Object getEditableValue();
-/**
- * Returns the list of property descriptors for this property source.
- * The <code>getPropertyValue</code> and <code>setPropertyValue</code> methods
- * are used to read and write the actual property values by specifying
- * the property ids from these property descriptors.
- * <p>
- * Implementors should cache the descriptors as they will be asked for
- * the descriptors with any edit/update. Since descriptors provide
- * cell editors, returning the same descriptors if possible allows
- * for efficient updating.
- * </p>
- *
- * @return the property descriptors
- */
-public IPropertyDescriptor[] getPropertyDescriptors();
-/**
- * Returns the value of the property with the given id if it has one.
- * Returns <code>null</code> if this source if the property's value is
- * <code>null</code> value or if this source does not have the specified
- * property.
- *
- * @see #setPropertyValue
- *
- * @param id the id of the property being set
- * @return the value of the property, or <code>null</code>
- */
-public Object getPropertyValue(Object id);
-/**
- * Returns whether the value of the property with the given id has changed from
- * its default value. Returns <code>false</code> if the notion of default value
- * is not meaningful for the specified property, or if this source does not have
- * the specified property.
- *
- * @param id the id of the property
- * @return <code>true</code> if the value of the specified property has changed
- * from its original default value, and <code>false</code> otherwise
- */
-public boolean isPropertySet(Object id);
-/**
- * Resets the property with the given id to its default value if possible.
- * Does nothing if the notion of default value is not meaningful for
- * the specified property, or if the property's value cannot be changed,
- * or if this source does not have the specified property.
- *
- * @param id the id of the property being reset
- */
-public void resetPropertyValue(Object id);
-/**
- * Sets the property with the given id if possible. Does nothing if the
- * property's value cannot be changed or if this source does not have the
- * specified property.
- * <p>
- * In general, a property source should not directly reference the value
- * parameter unless it is an atomic object that can be shared such as a
- * string.
- * </p>
- * <p>
- * An important reason for this is that several property sources with
- * compatible descriptors could be appearing in the property sheet at
- * the same time. An editor produces a single edited value which is passed
- * at the value parameter of this message to all the property sources.
- * Thus to avoid a situation where all of the property sources reference
- * the same value they should use the value parameter to create a
- * new instance of the real value for the given property.
- * </p>
- * <p>
- * There is another reason why a level of indirection is useful. The real
- * value of property may be a type that cannot be edited with a standard cell
- * editor. However instead of of returning the real value in <code>getPropertyValue</code>,
- * the value could be converted to a <code>String</code> which could be edited
- * with a standard cell editor. The edited value will be passed to this method
- * which can then turn it back into the real property value.
- * </p>
- * <p>Another variation on returning a value other than the real property value in
- * <code>getPropertyValue</code> is to return a value which is an
- * <code>IPropertySource</code> (or for which the property sheet can obtain an
- * <code>IPropertySource</code>). This allows the property sheet to properties
- * for the value itself. In this case the value to edit is obtained from the
- * child property source using <code>getEditableValue</code>. It is this editable value
- * that will be passed back via this method when the it has been edited
- * </p>
- *
- * @see #getPropertyValue
- * @see #getEditableValue
- *
- * @param id the id of the property being set
- * @param value the new value for the property; <code>null</code> is allowed
- */
-public void setPropertyValue(Object id, Object value);
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySourceProvider.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySourceProvider.java
deleted file mode 100644
index f4c4259..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySourceProvider.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * Interface used by <code>PropertySheetRoot</code> to obtain an
- * <code>IPropertySource</code> for a given object.
- * <p>
- * This interface may be implemented by clients.
- * </p>
- */
-public interface IPropertySourceProvider {
-/**
- * Returns a property source for the given object.
- *
- * @param object the object
- */
-public IPropertySource getPropertySource(Object object);
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IResourcePropertyConstants.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IResourcePropertyConstants.java
deleted file mode 100644
index 46113a0..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IResourcePropertyConstants.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * This interface documents the property constants used by the resource
- * property source.
- */
-public interface IResourcePropertyConstants {
- /**
- * The <code>IResource</code> property key for name.
- */
- public static final String P_LABEL_RES = PropertiesMessages.getString("IResourcePropertyConstants.name"); //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> property key for path.
- */
- public static final String P_PATH_RES = "org.eclipse.ui.path"; //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> property key for display path.
- */
- public static final String P_DISPLAYPATH_RES = PropertiesMessages.getString("IResourcePropertyConstants.path"); //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> property key for read-only.
- */
- public static final String P_EDITABLE_RES = "org.eclipse.ui.editable"; //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> property key for display read-only.
- */
- public static final String P_DISPLAYEDITABLE_RES = PropertiesMessages.getString("IResourcePropertyConstants.editable"); //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> category for the base values
- */
- public static final String P_FILE_SYSTEM_CATEGORY = PropertiesMessages.getString("IResourcePropertyConstants.info"); //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> property key for path.
- */
- public static final String P_SIZE_RES = "org.eclipse.ui.size"; //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> property key for displaying size
- */
- public static final String P_DISPLAY_SIZE = PropertiesMessages.getString("IResourcePropertyConstants.size"); //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> property key for path.
- */
- public static final String P_LAST_MODIFIED_RES = "org.eclipse.ui.lastmodified"; //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> category for last modified
- */
- public static final String P_DISPLAY_LAST_MODIFIED = PropertiesMessages.getString("IResourcePropertyConstants.lastModified"); //$NON-NLS-1$
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertiesMessages.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertiesMessages.java
deleted file mode 100644
index ec854c8..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertiesMessages.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps managing messages
- */
-class PropertiesMessages {
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.views.properties.messages";//$NON-NLS-1$
- private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
-private PropertiesMessages(){
- // prevent instantiation of class
-}
-/**
- * Returns the formatted message for the given key in
- * the resource bundle.
- *
- * @param key the resource name
- * @param args the message arguments
- * @return the string
- */
-public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key),args);
-}
-/**
- * Returns the resource object with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the key is returned.
- *
- * @param key the resource name
- * @return the string
- */
-public static String getString(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java
deleted file mode 100644
index f1b5eca..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java
+++ /dev/null
@@ -1,321 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.widgets.Composite;
-/**
- * Standard implementation for property descriptors.
- * <p>
- * The required attributes of property descriptors (id and display name) are
- * passed to the constructor; the optional attributes can be configured using
- * the various set methods (all have reasonable default values):
- * <ul>
- * <li><code>setDescription</code></li>
- * <li><code>setCategory</code></li>
- * <li><code>setLabelProvider</code></li>
- * <li><code>setHelpContexts</code></li>
- * </ul>
- * Subclasses should reimplement <code>getPropertyEditor</code> to provide a
- * cell editor for changing the value; otherwise the property will be
- * effectively read only.
- * </p>
- * <p>
- * There are several concrete subclasses provided in this package that cover
- * the most common cases:
- * <ul>
- * <li><code>TextPropertyDescriptor</code> - edits with a
- * <code>TextCellEditor</code></li>
- * <li><code>ComboBoxPropertyDescriptor - edits with a
- * <code>ComboBoxCellEditor</code></code></li>
- * <li><code>ColorPropertyDescriptor - edits with a
- * <code>ColorCellEditor</code></code></li>
- * </ul>
- * </p>
- */
-public class PropertyDescriptor implements IPropertyDescriptor {
-
- /**
- * The property id.
- */
- private Object id;
-
- /**
- * The name to display for the property.
- */
- private String display;
-
- /**
- * Category name, or <code>null</code> if none (the default).
- */
- private String category = null;
-
- /**
- * Description of the property, or <code>null</code> if none (the default).
- */
- private String description = null;
-
- /**
- * The help context ids, or <code>null</code> if none (the default).
- */
- private Object helpIds;
-
- /**
- * The flags used to filter the property.
- */
- private String[] filterFlags;
-
- /**
- * The object that provides the property value's text and image, or
- * <code>null</code> if the default label provider is used (the default).
- */
- private ILabelProvider labelProvider = null;
-
- /**
- * The object to validate the values in the cell editor, or <code>null</code>
- * if none (the default).
- */
- private ICellEditorValidator validator;
-
- /**
- * Indicates if the descriptor is compatible with other descriptors of this
- * type. <code>false</code> by default.
- */
- private boolean incompatible = false;
-/**
- * Creates a new property descriptor with the given id and display name
- */
-public PropertyDescriptor(Object id, String displayName) {
- Assert.isNotNull(id);
- Assert.isNotNull(displayName);
- this.id = id;
- this.display = displayName;
-}
-/**
- * The <code>PropertyDescriptor</code> implementation of this
- * <code>IPropertyDescriptor</code> method returns <code>null</code>.
- * <p>
- * Since no cell editor is returned, the property is read only.
- * </p>
- */
-public CellEditor createPropertyEditor(Composite parent) {
- return null;
-}
-/**
- * Returns <code>true</code> if this property descriptor is to be always
- * considered incompatible with any other property descriptor.
- * This prevents a property from displaying during multiple
- * selection.
- *
- * @return <code>true</code> to indicate always incompatible
- */
-protected boolean getAlwaysIncompatible() {
- return incompatible;
-}
-/**
- * The <code>PropertyDescriptor</code> implementation of this
- * <code>IPropertyDescriptor</code> method returns the value set by
- * the <code>setCategory</code> method. If unset, this method returns
- * <code>null</code> indicating the default category.
- *
- * @see #setCategory
- */
-public String getCategory() {
- return category;
-}
-/**
- * The <code>PropertyDescriptor</code> implementation of this
- * <code>IPropertyDescriptor</code> method returns the value set by
- * the <code>setDescription</code> method. If unset, this method returns
- * <code>null</code> indicating no description.
- *
- * @see #setDescription
- */
-public String getDescription() {
- return description;
-}
-/**
- * The <code>SimplePropertyDescriptor</code> implementation of this
- * <code>IPropertyDescriptor</code> method returns the value supplied
- * on the constructor.
- */
-public String getDisplayName() {
- return display;
-}
-/**
- * The <code>SimplePropertyDescriptor</code> implementation of this
- * <code>IPropertyDescriptor</code> method returns the value set by
- * the <code>setFilterFlags</code> method. If unset, this method returns
- * <code>null</code>.
- * <p>
- * Valid values for these flags are declared as constants on
- * <code>IPropertySheetEntry</code>
- */
-public String[] getFilterFlags() {
- return filterFlags;
-}
-/**
- * The <code>SimplePropertyDescriptor</code> implementation of this
- * <code>IPropertyDescriptor</code> method returns the value set by
- * the <code>setHelpContextId</code> method. If unset, this method returns
- * <code>null</code>.
- *
- * @see #setHelpContextIds
- */
-public Object getHelpContextIds() {
- return helpIds;
-}
-/**
- * The <code>PropertyDescriptor</code> implementation of this
- * <code>IPropertyDescriptor</code> method returns the value supplied
- * on the constructor.
- */
-public Object getId() {
- return id;
-}
-/**
- * The <code>PropertyDescriptor</code> implementation of this
- * <code>IPropertyDescriptor</code> method returns the value set by
- * the <code>setProvider</code> method or, if no value has been set
- * it returns a <code>LabelProvider</code>
- *
- * @see #setLabelProvider
- */
-public ILabelProvider getLabelProvider() {
- if (labelProvider != null)
- return labelProvider;
- else
- return new LabelProvider();
-}
-/**
- * Returns the input validator for editing the property.
- *
- * @return the validator used to verify correct values for this property,
- * or <code>null</code>
- */
-protected ICellEditorValidator getValidator() {
- return validator;
-}
-/**
- * The <code>SimplePropertyDescriptor</code> implementation of this
- * <code>IPropertyDescriptor</code> method returns true if the other
- * property has the same id and category and <code>getAlwaysIncompatible()</code>
- * returns false
- */
-public boolean isCompatibleWith(IPropertyDescriptor anotherProperty) {
- if (getAlwaysIncompatible())
- return false;
-
- // Compare id
- Object id1 = getId();
- Object id2 = anotherProperty.getId();
- if (!id1.equals(id2))
- return false;
-
- // Compare Category (may be null)
- if (getCategory() == null) {
- if (anotherProperty.getCategory() != null)
- return false;
- } else {
- if (!getCategory().equals(anotherProperty.getCategory()))
- return false;
- }
-
- return true;
-}
-/**
- * Sets a flag indicating whether this property descriptor is to be always
- * considered incompatible with any other property descriptor.
- * Setting this flag prevents a property from displaying during multiple
- * selection.
- *
- * @param flag <code>true</code> to indicate always incompatible
- */
-public void setAlwaysIncompatible(boolean flag) {
- incompatible = flag;
-}
-/**
- * Sets the category for this property descriptor.
- *
- * @param category the category for the descriptor, or <code>null</code> if none
- * @see #getCategory
- */
-public void setCategory(String category) {
- this.category = category;
-}
-/**
- * Sets the description for this property descriptor.
- * The description should be limited to a single line so that it can be
- * displayed in the status line.
- *
- * @param description the description, or <code>null</code> if none
- * @see #getDescription
- */
-public void setDescription(String description) {
- this.description = description;
-}
-/**
- * Sets the the filter flags for this property descriptor.
- * The description should be limited to a single line so that it can be
- * displayed in the status line.
- * <p>
- * Valid values for these flags are declared as constants on
- * <code>IPropertySheetEntry</code>
- * </p>
- *
- * @param value the filter flags
- * @see #getFilterFlags
- */
-public void setFilterFlags(String value[]) {
- filterFlags = value;
-}
-/**
- * Sets the help context id for this property descriptor.
- *
- * NOTE: Help support system API's changed since 2.0 and arrays
- * of contexts are no longer supported.
- * </p>
- * <p>
- * Thus the only valid parameter type for this method
- * is a <code>String</code> representing a context id.
- * The previously valid parameter types are deprecated.
- * The plural name for this method is unfortunate.
- * </p>
- *
- * @param contextId the help context id, or <code>null</code> if none
- * @see #getHelpContextIds
- */
-public void setHelpContextIds(Object contextIds) {
- helpIds = contextIds;
-}
-/**
- * Sets the label provider for this property descriptor.
- * <p>
- * If no label provider is set an instance of <code>LabelProvider</code>
- * will be created as the default when needed.
- * </p>
- *
- * @param labelProvider the label provider for the descriptor, or
- * <code>null</code> if the default label provider should be used
- * @see #getLabelProvider
- */
-public void setLabelProvider(ILabelProvider provider) {
- labelProvider = provider;
-}
-/**
- * Sets the input validator for the cell editor for this property descriptor.
- * <p>
- * [Issue: This method should be unnecessary is the cell editor's own
- * validator is used.
- * ]
- * </p>
- *
- * @param validator the cell input validator, or <code>null</code> if none
- */
-public void setValidator(ICellEditorValidator validator) {
- this.validator = validator;
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java
deleted file mode 100644
index da40cf0..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java
+++ /dev/null
@@ -1,205 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Main class for the Property Sheet View.
- * <p>
- * This standard view has id <code>"org.eclipse.ui.views.PropertySheet"</code>.
- * </p>
- * <p>
- * Note that property <it>sheets</it> and property sheet pages are not the
- * same thing as property <it>dialogs</it> and their property pages (the property
- * pages extension point is for contributing property pages to property dialogs).
- * Within the property sheet view, all pages are <code>IPropertySheetPage</code>s.
- * </p>
- * <p>
- * Property sheet pages are discovered by the property sheet view automatically
- * when a part is first activated. The property sheet view asks the active part
- * for its property sheet page; this is done by invoking
- * <code>getAdapter(IPropertySheetPage.class)</code> on the part. If the part
- * returns a page, the property sheet view then creates the controls for that
- * property sheet page (using <code>createControl</code>), and adds the page to
- * the property sheet view. Whenever this part becomes active, its corresponding
- * property sheet page is shown in the property sheet view (which may or may not
- * be visible at the time). A part's property sheet page is discarded when the
- * part closes. The property sheet view has a default page (an instance of
- * <code>PropertySheetPage</code>) which services all parts without a property
- * sheet page of their own.
- * </p>
- * <p>
- * The workbench will automatically instantiates this class when a Property
- * Sheet view is needed for a workbench window. This class is not intended
- * to be instantiated or subclassed by clients.
- * </p>
- *
- * @see IPropertySheetPage
- * @see PropertySheetPage
- */
-public class PropertySheet extends PageBookView implements ISelectionListener {
- /**
- * No longer used but preserved to avoid api change
- */
- public static final String HELP_CONTEXT_PROPERTY_SHEET_VIEW = IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW;
-
- /**
- * Register the adapters for the standard properties.
- */
- static {
- registerAdapters();
- }
-
- /**
- * The initial selection when the property sheet opens
- */
- private ISelection bootstrapSelection;
-/**
- * Creates a property sheet view.
- */
-public PropertySheet() {
- super();
-}
-/* (non-Javadoc)
- * Method declared on PageBookView.
- * Returns the default property sheet page.
- */
-protected IPage createDefaultPage(PageBook book) {
- PropertySheetPage page = new PropertySheetPage();
- initPage(page);
- page.createControl(book);
- return page;
-}
-/**
- * The <code>PropertySheet</code> implementation of this <code>IWorkbenchPart</code>
- * method creates a <code>PageBook</code> control with its default page showing.
- */
-public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- WorkbenchHelp.setHelp(getPageBook(), IPropertiesHelpContextIds.PROPERTY_SHEET_VIEW);
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
-public void dispose() {
- // run super.
- super.dispose();
-
- // remove ourselves as a selection listener
- getSite().getPage().removeSelectionListener(this);
-}
-/* (non-Javadoc)
- * Method declared on PageBookView.
- */
-protected PageRec doCreatePage(IWorkbenchPart part) {
- // Try to get a custom property sheet page.
- IPropertySheetPage page = (IPropertySheetPage)part.getAdapter(IPropertySheetPage.class);
- if (page != null) {
- if (page instanceof IPageBookViewPage)
- initPage((IPageBookViewPage) page);
- page.createControl(getPageBook());
- return new PageRec(part, page);
- }
-
- // Use the default page
- return null;
-}
-/* (non-Javadoc)
- * Method declared on PageBookView.
- */
-protected void doDestroyPage(IWorkbenchPart part, PageRec rec) {
- IPropertySheetPage page = (IPropertySheetPage) rec.page;
- page.dispose();
- rec.dispose();
-}
-/* (non-Javadoc)
- * Method declared on PageBookView.
- * Returns the active part on the same workbench page as this property
- * sheet view.
- */
-protected IWorkbenchPart getBootstrapPart() {
- IWorkbenchPage page = getSite().getPage();
- if (page != null) {
- bootstrapSelection = page.getSelection();
- return page.getActivePart();
- } else {
- return null;
- }
-}
-/* (non-Javadoc)
- * Method declared on IViewPart.
- */
-public void init(IViewSite site) throws PartInitException {
- site.getPage().addSelectionListener(this);
- super.init(site);
-}
-/* (non-Javadoc)
- * Method declared on PageBookView.
- * The property sheet may show properties for any view other than this view.
- */
-protected boolean isImportant(IWorkbenchPart part) {
- return part != this;
-}
-/**
- * The <code>PropertySheet</code> implementation of this <code>IPartListener</code>
- * method first sees if the active part is an <code>IContributedContentsView</code>
- * adapter and if so, asks it for its contributing part.
- */
-public void partActivated(IWorkbenchPart part) {
- IContributedContentsView view = (IContributedContentsView)part.getAdapter(IContributedContentsView.class);
- IWorkbenchPart source = null;
- if (view != null)
- source = view.getContributingPart();
- if (source != null)
- super.partActivated(source);
- else
- super.partActivated(part);
-
- // When the view is first opened, pass the selection to the page
- if (bootstrapSelection != null) {
- IPropertySheetPage page = (IPropertySheetPage)getCurrentPage();
- if (page != null)
- page.selectionChanged(part, bootstrapSelection);
- bootstrapSelection = null;
- }
-}
-/**
- * Registers the adapters for the standard properties.
- */
-static void registerAdapters() {
- IAdapterManager manager = Platform.getAdapterManager();
- IAdapterFactory factory = new StandardPropertiesAdapterFactory();
- manager.registerAdapters(factory, IWorkspace.class);
- manager.registerAdapters(factory, IWorkspaceRoot.class);
- manager.registerAdapters(factory, IProject.class);
- manager.registerAdapters(factory, IFolder.class);
- manager.registerAdapters(factory, IFile.class);
- manager.registerAdapters(factory, IMarker.class);
-}
-/* (non-Javadoc)
- * Method declared on ISelectionListener.
- * Notify the current page that the selection has changed.
- */
-public void selectionChanged(IWorkbenchPart part, ISelection sel) {
- // we ignore our own selection or null selection
- if (part == this || sel == null)
- return;
-
- // pass the selection to the page
- IPropertySheetPage page = (IPropertySheetPage)getCurrentPage();
- if(page != null)
- page.selectionChanged(part, sel);
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetAction.java
deleted file mode 100644
index 8b184e5..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetAction.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.actions.*;
-
-/**
- * This is the base class of all the local actions used
- * in the PropertySheet.
- */
-/*package*/ abstract class PropertySheetAction extends Action {
- protected PropertySheetViewer viewer;
- private String id;
-/**
- * Create a PropertySheetViewer action.
- */
-protected PropertySheetAction(PropertySheetViewer viewer, String name) {
- super (name);
- this.id = name;
- this.viewer = viewer;
-}
-/**
- * Return the unique action ID that will be
- * used in contribution managers.
- */
-public String getId() {
- return id;
-}
-/**
- * Return the PropertySheetViewer
- */
-public PropertySheetViewer getPropertySheet() {
- return viewer;
-}
-/**
- * Set the unique ID that should be used
- * in the contribution managers.
- */
-public void setId(String newId) {
- id = newId;
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetCategory.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetCategory.java
deleted file mode 100644
index 23b8075..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetCategory.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.List;
-/**
- * A category in a PropertySheet used to group <code>IPropertySheetEntry</code>
- * entries so they are displayed together.
- */
-/*package*/ class PropertySheetCategory {
- private String categoryName;
- private List entries = new ArrayList();
- private boolean shouldAutoExpand = true;
-/**
- * Create a PropertySheet category with name.
- */
-public PropertySheetCategory(String name) {
- categoryName = name;
-}
-/**
- * Add an <code>IPropertySheetEntry</code> to the list
- * of entries in this category.
- */
-public void addEntry(IPropertySheetEntry entry) {
- entries.add(entry);
-}
-/**
- * Return the category name.
- */
-public String getCategoryName() {
- return categoryName;
-}
-/**
- * Returns <code>true</code> if this category should be automatically
- * expanded. The default value is <code>true</code>.
- *
- * @return <code>true</code> if this category should be automatically
- * expanded, <code>false</code> otherwise
- */
-public boolean getAutoExpand() {
- return shouldAutoExpand;
-}
-/**
- * Sets if this category should be automatically
- * expanded.
- */
-public void setAutoExpand(boolean autoExpand) {
- shouldAutoExpand = autoExpand;
-}
-/**
- * Returns the entries in this category.
- *
- * @return the entries in this category
- */
-public IPropertySheetEntry[] getChildEntries() {
- return (IPropertySheetEntry[])entries.toArray(new IPropertySheetEntry[entries.size()]);
-}
-/**
- * Removes all of the entries in this category.
- * Doing so allows us to reuse this category entry.
- */
-public void removeAllEntries() {
- entries = new ArrayList();
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java
deleted file mode 100644
index b00694e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java
+++ /dev/null
@@ -1,641 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-import java.lang.reflect.*;
-import java.text.Collator;
-import java.util.*;
-import java.util.List;
-
-/**
- * <code>PropertySheetEntry</code> is an implementation of
- * <code>IPropertySheetEntry</code> which uses <code>IPropertySource</code>
- * and <code>IPropertyDescriptor</code> to interact with domain model objects.
- * <p>
- * Every property sheet entry has a single descriptor (except the root entry
- * which has none). This descriptor determines what property
- * of its objects it will display/edit.
- * </p>
- * <p>
- * Entries do not listen for changes in their objects. Since there is no
- * restriction on properties being independent, a change in one property
- * may affect other properties. The value of a parent's property may also
- * change. As a result we are forced to refresh the entire entry tree
- * when a property changes value.
- * </p>
- */
-/*package*/ class PropertySheetEntry implements IPropertySheetEntry {
-
- /**
- * The values we are displaying/editing.
- * These objects repesent the value of one of the
- * properties of the values of our parent entry.
- * Except for the root entry where they represent the
- * input (selected) objects.
- */
- private Object[] values = new Object[0];
-
- /**
- * The property sources for the values we are displaying/editing.
- */
- private Map sources = new HashMap(0);
-
- /**
- * The value of this entry is defined as the the first object
- * in its value array or, if that object is an
- * <code>IPropertySource</code>, the value it returns when sent
- * <code>getEditableValue</code>
- */
- private Object editValue;
-
- private PropertySheetEntry parent;
- private IPropertySourceProvider propertySourceProvider;
- private IPropertyDescriptor descriptor;
- private CellEditor editor;
- private String errorText;
- private PropertySheetEntry[] childEntries = null;
- private ListenerList listeners = new ListenerList();
-
- /**
- * Create the CellEditorListener for this entry. It listens for
- * value changes in the CellEditor, and cancel and finish requests.
- */
- private ICellEditorListener cellEditorListener = new ICellEditorListener() {
- public void editorValueChanged(boolean oldValidState, boolean newValidState) {
- if (!newValidState)
- // currently not valid so show an error message
- setErrorText(editor.getErrorMessage());
- else
- // currently valid
- setErrorText(null);
- }
- public void cancelEditor() {
- setErrorText(null);
- }
- public void applyEditorValue() {
- PropertySheetEntry.this.applyEditorValue();
- }
- };
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public void addPropertySheetEntryListener(IPropertySheetEntryListener listener) {
- listeners.add(listener);
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public void applyEditorValue() {
- // Check if editor has a valid value
- if (editor == null || !editor.isValueValid())
- return;
-
- // See if the value changed and if so update
- Object newValue = editor.getValue();
- boolean changed = false;
- if (values.length > 1) {
- changed = true;
- } else if (editValue == null) {
- if (newValue != null)
- changed = true;
- } else if (!editValue.equals(newValue))
- changed = true;
-
- // Set the editor value
- if (changed)
- setValue(newValue);
-}
-/**
- * Return the sorted intersection of all the <code>IPropertyDescriptor</code>s
- * for the objects.
- */
-private List computeMergedPropertyDescriptors() {
- if (values.length == 0)
- return new ArrayList(0);
-
- // get all descriptors from each object
- Map[] propertyDescriptorMaps = new Map[values.length];
- for (int i = 0; i < values.length; i++) {
- Object object = values[i];
- IPropertySource source = getPropertySource(object);
- if (source == null) {
- // if one of the selected items is not a property source
- // then we show no properties
- return new ArrayList(0);
- }
- // get the property descriptors keyed by id
- propertyDescriptorMaps[i] = computePropertyDescriptorsFor(source);
- }
-
- // intersect
- Map intersection = propertyDescriptorMaps[0];
- for (int i = 1; i < propertyDescriptorMaps.length; i++) {
- // get the current ids
- Object[] ids = intersection.keySet().toArray();
- for (int j = 0; j < ids.length; j++){
- Object object = propertyDescriptorMaps[i].get(ids[j]);
- if (object == null ||
- // see if the descriptors (which have the same id) are compatible
- !((IPropertyDescriptor)intersection.get(ids[j])).isCompatibleWith((IPropertyDescriptor)object))
- intersection.remove(ids[j]);
- }
- }
-
- // Sort the descriptors
- List descriptors = new ArrayList(intersection.values());
- Collections.sort(descriptors, new Comparator() {
- Collator coll = Collator.getInstance(Locale.getDefault());
- public int compare(Object a, Object b) {
- IPropertyDescriptor d1, d2;
- String dname1, dname2;
- d1 = (IPropertyDescriptor) a;
- dname1 = d1.getDisplayName();
- d2 = (IPropertyDescriptor) b;
- dname2 = d2.getDisplayName();
- return coll.compare(dname1, dname2);
- }
- });
-
- return descriptors;
-}
-/**
- * Returns an map of property descritptors (keyed on id) for the
- * given property source.
- *
- * @source a property source for which to obtain descriptors
- * @return a table of decriptors keyed on their id
- */
-private Map computePropertyDescriptorsFor(IPropertySource source) {
- IPropertyDescriptor[] descriptors = source.getPropertyDescriptors();
- Map result = new HashMap(descriptors.length*2+1);
- for (int i = 0; i < descriptors.length; i++){
- result.put(descriptors[i].getId(), descriptors[i]);
- }
- return result;
-}
-/**
- * Create our child entries.
- */
-private void createChildEntries() {
- // get the current descriptors
- List descriptors = computeMergedPropertyDescriptors();
-
- // rebuild child entries using old when possible
- childEntries = new PropertySheetEntry[descriptors.size()];
- for (int i = 0; i < descriptors.size(); i++) {
- IPropertyDescriptor d = (IPropertyDescriptor)descriptors.get(i);
- // create new entry
- PropertySheetEntry entry = new PropertySheetEntry();
- entry.setDescriptor(d);
- entry.setParent(this);
- entry.setPropertySourceProvider(propertySourceProvider);
- entry.refreshValues();
- childEntries[i] = entry;
- }
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public void dispose() {
- if (editor != null) {
- editor.dispose();
- editor = null;
- }
- // recursive call to dispose children
- if (childEntries != null)
- for (int i = 0; i < childEntries.length; i++) {
- // an error in a property source may cause refreshChildEntries
- // to fail. Since the Workbench handles such errors we
- // can be left in a state where a child entry is null.
- if (childEntries[i] != null)
- childEntries[i].dispose();
- }
-}
-/**
- * The child entries of this entry have changed
- * (children added or removed).
- * Notify all listeners of the change.
- */
-private void fireChildEntriesChanged() {
- if (listeners == null)
- return;
- Object[] array = listeners.getListeners();
- for (int i = 0; i < array.length; i++) {
- IPropertySheetEntryListener listener = (IPropertySheetEntryListener)array[i];
- listener.childEntriesChanged(this);
- }
-}
-/**
- * The error message of this entry has changed.
- * Notify all listeners of the change.
- */
-private void fireErrorMessageChanged() {
- if (listeners == null)
- return;
- Object[] array = listeners.getListeners();
- for (int i = 0; i < array.length; i++) {
- IPropertySheetEntryListener listener = (IPropertySheetEntryListener)array[i];
- listener.errorMessageChanged(this);
- }
-}
-/**
- * The values of this entry have changed.
- * Notify all listeners of the change.
- */
-private void fireValueChanged() {
- if (listeners == null)
- return;
- Object[] array = listeners.getListeners();
- for (int i = 0; i < array.length; i++) {
- IPropertySheetEntryListener listener = (IPropertySheetEntryListener)array[i];
- listener.valueChanged(this);
- }
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public String getCategory() {
- return descriptor.getCategory();
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public IPropertySheetEntry[] getChildEntries() {
- if (childEntries == null)
- createChildEntries();
- return childEntries;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public String getDescription() {
- return descriptor.getDescription();
-}
-/**
- * Returns the descriptor for this entry.
- */
-private IPropertyDescriptor getDescriptor() {
- return descriptor;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public String getDisplayName() {
- return descriptor.getDisplayName();
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public CellEditor getEditor(Composite parent) {
-
- if (editor == null) {
- editor = descriptor.createPropertyEditor(parent);
- if (editor != null) {
- editor.addListener(cellEditorListener);
- }
- }
- if (editor != null) {
- editor.setValue(editValue);
- setErrorText(editor.getErrorMessage());
- }
- return editor;
-}
-/**
- * Returns the edited value of this entry.
- *
- * @return the edited value of this entry
- */
-private Object getEditValue() {
- return editValue;
-}
-/**
- * Returns the edit value for the object at the given index.
- *
- * @param index the value object index
- * @return the edit value for the object at the given index
- */
-protected Object getEditValue(int index) {
- Object value = values[index];
- IPropertySource source = getPropertySource(value);
- if (source != null) {
- value = source.getEditableValue();
- }
- return value;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public String getErrorText() {
- return errorText;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public String getFilters() [] {
- return descriptor.getFilterFlags();
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public Object getHelpContextIds() {
- return descriptor.getHelpContextIds();
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public Image getImage() {
- ILabelProvider provider = descriptor.getLabelProvider();
- if (provider == null)
- return null;
- return provider.getImage(editValue);
-}
-/**
- * Returns the parent. This can be another <code>PropertySheetEntry</code>
- * or <code>null</code>.
- */
-private PropertySheetEntry getParent() {
- return parent;
-}
-/**
- * Returns an property source for the given object.
- *
- * @object an object for which to obtain a property source or
- * <code>null</code> if a property source is not available
- * @return an property source for the given object
- */
-private IPropertySource getPropertySource(Object object) {
- if (sources.containsKey(object))
- return (IPropertySource)sources.get(object);
-
- IPropertySource result = null;
- if (propertySourceProvider != null)
- result = propertySourceProvider.getPropertySource(object);
- else if (object instanceof IPropertySource)
- result = (IPropertySource)object;
- else if (object instanceof IAdaptable)
- result = (IPropertySource)((IAdaptable)object).getAdapter(IPropertySource.class);
-
- sources.put(object, result);
- return result;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public String getValueAsString() {
- if (editValue == null)
- return "";//$NON-NLS-1$
- ILabelProvider provider = descriptor.getLabelProvider();
- if (provider == null)
- return editValue.toString();
- return provider.getText(editValue);
-}
-/**
- * Returns the value objects of this entry.
- */
-private Object[] getValues() {
- return values;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public boolean hasChildEntries() {
- if (childEntries != null && childEntries.length > 0)
- return true;
- else
- // see if we could have entires if we were asked
- return computeMergedPropertyDescriptors().size() > 0;
-}
-/**
- * Update our child entries.
- * This implementation tries to reuse child entries if possible
- * (if the id of the new descriptor matches the descriptor id of the
- * old entry).
- */
-private void refreshChildEntries() {
- if (childEntries == null)
- // no children to refresh
- return;
-
- // get the current descriptors
- List descriptors = computeMergedPropertyDescriptors();
-
- // cache old entries by their descriptor id
- Map entryCache = new HashMap (childEntries.length*2+1);
- for (int i = 0; i < childEntries.length; i++){
- entryCache.put(childEntries[i].getDescriptor().getId(), childEntries[i]);
- }
-
- // create a list of entries to dispose
- List entriesToDispose = new ArrayList(Arrays.asList(childEntries));
-
- // rebuild child entries using old when possible
- childEntries = new PropertySheetEntry[descriptors.size()];
- boolean entriesChanged = descriptors.size() != entryCache.size();
- for (int i = 0; i < descriptors.size(); i++) {
- IPropertyDescriptor d = (IPropertyDescriptor)descriptors.get(i);
- // see if we have an entry matching this descriptor
- PropertySheetEntry entry = (PropertySheetEntry)entryCache.get(d.getId());
- if (entry != null) {
- // reuse old entry
- entry.setDescriptor(d);
- entriesToDispose.remove(entry);
- } else {
- // create new entry
- entry = new PropertySheetEntry();
- entry.setDescriptor(d);
- entry.setParent(this);
- entry.setPropertySourceProvider(propertySourceProvider);
- entriesChanged = true;
- }
- entry.refreshValues();
- childEntries[i] = entry;
- }
-
- if (entriesChanged)
- fireChildEntriesChanged();
-
- //Dispose of entries which are no longer needed
- for (int i = 0; i < entriesToDispose.size(); i++) {
- ((IPropertySheetEntry)entriesToDispose.get(i)).dispose();
- }
-}
-/**
- * Refresh the entry tree from the root down
- */
-private void refreshFromRoot() {
- if (parent == null)
- refreshChildEntries();
- else
- parent.refreshFromRoot();
-}
-/**
- * Update our value objects.
- * We ask our parent for the property values based on
- * our descriptor.
- */
-private void refreshValues() {
- // get our parent's value objects
- Object[] sources = parent.getValues();
-
- // loop through the objects getting our property value from each
- Object[] newValues = new Object[sources.length];
- for (int i = 0; i < sources.length; i++) {
- IPropertySource source = parent.getPropertySource(sources[i]);
- newValues[i] = source.getPropertyValue(descriptor.getId());
- }
-
- // set our new values
- setValues(newValues);
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public void removePropertySheetEntryListener(IPropertySheetEntryListener listener) {
- listeners.remove(listener);
-}
-/* (non-Javadoc)
- * Method declared on IPropertySheetEntry.
- */
-public void resetPropertyValue() {
- if (parent == null)
- // root does not have a default value
- return;
-
- // Use our parent's values to reset our values.
- boolean change = false;
- Object[] objects = parent.getValues();
- for (int i = 0; i < objects.length; i++){
- IPropertySource source = getPropertySource(objects[i]);
- if (source.isPropertySet(descriptor.getId())) {
- source.resetPropertyValue(descriptor.getId());
- change = true;
- }
- }
- if (change)
- refreshFromRoot();
-}
-/**
- * Set the descriptor.
- */
-private void setDescriptor(IPropertyDescriptor newDescriptor) {
- // if our descriptor is changing, we have to get rid
- // of our current editor if there is one
- if (descriptor != newDescriptor && editor != null) {
- editor.dispose();
- editor = null;
- }
- descriptor = newDescriptor;
-}
-/*
- * Set the error text. This should be set to null when
- * the current value is valid, otherwise it should be
- * set to a error string
- */
-private void setErrorText(String newErrorText) {
- errorText = newErrorText;
- // inform listeners
- fireErrorMessageChanged();
-}
-/**
- * Sets the parent of the entry.
- */
-private void setParent(PropertySheetEntry p){
- parent = p;
-}
-/*
- * Sets a property source provider for this entry.
- * This provider is used to obtain an <code>IPropertySource</code>
- * for each of this entries objects. If no provider is
- * set then a default provider is used.
- */
-public void setPropertySourceProvider(IPropertySourceProvider provider) {
- propertySourceProvider = provider;
-}
-/**
- * Set the value for this entry.
- * <p>
- * We set the given value as the value for all our value objects.
- * We then call our parent to update the property we represent
- * with the given value.
- * We then trigger a model refresh.
- * <p>
- *
- * @param newValue the new value
- */
-private void setValue(Object newValue) {
- // Set the value
- for (int i = 0; i < values.length; i++) {
- values[i] = newValue;
- }
-
- // Inform our parent
- parent.valueChanged(this);
-
- // Refresh the model
- refreshFromRoot();
-}
-/**
- * The <code>PropertySheetEntry</code> implmentation of this
- * method declared on<code>IPropertySheetEntry</code> will
- * obtain an editable value for the given objects and update
- * the child entries.
- * <p>
- * Updating the child entries will typically call this method
- * on the child entries and thus the entire entry tree is updated
- * </p>
- * @param objects the new values for this entry
- */
-public void setValues(Object[] objects) {
- values = objects;
- sources = new HashMap(values.length * 2 + 1);
-
- if (values.length == 0)
- editValue = null;
- else {
- // set the first value object as the entry's value
- Object newValue = values[0];
-
- // see if we should convert the value to an editable value
- IPropertySource source = getPropertySource(newValue);
- if (source != null)
- newValue = source.getEditableValue();
- editValue = newValue;
- }
-
- // update our child entries
- refreshChildEntries();
-
- // inform listeners that our value changed
- fireValueChanged();
-}
-/**
- * The value of the given child entry has changed.
- * Therefore we must set this change into our value objects.
- * <p>
- * We must inform our parent so that it can update its value objects
- * </p>
- * <p>
- * Subclasses may override to set the property value in some
- * custom way.
- * </p>
- *
- * @param the child entry that changed its value
- */
-protected void valueChanged(PropertySheetEntry child) {
- for (int i = 0; i < values.length; i++) {
- IPropertySource source = getPropertySource(values[i]);
- source.setPropertyValue(child.getDescriptor().getId(), child.getEditValue(i));
- }
-
- // inform our parent
- if (parent != null)
- parent.valueChanged(this);
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java
deleted file mode 100644
index 2918249..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java
+++ /dev/null
@@ -1,370 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.help.IContext;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.custom.TableTree;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.swt.events.HelpListener;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.IContextComputer;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.ui.part.Page;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * The standard implementation of property sheet page which presents
- * a table of property names and values obtained from the current selection
- * in the active workbench part.
- * <p>
- * This page obtains the information about what to properties display from
- * the current selection (which it tracks).
- * </p>
- * <p>
- * The model for this page is a hierarchy of <code>IPropertySheetEntry</code>.
- * The page may be configured with a custom model by setting the root entry.
- * <p>
- * If no root entry is set then a default model is created which uses the
- * <code>IPropertySource</code> interface to obtain the properties of
- * the current slection. This requires that the selected objects provide an
- * <code>IPropertySource</code> adapter (or implement
- * <code>IPropertySource</code> directly). This restiction can be overcome
- * by providing this page with an <code>IPropertySourceProvider</code>. If
- * supplied, this provider will be used by the default model to obtain a
- * property source for the current selection
- * </p>
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- *
- * @see IPropertySource
- */
-public class PropertySheetPage extends Page implements IPropertySheetPage {
- /**
- * Help context id
- * (value <code>"org.eclipse.ui.property_sheet_page_help_context"</code>).
- */
- public static final String HELP_CONTEXT_PROPERTY_SHEET_PAGE = "org.eclipse.ui.property_sheet_page_help_context"; //$NON-NLS-1$
-
- private PropertySheetViewer viewer;
- private IPropertySheetEntry rootEntry;
- private IPropertySourceProvider provider;
-
- private DefaultsAction defaultsAction;
- private FilterAction filterAction;
- private CategoriesAction categoriesAction;
- private CopyPropertyAction copyAction;
-
- private IActionBars actionBars;
- private ICellEditorActivationListener cellEditorActivationListener;
- private CellEditorActionHandler cellEditorActionHandler;
- /**
- * Creates a new property sheet page.
- */
- public PropertySheetPage() {
- super();
- }
- /* (non-Javadoc)
- * Method declared on <code>IPage</code>.
- */
- public void createControl(Composite parent) {
- // create a new viewer
- viewer = new PropertySheetViewer(parent);
-
- // set the model for the viewer
- if (rootEntry == null) {
- // create a new root
- PropertySheetEntry root = new PropertySheetEntry();
- if (provider != null)
- // set the property source provider
- root.setPropertySourceProvider(provider);
- rootEntry = root;
- }
- viewer.setRootEntry(rootEntry);
- viewer.addActivationListener(getCellEditorActivationListener());
- // add a listener to track when the entry selection changes
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleEntrySelection((IStructuredSelection) event.getSelection());
- }
- });
- initDragAndDrop();
-
- // Create the popup menu for the page.
- copyAction = new CopyPropertyAction(viewer, "copy"); //$NON-NLS-1$
- copyAction.setImageDescriptor(getImageDescriptor("etool16/copy_edit.gif")); //$NON-NLS-1$
- copyAction.setHoverImageDescriptor(getImageDescriptor("ctool16/copy_edit.gif")); //$NON-NLS-1$
-
- MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.add(copyAction);
- Menu menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
-
- // Set help on the viewer
- viewer.getControl().addHelpListener(new HelpListener() {
- /*
- * @see HelpListener#helpRequested(HelpEvent)
- */
- public void helpRequested(HelpEvent e) {
- // Get the context for the selected item
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- if (!selection.isEmpty()) {
- IPropertySheetEntry entry = (IPropertySheetEntry)selection.getFirstElement();
- Object helpContextId = entry.getHelpContextIds();
- if (helpContextId != null) {
- if (helpContextId instanceof String) {
- WorkbenchHelp.displayHelp((String)helpContextId);
- return;
- }
-
- // Since 2.0 the only valid type for helpContextIds
- // is a String (a single id).
- // However for backward compatibility we have to handle
- // and array of contexts (Strings and/or IContexts)
- // or a context computer.
- Object[] contexts = null;
- if (helpContextId instanceof IContextComputer) {
- // get local contexts
- contexts = ((IContextComputer)helpContextId).getLocalContexts(e);
- } else {
- contexts = (Object[])helpContextId;
- }
- // Ignore all but the first element in the array
- if (contexts[0] instanceof IContext)
- WorkbenchHelp.displayHelp((IContext)contexts[0]);
- else
- WorkbenchHelp.displayHelp((String)contexts[0]);
- return;
- }
- }
-
- // No help for the selection so show page help
- WorkbenchHelp.displayHelp(HELP_CONTEXT_PROPERTY_SHEET_PAGE);
- }
- });
- }
- /**
- * The <code>PropertySheetPage</code> implementation of this <code>IPage</code> method
- * disposes of this page's entries.
- */
- public void dispose() {
- super.dispose();
- if (rootEntry != null)
- rootEntry.dispose();
- }
- /**
- * Returns the cell editor activation listener for this page
- */
- private ICellEditorActivationListener getCellEditorActivationListener() {
- if (cellEditorActivationListener == null) {
- cellEditorActivationListener = new ICellEditorActivationListener() {
- public void cellEditorActivated(CellEditor cellEditor) {
- if (cellEditorActionHandler != null)
- cellEditorActionHandler.addCellEditor(cellEditor);
- }
- public void cellEditorDeactivated(CellEditor cellEditor) {
- if (cellEditorActionHandler != null)
- cellEditorActionHandler.removeCellEditor(cellEditor);
- }
- };
- }
- return cellEditorActivationListener;
- }
- /* (non-Javadoc)
- * Method declared on IPage (and Page).
- */
- public Control getControl() {
- if (viewer == null)
- return null;
- return viewer.getControl();
- }
- /**
- * Returns the image descriptor with the given relative path.
- */
- private ImageDescriptor getImageDescriptor(String relativePath) {
- String iconPath = "icons/full/"; //$NON-NLS-1$
-
- try {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- URL installURL = plugin.getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + relativePath);
- return ImageDescriptor.createFromURL(url);
- } catch (MalformedURLException e) {
- // Should not happen
- return null;
- }
- }
- /**
- * Handles a selection change in the entry table.
- *
- * @param selection the new selection
- */
- public void handleEntrySelection(ISelection selection) {
- if (defaultsAction != null)
- defaultsAction.setEnabled(!selection.isEmpty());
- }
- /**
- * Adds drag and drop support.
- */
- protected void initDragAndDrop() {
- int operations = DND.DROP_COPY;
- Transfer[] transferTypes = new Transfer[]{
- TextTransfer.getInstance()};
- DragSourceListener listener = new DragSourceAdapter() {
- public void dragSetData(DragSourceEvent event){
- performDragSetData(event);
- }
- public void dragFinished(DragSourceEvent event){
- }
- };
- DragSource dragSource = new DragSource(((TableTree)viewer.getControl()).getTable(), operations);
- dragSource.setTransfer(transferTypes);
- dragSource.addDragListener(listener);
- }
- /**
- * The user is attempting to drag. Add the appropriate
- * data to the event.
- */
- void performDragSetData(DragSourceEvent event) {
- // Get the selected property
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- if (selection.isEmpty())
- return;
- // Assume single selection
- IPropertySheetEntry entry = (IPropertySheetEntry)selection.getFirstElement();
-
- // Place text as the data
- StringBuffer buffer = new StringBuffer();
- buffer.append(entry.getDisplayName());
- buffer.append("\t"); //$NON-NLS-1$
- buffer.append(entry.getValueAsString());
-
- event.data = buffer.toString();
- }
- /**
- * Make action objects.
- */
- private void makeActions() {
- // Default values
- defaultsAction = new DefaultsAction(viewer, "defaults"); //$NON-NLS-1$
- defaultsAction.setToolTipText(PropertiesMessages.getString("Page.defaultToolTip")); //$NON-NLS-1$
- defaultsAction.setImageDescriptor(getImageDescriptor("elcl16/defaults_ps.gif")); //$NON-NLS-1$
- defaultsAction.setHoverImageDescriptor(getImageDescriptor("clcl16/defaults_ps.gif")); //$NON-NLS-1$
- defaultsAction.setDisabledImageDescriptor(getImageDescriptor("dlcl16/defaults_ps.gif")); //$NON-NLS-1$
- defaultsAction.setEnabled(false);
-
- // Filter (expert)
- filterAction = new FilterAction(viewer, "filter"); //$NON-NLS-1$
- filterAction.setToolTipText(PropertiesMessages.getString("Page.filterToolTip")); //$NON-NLS-1$
- filterAction.setImageDescriptor(getImageDescriptor("elcl16/filter_ps.gif")); //$NON-NLS-1$
- filterAction.setHoverImageDescriptor(getImageDescriptor("clcl16/filter_ps.gif")); //$NON-NLS-1$
- filterAction.setChecked(false);
-
- // Categories
- categoriesAction = new CategoriesAction(viewer, "categories"); //$NON-NLS-1$
- categoriesAction.setToolTipText(PropertiesMessages.getString("Page.categoriesToolTip")); //$NON-NLS-1$
- categoriesAction.setImageDescriptor(getImageDescriptor("elcl16/tree_mode.gif")); //$NON-NLS-1$
- categoriesAction.setHoverImageDescriptor(getImageDescriptor("clcl16/tree_mode.gif")); //$NON-NLS-1$
- categoriesAction.setChecked(true);
- }
- /* (non-Javadoc)
- * Method declared on IPage (and Page).
- */
- public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
-
- // make the actions
- makeActions();
-
- // add actions to the tool bar
- toolBarManager.add(categoriesAction);
- toolBarManager.add(filterAction);
- toolBarManager.add(defaultsAction);
-
- // set status line manager into the viewer
- viewer.setStatusLineManager(statusLineManager);
- }
- /**
- * Updates the model for the viewer.
- * <p>
- * Note that this means ensuring that the model reflects the state
- * of the current viewer input.
- * </p>
- */
- public void refresh() {
- if (viewer == null)
- return;
- // calling setInput on the viewer will cause the model to refresh
- viewer.setInput(viewer.getInput());
- }
- /* (non-Javadoc)
- * Method declared on ISelectionListener.
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- if (viewer == null)
- return;
-
- // change the viewer input since the workbench selection has changed.
- if (selection instanceof IStructuredSelection) {
- viewer.setInput(((IStructuredSelection) selection).toArray());
- }
- }
- /**
- * The <code>PropertySheetPage</code> implementation of this <code>IPage</code> method
- * calls <code>makeContributions</code> for backwards compatibility with
- * previous versions of <code>IPage</code>.
- * <p>
- * Subclasses may reimplement.
- * </p>
- */
- public void setActionBars(IActionBars actionBars) {
- super.setActionBars(actionBars);
- cellEditorActionHandler = new CellEditorActionHandler(actionBars);
- cellEditorActionHandler.setCopyAction(copyAction);
- }
- /**
- * Sets focus to a part in the page.
- */
- public void setFocus() {
- viewer.getControl().setFocus();
- }
- /**
- * Sets the given property source provider as
- * the property source provider
- * <p>
- * Calling this method is only valid if you are using
- * this page's defualt root entry
- * </p>
- * @param newProvider the property source provider
- */
- public void setPropertySourceProvider(IPropertySourceProvider newProvider) {
- provider = newProvider;
- if (rootEntry instanceof PropertySheetEntry) {
- ((PropertySheetEntry) rootEntry).setPropertySourceProvider(provider);
- // the following will trigger an update
- viewer.setRootEntry(rootEntry);
- }
- }
- /**
- * Sets the given entry as the model for the page.
- *
- * @param entry the root entry
- */
- public void setRootEntry(IPropertySheetEntry entry) {
- rootEntry = entry;
- if (viewer != null)
- // the following will trigger an update
- viewer.setRootEntry(rootEntry);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPageContextComputer.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPageContextComputer.java
deleted file mode 100644
index 004304a..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPageContextComputer.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.help.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.swt.widgets.Control;
-import java.util.*;
-
-/**
- * For determining the help context for a property sheet page.
- */
-/* package */ class PropertySheetPageContextComputer implements IContextComputer {
- private PropertySheetViewer viewer;
- private ArrayList contextList;
- private Object context;
-/**
- * Creates a new context computer for a property sheet page.
- *
- * @param page the property sheet page
- * @param helpContext a single help context id (type <code>String</code>) or
- * help context object (type <code>IContext</code>)
- */
-public PropertySheetPageContextComputer(PropertySheetViewer propertySheetViewer, Object helpContext) {
- Assert.isTrue(helpContext instanceof String || helpContext instanceof IContext);
- viewer = propertySheetViewer;
- context = helpContext;
-}
-/**
- * Add the contexts to the context list.
- *
- * @param object the contexts (<code>Object[]</code> or <code>IContextComputer</code>)
- * @param event the help event
- */
-private void addContexts(Object object, HelpEvent event) {
- Assert.isTrue(
- object instanceof Object[] ||
- object instanceof IContextComputer ||
- object instanceof String);
-
- if (object instanceof String) {
- contextList.add(object);
- return;
- }
-
- Object[] contexts;
- if (object instanceof IContextComputer)
- // get local contexts
- contexts = ((IContextComputer)object).getLocalContexts(event);
- else
- contexts = (Object[])object;
-
- // copy the contexts into our list
- for (int i = 0; i < contexts.length; i++)
- contextList.add(contexts[i]);
-}
-/* (non-Javadoc)
- * Method declared on IContextComputer.
- */
-public Object[] computeContexts(HelpEvent event) {
- contextList = new ArrayList();
-
- // Add the context for the selected item
- IStructuredSelection selection = (IStructuredSelection)viewer.getSelection();
- if (!selection.isEmpty()) {
- IPropertySheetEntry entry = (IPropertySheetEntry)selection.getFirstElement();
- Object helpContextIds = entry.getHelpContextIds();
- if (helpContextIds != null)
- addContexts(helpContextIds, event);
- }
-
- // Add the context for the page
- contextList.add(context);
-
- // Return the contexts
- return contextList.toArray();
-}
-/**
- * Returns the context set on this page.
- *
- * @return the context set on this page. (type <code>String</code>) or
- * help context object (type <code>IContext</code>)
- */
-public Object[] getLocalContexts(HelpEvent event) {
- return new Object[] {context};
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java
deleted file mode 100644
index 5eba64d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java
+++ /dev/null
@@ -1,1070 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.Collator;
-import java.util.*;
-import java.util.List; // otherwise ambiguous
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.viewers.*;
-/**
- * The PropertySheetViewer displays the properties of objects.
- * The model for the viewer consists of a hierarchy of
- * <code>IPropertySheetEntry</code>.
- * <p>
- * This viewer also supports the optional catogorization of the first level
- * <code>IPropertySheetEntry</code>s by using instances of
- * <code>PropertySheetCategory</code>.
- *
- */
-/*package*/
-class PropertySheetViewer extends Viewer {
- // The input objects for the viewer
- private Object[] input;
-
- // The root entry of the viewer
- private IPropertySheetEntry rootEntry;
-
- // The current categories
- private PropertySheetCategory[] categories;
-
- // SWT widgets
- private TableTree tableTree;
- private TableTreeEditor tableTreeEditor;
- private static String[] columnLabels = { PropertiesMessages.getString("PropertyViewer.property"), PropertiesMessages.getString("PropertyViewer.value")}; //$NON-NLS-2$ //$NON-NLS-1$
- private static String MISCELLANEOUS_CATEGORY_NAME = PropertiesMessages.getString("PropertyViewer.miscellaneousCategoryName"); //$NON-NLS-1$
-
- // Cell editor support.
- private int columnToEdit = 1;
- private CellEditor cellEditor;
- private IPropertySheetEntryListener entryListener;
- private ICellEditorListener editorListener;
-
- // Flag to indicate if categories (if any) should be shown
- private boolean isShowingCategories = true;
- // Flag to indicate expert properties should be shown
- private boolean isShowingExpertProperties = false;
-
- // The status line manager for showing messages
- private IStatusLineManager statusLineManager;
-
- // Cell editor activation listeners
- private ListenerList activationListeners = new ListenerList(3);
- /**
- * Creates a property sheet viewer on a newly-created table tree control
- * under the given parent. The viewer has no input, and no root entry.
- *
- * @param parent the parent control
- */
- public PropertySheetViewer(Composite parent) {
- tableTree = new TableTree(parent, SWT.FULL_SELECTION | SWT.SINGLE | SWT.HIDE_SELECTION);
-
- // configure the widget
- Table table = tableTree.getTable();
- table.setLinesVisible(true);
- table.setHeaderVisible(true);
-
- // configure the columns
- addColumns();
-
- // add our listeners to the widget
- hookControl();
-
- // create a new table tree editor
- tableTreeEditor = new TableTreeEditor(tableTree);
-
- // create the entry and editor listener
- createEntryListener();
- createEditorListener();
- }
- /**
- * Activate a cell editor for the given selected table tree item.
- *
- * @param item the selected table tree item
- */
- private void activateCellEditor(TableTreeItem item) {
- // ensure the cell editor is visible
- tableTree.showSelection();
-
- // Get the entry for this item
- IPropertySheetEntry activeEntry = (IPropertySheetEntry) item.getData();
-
- // Get the cell editor for the entry.
- // Note that the editor parent must be the Table control
- // that is underneath the TableTree
- cellEditor = activeEntry.getEditor(tableTree.getTable());
-
- if (cellEditor == null)
- // unable to create the editor
- return;
-
- // activate the cell editor
- cellEditor.activate();
-
- // if the cell editor has no control we can stop now
- Control control = cellEditor.getControl();
- if (control == null) {
- cellEditor.deactivate();
- cellEditor = null;
- return;
- }
-
- // add our editor listener
- cellEditor.addListener(editorListener);
-
- // set the layout of the table tree editor to match the cell editor
- CellEditor.LayoutData layout = cellEditor.getLayoutData();
- tableTreeEditor.horizontalAlignment = layout.horizontalAlignment;
- tableTreeEditor.grabHorizontal = layout.grabHorizontal;
- tableTreeEditor.minimumWidth = layout.minimumWidth;
- tableTreeEditor.setEditor(control, item, columnToEdit);
-
- // set the error text from the cel editor
- setErrorMessage(cellEditor.getErrorMessage());
-
- // give focus to the cell editor
- cellEditor.setFocus();
-
- // notify of activation
- fireCellEditorActivated(cellEditor);
- }
- /**
- * Adds a cell editor activation listener.
- * Has no effect if an identical activation listener
- * is already registered.
- *
- * @param listener a cell editor activation listener
- */
- /*package*/
- void addActivationListener(ICellEditorActivationListener listener) {
- activationListeners.add(listener);
- }
- /**
- * Add columns to the table tree and
- * set up the layout manager accordingly.
- */
- private void addColumns() {
- Table table = tableTree.getTable();
-
- // create the columns
- TableColumn[] columns = table.getColumns();
- for (int i = 0; i < columnLabels.length; i++) {
- String string = columnLabels[i];
- if (string != null) {
- TableColumn column;
- if (i < columns.length)
- column = columns[i];
- else
- column = new TableColumn(table, 0);
- column.setText(string);
- }
- }
-
- // property column
- ColumnLayoutData c1Layout = new ColumnWeightData(40, false);
-
- // value column
- ColumnLayoutData c2Layout = new ColumnWeightData(60, true);
-
- // set columns in Table layout
- TableLayout layout = new TableLayout();
- layout.addColumnData(c1Layout);
- layout.addColumnData(c2Layout);
- table.setLayout(layout);
- }
- /**
- * Asks the entry currently being edited to apply its
- * current cell editor value.
- */
- private void applyEditorValue() {
- TableTreeItem treeItem = tableTreeEditor.getItem();
- // treeItem can be null when view is opened
- if (treeItem == null || treeItem.isDisposed())
- return;
- IPropertySheetEntry entry = (IPropertySheetEntry) treeItem.getData();
- entry.applyEditorValue();
- }
- /**
- * Creates the child items for the given widget (item or table tree).
- * This method is called when the item is expanded for the first time or
- * when an item is assigned as the root of the table tree.
- */
- private void createChildren(Widget widget) {
- // get the current child items
- TableTreeItem[] childItems;
- if (widget == tableTree)
- childItems = tableTree.getItems();
- else {
- childItems = ((TableTreeItem) widget).getItems();
- }
-
- if (childItems.length > 0) {
- Object data = childItems[0].getData();
- if (data != null)
- // children already there!
- return;
- else
- // remove the dummy
- childItems[0].dispose();
- }
-
- // get the children and create their table tree items
- Object node = widget.getData();
- List children = getChildren(node);
- if (children.isEmpty())
- // this item does't actually have any children
- return;
- for (int i = 0; i < children.size(); i++) {
- // create a new table tree item
- createItem(children.get(i), widget, i);
- }
- }
- /**
- * Creates a new cell editor listener.
- */
- private void createEditorListener() {
- editorListener = new ICellEditorListener() {
- public void cancelEditor() {
- deactivateCellEditor();
- }
- public void editorValueChanged(boolean oldValidState, boolean newValidState) {
- }
- public void applyEditorValue() {
- }
- };
- }
- /**
- * Creates a new property sheet entry listener.
- */
- private void createEntryListener() {
- entryListener = new IPropertySheetEntryListener() {
- public void childEntriesChanged(IPropertySheetEntry entry) {
- // update the children of the given entry
- if (entry == rootEntry)
- updateChildrenOf(entry, tableTree);
- else {
- TableTreeItem item = findItem(entry);
- if (item != null)
- updateChildrenOf(entry, item);
- }
- }
- public void valueChanged(IPropertySheetEntry entry) {
- // update the given entry
- TableTreeItem item = findItem(entry);
- if (item != null)
- updateEntry(entry, item);
- }
- public void errorMessageChanged(IPropertySheetEntry entry) {
- // update the error message
- setErrorMessage(entry.getErrorText());
- }
- };
- }
- /**
- * Creates a new table tree item, sets the given entry or
- * category (node)in its user data field, and adds a listener to
- * the node if it is an entry.
- *
- * @param node the entry or category associated with this item
- * @param parent the parent widget
- * @param index indicates the position to insert the item
- * into its parent
- */
- private void createItem(Object node, Widget parent, int i) {
- // create the item
- TableTreeItem item;
- if (parent instanceof TableTreeItem)
- item = new TableTreeItem((TableTreeItem) parent, SWT.NONE, i);
- else
- item = new TableTreeItem((TableTree) parent, SWT.NONE, i);
-
- // set the user data field
- item.setData(node);
-
- // add our listener
- if (node instanceof IPropertySheetEntry)
- ((IPropertySheetEntry) node).addPropertySheetEntryListener(entryListener);
-
- // update the visual presentation
- if (node instanceof IPropertySheetEntry)
- updateEntry((IPropertySheetEntry) node, item);
- else
- updateCategory((PropertySheetCategory) node, item);
- }
- /**
- * Deactivate the currently active cell editor.
- */
- /*package*/
- void deactivateCellEditor() {
- tableTreeEditor.setEditor(null, null, columnToEdit);
- if (cellEditor != null) {
- cellEditor.deactivate();
- fireCellEditorDeactivated(cellEditor);
- cellEditor.removeListener(editorListener);
- cellEditor = null;
- }
- // clear any error message from the editor
- setErrorMessage(null);
- }
- /**
- * Sends out a selection changed event for the entry table to all
- * registered listeners.
- */
- private void entrySelectionChanged() {
- SelectionChangedEvent changeEvent = new SelectionChangedEvent(this, getSelection());
- fireSelectionChanged(changeEvent);
- }
- /**
- * Return a table tree item in the property sheet that has
- * the same entry in its user data field as the supplied
- * entry. Return <code>null</code> if there is no such item.
- *
- * @param entry the entry to serach for
- */
- private TableTreeItem findItem(IPropertySheetEntry entry) {
- // Iterate through tableTreeItems to find item
- TableTreeItem[] items = tableTree.getItems();
- for (int i = 0; i < items.length; i++) {
- TableTreeItem item = items[i];
- TableTreeItem findItem = findItem(entry, item);
- if (findItem != null)
- return findItem;
- }
- return null;
- }
- /**
- * Return a table tree item in the property sheet that has
- * the same entry in its user data field as the supplied
- * entry. Return <code>null</code> if there is no such item.
- *
- * @param entry the entry to search for
- * @param item the item look in
- */
- private TableTreeItem findItem(IPropertySheetEntry entry, TableTreeItem item) {
- // compare with current item
- if (entry == item.getData())
- return item;
-
- // recurse over children
- TableTreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- TableTreeItem childItem = items[i];
- TableTreeItem findItem = findItem(entry, childItem);
- if (findItem != null)
- return findItem;
- }
- return null;
- }
- /**
- * Notifies all registered cell editor activation listeners
- * of a cell editor activation.
- *
- * @param cellEditor the activated cell editor
- */
- private void fireCellEditorActivated(CellEditor cellEditor) {
- Object[] listeners = activationListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ICellEditorActivationListener) listeners[i]).cellEditorActivated(cellEditor);
- }
- }
- /**
- * Notifies all registered cell editor activation listeners
- * of a cell editor deactivation.
- *
- * @param cellEditor the deactivated cell editor
- */
- private void fireCellEditorDeactivated(CellEditor cellEditor) {
- Object[] listeners = activationListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((ICellEditorActivationListener) listeners[i]).cellEditorDeactivated(cellEditor);
- }
- }
- /**
- * Returns the active cell editor of this property sheet viewer
- * or <code>null</code> if no cell editor is active.
- *
- * @return the active cell editor
- */
- public CellEditor getActiveCellEditor() {
- return cellEditor;
- }
- /**
- * Returns the children of the given category or entry
- *
- * @node a category or entry
- * @return the children of the given category or entry
- * (element type <code>IPropertySheetEntry</code> or
- * <code>PropertySheetCategory</code>)
- */
- private List getChildren(Object node) {
- // cast the entry or category
- IPropertySheetEntry entry = null;
- PropertySheetCategory category = null;
- if (node instanceof IPropertySheetEntry)
- entry = (IPropertySheetEntry) node;
- else
- category = (PropertySheetCategory) node;
-
- // get the child entries or categories
- List children;
- if (category == null)
- children = getChildren(entry);
- else
- children = getChildren(category);
-
- return children;
- }
- /**
- * Returns the child entries of the given entry
- *
- * @return the children of the given entry
- * (element type <code>IPropertySheetEntry</code>)
- */
- private List getChildren(IPropertySheetEntry entry) {
- // if the entry is the root and we are showing categories, and we have more than the
- // defualt category, return the categories
- if (entry == rootEntry && isShowingCategories) {
- if (categories.length > 1 ||
- (categories.length == 1 &&
- !categories[0].getCategoryName().equals(MISCELLANEOUS_CATEGORY_NAME)))
- return Arrays.asList(categories);
- }
-
- // return the filtered child entries
- return getFilteredEntries(entry.getChildEntries());
- }
- /**
- * Returns the child entries of the given category
- *
- * @return the children of the given category
- * (element type <code>IPropertySheetEntry</code>)
- */
- private List getChildren(PropertySheetCategory category) {
- return getFilteredEntries(category.getChildEntries());
- }
- /* (non-Javadoc)
- * Method declared on Viewer.
- */
- public Control getControl() {
- return tableTree;
- }
- /**
- * Returns the entries which match the current filter.
- *
- * @entries the entries to filter
- * @return the entries which match the current filter
- * (element type <code>IPropertySheetEntry</code>)
- */
- private List getFilteredEntries(IPropertySheetEntry[] entires) {
- // if no filter just return all entries
- if (!isShowingExpertProperties)
- return Arrays.asList(entires);
-
- // check each entry for the filter
- List filteredEntries = new ArrayList(entires.length);
- for (int i = 0; i < entires.length; i++) {
- String[] filters = ((IPropertySheetEntry) entires[i]).getFilters();
- boolean expert = false;
- if (filters != null) {
- for (int j = 0; j < filters.length; j++) {
- if (filters[j].equals(IPropertySheetEntry.FILTER_ID_EXPERT)) {
- expert = true;
- break;
- }
- }
- }
- if (!expert)
- filteredEntries.add(entires[i]);
- }
- return filteredEntries;
- }
- /**
- * The <code>PropertySheetViewer</code> implementation of this
- * method declared on <code>IInputProvider</code> returns the
- * objects for which the viewer is currently showing properties.
- * It returns an <code>Object[]</code> or <code>null</code>.
- */
- public Object getInput() {
- return input;
- }
- /**
- * Returns the root entry for this property sheet viewer.
- * The root entry is not visible in the viewer.
- *
- * @return the root entry or <code>null</code>.
- */
- public IPropertySheetEntry getRootEntry() {
- return rootEntry;
- }
- /**
- * The <code>PropertySheetViewer</code> implementation of this
- * <code>ISelectionProvider</code> method
- * returns the result as a <code>StructuredSelection</code>.
- * <p>
- * Note that this method only includes <code>IPropertySheetEntry</code>
- * in the selection (no categories).
- * </p>
- */
- public ISelection getSelection() {
- if (tableTree.getSelectionCount() == 0)
- return StructuredSelection.EMPTY;
- TableTreeItem[] sel = tableTree.getSelection();
- List entries = new ArrayList(sel.length);
- for (int i = 0; i < sel.length; i++) {
- TableTreeItem ti = sel[i];
- Object data = ti.getData();
- if (data instanceof IPropertySheetEntry)
- entries.add(data);
- }
- return new StructuredSelection(entries);
- }
- /**
- * Selection in the viewer occurred.
- * Check if there is an active cell editor.
- * If yes, deactivate it and check if a new cell editor must be activated.
- *
- * @param event the selection event
- */
- private void handleSelect(SelectionEvent event) {
- // deactivate the current cell editor
- if (cellEditor != null) {
- applyEditorValue();
- deactivateCellEditor();
- }
-
- // get the new selection
- TableTreeItem[] sel = tableTree.getSelection();
- if (sel.length == 0) {
- setMessage(null);
- setErrorMessage(null);
- } else {
- Object object = sel[0].getData(); // assume single selection
- if (object instanceof IPropertySheetEntry) {
- // get the entry for this item
- IPropertySheetEntry activeEntry = (IPropertySheetEntry) object;
-
- // display the description for the item
- setMessage(activeEntry.getDescription());
-
- // activate a cell editor on the selection
- activateCellEditor(sel[0]);
- }
- }
- entrySelectionChanged();
- }
- /**
- * The expand icon for a node in this viewer has been
- * selected to collapse a subtree. Deactivate the cell editor
- *
- * @param event the SWT tree event
- */
- private void handleTreeCollapse(TreeEvent event) {
- if (cellEditor != null) {
- applyEditorValue();
- deactivateCellEditor();
- }
- }
- /**
- * The expand icon for a node in this viewer has been
- * selected to expand the subtree. Create the children
- * 1 level deep.
- * <p>
- * Note that we use a "dummy" item (no user data) to show a "+"
- * icon beside an item which has children before the item is expanded
- * now that it is being expanded we have to create the real child
- * items
- * </p>
- *
- * @param event the SWT tree event
- */
- private void handleTreeExpand(TreeEvent event) {
- createChildren(event.item);
- }
- /**
- * Hides the categories.
- */
- /*package*/
- void hideCategories() {
- isShowingCategories = false;
- categories = null;
- refresh();
- }
- /**
- * Hides the expert properties.
- */
- /*package*/
- void hideExpert() {
- isShowingExpertProperties = false;
- refresh();
- }
- /**
- * Establish this viewer as a listener on the control
- */
- private void hookControl() {
- // Handle selections in the TableTree
- tableTree.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleSelect(e);
- }
- });
-
- // Add a tree listener to expand and collapse which
- // allows for lazy creation of children
- tableTree.addTreeListener(new TreeListener() {
- public void treeExpanded(final TreeEvent event) {
- handleTreeExpand(event);
- }
- public void treeCollapsed(final TreeEvent event) {
- handleTreeCollapse(event);
- }
- });
-
- // Refresh the table when F5 pressed
- tableTree.getTable().addKeyListener(new KeyAdapter() {
- public void keyReleased(KeyEvent e) {
- if (e.character == SWT.ESC)
- deactivateCellEditor();
- else if (e.keyCode == SWT.F5)
- // The following will simulate a reselect
- setInput(getInput());
- }
- });
- }
- /**
- * Updates all of the items in the tree.
- * <p>
- * Note that this means ensuring that the tree items reflect the state
- * of the model (entry tree) it does not mean telling the model to update
- * itself.
- * </p>
- */
- public void refresh() {
- if (rootEntry != null) {
- updateChildrenOf(rootEntry, tableTree);
- }
- }
- /**
- * Removes the given cell editor activation listener
- * from this viewer.
- * Has no effect if an identical activation listener
- * is not registered.
- *
- * @param listener a cell editor activation listener
- */
- /*package*/
- void removeActivationListener(ICellEditorActivationListener listener) {
- activationListeners.remove(listener);
- }
- /**
- * Remove the given item from the table tree.
- * Remove our listener if the item's user data is a
- * an entry then set the user data to null
- *
- * @param item the item to remove
- */
- private void removeItem(TableTreeItem item) {
- Object data = item.getData();
- if (data instanceof IPropertySheetEntry)
- ((IPropertySheetEntry) data).removePropertySheetEntryListener(entryListener);
- item.setData(null);
- item.dispose();
- }
- /**
- * Reset the selected properties to their default values.
- */
- public void resetProperties() {
- // Determine the selection
- IStructuredSelection selection = (IStructuredSelection) getSelection();
-
- // Iterate over entries and reset them
- Iterator enum = selection.iterator();
- while (enum.hasNext())
- ((IPropertySheetEntry) enum.next()).resetPropertyValue();
- }
- /**
- * Sets the error message to be displayed in the status line.
- *
- * @param errorMessage the message to be displayed, or <code>null</code>
- */
- private void setErrorMessage(String errorMessage) {
- // show the error message
- if (statusLineManager != null)
- statusLineManager.setErrorMessage(errorMessage);
- }
- /**
- * The <code>PropertySheetViewer</code> implementation of this
- * method declared on <code>Viewer</code> method sets the objects
- * for which the viewer is currently showing properties.
- * <p>
- * The input must be an <code>Object[]</code> or <code>null</code>.
- * </p>
- * @param input the input of this viewer, or <code>null</code> if none
- */
- public void setInput(Object newInput) {
- // need to save any changed value when user clicks elsewhere
- applyEditorValue();
- // deactivate our cell editor
- deactivateCellEditor();
-
- // set the new input to the root entry
- input = (Object[]) newInput;
- if (input == null)
- input = new Object[0];
-
- if (rootEntry != null) {
- rootEntry.setValues(input);
- // ensure first level children are visible
- updateChildrenOf(rootEntry, tableTree);
- }
- }
- /**
- * Sets the message to be displayed in the status line. This message
- * is displayed when there is no error message.
- *
- * @param message the message to be displayed, or <code>null</code>
- */
- private void setMessage(String message) {
- // show the message
- if (statusLineManager != null)
- statusLineManager.setMessage(message);
- }
- /**
- * Sets the root entry for this property sheet viewer.
- * The root entry is not visible in the viewer.
- *
- * @param root the root entry
- */
- public void setRootEntry(IPropertySheetEntry root) {
- // If we have a root entry, remove our entry listener
- if (rootEntry != null)
- rootEntry.removePropertySheetEntryListener(entryListener);
-
- rootEntry = root;
-
- // Set the root as user data on the tableTree
- tableTree.setData(rootEntry);
-
- // Add an IPropertySheetEntryListener to listen for entry change notifications
- rootEntry.addPropertySheetEntryListener(entryListener);
-
- // Pass our input to the root, this will trigger entry change
- // callbacks to update this viewer
- setInput(input);
- }
- /**
- * The <code>PropertySheetViewer</code> implementation of this
- * <code>Viewer</code> method does nothing.
- */
- public void setSelection(ISelection selection, boolean reveal) {
- }
- /**
- * Sets the status line manager this view will use to show messages.
- *
- * @param manager the status line manager
- */
- public void setStatusLineManager(IStatusLineManager manager) {
- statusLineManager = manager;
- }
- /**
- * Shows the categories.
- */
- /*package*/
- void showCategories() {
- isShowingCategories = true;
- refresh();
- }
- /**
- * Shows the expert properties.
- */
- /*package*/
- void showExpert() {
- isShowingExpertProperties = true;
- refresh();
- }
- /**
- * Updates the categories.
- * Reuses old categories if possible.
- */
- private void updateCategories() {
- // lazy initialize
- if (categories == null)
- categories = new PropertySheetCategory[0];
-
- // get all the filtered child entries of the root
- List childEntries = getFilteredEntries(rootEntry.getChildEntries());
-
- // if the list is empty, just set an empty categories array
- if (childEntries.size() == 0) {
- categories = new PropertySheetCategory[0];
- return;
- }
-
- // cache old categories by their descriptor name
- Map categoryCache = new HashMap(categories.length * 2 + 1);
- for (int i = 0; i < categories.length; i++) {
- categories[i].removeAllEntries();
- categoryCache.put(categories[i].getCategoryName(), categories[i]);
- }
-
- // create a list of categories to get rid of
- List categoriesToRemove = new ArrayList(Arrays.asList(categories));
-
- // Determine the categories
- PropertySheetCategory misc = (PropertySheetCategory) categoryCache.get(MISCELLANEOUS_CATEGORY_NAME);
- if (misc == null)
- misc = new PropertySheetCategory(MISCELLANEOUS_CATEGORY_NAME);
- boolean addMisc = false;
-
- for (int i = 0; i < childEntries.size(); i++) {
- IPropertySheetEntry childEntry = (IPropertySheetEntry) childEntries.get(i);
- String categoryName = childEntry.getCategory();
- if (categoryName == null) {
- misc.addEntry(childEntry);
- addMisc = true;
- categoriesToRemove.remove(misc);
- } else {
- PropertySheetCategory category = (PropertySheetCategory) categoryCache.get(categoryName);
- if (category == null) {
- category = new PropertySheetCategory(categoryName);
- categoryCache.put(categoryName, category);
- } else {
- categoriesToRemove.remove(category);
- }
- category.addEntry(childEntry);
- }
- }
-
- // Add the PSE_MISC category if it has entries
- if (addMisc)
- categoryCache.put(MISCELLANEOUS_CATEGORY_NAME, misc);
-
- // Sort the categories
- List list = new ArrayList(categoryCache.values());
- for (int i = 0; i < categoriesToRemove.size(); i++)
- list.remove(categoriesToRemove.get(i));
- Collections.sort(list, new Comparator() {
- Collator coll = Collator.getInstance(Locale.getDefault());
- public int compare(Object a, Object b) {
- PropertySheetCategory c1, c2;
- String dname1, dname2;
- c1 = (PropertySheetCategory) a;
- dname1 = c1.getCategoryName();
- c2 = (PropertySheetCategory) b;
- dname2 = c2.getCategoryName();
- return coll.compare(dname1, dname2);
- }
- });
-
- categories = (PropertySheetCategory[]) list.toArray(new PropertySheetCategory[list.size()]);
- }
- /**
- * Update the category (but not its parent or children).
- *
- * @param node the category to update
- * @param item the tree item for the given entry
- */
- private void updateCategory(PropertySheetCategory category, TableTreeItem item) {
- // ensure that backpointer is correct
- item.setData(category);
-
- // Update the name and value columns
- item.setText(0, category.getCategoryName());
- item.setText(1, ""); //$NON-NLS-1$
-
- // update the "+" icon
- if (category.getAutoExpand()) {
- // we auto expand categories when they first appear
- createChildren(item);
- item.setExpanded(true);
- category.setAutoExpand(false);
- } else {
- // we do not want to auto expand categories if the user has collpased them
- updatePlus(category, item);
- }
- }
- /**
- * Update the child entries or categories of the given entry or category.
- * If the given node is the root entry and we are showing categories
- * then the child entries are categories, otherwise they are entries.
- *
- * @param node the entry or category whose children we will update
- * @param widget the widget for the given entry, either a
- * <code>TableTree</code> if the node is the root node or a
- * <code>TableTreeItem</code> otherwise.
- */
- private void updateChildrenOf(Object node, Widget widget) {
- // cast the entry or category
- IPropertySheetEntry entry = null;
- PropertySheetCategory category = null;
- if (node instanceof IPropertySheetEntry)
- entry = (IPropertySheetEntry) node;
- else
- category = (PropertySheetCategory) node;
-
- // get the current child table tree items
- TableTreeItem item = null;
- TableTreeItem[] childItems;
- if (node == rootEntry) {
- childItems = tableTree.getItems();
- } else {
- item = (TableTreeItem) widget;
- childItems = item.getItems();
- }
-
- // optimization! prune collapsed subtrees
- if (item != null && !item.getExpanded()) {
- // remove all children
- for (int i = 0; i < childItems.length; i++) {
- if (childItems[i].getData() != null) {
- removeItem(childItems[i]);
- }
- }
-
- // append a dummy if necessary
- if ((category != null || entry.hasChildEntries()) && childItems.length == 0) // may already have a dummy
- // its is either a category (which always has at least one child)
- // or an entry with chidren.
- // Note that this test is not perfect, if we have filtering on
- // then there in fact may be no entires to show when the user
- // presses the "+" expand icon. But this is an acceptable compromise.
- new TableTreeItem(item, SWT.NULL);
-
- return;
- }
-
- // get the child entries or categories
- if (node == rootEntry && isShowingCategories)
- // update the categories
- updateCategories();
- List children = getChildren(node);
-
- // remove items
- Set set = new HashSet(childItems.length * 2 + 1);
-
- for (int i = 0; i < childItems.length; i++) {
- Object data = childItems[i].getData();
- if (data != null) {
- Object e = data;
- int ix = children.indexOf(e);
- if (ix < 0) { // not found
- removeItem(childItems[i]);
- } else { // found
- set.add(e);
- }
- } else if (data == null) { // the dummy
- item.dispose();
- }
- }
-
- // WORKAROUND
- int oldCnt = -1;
- if (widget == tableTree)
- oldCnt = tableTree.getItemCount();
-
- // add new items
- int newSize = children.size();
- for (int i = 0; i < newSize; i++) {
- Object el = children.get(i);
- if (!set.contains(el))
- createItem(el, widget, i);
- }
-
- // WORKAROUND
- if (widget == tableTree && oldCnt == 0 && tableTree.getItemCount() == 1) {
- tableTree.setRedraw(false);
- tableTree.setRedraw(true);
- }
-
- // get the child table tree items after our changes
- if (entry == rootEntry)
- childItems = tableTree.getItems();
- else
- childItems = item.getItems();
-
- // update the child items
- // This ensures that the children are in the correct order
- // are showing the correct values.
- for (int i = 0; i < newSize; i++) {
- Object el = children.get(i);
- if (el instanceof IPropertySheetEntry)
- updateEntry((IPropertySheetEntry) el, childItems[i]);
- else {
- updateCategory((PropertySheetCategory) el, childItems[i]);
- updateChildrenOf((PropertySheetCategory) el, childItems[i]);
- }
- }
- // The tree's original selection may no longer apply after the update,
- // so fire the selection changed event.
- entrySelectionChanged();
- }
- /**
- * Update the given entry (but not its children or parent)
- *
- * @param node the entry we will update
- * @param item the tree item for the given entry
- */
- private void updateEntry(IPropertySheetEntry entry, TableTreeItem item) {
- // ensure that backpointer is correct
- item.setData(entry);
-
- // update the name and value columns
- item.setText(0, entry.getDisplayName());
- item.setText(1, entry.getValueAsString());
- Image image = entry.getImage();
- if (image != null)
- item.setImage(1, image);
-
- // update the "+" icon
- updatePlus(entry, item);
- }
- /**
- * Updates the "+"/"-" icon of the tree item from the given entry
- * or category.
- *
- * @parem node the entry or category
- * @param item the table tree item being updated
- */
- private void updatePlus(Object node, TableTreeItem item) {
- // cast the entry or category
- IPropertySheetEntry entry = null;
- PropertySheetCategory category = null;
- if (node instanceof IPropertySheetEntry)
- entry = (IPropertySheetEntry) node;
- else
- category = (PropertySheetCategory) node;
-
- boolean hasPlus = item.getItemCount() > 0;
- boolean needsPlus = category != null || entry.hasChildEntries();
- boolean removeAll = false;
- boolean addDummy = false;
-
- if (hasPlus != needsPlus) {
- if (needsPlus) {
- addDummy = true;
- } else {
- removeAll = true;
- }
- }
- if (removeAll) {
- // remove all children
- TableTreeItem[] items = item.getItems();
- for (int i = 0; i < items.length; i++) {
- removeItem(items[i]);
- }
- }
-
- if (addDummy) {
- new TableTreeItem(item, SWT.NULL); // append a dummy to create the plus sign
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ResourcePropertySource.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ResourcePropertySource.java
deleted file mode 100644
index 3663950..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ResourcePropertySource.java
+++ /dev/null
@@ -1,167 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import java.io.File;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-/**
- * A Resource property source.
- */
-public class ResourcePropertySource implements IPropertySource {
- protected static String NOT_LOCAL_TEXT = PropertiesMessages.getString("PropertySource.notLocal"); //$NON-NLS-1$
- protected static String FILE_NOT_FOUND = PropertiesMessages.getString("PropertySource.notFound"); //$NON-NLS-1$
-
- // The element for the property source
- protected IResource element;
-
- // Error message when setting a property incorrectly
- protected String errorMessage = PropertiesMessages.getString("PropertySource.readOnly"); //$NON-NLS-1$
-
- // Property Descriptors
- static protected IPropertyDescriptor[] propertyDescriptors =
- new IPropertyDescriptor[4];
- {
- PropertyDescriptor descriptor;
-
- // resource name
- descriptor =
- new PropertyDescriptor(
- IBasicPropertyConstants.P_TEXT,
- IResourcePropertyConstants.P_LABEL_RES);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
- propertyDescriptors[0] = descriptor;
-
- // Relative path
- descriptor =
- new PropertyDescriptor(
- IResourcePropertyConstants.P_PATH_RES,
- IResourcePropertyConstants.P_DISPLAYPATH_RES);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
- propertyDescriptors[1] = descriptor;
-
- // readwrite state
- descriptor =
- new PropertyDescriptor(
- IResourcePropertyConstants.P_EDITABLE_RES,
- IResourcePropertyConstants.P_DISPLAYEDITABLE_RES);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
- propertyDescriptors[2] = descriptor;
-
- // last modified state
- descriptor =
- new PropertyDescriptor(
- IResourcePropertyConstants.P_LAST_MODIFIED_RES,
- IResourcePropertyConstants.P_DISPLAY_LAST_MODIFIED);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
- propertyDescriptors[3] = descriptor;
-
- }
-/**
- * Creates a PropertySource and stores its IResource
- *
- * @param res the resource for which this is a property source
- */
-public ResourcePropertySource(IResource res) {
- this.element = res;
-}
-/**
- * Return the value for the date String for the timestamp of the supplied resource.
- * @return String
- * @param IResource - the resource to query
- */
-private String getDateStringValue(IResource resource) {
-
- if (!resource.isLocal(IResource.DEPTH_ZERO))
- return NOT_LOCAL_TEXT;
- else {
- File localFile = getFile(resource);
- if(localFile == null)
- return FILE_NOT_FOUND;
- else{
- DateFormat format = new SimpleDateFormat();
- return format.format(new Date(localFile.lastModified()));
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource.
- */
-public Object getEditableValue() {
- return this;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource.
- */
-public IPropertyDescriptor[] getPropertyDescriptors() {
- return propertyDescriptors;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource.
- */
-public Object getPropertyValue(Object name) {
- if (name.equals(IBasicPropertyConstants.P_TEXT)) {
- return element.getName();
- }
- if (name.equals(IResourcePropertyConstants.P_PATH_RES)) {
- return element.getFullPath().toString();
- }
- if (name.equals(IResourcePropertyConstants.P_LAST_MODIFIED_RES)) {
- return getDateStringValue(element);
- }
- if (name.equals(IResourcePropertyConstants.P_EDITABLE_RES)) {
- if (element.isReadOnly())
- return "false";//$NON-NLS-1$
- else
- return "true";//$NON-NLS-1$
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource.
- */
-public boolean isPropertySet(Object property) {
- return false;
-}
-/**
- * The <code>ResourcePropertySource</code> implementation of this
- * <code>IPropertySource</code> method does nothing since all
- * properties are read-only.
- */
-public void resetPropertyValue(Object property) {}
-/**
- * The <code>ResourcePropertySource</code> implementation of this
- * <code>IPropertySource</code> method does nothing since all
- * properties are read-only.
- */
-public void setPropertyValue(Object name, Object value) {
-}
-
-/**
- * Get the java.io.File equivalent of the passed
- * IFile. If the location does not exist then return
- * null
- * @param IFile
- * @return java.io.File or <code>null</code>.
- */
-protected File getFile(IResource resource) {
- IPath location = resource.getLocation();
- if(location == null)
- return null;
- else
- return location.toFile();
-}
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/StandardPropertiesAdapterFactory.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/StandardPropertiesAdapterFactory.java
deleted file mode 100644
index 7e91066..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/StandardPropertiesAdapterFactory.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IAdapterFactory;
-
-/**
- * Dispenses an <code>IPropertySource</code> adapter for the core resource objects.
- */
-/* package */ class StandardPropertiesAdapterFactory implements IAdapterFactory {
-/* (non-Javadoc)
- * Method declared on IAdapterFactory.
- */
-public Object getAdapter(Object o, Class adapterType) {
- if (adapterType.isInstance(o)) {
- return o;
- }
- if (adapterType == IPropertySource.class) {
- if (o instanceof IResource) {
- IResource resource = (IResource) o;
- if (resource.getType() == IResource.FILE)
- return new FilePropertySource((IFile) o);
- else
- return new ResourcePropertySource((IResource) o);
- }
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IAdapterFactory.
- */
-public Class[] getAdapterList() {
- return new Class[] {
- IPropertySource.class
- };
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/TextPropertyDescriptor.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/TextPropertyDescriptor.java
deleted file mode 100644
index 2c69354..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/TextPropertyDescriptor.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.ui.views.properties;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Descriptor for a property that has a value which should be edited with a
- * text cell editor.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * <p>
- * Example:
- * <pre>
- * IPropertyDescriptor pd = new TextPropertyDescriptor("surname", "Last Name");
- * </pre>
- * </p>
- */
-public class TextPropertyDescriptor extends PropertyDescriptor {
-/**
- * Creates an property descriptor with the given id and display name.
- *
- * @param id the id of the property
- * @param displayName the name to display for the property
- */
-public TextPropertyDescriptor(Object id, String displayName) {
- super(id, displayName);
-}
-/**
- * The <code>TextPropertyDescriptor</code> implementation of this
- * <code>IPropertyDescriptor</code> method creates and returns a new
- * <code>TextCellEditor</code>.
- * <p>
- * The editor is configured with the current validator if there is one.
- * </p>
- */
-public CellEditor createPropertyEditor(Composite parent) {
- CellEditor editor = new TextCellEditor(parent);
- if (getValidator() != null)
- editor.setValidator(getValidator());
- return editor;
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/messages.properties b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/messages.properties
deleted file mode 100644
index 2ae86a9..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/messages.properties
+++ /dev/null
@@ -1,34 +0,0 @@
-# ==============================================================================
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-# ==============================================================================
-
-# package: org.eclipse.ui.views.properties
-
-
-# ==============================================================================
-# Properties View
-# ==============================================================================
-Page.defaultToolTip = Restore Default Value
-DefaultAction.toolTip = Reset Property To Its Default Value
-CopyProperty.text = &Copy
-
-Page.filterToolTip = Filter Properties
-Filter.toolTip = Show Advanced Properties
-
-Page.categoriesToolTip = Show Categories
-
-PropertyViewer.property = Property
-PropertyViewer.value = Value
-PropertyViewer.miscellaneousCategoryName = Misc
-PropertySource.notLocal = <not local>
-PropertySource.notFound = <Path is invalid>
-PropertySource.readOnly = Read only
-
-IResourcePropertyConstants.name = name
-IResourcePropertyConstants.path = path
-IResourcePropertyConstants.editable = editable
-IResourcePropertyConstants.size = size
-IResourcePropertyConstants.lastModified = last modified
-IResourcePropertyConstants.info = Info
-
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/package.html b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/package.html
deleted file mode 100644
index 1a6a1b5..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/package.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides the standard Property Sheet view which displays
-custom properties of the active workbench part's current selection.
-<br>
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/CopyTaskAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/CopyTaskAction.java
deleted file mode 100644
index f4ff3d5..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/CopyTaskAction.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.part.MarkerTransfer;
-
-/**
- * Copies a task to the clipboard.
- */
-/*package*/ class CopyTaskAction extends TaskAction {
- /**
- * Creates the action.
- */
- public CopyTaskAction(TaskList tasklist, String id) {
- super(tasklist, id);
- WorkbenchHelp.setHelp(this, ITaskListHelpContextIds.COPY_TASK_ACTION);
- }
-
- /**
- * Performs this action.
- */
- public void run() {
- // Get the selected markers
- TaskList taskList = getTaskList();
- TableViewer viewer = taskList.getTableViewer();
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- if (selection.isEmpty()) {
- return;
- }
- taskList.cancelEditing();
- List list = selection.toList();
- IMarker[] markers = new IMarker[list.size()];
- list.toArray(markers);
-
- setClipboard(markers, TaskList.createMarkerReport(markers));
-
- //Update paste enablement
- taskList.updatePasteEnablement();
- }
-
- private void setClipboard(IMarker[] markers, String markerReport) {
- try {
- // Place the markers on the clipboard
- Object[] data = new Object[] {
- markers,
- markerReport};
- Transfer[] transferTypes = new Transfer[] {
- MarkerTransfer.getInstance(),
- TextTransfer.getInstance()};
-
- // set the clipboard contents
- getTaskList().getClipboard().setContents(data, transferTypes);
- } catch (SWTError e){
- if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
- throw e;
- if (MessageDialog.openQuestion(getShell(), WorkbenchMessages.getString("CopyToClipboardProblemDialog.title"), WorkbenchMessages.getString("CopyToClipboardProblemDialog.message"))) //$NON-NLS-1$ //$NON-NLS-2$
- setClipboard(markers, markerReport);
- }
- }
-}
-
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/DefaultTaskListResourceAdapter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/DefaultTaskListResourceAdapter.java
deleted file mode 100644
index a394afb..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/DefaultTaskListResourceAdapter.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * The DefaultTaskListResourceAdapter is the default
- * implementation of the ITaskListResourceAdapter used by the
- * TaskList for resource adaption.
- */
-
-class DefaultTaskListResourceAdapter implements ITaskListResourceAdapter {
-
- private static ITaskListResourceAdapter singleton;
-
- /**
- * Constructor for DefaultTaskListResourceAdapter.
- */
- DefaultTaskListResourceAdapter() {
- super();
- }
-
- /**
- * Return the default instance used for TaskList adapting.
- */
- static ITaskListResourceAdapter getDefault(){
- if(singleton == null)
- singleton = new DefaultTaskListResourceAdapter();
- return singleton;
- }
-
- /*
- * @see ITaskListResourceAdapter#getAffectedResource(IAdaptable)
- */
- public IResource getAffectedResource(IAdaptable adaptable) {
-
- IResource resource = (IResource) adaptable.getAdapter(IResource.class);
- if (resource == null)
- return (IFile) adaptable.getAdapter(IFile.class);
- else
- return resource;
-
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/FiltersAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/FiltersAction.java
deleted file mode 100644
index 650a5ba..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/FiltersAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This action opens an editor for the resource
- * associated with the selected marker, and
- * jumps to the marker's location in the editor.
- */
-/* package */ class FiltersAction extends TaskAction {
-/**
- * Creates the action.
- */
-public FiltersAction(TaskList tasklist, String id) {
- super(tasklist, id);
- WorkbenchHelp.setHelp(this, ITaskListHelpContextIds.FILTERS_ACTION);
-}
-/**
- * Performs this action.
- */
-public void run() {
- FiltersDialog dialog = new FiltersDialog(getShell());
- TasksFilter filter = getTaskList().getFilter();
- dialog.setFilter(filter);
- int result = dialog.open();
- if (result == FiltersDialog.OK) {
- getTaskList().filterChanged();
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/FiltersDialog.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/FiltersDialog.java
deleted file mode 100644
index 3bd5490..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/FiltersDialog.java
+++ /dev/null
@@ -1,819 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Cagatay Kavukcuoglu <cagatayk@acm.org> - Filter for markers in same project
-**********************************************************************/
-
-import java.text.Collator;
-import java.util.*;
-
-import org.eclipse.core.resources.IMarker;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.window.Window;
-
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/* package */ class FiltersDialog extends Dialog {
- /**
- * ID for the Reset button
- */
- static final int RESET_ID = IDialogConstants.CLIENT_ID;
- static final int SELECT_ID = IDialogConstants.CLIENT_ID + 1;
-
- private static class EnumValue {
- private int value;
- private String text;
- private Image image;
-
- EnumValue(int value, String text, Image image) {
- this.value = value;
- this.text = text;
- this.image = image;
- }
- int getValue() {
- return value;
- }
- String getText() {
- return text;
- }
- Image getImage() {
- return image;
- }
- }
-
- private static class EnumType {
- private EnumValue[] values;
-
- EnumType(EnumValue[] values) {
- this.values = values;
- }
- EnumValue[] getValues() {
- return values;
- };
- }
-
- private EnumType severityType;
- private EnumType priorityType;
- private EnumType completionType;
-
- private class CheckboxEnumGroup {
- private EnumType type;
- private Button enableButton;
- private Button[] valueButtons;
-
- CheckboxEnumGroup(Composite parent, String text, EnumType type) {
- this.type = type;
- // although not needed for layout, this composite is needed to get the tab order right
- Composite enableComposite = new Composite(parent, SWT.NONE);
- enableComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- enableComposite.setLayout(new FillLayout());
- enableButton = new Button(enableComposite, SWT.CHECK);
- enableButton.addSelectionListener(selectionListener);
- enableButton.setText(text);
- Composite valueComposite = new Composite(parent, SWT.NONE);
- valueComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- valueComposite.setLayout(new FillLayout());
- EnumValue[] values = type.getValues();
- valueButtons = new Button[values.length];
- for (int i = 0; i < values.length; ++i) {
- Button valueButton = new Button(valueComposite, SWT.CHECK);
- valueButton.setText(values[i].getText());
-// valueButton.setImage(values[i].getImage());
- valueButtons[i] = valueButton;
- }
- }
-
- boolean getEnabled() {
- return enableButton.getEnabled();
- }
-
- void setEnabled(boolean enabled) {
- enableButton.setEnabled(enabled);
- updateEnabledState();
- }
-
- boolean getSelection() {
- return enableButton.getSelection();
- }
-
- void setSelection(boolean selected) {
- enableButton.setSelection(selected);
- updateEnabledState();
- }
-
- void updateEnabledState() {
- boolean enabled = enableButton.isEnabled() && enableButton.getSelection();
- for (int i = 0; i < valueButtons.length; ++i) {
- valueButtons[i].setEnabled(enabled);
- }
- }
-
- int getValueMask() {
- int mask = 0;
- EnumValue[] values = type.getValues();
- for (int i = 0; i < valueButtons.length; ++i) {
- if (valueButtons[i].getSelection()) {
- mask |= (1 << values[i].getValue());
- }
- }
- return mask;
- }
-
- void setValueMask(int mask) {
- EnumValue[] values = type.getValues();
- for (int i = 0; i < values.length; ++i) {
- valueButtons[i].setSelection((mask & (1 << values[i].getValue())) != 0);
- }
- }
- }
-
-
- private class LabelComboTextGroup {
- Label label;
- Combo combo;
- Text text;
-
- LabelComboTextGroup(Composite parent, String labelText, String[] comboStrings, String initialText, int widthHint) {
- Composite group = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- //Set the margin width to 0 in order to line up with other items
- layout.marginWidth = 0;
- group.setLayout(layout);
- label = new Label(group, SWT.NONE);
- label.setText(labelText);
- combo = createCombo(group, comboStrings, 0);
- text = new Text(parent, SWT.SINGLE | SWT.BORDER);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = widthHint;
- text.setLayoutData(gridData);
- text.setText(initialText);
- }
- }
-
- /**
- * Creates and manages a group of widgets for selecting a working
- * set task filter.
- */
- private class WorkingSetGroup {
- private Button button;
- private Button selectButton;
- /**
- * Creates the working set filter selection widgets.
- *
- * @param parent the parent composite of the working set widgets
- */
- WorkingSetGroup(Composite parent) {
- // radio button has to be part of main radio button group
- button = createRadioButton(parent, TaskListMessages.getString("TaskList.noWorkingSet")); //$NON-NLS-1$
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- button.setLayoutData(data);
-
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- Button radio = new Button(parent, SWT.RADIO);
- layout.marginWidth = radio.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;
- layout.marginHeight = 0;
- radio.dispose();
- composite.setLayout(layout);
- selectButton = createButton(composite, SELECT_ID, TaskListMessages.getString("TaskList.workingSetSelect"), false); //$NON-NLS-1$
- }
- /**
- * Returns wether or not a working set filter should be used
- *
- * @return
- * true=a working set filter should be used
- * false=a working set filter should not be used
- */
- boolean getSelection() {
- return button.getSelection();
- }
- /**
- * Returns the selected working set filter or null if none
- * is selected.
- *
- * @return the selected working set filter or null if none
- * is selected.
- */
- IWorkingSet getWorkingSet() {
- return (IWorkingSet) button.getData();
- }
- /**
- * Sets the working set filter selection.
- *
- * @param selected true=a working set filter should be used
- * false=no working set filter should be used
- */
- void setSelection(boolean selected) {
- button.setSelection(selected);
- if (selected) {
- anyResourceButton.setSelection(false);
- anyResourceInSameProjectButton.setSelection(false);
- selectedResourceButton.setSelection(false);
- selectedResourceAndChildrenButton.setSelection(false);
- }
- }
- /**
- * Opens the working set selection dialog.
- */
- void selectPressed() {
- IWorkingSetSelectionDialog dialog = WorkbenchPlugin.getDefault().getWorkingSetManager().createWorkingSetSelectionDialog(getShell(), false);
- IWorkingSet workingSet = getWorkingSet();
-
- if (workingSet != null) {
- dialog.setSelection(new IWorkingSet[]{workingSet});
- }
- if (dialog.open() == Window.OK) {
- IWorkingSet[] result = dialog.getSelection();
- if (result != null && result.length > 0) {
- setWorkingSet(result[0]);
- }
- else {
- setWorkingSet(null);
- }
- if (getSelection() == false) {
- setSelection(true);
- }
- }
- }
- /**
- * Sets the specified working set.
- *
- * @param workingSet the working set
- */
- void setWorkingSet(IWorkingSet workingSet) {
- button.setData(workingSet);
- if (workingSet != null) {
- button.setText(TaskListMessages.format(
- "TaskList.workingSet", //$NON-NLS-1$
- new Object[] {workingSet.getName()}));
- }
- else {
- button.setText(TaskListMessages.getString("TaskList.noWorkingSet")); //$NON-NLS-1$
- }
- }
- }
-
- private TasksFilter filter;
-
- private MarkerTypesModel markerTypesModel = new MarkerTypesModel();
-
- private MarkerType[] markerTypes;
-
- private CheckboxTreeViewer typesViewer;
- private Button anyResourceButton;
- private Button anyResourceInSameProjectButton; // added by cagatayk@acm.org
- private Button selectedResourceButton;
- private Button selectedResourceAndChildrenButton;
- private WorkingSetGroup workingSetGroup;
- private LabelComboTextGroup descriptionGroup;
- private CheckboxEnumGroup severityGroup;
- private CheckboxEnumGroup priorityGroup;
- private CheckboxEnumGroup completionGroup;
- private Button filterOnMarkerLimit;
- private Text markerLimit;
-
- private SelectionListener selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- FiltersDialog.this.widgetSelected(e);
- }
- };
-
- private ICheckStateListener checkStateListener = new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- FiltersDialog.this.checkStateChanged(event);
- }
- };
-/**
- * Creates a new filters dialog.
- */
-public FiltersDialog(Shell parentShell) {
- super(parentShell);
- initTypes();
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void buttonPressed(int buttonId) {
- if (RESET_ID == buttonId) {
- resetPressed();
- }
- else
- if (SELECT_ID == buttonId) {
- workingSetGroup.selectPressed();
- }
- else {
- super.buttonPressed(buttonId);
- }
-}
-public void checkStateChanged(CheckStateChangedEvent event) {
- MarkerType type = (MarkerType) event.getElement();
- typesViewer.setSubtreeChecked(type, event.getChecked());
- MarkerType[] allSupertypes = type.getAllSupertypes();
- for (int i = 0; i < allSupertypes.length; ++i) {
- typesViewer.setChecked(allSupertypes[i], false);
- }
- updateEnabledState();
-}
-/* (non-Javadoc)
- * Method declared on Window.
- */
-protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(TaskListMessages.getString("TaskList.filter")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(newShell, ITaskListHelpContextIds.FILTERS_DIALOG);
-}
-/**
- * Creates the area showing filtering criteria on attribute values.
- *
- * @param parent the parent composite
- */
-void createAttributesArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- String[] filters = {TaskListMessages.getString("TaskList.contains"), TaskListMessages.getString("TaskList.doesNotContain")}; //$NON-NLS-2$ //$NON-NLS-1$
- descriptionGroup = new LabelComboTextGroup(composite, TaskListMessages.getString("TaskList.whereDescription"), filters, "", 200);//$NON-NLS-2$ //$NON-NLS-1$
- severityGroup = new CheckboxEnumGroup(composite, TaskListMessages.getString("TaskList.severity.label"), severityType); //$NON-NLS-1$
- priorityGroup = new CheckboxEnumGroup(composite, TaskListMessages.getString("TaskList.priority.label"), priorityType); //$NON-NLS-1$
- completionGroup = new CheckboxEnumGroup(composite, TaskListMessages.getString("TaskList.status.label"), completionType); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void createButtonsForButtonBar(Composite parent) {
- super.createButtonsForButtonBar(parent);
- createButton(parent, RESET_ID, TaskListMessages.getString("TaskList.resetText"), false); //$NON-NLS-1$
-}
-/**
- * Creates a check box button with the given parent and text.
- *
- * @param parent the parent composite
- * @param text the text for the check box
- * @param grabRow <code>true</code>to grab the remaining horizontal space, <code>false</code> otherwise
- * @return the check box button
- */
-Button createCheckbox(Composite parent, String text, boolean grabRow) {
- Button button = new Button(parent, SWT.CHECK);
- if (grabRow) {
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- button.setLayoutData(gridData);
- }
- button.setText(text);
- button.addSelectionListener(selectionListener);
- return button;
-}
-/**
- * Creates a combo box with the given parent, items, and selection
- *
- * @param parent the parent composite
- * @param items the items for the combo box
- * @param selectionIndex the index of the item to select
- * @return the combo box
- */
-Combo createCombo(Composite parent, String[] items, int selectionIndex) {
- Combo combo = new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
- combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- combo.setItems(items);
- combo.select(selectionIndex);
- combo.addSelectionListener(selectionListener);
- return combo;
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- createMarkerLimitArea(composite);
- createTypesArea(composite);
- createResourceArea(composite);
- createAttributesArea(composite);
-
- updateUIFromFilter(getFilter());
-
- return composite;
-}
-/**
- * Creates a radio button with the given parent and text.
- *
- * @param parent the parent composite
- * @param text the text for the check box
- * @return the radio box button
- */
-Button createRadioButton(Composite parent, String text) {
- Button button = new Button(parent, SWT.RADIO);
- button.setText(text);
- button.addSelectionListener(selectionListener);
- return button;
-}
-/**
- * Creates the area showing which resources should be considered.
- *
- * @param parent the parent composite
- */
-void createResourceArea(Composite parent) {
- Composite group = new Composite(parent, SWT.NONE);
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- group.setLayout(new GridLayout());
- anyResourceButton = createRadioButton(group, TaskListMessages.getString("TaskList.anyResource")); //$NON-NLS-1$
- anyResourceInSameProjectButton = createRadioButton(group, TaskListMessages.getString("TaskList.anyResourceInSameProject")); //$NON-NLS-1$ // added by cagatayk@acm.org
- selectedResourceButton = createRadioButton(group, TaskListMessages.getString("TaskList.selectedResource")); //$NON-NLS-1$
- selectedResourceAndChildrenButton = createRadioButton(group, TaskListMessages.getString("TaskList.selectedAndChildren")); //$NON-NLS-1$
- workingSetGroup = new WorkingSetGroup(group);
-}
-/**
- * Creates the area showing which marker types should be included.
- *
- * @param parent the parent composite
- */
-void createTypesArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
-
- Label label = new Label(composite, SWT.NONE);
- label.setText(TaskListMessages.getString("TaskList.showItemsOfType")); //$NON-NLS-1$
-
- typesViewer = new CheckboxTreeViewer(composite);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.heightHint = 100;
- typesViewer.getControl().setLayoutData(gridData);
- typesViewer.setContentProvider(getContentProvider());
- typesViewer.setLabelProvider(getLabelProvider());
- typesViewer.setSorter(getSorter());
- typesViewer.setAutoExpandLevel(CheckboxTreeViewer.ALL_LEVELS);
- typesViewer.addCheckStateListener(checkStateListener);
- typesViewer.setInput(getMarkerTypes());
-}
-ITreeContentProvider getContentProvider() {
- return new ITreeContentProvider() {
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
- public void dispose() {}
- public Object[] getElements(Object inputElement) {
- return new Object[] {
- markerTypesModel.getType(IMarker.PROBLEM),
- markerTypesModel.getType(IMarker.TASK)
- };
- }
- public Object[] getChildren(Object parentElement) {
- MarkerType type = (MarkerType) parentElement;
- return type.getSubtypes();
- }
- public Object getParent(Object element) {
- return null;
- }
- public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
- }
- };
-}
-
-void createMarkerLimitArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- filterOnMarkerLimit = createCheckbox(composite, TaskListMessages.getString(
- "TaskList.limitVisibleTasksTo"), false); //$NON-NLS-1$
- filterOnMarkerLimit.setLayoutData(new GridData());
- markerLimit = new Text(composite, SWT.SINGLE | SWT.BORDER);
- markerLimit.setTextLimit(6);
- GridData gridData = new GridData();
- gridData.widthHint = convertWidthInCharsToPixels(10);
- markerLimit.setLayoutData(gridData);
-}
-
-/**
- * Returns the filter which this dialog is configuring.
- *
- * @return the filter
- */
-public TasksFilter getFilter() {
- if (filter == null)
- filter = new TasksFilter();
- return filter;
-}
-ILabelProvider getLabelProvider() {
- return new LabelProvider() {
- public String getText(Object element) {
- MarkerType type = (MarkerType) element;
- return type.getLabel();
- }
- };
-}
-/**
- * Returns the marker types to display.
- *
- * @return the marker types to display
- */
-MarkerType[] getMarkerTypes() {
- if (markerTypes == null) {
- ArrayList typesList = new ArrayList();
- MarkerType[] types = markerTypesModel.getTypes();
- for (int i = 0; i < types.length; ++i) {
- MarkerType type = types[i];
- if (type.getLabel().length() > 0) {
- if (type.isSubtypeOf(markerTypesModel.getType(IMarker.PROBLEM))
- || type.isSubtypeOf(markerTypesModel.getType(IMarker.TASK))) {
- typesList.add(type);
- }
- }
- }
- Collections.sort(typesList, new Comparator() {
- Collator collator = Collator.getInstance();
- public int compare(Object o1, Object o2) {
- return collator.compare(((MarkerType) o1).getLabel(), ((MarkerType) o2).getLabel());
- }
- });
- markerTypes = new MarkerType[typesList.size()];
- typesList.toArray(markerTypes);
- }
- return markerTypes;
-}
-/**
- * Returns the ids of the selected marker types.
- *
- * @return the ids of the selected marker types
- */
-String[] getSelectedTypes() {
- Object[] checked = typesViewer.getCheckedElements();
- ArrayList list = new ArrayList();
- for (int i = 0; i < checked.length; ++i) {
- MarkerType type = (MarkerType) checked[i];
- // Skip it if any supertypes have already been included.
- // Relies on getCheckedElements() using a pre-order traversal
- // so parents are earlier in the list.
- boolean found = false;
- for (int j = list.size(); --j >= 0;) {
- if (type.isSubtypeOf((MarkerType) list.get(j))) {
- found = true;
- break;
- }
- }
- if (!found) {
- list.add(type);
- }
- }
- String[] types = new String[list.size()];
- for (int i = 0; i < list.size(); ++i) {
- types[i] = ((MarkerType) list.get(i)).getId();
- }
- return types;
-}
-ViewerSorter getSorter() {
- return new ViewerSorter() {
- public int compare(Viewer viewer, Object e1, Object e2) {
- MarkerType t1 = (MarkerType) e1;
- MarkerType t2 = (MarkerType) e2;
- return collator.compare(t1.getLabel(), t2.getLabel());
- }
- };
-}
-/**
- * Returns the id of the marker type at the given index
- *
- * @param typeIndex the index of the marker type in the UI list
- * @return the id of the marker type at the given index
- */
-String getTypeId(int typeIndex) {
- return getMarkerTypes()[typeIndex].getId();
-}
-/**
- * Returns the index of the given marker type
- *
- * @param markerType the marker type id
- * @return the index of the marker type
- */
-int getTypeIndex(String markerType) {
- MarkerType[] types = getMarkerTypes();
- for (int i = 0; i < types.length; ++i) {
- String id = types[i].getId();
- if (id == null ? markerType == null : id.equals(markerType))
- return i;
- }
- return -1;
-}
-void initTypes() {
- severityType = new EnumType(
- new EnumValue[] {
- new EnumValue(IMarker.SEVERITY_ERROR, TaskListMessages.getString("TaskList.severity.error"), MarkerUtil.getImage("error")),//$NON-NLS-2$ //$NON-NLS-1$
- new EnumValue(IMarker.SEVERITY_WARNING, TaskListMessages.getString("TaskList.severity.warning"), MarkerUtil.getImage("warn")),//$NON-NLS-2$ //$NON-NLS-1$
- new EnumValue(IMarker.SEVERITY_INFO, TaskListMessages.getString("TaskList.severity.info"), MarkerUtil.getImage("info"))//$NON-NLS-2$ //$NON-NLS-1$
- }
- );
-
- priorityType = new EnumType(
- new EnumValue[] {
- new EnumValue(IMarker.PRIORITY_HIGH, TaskListMessages.getString("TaskList.priority.high"), MarkerUtil.getImage("hprio")),//$NON-NLS-2$ //$NON-NLS-1$
- new EnumValue(IMarker.PRIORITY_NORMAL, TaskListMessages.getString("TaskList.priority.normal"), null), //$NON-NLS-1$
- new EnumValue(IMarker.PRIORITY_LOW, TaskListMessages.getString("TaskList.priority.low"), MarkerUtil.getImage("lprio"))//$NON-NLS-2$ //$NON-NLS-1$
- }
- );
-
- completionType = new EnumType(
- new EnumValue[] {
- new EnumValue(1, TaskListMessages.getString("TaskList.status.completed"), null), //$NON-NLS-1$
- new EnumValue(0, TaskListMessages.getString("TaskList.status.notCompleted"), null) //$NON-NLS-1$
- }
- );
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-/**
- * Updates the filter from the UI state.
- * Must be done here rather than by extending open()
- * because after super.open() is called, the widgetry is disposed.
- */
-protected void okPressed() {
- try {
- int markerLimit = Integer.parseInt(this.markerLimit.getText());
-
- if (markerLimit < 1) {
- throw new NumberFormatException();
- }
-
- updateFilterFromUI(getFilter());
- super.okPressed();
- }
- catch (NumberFormatException eNumberFormat) {
- MessageBox messageBox = new MessageBox(getShell(),
- SWT.OK | SWT.APPLICATION_MODAL | SWT.ICON_ERROR);
- messageBox.setText(TaskListMessages.getString(
- "TaskList.titleMarkerLimitInvalid")); //$NON-NLS-1$
- messageBox.setMessage(TaskListMessages.getString(
- "TaskList.messageMarkerLimitInvalid")); //$NON-NLS-1$
- messageBox.open();
-
- if (markerLimit.forceFocus()) {
- markerLimit.setSelection(0, markerLimit.getCharCount());
- markerLimit.showSelection();
- }
- }
-}
-/**
- * Handles a press of the Reset button.
- * Updates the UI state to correspond to a reset filter,
- * but doesn't actually reset our filter.
- */
-void resetPressed() {
- updateUIFromFilter(new TasksFilter());
-}
-/**
- * Returns whether any of the selected types are a subtype of the given type.
- */
-boolean selectionIncludesSubtypeOf(String type) {
- MarkerType superType = markerTypesModel.getType(type);
- if (superType == null) {
- return false;
- }
- Object[] checked = typesViewer.getCheckedElements();
- for (int i = 0; i < checked.length; ++i) {
- if (((MarkerType) checked[i]).isSubtypeOf(superType)) {
- return true;
- }
- }
- return false;
-}
-/**
- * Sets the filter which this dialog is to configure.
- *
- * @param filter the filter
- */
-public void setFilter(TasksFilter filter) {
- this.filter = filter;
-}
-/**
- * Sets the selected marker types.
- *
- * @param typeIds the ids of the marker types to select
- */
-void setSelectedTypes(String[] typeIds) {
- typesViewer.setCheckedElements(new MarkerType[0]);
- for (int i = 0; i < typeIds.length; ++i) {
- MarkerType type = markerTypesModel.getType(typeIds[i]);
- if (type != null) {
- typesViewer.setSubtreeChecked(type, true);
- }
- }
-}
-/**
- * Updates the enabled state of the widgetry.
- */
-void updateEnabledState() {
- markerLimit.setEnabled(filterOnMarkerLimit.getSelection());
- boolean isProblemSelected = selectionIncludesSubtypeOf(IMarker.PROBLEM);
- boolean isTaskSelected = selectionIncludesSubtypeOf(IMarker.TASK);
- severityGroup.setEnabled(isProblemSelected);
- priorityGroup.setEnabled(isTaskSelected);
- completionGroup.setEnabled(isTaskSelected);
-}
-/**
- * Updates the given filter from the UI state.
- *
- * @param filter the filter to update
- */
-void updateFilterFromUI(TasksFilter filter) {
-
- filter.types = getSelectedTypes();
-
- if (selectedResourceButton.getSelection())
- filter.onResource = TasksFilter.ON_SELECTED_RESOURCE_ONLY;
- else if (selectedResourceAndChildrenButton.getSelection())
- filter.onResource = TasksFilter.ON_SELECTED_RESOURCE_AND_CHILDREN;
- else if (anyResourceInSameProjectButton.getSelection()) // added by cagatayk@acm.org
- filter.onResource = TasksFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT;
- else if (workingSetGroup.getSelection())
- filter.onResource = TasksFilter.ON_WORKING_SET;
- else
- filter.onResource = TasksFilter.ON_ANY_RESOURCE;
-
- filter.workingSet = workingSetGroup.getWorkingSet();
- filter.descriptionFilterKind = descriptionGroup.combo.getSelectionIndex();
- filter.descriptionFilter = descriptionGroup.text.getText();
- filter.filterOnDescription = !filter.descriptionFilter.equals("");//$NON-NLS-1$
-
- filter.filterOnSeverity = severityGroup.getSelection();
- filter.severityFilter = severityGroup.getValueMask();
-
- filter.filterOnPriority = priorityGroup.getSelection();
- filter.priorityFilter = priorityGroup.getValueMask();
-
- filter.filterOnCompletion = completionGroup.getSelection();
- filter.completionFilter = completionGroup.getValueMask();
-
- int markerLimit = TasksFilter.DEFAULT_MARKER_LIMIT;
-
- try {
- markerLimit = Integer.parseInt(this.markerLimit.getText());
- }
- catch (NumberFormatException eNumberFormat) {
- }
-
- filter.setMarkerLimit(markerLimit);
- filter.setFilterOnMarkerLimit(filterOnMarkerLimit.getSelection());
-}
-/**
- * Updates the UI state from the given filter.
- *
- * @param filter the filter to use
- */
-void updateUIFromFilter(TasksFilter filter) {
-
- setSelectedTypes(filter.types);
-
- int on = filter.onResource;
- anyResourceButton.setSelection(on == TasksFilter.ON_ANY_RESOURCE);
- anyResourceInSameProjectButton.setSelection(on == TasksFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT); // added by cagatayk@acm.org
- selectedResourceButton.setSelection(on == TasksFilter.ON_SELECTED_RESOURCE_ONLY);
- selectedResourceAndChildrenButton.setSelection(on == TasksFilter.ON_SELECTED_RESOURCE_AND_CHILDREN);
- workingSetGroup.setSelection(on == TasksFilter.ON_WORKING_SET);
- workingSetGroup.setWorkingSet(filter.workingSet);
-
- descriptionGroup.combo.select(filter.descriptionFilterKind);
- descriptionGroup.text.setText(filter.descriptionFilter);
-
- severityGroup.setSelection(filter.filterOnSeverity);
- severityGroup.setValueMask(filter.severityFilter);
-
- priorityGroup.setSelection(filter.filterOnPriority);
- priorityGroup.setValueMask(filter.priorityFilter);
-
- completionGroup.setSelection(filter.filterOnCompletion);
- completionGroup.setValueMask(filter.completionFilter);
-
- markerLimit.setText("" + filter.getMarkerLimit());
- filterOnMarkerLimit.setSelection(filter.getFilterOnMarkerLimit());
-
- updateEnabledState();
-}
-/**
- * Handles selection on a check box or combo box.
- */
-void widgetSelected(SelectionEvent e) {
- updateEnabledState();
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/GotoTaskAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/GotoTaskAction.java
deleted file mode 100644
index e1c04ae..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/GotoTaskAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-
-import org.eclipse.jface.util.OpenStrategy;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.dialogs.DialogUtil;
-
-/**
- * This action opens an editor for the resource
- * associated with the selected marker, and
- * jumps to the marker's location in the editor.
- */
-/* package */ class GotoTaskAction extends TaskAction {
-/**
- * Creates the action.
- */
-public GotoTaskAction(TaskList tasklist, String id) {
- super(tasklist, id);
- WorkbenchHelp.setHelp(this, ITaskListHelpContextIds.GOTO_TASK_ACTION);
-}
-/**
- * Performs this action. This action works only for single selection.
- */
-public void run() {
- IStructuredSelection selection = (IStructuredSelection) getTaskList().getSelection();
- Object o = selection.getFirstElement();
- if (!(o instanceof IMarker))
- return;
- IMarker marker = (IMarker) o;
- IResource resource = marker.getResource();
- if (marker.exists() && resource instanceof IFile) {
- IWorkbenchPage page = getTaskList().getSite().getPage();
- try {
- page.openEditor(marker,OpenStrategy.activateOnOpen());
- } catch (PartInitException e) {
- DialogUtil.openError(
- page.getWorkbenchWindow().getShell(),
- TaskListMessages.getString("GotoTask.errorMessage"), //$NON-NLS-1$
- e.getMessage(),
- e);
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/IMarkerConstants.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/IMarkerConstants.java
deleted file mode 100644
index 3ed7c37..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/IMarkerConstants.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * This interface defines constants used for marker properties
- * and attributes.
- *
- * @see IMarker
- */
-/* package */ interface IMarkerConstants {
- public static final String PREFIX = "org.eclipse.ui.tasklist."; //$NON-NLS-1$
- public static final String P_PRIORITY_IMAGE = PREFIX+"priorityImage"; //$NON-NLS-1$
- public static final String P_COMPLETE_IMAGE = PREFIX+"completeImage"; //$NON-NLS-1$
- public static final String P_RESOURCE_NAME = PREFIX+"resourceName"; //$NON-NLS-1$
- public static final String P_CONTAINER_NAME = PREFIX+"containerName"; //$NON-NLS-1$
- public static final String P_LINE_AND_LOCATION = PREFIX+"lineAndLocation"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ITaskListHelpContextIds.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ITaskListHelpContextIds.java
deleted file mode 100644
index 4abf6d0..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ITaskListHelpContextIds.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Help context ids for the task list view.
- * <p>
- * This interface contains constants only; it is not intended to be implemented
- * or extended.
- * </p>
- *
- */
-/*package*/ interface ITaskListHelpContextIds {
- public static final String PREFIX = PlatformUI.PLUGIN_ID + "."; //$NON-NLS-1$
-
- // Actions
- public static final String PURGE_COMPLETED_TASK_ACTION = PREFIX + "purge_completed_task_action_context"; //$NON-NLS-1$
- public static final String COPY_TASK_ACTION = PREFIX + "copy_task_action_context"; //$NON-NLS-1$
- public static final String PASTE_TASK_ACTION = PREFIX + "paste_task_action_context"; //$NON-NLS-1$
- public static final String NEW_TASK_ACTION = PREFIX + "new_task_action_context"; //$NON-NLS-1$
- public static final String REMOVE_TASK_ACTION = PREFIX + "remove_task_action_context"; //$NON-NLS-1$
- public static final String GOTO_TASK_ACTION = PREFIX + "goto_task_action_context"; //$NON-NLS-1$
- public static final String FILTERS_ACTION = PREFIX + "filters_action_context"; //$NON-NLS-1$
- public static final String MARK_COMPLETED_ACTION = PREFIX + "mark_completed_action_context"; //$NON-NLS-1$
- public static final String RESOLVE_MARKER_ACTION = PREFIX + "resolve_marker_action_context"; //$NON-NLS-1$
- public static final String SELECT_ALL_TASKS_ACTION = PREFIX + "select_all_tasks_action_context"; //$NON-NLS-1$
- public static final String TASK_PROPERTIES_ACTION = PREFIX + "task_properties_action_context"; //$NON-NLS-1$
-
- // Dialogs
- public static final String FILTERS_DIALOG = PREFIX + "task_filters_dialog_context"; //$NON-NLS-1$
- public static final String PROPERTIES_DIALOG = PREFIX + "task_properties_dialog_context"; //$NON-NLS-1$
-
- // Views
- public static final String TASK_LIST_VIEW = PREFIX + "task_list_view_context"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ITaskListResourceAdapter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ITaskListResourceAdapter.java
deleted file mode 100644
index 424ace1..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ITaskListResourceAdapter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * <code>ITaskListResourceAdapter</code> is an adapter interface that
- * supplies the resource to query for markers to display in the task list.
- *
- * Implementors of this interface are typically registered with an
- * IAdapterFactory for lookup via the getAdapter() mechanism.
- */
-public interface ITaskListResourceAdapter {
-
- /**
- * Returns the resource to query for the markers to display
- * for the given adaptable.
- *
- * @param adaptable the adaptable being queried.
- * @return the resource or <code>null</code> if there
- * is no adapted resource for this object.
- */
- public IResource getAffectedResource(IAdaptable adaptable);
-
-
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkCompletedAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkCompletedAction.java
deleted file mode 100644
index 558e577..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkCompletedAction.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-class MarkCompletedAction extends TaskAction {
-
- /**
- * Create a MarkCompletedAction.
- * @param tasklist
- * @param id
- */
- protected MarkCompletedAction(TaskList tasklist, String id) {
- super(tasklist, id);
- WorkbenchHelp.setHelp(this, ITaskListHelpContextIds.MARK_COMPLETED_ACTION);
- }
-
- /**
- * Sets the completed value of the currently selected
- * actions.
- */
- public void run() {
- ISelection markers = getTaskList().getSelection();
- if (markers instanceof IStructuredSelection) {
- Iterator selections = ((IStructuredSelection) markers).iterator();
- while (selections.hasNext()) {
- IMarker nextMarker = (IMarker) selections.next();
- getTaskList().setProperty(nextMarker, IMarker.DONE, Boolean.TRUE);
- }
- }
- }
-
- /* (non-Javadoc)
- * Method declared on IAction.
- */
- public boolean isEnabled() {
- ISelection markers = getTaskList().getSelection();
- if (markers instanceof IStructuredSelection) {
- Iterator selections = ((IStructuredSelection) markers).iterator();
-
- //Do not enable if there is no selection
- if(!selections.hasNext())
- return false;
- while (selections.hasNext()) {
- IMarker marker = (IMarker) selections.next();
- if (!MarkerUtil.isMarkerType(marker, IMarker.TASK)
- || MarkerUtil.isComplete(marker))
- return false;
- }
- }
- return true;
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerType.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerType.java
deleted file mode 100644
index e5b137f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerType.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-
-/**
- * Represents a marker type.
- */
-/* package */ class MarkerType {
- private MarkerTypesModel model;
- private String id;
- private String label;
- private String[] supertypeIds;
-/**
- * Creates a new marker type.
- */
-public MarkerType(MarkerTypesModel model, String id, String label, String[] supertypeIds) {
- this.model = model;
- this.id = id;
- this.label = label;
- this.supertypeIds = supertypeIds;
-}
-/**
- * Returns all this type's supertypes.
- */
-public MarkerType[] getAllSupertypes() {
- ArrayList result = new ArrayList();
- getAllSupertypes(result);
- return (MarkerType[]) result.toArray(new MarkerType[result.size()]);
-}
-/**
- * Appends all this type's supertypes to the given list.
- */
-private void getAllSupertypes(ArrayList result) {
- MarkerType[] supers = getSupertypes();
- for (int i = 0; i < supers.length; ++i) {
- MarkerType sup = supers[i];
- if (!result.contains(sup)) {
- result.add(sup);
- sup.getAllSupertypes(result);
- }
- }
-}
-/**
- * Returns the marker type id.
- */
-public String getId() {
- return id;
-}
-/**
- * Returns the human-readable label for this marker type.
- */
-public String getLabel() {
- return label;
-}
-/**
- * Returns the types which have this type as a direct supertype.
- *
- * @return the direct subtypes of this type
- */
-public MarkerType[] getSubtypes() {
- MarkerType[] types = model.getTypes();
- ArrayList result = new ArrayList();
- for (int i = 0; i < types.length; ++i) {
- MarkerType type = types[i];
- String[] supers = type.getSupertypeIds();
- for (int j = 0; j < supers.length; ++j) {
- if (supers[j].equals(id)) {
- result.add(type);
- }
- }
- }
- return (MarkerType[]) result.toArray(new MarkerType[result.size()]);
-}
-/**
- * Returns the marker type ids for this type's supertypes.
- */
-public String[] getSupertypeIds() {
- return supertypeIds;
-}
-/**
- * Returns this type's direct supertypes.
- */
-public MarkerType[] getSupertypes() {
- ArrayList result = new ArrayList();
- for (int i = 0; i < supertypeIds.length; ++i) {
- MarkerType sup = model.getType(supertypeIds[i]);
- if (sup != null) {
- result.add(sup);
- }
- }
- return (MarkerType[]) result.toArray(new MarkerType[result.size()]);
-}
-/**
- * Returns whether this marker type is considered to be a subtype of
- * the given marker type.
- *
- * @return boolean <code>true</code>if this type is the same as (or a subtype of) the given type
- */
-public boolean isSubtypeOf(MarkerType superType) {
- if (id.equals(superType.getId())) {
- return true;
- }
- for (int i = 0; i < supertypeIds.length; ++i) {
- MarkerType sup = model.getType(supertypeIds[i]);
- if (sup != null && sup.isSubtypeOf(superType)) {
- return true;
- }
- }
- return false;
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerTypesModel.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerTypesModel.java
deleted file mode 100644
index 16a38b3..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerTypesModel.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-
-/**
- * Maintains a model of all known marker types.
- */
-/* package */ class MarkerTypesModel {
- /**
- * Maps from marker type id to MarkerType.
- */
- private HashMap types;
-
-/**
- * Creates a new marker types model.
- */
-public MarkerTypesModel() {
- types = readTypes();
-}
-/**
- * Returns the marker type with the given id, or <code>null</code> if there is no such marker type.
- */
-public MarkerType getType(String id) {
- return (MarkerType) types.get(id);
-}
-/**
- * Returns all known marker types.
- */
-public MarkerType[] getTypes() {
- MarkerType[] result = new MarkerType[types.size()];
- types.values().toArray(result);
- return result;
-}
-/**
- * Returns the label for the given marker type.
- * Workaround until we have labels in XML.
- */
-private String getWellKnownLabel(String type) {
- if (type.equals(IMarker.PROBLEM))
- return "Problem";//$NON-NLS-1$
- if (type.equals(IMarker.TASK))
- return "Task";//$NON-NLS-1$
- if (type.equals("org.eclipse.jdt.core.problem"))//$NON-NLS-1$
- return "Java Problem";//$NON-NLS-1$
- return type;
-}
-/**
- * Reads the marker types from the registry.
- */
-private HashMap readTypes() {
- HashMap types = new HashMap();
- IExtensionPoint point = Platform.getPluginRegistry().getExtensionPoint(ResourcesPlugin.PI_RESOURCES, ResourcesPlugin.PT_MARKERS);
- if (point != null) {
- // Gather all registered marker types.
- IExtension[] extensions = point.getExtensions();
- for (int i = 0; i < extensions.length; ++i) {
- IExtension ext = extensions[i];
- String id = ext.getUniqueIdentifier();
- String label = ext.getLabel();
- if (label.equals("")) {//$NON-NLS-1$
- label = getWellKnownLabel(id);
- }
- ArrayList supersList = new ArrayList();
- IConfigurationElement[] configElements = ext.getConfigurationElements();
- for (int j = 0; j < configElements.length; ++j) {
- IConfigurationElement elt = configElements[j];
- if (elt.getName().equalsIgnoreCase("super")) {//$NON-NLS-1$
- String sup = elt.getAttribute("type");//$NON-NLS-1$
- if (sup != null) {
- supersList.add(sup);
- }
- }
- }
- String[] superTypes = new String[supersList.size()];
- supersList.toArray(superTypes);
- MarkerType type = new MarkerType(this, id, label, superTypes);
- types.put(id, type);
- }
- }
- return types;
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerUtil.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerUtil.java
deleted file mode 100644
index ad94f19..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerUtil.java
+++ /dev/null
@@ -1,443 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-
-/**
- * Utility class for accessing marker attributes.
- */
-/* package */ class MarkerUtil implements IMarkerConstants {
- private static Map imageDescriptors;
- private static ImageRegistry imageRegistry = new ImageRegistry();
-
- static {
- createImageDescriptors();
- }
-/**
- * Don't allow instantiation.
- */
-private MarkerUtil() {
-}
-/**
- * Creates an image descriptor for the image file referred to by the
- * given relative path (relative to the icons directory for the plug-in).
- */
-static ImageDescriptor createImageDescriptor(String relativePath) {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- URL URL_BASIC = TaskList.getPlugin().getDescriptor().getInstallURL();
- URL url = new URL(URL_BASIC, iconPath + relativePath);
- return ImageDescriptor.createFromURL(url);
- } catch (MalformedURLException e) {
- Assert.isTrue(false);
- return null;
- }
-}
-/**
- * Creates the map of image descriptors.
- */
-static void createImageDescriptors() {
- String CTOOL = "ctool16/";//$NON-NLS-1$
- String LOCAL = "clcl16/";//$NON-NLS-1$
- String LOCAL_GREY = "elcl16/";//$NON-NLS-1$
- String LOCAL_DISABLED = "dlcl16/";//$NON-NLS-1$
- String OBJ = "obj16/";//$NON-NLS-1$
-
- imageDescriptors = new HashMap(51);
- imageDescriptors.put("copy", createImageDescriptor(CTOOL + "copy_edit.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("paste", createImageDescriptor(CTOOL + "paste_edit.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("task", createImageDescriptor(OBJ + "taskmrk_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("error", createImageDescriptor(OBJ + "error_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("warn", createImageDescriptor(OBJ + "warn_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("info", createImageDescriptor(OBJ + "info_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("hprio", createImageDescriptor(OBJ + "hprio_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("lprio", createImageDescriptor(OBJ + "lprio_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("complete_tsk", createImageDescriptor(OBJ + "complete_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("incomplete_tsk", createImageDescriptor(OBJ + "incomplete_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("gotoobj", createImageDescriptor(LOCAL + "gotoobj_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("gotoobj_grey", createImageDescriptor(LOCAL_GREY + "gotoobj_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("addtsk", createImageDescriptor(LOCAL + "addtsk_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("addtsk_grey", createImageDescriptor(LOCAL_GREY + "addtsk_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("addtsk_disabled", createImageDescriptor(LOCAL_DISABLED + "addtsk_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("remtsk", createImageDescriptor(LOCAL + "remtsk_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("remtsk_grey", createImageDescriptor(LOCAL_GREY + "remtsk_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("remtsk_disabled", createImageDescriptor(LOCAL_DISABLED + "remtsk_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("showcomplete", createImageDescriptor(LOCAL + "showcomplete_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("selected_mode", createImageDescriptor(LOCAL + "selected_mode.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("selected_mode_grey", createImageDescriptor(LOCAL_GREY + "selected_mode.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("selected_mode_disabled", createImageDescriptor(LOCAL_DISABLED + "selected_mode.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("showchild_mode", createImageDescriptor(LOCAL + "showchild_mode.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("showchild_mode_grey", createImageDescriptor(LOCAL_GREY + "showchild_mode.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("showchild_mode_disabled", createImageDescriptor(LOCAL_DISABLED + "showchild_mode.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("showerr_grey", createImageDescriptor(LOCAL_GREY + "showerr_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("showerr_disabled", createImageDescriptor(LOCAL_DISABLED + "showerr_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("showwarn_grey", createImageDescriptor(LOCAL_GREY + "showwarn_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("showwarn_disabled", createImageDescriptor(LOCAL_DISABLED + "showwarn_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("showtsk_grey", createImageDescriptor(LOCAL_GREY + "showtsk_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("showtsk_disabled", createImageDescriptor(LOCAL_DISABLED + "showtsk_tsk.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("delete_edit", createImageDescriptor(CTOOL + "delete_edit.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("filter", createImageDescriptor(LOCAL + "filter_ps.gif"));//$NON-NLS-2$//$NON-NLS-1$
-}
-/**
- * Returns the ending character offset of the given marker.
- */
-public static int getCharEnd(IMarker marker) {
- return marker.getAttribute(IMarker.CHAR_END, -1);
-}
-/**
- * Returns the starting character offset of the given marker.
- */
-public static int getCharStart(IMarker marker) {
- return marker.getAttribute(IMarker.CHAR_START, -1);
-}
-/**
- * Returns the icon to be used in the tasklist
- * for the complete state of a task. Returns null
- * for markers that are not tasks.
- */
-public static Image getCompleteImage(IMarker marker) {
- if (isMarkerType(marker, IMarker.TASK)) {
- if (isComplete(marker))
- return getImage("complete_tsk");//$NON-NLS-1$
- else
- return getImage("incomplete_tsk");//$NON-NLS-1$
- }
- return null;
-}
-
-/**
- * Returns the text to be used for the complete state of a task.
- * Returns the empty string for markers that are not tasks.
- */
-public static String getCompleteText(IMarker marker) {
- if (isMarkerType(marker, IMarker.TASK)) {
- if (isComplete(marker))
- return TaskListMessages.getString("TaskList.completed"); //$NON-NLS-1$
- else
- return TaskListMessages.getString("TaskList.notCompleted"); //$NON-NLS-1$
- }
- return ""; //$NON-NLS-1$
-}
-
-/**
- * Returns the text to be used for the kind of marker.
- */
-public static String getKindText(IMarker marker) {
- if (isMarkerType(marker, IMarker.TASK)) {
- return TaskListMessages.getString("TaskList.task"); //$NON-NLS-1$
- }
- switch (getSeverity(marker)) {
- case IMarker.SEVERITY_ERROR:
- return TaskListMessages.getString("TaskList.error"); //$NON-NLS-1$
- case IMarker.SEVERITY_WARNING:
- return TaskListMessages.getString("TaskList.warning"); //$NON-NLS-1$
- case IMarker.SEVERITY_INFO:
- return TaskListMessages.getString("TaskList.info"); //$NON-NLS-1$
- }
- return ""; //$NON-NLS-1$
-}
-
-/**
- * Returns the container name if it is defined, or empty string if not.
- */
-public static String getContainerName(IMarker marker) {
- // taking substring from resource's path string is 40x faster
- // than getting relative path string from resource's parent
- String path = marker.getResource().getFullPath().toString();
- int i = path.lastIndexOf(IPath.SEPARATOR);
- if (i == 0)
- return ""; //$NON-NLS-1$
- return path.substring(1, i);
-}
-
-/**
- * Returns the image with the given key, or <code>null</code> if not found.
- */
-static Image getImage(String key) {
- Image image = (Image) imageRegistry.get(key);
- if (image == null) {
- ImageDescriptor desc = getImageDescriptor(key);
- if (desc != null) {
- image = desc.createImage(false);
- if (image == null) {
- System.err.println("TaskList: Error creating image for " + key);//$NON-NLS-1$
- }
- imageRegistry.put(key, image);
- }
- }
- return image;
-}
-/**
- * Returns the image that should be used to visually represent
- * the marker, based on its type and priority.
- */
-static public Image getImage(IMarker marker) {
- if (isMarkerType(marker, IMarker.PROBLEM)) {
- switch (getSeverity(marker)) {
- case IMarker.SEVERITY_ERROR:
- return getImage("error");//$NON-NLS-1$
- case IMarker.SEVERITY_WARNING:
- return getImage("warn");//$NON-NLS-1$
- case IMarker.SEVERITY_INFO:
- return getImage("info");//$NON-NLS-1$
- }
- }
- else if (isMarkerType(marker, IMarker.TASK)) {
- return getImage("task");//$NON-NLS-1$
- }
- return null;
-}
-/**
- * Returns the image descriptor with the given key, or <code>null</code> if not found.
- */
-static ImageDescriptor getImageDescriptor(String key) {
- ImageDescriptor desc = (ImageDescriptor) imageDescriptors.get(key);
- if (desc == null) {
- System.err.println("TaskList: No image descriptor for " + key); //$NON-NLS-1$
- }
- return desc;
-}
-
-/**
- * Returns the text for the line and location column given the marker.
- */
-public static String getLineAndLocation(IMarker marker) {
- int lineNumber = getLineNumber(marker);
- String location = getLocation(marker);
- return getLineAndLocation(lineNumber, location);
-}
-
-/**
- * Returns the text for the line and location column given the line number and location text.
- */
-public static String getLineAndLocation(int lineNumber, String location) {
- if (lineNumber == -1) {
- if (location.equals("")) {//$NON-NLS-1$
- return "";//$NON-NLS-1$
- }
- else {
- return location;
- }
- }
- else {
- if (location.equals("")) {//$NON-NLS-1$
- return TaskListMessages.format("TaskList.line", new Object[] { new Integer(lineNumber) }); //$NON-NLS-1$
- }
- else {
- return TaskListMessages.format("TaskList.lineAndLocation", new Object[] { new Integer(lineNumber), location }); //$NON-NLS-1$
- }
- }
-}
-/**
- * Returns the line number of the given marker.
- */
-public static int getLineNumber(IMarker marker) {
- return marker.getAttribute(IMarker.LINE_NUMBER, -1);
-}
-/**
- * Returns the text for the location field.
- */
-public static String getLocation(IMarker marker) {
- return marker.getAttribute(IMarker.LOCATION, "");//$NON-NLS-1$
-}
-/**
- * Returns the message attribute of the given marker,
- * or the empty string if the message attribute is not defined.
- */
-public static String getMessage(IMarker marker) {
- return marker.getAttribute(IMarker.MESSAGE, "");//$NON-NLS-1$
-}
-/**
- * Returns the numeric value of the given string, which is assumed to represent a numeric value.
- *
- * @return <code>true</code> if numeric, <code>false</code> if not
- */
-static public int getNumericValue(String value) {
- boolean negative = false;
- int i = 0;
- int len = value.length();
-
- // skip any leading '#'
- // workaround for 1GCE69U: ITPJCORE:ALL - Java problems should not have '#' in location.
- if (i < len && value.charAt(i) == '#')
- ++i;
-
- if (i < len && value.charAt(i) == '-') {
- negative = true;
- ++i;
- }
-
- int result = 0;
- while (i < len) {
- int digit = Character.digit(value.charAt(i++), 10);
- if (digit < 0) {
- return result;
- }
- result = result * 10 + digit;
- }
- if (negative) {
- result = -result;
- }
- return result;
-}
-/**
- * Returns the priority of the given marker. Default is PRIORITY_NORMAL.
- */
-public static int getPriority(IMarker marker) {
- return marker.getAttribute(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
-}
-/**
- * Returns an image that should visually represent marker's priority
- * in the tasklist.
- */
-public static Image getPriorityImage(IMarker marker) {
- switch (getPriority(marker)) {
- case IMarker.PRIORITY_HIGH:
- return getImage("hprio");//$NON-NLS-1$
- case IMarker.PRIORITY_NORMAL:
- return null; // no image for normal priority
- case IMarker.PRIORITY_LOW:
- return getImage("lprio");//$NON-NLS-1$
- }
- return null;
-}
-
-/**
- * Returns the text for the given marker's priority.
- */
-public static String getPriorityText(IMarker marker) {
- switch (getPriority(marker)) {
- case IMarker.PRIORITY_HIGH:
- return TaskListMessages.getString("TaskList.high"); //$NON-NLS-1$
- case IMarker.PRIORITY_NORMAL:
- return ""; //$NON-NLS-1$
- case IMarker.PRIORITY_LOW:
- return TaskListMessages.getString("TaskList.low"); //$NON-NLS-1$
- }
- return ""; //$NON-NLS-1$
-}
-
-/**
- * Implements IProvider interface by supporting a number of
- * properties required for visual representation of markers
- * in the tasklist.
- */
-
-static public Object getProperty(Object object, String key) {
- IMarker marker = (IMarker) object;
-
- // optimizations:
- // - check properties needed for TaskListLabelProvider first,
- // then those needed for cell modifiers
- // - use == instead of equals for efficiency
- if (IBasicPropertyConstants.P_IMAGE == key) {
- return getImage(marker);
- }
- if (IMarkerConstants.P_COMPLETE_IMAGE == key) {
- return getCompleteImage(marker);
- }
- if (IMarkerConstants.P_PRIORITY_IMAGE == key) {
- return getPriorityImage(marker);
- }
- if (IMarker.MESSAGE == key) {
- return getMessage(marker);
- }
- if (IMarkerConstants.P_RESOURCE_NAME == key) {
- return getResourceName(marker);
- }
- if (IMarkerConstants.P_CONTAINER_NAME == key) {
- return getContainerName(marker);
- }
- if (IMarkerConstants.P_LINE_AND_LOCATION == key) {
- return getLineAndLocation(marker);
- }
- if (IMarker.PRIORITY == key) {
- // this property is used only by cell editor, where order is High, Normal, Low
- return new Integer(IMarker.PRIORITY_HIGH-getPriority(marker));
- }
- if (IMarker.DONE == key) {
- return isComplete(marker) ? Boolean.TRUE : Boolean.FALSE;
- }
- if (IBasicPropertyConstants.P_TEXT == key) {
- return getMessage(marker);
- }
- return null;
-}
-/**
- * Returns name if it is defined, or
- * blank string if not.
- */
-public static String getResourceName(IMarker marker) {
- return marker.getResource().getName();
-}
-/**
- * Returns the severity of the given marker. Default is SEVERITY_WARNING.
- */
-public static int getSeverity(IMarker marker) {
- return marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
-}
-/**
- * A helper method that returns true if the given
- * marker is marked as complete in the tasklist.
- * Only tasks can be complete.
- */
-public static boolean isComplete(IMarker marker) {
- return marker.getAttribute(IMarker.DONE, false);
-}
-/**
- * Returns whether the given marker is of the given type (either directly or indirectly).
- */
-public static boolean isMarkerType(IMarker marker, String type) {
- try {
- return marker.isSubtypeOf(type);
- }
- catch (CoreException e) {
- return false;
- }
-}
-/**
- * Returns whether the given string represents a numeric value.
- *
- * @return <code>true</code> if numeric, <code>false</code> if not
- */
-static public boolean isNumeric(String value) {
- int i = 0;
- int len = value.length();
-
- // skip any leading '#'
- // workaround for 1GCE69U: ITPJCORE:ALL - Java problems should not have '#' in location.
- if (i < len && value.charAt(i) == '#')
- ++i;
-
- // skip any '-'
- if (i < len && value.charAt(i) == '-')
- ++i;
-
- // if no digits, consider it not to be numeric
- if (i == len)
- return false;
-
- while (i < len) {
- if (Character.digit(value.charAt(i++), 10) == -1)
- return false;
- }
- return true;
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/NewTaskAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/NewTaskAction.java
deleted file mode 100644
index 87bf78b..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/NewTaskAction.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IMarker;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This action creates a new task. If a resource is currently
- * present at the tasklist's input, this task will be
- * associated with it. If the tasklist is currently
- * observing all the markers in the workbench, the task
- * will not be associated with any resource.
- * <p>The newly created task will have low priority,
- * fixed description text and will not be subject to
- * sorting or filtering until its desciprion is being
- * changed for the first time. For this reason, new
- * tasks remain at the top of the task list
- * until modified. It is possible that the newly
- * created task dissapears after that if its
- * type or some other property causes it to
- * be filtered out.
- */
-/* package */ class NewTaskAction extends TaskAction {
-
-/**
- * Creates the action.
- */
-public NewTaskAction(TaskList tasklist, String id) {
- super(tasklist, id);
- WorkbenchHelp.setHelp(this, ITaskListHelpContextIds.NEW_TASK_ACTION);
-}
-/**
- * Opens the new task dialog and shows the newly created task when done.
- * The new task is created on the currently selected resource.
- */
-public void run() {
- TaskPropertiesDialog dialog = new TaskPropertiesDialog(getShell());
- dialog.setResource(getTaskList().getResource());
- int result = dialog.open();
- if (result == Dialog.OK) {
- showMarker(dialog.getMarker());
- }
-}
-
-/**
- * Show the newly created marker.
- */
-private void showMarker(final IMarker marker) {
- if (marker == null) {
- return;
- }
- if (getTaskList().shouldShow(marker)) {
- // Need to do this in an asyncExec, even though we're in the UI thread here,
- // since the task list updates itself with the addition in an asyncExec,
- // which hasn't been processed yet.
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- getTaskList().setSelection(new StructuredSelection(marker), true);
- }
- });
- }
- else {
- MessageDialog.openInformation(
- getShell(),
- TaskListMessages.getString("NewTask.notShownTitle"), //$NON-NLS-1$
- TaskListMessages.getString("NewTask.notShownMsg")); //$NON-NLS-1$
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/PasteTaskAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/PasteTaskAction.java
deleted file mode 100644
index df7cc1d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/PasteTaskAction.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.Map;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.MarkerTransfer;
-
-/**
- * Standard action for pasting tasks from the clipboard.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- *
- * @since 2.0
- */
-/*package*/ class PasteTaskAction extends TaskAction {
-
-/**
- * Creates a new action.
- */
-public PasteTaskAction(TaskList tasklist, String id) {
- super(tasklist, id);
- WorkbenchHelp.setHelp(this, ITaskListHelpContextIds.PASTE_TASK_ACTION);
-}
-/**
- * Implementation of method defined on <code>IAction</code>.
- */
-public void run() {
- // Get the markers from the clipboard
- MarkerTransfer transfer = MarkerTransfer.getInstance();
- final IMarker[] markerData = (IMarker[])getTaskList().getClipboard().getContents(transfer);
-
- if (markerData == null)
- return;
-
- final ArrayList newMarkers = new ArrayList();
-
- try {
- getTaskList().getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (int i = 0; i < markerData.length; i++) {
- // Only paste tasks (not problems)
- if (!markerData[i].getType().equals(IMarker.TASK))
- continue;
-
- // Paste to the same resource as the original
- IResource resource = markerData[i].getResource();
- Map attributes = markerData[i].getAttributes();
- IMarker marker = resource.createMarker(IMarker.TASK);
- marker.setAttributes(attributes);
- newMarkers.add(marker);
- }
- }
- }, null);
- } catch (CoreException e) {
- ErrorDialog.openError(
- getShell(),
- TaskListMessages.getString("PasteTask.errorMessage"), //$NON-NLS-1$
- null,
- e.getStatus());
- return;
- }
-
- // Need to do this in an asyncExec, even though we're in the UI thread here,
- // since the task list updates itself with the addition in an asyncExec,
- // which hasn't been processed yet.
- // Must be done outside IWorkspaceRunnable above since notification for add is
- // sent after IWorkspaceRunnable is run.
- if (newMarkers.size() > 0) {
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- TaskList taskList = getTaskList();
- taskList.setSelection(new StructuredSelection(newMarkers), true);
- }
- });
- }
-}
-
-
-}
-
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/PurgeCompletedAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/PurgeCompletedAction.java
deleted file mode 100644
index c60f52d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/PurgeCompletedAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This action deletes all the tasks found in the registry that
- * are marked as completed.
- */
-/* package */ class PurgeCompletedAction extends TaskAction {
-/**
- * Creates the action.
- */
-public PurgeCompletedAction(TaskList tasklist, String id) {
- super(tasklist, id);
- WorkbenchHelp.setHelp(this, ITaskListHelpContextIds.PURGE_COMPLETED_TASK_ACTION);
-}
-/**
- * Fetches all the completed tasks in the workspace and deletes them.
- */
-public void run() {
- // Verify.
- if (!MessageDialog
- .openConfirm(
- getShell(),
- TaskListMessages.getString("PurgeCompleted.question"), //$NON-NLS-1$
- TaskListMessages.getString("PurgeCompleted.permanent") //$NON-NLS-1$
- ))
- return;
-
- try {
- IResource resource = getTaskList().getResource();
- int depth = getTaskList().getResourceDepth();
- IMarker[] tasks = resource.findMarkers(IMarker.TASK, true, depth);
- final List completed = new ArrayList(tasks.length);
- for (int i = 0; i < tasks.length; i++) {
- IMarker task = tasks[i];
- if (MarkerUtil.isComplete(task)) {
- completed.add(task);
- }
- }
- // Check if there is anything to do
- if (completed.size() == 0)
- return;
- IMarker[] toDelete = new IMarker[completed.size()];
- completed.toArray(toDelete);
- getTaskList().getWorkspace().deleteMarkers(toDelete);
- } catch (CoreException e) {
- ErrorDialog.openError(getShell(), TaskListMessages.getString("PurgeCompleted.errorMessage"), null, e.getStatus()); //$NON-NLS-1$
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/RemoveTaskAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/RemoveTaskAction.java
deleted file mode 100644
index b0d0cb9..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/RemoveTaskAction.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.widgets.Table;
-
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This action removes the selected task(s) from the task list.
- * Only tasks can be removed. Problems can only disappear from
- * the task list when they are fixed in the associated code.
- */
-/* package */ class RemoveTaskAction extends TaskAction {
-/**
- * Creates the action.
- */
-public RemoveTaskAction(TaskList tasklist, String id) {
- super(tasklist, id);
- WorkbenchHelp.setHelp(this, ITaskListHelpContextIds.REMOVE_TASK_ACTION);
-}
-/**
- * Removes all the tasks in the current selection from the task list.
- */
-public void run() {
- TaskList taskList = getTaskList();
- TableViewer viewer = taskList.getTableViewer();
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- if (selection.isEmpty()) {
- return;
- }
- taskList.cancelEditing();
- // get the index of the selected item which has focus
- Table table = viewer.getTable();
- int focusIndex = table.getSelectionIndex();
- try {
- List list = ((IStructuredSelection) selection).toList();
- IMarker[] markers = new IMarker[list.size()];
- list.toArray(markers);
- // be sure to only invoke one workspace operation
- taskList.getWorkspace().deleteMarkers(markers);
- // set the selection to be the one which took the place of the one with focus
- int count = table.getItemCount();
- if (focusIndex < count) {
- table.setSelection(focusIndex);
- }
- else if (count != 0) {
- table.setSelection(count-1);
- }
- // update the viewer's selection, since setting the table selection does not notify the viewer
- viewer.setSelection(viewer.getSelection(), true);
-
- } catch (CoreException e) {
- ErrorDialog.openError(
- getShell(),
- TaskListMessages.getString("RemoveTask.errorMessage"), //$NON-NLS-1$
- null,
- e.getStatus());
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ResolveMarkerAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ResolveMarkerAction.java
deleted file mode 100644
index 43eccdc..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ResolveMarkerAction.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IMarkerResolution;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.MarkerResolutionSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This action displays a list of resolutions for the selected marker
- *
- * @since 2.0
- */
-/* package */ class ResolveMarkerAction extends TaskAction {
- /**
- * Creates the action.
- */
- protected ResolveMarkerAction(TaskList tasklist, String id) {
- super(tasklist, id);
- WorkbenchHelp.setHelp(this, ITaskListHelpContextIds.RESOLVE_MARKER_ACTION);
- }
-
- /* (non-Javadoc)
- * Method declared on IAction.
- */
- public boolean isEnabled() {
- IMarker marker = getMarker();
- if (marker == null)
- return false;
- IWorkbench workbench = getTaskList().getViewSite().getWorkbenchWindow().getWorkbench();
- return workbench.getMarkerHelpRegistry().hasResolutions(marker);
- }
-
- /**
- * Displays a list of resolutions and performs the selection.
- */
- public void run() {
- IMarker marker = getMarker();
- getTaskList().cancelEditing();
- IMarkerResolution[] resolutions = getResolutions(marker);
- if (resolutions.length == 0) {
- MessageDialog.openInformation(
- getShell(),
- TaskListMessages.getString("Resolve.title"), //$NON-NLS-1
- TaskListMessages.getString("Resolve.noResolutionsLabel")); //$NON-NLS-1);
- return;
- }
- MarkerResolutionSelectionDialog d = new MarkerResolutionSelectionDialog(getShell(), resolutions);
- if (d.open() != Dialog.OK)
- return;
- Object[] result = d.getResult();
- if (result != null && result.length > 0)
- ((IMarkerResolution)result[0]).run(marker);
- }
-
- /**
- * Returns the resolutions for the given marker.
- *
- * @param the marker for which to obtain resolutions
- * @return the resolutions for the selected marker
- */
- private IMarkerResolution[] getResolutions(IMarker marker) {
- IWorkbench workbench = getTaskList().getViewSite().getWorkbenchWindow().getWorkbench();
- return workbench.getMarkerHelpRegistry().getResolutions(marker);
- }
-
- /**
- * Returns the selected marker (may be <code>null</code>).
- *
- * @return the selected marker
- */
- private IMarker getMarker() {
- IStructuredSelection selection = (IStructuredSelection)getTaskList().getSelection();
- // only enable for single selection
- if (selection.size() != 1)
- return null;
- return (IMarker)selection.getFirstElement();
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/SelectAllTasksAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/SelectAllTasksAction.java
deleted file mode 100644
index d01de81..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/SelectAllTasksAction.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This action selects all tasks currently showing in the task list.
- */
-/* package */ class SelectAllTasksAction extends TaskAction {
-/**
- * Creates the action.
- */
-protected SelectAllTasksAction(TaskList tasklist, String id) {
- super(tasklist, id);
- WorkbenchHelp.setHelp(this, ITaskListHelpContextIds.SELECT_ALL_TASKS_ACTION);
-}
-/**
- * Selects all resources in the view.
- */
-public void run() {
- getTaskList().cancelEditing();
- TableViewer viewer = getTaskList().getTableViewer();
- viewer.getTable().selectAll();
- // force viewer selection change
- viewer.setSelection(viewer.getSelection());
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskAction.java
deleted file mode 100644
index 5627500..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.IDialogSettings;
-
-/**
- * This is the base class of all the local actions used
- * in the task list view.
- */
-/* package */ abstract class TaskAction extends Action {
- private TaskList taskList;
-/**
- * TaskAction constructor.
- */
-protected TaskAction(TaskList tasklist, String id) {
- super();
- this.taskList = tasklist;
- setId(id);
-}
-/**
- * Returns the shell to use within actions.
- */
-protected Shell getShell() {
- return taskList.getSite().getShell();
-}
-/**
- * Returns the task list viewer.
- */
-protected TaskList getTaskList() {
- return taskList;
-}
-/**
- * Stores the current state value of this toggle action
- * into the dialog store using action ID as a key.
- */
-protected void storeValue() {
- IDialogSettings workbenchSettings = TaskList.getPlugin().getDialogSettings();
- IDialogSettings settings = workbenchSettings.getSection("TaskAction");//$NON-NLS-1$
- if(settings == null)
- settings = workbenchSettings.addNewSection("TaskAction");//$NON-NLS-1$
- settings.put(getId(), isChecked());
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskList.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskList.java
deleted file mode 100644
index a1c1311..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskList.java
+++ /dev/null
@@ -1,1294 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Cagatay Kavukcuoglu <cagatayk@acm.org> - Filter for markers in same project
-**********************************************************************/
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.*;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * Main class for the Task List view for displaying tasks and problem annotations
- * on resources, and for opening an editor on the resource when the user commands.
- * <p>
- * This standard view has id <code>"org.eclipse.ui.views.TaskList"</code>.
- * </p>
- * <p>
- * The workbench will automatically instantiate this class when a Task List
- * view is needed for a workbench window. This class is not intended
- * to be instantiated or subclassed by clients.
- * </p>
- */
-public class TaskList extends ViewPart {
-
- private Table table;
- private TableEditor tableEditor;
- private MenuManager contextMenu;
-
- private CellEditor descriptionEditor;
- private TableViewer viewer;
- private TasksFilter filter = new TasksFilter();
- private IMemento memento;
-
- private boolean markerLimitExceeded;
- private Composite parent;
- private StackLayout stackLayout = new StackLayout();
- private Composite compositeMarkerLimitExceeded;
-
- private CellEditorActionHandler editorActionHandler;
- private TaskAction newTaskAction;
- private TaskAction copyTaskAction;
- private TaskAction pasteTaskAction;
- private TaskAction removeTaskAction;
- private TaskAction purgeCompletedAction;
- private TaskAction gotoTaskAction;
- private TaskAction selectAllAction;
- private TaskAction resolveMarkerAction;
- private TaskAction filtersAction;
- private TaskAction markCompletedAction;
- private TaskAction propertiesAction;
-
- private Clipboard clipboard;
-
- private static String[] tableColumnProperties = {
- IBasicPropertyConstants.P_IMAGE,
- IMarker.DONE,
- IMarker.PRIORITY,
- IMarker.MESSAGE,
- IMarkerConstants.P_RESOURCE_NAME,
- IMarkerConstants.P_CONTAINER_NAME,
- IMarkerConstants.P_LINE_AND_LOCATION};
-
- // Persistance tags.
- private static final String TAG_COLUMN = "column"; //$NON-NLS-1$
- private static final String TAG_NUMBER = "number"; //$NON-NLS-1$
- private static final String TAG_WIDTH = "width"; //$NON-NLS-1$
- private static final String TAG_SORTER_COLUMN = "sorterColumn"; //$NON-NLS-1$
- private static final String TAG_SORTER_REVERSED = "sorterReversed"; //$NON-NLS-1$
- private static final String TAG_FILTER = "filter"; //$NON-NLS-1$
- private static final String TAG_SELECTION = "selection"; //$NON-NLS-1$
- private static final String TAG_ID = "id"; //$NON-NLS-1$
- private static final String TAG_MARKER = "marker"; //$NON-NLS-1$
- private static final String TAG_RESOURCE = "resource"; //$NON-NLS-1$
- private static final String TAG_TOP_INDEX = "topIndex"; //$NON-NLS-1$
-
- static class TaskListLabelProvider
- extends LabelProvider
- implements ITableLabelProvider {
-
- private static String[] keys = {
- IBasicPropertyConstants.P_IMAGE,
- IMarkerConstants.P_COMPLETE_IMAGE,
- IMarkerConstants.P_PRIORITY_IMAGE,
- IMarker.MESSAGE,
- IMarkerConstants.P_RESOURCE_NAME,
- IMarkerConstants.P_CONTAINER_NAME,
- IMarkerConstants.P_LINE_AND_LOCATION};
-
- public String getColumnText(Object element, int columnIndex) {
- if (columnIndex >= 3 && columnIndex <= 6)
- return (String) MarkerUtil.getProperty(element, keys[columnIndex]);
- return ""; //$NON-NLS-1$
- }
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex >= 0 && columnIndex <= 2) {
- return (Image) MarkerUtil.getProperty(element, keys[columnIndex]);
- }
- return null;
- }
- }
-
- private String columnHeaders[] = {
- TaskListMessages.getString("TaskList.headerIcon"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.headerCompleted"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.headerPriority"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.headerDescription"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.headerResource"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.headerFolder"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.headerLocation") //$NON-NLS-1$
- };
-
- private ColumnLayoutData columnLayouts[] = {
- new ColumnPixelData(19, false),
- new ColumnPixelData(19, false),
- new ColumnPixelData(19, false),
- new ColumnWeightData(200),
- new ColumnWeightData(75),
- new ColumnWeightData(150),
- new ColumnWeightData(60)};
-
-
- private IPartListener partListener = new IPartListener() {
- public void partActivated(IWorkbenchPart part) {
- TaskList.this.partActivated(part);
- }
- public void partBroughtToTop(IWorkbenchPart part) {
- }
- public void partClosed(IWorkbenchPart part) {
- TaskList.this.partClosed(part);
- }
- public void partDeactivated(IWorkbenchPart part) {
- }
- public void partOpened(IWorkbenchPart part) {
- }
- };
- private ISelectionChangedListener focusSelectionChangedListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- TaskList.this.focusSelectionChanged(event);
- }
- };
- private IResource[] focusResources;
- private IWorkbenchPart focusPart;
- private ISelectionProvider focusSelectionProvider;
-
- private ICellModifier cellModifier = new ICellModifier() {
- public Object getValue(Object element, String property) {
- return MarkerUtil.getProperty(element,property);
- }
-
- public boolean canModify(Object element, String property) {
- IMarker marker = (IMarker) element;
- return MarkerUtil.isMarkerType(marker, IMarker.TASK);
- }
-
- /**
- * Modifies a marker as a result of a successfully completed direct editing.
- */
- public void modify(Object element, String property, Object value) {
- Item item = (Item) element;
- IMarker marker = (IMarker) item.getData();
- setProperty(marker, property, value);
- }
- };
-
-/**
- * Creates a new task list view.
- */
-public TaskList() {
- super();
-}
-void addDragSupport(Control control) {
-
- int operations = DND.DROP_COPY;
- Transfer[] transferTypes = new Transfer[]{MarkerTransfer.getInstance(),
- TextTransfer.getInstance()};
- DragSourceListener listener = new DragSourceAdapter() {
- public void dragSetData(DragSourceEvent event){
- performDragSetData(event);
- }
- public void dragFinished(DragSourceEvent event){
- }
- };
- viewer.addDragSupport(operations, transferTypes, listener);
-}
-void cancelEditing() {
- getTableViewer().cancelEditing();
-}
-void createColumns() {
- /**
- * This class handles selections of the column headers.
- * Selection of the column header will cause resorting
- * of the shown tasks using that column's sorter.
- * Repeated selection of the header will toggle
- * sorting order (ascending versus descending).
- */
- SelectionListener headerListener = new SelectionAdapter() {
- /**
- * Handles the case of user selecting the
- * header area.
- * <p>If the column has not been selected previously,
- * it will set the sorter of that column to be
- * the current tasklist sorter. Repeated
- * presses on the same column header will
- * toggle sorting order (ascending/descending).
- */
- public void widgetSelected(SelectionEvent e) {
- // column selected - need to sort
- int column = table.indexOf((TableColumn) e.widget);
- TaskSorter oldSorter = (TaskSorter) viewer.getSorter();
- if (oldSorter != null && column == oldSorter.getColumnNumber()) {
- oldSorter.setReversed(!oldSorter.isReversed());
- viewer.refresh();
- } else {
- viewer.setSorter(new TaskSorter(TaskList.this, column));
- }
- }
- };
-
- if(memento != null) {
- //restore columns width
- IMemento children[] = memento.getChildren(TAG_COLUMN);
- if (children != null) {
- for (int i = 0; i < children.length; i++) {
- Integer val = children[i].getInteger(TAG_NUMBER);
- if (val != null) {
- int index = val.intValue();
- val = children[i].getInteger(TAG_WIDTH);
- if (val != null) {
- columnLayouts[index] = new ColumnPixelData(val.intValue(), true);
- }
- }
- }
- }
- }
-
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
- table.setHeaderVisible(true);
- for (int i = 0; i < columnHeaders.length; i++) {
- layout.addColumnData(columnLayouts[i]);
- TableColumn tc = new TableColumn(table, SWT.NONE,i);
- tc.setResizable(columnLayouts[i].resizable);
- tc.setText(columnHeaders[i]);
- tc.addSelectionListener(headerListener);
- }
-
-}
-/**
- * Returns a string that summarizes the contents of the
- * given markers.
- */
-/*package*/ static String createMarkerReport(IMarker[] markers) {
- StringBuffer buf = new StringBuffer();
- // Create the header
- buf.append(TaskListMessages.getString("TaskList.reportKind")); //$NON-NLS-1$
- buf.append("\t"); //$NON-NLS-1$
- buf.append(TaskListMessages.getString("TaskList.reportStatus")); //$NON-NLS-1$
- buf.append("\t"); //$NON-NLS-1$
- buf.append(TaskListMessages.getString("TaskList.reportPriority")); //$NON-NLS-1$
- buf.append("\t"); //$NON-NLS-1$
- buf.append(TaskListMessages.getString("TaskList.headerDescription")); //$NON-NLS-1$
- buf.append("\t"); //$NON-NLS-1$
- buf.append(TaskListMessages.getString("TaskList.headerResource")); //$NON-NLS-1$
- buf.append("\t"); //$NON-NLS-1$
- buf.append(TaskListMessages.getString("TaskList.headerFolder")); //$NON-NLS-1$
- buf.append("\t"); //$NON-NLS-1$
- buf.append(TaskListMessages.getString("TaskList.headerLocation")); //$NON-NLS-1$
- buf.append(System.getProperty("line.separator")); //$NON-NLS-1$
-
- // Create the report for the markers
- for (int i = 0; i < markers.length; i++) {
- writeMarker(buf, markers[i]);
- }
- return buf.toString();
-}
-
-/* package */ boolean isMarkerLimitExceeded() {
- return markerLimitExceeded;
-}
-
-/* package */ void setMarkerLimitExceeded(boolean markerLimitExceeded) {
- this.markerLimitExceeded = markerLimitExceeded;
-
- if (markerLimitExceeded) {
- stackLayout.topControl = compositeMarkerLimitExceeded;
- }
- else {
- stackLayout.topControl = table;
- }
-
- parent.layout();
-}
-
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
-public void createPartControl(Composite parent) {
- this.parent = parent;
- clipboard = new Clipboard(parent.getDisplay());
- createTable(parent);
- viewer = new TableViewer(table);
- viewer.setUseHashlookup(true);
- createColumns();
- makeActions();
- fillActionBars();
- addDragSupport(table);
-
- compositeMarkerLimitExceeded = new Composite(parent, SWT.NONE);
- compositeMarkerLimitExceeded.setLayout(new GridLayout());
- Label labelMarkerLimitExceeded = new Label(compositeMarkerLimitExceeded,
- SWT.WRAP);
- labelMarkerLimitExceeded.setText(TaskListMessages.getString(
- "TaskList.markerLimitExceeded")); //$NON-NLS-1$
- parent.setLayout(stackLayout);
- setMarkerLimitExceeded(false);
-
- viewer.setContentProvider(new TaskListContentProvider(this));
- viewer.setLabelProvider(new TaskListLabelProvider());
- viewer.setSorter(new TaskSorter(this, 5));
- if(memento != null) {
- //restore filter
- IMemento filterMem = memento.getChild(TAG_FILTER);
- if(filterMem != null)
- getFilter().restoreState(filterMem);
- //restore sorter
- Integer columnNumber = memento.getInteger(TAG_SORTER_COLUMN);
- if(columnNumber != null) {
- boolean reversed = memento.getInteger(TAG_SORTER_REVERSED).intValue() == 1;
- TaskSorter sorter = new TaskSorter(this, columnNumber.intValue());
- sorter.setReversed(reversed);
- viewer.setSorter(sorter);
- }
- }
- viewer.setInput(getWorkspace().getRoot());
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- TaskList.this.selectionChanged(event);
- }
- });
- viewer.addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- gotoTaskAction.run();
- }
- });
- viewer.getControl().addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- handleKeyPressed(e);
- }
- });
-
- CellEditor editors[] = new CellEditor[columnHeaders.length];
- editors[1] = new CheckboxCellEditor(table);
- editors[2] = new ComboBoxCellEditor(table,new String[] {
- TaskListMessages.getString("TaskList.high"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.normal"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.low") //$NON-NLS-1$
- });
- editors[3] = descriptionEditor = new TextCellEditor(table);
- viewer.setCellEditors(editors);
- viewer.setCellModifier(cellModifier);
- viewer.setColumnProperties(tableColumnProperties);
-
- // Configure the context menu to be lazily populated on each pop-up.
- MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(
- new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- TaskList.this.fillContextMenu(manager);
- }
- });
- Menu menu = menuMgr.createContextMenu(table);
- table.setMenu(menu);
- // Be sure to register it so that other plug-ins can add actions.
- getSite().registerContextMenu(menuMgr, viewer);
- this.contextMenu = menuMgr;
-
- // Track selection in the page.
- getSite().getPage().addPartListener(partListener);
-
- // Add global action handlers.
- editorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
- editorActionHandler.addCellEditor(descriptionEditor);
- editorActionHandler.setCopyAction(copyTaskAction);
- editorActionHandler.setPasteAction(pasteTaskAction);
- editorActionHandler.setDeleteAction(removeTaskAction);
- editorActionHandler.setSelectAllAction(selectAllAction);
-
- getViewSite().getActionBars().setGlobalActionHandler(
- IWorkbenchActionConstants.PROPERTIES,
- propertiesAction);
-
-
- if (memento != null) restoreState(memento);
- memento = null;
-
- // Set help on the view itself
- viewer.getControl().addHelpListener(new HelpListener() {
- /*
- * @see HelpListener#helpRequested(HelpEvent)
- */
- public void helpRequested(HelpEvent e) {
- String contextId = null;
- // See if there is a context registered for the current selection
- IMarker marker = (IMarker)((IStructuredSelection)getSelection()).getFirstElement();
- if (marker != null) {
- IWorkbench workbench = getViewSite().getWorkbenchWindow().getWorkbench();
- contextId = workbench.getMarkerHelpRegistry().getHelp(marker);
- }
-
- if (contextId == null)
- contextId = ITaskListHelpContextIds.TASK_LIST_VIEW;
-
- WorkbenchHelp.displayHelp(contextId);
- }
- });
-
- // Prime the status line and title.
- updateStatusMessage();
- updateTitle();
-}
-/**
- * Creates the table control.
- */
-void createTable(Composite parent) {
- table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
- table.setLinesVisible(true);
- //table.setLayout(new TableLayout());
-
- tableEditor = new TableEditor(table);
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
-public void dispose() {
- super.dispose();
- getSite().getPage().removePartListener(partListener);
- if (focusSelectionProvider != null) {
- focusSelectionProvider.removeSelectionChangedListener(focusSelectionChangedListener);
- focusSelectionProvider = null;
- }
- focusPart = null;
- if (editorActionHandler != null) {
- editorActionHandler.dispose();
- editorActionHandler = null;
- }
- if (clipboard != null)
- clipboard.dispose();
-}
-/**
- * Activates the editor on the given marker.
- */
-public void edit(IMarker marker) {
- viewer.editElement(marker, 3);
-}
-/**
- * Fills the local tool bar and menu manager with actions.
- */
-void fillActionBars() {
- IActionBars actionBars = getViewSite().getActionBars();
- IMenuManager menu = actionBars.getMenuManager();
- menu.add(filtersAction);
-
- IToolBarManager toolBar = actionBars.getToolBarManager();
- toolBar.add(newTaskAction);
- toolBar.add(removeTaskAction);
- toolBar.add(filtersAction);
-}
-/**
- * Contributes actions to the pop-up menu.
- */
-void fillContextMenu(IMenuManager menu) {
- menu.add(newTaskAction);
- menu.add(gotoTaskAction);
- menu.add(new Separator());
- menu.add(copyTaskAction);
- menu.add(pasteTaskAction);
- menu.add(removeTaskAction);
- menu.add(new Separator());
- menu.add(markCompletedAction);
- menu.add(purgeCompletedAction);
- menu.add(new Separator());
- menu.add(resolveMarkerAction);
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS+"-end")); //$NON-NLS-1$
- menu.add(propertiesAction);
-}
-/**
- * The filter settings have changed.
- * Refreshes the viewer and title bar.
- */
-void filterChanged() {
-
- BusyIndicator.showWhile(viewer.getControl().getShell().getDisplay(), new Runnable() {
- public void run() {
- // Filter has already been updated by dialog; just refresh.
- // Don't need to update labels for existing elements
- // since changes to filter settings don't affect them.
- viewer.getControl().setRedraw(false);
- viewer.refresh(false);
- viewer.getControl().setRedraw(true);
- // update after refresh since the content provider caches summary info
- updateStatusMessage();
- updateTitle();}
- });
-
-}
-void focusSelectionChanged(SelectionChangedEvent event) {
- updateFocusResource(event.getSelection());
-}
-
-/**
- * Returns a clipboard for cut/copy/paste actions.
- * <p>
- * May only be called after this part's viewer has been created.
- * The clipboard is disposed when this part is disposed.
- * </p>
- * @return a clipboard
- * @since 2.0
- */
-/*package*/ Clipboard getClipboard() {
- return clipboard;
-}
-
-/**
- * Returns the filter for the viewer.
- */
-TasksFilter getFilter() {
- return filter;
-}
-
-/**
- * Returns the UI plugin for the task list.
- */
-static AbstractUIPlugin getPlugin() {
- return (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
-}
-/**
- * Returns the resource for which the task list is showing tasks.
- *
- * @return the resource, possibly the workspace root
- */
-public IResource getResource() {
- if (showSelections()) {
- if (focusResources != null && focusResources.length >= 1 && focusResources[0] != null) {
- return focusResources[0];
- }
- }
-
- return getWorkspace().getRoot();
-}
-
-public IResource[] getResources() {
- if (showSelections()) {
- if (focusResources != null) {
- return focusResources;
- }
- }
-
- return new IResource[] { getWorkspace().getRoot() };
-}
-
-/**
- * Returns the resource depth which the task list is using to show tasks.
- *
- * @return an <code>IResource.DEPTH_*</code> constant
- */
-int getResourceDepth() {
- if (showSelections() && !showChildrenHierarchy())
- return IResource.DEPTH_ZERO;
- else
- return IResource.DEPTH_INFINITE;
-}
-/**
- * API method which returns the current selection.
- *
- * @return the current selection (element type: <code>IMarker</code>)
- */
-public ISelection getSelection() {
- return viewer.getSelection();
-}
-/**
- * Returns the message to display in the status line.
- */
-String getStatusMessage(IStructuredSelection selection) {
- if (selection.size() == 1) {
- IMarker marker = (IMarker) selection.getFirstElement();
- return MarkerUtil.getMessage(marker);
- }
- TaskListContentProvider provider = (TaskListContentProvider) viewer.getContentProvider();
- if (selection.size() > 1) {
- return provider.getStatusSummarySelected(selection);
- } else {
- return provider.getStatusSummaryVisible();
- }
-}
-/**
- * When created, new task instance is cached in
- * order to keep it at the top of the list until
- * first edited. This method returns it, or
- * null if there is no task instance pending
- * for first editing.
- */
-TableViewer getTableViewer() {
- return viewer;
-}
-/**
- * Returns the workspace.
- */
-IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
-}
-/**
- * Handles key events in viewer.
- */
-void handleKeyPressed(KeyEvent event) {
- if (event.character == SWT.DEL && event.stateMask == 0
- && removeTaskAction.isEnabled())
- removeTaskAction.run();
-}
-/* (non-Javadoc)
- * Method declared on IViewPart.
- */
-public void init(IViewSite site,IMemento memento) throws PartInitException {
- super.init(site,memento);
- this.memento = memento;
-}
-
-/**
- * Returns whether we are interested in the given marker delta.
- */
-boolean isAffectedBy(IMarkerDelta markerDelta) {
- return checkResource(markerDelta.getResource()) && getFilter().select(markerDelta);
-}
-
-/**
- * Returns whether we are interested in markers on the given resource.
- */
-boolean checkResource(IResource resource) {
- if (!showSelections()) {
- return true;
- }
-
- IResource[] resources = getResources();
- IResource resource2;
-
- if (showOwnerProject()) {
- IProject project;
-
- for (int i = 0, l = resources.length; i < l; i++) {
- resource2 = resources[i];
-
- if (resource2 == null) {
- return true;
- }
- else {
- project = resource2.getProject();
-
- if (project == null || project.equals(resource.getProject())) {
- return true;
- }
- }
- }
- }
- if (showChildrenHierarchy()) {
- for (int i = 0, l = resources.length; i < l; i++) {
- resource2 = resources[i];
-
- if (resource2 != null &&
- resource2.getFullPath().isPrefixOf(resource.getFullPath())) {
- return true;
- }
- }
- }
- else {
- for (int i = 0, l = resources.length; i < l; i++) {
- resource2 = resources[i];
-
- if (resource.equals(resource2)) {
- return true;
- }
- }
- }
-
- return false;
-}
-
-/**
- * Returns whether the given marker should be shown,
- * given the current filter settings.
- */
-boolean shouldShow(IMarker marker) {
- return checkResource(marker.getResource()) && getFilter().select(marker);
-}
-
-/**
- * Makes actions used in the local tool bar and
- * popup menu.
- */
-void makeActions() {
- // goto
- gotoTaskAction = new GotoTaskAction(this, "gotoFile"); //$NON-NLS-1$
- gotoTaskAction.setText(TaskListMessages.getString("GotoTask.text")); //$NON-NLS-1$
- gotoTaskAction.setToolTipText(TaskListMessages.getString("GotoTask.tooltip")); //$NON-NLS-1$
- gotoTaskAction.setHoverImageDescriptor(MarkerUtil.getImageDescriptor("gotoobj")); //$NON-NLS-1$
- gotoTaskAction.setImageDescriptor(MarkerUtil.getImageDescriptor("gotoobj_grey")); //$NON-NLS-1$
- gotoTaskAction.setEnabled(false);
-
- // new task
- newTaskAction = new NewTaskAction(this, "newTask"); //$NON-NLS-1$
- newTaskAction.setText(TaskListMessages.getString("NewTask.text")); //$NON-NLS-1$
- newTaskAction.setToolTipText(TaskListMessages.getString("NewTask.tooltip")); //$NON-NLS-1$
- newTaskAction.setHoverImageDescriptor(MarkerUtil.getImageDescriptor("addtsk")); //$NON-NLS-1$
- newTaskAction.setImageDescriptor(MarkerUtil.getImageDescriptor("addtsk_grey")); //$NON-NLS-1$
- newTaskAction.setDisabledImageDescriptor(MarkerUtil.getImageDescriptor("addtsk_disabled")); //$NON-NLS-1$
-
- // copy task
- copyTaskAction = new CopyTaskAction(this, "copy"); //$NON-NLS-1$
- copyTaskAction.setText(TaskListMessages.getString("CopyTask.text")); //$NON-NLS-1$
- copyTaskAction.setToolTipText(TaskListMessages.getString("CopyTask.tooltip")); //$NON-NLS-1$
- copyTaskAction.setHoverImageDescriptor(MarkerUtil.getImageDescriptor("copy")); //$NON-NLS-1$
- copyTaskAction.setEnabled(false);
-
- // paste task
- pasteTaskAction = new PasteTaskAction(this, "paste"); //$NON-NLS-1$
- pasteTaskAction.setText(TaskListMessages.getString("PasteTask.text")); //$NON-NLS-1$
- pasteTaskAction.setToolTipText(TaskListMessages.getString("PasteTask.tooltip")); //$NON-NLS-1$
- pasteTaskAction.setHoverImageDescriptor(MarkerUtil.getImageDescriptor("paste")); //$NON-NLS-1$
- pasteTaskAction.setEnabled(false);
-
- // remove task
- removeTaskAction = new RemoveTaskAction(this, "delete"); //$NON-NLS-1$
- removeTaskAction.setText(TaskListMessages.getString("RemoveTask.text")); //$NON-NLS-1$
- removeTaskAction.setToolTipText(TaskListMessages.getString("RemoveTask.tooltip")); //$NON-NLS-1$
- removeTaskAction.setHoverImageDescriptor(MarkerUtil.getImageDescriptor("remtsk")); //$NON-NLS-1$
- removeTaskAction.setImageDescriptor(MarkerUtil.getImageDescriptor("remtsk_grey")); //$NON-NLS-1$
- removeTaskAction.setDisabledImageDescriptor(MarkerUtil.getImageDescriptor("remtsk_disabled")); //$NON-NLS-1$
- removeTaskAction.setEnabled(false);
-
- //mark completed task
- markCompletedAction = new MarkCompletedAction(this,"markCompleted"); //$NON-NLS-1$
- markCompletedAction.setText(TaskListMessages.getString("MarkCompleted.text")); //$NON-NLS-1$
- markCompletedAction.setToolTipText(TaskListMessages.getString("MarkCompleted.tooltip")); //$NON-NLS-1$
- markCompletedAction.setEnabled(false);
-
- //delete completed task
- purgeCompletedAction = new PurgeCompletedAction(this, "deleteCompleted"); //$NON-NLS-1$
- purgeCompletedAction.setText(TaskListMessages.getString("PurgeCompleted.text")); //$NON-NLS-1$
- purgeCompletedAction.setToolTipText(TaskListMessages.getString("PurgeCompleted.tooltip")); //$NON-NLS-1$
- purgeCompletedAction.setImageDescriptor(MarkerUtil.getImageDescriptor("delete_edit")); //$NON-NLS-1$
- purgeCompletedAction.setEnabled(true);
-
- // select all
- selectAllAction = new SelectAllTasksAction(this, "selectAll"); //$NON-NLS-1$
- selectAllAction.setText(TaskListMessages.getString("SelectAll.text")); //$NON-NLS-1$
- selectAllAction.setToolTipText(TaskListMessages.getString("SelectAll.tooltip")); //$NON-NLS-1$
-
- // resolutions
- resolveMarkerAction = new ResolveMarkerAction(this, "resolve"); //$NON-NLS-1$
- resolveMarkerAction.setText(TaskListMessages.getString("Resolve.text")); //$NON-NLS-1$
- resolveMarkerAction.setToolTipText(TaskListMessages.getString("Resolve.tooltip")); //$NON-NLS-1$
-
- // filters...
- filtersAction = new FiltersAction(this, "filter"); //$NON-NLS-1$
- filtersAction.setText(TaskListMessages.getString("Filters.text")); //$NON-NLS-1$
- filtersAction.setToolTipText(TaskListMessages.getString("Filters.tooltip")); //$NON-NLS-1$
- filtersAction.setImageDescriptor(MarkerUtil.getImageDescriptor("filter")); //$NON-NLS-1$
-
- // properties
- propertiesAction = new TaskPropertiesAction(this, "properties"); //$NON-NLS-1$
- propertiesAction.setText(TaskListMessages.getString("Properties.text")); //$NON-NLS-1$
- propertiesAction.setToolTipText(TaskListMessages.getString("Properties.tooltip")); //$NON-NLS-1$
- propertiesAction.setEnabled(false);
-}
-/**
- * The markers have changed. Update the status line and title bar.
- */
-void markersChanged() {
- updateStatusMessage();
- updateTitle();
-}
-void partActivated(IWorkbenchPart part) {
- if (part == focusPart)
- return;
-
- if (focusSelectionProvider != null) {
- focusSelectionProvider.removeSelectionChangedListener(focusSelectionChangedListener);
- focusSelectionProvider = null;
- }
-
- focusPart = part;
- if (focusPart != null) {
- focusSelectionProvider = focusPart.getSite().getSelectionProvider();
- if (focusSelectionProvider != null) {
- focusSelectionProvider.addSelectionChangedListener(focusSelectionChangedListener);
- updateFocusResource(focusSelectionProvider.getSelection());
- }
- else {
- updateFocusResource(null);
- }
- }
-
-}
-void partClosed(IWorkbenchPart part) {
- if (part != focusPart)
- return;
- if (focusSelectionProvider != null) {
- focusSelectionProvider.removeSelectionChangedListener(focusSelectionChangedListener);
- focusSelectionProvider = null;
- }
- focusPart = null;
-}
-/**
- * The user is attempting to drag marker data. Add the appropriate
- * data to the event depending on the transfer type.
- */
-void performDragSetData(DragSourceEvent event) {
- if (MarkerTransfer.getInstance().isSupportedType(event.dataType)) {
- event.data = ((IStructuredSelection) viewer.getSelection()).toArray();
- return;
- }
- if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
- Object[] data = ((IStructuredSelection) viewer.getSelection()).toArray();
- if (data != null) {
- IMarker[] markers = new IMarker[data.length];
- for (int i = 0; i < markers.length; i++) {
- markers[i] = (IMarker)data[i];
- }
- event.data = createMarkerReport(markers);
- }
- return;
- }
-}
-void restoreState(IMemento memento) {
- //restore selection
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IMemento selectionMem = memento.getChild(TAG_SELECTION);
- if(selectionMem != null) {
- ArrayList selectionList = new ArrayList();
- IMemento markerMems[] = selectionMem.getChildren(TAG_MARKER);
- for (int i = 0; i < markerMems.length; i++){
- try {
- long id = Long.parseLong(markerMems[i].getString(TAG_ID));
- IResource resource = root.findMember(markerMems[i].getString(TAG_RESOURCE));
- if(resource != null) {
- IMarker marker = resource.findMarker(id);
- if (marker != null) {
- selectionList.add(marker);
- }
- }
- } catch (NumberFormatException e) {
- } catch (CoreException e) {
- }
-
- }
- viewer.setSelection(new StructuredSelection(selectionList));
- }
-
- Table table = viewer.getTable();
- //restore vertical position
- try {
- String topIndexStr = memento.getString(TAG_TOP_INDEX);
- table.setTopIndex(Integer.parseInt(topIndexStr));
- } catch (NumberFormatException e) {}
-}
-/* (non-Javadoc)
- * Method declared on IViewPart.
- */
-public void saveState(IMemento memento) {
- if(viewer == null) {
- if(this.memento != null) //Keep the old state;
- memento.putMemento(this.memento);
- return;
- }
-
- //save filter
- getFilter().saveState(memento.createChild(TAG_FILTER));
-
- //save sorter
- TaskSorter sorter = (TaskSorter) viewer.getSorter();
- memento.putInteger(TAG_SORTER_COLUMN,sorter.getColumnNumber());
- memento.putInteger(TAG_SORTER_REVERSED,sorter.isReversed()?1:0);
-
- //save columns width
- Table table = viewer.getTable();
- TableColumn columns[] = table.getColumns();
- //check whether it has ever been layed out
- //workaround for 1GDTU19: ITPUI:WIN2000 - Task list columns "collapsed" left
- boolean shouldSave = false;
- for (int i = 0; i < columns.length; i++) {
- if (columnLayouts[i].resizable && columns[i].getWidth() != 0) {
- shouldSave = true;
- break;
- }
- }
- if (shouldSave) {
- for (int i = 0; i < columns.length; i++) {
- if (columnLayouts[i].resizable) {
- IMemento child = memento.createChild(TAG_COLUMN);
- child.putInteger(TAG_NUMBER,i);
- child.putInteger(TAG_WIDTH,columns[i].getWidth());
- }
- }
- }
-
- //save selection
- Object markers[] = ((IStructuredSelection)viewer.getSelection()).toArray();
- if(markers.length > 0) {
- IMemento selectionMem = memento.createChild(TAG_SELECTION);
- for (int i = 0; i < markers.length; i++) {
- IMemento elementMem = selectionMem.createChild(TAG_MARKER);
- IMarker marker = (IMarker)markers[i];
- elementMem.putString(TAG_RESOURCE,marker.getResource().getFullPath().toString());
- elementMem.putString(TAG_ID,String.valueOf(marker.getId()));
- }
- }
-
- //save vertical position
- int topIndex = table.getTopIndex();
- memento.putString(TAG_TOP_INDEX,String.valueOf(topIndex));
-}
-/**
- * Handles marker selection change in the task list by updating availability of
- * the actions in the local tool bar.
- */
-void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- updateStatusMessage(selection);
- updateTitle();
-
- updatePasteEnablement();
-
- // If selection is empty, then disable copy, remove and goto.
- if (selection.isEmpty()) {
- copyTaskAction.setEnabled(false);
- removeTaskAction.setEnabled(false);
- gotoTaskAction.setEnabled(false);
- propertiesAction.setEnabled(false);
- return;
- };
-
- // Can only open properties for a single task at a time
- propertiesAction.setEnabled(selection.size() == 1);
-
- // Can always copy
- copyTaskAction.setEnabled(true);
-
- // Determine if goto should be enabled
- IMarker selectedMarker = (IMarker) selection.getFirstElement();
- boolean canJump = selection.size() == 1 && selectedMarker.getResource().getType() == IResource.FILE;
- gotoTaskAction.setEnabled(canJump);
-
- // Determine if remove should be enabled
- boolean canRemove = true;
- for (Iterator markers = selection.iterator(); markers.hasNext();) {
- IMarker m = (IMarker) markers.next();
- if (!MarkerUtil.isMarkerType(m, IMarker.TASK)) {
- canRemove = false;
- break;
- }
- }
- removeTaskAction.setEnabled(canRemove);
-
- // if there is an active editor on the selection's input, tell
- // the editor to goto the marker
- if (canJump) {
- IEditorPart editor = getSite().getPage().getActiveEditor();
- if (editor != null) {
- IEditorInput input = editor.getEditorInput();
- if (input instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput)input).getFile();
- if (selectedMarker.getResource().equals(file))
- editor.gotoMarker(selectedMarker);
- }
- }
- }
-}
-
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
-public void setFocus() {
- viewer.getControl().setFocus();
-}
-
-/**
- * Sets the property on a marker to the given value.
- *
- * @exception CoreException if an error occurs setting the value
- */
-void setProperty(IMarker marker, String property, Object value) {
- if (MarkerUtil.getProperty(marker, property).equals(value)) {
- return;
- }
- try {
- if (property == tableColumnProperties[1]) { // Completed
- marker.setAttribute(IMarker.DONE, value);
- } else if (property == tableColumnProperties[2]) { // Priority
- // this property is used only by cell editor, where order is High, Normal, Low
- marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH - ((Integer) value).intValue());
- } else if (property == tableColumnProperties[3]) { // Description
- marker.setAttribute(IMarker.MESSAGE, value);
- // Let's not refilter too lightly - see if it is needed
-// TaskSorter sorter = (TaskSorter) viewer.getSorter();
-// if (sorter != null && sorter.getColumnNumber() == 3) {
-// viewer.refresh();
-// }
- }
- }
- catch (CoreException e) {
- String msg = TaskListMessages.getString("TaskList.errorModifyingTask"); //$NON-NLS-1$
- ErrorDialog.openError(getSite().getShell(), msg, null, e.getStatus());
- }
-}
-/**
- * API method which sets the current selection of this viewer.
- *
- * @param selection a structured selection of <code>IMarker</code> objects
- * @param reveal <code>true</code> to reveal the selection, <false> otherwise
- */
-public void setSelection(ISelection selection, boolean reveal) {
- Assert.isTrue(selection instanceof IStructuredSelection);
- IStructuredSelection ssel = (IStructuredSelection) selection;
- for (Iterator i = ssel.iterator(); i.hasNext();)
- Assert.isTrue(i.next() instanceof IMarker);
- viewer.setSelection(selection, reveal);
-}
-boolean showChildrenHierarchy() {
- switch (getFilter().onResource) {
- case TasksFilter.ON_ANY_RESOURCE:
- case TasksFilter.ON_SELECTED_RESOURCE_AND_CHILDREN:
- case TasksFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT: // added by cagatayk@acm.org
- case TasksFilter.ON_WORKING_SET:
- default:
- return true;
- case TasksFilter.ON_SELECTED_RESOURCE_ONLY:
- return false;
- }
-}
-boolean showSelections() {
- switch (getFilter().onResource) {
- case TasksFilter.ON_SELECTED_RESOURCE_ONLY:
- case TasksFilter.ON_SELECTED_RESOURCE_AND_CHILDREN:
- case TasksFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT: // added by cagatayk@acm.org
- return true;
- case TasksFilter.ON_ANY_RESOURCE:
- case TasksFilter.ON_WORKING_SET:
- default:
- return false;
- }
-}
-
-// showOwnerProject() added by cagatayk@acm.org
-boolean showOwnerProject() {
- return getFilter().onResource == TasksFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT;
-}
-/**
- * Processes state change of the 'showSelections' switch.
- * If true, it will resync with the saved input element.
- * Otherwise, it will reconfigure to show all the
- * problems/tasks in the workbench.
- */
-void toggleInputSelection(boolean value) {
- /*
- if (value) {
- handleInput(inputSelection, false);
- } else {
- // detach from input and link to the workbench object
- handleInput(WorkbenchPlugin.getPluginWorkbench(), true);
- }
- updateTitle();
- */
-}
-/**
- * If true, current input will be
- * remembered and further selections will be
- * ignored.
- */
-void toggleLockInput(boolean value) {
- /*
- if (!value) {
- handleInput(inputSelection, false);
- lockedInput = null;
- } else {
- lockedInput = (IElement) getInput();
- }
- String lockedInputPath = "";
- if (lockedInput != null && lockedInput instanceof IResource) {
- IResource resource = (IResource) lockedInput;
- lockedInputPath = resource.getFullPath().toString();
- }
- IDialogStore store = WorkbenchPlugin.getDefault().getDialogStore();
- store.put(STORE_LOCKED_INPUT, lockedInputPath);
- updateTitle();
- */
-}
-/**
- * Updates the focus resource, and refreshes if we're showing only tasks for the focus resource.
- */
-void updateFocusResource(ISelection selection) {
- java.util.List list = new ArrayList();
-
- if (selection instanceof IStructuredSelection) {
- Iterator iterator = ((IStructuredSelection) selection).iterator();
- Object object;
- Object adapter;
- ITaskListResourceAdapter taskListResourceAdapter;
-
- if (iterator != null) {
- while (iterator.hasNext()) {
- object = iterator.next();
-
- if (object instanceof IAdaptable) {
- adapter = ((IAdaptable) object).getAdapter(ITaskListResourceAdapter.class);
-
- if (adapter != null) {
- taskListResourceAdapter = (ITaskListResourceAdapter) adapter;
- }
- else {
- taskListResourceAdapter = DefaultTaskListResourceAdapter.getDefault();
- }
-
- list.add(taskListResourceAdapter.getAffectedResource((IAdaptable) object));
- }
- }
- }
- }
-
- if (list.size() == 0 && focusPart instanceof IEditorPart) {
- IEditorInput input = ((IEditorPart) focusPart).getEditorInput();
-
- if (input != null) {
- if (input instanceof IFileEditorInput) {
- list.add(((IFileEditorInput) input).getFile());
- }
- else {
- IResource resource = (IResource) input.getAdapter(IResource.class);
-
- if (resource == null) {
- resource = (IFile) input.getAdapter(IFile.class);
- }
-
- list.add(resource);
- }
- }
- }
-
- IResource[] resources = (IResource[]) list.toArray(new IResource[list.size()]);
-
- if (resources.length < 1) {
- return; // required to achieve lazy update behavior.
- }
-
- if (!java.util.Arrays.equals(resources, focusResources)) {
- boolean updateNeeded = false;
-
- if (resources == null || focusResources == null) {
- updateNeeded = true;
- }
- else if (showOwnerProject()) {
- int l = resources.length;
-
- if (l != focusResources.length) {
- updateNeeded = true;
- }
- else {
- IProject oldProject;
- IProject newProject;
- boolean projectsEqual;
-
- for (int i = 0; i < l; i++) {
- oldProject = focusResources[0] == null ? null : focusResources[0].getProject();
- newProject = resources[0] == null ? null : resources[0].getProject();
- projectsEqual = (oldProject == null ? newProject == null : oldProject.equals(newProject));
-
- if (!projectsEqual) {
- updateNeeded = true;
- break;
- }
- }
- }
- }
- else if (showSelections()) {
- updateNeeded = true;
- }
-
- // remember the focus resource even if update is not needed,
- // so that we know it if the filter settings change
- focusResources = resources;
-
- if (updateNeeded) {
- viewer.getControl().setRedraw(false);
- viewer.refresh();
- viewer.getControl().setRedraw(true);
- updateStatusMessage();
- updateTitle();
- }
- }
-}
-/**
- * Updates the enablement of the paste action
- */
-void updatePasteEnablement() {
- // Paste if clipboard contains tasks
- MarkerTransfer transfer = MarkerTransfer.getInstance();
- IMarker[] markerData = (IMarker[])getClipboard().getContents(transfer);
- boolean canPaste = false;
- if (markerData != null) {
- for (int i = 0; i < markerData.length; i++) {
- if (MarkerUtil.isMarkerType(markerData[i], IMarker.TASK)) {
- canPaste = true;
- break;
- }
- }
- }
- pasteTaskAction.setEnabled(canPaste);
-}
-
-/**
- * Updates that message displayed in the status line.
- */
-void updateStatusMessage() {
- updateStatusMessage((IStructuredSelection) viewer.getSelection());
-}
-/**
- * Updates that message displayed in the status line.
- */
-void updateStatusMessage(IStructuredSelection selection) {
- String message = getStatusMessage(selection);
- getViewSite().getActionBars().getStatusLineManager().setMessage(message);
-}
-/**
- * Updates the title of the view. Should be called when filters change.
- */
-void updateTitle() {
- String viewName = getConfigurationElement().getAttribute("name"); //$NON-NLS-1$
- TaskListContentProvider provider = (TaskListContentProvider) getTableViewer().getContentProvider();
- String summary = provider.getTitleSummary();
- if ("".equals(summary)) { //$NON-NLS-1$
- setTitle(viewName);
- }
- else {
- String title = TaskListMessages.format("TaskList.title", new Object[] { viewName, summary }); //$NON-NLS-1$
- setTitle(title);
- }
-}
-/**
- * Writes a string representation of the given marker to the buffer.
- */
-static void writeMarker(StringBuffer buf, IMarker marker) {
- buf.append(MarkerUtil.getKindText(marker));
- buf.append("\t"); //$NON-NLS-1$
- buf.append(MarkerUtil.getCompleteText(marker));
- buf.append("\t"); //$NON-NLS-1$
- buf.append(MarkerUtil.getPriorityText(marker));
- buf.append("\t"); //$NON-NLS-1$
- buf.append(MarkerUtil.getMessage(marker));
- buf.append("\t"); //$NON-NLS-1$
- buf.append(MarkerUtil.getResourceName(marker));
- buf.append("\t"); //$NON-NLS-1$
- buf.append(MarkerUtil.getContainerName(marker));
- buf.append("\t"); //$NON-NLS-1$
- buf.append(MarkerUtil.getLineAndLocation(marker));
- buf.append(System.getProperty("line.separator")); //$NON-NLS-1$
-
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskListContentProvider.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskListContentProvider.java
deleted file mode 100644
index a3a23d4..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskListContentProvider.java
+++ /dev/null
@@ -1,543 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Cagatay Kavukcuoglu <cagatayk@acm.org> - Filter for markers in same project
-**********************************************************************/
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.widgets.Control;
-
-import org.eclipse.jface.viewers.*;
-
-/**
- * Task list content provider returns elements that should be
- * in the task list depending on the selection mode.
- * It goes directly to the marker manager and retreives
- * tasks and problems.
- */
-class TaskListContentProvider implements IStructuredContentProvider,
- IResourceChangeListener {
-
- private static final int TASKS = 0;
- private static final int ERRORS = 1;
- private static final int WARNINGS = 2;
- private static final int INFOS = 3;
-
- private TaskList taskList;
- private TableViewer viewer;
- private IResource input;
-
- /* cached counts of tasks, errors, warnings and infos for the visible
- * markers, maintained incrementally */
- private int[] visibleMarkerCounts = null;
-
- /* cached count of all markers in workspace matching supported root types
- * (tasks & problems), maintained incrementally */
- private int totalMarkerCount = -1;
-
- /**
- * The constructor.
- */
- public TaskListContentProvider(TaskList taskList) {
- this.taskList = taskList;
- this.viewer = taskList.getTableViewer();
- }
-
- private boolean getFilterOnMarkerLimit() {
- return taskList.getFilter().getFilterOnMarkerLimit();
- }
-
- private int getMarkerLimit() {
- return taskList.getFilter().getMarkerLimit();
- }
-
- private boolean isMarkerLimitExceeded() {
- return taskList.isMarkerLimitExceeded();
- }
-
- private void setMarkerLimitExceeded(boolean markerLimitExceeded) {
- taskList.setMarkerLimitExceeded(markerLimitExceeded);
-
- viewer.getControl().getDisplay().syncExec(new Runnable() {
- public void run() {
- viewer.refresh();
- }
- });
- }
-
- /**
- * Returns a one-line string containing a summary of the number
- * of visible tasks and problems.
- */
- public String getStatusSummaryVisible() {
- if (visibleMarkerCounts == null) {
- return ""; //$NON-NLS-1$
- }
-
- return TaskListMessages.format(
- "TaskList.statusSummaryVisible", //$NON-NLS-1$
- new Object[] {
- new Integer(sum(visibleMarkerCounts)),
- getStatusSummaryBreakdown(visibleMarkerCounts)});
- }
-
- /**
- * Returns a one-line string containing a summary of the number
- * of selected tasks and problems.
- *
- * @param selection the current selection
- */
- public String getStatusSummarySelected(IStructuredSelection selection) {
- int[] selectedMarkerCounts = getMarkerCounts(selection.toList());
- return TaskListMessages.format(
- "TaskList.statusSummarySelected", //$NON-NLS-1$
- new Object[] {
- new Integer(sum(selectedMarkerCounts)),
- getStatusSummaryBreakdown(selectedMarkerCounts)});
- }
-
- /**
- * Returns a one-line string containing a summary of the number of
- * given tasks, errors, warnings, and infos.
- */
- private String getStatusSummaryBreakdown(int[] counts) {
- return TaskListMessages.format(
- "TaskList.statusSummaryBreakdown", //$NON-NLS-1$
- new Object[] {
- new Integer(counts[TASKS]),
- new Integer(counts[ERRORS]),
- new Integer(counts[WARNINGS]),
- new Integer(counts[INFOS])});
- }
-
- /**
- * Returns a one-line string containing a summary of the number items
- * being shown by the filter, for display in the title bar.
- */
- public String getTitleSummary() {
- if (visibleMarkerCounts == null) {
- return ""; //$NON-NLS-1$
- }
-
- int visibleMarkerCount = sum(visibleMarkerCounts);
- TasksFilter filter = (TasksFilter) taskList.getFilter();
-
- if (filter.isShowingAll()) {
- return TaskListMessages.format(
- "TaskList.titleSummaryUnfiltered", //$NON-NLS-1$
- new Object[] { new Integer(visibleMarkerCount)});
- }
- else {
- return TaskListMessages.format(
- "TaskList.titleSummaryFiltered", //$NON-NLS-1$
- new Object[] {
- new Integer(visibleMarkerCount),
- new Integer(getTotalMarkerCount())});
- }
- }
-
- /**
- * Returns the sum of the given counts.
- */
- private int sum(int[] counts) {
- int sum = 0;
-
- for (int i = 0, l = counts.length; i < l; ++i) {
- sum += counts[i];
- }
-
- return sum;
- }
-
- /**
- * Returns the count of all markers in the workspace which can be shown in
- * the task list. This is computed once, then maintained incrementally by
- * the delta processing.
- */
- private int getTotalMarkerCount() {
- if (totalMarkerCount == -1) {
- totalMarkerCount = 0;
-
- try {
- IResource root = taskList.getWorkspace().getRoot();
- IMarker[] markers = root.findMarkers(null, true,
- IResource.DEPTH_INFINITE);
-
- for (int i = 0; i < markers.length; ++i) {
- if (isRootType(markers[i])) {
- ++totalMarkerCount;
- }
- }
- } catch (CoreException e) {
- // shouldn't happen
- }
- }
-
- return totalMarkerCount;
- }
-
- /**
- * Returns whether the given marker is a subtype of one of the root types.
- */
- private boolean isRootType(IMarker marker) {
- String[] rootTypes = TasksFilter.ROOT_TYPES;
-
- for (int i = 0, l = rootTypes.length; i < l; ++i) {
- if (MarkerUtil.isMarkerType(marker, rootTypes[i])) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Returns the markers to show in the task list.
- */
- private IMarker[] getMarkers() throws CoreException {
- IResource[] resources = taskList.getResources();
- int l = resources.length;
- IResource resource;
- boolean bExists = false;
-
- for (int i = 0; i < l; i++) {
- resource = resources[i];
-
- if (resource != null && resource.exists()) {
- bExists = true;
- break;
- }
- }
-
-
- if (!bExists) {
- return new IMarker[0];
- }
-
- if (taskList.showOwnerProject()) {
- IResource[] projectResources = new IResource[l];
- IResource project;
-
- for (int i = 0; i < l; i++) {
- resource = resources[i];
-
- if (resource != null) {
- project = resource.getProject();
-
- if (project != null) {
- projectResources[i] = project;
- }
- else {
- projectResources[i] = resource;
- }
- }
- }
-
- resources = projectResources;
- }
-
- int depth = taskList.getResourceDepth();
- TasksFilter filter = taskList.getFilter();
- Set set = new HashSet();
-
- for (int i = 0; i < l; i++) {
- resource = resources[i];
-
- if (resource != null) {
- IMarker[] markers = resource.findMarkers(null, true, depth);
-
- for (int j = 0; j < markers.length; ++j) {
- IMarker marker = markers[j];
-
- if (filter.select(marker)) {
- set.add(marker);
- }
- }
- }
- }
-
- IMarker[] result = new IMarker[set.size()];
- set.toArray(result);
- return result;
- }
-
- /**
- * Returns the number of tasks, errors, warnings, infos
- * in the given markers.
- */
- private int[] getMarkerCounts(List markers) {
- int[] markerCounts = new int[4];
- Iterator iterator = markers.iterator();
-
- while (iterator.hasNext()) {
- IMarker marker = (IMarker) iterator.next();
-
- if (MarkerUtil.isMarkerType(marker, IMarker.PROBLEM)) {
- switch (MarkerUtil.getSeverity(marker)) {
- case IMarker.SEVERITY_ERROR:
- ++markerCounts[ERRORS];
- break;
- case IMarker.SEVERITY_WARNING:
- ++markerCounts[WARNINGS];
- break;
- case IMarker.SEVERITY_INFO:
- ++markerCounts[INFOS];
- break;
- }
- }
- else if (MarkerUtil.isMarkerType(marker, IMarker.TASK)) {
- ++markerCounts[TASKS];
- }
- }
-
- return markerCounts;
- }
-
- /**
- * Updates the marker counts for the given delta.
- * Assumptions:
- * - the delta is either an addition or a removal
- * - problem severities don't change
- */
- private void updateMarkerCounts(IMarkerDelta markerDelta, int diff) {
- if (visibleMarkerCounts == null) {
- return;
- }
-
- if (markerDelta.isSubtypeOf(IMarker.PROBLEM)) {
- int severity = markerDelta.getAttribute(IMarker.SEVERITY,
- IMarker.SEVERITY_WARNING);
-
- switch (severity) {
- case IMarker.SEVERITY_ERROR:
- visibleMarkerCounts[ERRORS] += diff;
- break;
- case IMarker.SEVERITY_WARNING:
- visibleMarkerCounts[WARNINGS] += diff;
- break;
- case IMarker.SEVERITY_INFO:
- visibleMarkerCounts[INFOS] += diff;
- break;
- }
- }
- else if (markerDelta.isSubtypeOf(IMarker.TASK)) {
- visibleMarkerCounts[TASKS] += diff;
- }
- }
-
- /**
- * Updates the viewer given the lists of added, removed, and changes
- * markers. This is called inside an syncExec.
- */
- private void updateViewer(List additions, List removals, List changes) {
-
- // The widget may have been destroyed by the time this is run.
- // Check for this and do nothing if so.
- Control ctrl = viewer.getControl();
-
- if (ctrl == null || ctrl.isDisposed()) {
- return;
- }
-
- //update the viewer based on the marker changes.
- //process removals before additions, to avoid multiple equal elements in
- //the viewer
- if (removals.size() > 0) {
-
- // Cancel any open cell editor. We assume that the one being edited
- // is the one being removed.
- viewer.cancelEditing();
- viewer.remove(removals.toArray());
- }
-
- if (additions.size() > 0) {
- viewer.add(additions.toArray());
- }
-
- if (changes.size() > 0) {
- viewer.update(changes.toArray(), null);
- }
- }
-
- /**
- * The visual part that is using this content provider is about
- * to be disposed. Deallocate all allocated SWT resources.
- */
- public void dispose() {
- if (input != null) {
- input.getWorkspace().removeResourceChangeListener(this);
- input = null;
- }
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (this.input != null) {
- this.input.getWorkspace().removeResourceChangeListener(this);
- }
-
- this.input = (IResource) newInput;
-
- if (this.input != null) {
- this.input.getWorkspace().addResourceChangeListener(this,
- IResourceChangeEvent.POST_CHANGE);
- }
-
- this.viewer = (TableViewer) viewer;
- }
-
- /**
- * Returns all the markers that should be shown for
- * the current settings.
- */
- public Object[] getElements(Object parent) {
- try {
- IMarker[] markers = getMarkers();
- this.visibleMarkerCounts = getMarkerCounts(Arrays.asList(markers));
-
- if (getFilterOnMarkerLimit() && markers.length > getMarkerLimit()) {
- if (!isMarkerLimitExceeded()) {
- setMarkerLimitExceeded(true);
- }
-
- return new IMarker[0];
- }
- else {
- if (isMarkerLimitExceeded()) {
- setMarkerLimitExceeded(false);
- }
-
- return markers;
- }
- } catch (CoreException e) {
- return new IMarker[0];
- }
- }
-
- /**
- * The workbench has changed. Process the delta and issue updates to the
- * viewer, inside the UI thread.
- *
- * @see IResourceChangeListener#resourceChanged
- */
- public void resourceChanged(final IResourceChangeEvent event) {
-
- /*
- * gather all marker changes from the delta. be sure to do this in the
- * calling thread, as the delta is destroyed when this method returns
- */
- IMarkerDelta[] markerDeltas = event.findMarkerDeltas(null, true);
- int oldTotal = totalMarkerCount;
- final List additions = new ArrayList();
- final List removals = new ArrayList();
- final List changes = new ArrayList();
-
- for (int i = 0; i < markerDeltas.length; i++) {
- IMarkerDelta markerDelta = markerDeltas[i];
- int iKind = markerDelta.getKind();
-
- for (int j = 0; j < TasksFilter.ROOT_TYPES.length; ++j) {
- if (markerDelta.isSubtypeOf(TasksFilter.ROOT_TYPES[j])) {
-
- /*
- * Updates the total count of markers given the applicable
- * marker deltas.
- */
- if (totalMarkerCount != -1) {
- switch (iKind) {
- case IResourceDelta.ADDED:
- ++totalMarkerCount;
- break;
- case IResourceDelta.REMOVED:
- --totalMarkerCount;
- break;
- }
- }
-
- /*
- * Partition the marker deltas into one of the three given
- * lists depending on
- * the type of delta (add, remove, or change).
- * The resulting lists contain the corresponding markers,
- * not the deltas.
- * Deltas which are not under the current focus resource are
- * discarded.
- * This also updates the marker counts.
- */
- if (taskList.isAffectedBy(markerDelta)) {
- IMarker marker = markerDelta.getMarker();
-
- switch (iKind) {
- case IResourceDelta.ADDED:
- additions.add(marker);
- updateMarkerCounts(markerDelta, +1);
- break;
- case IResourceDelta.REMOVED:
- removals.add(marker);
- updateMarkerCounts(markerDelta, -1);
- break;
- case IResourceDelta.CHANGED:
- changes.add(marker);
-
- /*
- * Assume attribute changes don't affect marker
- * counts. This is only true if problem severities
- * can't change.
- * */
- break;
- }
- }
-
- break;
- }
- }
- }
-
- if (oldTotal == totalMarkerCount && additions.size() + removals.size()
- + changes.size() == 0) {
- // no changes to markers that we care about
- return;
- }
-
- /*
- * do the required viewer updates in the UI thread need to use syncExec;
- * see 1G95PU8: ITPUI:WIN2000 - Changing task description flashes old
- * description
- */
- viewer.getControl().getDisplay().syncExec(new Runnable() {
- public void run() {
-
- if (getFilterOnMarkerLimit() && sum(visibleMarkerCounts) > getMarkerLimit()) {
- if (!isMarkerLimitExceeded()) {
- setMarkerLimitExceeded(true);
- }
- }
- else if (taskList.isMarkerLimitExceeded()) {
- setMarkerLimitExceeded(false);
- }
- else {
- updateViewer(additions, removals, changes);
- }
-
- /* Update the task list's status message.
- * XXX: Quick and dirty solution here.
- * Would be better to have a separate model for the tasks and
- * have both the content provider and the task list register for
- * updates. XXX: Do this inside the syncExec, since we're
- * talking to status line widget.
- */
- taskList.markersChanged();
- }
- });
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskListMessages.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskListMessages.java
deleted file mode 100644
index 8e0276c..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskListMessages.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps manage messages.
- */
-class TaskListMessages {
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.views.tasklist.messages";//$NON-NLS-1$
- private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
-private TaskListMessages(){
- // prevent instantiation of class
-}
-/**
- * Returns the formatted message for the given key in
- * the resource bundle.
- *
- * @param key the resource name
- * @param args the message arguments
- * @return the string
- */
-public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key),args);
-}
-/**
- * Returns the resource object with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the key is returned.
- *
- * @param key the resource name
- * @return the string
- */
-public static String getString(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskPropertiesAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskPropertiesAction.java
deleted file mode 100644
index 232e4bb..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskPropertiesAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This action opens the properties dialog for the current task.
- */
-/* package */ class TaskPropertiesAction extends TaskAction {
-
-/**
- * Creates the action.
- */
-public TaskPropertiesAction(TaskList tasklist, String id) {
- super(tasklist, id);
- WorkbenchHelp.setHelp(this, ITaskListHelpContextIds.TASK_PROPERTIES_ACTION);
-}
-
-/**
- * Performs this action.
- */
-public void run() {
- IStructuredSelection sel = (IStructuredSelection) getTaskList().getSelection();
- Object o = sel.getFirstElement();
- if (o instanceof IMarker) {
- TaskPropertiesDialog dialog = new TaskPropertiesDialog(getShell());
- dialog.setMarker((IMarker) o);
- dialog.open();
- }
-}
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskPropertiesDialog.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskPropertiesDialog.java
deleted file mode 100644
index 217f63a..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskPropertiesDialog.java
+++ /dev/null
@@ -1,501 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog; // disambiguate
-
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Shows the properties of a new or existing task, or a problem.
- */
-public class TaskPropertiesDialog extends Dialog {
-
- /**
- * The task or problem being shown, or <code>null</code> for a new task.
- */
- private IMarker marker = null;
-
- /**
- * The resource on which to create a new task.
- */
- private IResource resource = null;
-
- /**
- * The initial attributes to use when creating a new task.
- */
- private Map initialAttributes = null;
-
- /**
- * The text control for the Description field.
- */
- private Text descriptionText;
-
- /**
- * The combo box control for the Priority field.
- */
- private Combo priorityCombo;
-
- /**
- * The checkbox button for the Completed field.
- */
- private Button completedCheckbox;
-
- /**
- * The control for the Severity field.
- */
-// private Combo severityCombo;
- private Label severityLabel;
-
- /**
- * The text control for the Resource field.
- */
- private Text resourceText;
-
- /**
- * The text control for the Folder field.
- */
- private Text folderText;
-
- /**
- * The text control for the Location field.
- */
- private Text locationText;
-
- /**
- * Dirty flag. True if any changes have been made.
- */
- private boolean dirty;
-
-/**
- * Creates the dialog. By default this dialog creates a new task.
- * To set the resource and initial attributes for the new task,
- * use <code>setResource</code> and <code>setInitialAttributes</code>.
- * To show or modify an existing task, use <code>setMarker</code>.
- *
- * @param shell the parent shell
- */
-public TaskPropertiesDialog(Shell parentShell) {
- super(parentShell);
-}
-
-/**
- * Sets the marker to show or modify.
- *
- * @param marker the marker, or <code>null</code> to create a new marker
- */
-public void setMarker(IMarker marker) {
- this.marker = marker;
-}
-
-/**
- * Returns the marker being created or modified.
- * For a new marker, this returns <code>null</code> until
- * the dialog returns, but is non-null after.
- */
-public IMarker getMarker() {
- return marker;
-}
-
-/**
- * Sets the resource to use when creating a new task.
- * If not set, the new task is created on the workspace root.
- */
-public void setResource(IResource resource) {
- this.resource = resource;
-}
-
-/**
- * Returns the resource to use when creating a new task,
- * or <code>null</code> if none has been set.
- * If not set, the new task is created on the workspace root.
- */
-public IResource getResource() {
- return resource;
-}
-
-/**
- * Sets initial attributes to use when creating a new task.
- * If not set, the new task is created with default attributes.
- */
-public void setInitialAttributes(Map initialAttributes) {
- this.initialAttributes = initialAttributes;
-}
-
-/**
- * Returns the initial attributes to use when creating a new task,
- * or <code>null</code> if not set.
- * If not set, the new task is created with default attributes.
- */
-public Map getInitialAttributes() {
- return initialAttributes;
-}
-
-/* (non-Javadoc)
- * Method declared on Window.
- */
-protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
-
- if (marker == null) {
- newShell.setText(TaskListMessages.getString("TaskProp.newTaskTitle")); //$NON-NLS-1$
- }
- else {
- String kind = MarkerUtil.getKindText(marker);
- newShell.setText(TaskListMessages.format("TaskProp.propertiesTitle", new Object[] { kind })); //$NON-NLS-1$
- }
-
- WorkbenchHelp.setHelp(newShell, ITaskListHelpContextIds.PROPERTIES_DIALOG);
-}
-
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- initializeDialogUnits(composite);
- createDescriptionArea(composite);
- if (isTask()) {
- createPriorityAndStatusArea(composite);
- }
- else {
- createSeverityArea(composite);
- }
- createResourceArea(composite);
- updateDialogFromMarker();
- return composite;
-}
-
-/**
- * Creates only the OK button if showing problem properties, otherwise creates
- * both OK and Cancel buttons.
- */
-protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- if (isTask()) {
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
-}
-
-/**
- * Creates the area for the Description field.
- */
-private void createDescriptionArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- Label label = new Label(composite, SWT.NONE);
- label.setText(TaskListMessages.getString("TaskProp.description")); //$NON-NLS-1$
- int style = SWT.SINGLE | SWT.BORDER;
- if (!isTask()) {
- style |= SWT.READ_ONLY;
- }
- descriptionText = new Text(composite, style);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = convertHorizontalDLUsToPixels(400);
- descriptionText.setLayoutData(gridData);
-}
-
-/**
- * Creates the area for the Priority and Status fields.
- */
-private void createPriorityAndStatusArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- composite.setLayout(layout);
-
- Label label = new Label(composite, SWT.NONE);
- label.setText(TaskListMessages.getString("TaskProp.priority")); //$NON-NLS-1$
- priorityCombo = new Combo(composite, SWT.READ_ONLY);
- priorityCombo.setItems(new String[] {
- TaskListMessages.getString("TaskList.high"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.normal"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.low") //$NON-NLS-1$
- });
- // Prevent Esc and Return from closing the dialog when the combo is active.
- priorityCombo.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
- e.doit = false;
- }
- }
- });
-
- completedCheckbox = new Button(composite, SWT.CHECK);
- completedCheckbox.setText(TaskListMessages.getString("TaskProp.completed")); //$NON-NLS-1$
- GridData gridData = new GridData();
- gridData.horizontalIndent = convertHorizontalDLUsToPixels(20);
- completedCheckbox.setLayoutData(gridData);
-}
-
-/**
- * Creates the area for the Severity field.
- */
-private void createSeverityArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- Label label = new Label(composite, SWT.NONE);
- label.setText(TaskListMessages.getString("TaskProp.severity")); //$NON-NLS-1$
-
- // workaround for bug 11078: Can't get a read-only combo box
- severityLabel = new Label(composite, SWT.NONE);
-/*
- severityCombo = new Combo(composite, SWT.READ_ONLY);
- severityCombo.setItems(new String[] {
- TaskListMessages.getString("TaskList.error"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.warning"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.info") //$NON-NLS-1$
- });
-*/
-}
-
-/**
- * Creates the area for the Resource field.
- */
-private void createResourceArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- composite.setLayoutData(gridData);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
-
- Label resourceLabel = new Label(composite, SWT.NONE);
- resourceLabel.setText(TaskListMessages.getString("TaskProp.onResource")); //$NON-NLS-1$
- resourceText = new Text(composite, SWT.SINGLE | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- resourceText.setLayoutData(gridData);
-
- Label folderLabel = new Label(composite, SWT.NONE);
- folderLabel.setText(TaskListMessages.getString("TaskProp.inFolder")); //$NON-NLS-1$
- folderText = new Text(composite, SWT.SINGLE | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- folderText.setLayoutData(gridData);
-
- Label locationLabel = new Label(composite, SWT.NONE);
- locationLabel.setText(TaskListMessages.getString("TaskProp.location")); //$NON-NLS-1$
- locationText = new Text(composite, SWT.SINGLE | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- locationText.setLayoutData(gridData);
-}
-
-/**
- * Updates the dialog from the marker state.
- */
-private void updateDialogFromMarker() {
- if (marker == null) {
- updateDialogForNewMarker();
- return;
- }
- descriptionText.setText(MarkerUtil.getMessage(marker));
- if (isTask()) {
- priorityCombo.clearSelection();
- priorityCombo.select(IMarker.PRIORITY_HIGH - MarkerUtil.getPriority(marker));
- completedCheckbox.setSelection(MarkerUtil.isComplete(marker));
- markDirty();
- }
- else {
-/* workaround for bug 11078: Can't get a read-only combo box
- severityCombo.clearSelection();
- severityCombo.select(IMarker.SEVERITY_ERROR - MarkerUtil.getSeverity(marker));
-*/
- String sev = ""; //$NON-NLS-1$
- switch (MarkerUtil.getSeverity(marker)) {
- case IMarker.SEVERITY_ERROR:
- sev = TaskListMessages.getString("TaskList.error"); //$NON-NLS-1$
- break;
- case IMarker.SEVERITY_WARNING:
- sev = TaskListMessages.getString("TaskList.warning"); //$NON-NLS-1$
- break;
- case IMarker.SEVERITY_INFO:
- sev = TaskListMessages.getString("TaskList.info"); //$NON-NLS-1$
- break;
- }
- severityLabel.setText(sev);
-
- }
- resourceText.setText(MarkerUtil.getResourceName(marker));
- folderText.setText(MarkerUtil.getContainerName(marker));
- locationText.setText(MarkerUtil.getLineAndLocation(marker));
-}
-
-/**
- * Updates the dialog to reflect the state for a new marker.
- */
-private void updateDialogForNewMarker() {
- Map attrs = getInitialAttributes();
-
- String desc = ""; //$NON-NLS-1$
- if (attrs != null) {
- Object o = attrs.get(IMarker.MESSAGE);
- if (o instanceof String) {
- desc = (String) o;
- }
- }
- descriptionText.setText(desc);
-
- int pri = IMarker.PRIORITY_NORMAL;
- if (attrs != null) {
- Object o = attrs.get(IMarker.PRIORITY);
- if (o instanceof Integer) {
- int val = ((Integer) o).intValue();
- if (val >= IMarker.PRIORITY_LOW && val <= IMarker.PRIORITY_HIGH) {
- pri = val;
- }
- }
- }
- priorityCombo.deselectAll();
- priorityCombo.select(IMarker.PRIORITY_HIGH - pri);
-
- boolean completed = false;
- if (attrs != null) {
- Object o = attrs.get(IMarker.DONE);
- if (o instanceof Boolean) {
- completed = ((Boolean) o).booleanValue();
- }
- }
- completedCheckbox.setSelection(completed);
-
- IResource resource = getResource();
- if (resource != null) {
- resourceText.setText(resource.getName());
- IResource parent = resource.getParent();
- folderText.setText(parent == null ? "" : parent.getFullPath().toString().substring(1)); //$NON-NLS-1$
- }
-
- int line = -1;
- String loc = ""; //$NON-NLS-1$
- if (attrs != null) {
- Object o = attrs.get(IMarker.LINE_NUMBER);
- if (o instanceof Integer) {
- line = ((Integer) o).intValue();
- }
- o = attrs.get(IMarker.LOCATION);
- if (o instanceof String) {
- loc = (String) o;
- }
- }
- locationText.setText(MarkerUtil.getLineAndLocation(line, loc));
-
- markDirty();
- return;
-
-}
-
-/* (non-Javadoc)
- * Method declared on Dialog
- */
-protected void okPressed() {
- saveChanges();
- super.okPressed();
-}
-
-private void markDirty() {
- dirty = true;
-}
-
-private boolean isDirty() {
- return dirty;
-}
-
-/**
- * Returns <code>true</code> if a task is being created or modified.
- * Returns <code>false</code> if a problem is being shown.
- */
-private boolean isTask() {
- return marker == null || MarkerUtil.isMarkerType(marker, IMarker.TASK);
-}
-
-/**
- * Saves the changes made in the dialog if needed.
- * Creates a new task if needed.
- * Updates the existing task only if there have been changes.
- * Does nothing for problems, since they cannot be modified.
- */
-private void saveChanges() {
- if (!isTask() || !isDirty()) {
- return;
- }
- try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- createOrUpdateMarker();
- }
- }, null);
- } catch (CoreException e) {
- ErrorDialog.openError(
- getShell(),
- TaskListMessages.getString("TaskProp.errorMessage"), //$NON-NLS-1$
- null,
- e.getStatus());
- return;
- }
-}
-
-/**
- * Creates or updates the marker. Must be called within a workspace runnable.
- */
-private void createOrUpdateMarker() throws CoreException {
- if (marker == null) {
- IResource resource = getResource();
- if (resource == null) {
- resource = ResourcesPlugin.getWorkspace().getRoot();
- }
- marker = resource.createMarker(IMarker.TASK);
- Map initialAttrs = getInitialAttributes();
- if (initialAttrs != null) {
- marker.setAttributes(initialAttrs);
- }
- }
-
- // Set the marker attributes from the current dialog field values.
- // Do not use setAttributes(Map) as that overwrites any attributes
- // not covered by the dialog.
- Map attrs = getMarkerAttributesFromDialog();
- for (Iterator i = attrs.keySet().iterator(); i.hasNext();) {
- String key = (String) i.next();
- Object val = attrs.get(key);
- marker.setAttribute(key, val);
- }
-}
-
-/**
- * Returns the marker attributes to save back to the marker,
- * based on the current dialog fields.
- */
-private Map getMarkerAttributesFromDialog() {
- Map attribs = new HashMap(11);
- if (isTask()) {
- attribs.put(IMarker.MESSAGE, descriptionText.getText());
- int i = priorityCombo.getSelectionIndex();
- if (i != -1) {
- attribs.put(IMarker.PRIORITY, new Integer(IMarker.PRIORITY_HIGH - i));
- }
- attribs.put(IMarker.DONE, completedCheckbox.getSelection() ? Boolean.TRUE : Boolean.FALSE);
- }
- return attribs;
-}
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskSorter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskSorter.java
deleted file mode 100644
index 8807f09..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskSorter.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IMarker;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-/**
- * This is the abstract superclass of sorters in the task list.
- */
-/* package */ class TaskSorter extends ViewerSorter {
- private TaskList tasklist;
- private boolean reversed = false;
- private int columnNumber;
-
- private static final int NUM_COLUMNS = 7;
-
- // column headings: "","C", "!","Description","Resource Name", "In Folder", "Location"
- private static final int[][] SORT_ORDERS_BY_COLUMN = {
- {0, 2, 4, 5, 6, 3, 1}, /* category */
- {1, 0, 2, 4, 5, 6, 3}, /* completed */
- {2, 0, 4, 5, 6, 3, 1}, /* priority */
- {3, 4, 5, 6, 0, 2, 1}, /* description */
- {4, 5, 6, 3, 0, 2, 1}, /* resource */
- {5, 4, 6, 3, 0, 2, 1}, /* container */
- {6, 4, 5, 3, 0, 2, 1} /* location */
- };
-/**
- * Creates a new task sorter.
- */
-public TaskSorter(TaskList tasklist, int columnNumber) {
- this.tasklist = tasklist;
- this.columnNumber = columnNumber;
-}
-/* (non-Javadoc)
- * Method declared on ViewerSorter.
- */
-/**
- * Compares two markers, sorting first by the main column of this sorter,
- * then by subsequent columns, depending on the column sort order.
- */
-public int compare(Viewer viewer, Object e1, Object e2) {
- IMarker m1 = (IMarker) e1;
- IMarker m2 = (IMarker) e2;
- int[] columnSortOrder = SORT_ORDERS_BY_COLUMN[columnNumber];
- int result = 0;
- for (int i = 0; i < NUM_COLUMNS; ++i) {
- result = compareColumnValue(columnSortOrder[i], m1, m2);
- if (result != 0)
- break;
- }
- if (reversed)
- result = -result;
- return result;
-}
-/* (non-Javadoc)
- * Method declared on ViewerSorter.
- */
-/**
- * Compares two markers, based only on the value of the specified column.
- */
-private int compareColumnValue(int columnNumber, IMarker m1, IMarker m2) {
- switch (columnNumber) {
- case 0: /* category */
- return getCategoryOrder(m1) - getCategoryOrder(m2);
- case 1: /* completed */
- return getCompletedOrder(m1) - getCompletedOrder(m2);
- case 2: /* priority */
- return getPriorityOrder(m1) - getPriorityOrder(m2);
- case 3: /* description */
- return collator.compare(MarkerUtil.getMessage(m1), MarkerUtil.getMessage(m2));
- case 4: /* resource name */
- // Optimization: if the markers' resources are equal, then their names are the same.
- // If resources are equal, chances are they're identical; don't take hit for full equality comparison.
- if (m1.getResource() == m2.getResource())
- return 0;
- return collator.compare(MarkerUtil.getResourceName(m1), MarkerUtil.getResourceName(m2));
- case 5: /* container name */
- // Optimization: if the markers' resources are equal, then container names are the same.
- // If resources are equal, chances are they're identical; don't take hit for full equality comparison.
- if (m1.getResource() == m2.getResource())
- return 0;
- return collator.compare(MarkerUtil.getContainerName(m1), MarkerUtil.getContainerName(m2));
- case 6: /* line and location */
- return compareLineAndLocation(m1, m2);
- default:
- return 0;
- }
-}
-/**
- * Compares the line number and location of the two markers.
- * If line number is specified for both, this sorts first by line number (numerically),
- * then by start offset (numerically), then by location (textually).
- * If line number is not specified for either, this sorts by location.
- * Otherwise, if only one has a line number, this sorts by the combined text for line number and location.
- */
-private int compareLineAndLocation(IMarker m1, IMarker m2) {
- int line1 = MarkerUtil.getLineNumber(m1);
- int line2 = MarkerUtil.getLineNumber(m2);
- if (line1 != -1 && line2 != -1) {
- if (line1 != line2) {
- return line1 - line2;
- }
- int start1 = MarkerUtil.getCharStart(m1);
- int start2 = MarkerUtil.getCharStart(m2);
- if (start1 != -1 && start2 != -1) {
- if (start1 != start2) {
- return start1 - start2;
- }
- }
- String loc1 = MarkerUtil.getLocation(m1);
- String loc2 = MarkerUtil.getLocation(m2);
- return collator.compare(loc1, loc2);
- }
- if (line1 == -1 && line2 == -1) {
- String loc1 = MarkerUtil.getLocation(m1);
- String loc2 = MarkerUtil.getLocation(m2);
- return collator.compare(loc1, loc2);
- }
- String loc1 = MarkerUtil.getLineAndLocation(m1);
- String loc2 = MarkerUtil.getLineAndLocation(m2);
- return collator.compare(loc1, loc2);
-}
-/**
- * Returns the sort order for the given marker based on its category.
- * Lower numbers appear first.
- */
-private int getCategoryOrder(IMarker marker) {
- if (MarkerUtil.isMarkerType(marker, IMarker.PROBLEM)) {
- switch (MarkerUtil.getSeverity(marker)) {
- case IMarker.SEVERITY_ERROR:
- return 1;
- case IMarker.SEVERITY_WARNING:
- return 2;
- case IMarker.SEVERITY_INFO:
- return 3;
- }
- } else if (MarkerUtil.isMarkerType(marker, IMarker.TASK)) {
- return 0;
- }
- return 1000;
-}
-/**
- * Returns the number of the column by which this is sorting.
- */
-public int getColumnNumber() {
- return columnNumber;
-}
-/**
- * Returns the sort order for the given marker based on its completion status.
- * Lower numbers appear first.
- */
-private int getCompletedOrder(IMarker marker) {
- return MarkerUtil.isComplete(marker) ? 0 : 1;
-}
-/**
- * Returns the sort order for the given marker based on its priority.
- * Lower numbers appear first.
- */
-private int getPriorityOrder(IMarker marker) {
- // want HIGH to appear first
- return IMarker.PRIORITY_HIGH - MarkerUtil.getPriority(marker);
-}
-/**
- * Returns true for descending, or false
- * for ascending sorting order.
- */
-public boolean isReversed() {
- return reversed;
-}
-/**
- * Sets the sorting order.
- */
-public void setReversed(boolean newReversed) {
- reversed = newReversed;
-}
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TasksFilter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TasksFilter.java
deleted file mode 100644
index 7c480bd..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TasksFilter.java
+++ /dev/null
@@ -1,424 +0,0 @@
-package org.eclipse.ui.views.tasklist;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Cagatay Kavukcuoglu <cagatayk@acm.org> - Filter for markers in same project
-**********************************************************************/
-
-import java.util.Arrays;
-import java.util.HashSet;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/* package */ class TasksFilter extends ViewerFilter implements Cloneable {
-
- public static final String[] ROOT_TYPES = new String[] { IMarker.PROBLEM, IMarker.TASK };
-
- // Filter on resource constants
- static final int ON_ANY_RESOURCE = 0;
- static final int ON_SELECTED_RESOURCE_ONLY = 1;
- static final int ON_SELECTED_RESOURCE_AND_CHILDREN = 2;
- static final int ON_ANY_RESOURCE_OF_SAME_PROJECT = 3; // added by cagatayk@acm.org
- static final int ON_WORKING_SET = 4;
-
- // Description filter kind constants
- static final int FILTER_CONTAINS = 0;
- static final int FILTER_DOES_NOT_CONTAIN = 1;
-
- //final static int MINIMUM_MARKER_LIMIT = 10;
- final static int DEFAULT_MARKER_LIMIT = 2000;
- //final static int MAXIMUM_MARKER_LIMIT = 20000;
-
- String[] types;
- int onResource;
- IWorkingSet workingSet;
- boolean filterOnDescription;
- int descriptionFilterKind;
- String descriptionFilter;
- boolean filterOnSeverity;
- int severityFilter;
- boolean filterOnPriority;
- int priorityFilter;
- boolean filterOnCompletion;
- int completionFilter;
- private boolean filterOnMarkerLimit = true;
- private int markerLimit = DEFAULT_MARKER_LIMIT;
-
- private static final String TAG_ID = "id"; //$NON-NLS-1$
- private static final String TAG_TYPE = "type"; //$NON-NLS-1$
- private static final String TAG_ON_RESOURCE = "onResource"; //$NON-NLS-1$
- private static final String TAG_WORKING_SET = "workingSet"; //$NON-NLS-1$
- private static final String TAG_FILTER_ON_DESCRIPTION = "filterOnDescription"; //$NON-NLS-1$
- private static final String TAG_DESCRIPTION_FILTER_KIND = "descriptionFilterKind"; //$NON-NLS-1$
- private static final String TAG_DESCRIPTION_FILTER = "descriptionFilter"; //$NON-NLS-1$
- private static final String TAG_FILTER_ON_SEVERITY = "filterOnSeverity"; //$NON-NLS-1$
- private static final String TAG_SEVERITY_FILTER = "severityFilter"; //$NON-NLS-1$
- private static final String TAG_FILTER_ON_PRIORITY = "filterOnPriority"; //$NON-NLS-1$
- private static final String TAG_PRIORITY_FILTER = "priorityFilter"; //$NON-NLS-1$
- private static final String TAG_FILTER_ON_COMPLETION = "filterOnCompletion"; //$NON-NLS-1$
- private static final String TAG_COMPLETION_FILTER = "completionFilter"; //$NON-NLS-1$
- private static final String TAG_FILTER_ON_MARKER_LIMIT = "filterOnMarkerLimit"; //$NON-NLS-1$
- private static final String TAG_MARKER_LIMIT = "markerLimit"; //$NON-NLS-1$
-
-public TasksFilter() {
- reset();
-}
-
-boolean getFilterOnMarkerLimit() {
- return filterOnMarkerLimit;
-}
-
-void setFilterOnMarkerLimit(boolean filterOnMarkerLimit) {
- this.filterOnMarkerLimit = filterOnMarkerLimit;
-}
-
-int getMarkerLimit() {
- return markerLimit;
-}
-
-void setMarkerLimit(int markerLimit) {
- if (markerLimit < 1) {
- markerLimit = TasksFilter.DEFAULT_MARKER_LIMIT;
- }
-
- //if (markerLimit < TasksFilter.MINIMUM_MARKER_LIMIT) {
- // markerLimit = TasksFilter.MINIMUM_MARKER_LIMIT;
- //} else if (markerLimit > TasksFilter.MAXIMUM_MARKER_LIMIT) {
- // markerLimit = TasksFilter.MAXIMUM_MARKER_LIMIT;
- //}
-
- this.markerLimit = markerLimit;
-}
-
-boolean checkDescription(String desc) {
- boolean contains = containsSubstring(desc, descriptionFilter);
- return descriptionFilterKind == FILTER_CONTAINS ? contains : !contains;
-}
-
-public Object clone() {
- try {
- return super.clone();
- }
- catch (CloneNotSupportedException e) {
- throw new Error(); // shouldn't happen
- }
-}
-
-boolean containsSubstring(String string, String substring) {
- int strLen = string.length();
- int subLen = substring.length();
- int len = strLen - subLen;
- for (int i = 0; i <= len; ++i) {
- if (string.regionMatches(true, i, substring, 0, subLen)) {
- return true;
- }
- }
- return false;
-}
-/**
- * Returns whether the element is a parent or a child
- * of a working set element.
- *
- * @param element the resource to check
- * @return
- * true=the element is a parent or a child of a working
- * set element.
- * false=the element is neither a parent nor a child of a
- * working set element.
- */
-private boolean isEnclosed(IResource element) {
- IPath elementPath = element.getFullPath();
- IAdaptable[] workingSets = workingSet.getElements();
-
- if (elementPath.isEmpty() || elementPath.isRoot()) {
- return false;
- }
- for (int i = 0; i < workingSets.length; i++) {
- IAdaptable adaptable = workingSets[i];
- IResource resource;
-
- if (adaptable instanceof IResource) {
- resource = (IResource) adaptable;
- }
- else {
- resource = (IResource) adaptable.getAdapter(IResource.class);
- }
- if (resource != null) {
- IPath resourcePath = resource.getFullPath();
- if (resourcePath.isPrefixOf(elementPath))
- return true;
- if (elementPath.isPrefixOf(resourcePath))
- return true;
- }
- }
- return false;
-}
-public void reset() {
- types = ROOT_TYPES;
- onResource = ON_ANY_RESOURCE;
- filterOnDescription = false;
- descriptionFilter = ""; //$NON-NLS-1$
- filterOnSeverity = false;
- severityFilter = 0;
- filterOnPriority = false;
- priorityFilter = 0;
- filterOnCompletion = false;
- completionFilter = 0;
- filterOnMarkerLimit = true;
- markerLimit = DEFAULT_MARKER_LIMIT;
-}
-/**
- * @see IPersistable
- */
-public void restoreState(IMemento memento) {
- IMemento children[] = memento.getChildren(TAG_TYPE);
- types = new String[children.length];
- for (int i = 0; i < children.length; i++){
- types[i] = children[i].getString(TAG_ID);
- }
- Integer ival = memento.getInteger(TAG_ON_RESOURCE);
- onResource = ival == null ? ON_ANY_RESOURCE : ival.intValue();
- restoreWorkingSet(memento.getString(TAG_WORKING_SET));
- ival = memento.getInteger(TAG_FILTER_ON_DESCRIPTION);
- filterOnDescription = ival != null && ival.intValue() == 1;
- ival = memento.getInteger(TAG_DESCRIPTION_FILTER_KIND);
- descriptionFilterKind = ival == null ? FILTER_CONTAINS : ival.intValue();
- descriptionFilter = memento.getString(TAG_DESCRIPTION_FILTER);
- if (descriptionFilter == null)
- descriptionFilter = ""; //$NON-NLS-1$
- ival = memento.getInteger(TAG_FILTER_ON_SEVERITY);
- filterOnSeverity = ival != null && ival.intValue() == 1;
- ival = memento.getInteger(TAG_SEVERITY_FILTER);
- severityFilter = ival == null ? 0 : ival.intValue();
- ival = memento.getInteger(TAG_FILTER_ON_PRIORITY);
- filterOnPriority = ival != null && ival.intValue() == 1;
- ival = memento.getInteger(TAG_PRIORITY_FILTER);
- priorityFilter = ival == null ? 0 : ival.intValue();
- ival = memento.getInteger(TAG_FILTER_ON_COMPLETION);
- filterOnCompletion = ival != null && ival.intValue() == 1;
- ival = memento.getInteger(TAG_COMPLETION_FILTER);
- completionFilter = ival == null ? 0 : ival.intValue();
- ival = memento.getInteger(TAG_FILTER_ON_MARKER_LIMIT);
- filterOnMarkerLimit = ival == null || ival.intValue() == 1;
- ival = memento.getInteger(TAG_MARKER_LIMIT);
- markerLimit = ival == null ? DEFAULT_MARKER_LIMIT : ival.intValue();
-}
-/**
- * Restores the saved working set, if any.
- *
- * @param the saved working set name or null
- */
-private void restoreWorkingSet(String workingSetName) {
- if (workingSetName != null) {
- IWorkingSetManager workingSetManager = WorkbenchPlugin.getDefault().getWorkingSetManager();
- IWorkingSet workingSet = workingSetManager.getWorkingSet(workingSetName);
-
- if (workingSet != null) {
- this.workingSet = workingSet;
- }
- }
-}
-/**
- * Saves the object state within a memento.
- *
- * @param memento a memento to receive the object state
- */
-public void saveState(IMemento memento) {
- for (int i = 0; i < types.length; i++){
- memento.createChild(TAG_TYPE).putString(TAG_ID,types[i]);
- }
- memento.putInteger(TAG_ON_RESOURCE,onResource);
- if (workingSet != null) {
- memento.putString(TAG_WORKING_SET,workingSet.getName());
- }
- memento.putInteger(TAG_FILTER_ON_DESCRIPTION,filterOnDescription?1:0);
- memento.putInteger(TAG_DESCRIPTION_FILTER_KIND,descriptionFilterKind);
- memento.putString(TAG_DESCRIPTION_FILTER,descriptionFilter);
- memento.putInteger(TAG_FILTER_ON_SEVERITY,filterOnSeverity?1:0);
- memento.putInteger(TAG_SEVERITY_FILTER,severityFilter);
- memento.putInteger(TAG_FILTER_ON_PRIORITY,filterOnPriority?1:0);
- memento.putInteger(TAG_PRIORITY_FILTER,priorityFilter);
- memento.putInteger(TAG_FILTER_ON_COMPLETION,filterOnCompletion?1:0);
- memento.putInteger(TAG_COMPLETION_FILTER,completionFilter);
- memento.putInteger(TAG_FILTER_ON_MARKER_LIMIT,filterOnMarkerLimit?1:0);
- memento.putInteger(TAG_MARKER_LIMIT,markerLimit);
-}
-
-public boolean select(Viewer viewer, Object parentElement, Object element) {
- return select((IMarker) element);
-}
-
-public boolean select(IMarker marker) {
- // resource settings are handled by the content provider
- return selectByType(marker) && selectByAttributes(marker) && selectByWorkingSet(marker);
-}
-
-public boolean select(IMarkerDelta markerDelta) {
- // resource settings are handled by the content provider
- return selectByType(markerDelta) && selectByAttributes(markerDelta) && selectByWorkingSet(markerDelta);
-}
-
-private boolean selectByType(IMarker marker) {
- for (int i = 0; i < types.length; ++i) {
- if (MarkerUtil.isMarkerType(marker, types[i]))
- return true;
- }
- return false;
-}
-
-private boolean selectByType(IMarkerDelta markerDelta) {
- for (int i = 0; i < types.length; ++i) {
- if (markerDelta.isSubtypeOf(types[i]))
- return true;
- }
- return false;
-}
-
-/**
- * Returns whether the specified marker should be filter out or not.
- *
- * @param marker the marker to test
- * @return
- * true=the marker should not be filtered out
- * false=the marker should be filtered out
- */
-private boolean selectByWorkingSet(IMarker marker) {
- if (workingSet == null || onResource != ON_WORKING_SET) {
- return true;
- }
- IResource resource = (IResource) marker.getResource();
- if (resource != null) {
- return isEnclosed(resource);
- }
- return false;
-}
-/**
- * Returns whether the specified marker delta should be filter out
- * or not.
- *
- * @param markerDelta the marker delta to test
- * @return
- * true=the marker delta should not be filtered out
- * false=the marker delta should be filtered out
- */
-private boolean selectByWorkingSet(IMarkerDelta markerDelta) {
- if (workingSet == null || onResource != ON_WORKING_SET) {
- return true;
- }
- IResource resource = (IResource) markerDelta.getResource();
- if (resource != null) {
- return isEnclosed(resource);
- }
- return false;
-}
-/*
- * WARNING: selectByAttributes(IMarker) and selectByAttributes(IMarkerDelta) must correspond.
- */
-
-private boolean selectByAttributes(IMarker marker) {
-
- // severity filter applies only to problems
- if (filterOnSeverity && MarkerUtil.isMarkerType(marker, IMarker.PROBLEM)) {
- int sev = MarkerUtil.getSeverity(marker);
- if ((severityFilter & (1 << sev)) == 0)
- return false;
- }
-
- // priority and completion filters apply only to tasks
- // avoid doing type check more than once
- if ((filterOnPriority || filterOnCompletion) && MarkerUtil.isMarkerType(marker, IMarker.TASK)) {
- if (filterOnPriority) {
- int pri = MarkerUtil.getPriority(marker);
- if ((priorityFilter & (1 << pri)) == 0)
- return false;
- }
- if (filterOnCompletion) {
- boolean complete = MarkerUtil.isComplete(marker);
- if ((completionFilter & (complete ? 2 : 1)) == 0)
- return false;
- }
- }
-
- // description applies to all markers
- if (filterOnDescription) {
- String desc = MarkerUtil.getMessage(marker);
- if (!checkDescription(desc))
- return false;
- }
- return true;
-}
-
-private boolean selectByAttributes(IMarkerDelta markerDelta) {
-
- // severity filter applies only to problems
- if (filterOnSeverity && markerDelta.isSubtypeOf(IMarker.PROBLEM)) {
- int sev = markerDelta.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING);
- if ((severityFilter & (1 << sev)) == 0)
- return false;
- }
-
- // priority and completion filters apply only to tasks
- // avoid doing type check more than once
- if ((filterOnPriority || filterOnCompletion) && markerDelta.isSubtypeOf(IMarker.TASK)) {
- if (filterOnPriority) {
- int pri = markerDelta.getAttribute(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
- if ((priorityFilter & (1 << pri)) == 0)
- return false;
- }
- if (filterOnCompletion) {
- boolean complete = markerDelta.getAttribute(IMarker.DONE, false);
- if ((completionFilter & (complete ? 2 : 1)) == 0)
- return false;
- }
- }
-
- // description applies to all markers
- if (filterOnDescription) {
- String desc = markerDelta.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
- if (!checkDescription(desc))
- return false;
- }
- return true;
-}
-
-
-/**
- * Returns whether the filter is including all markers.
- *
- * @return <code>true</code> if the filter includes all markers, <code>false</code> if not
- */
-public boolean isShowingAll() {
- if (filterOnDescription || filterOnSeverity || filterOnPriority || filterOnCompletion) {
- return false;
- }
- if (onResource != ON_ANY_RESOURCE) {
- return false;
- }
-
- HashSet set = new HashSet(Arrays.asList(types));
- if (set.size() != ROOT_TYPES.length) {
- return false;
- }
- for (int i = 0; i < ROOT_TYPES.length; ++i) {
- if (!set.contains(ROOT_TYPES[i])) {
- return false;
- }
- }
- return true;
-}
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/messages.properties b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/messages.properties
deleted file mode 100644
index ec4794f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/messages.properties
+++ /dev/null
@@ -1,168 +0,0 @@
-# ==============================================================================
-# Copyright (c) 2000, 2002 IBM Corp. and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Common Public License v0.5
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/cpl-v05.html
-#
-# Contributors:
-# Cagatay Kavukcuoglu <cagatayk@acm.org> - Filter for markers in same project
-# ==============================================================================
-
-# package: org.eclipse.ui.views.tasklist
-
-
-# ==============================================================================
-# TaskList
-# ==============================================================================
-
-TaskList.line = line {0}
-TaskList.lineAndLocation = line {0} in {1}
-
-TaskList.statusSummaryVisible = \
- {0,choice,0#0 items|1#{0,number,integer} item\
- |1<{0,number,integer} items}: {1}
-TaskList.statusSummarySelected = \
- {0,choice,0#0 items|1#{0,number,integer} item\
- |1<{0,number,integer} items} selected: {1}
-TaskList.statusSummaryBreakdown = \
- {0,choice,0#0 tasks|1#{0,number,integer} task\
- |1<{0,number,integer} tasks}, \
- {1,choice,0#0 errors|1#{1,number,integer} error\
- |1<{1,number,integer} errors}, \
- {2,choice,0#0 warnings|1#{2,number,integer} warning\
- |1<{2,number,integer} warnings}, \
- {3,choice,0#0 infos|1#{3,number,integer} info\
- |1<{3,number,integer} infos}
-TaskList.titleSummaryUnfiltered = \
- {0,choice,0#0 items|1#{0,number,integer} item\
- |1<{0,number,integer} items}
-TaskList.titleSummaryFiltered = Filter matched {0} of \
- {1,choice,0#0 items|1#{1,number,integer} item\
- |1<{1,number,integer} items}
-TaskList.title = {0} ({1})
-
-TaskList.headerIcon =
-TaskList.headerCompleted = C
-TaskList.headerPriority = !
-TaskList.headerDescription = Description
-TaskList.headerResource = Resource
-TaskList.headerFolder = In Folder
-TaskList.headerLocation = Location
-
-TaskList.high = High
-TaskList.low = Low
-TaskList.normal = Normal
-
-TaskList.errorModifyingTask = Error modifying task
-
-TaskList.reportKind = Kind
-TaskList.reportStatus = Status
-TaskList.reportPriority = Priority
-
-TaskList.task = Task
-TaskList.error = Error
-TaskList.warning = Warning
-TaskList.info = Info
-
-TaskList.completed = Completed
-TaskList.notCompleted = Not Completed
-
-TaskList.markerLimitExceeded = There are too many items to display.\n\
- To see items in this window, adjust the filter settings.
-
-# --- Actions ---
-NewTask.text = &New Task
-NewTask.tooltip = New Task
-NewTask.notShownTitle = New Task Not Visible
-NewTask.notShownMsg = The new task will not be visible, due to the current filter settings.\n\
- To see all tasks, choose Filter... then select the Reset button.
-
-CopyTask.text = &Copy
-CopyTask.tooltip = Copy
-
-PasteTask.text = &Paste
-PasteTask.tooltip = Paste
-PasteTask.errorMessage = Error pasting task
-
-RemoveTask.text = &Delete
-RemoveTask.tooltip = Delete
-RemoveTask.errorMessage = Error deleting task
-
-Filters.text = &Filter...
-Filters.tooltip = Filter...
-
-GotoTask.text = &Go To
-GotoTask.tooltip = Go To
-GotoTask.errorMessage = Problems Opening Editor
-
-PurgeCompleted.text = Delete Completed &Tasks
-PurgeCompleted.tooltip = Delete Completed Tasks
-PurgeCompleted.question = Question
-PurgeCompleted.permanent = Do you want to permanently delete all completed tasks?
-PurgeCompleted.errorMessage = Error deleting completed tasks
-
-MarkCompleted.text = &Mark Completed
-MarkCompleted.tooltip = Mark Completed
-
-SelectAll.text = Select A&ll
-SelectAll.tooltip = Select All
-
-Resolve.text = &Quick Fix...
-Resolve.tooltip = Quick Fix
-Resolve.title = Quick Fix
-Resolve.noResolutionsLabel = There are no quick fixes available for the selected marker.
-
-Properties.text = P&roperties
-Properties.tooltip = Properties
-
-# --- Filter Dialog ---
-TaskList.filter = Filter Tasks
-TaskList.showItemsOfType = Show items of &type:
-
-TaskList.anyResource = On &any resource
-TaskList.anyResourceInSameProject = On any resource in same &project
-TaskList.selectedResource = On selected resource &only
-TaskList.selectedAndChildren = On selected resource and its &children
-TaskList.workingSet = On wor&king set: {0}
-TaskList.workingSetSelect = &Select...
-TaskList.noWorkingSet = On wor&king set: <no working set selected>
-
-TaskList.whereDescription = Where &description
-TaskList.contains = contains
-TaskList.doesNotContain = does not contain
-
-TaskList.severity.label = Where problem se&verity is:
-TaskList.severity.error = &Error
-TaskList.severity.warning = Warnin&g
-TaskList.severity.info = &Info
-
-TaskList.priority.label = Where task priorit&y is:
-TaskList.priority.high = &High
-TaskList.priority.low = Lo&w
-TaskList.priority.normal = &Normal
-
-TaskList.status.label = Where task stat&us is:
-TaskList.status.completed = Co&mpleted
-TaskList.status.notCompleted = Not Comp&leted
-
-TaskList.resetText = &Reset
-
-TaskList.limitVisibleTasksTo = Limit visi&ble items to:
-TaskList.titleMarkerLimitInvalid = Error
-TaskList.messageMarkerLimitInvalid = The visible item limit must be a positive integer.
-
-# --- Properties Dialog ---
-TaskProp.newTaskTitle = New Task
-TaskProp.propertiesTitle = {0} Properties
-#TaskProp.titleFmt = {0} - {1}
-TaskProp.description = &Description:
-TaskProp.priority = &Priority:
-TaskProp.completed = &Completed
-TaskProp.severity = Severity:
-TaskProp.onResource = On &Resource:
-TaskProp.inFolder = In &Folder:
-TaskProp.location = &Location:
-TaskProp.errorMessage = Error creating or modifying task
-
-
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/package.html b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/package.html
deleted file mode 100644
index 94c17f9..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/package.html
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides the standard Task List view for displaying
-tasks and problem annotations on resources.
-<br>
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.win32/.classpath b/bundles/org.eclipse.ui.win32/.classpath
deleted file mode 100644
index 8e2273a..0000000
--- a/bundles/org.eclipse.ui.win32/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
- <classpathentry kind="src" path="/org.eclipse.ui"/>
- <classpathentry kind="src" path="/org.eclipse.swt"/>
- <classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.ui.win32/.cvsignore b/bundles/org.eclipse.ui.win32/.cvsignore
deleted file mode 100644
index ba077a4..0000000
--- a/bundles/org.eclipse.ui.win32/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
diff --git a/bundles/org.eclipse.ui.win32/.project b/bundles/org.eclipse.ui.win32/.project
deleted file mode 100644
index d0876c2..0000000
--- a/bundles/org.eclipse.ui.win32/.project
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.win32</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.swt</project>
- <project>org.eclipse.ui</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/bundles/org.eclipse.ui.win32/about.html b/bundles/org.eclipse.ui.win32/about.html
deleted file mode 100644
index 9db411a..0000000
--- a/bundles/org.eclipse.ui.win32/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, "Program" will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.win32/build.properties b/bundles/org.eclipse.ui.win32/build.properties
deleted file mode 100644
index 1c4c96d..0000000
--- a/bundles/org.eclipse.ui.win32/build.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-source.workbenchwin32.jar=src/
-src.includes=about.html
-bin.includes=fragment.xml,fragment.properties,*.jar
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.win32/fragment.xml b/bundles/org.eclipse.ui.win32/fragment.xml
deleted file mode 100644
index d5e7969..0000000
--- a/bundles/org.eclipse.ui.win32/fragment.xml
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<fragment
- id="org.eclipse.ui.win32"
- name="%Win32Fragment.fragmentName"
- version="2.1.0"
- provider-name="%Plugin.providerName"
- plugin-id="org.eclipse.ui"
- plugin-version="2.1.0">
-
- <runtime>
- <library name="workbenchwin32.jar">
- <export name="*"/>
- </library>
- </runtime>
-
-
-</fragment>
diff --git a/bundles/org.eclipse.ui.win32/src/org/eclipse/ui/internal/editorsupport/win32/OleEditor.java b/bundles/org.eclipse.ui.win32/src/org/eclipse/ui/internal/editorsupport/win32/OleEditor.java
deleted file mode 100644
index 4cce7d6..0000000
--- a/bundles/org.eclipse.ui.win32/src/org/eclipse/ui/internal/editorsupport/win32/OleEditor.java
+++ /dev/null
@@ -1,611 +0,0 @@
-package org.eclipse.ui.internal.editorsupport.win32;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Vector;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.ole.win32.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.SaveAsDialog;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPage;
-import org.eclipse.ui.part.EditorPart;
-import org.eclipse.ui.part.FileEditorInput;
-
-/**
- */
-public class OleEditor extends EditorPart {
-
- /**
- * The resource listener updates the receiver when
- * a change has occured.
- */
- private IResourceChangeListener resourceListener =
- new IResourceChangeListener() {
-
- /*
- * @see IResourceChangeListener#resourceChanged(IResourceChangeEvent)
- */
- public void resourceChanged(IResourceChangeEvent event) {
- IResourceDelta mainDelta = event.getDelta();
- if(mainDelta == null)
- return;
- IResourceDelta affectedElement =
- mainDelta.findMember(resource.getFullPath());
- if (affectedElement != null)
- try {
- processDelta(affectedElement);
- } catch (CoreException exception) {
- //Failed so close the receiver
- getSite().getPage().closeEditor(OleEditor.this, true);
- }
- }
-
- /*
- * Process the delta for the receiver
- */
- private boolean processDelta(final IResourceDelta delta) throws CoreException {
-
- Runnable changeRunnable = null;
-
- switch (delta.getKind()) {
- case IResourceDelta.REMOVED :
- if ((IResourceDelta.MOVED_TO & delta.getFlags()) != 0) {
- changeRunnable = new Runnable() {
- public void run() {
- IPath path = delta.getMovedToPath();
- IFile newFile = delta.getResource().getWorkspace().getRoot().getFile(path);
- if (newFile != null) {
- sourceChanged(newFile);
- }
- }
- };
- } else {
- changeRunnable = new Runnable() {
- public void run() {
- sourceDeleted = true;
- getSite().getPage().closeEditor(OleEditor.this, true);
- }
- };
-
- }
-
- break;
- }
-
- if (changeRunnable != null)
- update(changeRunnable);
-
- return true; // because we are sitting on files anyway
- }
-
- };
-
- private OleFrame clientFrame;
- private OleClientSite clientSite;
- private File source;
- private IFile resource;
- private Image oleTitleImage;
- //The sourceDeleted flag makes sure that the receiver is not
- //dirty when shutting down
- boolean sourceDeleted = false;
- //The sourceChanged flag indicates whether or not the save from the ole component
- //can be used or if the input changed
- boolean sourceChanged = false;
-
- /**
- * Keep track of whether we have an active client so we do not
- * deactivate multiple times
- */
- private boolean clientActive = false;
-
- /**
- * Keep track of whether we have activated OLE or not as some applications
- * will only allow single activations.
- */
- private boolean oleActivated = false;
-
- private IPartListener partListener = new IPartListener() {
- public void partActivated(IWorkbenchPart part) {
- activateClient(part);
- }
- public void partBroughtToTop(IWorkbenchPart part) {
- }
- public void partClosed(IWorkbenchPart part) {
- }
- public void partOpened(IWorkbenchPart part) {
- }
- public void partDeactivated(IWorkbenchPart part) {
- deactivateClient(part);
- }
- };
-
- private static final String FILE_PROMPTER_TITLE =
- WorkbenchMessages.getString("OleEditor.renameTitle"); //$NON-NLS-1$
- //$NON-NLS-1$
- private static final String FILE_PROMPTER_MESSAGE =
- WorkbenchMessages.getString("OleEditor.renameMessage"); //$NON-NLS-1$
- //$NON-NLS-1$
- private static final String RENAME_ERROR_TITLE =
- WorkbenchMessages.getString("OleEditor.errorSaving"); //$NON-NLS-1$
- //$NON-NLS-1$
- private static final String OLE_EXCEPTION_TITLE =
- WorkbenchMessages.getString("OleEditor.oleExceptionTitle"); //$NON-NLS-1$
- //$NON-NLS-1$
- private static final String OLE_EXCEPTION_MESSAGE =
- WorkbenchMessages.getString("OleEditor.oleExceptionMessage"); //$NON-NLS-1$
- //$NON-NLS-1$
- private static final String SAVE_ERROR_TITLE =
- WorkbenchMessages.getString("OleEditor.savingTitle"); //$NON-NLS-1$
- //$NON-NLS-1$
- private static final String SAVE_ERROR_MESSAGE =
- WorkbenchMessages.getString("OleEditor.savingMessage"); //$NON-NLS-1$
- //$NON-NLS-1$
- /**
- * Return a new ole editor.
- */
- public OleEditor() {
- }
-
- private void activateClient(IWorkbenchPart part) {
- if (part == this) {
- oleActivate();
- this.clientActive = true;
- }
- }
- /**
- * createPartControl method comment.
- */
- public void createPartControl(Composite parent) {
-
- // Create a frame.
- clientFrame = new OleFrame(parent, SWT.CLIP_CHILDREN);
- clientFrame.setBackground(
- JFaceColors.getBannerBackground(clientFrame.getDisplay()));
-
- initializeWorkbenchMenus();
-
- // Set the input file.
- IEditorInput input = getEditorInput();
- if (input instanceof IFileEditorInput) {
- setResource(((IFileEditorInput) input).getFile());
- resource.getWorkspace().addResourceChangeListener(resourceListener);
- }
-
- createClientSite();
- }
-
- /**
- * Create the client site for the reciever
- */
-
- private void createClientSite() {
- //If there was an OLE Error or nothing has been created yet
- if (clientFrame == null || clientFrame.isDisposed())
- return;
- // Create a OLE client site.
- clientSite = new OleClientSite(clientFrame, SWT.NONE, source);
- clientSite.setBackground(
- JFaceColors.getBannerBackground(clientFrame.getDisplay()));
-
- }
-
- private void deactivateClient(IWorkbenchPart part) {
- //Check the client active flag. Set it to false when we have deactivated
- //to prevent multiple deactivations.
- if (part == this && clientActive) {
- if(clientSite != null)
- clientSite.deactivateInPlaceClient();
- this.clientActive = false;
- this.oleActivated = false;
- }
- }
- /**
- * Display an error dialog with the supplied title and message.
- */
- private void displayErrorDialog(String title, String message) {
- Shell parent = null;
- if(getClientSite() != null)
- parent = getClientSite().getShell();
- MessageDialog.openError(parent, title, message);
- }
- /**
- * @see IWorkbenchPart#dispose
- */
- public void dispose() {
- if (resource != null)
- resource.getWorkspace().removeResourceChangeListener(resourceListener);
-
- //can dispose the title image because it was created in init
- if (oleTitleImage != null) {
- oleTitleImage.dispose();
- oleTitleImage = null;
- }
-
- if (getSite() != null && getSite().getPage() != null)
- getSite().getPage().removePartListener(partListener);
-
- }
- /**
- * Print this object's contents
- */
- public void doPrint() {
- if(clientSite == null)
- return;
- BusyIndicator.showWhile(clientSite.getDisplay(), new Runnable() {
- public void run() {
- clientSite.exec(OLE.OLECMDID_PRINT, OLE.OLECMDEXECOPT_PROMPTUSER, null, null);
- // note: to check for success: above == SWTOLE.S_OK
- }
- });
- }
- /**
- * Save the viewer's contents to the source file system file
- */
- public void doSave(final IProgressMonitor monitor) {
- if(clientSite == null)
- return;
- BusyIndicator.showWhile(clientSite.getDisplay(), new Runnable() {
- public void run() {
-
- //Do not try and use the component provided save if the source has
- //changed in Eclipse
- if (!sourceChanged) {
- int result = clientSite.queryStatus(OLE.OLECMDID_SAVE);
- if ((result & OLE.OLECMDF_ENABLED) != 0) {
- result =
- clientSite.exec(OLE.OLECMDID_SAVE, OLE.OLECMDEXECOPT_PROMPTUSER, null, null);
- if (result == OLE.S_OK) {
- try {
- resource.refreshLocal(resource.DEPTH_ZERO, monitor);
- } catch (CoreException ex) {
- }
- return;
- } else {
- displayErrorDialog(
- OLE_EXCEPTION_TITLE,
- OLE_EXCEPTION_MESSAGE + String.valueOf(result));
- return;
- }
- }
- }
- if (saveFile(source)) {
- try {
- resource.refreshLocal(resource.DEPTH_ZERO, monitor);
- } catch (CoreException ex) {
- }
- } else
- displayErrorDialog(SAVE_ERROR_TITLE, SAVE_ERROR_MESSAGE + source.getName());
- }
- });
- }
- /**
- * Save the viewer's contents into the provided resource.
- */
- public void doSaveAs() {
- if(clientSite == null)
- return;
- WorkspaceModifyOperation op = saveNewFileOperation();
- Shell shell = clientSite.getShell();
- try {
- new ProgressMonitorDialog(shell).run(false, true, op);
- } catch (InterruptedException interrupt) {
- //Nothing to reset so do nothing
- } catch (InvocationTargetException invocationException) {
- MessageDialog.openError(
- shell,
- RENAME_ERROR_TITLE,
- invocationException.getTargetException().getMessage());
- }
-
- }
- /**
- * Answer self's client site
- *
- * @return org.eclipse.swt.ole.win32.OleClientSite
- */
- public OleClientSite getClientSite() {
- return clientSite;
- }
- /**
- * Answer the file system representation of self's input element
- *
- * @return java.io.File
- */
- public File getSourceFile() {
- return source;
- }
- /* (non-Javadoc)
- * Sets the cursor and selection state for this editor to the passage defined
- * by the given marker.
- *
- * @see IEditorPart
- */
- public void gotoMarker(IMarker marker) {
- }
-
- private void handleWord() {
- OleAutomation dispInterface = new OleAutomation(clientSite);
- // Get Application
- int[] appId = dispInterface.getIDsOfNames(new String[]{"Application"});
- if (appId != null) {
- Variant pVarResult = dispInterface.getProperty(appId[0]);
- if (pVarResult != null) {
- OleAutomation application = pVarResult.getAutomation();
- int[] dispid = application.getIDsOfNames(new String[] {"DisplayScrollBars"});
- if (dispid != null) {
- Variant rgvarg = new Variant(true);
- boolean result = application.setProperty(dispid[0], rgvarg);
- }
- application.dispose();
- }
- }
- dispInterface.dispose();
- }
-
- /* (non-Javadoc)
- * Initializes the editor when created from scratch.
- *
- * This method is called soon after part construction and marks
- * the start of the extension lifecycle. At the end of the
- * extension lifecycle <code>shutdown</code> will be invoked
- * to terminate the lifecycle.
- *
- * @param container an interface for communication with the part container
- * @param input The initial input element for the editor. In most cases
- * it is an <code>IFile</code> but other types are acceptable.
- * @see IWorkbenchPart#shutdown
- */
- public void init(IEditorSite site, IEditorInput input)
- throws PartInitException {
- // Check input.
- if (!(input instanceof IFileEditorInput))
- throw new PartInitException(
- WorkbenchMessages.format("OleEditor.invalidInput", new Object[] { input })); //$NON-NLS-1$
- //$NON-NLS-1$
-
- // Save input.
- setSite(site);
- setInput(input);
-
- // Update titles.
- setTitle(input.getName());
- setTitleToolTip(input.getToolTipText());
- ImageDescriptor desc = input.getImageDescriptor();
- if (desc != null) {
- oleTitleImage = desc.createImage();
- setTitleImage(oleTitleImage);
- }
-
- // Listen for part activation.
- site.getPage().addPartListener(partListener);
-
- }
- /**
- * Initialize the workbench menus for proper merging
- */
- protected void initializeWorkbenchMenus() {
- //If there was an OLE Error or nothing has been created yet
- if (clientFrame == null || clientFrame.isDisposed())
- return;
- // Get the browser menubar. If one does not exist then
- // create it.
- Shell shell = clientFrame.getShell();
- Menu menuBar = shell.getMenuBar();
- if (menuBar == null) {
- menuBar = new Menu(shell, SWT.BAR);
- shell.setMenuBar(menuBar);
- }
-
- // Swap the file and window menus.
- MenuItem[] windowMenu = new MenuItem[1];
- MenuItem[] fileMenu = new MenuItem[1];
- Vector containerItems = new Vector();
-
- IWorkbenchWindow window = getSite().getWorkbenchWindow();
-
- for (int i = 0; i < menuBar.getItemCount(); i++) {
- MenuItem item = menuBar.getItem(i);
- String id = ""; //$NON-NLS-1$
- if (item.getData() instanceof IMenuManager)
- id = ((IMenuManager) item.getData()).getId();
- if (id.equals(IWorkbenchActionConstants.M_FILE))
- fileMenu[0] = item;
- else if (id.equals(IWorkbenchActionConstants.M_WINDOW))
- windowMenu[0] = item;
- else {
- if (window.isApplicationMenu(id)) {
- containerItems.addElement(item);
- }
- }
- }
- MenuItem[] containerMenu = new MenuItem[containerItems.size()];
- containerItems.copyInto(containerMenu);
- clientFrame.setFileMenus(fileMenu);
- clientFrame.setContainerMenus(containerMenu);
- clientFrame.setWindowMenus(windowMenu);
- }
- /* (non-Javadoc)
- * Returns whether the contents of this editor have changed since the last save
- * operation. As this is an external editor and we have no way of knowing return true
- * if there is something to save to.
- *
- * @see IEditorPart
- */
- public boolean isDirty() {
- /*Return only if we have a clientSite which is dirty
- as this can be asked before anything is opened*/
- return this.clientSite != null;
- }
- /* (non-Javadoc)
- * Returns whether the "save as" operation is supported by this editor. We assume we
- * can always save a file whether it will be via OLE or not.
- *
- * @see IEditorPart
- */
- public boolean isSaveAsAllowed() {
- return true;
- }
- /**
- * Since we don't know when a change has been made, always answer true
- */
- public boolean isSaveNeeded() {
- //Answer false if it was not opened and true only if it is dirty
- return getClientSite() != null && isDirty();
- }
- /**
- * Save the supplied file using the SWT API.
- * @param file java.io.File
- */
- private boolean saveFile(File file) {
-
- File tempFile = new File(file.getAbsolutePath() + ".tmp"); //$NON-NLS-1$
- file.renameTo(tempFile);
- boolean saved = false;
- if (OLE.isOleFile(file) || usesStorageFiles(clientSite.getProgramID())) {
- saved = clientSite.save(file, true);
- } else {
- saved = clientSite.save(file, false);
- }
-
- if (saved) {
- // save was successful so discard the backup
- tempFile.delete();
- return true;
- } else {
- // save failed so restore the backup
- tempFile.renameTo(file);
- return false;
- }
- }
- /**
- * Save the new File using the client site.
- */
- private WorkspaceModifyOperation saveNewFileOperation() {
-
- return new WorkspaceModifyOperation() {
- public void execute(final IProgressMonitor monitor) throws CoreException {
- SaveAsDialog dialog = new SaveAsDialog(clientFrame.getShell());
- IFileEditorInput input = (IFileEditorInput)getEditorInput();
- IFile sFile = input.getFile();
- dialog.setOriginalFile(sFile);
- dialog.open();
-
- IPath newPath = dialog.getResult();
- if(newPath == null)
- return;
-
- if (dialog.getReturnCode() == dialog.OK) {
- String projectName = newPath.segment(0);
- newPath = newPath.removeFirstSegments(1);
- IProject project = resource.getWorkspace().getRoot().getProject(projectName);
- newPath = project.getLocation().append(newPath);
- File newFile = newPath.toFile();
- if (saveFile(newFile)) {
- IFile newResource = resource.getWorkspace().getRoot().getFileForLocation(newPath);
- if (newResource != null) {
- sourceChanged(newResource);
- newResource.refreshLocal(IResource.DEPTH_ZERO, monitor);
- }
- } else {
- displayErrorDialog(SAVE_ERROR_TITLE, SAVE_ERROR_MESSAGE + newFile.getName());
- return;
- }
- }
- }
- };
-
- }
- /**
- * Asks the part to take focus within the workbench.
- */
- public void setFocus() {}
-
- /**
- * Make ole active so that the controls are rendered.
- */
- private void oleActivate() {
- //If there was an OLE Error or nothing has been created yet
- if (clientSite == null || clientFrame == null || clientFrame.isDisposed())
- return;
-
- if (!oleActivated) {
- clientSite.doVerb(OLE.OLEIVERB_SHOW);
- oleActivated = true;
- String progId = clientSite.getProgramID();
- if (progId != null && progId.startsWith("Word.Document")) { //$NON-NLS-1$
- handleWord();
- }
- }
- }
-
- /**
- * Set the file resource that this object is displaying
- */
- protected void setResource(IFile file) {
- resource = file;
- source = new File(file.getLocation().toOSString());
- }
- /**
- * See if it is one of the known types that use OLE Storage.
- */
- private static boolean usesStorageFiles(String progID) {
- return (progID != null && (progID.startsWith("Word.", 0) //$NON-NLS-1$
- || progID.startsWith("MSGraph", 0) //$NON-NLS-1$
- || progID.startsWith("PowerPoint", 0) //$NON-NLS-1$
- || progID.startsWith("Excel", 0))); //$NON-NLS-1$
- }
-
- /**
- * The source has changed to the newFile. Update
- * editors and set any required flags
- */
- private void sourceChanged(IFile newFile) {
-
- FileEditorInput newInput = new FileEditorInput(newFile);
- setInput(newInput);
- setResource(newFile);
- sourceChanged = true;
- setTitle(newInput.getName());
-
- }
-
- /*
- * See IEditorPart.isSaveOnCloseNeeded()
- */
- public boolean isSaveOnCloseNeeded() {
- return !sourceDeleted && super.isSaveOnCloseNeeded();
- }
-
- /**
- * Posts the update code "behind" the running operation.
- *
- * @param runnable the update code
- */
- private void update(Runnable runnable) {
- IWorkbench workbench = PlatformUI.getWorkbench();
- IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
- if (windows != null && windows.length > 0) {
- Display display = windows[0].getShell().getDisplay();
- display.asyncExec(runnable);
- } else
- runnable.run();
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/.classpath b/bundles/org.eclipse.ui.workbench/.classpath
deleted file mode 100644
index 162c7f9..0000000
--- a/bundles/org.eclipse.ui.workbench/.classpath
+++ /dev/null
@@ -1,16 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="extensions"/>
- <classpathentry kind="src" path="Eclipse UI/"/>
- <classpathentry kind="src" path="Eclipse UI Editor Support/"/>
- <classpathentry kind="src" path="/org.apache.xerces"/>
- <classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry kind="src" path="/org.eclipse.update.core"/>
- <classpathentry kind="src" path="/org.eclipse.help"/>
- <classpathentry kind="src" path="/org.eclipse.jface"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="src" path="/org.eclipse.core.boot"/>
- <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
- <classpathentry kind="src" path="/org.eclipse.jface.text"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/bundles/org.eclipse.ui.workbench/.cvsignore b/bundles/org.eclipse.ui.workbench/.cvsignore
deleted file mode 100644
index c5e82d7..0000000
--- a/bundles/org.eclipse.ui.workbench/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/.project b/bundles/org.eclipse.ui.workbench/.project
deleted file mode 100644
index 67e31dd..0000000
--- a/bundles/org.eclipse.ui.workbench/.project
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.workbench</name>
- <comment></comment>
- <projects>
- <project>org.apache.xerces</project>
- <project>org.eclipse.core.boot</project>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.help</project>
- <project>org.eclipse.jface</project>
- <project>org.eclipse.jface.text</project>
- <project>org.eclipse.update.core</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
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
deleted file mode 100644
index 58f48fe..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI Editor Support/org/eclipse/ui/internal/editorsupport/ComponentSupport.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.ui.internal.editorsupport;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.ui.*;
-import org.eclipse.swt.SWT;
-/**
- * This class provides an OS independent interface to the
- * components available on the platform
- */
-public final class ComponentSupport {
- /**
- * Return the default component Editor.
- * <p>
- * Check if we are on Win32 - if so then return an OLEEditor, if not return
- * null.
- * @see ComponentSupport
- */
- public static IEditorPart getComponentEditor() {
- if (SWT.getPlatform().equals("win32")) { //$NON-NLS-1$
- return getOleEditor();
- }
- return null;
- }
- /**
- * Return Component Editor associated with the file input
- * is to be opened on. Only return one if in Win32.
- * <p>
- * @param IFile the input on which the componenet editor
- * @return IEditorPart or <code>null</code> if no editor exists
- * @see ComponentSupport
- */
- public static IEditorPart getComponentEditor(IFile input) {
- if ((SWT.getPlatform().equals("win32"))
- && testForOleEditor(input)) { //$NON-NLS-1$
- return getOleEditor();
- }
- return null;
- }
- /**
- * Get a new OLEEditor
- * @return IEditorPart
- */
- private static IEditorPart getOleEditor() {
- try {
- Class oleEditorClass =
- Class.forName("org.eclipse.ui.internal.editorsupport.win32.OleEditor");
- return (IEditorPart) oleEditorClass.newInstance();
- } catch (ClassNotFoundException exception) {
- return null;
- }
- catch (IllegalAccessException exception) {
- return null;
- }
- catch (InstantiationException exception) {
- return null;
- }
- }
-
- public static boolean testForOleEditor(IFile input) {
- String strName = input.getName();
- int nDot = strName.lastIndexOf('.');
- if (nDot >= 0) {
- try {
- strName = strName.substring(nDot);
- Class oleClass = Class.forName("org.eclipse.swt.ole.win32.OLE");
- Method findMethod =
- oleClass.getDeclaredMethod("findProgramID", new Class[] { String.class });
- strName = (String) findMethod.invoke(null, new Object[] { strName });
- if (strName.length() > 0)
- 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;
- }
-
- }
- return false;
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index ffca33a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionBars.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-
-/**
- * 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>
- * In a workbench window there 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
- * 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
- * <code>org.eclipse.ui.IWorkbenchActionConstants</code>.
- * </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
- * 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>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-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>
- */
-public 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
- */
-public 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
- */
-public IMenuManager getMenuManager();
-/**
- * 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.
- * </p>
- *
- * @return the status line manager
- */
-public 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
- */
-public 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
- */
-public 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 should call this method to propagated the changes throughout
- * the workbench.
- * </p>
- */
-public void updateActionBars();
-}
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
deleted file mode 100644
index 00e1cea..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegate.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.IAction;
-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
- * real work.
- * </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>
- * An action delegates cannot be consulted about selection changes before the
- * action is performed because it does not exist. For this reason, control
- * of 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>
- */
-public interface IActionDelegate {
-/**
- * Performs this action.
- * <p>
- * This method is called when the delegating action has been triggered.
- * Implement this method to do the actual work.
- * </p>
- *
- * @param action the action proxy that handles the presentation portion of the
- * action
- */
-public 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>
- *
- * @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.
- */
-public void selectionChanged(IAction action, ISelection selection);
-}
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
deleted file mode 100644
index f13d9c1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionDelegateWithEvent.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-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>.
- * <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).
- * <p>
- * NOTE: This is experimental API, which may change in the future.
- *
- * @since 2.0
- */
-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>
- * NOTE: This is experimental API, which may change in the future.
- *
- * @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
- */
-public 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
deleted file mode 100644
index c4ed14e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IActionFilter.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * 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.
- * </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.
- * </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.
- * </p>
- * <p>
- * The attribute names for <code>IResource, IMarker and IProject</code> are defined
- * in <code>IResourceActionFilter, IMarkerActionFilter, and IProjectActionFilter</code>.
- * </p>
- *
- * @see IAdaptable
- * @see IResourceActionFilter
- * @see IMarkerActionFilter
- * @see IProjectActionFilter
- */
-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 attriute value
- * @return <code>true</code> if the attribute matches; <code>false</code> otherwise
- */
-public boolean testAttribute(Object target, String name, String value);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ICapabilityInstallWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ICapabilityInstallWizard.java
deleted file mode 100644
index 6828408..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ICapabilityInstallWizard.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.ui;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
-
-/**
- * Interface for project capability install wizard. The wizard is
- * responsible for collecting any necessary information from the
- * user and adding this capability's nature along with all other
- * natures from capabilities this capability handles the UI for.
- * <p>
- * The install wizard must only add natures that represent the
- * capability and any capabilities it handles the UI for. The
- * install wizard must handle the situation where some or all
- * of the required capabilites are already installed.
- * </p><p>
- * The <code>IProject</code> passed in the init method will exist
- * and can be queried for the existance of other natures. The
- * install wizard must <b>not</b> close nor delete the project
- * passed in the init method. The install wizard must <b>not</b>
- * rename the project passed in the init method.
- * </p><p>
- * The install wizard can change the location of the project if
- * required, but must inform the user of this action.
- * </p><p>
- * Clients should implement this interface and include the name of their class
- * in an extension contributed to the workbench's capabilities wizard extension point
- * (named <code>"org.eclipse.ui.capabilities"</code>).
- * </p>
- *
- * @see org.eclipse.jface.wizard.IWizard
- * @see org.eclipse.ui.ICapabilityUninstallWizard
- * @since 2.0
- */
-public interface ICapabilityInstallWizard extends IWizard {
-
- /**
- * Initializes this capability wizard using the passed workbench,
- * object selection, and project.
- * <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
- * @param project the project to configure with a capability
- */
- public void init(IWorkbench workbench, IStructuredSelection selection, IProject project);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ICapabilityUninstallWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ICapabilityUninstallWizard.java
deleted file mode 100644
index 114e0c5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ICapabilityUninstallWizard.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.ui;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
-
-/**
- * Interface for project capability uninstall wizard. The wizard is
- * responsible for collecting any necessary information from the
- * user and removing this capability's nature. Also must remove natures
- * from capabilities that the user wants removed - capabilites that this
- * capability handles the UI for. These other capabilities that the user
- * wants removed will be provided in the <code>init</code> method.
- * <p>
- * The uninstall wizard must only remove natures that are passed in
- * its <code>init</code> method.
- * </p><p>
- * The <code>IProject</code> passed in the init method will exist
- * and can be queried for the existance of other natures. The
- * uninstall wizard must <b>not</b> close nor delete the project
- * passed in the <code>init</code> method. The install wizard must
- * <b>not</b> rename the project passed in the <code>init</code> method.
- * </p><p>
- * The uninstall wizard can change the location of the project if
- * required, but must inform the user of this action.
- * </p><p>
- * Clients should implement this interface and include the name of their class
- * in an extension contributed to the workbench's capabilities wizard extension point
- * (named <code>"org.eclipse.ui.capabilities"</code>).
- * </p>
- *
- * @see org.eclipse.jface.wizard.IWizard
- * @see org.eclipse.ui.ICapabilityInstallWizard
- * @since 2.0
- */
-public interface ICapabilityUninstallWizard extends IWizard {
-
- /**
- * Initializes this capability wizard using the passed workbench,
- * object selection, project, and nature IDs.
- * <p>
- * This method is called after the no argument constructor and
- * before other methods are called.
- * </p><p>
- * The list of nature IDs contains the nature ID for this
- * capability. Also includes nature IDs for capabilities that
- * the user wants removed - capabilites that this capability
- * handles the UI for.
- * </p>
- *
- * @param workbench the current workbench
- * @param selection the current object selection
- * @param project the project to configure with a capability
- * @param natureIds the nature ids to be removed from the project
- */
- public void init(IWorkbench workbench, IStructuredSelection selection, IProject project, String[] natureIds);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ICapabilityWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ICapabilityWizard.java
deleted file mode 100644
index 753b578..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ICapabilityWizard.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.ui;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
-
-/**
- * Interface for project capability configuration wizards.
- * <p>
- * Clients should implement this interface and include the name of their class
- * in an extension contributed to the workbench's capabilities wizard extension point
- * (named <code>"org.eclipse.ui.capabilities"</code>).
- * </p>
- *
- * @see org.eclipse.jface.wizard.IWizard
- * @see org.eclipse.ui.ICapabilityInstallWizard
- * @since 2.0
- * @deprecated use ICapabilityInstallWizard instead. This interface
- * will be deleted for M6 milestone build.
- */
-public interface ICapabilityWizard extends ICapabilityInstallWizard {
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IContributorResourceAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IContributorResourceAdapter.java
deleted file mode 100644
index 397332b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IContributorResourceAdapter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * The IContributorResourceAdapter is an interface that defines
- * the API required to get a resource that an object adapts to
- * for use of object contributions, decorators and property
- * pages that have adaptable = true.
- * Implementors of this interface are typically registered with an
- * IAdapterFactory for lookup via the getAdapter() mechanism.
- */
-
-public interface IContributorResourceAdapter {
-
- /**
- * Return the resource that the supplied adaptable
- * adapts to. An IContributorResourceAdapter assumes
- * that any object passed to it adapts to one equivalent
- * resource.
- * @return <code>IResource</code> or <code>null</code> if there
- * is no adapted resource for this type.
- * @param IAdaptable the adaptable being queried.
- */
-
- public IResource getAdaptedResource(IAdaptable adaptable);
-
-}
-
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
deleted file mode 100644
index 1882fb1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IDecoratorManager.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.ILabelDecorator;
-
-/**
- * Manages the decorators contributed via the decorators extension point.
- * Views which allow decoration of their elements should use the label
- * decorator returned by <code>getLabelDecorator()</code>.
- */
-
-public interface IDecoratorManager {
-
- /**
- * Returns the label decorator which applies the decorations from all
- * enabled decorators.
- * Views which allow decoration of their elements should use this
- * label decorator.
- *
- * @return the label decorator
- * @see DecoratingLabelProvider
- */
- ILabelDecorator getLabelDecorator();
-
- /**
- * Returns the label decorator for the specified decorator if it
- * is enabled. Otherwise returns <code>null</code>.
- *
- * @param decoratorId the decorator id
- * @return the label decorator
- */
- ILabelDecorator getLabelDecorator(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;
-
-}
\ No newline at end of file
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
deleted file mode 100644
index 3df2f78..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionBarContributor.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A editor action bar contributor defines the actions for
- * one or more editors.
- * <p>
- * Within the workbench there may be more than one open editor of a particular
- * type. For instance, there may be 1 or more open Java Editors. To avoid the
- * creation of duplicate actions and action images the editor concept has been
- * split into two. An action contributor is responsable for the creation of
- * actions. The editor is responsible for action implementation. Furthermore,
- * the contributor is shared by each open editor. As a result of this design
- * there is only 1 set of actions for 1 or more open editors.
- * </p><p>
- * The relationship between editor and contributor is defined by
- * the <code>org.eclipse.ui.editorss</code> extension point in the plugin registry.
- * For each extension an editor class and a contributor class must be defined.
- * </p><p>
- * This interface should not be implemented directly. An implementation of this
- * interface has been created in <code>EditorActionBarContributor</code>.
- * Implementors should subclass this and specialize as required.
- * </p>
- *
- * @see org.eclipse.ui.actions.EditorActionBarContributor
- */
-public interface IEditorActionBarContributor {
-/**
- * Initializes this contributor, which is expected to add contributions as
- * required to the given action bars and global action handlers.
- * <p>
- * The page is passed to support the use of <code>RetargetAction</code> by
- * the contributor. In this case the init method implementors should:
- * </p>
- * <p><ul>
- * <li>1) set retarget actions as global action handlers</li>
- * <li>2) add the retarget actions as part listeners</li>
- * <li>3) get the active part and if not <code>null</code>
- * call partActivated on the retarget actions</li>
- * </ul></p>
- * <p>
- * And in the dispose method the retarget actions should be removed as part listeners.
- * </p>
- *
- * @param bars the action bars
- * @param page the workbench page for this contributor
- * @since 2.0
- */
-public 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
- */
-public void setActiveEditor(IEditorPart targetEditor);
-/**
- * Disposes this contributor.
- *
- * @since 2.0
- */
-public 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
deleted file mode 100644
index 27f874e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorActionDelegate.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.IAction;
-
-/**
- * Interface for an action that is contributed into an editor-activated menu or
- * tool bar. It extends <code>IActionDelegate</code> and adds a method for
- * connecting the delegate to the editor it should work with. Since there is
- * always only one action delegate per editor type, this method supplies the
- * 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
- */
-public 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
deleted file mode 100644
index c42627a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorDescriptor.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.IEditorActionBarContributor;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * Description of an editor in the workbench editor registry. The
- * editor descriptor contains the information needed to create editor instances.
- * <p>
- * An editor descriptor typically represents one of three types of editors:
- * <ul>
- * <li>a file editor extension for a specific file extension.</li>
- * <li>a file editor added by the user (via the workbench preference page)</li>
- * <li>a general editor extension which works on objects other than files.</li>
- * </ul>
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IEditorRegistry
- */
-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
- */
-public String getId();
-/**
- * Returns the descriptor of the image for this editor.
- *
- * @return the descriptor of the image to display next to this editor
- */
-public ImageDescriptor getImageDescriptor();
-/**
- * Returns the label to show for this editor.
- *
- * @return the editor label
- */
-public String getLabel();
-}
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
deleted file mode 100644
index 1641047..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorInput.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-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>.
- * <p>
- * Clients should extend this interface to declare new types of editor
- * inputs.
- * </p>
- * <p>
- * An editor input is passed to an editor via the <code>IEditorPart.init</code>
- * method. Due to the wide range of valid editor inputs, it is not possible to
- * define generic methods for getting and setting bytes. However, two subtypes
- * of <code>IEditorInput</code> have been defined for greater type clarity when
- * IStorage (<code>IStorageEditorInput</code>) and IFiles
- * (<code>IFileEditorInput</code>) are used. Any editor which is file-oriented
- * should handle these two types. The same pattern may be used to define
- * other editor input types.
- * </p>
- * <p>
- * The <code>IStorageEditorInput</code> interface is used to wrap an
- * <code>IStorage</code> object. This may represent read-only data
- * in a repository, external jar, or file system. The editor should provide
- * viewing (but not editing) functionality.
- * </p>
- * <p>
- * The <code>IFileEditorInput</code> interface is used to wrap an
- * file resource (<code>IFile</code>). The editor should provide read and write
- * functionality.
- * </p>
- * <p>
- * Editor input must implement the <code>IAdaptable</code> interface; extensions
- * are managed by the platform's adapter manager.
- * </p>
- *
- * @see IEditorPart
- * @see org.eclipse.core.resources.IFile
- * @see IStreamEditorInput
- * @see IFileEditorInput
- */
-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.
- *
- * @return <code>true</code> if the editor input exists; <code>false</code>
- * otherwise
- */
-public boolean exists();
-/**
- * Returns the image descriptor for this input.
- *
- * @return the image descriptor for this input
- */
-public ImageDescriptor getImageDescriptor();
-/**
- * Returns the name of this editor input for display purposes.
- * <p>
- * For instance, if the fully qualified input name is
- * <code>"a\b\MyFile.gif"</code>, the return value would be just
- * <code>"MyFile.gif"</code>.
- *
- * @return the name string
- */
-public String getName();
-/*
- * 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
- */
-public 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.
- * <p>
- * The format of the path will vary with each input type. For instance,
- * if the editor input is of type <code>IFileEditorInput</code> this method
- * should return the fully qualified resource path. For editor input of
- * other types it may be different.
- * </p>
- * @return the tool tip text
- */
-public String getToolTipText();
-}
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
deleted file mode 100644
index a03c7a4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorLauncher.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-
-/**
- * An editor launcher is used to launch external editors on an
- * <code>IFile</code>input.
- * <p>
- * Clients should implement this interface to define a new type of editor
- * launcher. Each new launcher must be registered as an editor in the
- * workbench's editor extension point
- * (named <code>"org.eclipse.ui.exportWizards"</code>).
- *
- * For example, the plug-in's XML markup might contain:
- * <pre>
- * <extension point = "org.eclipse.ui.editors">
- * <editor
- * id="org.eclipse.ui.SwingEditorLauncher"
- * name="Swing Editor"
- * extensions="xml"
- * launcher="org.eclipse.ui.examples.swingeditor.SwingEditorLauncher"
- * icon="icons/xml.gif">
- * </editor>
- * </extension>
- * </pre>
- * </p><p>
- * In this example a launcher has been registered for use with <code>xml</code>
- * files. Once registered, the launcher will appear in the <code>Open With</code>
- * menu for an <code>xml</code> file. If the item is invoked the workbench will
- * create an instance of the launcher class and call <code>open</code> on it,
- * passing the input file.
- * </p>
- */
-public interface IEditorLauncher{
-/**
- * Launches this external editor to edit the given file.
- *
- * @param file the file to edit
- */
-public void open(IFile file);
-}
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
deleted file mode 100644
index 0534a70..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorPart.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * An editor is a visual component within a workbench page. It is
- * typically used to edit or browse a document or input object. The input
- * is identified using an <code>IEditorInput</code>. Modifications made
- * in an editor part follow an open-save-close lifecycle model (in contrast
- * to a view part, where modifications are saved to the workbench
- * immediately).
- * <p>
- * An editor is document or input-centric. Each editor has an input, and only
- * one editor can exist for each editor input within a page. This policy has
- * been designed to simplify part management.
- * </p><p>
- * An editor should be used in place of a view whenever more than one instance
- * of a document type can exist.
- * </p><p>
- * This interface may be implemented directly. For convenience, a base
- * implementation is defined in <code>EditorPart</code>.
- * </p>
- * <p>
- * An editor part is added to the workbench in two stages:
- * <ol>
- * <li>An editor extension is contributed to the workbench registry. This
- * extension defines the extension id, extension class, and the file
- * extensions which are supported by the editor.</li>
- * <li>An editor part based upon the extension is created and added to the
- * workbench when the user opens a file with one of the supported file
- * extensions (or some other suitable form of editor input).</li>
- * </ol>
- * </p>
- * <p>
- * All editor parts implement the <code>IAdaptable</code> interface; extensions
- * are managed by the platform's adapter manager.
- * </p>
- *
- * @see IPerspective#openEditor
- * @see org.eclipse.ui.part.EditorPart
- */
-public interface IEditorPart extends IWorkbenchPart {
-
- /**
- * The property id for <code>isDirty</code>.
- */
- public static final int PROP_DIRTY = 0x101;
-
- /**
- * The property id for <code>getEditorInput</code>.
- */
- public static final int PROP_INPUT = 0x102;
-/**
- * Saves the contents of this editor.
- * <p>
- * If the save is successful, the editor should fire a property changed event
- * reflecting the new dirty state (<code>PROP_SAVE_NEEDED</code> property).
- * </p>
- * <p>
- * If the save is cancelled through user action, or for any other reason, the
- * editor should invoke <code>setCancelled</code> on the <code>monitor</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
- */
-public void doSave(IProgressMonitor monitor);
-/**
- * Saves the contents of this editor 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>ProgressMonitorDialog</code> should be used to indicate progress.
- * </p>
- * <p>
- * If the save is successful, the editor fires a property changed event
- * reflecting the new dirty state (<code>PROP_SAVE_NEEDED</code> property).
- * </p>
- */
-public void doSaveAs();
-/**
- * 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
- */
-public IEditorInput getEditorInput();
-/**
- * Returns the site for this editor. The method is equivalent to
- * <code>(IEditorSite) getSite()</code>.
- *
- * @return the editor site
- */
-public IEditorSite getEditorSite();
-/**
- * Sets the cursor and selection state for this editor to the passage defined
- * by the given marker.
- *
- * @param marker the marker
- */
-public void gotoMarker(IMarker marker);
-/**
- * Initializes this editor with the given editor site and input.
- * <p>
- * This method is automatically called shortly after part construction; 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
- */
-public void init(IEditorSite site, IEditorInput input) throws PartInitException;
-/**
- * Returns whether the contents of this editor 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>
- *
- * @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 boolean isDirty();
-/**
- * Returns whether the "save as" operation is supported by this editor.
- *
- * @return <code>true</code> if "save as" is supported, and <code>false</code>
- * if "save as" is not supported
- */
-public boolean isSaveAsAllowed();
-/**
- * Returns whether the contents of this editor should be saved when the editor
- * is closed.
- *
- * @return <code>true</code> if the contents of the editor should be saved on
- * close, and <code>false</code> if the contents are expendable
- */
-public boolean isSaveOnCloseNeeded();
-}
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
deleted file mode 100644
index 3088c9d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorReference.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.eclipse.ui;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-/**
- * Implements a reference to a editor.
- * The IEditorPart will not be instanciated until
- * the editor becomes visible or the API getEditor
- * is sent with true;
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface IEditorReference extends IWorkbenchPartReference {
- /**
- * Returns the factory id of the factory used to
- * restore this editor. Returns null if the editor
- * is not pesistable.
- */
- public String getFactoryId();
- /**
- * Returns the editor input name. May return null is the
- * name is not available or if the editor failed to be
- * restored.
- */
- public String getName();
- /**
- * Returns the IEditorPart referenced by this object.
- * Returns null if the editors was not instanciated or
- * it failed to be restored. Tries to restore the editor
- * if <code>restore</code> is true.
- */
- public IEditorPart getEditor(boolean restore);
- /**
- * Returns true if the editor is dirty otherwise returns false.
- */
- public boolean isDirty();
- /**
- * Returns true if the editor is pinned otherwise returns false.
- */
- public boolean isPinned();
-}
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
deleted file mode 100644
index bc8a6b0..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorRegistry.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * Registry of editors known to the workbench.
- * <p>
- * An editor can be created in one of two ways:
- * <ul>
- * <li>An editor can be defined by an extension to the workbench.</li>
- * <li>The user manually associates an editor with a given resource extension
- * type. This will override any default workbench or platform association.
- * </li>
- * </ul>
- * </p>
- * <p>
- * The registry does not keep track of editors that are "implicitly" determined.
- * For example a bitmap (<code>.bmp</code>) file will typically not have a
- * registered editor. Instead, when no registered editor is found, the
- * underlying OS is consulted.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IWorkbenchPlugin#getEditorRegistry
- */
-public interface IEditorRegistry {
-
- /**
- * The property id for the contents of this registry.
- */
- public static final int PROP_CONTENTS = 0x01;
-/**
- * Adds a listener for changes to properties of this registry.
- * Has no effect if an identical listener is already registered.
- * <p>
- * The properties ids are as follows:
- * <ul>
- * <li><code>PROP_CONTENTS</code>: Triggered when the file editor mappings in
- * the editor registry change.</li>
- * </ul>
- * </p>
- * <p>
- * [Issue: Check handling of identical listeners.]
- * </p>
- *
- * @param listener a property listener
- */
-public 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
- */
-public IEditorDescriptor findEditor(String editorId);
-/**
- * Returns the default editor used for all unmapped resource types.
- * There is always a default editor.
- *
- * @return the descriptor of the default editor
- */
-public IEditorDescriptor getDefaultEditor();
-/**
- * Returns the default editor for a given file name.
- * <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
- * @return the descriptor of the default editor, or <code>null</code> if not
- * found
- */
-public IEditorDescriptor getDefaultEditor(String fileName) ;
-/**
- * Returns the default editor for a given file.
- * <p>
- * A default editor id may be registered for a specific file using
- * <code>setDefaultEditor</code>. If the given file has a registered
- * default editor id the default editor will derived from it. If not,
- * the default editor is determined by taking the file extension for the
- * file and obtaining the default editor for that extension.
- * </p>
- *
- * @param file the file
- * @return the descriptor of the default editor, or <code>null</code> if not
- * found
- */
-public IEditorDescriptor getDefaultEditor(IFile file) ;
-/**
- * Returns the list of file editors registered to work against the file
- * with the given file name.
- * <p>
- * Note: Use <code>getDefaultEditor</code> if you only the need the default
- * editor rather than all candidate editors.
- * </p>
- *
- * @param filename the file name
- * @return a list of editor descriptors
- */
-public IEditorDescriptor[] getEditors(String filename) ;
-/**
- * Returns the list of file editors registered to work against the given
- * file.
- * <p>
- * Note: Use <code>getDefaultEditor</code> if you only the need the default
- * editor rather than all candidate editors.
- * </p><p>
- * This is a convenience method for use with <code>IFile</code>'s.
- * </p>
- *
- * @param file the file
- * @return a list of editor descriptors
- */
-public IEditorDescriptor[] getEditors(IFile file) ;
-/**
- * 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
- */
-public IFileEditorMapping[] getFileEditorMappings();
-/**
- * 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.
- * </p>
- *
- * @param filename the file name
- * @return the descriptor of the image to display next to the file
- */
-public 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.
- * </p><p>
- * This is a convenience method for use with <code>IFile</code>'s.
- * </p>
- *
- * @param file the file
- * @return the descriptor of the image to display next to the given file
- */
-public ImageDescriptor getImageDescriptor(IFile file);
-/**
- * Removes the given property listener from this registry.
- * Has no affect if an identical listener is not registered.
- * <p>
- * [Issue: Check handling of identical listeners.]
- * </p>
- *
- * @param listener a property listener
- */
-public void removePropertyListener(IPropertyListener listener);
-/**
- * Sets the default editor id for a given file. This value will be used
- * to determine the default editor descriptor for the file in future calls to
- * <code>getDefaultEditor(IFile)</code>.
- *
- * @param file the file
- * @param editorId the editor id
- */
-public void setDefaultEditor(IFile file, String editorId);
-/**
- * Sets the default editor id for a 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 fileNamePattern the file name or pattern (e.g. "*.xml");
- * @param editorId the editor id
- */
-public void setDefaultEditor(String fileNameOrExtension, String editorId);
-}
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
deleted file mode 100644
index 7d3b8ae..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IEditorSite.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * The primary interface between an editor part and the outside world.
- * <p>
- * The workbench exposes its implemention of editor part sites via this
- * interface, which is not intended to be implemented or extended by clients.
- * </p>
- */
-public interface IEditorSite extends IWorkbenchPartSite {
-/**
- * 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, or <code>null</code> if none exists
- */
-public IEditorActionBarContributor getActionBarContributor();
-}
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
deleted file mode 100644
index e671312..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IElementFactory.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * A factory for re-creating objects from a previously saved memento.
- * <p>
- * Clients should implement this interface and include the name of their class
- * in an extension to the platform extension point named
- * <code>"org.eclipse.ui.elementFactories"</code>.
- * For example, the plug-in's XML markup might contain:
- * <pre>
- * <extension point="org.eclipse.ui.elementFactories">
- * <factory id="com.example.myplugin.MyFactory" class="com.example.myplugin.MyFactory" />
- * </extension>
- * </pre>
- * </p>
- *
- * @see IPersistableElement
- * @see IMemento
- */
-public interface IElementFactory {
-/**
- * Re-creates and returns an object from the state captured within the given
- * memento.
- * <p>
- * Under normal circumstances, the resulting object can be expected to be
- * persistable; that is,
- * <pre>
- * result.getAdapter(org.eclipse.ui.IPersistableElement.class)
- * </pre>
- * should not return <code>null</code>.
- * </p>
- *
- * @param memento a memento containing the state for the object
- * @return an object, or <code>null</code> if the element could not be created
- */
-public IAdaptable createElement(IMemento memento);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IExportWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IExportWizard.java
deleted file mode 100644
index 70393e3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IExportWizard.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Interface for export wizards.
- * <p>
- * Clients should implement this interface and include the name of their class
- * in a wizard contributed to the workbench's export wizard extension point
- * (named <code>"org.eclipse.ui.exportWizards"</code>).
- * For example, the plug-in's XML markup might contain:
- * <pre>
- * <extension point="org.eclipse.ui.exportWizards">
- * <wizard
- * id="com.example.myplugin.blob"
- * name="Blob File"
- * class="com.example.myplugin.BlobFileExporter"
- * icon="icons/export_blob_wiz.gif">
- * <description>Export resources to a BLOB file</description>
- * <selection class="org.eclipse.core.resources.IResource" />
- * </wizard>
- * </extension>
- * </pre>
- * </p>
-*
- * @see org.eclipse.jface.wizard.IWizard
- */
-public interface IExportWizard extends IWorkbenchWizard {
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFileEditorInput.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFileEditorInput.java
deleted file mode 100644
index c2b183a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFileEditorInput.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-
-/**
- * This interface defines a file-oriented input to an editor.
- * <p>
- * File-oriented editors should support this as a valid input type, and allow
- * full read-write editing of its content.
- * </p><p>
- * A default implementation of this interface is provided by
- * org.eclipse.ui.part.FileEditorInput.
- * </p><p>
- * All editor inputs must implement the <code>IAdaptable</code> interface;
- * extensions are managed by the platform's adapter manager.
- * </p>
- *
- * @see org.eclipse.core.resources.IFile
- */
-public interface IFileEditorInput extends IStorageEditorInput {
-/**
- * Returns the file resource underlying this editor input.
- *
- * @return the underlying file
- */
-public IFile getFile();
-}
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
deleted file mode 100644
index 6c36b28..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFileEditorMapping.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-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*)
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IEditorRegistry#getFileEditorMappings
- */
-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
- */
-public IEditorDescriptor getDefaultEditor();
-/**
- * Returns the list of editors registered for this type mapping.
- *
- * @return a possibly empty list of editors
- */
-public 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
- */
-public IEditorDescriptor[] getDeletedEditors();
-/**
- * Returns the file's extension for this type mapping.
- *
- * @return the extension for this mapping
- */
-public 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
- */
-public ImageDescriptor getImageDescriptor() ;
-/**
- * Returns the label to use for this mapping.
- * Labels have the form "<it>name</it>.<it>extension</it>".
- *
- * @return the label to use for this mapping
- */
-public String getLabel();
-/**
- * Returns the file's name for this type mapping.
- *
- * @return the name for this mapping
- */
-public 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
deleted file mode 100644
index 16d7ebc..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IFolderLayout.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.ui;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-
-/**
- * An <code>IFolderLayout</code> is used to define the initial pages within a folder.
- * The folder itself is component within an <code>IPageLayout</code>.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IPageLayout#createFolder
- */
-public interface IFolderLayout extends IPlaceholderFolderLayout {
-/**
- * Adds a view with the given id to this folder.
- * The 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
- */
-public void addView(String viewId);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IImportWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IImportWizard.java
deleted file mode 100644
index 59c7c19..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IImportWizard.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Interface for import wizards.
- * <p>
- * Clients should implement this interface and include the name of their class
- * in a wizard contributed to the workbench's import wizard extension point
- * (named <code>"org.eclipse.ui.importWizards"</code>).
- * For example, the plug-in's XML markup might contain:
- * <pre>
- * <extension point="org.eclipse.ui.importWizards">
- * <wizard
- * id="com.example.myplugin.blob"
- * name="Blob File"
- * class="com.example.myplugin.BlobFileImporter"
- * icon="icons/import_blob_wiz.gif">
- * <description>Import resources from a BLOB file</description>
- * <selection class="org.eclipse.core.resources.IResource" />
- * </wizard>
- * </extension>
- * </pre>
- * </p>
- *
- * @see org.eclipse.jface.wizard.IWizard
- */
-public interface IImportWizard extends IWorkbenchWizard {
-}
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
deleted file mode 100644
index 4a68321..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IKeyBindingService.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.ui;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.IAction;
-import org.eclipse.swt.events.KeyEvent;
-
-/**
- * The key binding service is responsible for invoking an action
- * when the action's sequence of accelerator keys is pressed. The
- * accelerator key sequence assigned to an action is defined by the
- * extension point <code>org.eclipse.ui.acceleratorSets</code> and the
- * active accelerator configuration choosen by the user.
- * <p>
- * A participating workbench part is responsible to register all
- * its actions with the service. The part is also responsible to
- * set the current scope.
- * </p><p>
- * This interface is not intended to be implemented or extended
- * by clients.
- * </p>
- * @since 2.0
- */
-public interface IKeyBindingService {
-
- /**
- * Returns the active accelerator scope ids.
- *
- * @return the active accelerator scope ids.
- */
- String[] getScopeIds();
-
- /**
- * Sets the active accelerator scope ids.
- *
- * @param ids the active accelerator scope ids.
- */
- void setScopeIds(String[] scopeIds)
- throws IllegalArgumentException;
-
- /**
- * Registers an action with the key binding service.
- *
- * @param action the action to be registered with the key binding service.
- */
- void registerAction(IAction action)
- throws IllegalArgumentException;
-
- /**
- * Unregisters an action with the key binding service.
- *
- * @param action the action to be unregistered with the key binding service.
- */
- void unregisterAction(IAction action)
- throws IllegalArgumentException;
-
- /**
- * Returns the id of the active accelerator configuration.
- *
- * @return the id of the active accelerator configuration
- * @deprecated
- */
- String getActiveAcceleratorConfigurationId();
-
- /**
- * Returns the id of the active accelerator scope.
- *
- * @return the id of the active accelerator scope
- * @deprecated
- */
- String getActiveAcceleratorScopeId();
-
- /**
- * Sets the active accelerator scope id.
- *
- * @param scopeId the new accelerator scope id
- * @deprecated
- */
- void setActiveAcceleratorScopeId(String scopeId)
- throws IllegalArgumentException;
-
- /**
- * To be called by an editor upon receiving a key event from its SWT
- * text widget. The key binding service invokes the corresponding action
- * if the key is mapped to an action. The key binding service may also
- * invoke a mode, if the key is the first key in a (multi-key) accelerator
- * key sequence of a registered action. If either of these cases occurs,
- * processKey() returns true. If neither of these cases occurs, nothing
- * happens and processKey() returns false.
- *
- * @param event The key to be processed
- * @return true if the key was consumed by the key binding service,
- * false if the editor is free to consume the key
- * @deprecated
- */
- boolean processKey(KeyEvent event);
-
- /**
- * Enables or Disables this service. The default is false. Registered accelerators
- * have no efect until the service is enabled;
- *
- * @deprecated
- */
- void enable(boolean enable);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerActionFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerActionFilter.java
deleted file mode 100644
index ca2b173..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerActionFilter.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Describes the public attributes for a marker and the acceptables values
- * each may have.
- * <p>
- * A popup menu extension may use these constants to describe its object target.
- * Each identifies an attribute name or possible value.
- * <p>
- * Clients are not expected to implement this interface.
- * </p>
- *
- * @see IActionFilter
- */
-public interface IMarkerActionFilter extends IActionFilter {
- /**
- * An attribute indicating the marker type (value <code>"type"</code>).
- * The attribute value in xml should match one of the marker types defined in
- * the workbench's marker extension point. Common examples are
- * <code>IMarker.TASK, IMarker.BOOKMARK, and IMarker.MARKER</code>.
- */
- public static final String TYPE = "type"; //$NON-NLS-1$
-
- /**
- * An attribute indicating the marker super type (value <code>"superType"</code>).
- * The attribute value in xml should match one of the marker types defined in
- * the workbench's marker extension point. Common examples are
- * <code>IMarker.TASK, IMarker.BOOKMARK, and IMarker.MARKER</code>.
- */
- public static final String SUPER_TYPE = "superType"; //$NON-NLS-1$
-
- /**
- * An attribute indicating the marker priority (value <code>"priority"</code>).
- * The attribute value in xml must be one of <code>IMarker.PRIORITY_LOW,
- * IMarker.PRIORITY_NORMAL, or IMarker.PRIORITY_HIGH</code>
- */
- public static final String PRIORITY = "priority"; //$NON-NLS-1$
-
- /**
- * An attribute indicating the marker severity (value <code>"severity"</code>).
- * The attribute value in xml in xml must be one of <code>IMarker.SEVERITY_ERROR,
- * IMarker.SEVERITY_WARNING, or IMarker.SEVERITY_INFO</code>
- */
- public static final String SEVERITY = "severity"; //$NON-NLS-1$
-
- /**
- * An attribute indicating whether the marker is considered done (value
- * <code>"done"</code>).
- * The attribute value in xml must be one of <code>"true" or "false"</code>.
- */
- public static final String DONE = "done"; //$NON-NLS-1$
-
- /**
- * An attribute indicating the marker message (value <code>"message"</code>).
- * The attribute value in xml is unconstrained. "*" may be used at the start or
- * the end to represent "one or more characters".
- */
- public static final String MESSAGE = "message"; //$NON-NLS-1$
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerHelpRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerHelpRegistry.java
deleted file mode 100644
index 1c0a635..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerHelpRegistry.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.ui;
-
-import org.eclipse.core.resources.IMarker;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Registry of F1 help contexts and resolutions for markers.
- * <p>
- * The information contained in the registry is read from the
- * org.eclipse.ui.markerhelp and org.eclipse.ui.markerresolution
- * extension points.
- * </p>
- *
- * @since 2.0
- */
-public interface IMarkerHelpRegistry {
- /**
- * Returns a help context id for the given marker or
- * <code>null</code> if no help has been registered
- * for the marker.
- *
- * @param marker the marker for which to obtain help
- * @since 2.0
- */
- public String getHelp(IMarker marker);
- /**
- * Returns <code>false</code> if there are no resolutions for
- * the given marker. Returns <code>true</code> if their may
- * be resolutions. In most cases a <code>true</code> value
- * means there are resolutions but due to plugin loading
- * issues getResolutions may sometimes return an empty array
- * after this method returns <code>true</code>.
- *
- * @param marker the marker for which to determine if there
- * are resolutions
- * @since 2.0
- */
- public boolean hasResolutions(IMarker marker);
- /**
- * Returns an array of resolutions for the given marker.
- * The returned array will be empty if there are no resolutions
- * for the marker.
- *
- * @param marker the marker for which to obtain resolutions
- * @since 2.0
- */
- public IMarkerResolution[] getResolutions(IMarker marker);
-}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerResolution.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerResolution.java
deleted file mode 100644
index 9a15261..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerResolution.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IMarker;
-
-/**
- * Resolution for a marker. When run, a resolution would
- * typically eliminate the need for the marker.
- *
- * @since 2.0
- */
-public interface IMarkerResolution {
- /**
- * Returns a short label indicating what the resolution will do.
- *
- * @return a short label for this resolution
- */
- public String getLabel();
-
- /**
- * Runs this resolution.
- *
- * @param marker the marker to resolve
- */
- public void run(IMarker marker);
-}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerResolutionGenerator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerResolutionGenerator.java
deleted file mode 100644
index 7f7821f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMarkerResolutionGenerator.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IMarker;
-
-/**
- * Creates resolutions for a given marker.
- * When run, a resolution would typically eliminate
- * the need for the marker.
- *
- * @since 2.0
- */
-public interface IMarkerResolutionGenerator {
- /**
- * Returns resolutions for the given marker (may
- * be empty).
- *
- * @return resolutions for the given marker
- */
- public IMarkerResolution[] getResolutions(IMarker marker);
-}
-
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
deleted file mode 100644
index f735426..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IMemento.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.eclipse.ui;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-/**
- * Interface to a memento used for saving the important state of an object
- * in a form that can be persisted in the file system.
- * <p>
- * Mementos were designed with the following requirements in mind:
- * <ol>
- * <li>Certain objects need to be saved and restored across platform sessions.
- * </li>
- * <li>When an object is restored, an appropriate class for an object might not
- * be available. It must be possible to skip an object in this case.</li>
- * <li>When an object is restored, the appropriate class for the object may be
- * different from the one when the object was originally saved. If so, the
- * new class should still be able to read the old form of the data.</li>
- * </ol>
- * </p>
- * <p>
- * Mementos meet these requirements by providing support for storing a
- * mapping of arbitrary string keys to primitive values, and by allowing
- * mementos to have other mementos as children (arranged into a tree).
- * A robust external storage format based on XML is used.
- * </p><p>
- * The key for an attribute may be any alpha numeric value. However, the
- * value of <code>TAG_ID</code> is reserved for internal use.
- * </p><p>
- * This interface is not intended to be implemented or extended by clients.
- * </p>
- *
- * @see IPersistableElement
- * @see IElementFactory
- */
-public interface IMemento {
- /**
- * Special reserved key used to store the memento id
- * (value <code>"org.eclipse.ui.id"</code>).
- *
- * @see #getId
- */
- public static final 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
- */
-public 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
- */
-public 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
- */
-public IMemento getChild(String type);
-/**
- * Returns all children with the given type id.
- *
- * @param type the type id
- * @return the list of children with the given type
- */
-public 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
- */
-public Float getFloat(String key);
-/**
- * Returns the id for this memento.
- * <p>
- * [Issue: For consistency, rename to "getId".]
- * </p>
- *
- * @return the memento id, or <code>null</code> if none
- * @see #createChild(java.lang.String,java.lang.String)
- */
-public 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
- */
-public 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 or was found
- * but was not an integer
- */
-public String getString(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
- */
-public String getTextData();
-/**
- * Sets the value of the given key to the given floating point number.
- *
- * @param key the key
- * @param value the value
- */
-public 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
- */
-public 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.
- */
-public void putMemento(IMemento memento);
-/**
- * Sets the value of the given key to the given string.
- *
- * @param key the key
- * @param value the value
- */
-public void putString(String key, String 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
- */
-public 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
deleted file mode 100644
index fc12ae7..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationHistory.java
+++ /dev/null
Binary files differ
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
deleted file mode 100644
index 8ecd2ec..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocation.java
+++ /dev/null
Binary files differ
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
deleted file mode 100644
index 84bedcb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INavigationLocationProvider.java
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INewWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INewWizard.java
deleted file mode 100644
index 1640d24..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INewWizard.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Interface for creation wizards.
- * <p>
- * Clients should implement this interface and include the name of their class
- * in a wizard contributed to the workbench's creation wizard extension point
- * (named <code>"org.eclipse.ui.newWizards"</code>).
- * For example, the plug-in's XML markup might contain:
- * <pre>
- * <extension point="org.eclipse.ui.newWizards">
- * <wizard
- * id="com.example.myplugin.new.blob"
- * name="Blob"
- * class="com.example.myplugin.BlobCreator"
- * icon="icons/new_blob_wiz.gif">
- * <description>Create a new BLOB file</description>
- * <selection class="org.eclipse.core.resources.IResource" />
- * </wizard>
- * </extension>
- * </pre>
- * </p>
- *
- * @see org.eclipse.jface.wizard.IWizard
- */
-public interface INewWizard extends IWorkbenchWizard {
-}
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
deleted file mode 100644
index 5cc8f9a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/INullSelectionListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Interface for listening to null selection changes.
- * <p>
- * This interface should be implemented by <code>ISelectionListener</code>
- * objects which wish to be notified when the selection becomes
- * <code>null</code>. It has no methods. It simply indicates the
- * desire to receive null selection events through the existing
- * <code>selectionChanged</code> method.
- * Either the part or the selection may be <code>null</code>.
- * </p>
- *
- * @see ISelectionListener#selectionChanged
- * @see IActionDelegate#selectionChanged
- *
- * @since 2.0
- */
-public interface INullSelectionListener {
-}
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
deleted file mode 100644
index 32f616a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IObjectActionDelegate.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-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.
- */
-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.
- * <p>
- * 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
- * @param targetPart the new part target
- */
-public 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
deleted file mode 100644
index cff4916..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageLayout.java
+++ /dev/null
@@ -1,332 +0,0 @@
-package org.eclipse.ui;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-/**
- * A page layout defines the initial layout for a page in a workbench window.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * <p>
- * When the workbench needs to create a new page, it uses a perspective to
- * creates a new page layout with a single editor area. This layout is then
- * passed to client code (implementation of
- * <code>IPerspectiveFactory.createInitialLayout</code>) where
- * additional views can be added, using the existing editor area as the initial
- * point of reference.
- * </p>
- * <p>
- * Example of populating a layout with standard workbench views:
- * <pre>
- * IPageLayout layout = ...
- * // Get the editor area.
- * String editorArea = layout.getEditorArea();
- *
- * // Top left: Resource Navigator view and Bookmarks view placeholder
- * IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, 0.25f,
- * editorArea);
- * topLeft.addView(IPageLayout.ID_RES_NAV);
- * topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS);
- *
- * // Bottom left: Outline view and Property Sheet view
- * IFolderLayout bottomLeft = layout.createFolder("bottomLeft", IPageLayout.BOTTOM, 0.50f,
- * "topLeft");
- * bottomLeft.addView(IPageLayout.ID_OUTLINE);
- * bottomLeft.addView(IPageLayout.ID_PROP_SHEET);
- *
- * // Bottom right: Task List view
- * layout.addView(IPageLayout.ID_TASK_LIST, IPageLayout.BOTTOM, 0.66f, editorArea);
- * </pre>
- * </p>
- */
-public interface IPageLayout {
-
- /**
- * The part id for the workbench's editor area. This may only be used
- * as a reference part for view addition.
- */
- public static String ID_EDITOR_AREA = "org.eclipse.ui.editorss"; //$NON-NLS-1$
-
- /**
- * The view id for the workbench's Resource Navigator standard component.
- */
- public static String ID_RES_NAV = "org.eclipse.ui.views.ResourceNavigator"; //$NON-NLS-1$
-
- /**
- * The view id for the workbench's Property Sheet standard component.
- */
- public static String ID_PROP_SHEET = "org.eclipse.ui.views.PropertySheet"; //$NON-NLS-1$
-
- /**
- * The view id for the workbench's Content Outline standard component.
- */
- public static String ID_OUTLINE = "org.eclipse.ui.views.ContentOutline"; //$NON-NLS-1$
-
-
- /**
- * The view id for the workbench's Task List standard component.
- */
- public static String ID_TASK_LIST = "org.eclipse.ui.views.TaskList"; //$NON-NLS-1$
-
- /**
- * The view id for the workbench's Bookmark Navigator standard component.
- */
- public static String ID_BOOKMARKS = "org.eclipse.ui.views.BookmarkNavigator"; //$NON-NLS-1$
-
- /**
- * Relationship constant indicating a part should be placed to the left of
- * its relative.
- */
- public static final int LEFT = 1;
-
- /**
- * Relationship constant indicating a part should be placed to the right of
- * its relative.
- */
- public static final int RIGHT = 2;
-
- /**
- * Relationship constant indicating a part should be placed above its
- * relative.
- */
- public static final int TOP = 3;
-
- /**
- * Relationship constant indicating a part should be placed below its
- * relative.
- */
- public static final int BOTTOM = 4;
-
- /**
- * Minimum acceptable ratio value when adding a view
- * @since 2.0
- */
- public static final float RATIO_MIN = 0.05f;
-
- /**
- * Maximum acceptable ratio value when adding a view
- * @since 2.0
- */
- public static final float RATIO_MAX = 0.95f;
-
- /**
- * The default fast view ratio width.
- * @since 2.0
- */
- public static final float DEFAULT_FASTVIEW_RATIO = 0.3f;
-
- /**
- * The default view ratio width for regular (non-fast) views.
- * @since 2.0
- */
- public static final float DEFAULT_VIEW_RATIO = 0.5f;
-
- /**
- * A variable used to represent invalid ratios.
- * @since 2.0
- */
- public static final float INVALID_RATIO = -1f;
-
- /**
- * A variable used to represent a ratio which has not been specified.
- * @sicne 2.0
- */
- public static final 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
- */
-public void addActionSet(String actionSetId);
-/**
- * Adds the view with the given id to the page layout as a fast view.
- * The id must name a view contributed to the workbench's view extension
- * point (named <code>"org.eclipse.ui.views"</code>).
- *
- * @param id the id of the view to be added
- * @since 2.0
- */
-public void addFastView(String id);
-/**
- * Adds the view with the given id to the page layout as a fast view
- * with the given width ratio. The id must name a view contributed to
- * the workbench's view extension point (named <code>"org.eclipse.ui.views"</code>).
- *
- * @param id the id of the view to be added
- * @param ratio the percentage of the workbench the fast view will cover
- * @since 2.0
- */
-public void addFastView(String id, float ratio);
-/**
- * Adds a creation wizard to the File New menu.
- * The id must name a new wizard extension contributed to the
- * workbench's extension point (named <code>"org.eclipse.ui.newWizards"</code>).
- *
- * @param id the wizard id
- */
-public void addNewWizardShortcut(String id);
-/**
- * Adds a perspective shortcut to the Perspective menu.
- * The id must name a perspective extension contributed to the
- * workbench's extension point (named <code>"org.eclipse.ui.perspectives"</code>).
- *
- * @param id the perspective id
- */
-public void addPerspectiveShortcut(String id);
-/**
- * Adds a placeholder for a view with the given id 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
- * with the same id as a placeholder, the view will replace the placeholder
- * as it is being made visible.
- * The 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
- * @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>
- */
-public void addPlaceholder(String viewId, int relationship, float ratio, String refId);
-/**
- * Adds a view to the Show View menu.
- * The id must name a view extension contributed to the
- * workbench's extension point (named <code>"org.eclipse.ui.views"</code>).
- *
- * @param id the view id
- */
-public void addShowViewShortcut(String id);
-/**
- * Adds a view with the given id to this page layout.
- * The 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
- * @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>
- */
-public 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
- */
-public 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
- */
-public 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
- */
-public 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
- */
-public 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
- */
-public void setEditorAreaVisible(boolean showEditorArea);
-/**
- * Returns the number of open editors before reusing editors or -1 if the
- * preference settings should be used instead.
- *
- * Note: For EXPERIMENTAL use only. IT MAY CHANGE IN NEAR FUTURE.
- *
- * @return a int
- *
- * @deprecated
- */
-public int getEditorReuseThreshold();
-/**
- * Set the number of open editors before reusing editors.
- * If < 0 the user preference settings will be used.
- *
- * Note: For EXPERIMENTAL use only. IT MAY CHANGE IN NEAR FUTURE.
- *
- * @param openEditors the number of open editors.
- *
- * @deprecated
- */
-public void setEditorReuseThreshold(int openEditors);
-}
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
deleted file mode 100644
index a305d03..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageListener.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Interface for listening to page lifecycle events.
- * <p>
- * This interface may be implemented by clients.
- * </p>
- *
- * @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
- */
-public void pageActivated(IWorkbenchPage page);
-/**
- * Notifies this listener that the given page has been closed.
- *
- * @param page the page that was closed
- * @see IWorkbenchPage#close
- */
-public void pageClosed(IWorkbenchPage page);
-/**
- * Notifies this listener that the given page has been opened.
- *
- * @param page the page that was opened
- * @see IWorkbenchWindow#openPage
- */
-public 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
deleted file mode 100644
index ab24d53..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPageService.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A page service tracks the page and perspective lifecycle events
- * within a workbench window.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IWorkbenchWindow
- * @see IPageListener
- * @see IPerspectiveListener
- */
-public interface IPageService {
-/**
- * Adds the given listener for page lifecycle events.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a page listener
- */
-public 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.
- *
- * @param listener a perspective listener
- */
-public void addPerspectiveListener(IPerspectiveListener listener);
-/*
- * Returns the active page.
- *
- * @return the active page, or <code>null</code> if no page is currently active
- */
-public IWorkbenchPage getActivePage();
-/**
- * Removes the given page listener.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a page listener
- */
-public void removePageListener(IPageListener listener);
-/**
- * Removes the given page's perspective listener.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a perspective listener
- */
-public 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
deleted file mode 100644
index 4fae8b8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartListener.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Interface for listening to part lifecycle events.
- * <p>
- * This interface may be implemented by clients.
- * </p>
- *
- * @see IPartService#addPartListener
- */
-public interface IPartListener {
-/**
- * Notifies this listener that the given part has been activated.
- *
- * @param part the part that was activated
- * @see IPerspective#activate
- */
-public 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 IPerspective#bringToTop
- */
-public void partBroughtToTop(IWorkbenchPart part);
-/**
- * Notifies this listener that the given part has been closed.
- *
- * @param part the part that was closed
- * @see IPerspective#close
- */
-public void partClosed(IWorkbenchPart part);
-/**
- * Notifies this listener that the given part has been deactivated.
- *
- * @param part the part that was deactivated
- * @see IPerspective#activate
- */
-public void partDeactivated(IWorkbenchPart part);
-/**
- * Notifies this listener that the given part has been opened.
- *
- * @param part the part that was opened
- */
-public void partOpened(IWorkbenchPart part);
-}
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
deleted file mode 100644
index 0b202da..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPartService.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A part service tracks the creation and activation of parts within a
- * workbench page.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IWorkbenchPage
- */
-public interface IPartService {
-/**
- * Adds the given listener for part lifecycle events.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a part listener
- */
-public void addPartListener(IPartListener listener);
-/*
- * Returns the active part.
- *
- * @return the active part, or <code>null</code> if no part is currently active
- */
-public IWorkbenchPart getActivePart();
-/**
- * Removes the given part listener.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a part listener
- */
-public void removePartListener(IPartListener listener);
-}
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
deleted file mode 100644
index beb9a9b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPersistableElement.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * 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.
- * </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.
- * </p>
- *
- * @see org.eclipse.core.runtime.IAdaptable
- * @see IMemento
- * @see IElementFactory
- */
-public interface IPersistableElement {
-/**
- * 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
- */
-public String getFactoryId();
-/**
- * Saves the state of the object in the given memento.
- *
- * @param memento the storage area for object's state
- */
-public void saveState(IMemento memento);
-}
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
deleted file mode 100644
index bd7134b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveDescriptor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.*;
-
-/**
- * A perspective descriptor describes a perspective in an
- * <code>IPerspectiveRegistry</code>.
- * <p>
- * A perspective is a template for view visibility, layout, and action visibility
- * within a workbench page. There are two types of perspective: a predefined
- * perspective and a custom perspective.
- * <ul>
- * <li>A predefined perspective is defined by an extension to the workbench's
- * perspective extension point (<code>"org.eclipse.ui.perspectives"</code>).
- * The extension defines a id, label, and <code>IPerspectiveFactory</code>.
- * A perspective factory is used to define the initial layout for a page.
- * </li>
- * <li>A custom perspective is defined by the user. In this case a predefined
- * perspective is modified to suit a particular task and saved as a new
- * perspective. The attributes for the perspective are stored in a separate file
- * in the workbench's metadata directory.
- * </li>
- * </ul>
- * </p>
- * <p>
- * Within a page the user can switch between any of the perspectives known
- * to the workbench's perspective registry, typically by selecting one from the
- * workbench's <code>Switch Perspective</code> menu. When selected, the views,
- * and actions within the active page rearrange to reflect the perspective.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * @see IPerspectiveRegistry
- */
-public interface IPerspectiveDescriptor {
-/**
- * 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
- */
-public String getId();
-/**
- * Returns the descriptor of the image for this perspective.
- *
- * @return the descriptor of the image to display next to this perspective
- */
-public 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
- */
-public 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
deleted file mode 100644
index fcdda8d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveFactory.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * A perspective factory generates the initial page layout and visible
- * action set for a page.
- * <p>
- * When a new page is created in the workbench a perspective is used to define
- * the initial page layout. If this is a predefined perspective (based on an extension to
- * the workbench's perspective extension point) an <code>IPerspectiveFactory</code>
- * is used to define the initial page layout.
- * </p><p>
- * The factory for the perspective is created and passed an <code>IPageLayout</code>
- * where views can be added. The default layout consists of the editor area with no
- * additional views. Additional views are added to the layout using
- * the editor area as the initial point of reference. The factory is used only briefly
- * while a new page is created; then discarded.
- * </p><p>
- * To define a perspective clients should implement this interface and
- * include the name of their class in an extension to the workbench's perspective
- * extension point (named <code>"org.eclipse.ui.perspectives"</code>). For example,
- * the plug-in's XML markup might contain:
- * <pre>
- * <extension point="org.eclipse.ui.perspectives">
- * <perspective
- * id="com.example.javaplugin.perspective"
- * name="Java"
- * class="com.example.javaplugin.JavaPerspective"
- * </perspective>
- * </extension>
- * </pre>
- * </p><p>
- * Example of populating a page with standard workbench views:
- * <pre>
- * public void createInitialLayout(IPageLayout layout) {
- * // Get the editor area.
- * String editorArea = layout.getEditorArea();
- *
- * // Top left: Resource Navigator view and Bookmarks view placeholder
- * IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, 0.25f,
- * editorArea);
- * topLeft.addView(IPageLayout.ID_RES_NAV);
- * topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS);
- *
- * // Bottom left: Outline view and Property Sheet view
- * IFolderLayout bottomLeft = layout.createFolder("bottomLeft", IPageLayout.BOTTOM, 0.50f,
- * "topLeft");
- * bottomLeft.addView(IPageLayout.ID_OUTLINE);
- * bottomLeft.addView(IPageLayout.ID_PROP_SHEET);
- *
- * // Bottom right: Task List view
- * layout.addView(IPageLayout.ID_TASK_LIST, IPageLayout.BOTTOM, 0.66f, editorArea);
- * }
- * </pre>
- * </p><p>
- * Within the workbench a user may override the visible views, layout and
- * action sets of a predefined perspective to create a custom perspective. In such cases
- * the layout is persisted by the workbench and the factory is not used.
- * </p>
- * @see IPerspectiveDescriptor#createFactory
- */
-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
- */
-public 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
deleted file mode 100644
index 2fb55ff..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveListener.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Interface for listening to a perspective lifecycle events.
- * <p>
- * This interface may be implemented by clients.
- * </p>
- *
- * @see IPageService#addPerspectiveListener
- */
-public interface IPerspectiveListener {
-/**
- * Notifies this listener that the given page's perspective
- * has been activated.
- *
- * @param page the page whose perspective was activated
- * @param perspective the perspective descriptor that was activated
- * @see IWorkbenchPage#setPerspective
- */
-public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective);
-/**
- * Notifies this listener that the given page's perspective
- * has change in some way (e.g. editor area hidden, perspective reset,
- * view show/hide, editor open/close, ...).
- *
- * @param page the page whose perspective was reset
- * @param perspective the perspective descriptor
- * @param changeId one of the <code>CHANGE_*</code> constants on IWorkbenchPage
- */
-public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId);
-}
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
deleted file mode 100644
index bc5b9cd..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPerspectiveRegistry.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * The workbench's global registry of perspectives.
- * <p>
- * This registry contains a descriptor for each perspectives in the workbench.
- * 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>
- * This interface is not intended to be implemented by clients.
- * </p>
- * @see IWorkbench#getPerspectiveRegistry
- */
-public interface IPerspectiveRegistry {
-/**
- * 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
- */
-public 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
- */
-public 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>
- * <p><p>
- * On startup of the platform UI the default perspective is determined using a
- * multistep process.
- * </p>
- * <ol>
- * <li>Initially the <code>Resource Perspective</code> is default. </li>
- * <li>If a single perspective extension within the registry has a <b>default</b>
- * attribute it will become the default perspective. If two or more
- * extensions have the <b>default</b> attribute the registry will ignore all
- * of them and select the <code>Resource Perspective</code>. </li>
- * <li>If the user has set the default perspective within the
- * <code>Perspective</code> dialog their preference will be selected
- * over all others. </li>
- * </ol>
- * </p>
- *
- * @return the default perspective id; will never be <code>null</code>
- */
-public String getDefaultPerspective();
-/**
- * Returns a list of the perspectives known to the workbench.
- *
- * @return a list of perspectives
- */
-public IPerspectiveDescriptor[] getPerspectives();
-/**
- * Sets the default perspective for the workbench to the given perspective id.
- * The id must correspond to one perspective extension within the workbench's
- * perspective registry.
- *
- * @param id a perspective id; must not be <code>null</code>
- */
-public void setDefaultPerspective(String id);
-}
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
deleted file mode 100644
index 2d4f8f5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPlaceholderFolderLayout.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.ui;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-/**
- * An <code>IPlaceholderFolderLayout</code> is used to define the initial
- * places for page placeholders within a folder placeholder. The folder itself is a component within
- * an <code>IPageLayout</code>.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IPageLayout#createPlaceholderFolder
- * @since 2.0
- */
-public interface IPlaceholderFolderLayout {
-/**
- * Adds an invisible placeholder for a view with the given id 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
- * with the same id as a placeholder, the view will replace the placeholder
- * as it is being made visible.
- * The 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
- */
-public void addPlaceholder(String viewId);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IProjectActionFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IProjectActionFilter.java
deleted file mode 100644
index 0d7e7d0..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IProjectActionFilter.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Describes the public attributes for a project and the acceptables values
- * each may have.
- * <p>
- * A popup menu extension may use these constants to describe its object target.
- * Each identifies an attribute name or possible value.
- * <p>
- * Clients are not expected to implement this interface.
- * </p>
- *
- * @see IActionFilter
- */
-public interface IProjectActionFilter extends IResourceActionFilter {
-
- /**
- * An attribute indicating the project nature (value <code>"nature"</code>).
- * The attribute value in xml is unconstrained.
- */
- public static final String NATURE = "nature"; //$NON-NLS-1$
-
-
- /**
- * An attribute indicating whether the project is open (value <code>"open"</code>).
- * The attribute value in xml must be one of <code>"true" or "false"</code>.
- */
- public static final String OPEN = "open"; //$NON-NLS-1$
-
-}
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
deleted file mode 100644
index 2ad6a5c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IPropertyListener.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Interface for listening for property changes on an object.
- * <p>
- * This interface may be implemented by clients.
- * </p>
- *
- * @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
- */
-public void propertyChanged(Object source, int propId);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IResourceActionFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IResourceActionFilter.java
deleted file mode 100644
index 57b39b5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IResourceActionFilter.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Describes the public attributes for a resource and the acceptables values
- * each may have.
- * <p>
- * A popup menu extension may use these constants to describe its object target.
- * Each identifies an attribute name or possible value.
- * <p>
- * Clients are not expected to implement this interface.
- * </p>
- *
- * @see IActionFilter
- */
-public interface IResourceActionFilter extends IActionFilter {
- /**
- * An attribute indicating the file name (value <code>"name"</code>).
- * The attribute value in xml is unconstrained. "*" may be used at the start or
- * the end to represent "one or more characters".
- */
- public static final String NAME = "name"; //$NON-NLS-1$
-
- /**
- * An attribute indicating the file extension (value <code>"extension"</code>).
- * The attribute value in xml is unconstrained.
- */
- public static final String EXTENSION = "extension"; //$NON-NLS-1$
-
- /**
- * An attribute indicating the file path (value <code>"path"</code>).
- * The attribute value in xml is unconstrained. "*" may be used at the start or
- * the end to represent "one or more characters".
- */
- public static final String PATH = "path"; //$NON-NLS-1$
-
- /**
- * An attribute indicating whether the file is read only (value <code>"readOnly"</code>).
- * The attribute value in xml must be one of <code>"true" or "false"</code>.
- */
- public static final String READ_ONLY = "readOnly"; //$NON-NLS-1$
-
- /**
- * An attribute indicating the project nature (value <code>"projectNature"</code>).
- * The attribute value in xml is unconstrained.
- */
- public static final String PROJECT_NATURE = "projectNature"; //$NON-NLS-1$
-
- /**
- * An attribute indicating a persistent property on the selected resource
- * (value <code>"persistentProperty"</code>).
- * If the value is a simple string, then this simply tests for existence of the property on the resource.
- * If it has the format <code>"propertyName=propertyValue" this obtains the value of the property
- * with the specified name and tests it for equality with the specified value.
- */
- public static final String PERSISTENT_PROPERTY = "persistentProperty"; //$NON-NLS-1$
-
- /**
- * An attribute indicating a persistent property on the selected resource's project.
- * (value <code>"projectPersistentProperty"</code>).
- * If the value is a simple string, then this simply tests for existence of the property on the resource.
- * If it has the format <code>"propertyName=propertyValue" this obtains the value of the property
- * with the specified name and tests it for equality with the specified value.
- */
- public static final String PROJECT_PERSISTENT_PROPERTY = "projectPersistentProperty"; //$NON-NLS-1$
-
- /**
- * An attribute indicating a session property on the selected resource
- * (value <code>"sessionProperty"</code>).
- * If the value is a simple string, then this simply tests for existence of the property on the resource.
- * If it has the format <code>"propertyName=propertyValue" this obtains the value of the property
- * with the specified name and tests it for equality with the specified value.
- */
- public static final String SESSION_PROPERTY = "sessionProperty"; //$NON-NLS-1$
-
- /**
- * An attribute indicating a session property on the selected resource's project.
- * (value <code>"projectSessionProperty"</code>).
- * If the value is a simple string, then this simply tests for existence of the property on the resource.
- * If it has the format <code>"propertyName=propertyValue" this obtains the value of the property
- * with the specified name and tests it for equality with the specified value.
- */
- public static final String PROJECT_SESSION_PROPERTY = "projectSessionProperty"; //$NON-NLS-1$
-}
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
deleted file mode 100644
index 7db36c9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IReusableEditor.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.ui;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * 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.
- *
- * Note: For EXPERIMENTAL use only. IT MAY CHANGE IN NEAR FUTURE.
- *
- */
-public interface IReusableEditor extends IEditorPart {
-/**
- * @see EditorPart#setInput
- */
-public void setInput(IEditorInput newInput);
-}
-
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
deleted file mode 100644
index 4c4805f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionListener.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.ISelection;
-
-/**
- * Interface for listening to selection changes.
- * <p>
- * This interface may be implemented by clients.
- * </p>
- *
- * @see ISelectionService#addSelectionListener
- */
-public interface ISelectionListener {
-/**
- * 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.
- */
-public 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
deleted file mode 100644
index e02ad21..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISelectionService.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.ISelection;
-
-/**
- * A selection service tracks the selection within an object.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface ISelectionService {
-/**
- * Adds the given selection listener.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a selection listener
- */
-public 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. The listener is also notified when the part is created
- * and 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.
- *
- * @param partId the id of the part to track
- * @param listener a selection listener
- * @since 2.0
- */
-public 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).
- *
- * @param listener a selection listener
- */
-public void addPostSelectionListener(ISelectionListener listener);
-
-/**
- * Adds a part-specific post 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. The listener is also notified when the part is created
- * and 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.
- *
- * @param partId the id of the part to track
- * @param listener a selection listener
- * @since 2.0
- */
-public 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
- */
-public 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
- */
-public ISelection getSelection(String partId);
-/**
- * Removes the given selection listener.
- * Has no effect if an identical listener is not registered.
- *
- * @param listener a selection listener
- */
-public 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
- */
-public 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
- */
-public 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
- */
-public 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
deleted file mode 100644
index bc89ba2..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ISharedImages.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * 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.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface ISharedImages {
- /**
- * Identifies a file image.
- */
- public final static String IMG_OBJ_FILE = "IMG_OBJ_FILE"; //$NON-NLS-1$
-
- /**
- * Identifies a folder image.
- */
- public final static String IMG_OBJ_FOLDER = "IMG_OBJ_FOLDER"; //$NON-NLS-1$
-
- /**
- * Identifies a project image.
- */
- public final static String IMG_OBJ_PROJECT = "IMG_OBJ_PROJECT"; //$NON-NLS-1$
-
- /**
- * Identifies a closed project image.
- */
- public final static String IMG_OBJ_PROJECT_CLOSED = "IMG_OBJ_PROJECT_CLOSED"; //$NON-NLS-1$
-
- /**
- * Identifies an element image.
- */
- public final static String IMG_OBJ_ELEMENT = "IMG_OBJ_ELEMENTS"; //$NON-NLS-1$
-
- /**
- * Identifies the image used for "open marker".
- */
- public final static String IMG_OPEN_MARKER = "IMG_OPEN_MARKER"; //$NON-NLS-1$
-
- /**
- * Identifies the default image used for views.
- */
- public final static String IMG_DEF_VIEW = "IMG_DEF_VIEW"; //$NON-NLS-1$
-
- /**
- * Identifies the default image used to indicate errors.
- */
- public final static String IMG_OBJS_ERROR_TSK = "IMG_OBJS_ERROR_TSK"; //$NON-NLS-1$
-
- /**
- * Identifies the default image used to indicate warnings.
- */
- public final static String IMG_OBJS_WARN_TSK = "IMG_OBJS_WARN_TSK"; //$NON-NLS-1$
-
- /**
- * Identifies the default image used to indicate information only.
- */
- public final static String IMG_OBJS_INFO_TSK = "IMG_OBJS_INFO_TSK"; //$NON-NLS-1$
-
- /**
- * Identifies the default image used to indicate a task.
- */
- public final static String IMG_OBJS_TASK_TSK = "IMG_OBJS_TASK_TSK"; //$NON-NLS-1$
- /**
- * Identifies the default image used to indicate a bookmark.
- */
- public final static String IMG_OBJS_BKMRK_TSK = "IMG_OBJS_BKMRK_TSK"; //$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 (constants found in
- * this interface)
- * @return the image, or <code>null</code> if not found
- */
-public 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 (constants found in
- * this interface)
- * @return the image descriptor, or <code>null</code> if not found
- */
-public ImageDescriptor getImageDescriptor(String symbolicName);
-}
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
deleted file mode 100644
index 1bbcac0..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IStartup.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-/**
- * Plugins 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.
- *
- * <p>
- * @since 2.0
- */
-public interface IStartup {
- /**
- * Will be called in a separed thread after the workbench initializes.
- */
- public void earlyStartup();
-}
-
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IStorageEditorInput.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IStorageEditorInput.java
deleted file mode 100644
index 31af405..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IStorageEditorInput.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.InputStream;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.resources.IStorage;
-
-/**
- * Interface for a <code>IStorage</code> input to an editor.
- * <p>
- * Clients should implement this interface to declare new types of
- * <code>IStorage</code> editor inputs.
- * </p>
- * <p>
- * File-oriented editors should support this as a valid input type, and display
- * its content for viewing (but not allow modification).
- * Within the editor, the "save" and "save as" operations should create a new
- * file resource within the workspace.
- * <p>
- * All editor inputs must implement the <code>IAdaptable</code> interface;
- * extensions are managed by the platform's adapter manager.
- * </p>
- */
-public interface IStorageEditorInput extends IEditorInput {
-/**
- * Returns the underlying IStorage object.
- *
- * @return an IStorage object.
- * @exception CoreException if this method fails
- */
-public IStorage getStorage() throws CoreException;
-}
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
deleted file mode 100644
index 8412713..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewActionDelegate.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * 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
- * 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
- */
-public void init(IViewPart view);
-}
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
deleted file mode 100644
index 55dd8ab..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewPart.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * 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 display properties for the active editor. Modifications made in a view are
- * saved immediately (in contrast to an editor part, which conforms to a more
- * elaborate open-save-close lifecycle).
- * <p>
- * Only one instance of a particular view type may exist within a workbench page.
- * This policy is designed to simplify part management for a user.
- * </p><p>
- * This interface may be implemented directly. For convenience, a base
- * implementation is defined in <code>ViewPart</code>.
- * </p>
- * <p>
- * A view is added to the workbench in two steps:
- * <ol>
- * <li>A view extension is contributed to the workbench registry. This
- * extension defines the extension id and extension class.</li>
- * <li>The view is included in the default layout for a perspective.
- * Alternatively, the user may open the view from the Perspective menu.</li>
- * </ol>
- * </p>
- * <p>
- * Views implement the <code>IAdaptable</code> interface; extensions
- * are managed by the platform's adapter manager.
- * </p>
- *
- * @see IWorkbenchPage#showView
- * @see org.eclipse.ui.part.ViewPart
- */
-public interface IViewPart extends IWorkbenchPart {
-/**
- * Returns the site for this view.
- *
- * @return the view site
- */
-public IViewSite getViewSite();
-/**
- * Initializes this view with the given view site.
- * <p>
- * This method is automatically called by the workbench shortly after part
- * construction. 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
- */
-public 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 part
- * construction. 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
- */
-public void init(IViewSite site,IMemento memento) throws PartInitException;
-/**
- * Saves the object state within a memento.
- *
- * @param memento a memento to receive the object state
- */
-public 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
deleted file mode 100644
index 11450e0..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewReference.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.ui;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-/**
- * Defines a reference to an IViewPart.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- */
-public interface IViewReference extends IWorkbenchPartReference {
- /**
- * Returns the IViewPart referenced by this object.
- * Returns null if the view was not instanciated or
- * it failed to be restored. Tries to restore the view
- * if <code>restore</code> is true.
- */
- public IViewPart getView(boolean restore);
- /**
- * Returns true if the view is a fast view otherwise returns false.
- */
- public 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
deleted file mode 100644
index 95eb84a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IViewSite.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.ui;
-
-import org.eclipse.jface.viewers.ILabelDecorator;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * The primary interface between a view part and the outside world.
- * <p>
- * The workbench exposes its implemention of view part sites via this interface,
- * which is not intended to be implemented or extended by clients.
- * </p>
- */
-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
- */
-public IActionBars getActionBars();
-
-}
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
deleted file mode 100644
index 9297327..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWindowListener.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.eclipse.ui;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Interface for listening to window lifecycle events.
- * <p>
- * This interface may be implemented by clients.
- * </p>
- */
-public interface IWindowListener {
-/**
- * Notifies this listener that the given window has been activated.
- *
- * @param window the window that was activated
- */
-public void windowActivated(IWorkbenchWindow window);
-/**
- * Notifies this listener that the given window has been deactivated.
- *
- * @param window the window that was activated
- */
-public void windowDeactivated(IWorkbenchWindow window);
-/**
- * Notifies this listener that the given window has been closed.
- *
- * @param window the window that was closed
- * @see IWorkbenchWindow#close
- */
-public void windowClosed(IWorkbenchWindow window);
-/**
- * Notifies this listener that the given window has been opened.
- *
- * @param window the window that was opened
- * @see IWorkbench#openWorkbenchWindow
- */
-public 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
deleted file mode 100644
index 186658a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbench.java
+++ /dev/null
Binary files differ
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
deleted file mode 100644
index 79cf199..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchActionConstants.java
+++ /dev/null
@@ -1,610 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * 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>View menu (<code>M_VIEW</code>)</li>
- * <li>Workbench menu (<code>M_WORKBENCH</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>
- * </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>
- * </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>
- * </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>
- * </ul>
- * <h3>Standard Perspective menu actions</h3>
- * <ul>
- * <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>
- * </ul>
- * <h3>Standard Window menu actions</h3>
- * <ul>
- * <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>
- * </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>
- * </ul>
- */
-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>
- */
- public static final String MENU_PREFIX = ""; //$NON-NLS-1$
-
- /**
- * <p>
- * [Issue: SEP is "/". It is not used anywhere. Recommend deleting it.]
- * </p>
- */
- public static final String SEP = "/"; //$NON-NLS-1$
-
- /**
- * Name of standard File menu (value <code>"file"</code>).
- */
- public static final String M_FILE = MENU_PREFIX+"file"; //$NON-NLS-1$
-
- /**
- * Name of standard Edit menu (value <code>"edit"</code>).
- */
- public static final String M_EDIT = MENU_PREFIX+"edit"; //$NON-NLS-1$
-
- /**
- * Name of standard Perspective menu (value <code>"view"</code>).
- */
- public static final String M_VIEW = MENU_PREFIX+"view"; //$NON-NLS-1$
-
- /**
- * Name of standard Workbench menu (value <code>"workbench"</code>).
- */
- public static final String M_WORKBENCH = MENU_PREFIX+"workbench"; //$NON-NLS-1$
-
-// menu reorg
-
- /**
- * Name of standard Navigate menu (value <code>"navigate"</code>).
- */
- public static final String M_NAVIGATE = MENU_PREFIX+"navigate"; //$NON-NLS-1$
-
- /**
- * Name of standard Project menu (value <code>"project"</code>).
- */
- public static final String M_PROJECT = MENU_PREFIX+"project"; //$NON-NLS-1$
-
-// end menu reorg
-
- /**
- * Name of standard Window menu (value <code>"window"</code>).
- */
- public static final String M_WINDOW = MENU_PREFIX+"window"; //$NON-NLS-1$
-
- /**
- * Name of Launch window menu (value <code>"launch"</code>).
- */
- public static final String M_LAUNCH = MENU_PREFIX + "launch"; //$NON-NLS-1$
-
- /**
- * Name of standard Help menu (value <code>"help"</code>).
- */
- public static final String M_HELP = MENU_PREFIX+"help"; //$NON-NLS-1$
-
-// Standard area for adding top level menus:
- /**
- * Name of group for adding new top-level menus (value <code>"additions"</code>).
- */
- public static final String MB_ADDITIONS = "additions"; // Group. //$NON-NLS-1$
-
-// Standard file actions:
- /**
- * File menu: name of group for start of menu (value <code>"fileStart"</code>).
- */
- public static final String FILE_START = "fileStart"; // Group. //$NON-NLS-1$
-
- /**
- * File menu: name of group for end of menu (value <code>"fileEnd"</code>).
- */
- public static final String FILE_END = "fileEnd"; // Group. //$NON-NLS-1$
-
- /**
- * File menu: name of standard New action (value <code>"new"</code>).
- */
- public static final String NEW = "new"; //$NON-NLS-1$
-
- /**
- * File menu: name of group for extra New-like actions (value <code>"new.ext"</code>).
- */
- public static final String NEW_EXT = "new.ext"; // Group. //$NON-NLS-1$
-
- /**
- * File menu: name of standard Close action (value <code>"close"</code>).
- */
- public static final String CLOSE = "close"; //$NON-NLS-1$
-
- /**
- * File menu: name of standard Close All action (value <code>"closeAll"</code>).
- */
- public static final String CLOSE_ALL = "closeAll"; //$NON-NLS-1$
-
- /**
- * File menu: name of group for extra Close-like actions (value <code>"close.ext"</code>).
- */
- public static final String CLOSE_EXT = "close.ext"; // Group. //$NON-NLS-1$
-
- /**
- * File menu: name of standard Save action (value <code>"save"</code>).
- */
- public static final String SAVE = "save"; //$NON-NLS-1$
-
- /**
- * File menu: name of standard Save As action (value <code>"saveAs"</code>).
- */
- public static final String SAVE_AS = "saveAs"; //$NON-NLS-1$
-
- /**
- * File menu: name of standard Save All action (value <code>"saveAll"</code>).
- */
- public static final String SAVE_ALL = "saveAll"; //$NON-NLS-1$
-
- /**
- * File menu: name of group for extra Save-like actions (value <code>"save.ext"</code>).
- */
- public static final String SAVE_EXT = "save.ext"; // Group. //$NON-NLS-1$
-
- /**
- * File menu: name of standard Print global action
- * (value <code>"print"</code>).
- */
- public static final String PRINT = "print"; // Global action. //$NON-NLS-1$
-
- /**
- * File menu: name of standard Import action (value <code>"import"</code>).
- */
- public static final String IMPORT = "import"; //$NON-NLS-1$
-
- /**
- * File menu: name of standard Export action (value <code>"export"</code>).
- */
- public static final String EXPORT = "export"; //$NON-NLS-1$
-
- /**
- * File menu: name of group for extra Import-like actions (value <code>"import.ext"</code>).
- */
- public static final String IMPORT_EXT = "import.ext"; // Group. //$NON-NLS-1$
-
- /**
- * File menu: name of "Most Recently Used File" group.
- * (value <code>"mru"</code>).
- */
- public static final String MRU = "mru"; //$NON-NLS-1$
-
- /**
- * File menu: name of standard Quit action (value <code>"quit"</code>).
- */
- public static final String QUIT = "quit"; //$NON-NLS-1$
-
-// Standard edit actions:
- /**
- * Edit menu: name of group for start of menu (value <code>"editStart"</code>).
- */
- public static final String EDIT_START = "editStart"; // Group. //$NON-NLS-1$
-
- /**
- * Edit menu: name of group for end of menu (value <code>"editEnd"</code>).
- */
- public static final String EDIT_END = "editEnd"; // Group. //$NON-NLS-1$
-
- /**
- * Edit menu: name of standard Undo global action
- * (value <code>"undo"</code>).
- */
- public static final String UNDO = "undo"; // Global action. //$NON-NLS-1$
-
- /**
- * Edit menu: name of standard Redo global action
- * (value <code>"redo"</code>).
- */
- public static final String REDO = "redo"; // Global action. //$NON-NLS-1$
-
- /**
- * Edit menu: name of group for extra Undo-like actions (value <code>"undo.ext"</code>).
- */
- public static final String UNDO_EXT = "undo.ext"; // Group. //$NON-NLS-1$
-
- /**
- * Edit menu: name of standard Cut global action
- * (value <code>"cut"</code>).
- */
- public static final String CUT = "cut"; // Global action. //$NON-NLS-1$
-
- /**
- * Edit menu: name of standard Copy global action
- * (value <code>"copy"</code>).
- */
- public static final String COPY = "copy"; // Global action. //$NON-NLS-1$
-
- /**
- * Edit menu: name of standard Paste global action
- * (value <code>"paste"</code>).
- */
- public static final String PASTE = "paste"; // Global action. //$NON-NLS-1$
-
- /**
- * Edit menu: name of group for extra Cut-like actions (value <code>"cut.ext"</code>).
- */
- public static final String CUT_EXT = "cut.ext"; // Group. //$NON-NLS-1$
-
- /**
- * Edit menu: name of standard Delete global action
- * (value <code>"delete"</code>).
- */
- public static final String DELETE = "delete"; // Global action. //$NON-NLS-1$
-
- /**
- * Edit menu: name of standard Find global action
- * (value <code>"find"</code>).
- */
- public static final String FIND = "find"; // Global action. //$NON-NLS-1$
-
- /**
- * Edit menu: name of group for extra Find-like actions (value <code>"find.ext"</code>).
- */
- public static final String FIND_EXT = "cut.ext"; // Group. //$NON-NLS-1$
-
- /**
- * Edit menu: name of standard Select All global action
- * (value <code>"selectAll"</code>).
- */
- public static final String SELECT_ALL = "selectAll"; // Global action. //$NON-NLS-1$
-
- /**
- * Edit menu: name of standard Add Bookmark global action
- * (value <code>"bookmark"</code>).
- */
- public static final String BOOKMARK = "bookmark"; // Global action. //$NON-NLS-1$
-
- /**
- * Edit menu: name of standard Add Task global action
- * (value <code>"addTask"</code>).
- */
- public static final String ADD_TASK = "addTask"; // Global action. //$NON-NLS-1$
-
- /**
- * Edit menu: name of group for extra Add-like actions (value <code>"add.ext"</code>).
- */
- public static final 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>).
- */
- public static final String WB_START = "wbStart"; // Group. //$NON-NLS-1$
-
- /**
- * Workbench menu: name of group for end of menu
- * (value <code>"wbEnd"</code>).
- */
- public static final String WB_END = "wbEnd"; // Group. //$NON-NLS-1$
-
- /**
- * Workbench menu: name of group for extra Build-like actions
- * (value <code>"build.ext"</code>).
- */
- public static final String BUILD_EXT = "build.ext"; // Group. //$NON-NLS-1$
-
- /**
- * Workbench menu: name of standard Build action
- * (value <code>"build"</code>).
- */
- public static final String BUILD = "build"; //$NON-NLS-1$
-
- /**
- * Workbench menu: name of standard Rebuild All action
- * (value <code>"rebuildAll"</code>).
- */
- public static final String REBUILD_ALL = "rebuildAll"; //$NON-NLS-1$
-
-// Pop-up menu groups:
- /**
- * Pop-up menu: name of group for Managing actions (value <code>"group.managing"</code>).
- */
- public static final String GROUP_MANAGING = "group.managing"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for Reorganize actions (value <code>"group.reorganize"</code>).
- */
- public static final String GROUP_REORGANIZE = "group.reorganize"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for Add actions (value <code>"group.add"</code>).
- */
- public static final String GROUP_ADD = "group.add"; //$NON-NLS-1$
-
- /**
- * Pop-up menu: name of group for File actions (value <code>"group.file"</code>).
- */
- public static final String GROUP_FILE = "group.file"; //$NON-NLS-1$
-
- /**
- * Toolbar: name of group for editor action bars.
- */
- public static final String GROUP_EDITOR = "group.editor"; //$NON-NLS-1$
-
-// Standard view actions:
- /**
- * View menu: name of group for additional view-like items.
- * (value <code>"additions"</code>).
- */
- public static final String VIEW_EXT = MB_ADDITIONS; // Group.
-
-// Standard window actions:
- /**
- * Window menu: name of group for additional window-like items.
- * (value <code>"additions"</code>).
- */
- public static final String WINDOW_EXT = MB_ADDITIONS; // Group.
-
- /**
- * Launch menu: name of group for launching additional windows.
- * (value <code>"additions"</code>).
- */
- public static final String LAUNCH_EXT = MB_ADDITIONS; // Group.
-
-// menu reorg
- /**
- * File menu: name of standard Revert global action
- * (value <code>"revert"</code>).
- */
- public static final String REVERT = "revert"; // Global action. //$NON-NLS-1$
-
- /**
- * File menu: name of standard Refresh global action
- * (value <code>"refresh"</code>).
- */
- public static final String REFRESH = "refresh"; // Global action. //$NON-NLS-1$
-
- /**
- * File menu: name of standard Properties global action
- * (value <code>"properties"</code>).
- */
- public static final String PROPERTIES = "properties"; // Global action. //$NON-NLS-1$
-
- /**
- * Edit menu: name of standard Move global action
- * (value <code>"move"</code>).
- */
- public static final String MOVE = "move"; // Global action. //$NON-NLS-1$
-
- /**
- * Edit menu: name of standard Rename global action
- * (value <code>"rename"</code>).
- */
- public static final String RENAME = "rename"; // Global action. //$NON-NLS-1$
-
- /**
- * Edit menu: name of standard Add Task global action
- * (value <code>"addTask"</code>).
- */
-// public static final String ADD_TASK = "addTask"; // Global action. //$NON-NLS-1$
-
- /**
- * Navigate menu: name of group for start of menu
- * (value <code>"navStart"</code>).
- */
- public static final String NAV_START = "navStart"; // Group. //$NON-NLS-1$
-
- /**
- * Navigate menu: name of group for end of menu
- * (value <code>"navStart"</code>).
- */
- public static final String NAV_END = "navStart"; // Group. //$NON-NLS-1$
-
- /**
- * Navigate menu: name of group for extra Open actions
- * (value <code>"open.ext"</code>).
- */
- public static final String OPEN_EXT = "open.ext"; // Group. //$NON-NLS-1$
-
- /**
- * Navigate menu: name of group for extra Show actions
- * (value <code>"show.ext"</code>).
- */
- public static final String SHOW_EXT = "show.ext"; // Group. //$NON-NLS-1$
-
- /**
- * Navigate menu: name of standard Go Into global action
- * (value <code>"goInto"</code>).
- */
- public static final String GO_INTO = "goInto"; // Global action. //$NON-NLS-1$
-
- /**
- * Navigate menu: name of standard Go To submenu
- * (value <code>"goTo"</code>).
- */
- public static final String GO_TO = "goTo"; //$NON-NLS-1$
-
- /**
- * Navigate menu: name of standard Back global action
- * (value <code>"back"</code>).
- */
- public static final String BACK = "back"; // Global action. //$NON-NLS-1$
-
- /**
- * Navigate menu: name of standard Forward global action
- * (value <code>"forward"</code>).
- */
- public static final String FORWARD = "forward"; // Global action. //$NON-NLS-1$
-
- /**
- * Navigate menu: name of standard Up global action
- * (value <code>"up"</code>).
- */
- public static final String UP = "up"; // Global action. //$NON-NLS-1$
-
- /**
- * Navigate menu: name of standard Next global action
- * (value <code>"next"</code>).
- */
- public static final String NEXT = "next"; // Global action. //$NON-NLS-1$
-
- /**
- * Navigate menu: name of standard Up global action
- * (value <code>"previous"</code>).
- */
- public static final String PREVIOUS = "previous"; // Global action. //$NON-NLS-1$
-
- /**
- * Project menu: name of group for start of menu
- * (value <code>"projStart"</code>).
- */
- public static final String PROJ_START = "projStart"; // Group. //$NON-NLS-1$
-
- /**
- * Project menu: name of group for start of menu
- * (value <code>"projEnd"</code>).
- */
- public static final String PROJ_END = "projEnd"; // Group. //$NON-NLS-1$
-
- /**
- * Project menu: name of standard Build Project global action
- * (value <code>"buildProject"</code>).
- */
- public static final String BUILD_PROJECT = "buildProject"; // Global action. //$NON-NLS-1$
-
- /**
- * Project menu: name of standard Rebuild Project global action
- * (value <code>"rebuildProject"</code>).
- */
- public static final String REBUILD_PROJECT = "rebuildProject"; // Global action. //$NON-NLS-1$
-
- /**
- * Project menu: name of standard Open Project global action
- * (value <code>"openProject"</code>).
- */
- public static final String OPEN_PROJECT = "openProject"; // Global action. //$NON-NLS-1$
-
- /**
- * Project menu: name of standard Close Project global action
- * (value <code>"closeProject"</code>).
- */
- public static final String CLOSE_PROJECT = "closeProject"; // Global action. //$NON-NLS-1$
-// end menu reorg
-
-
-// Standard help actions:
- /**
- * Help menu: name of group for start of menu
- * (value <code>"helpStart"</code>).
- */
- public static final String HELP_START = "helpStart"; // Group. //$NON-NLS-1$
-
- /**
- * Help menu: name of group for end of menu
- * (value <code>"helpEnd"</code>).
- */
- public static final String HELP_END = "helpEnd"; // Group. //$NON-NLS-1$
-
- /**
- * Help menu: name of standard About action
- * (value <code>"about"</code>).
- */
- public static final String ABOUT = "about"; //$NON-NLS-1$
-
- /**
- * Standard global actions in a workbench window.
- */
- public static final 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/IWorkbenchPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPage.java
deleted file mode 100644
index 94f63d4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPage.java
+++ /dev/null
@@ -1,655 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.viewers.ISelection;
-
-/**
- * A workbench page consists of an arrangement of views and editors intended to
- * be presented together to the user in a single workbench window.
- * <p>
- * A page can contain 0 or more views and 0 or more editors. These views and editors
- * are contained wholly within the page and are not shared with other pages.
- * The layout and visible action set for the page is defined by a perspective.
- * <p>
- * The number of views and editors within a page is restricted to simplify part
- * management for the user. In particular:
- * <ul>
- * <li>Only one instance of a particular view type may exist within a workbench page.</li>
- * <li>Only one editor can exist for each editor input within a page.<li>
- * </ul>
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IPerspectiveDescriptor
- * @see IEditorPart
- * @see IViewPart
- */
-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
- * <code>openEditor</code> is called.
- *
- * @see #openEditor
- */
- public static final String EDITOR_ID_ATTR = "org.eclipse.ui.editorID"; //$NON-NLS-1$
-
- /**
- * Change event id when the perspective is reset to its
- * original state.
- *
- * @see IPerspectiveListener
- */
- public static final String CHANGE_RESET = "reset"; //$NON-NLS-1$
-
- /**
- * Change event id when one or more perspective views are shown.
- *
- * @see IPerspectiveListener
- */
- public static final String CHANGE_VIEW_SHOW = "viewShow"; //$NON-NLS-1$
-
- /**
- * Change event id when one or more perspective views are hidden.
- *
- * @see IPerspectiveListener
- */
- public static final String CHANGE_VIEW_HIDE = "viewHide"; //$NON-NLS-1$
-
-
- /**
- * Change event id when one or more perspective editors are opened.
- *
- * @see IPerspectiveListener
- */
- public static final String CHANGE_EDITOR_OPEN = "editorOpen"; //$NON-NLS-1$
-
- /**
- * Change event id when one or more perspective editors are closed.
- *
- * @see IPerspectiveListener
- */
- public static final String CHANGE_EDITOR_CLOSE = "editorClose"; //$NON-NLS-1$
-
- /**
- * Change event id when the perspective editor area is shown.
- *
- * @see IPerspectiveListener
- */
- public static final String CHANGE_EDITOR_AREA_SHOW = "editorAreaShow"; //$NON-NLS-1$
-
- /**
- * Change event id when the perspective editor area is hidden.
- *
- * @see IPerspectiveListener
- */
- public static final String CHANGE_EDITOR_AREA_HIDE = "editorAreaHide"; //$NON-NLS-1$
-
- /**
- * Change event id when a perspective action set is shown.
- *
- * @see IPerspectiveListener
- */
- public static final String CHANGE_ACTION_SET_SHOW = "actionSetShow"; //$NON-NLS-1$
-
- /**
- * Change event id when the perspective action set is hidden.
- *
- * @see IPerspectiveListener
- */
- public static final String CHANGE_ACTION_SET_HIDE = "actionSetHide"; //$NON-NLS-1$
-
- /**
- * Change event id when a perspective fast view added.
- *
- * @see IPerspectiveListener
- */
- public static final String CHANGE_FAST_VIEW_ADD = "fastViewAdd"; //$NON-NLS-1$
-
- /**
- * Change event id when the perspective fast view removed.
- *
- * @see IPerspectiveListener
- */
- public static final String CHANGE_FAST_VIEW_REMOVE = "fastViewRemove"; //$NON-NLS-1$
-
- /**
- * Change event id when the page working set was replaced
- *
- * @see IPropertyChangeListener
- */
- public static final String CHANGE_WORKING_SET_REPLACE = "workingSetReplace"; //$NON-NLS-1$
-
-/**
- * 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
- */
-public void activate(IWorkbenchPart part);
-/**
- * Adds a property change listener.
- *
- * @param listener the property change listener to add
- * @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.
- */
-public 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.
- *
- * @param part the part to bring forward
- */
-public void bringToTop(IWorkbenchPart part);
-/**
- * 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.
- * </p>
- *
- * @return <code>true</code> if the page was successfully closed,
- * and <code>false</code> if it is still open
- */
-public boolean close();
-/**
- * Closes all of the editors belonging to this workbench page.
- * <p>
- * If the page has open editors with unsaved content and <code>save</code>
- * is <code>true</code>, the user will be given the opportunity to save them.
- * </p>
- *
- * @return <code>true</code> if all editors were successfully closed,
- * and <code>false</code> if at least one is still open
- */
-public boolean closeAllEditors(boolean save);
-/**
- * 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.
- * </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
- * @return <code>true</code> if the editor was successfully closed,
- * and <code>false</code> if the editor is still open
- */
-public boolean closeEditor(IEditorPart editor, boolean save);
-/**
- * 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
- * @return the view, or <code>null</code> if none is found
- */
-public IViewPart findView(String viewId);
-/**
- * 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.
- * </p>
- *
- * @return the active editor, or <code>null</code> if no editor is active
- */
-public IEditorPart getActiveEditor();
-/**
- * Returns the editor with the specified input. Returns null if there
- * is no opened editor with that input.
- *
- * @return an editor with input equals to <code>input</code>
- */
-public IEditorPart findEditor(IEditorInput input);
-/**
- * Returns a list of the editors open in this page.
- * <p>
- * Note that each page has its own editors; editors are never shared between
- * pages.
- * </p>
- *
- * @return a list of open editors
- *
- * @deprecated use getEditorReferences() instead
- */
-public IEditorPart[] getEditors();
-/**
- * Returns a array of references to open editors in this page.
- * <p>
- * Note that each page has its own editors; editors are never shared between
- * pages.
- * </p>
- *
- * @return a list of open editors
- */
-public IEditorReference[] getEditorReferences();
-/**
- * Returns a list of dirty editors in this page.
- *
- * @return a list of dirty editors
- */
-public IEditorPart[] getDirtyEditors();
-/**
- * Returns the input for this page.
- *
- * @return the input for this page, or <code>null</code> if none
- */
-public IAdaptable getInput();
-/**
- * Returns the page label. This will be a unique identifier within the
- * containing workbench window.
- *
- * @return the page label
- */
-public String getLabel();
-/**
- * Returns the current perspective descriptor for this page.
- *
- * @return the current perspective descriptor
- * @see #setPerspective
- * @see #savePerspective
- */
-public IPerspectiveDescriptor getPerspective();
-/**
- * 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.
- * </p>
- *
- * @return a list of references to visible views
- */
-public IViewReference[] getViewReferences();
-/**
- * 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.
- * </p>
- *
- * @return a list of visible views
- *
- * @deprecated use getViewReferences() instead.
- */
-public IViewPart[] getViews();
-/**
- * Returns the workbench window of this page.
- *
- * @return the workbench window
- */
-public IWorkbenchWindow getWorkbenchWindow();
-/**
- * Returns the working set of this page.
- *
- * @return the working set of this page.
- * @since 2.0
- * @deprecated individual views should store a working set if needed
- */
-public IWorkingSet getWorkingSet();
-/**
- * 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.
- * </p>
- */
-public void hideActionSet(String actionSetID);
-/**
- * Hides the given view. The view must belong to this page.
- *
- * @param view the view to hide
- */
-public void hideView(IViewPart view);
-/**
- * Returns whether the page's current perspective is showing
- * the editor area.
- *
- * @return <code>true</code> when editor area visible, <code>false</code> otherwise
- */
-public boolean isEditorAreaVisible();
-/**
- * Opens an editor on the given file resource.
- * <p>
- * If this page already has an editor open on the target object that editor is
- * activated; otherwise, a new editor is opened.
- * <p><p>
- * An appropriate editor for the input is determined using a multistep process.
- * </p>
- * <ol>
- * <li>The workbench editor registry is consulted to determine if an editor
- * extension has been registered for the file type. If so, an
- * instance of the editor extension is opened on the file.
- * See <code>IEditorRegistry.getDefaultEditor(IFile)</code>.
- * <li>Next, the native operating system will be consulted to determine if a native
- * editor exists for the file type. If so, a new process is started
- * and the native editor is opened on the file.
- * <li>If all else fails the file will be opened in a default text editor.</li>
- * </ol>
- * </p>
- *
- * @param input the file to edit
- * @return an open and active editor, or null if a system editor was opened
- * @exception PartInitException if the editor could not be initialized
- */
-public IEditorPart openEditor(IFile input) throws PartInitException;
-/**
- * Opens an editor on the given file resource.
- * <p>
- * If this page already has an editor open on the target object that editor is
- * brought to front; otherwise, a new editor is opened. If
- * <code>activate == true</code> the editor will be activated.
- * <p><p>
- * The editor type is determined by mapping <code>editorId</code> to an editor
- * 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>
- *
- * @param input the file to edit
- * @param editorId the id of the editor extension to use or null
- * @param activate if <code>true</code> the editor will be activated
- * @return an open and active editor
- * @exception PartInitException if the editor could not be initialized
- */
-public IEditorPart openEditor(IFile input, String editorID, boolean activate)
- throws PartInitException;
-/**
- * Opens an editor on the given file resource.
- * <p>
- * If this page already has an editor open on the target object that editor is
- * activated; otherwise, a new editor is opened.
- * <p><p>
- * The editor type is determined by mapping <code>editorId</code> to an editor
- * 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>
- *
- * @param editorId the id of the editor extension to use
- * @param input the file to edit
- * @return an open and active editor
- * @exception PartInitException if the editor could not be initialized
- */
-public IEditorPart openEditor(IFile input, String editorID)
- throws PartInitException;
-/**
- * Opens an editor on the file resource of the given marker.
- * <p>
- * If this page already has an editor open on the target object that editor is
- * activated; otherwise, a new editor is opened. The cursor and selection state
- * of the editor is then updated from information recorded in the marker.
- * <p><p>
- * If the marker contains an <code>EDITOR_ID_ATTR</code> attribute
- * the attribute value will be used to determine the editor type to be opened.
- * If not, the registered editor for the marker resource will be used.
- * </p>
- *
- * @param marker the marker to open
- * @return an open and active editor, or null if a system editor was opened
- * @exception PartInitException if the editor could not be initialized
- * @see IEditorPart#gotoMarker
- */
-public IEditorPart openEditor(IMarker marker) throws PartInitException;
-/**
- * Opens an editor on the file resource of the given marker.
- * <p>
- * If this page already has an editor open on the target object that editor is
- * brought to front; otherwise, a new editor is opened. If
- * <code>activate == true</code> the editor will be activated. The cursor and
- * selection state of the editor are then updated from information recorded in
- * the marker.
- * <p><p>
- * If the marker contains an <code>EDITOR_ID_ATTR</code> attribute
- * the attribute value will be used to determine the editor type to be opened.
- * If not, the registered editor for the marker resource will be used.
- * </p>
- *
- * @param marker the marker to open
- * @param activate if <code>true</code> the editor will be activated
- * @return an open editor, or null if a system editor was opened
- * @exception PartInitException if the editor could not be initialized
- * @see IEditorPart#gotoMarker
- */
-public IEditorPart openEditor(IMarker marker, boolean activate)
- throws PartInitException;
-/**
- * Opens an editor on the given object.
- * <p>
- * If this page already has an editor open on the target object that editor is
- * activated; otherwise, a new editor is opened.
- * <p><p>
- * The editor type is determined by mapping <code>editorId</code> to an editor
- * 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>
- *
- * @param input the editor input
- * @param editorId the id of the editor extension to use
- * @return an open and active editor
- * @exception PartInitException if the editor could not be initialized
- */
-public IEditorPart openEditor(IEditorInput input, String editorId)
- throws PartInitException;
-/**
- * Opens an editor on the given object.
- * <p>
- * If this page already has an editor open on the target object that editor is
- * brought to the front; otherwise, a new editor is opened. If
- * <code>activate == true</code> the editor will be activated.
- * <p><p>
- * The editor type is determined by mapping <code>editorId</code> to an editor
- * 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>
- *
- * @param input the editor input
- * @param editorId the id of the editor extension to use
- * @param activate if <code>true</code> the editor will be activated
- * @return an open editor
- * @exception PartInitException if the editor could not be initialized
- */
-public IEditorPart openEditor(IEditorInput input, String editorId, boolean activate)
- throws PartInitException;
-/**
- * Opens an operating system editor on a given file. Once open, the
- * workbench has no knowledge of the editor or the state of the file
- * being edited. Users are expected to perform a "Local Refresh" from
- * the workbench user interface.
- *
- * @param input the file to edit
- * @exception PartInitException if the editor could not be opened.
- */
-public void openSystemEditor(IFile input) throws PartInitException;
-/**
- * Removes the property change listener.
- *
- * @param listener the property change listener to remove
- * @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.
- */
-public 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.
- * <p>
- * For more information on perspective change see<code>setPerspective()</code>.
- * </p>
- */
-public 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.
- * <p>
- * If <code>confirm</code> is <code>true</code> the user is prompted to
- * confirm the command.
- * </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 at least one editor with unsaved changes was not saved
- */
-public boolean saveAllEditors(boolean confirm);
-/**
- * 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.
- * </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
- */
-public 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.
- */
-public 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
- * perspective descriptor are overwritten and it is made the current one
- * for this page.
- *
- * @param perspective the perspective descriptor to save to
- */
-public 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
- */
-public 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.
- * <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.
- * </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.
- * </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.
- * </p><p>
- * The open editors are not modified by this method.
- * </p>
- *
- * @param perspective the perspective descriptor
- */
-public 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.
- * </p>
- */
-public void showActionSet(String actionSetID);
-/**
- * Shows a view in this page and give it focus. If the view is already visible,
- * it is given focus.
- * <p>
- * The view type is determined by mapping <code>viewId</code> to a view extension
- * registered with the workbench. A view id is passed rather than a view object
- * to prevent the accidental creation of more than one view of a particular type.
- * It also guarantees a consistent lifecycle for views, regardless of whether
- * they are created by the user or restored from saved data.
- * </p>
- *
- * @param viewId the id of the view extension to use
- * @return a view
- * @exception PartInitException if the view could not be initialized
- */
-public IViewPart showView(String viewId) throws PartInitException;
-/**
- * Returns true if the editor is pinned and should not be
- * reused.
- *
- * @return boolean
- */
-public boolean isEditorPinned(IEditorPart editor);
-/**
- * Returns the number of open editors before reusing editors.
- *
- * @return a int
- *
- * Note: For EXPERIMENTAL use only. IT MAY CHANGE IN NEAR FUTURE.
- *
- * @deprecated
- */
-public int getEditorReuseThreshold();
-/**
- * Set the number of open editors before reusing editors.
- * If < 0 the user preference settings will be used.
- *
- * Note: For EXPERIMENTAL use only. IT MAY CHANGE IN NEAR FUTURE.
- *
- * @deprecated use IPageLayout.setEditorReuseThreshold(int openEditors) instead.
- */
-public void setEditorReuseThreshold(int openEditors);
-/**
- * 2.1 - WORK_IN_PROGRESS. Do not use.
- *
- * 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.
- */
-public INavigationHistory getNavigationHistory();
-}
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
deleted file mode 100644
index 74d7883..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPart.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * A workbench part is a visual component within a workbench page. There
- * are two subtypes: view and editor, as defined by <code>IViewPart</code> and
- * <code>IEditorPart</code>.
- * <p>
- * A view is typically used to navigate a hierarchy of information (like the
- * workspace), open an editor, or display properties for the active editor.
- * Modifications made in a view are saved immediately.
- * </p><p>
- * An editor is typically used to edit or browse a document or input object.
- * The input is identified using an <code>IEditorInput</code>. Modifications made
- * in an editor part follow an open-save-close lifecycle model.
- * </p><p>
- * This interface may be implemented directly. For convenience, a base
- * implementation is defined in <code>WorkbenchPart</code>.
- * </p><p>
- * The lifecycle of a workbench part is as follows:
- * <ul>
- * <li>When a part extension is created:
- * <ul>
- * <li>instantiate the part</li>
- * <li>create a part site</li>
- * <li>call <code>part.init(site)</code></li>
- * </ul>
- * <li>When a part becomes visible in the workbench:
- * <ul>
- * <li>add part to presentation by calling
- * <code>part.createControl(parent)</code> to create actual widgets</li>
- * <li>fire <code>partOpened</code> event to all listeners</li>
- * </ul>
- * </li>
- * <li>When a part is activated or gets focus:
- * <ul>
- * <li>call <code>part.setFocus()</code></li>
- * <li>fire <code>partActivated</code> event to all listeners</li>
- * </ul>
- * </li>
- * <li>When a part is closed:
- * <ul>
- * <li>if save is needed, do save; if it fails or is canceled return</li>
- * <li>if part is active, deactivate part</li>
- * <li>fire <code>partClosed</code> event to all listeners</li>
- * <li>remove part from presentation; part controls are disposed as part
- * of the SWT widget tree
- * <li>call <code>part.dispose()</code></li>
- * </ul>
- * </li>
- * </ul>
- * </p>
- * <p>
- * After <code>createPartControl</code> has been called, the implementor may
- * safely reference the controls created. When the part is closed
- * these controls will be disposed as part of an SWT composite. This
- * occurs before the <code>IWorkbenchPart.dispose</code> method is called.
- * If there is a need to free SWT resources the part should define a dispose
- * listener for its own control and free those resources from the dispose
- * listener. If the part invokes any method on the disposed SWT controls
- * after this point an <code>SWTError</code> will be thrown.
- * </p>
- * <p>
- * The last method called on <code>IWorkbenchPart</code> is <code>dispose</code>.
- * This signals the end of the part lifecycle.
- * </p>
- * <p>
- * An important point to note about this lifecycle is that following
- * a call to init, createControl may never be called. Thus in the dispose
- * method, implementors must not assume controls were created.
- * </p>
- * <p>
- * Workbench parts implement the <code>IAdaptable</code> interface; extensions
- * are managed by the platform's adapter manager.
- * </p>
- *
- * @see IViewPart
- * @see IEditorPart
- */
-public interface IWorkbenchPart extends IAdaptable {
-
- /**
- * The property id for <code>getTitle</code> and <code>getTitleImage</code>.
- */
- public static final int PROP_TITLE = 0x01;
-/**
- * Adds a listener for changes to properties of this workbench part.
- * Has no effect if an identical listener is already registered.
- * <p>
- * The properties ids are as follows:
- * <ul>
- * <li><code>IWorkbenchPart.PROP_TITLE</code> </li>
- * <li><code>IEditorPart.PROP_INPUT</code> </li>
- * <li><code>IEditorPart.PROP_DIRTY</code> </li>
- * </ul>
- * </p>
- *
- * @param listener a property listener
- */
-public 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 needs to, which may be never).
- * </p>
- * <p>
- * For implementors this is a multi-step process:
- * <ol>
- * <li>Create one or more controls within the parent.</li>
- * <li>Set the parent layout as needed.</li>
- * <li>Register any global actions with the <code>IActionService</code>.</li>
- * <li>Register any popup menus with the <code>IActionService</code>.</li>
- * <li>Register a selection provider with the <code>ISelectionService</code>
- * (optional). </li>
- * </ol>
- * </p>
- *
- * @param parent the parent control
- */
-public 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.
- * 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>
- */
-public void dispose();
-/**
- * Returns the site for this workbench part.
- *
- * @return the part site
- */
-public 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
- */
-public 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
- */
-public Image getTitleImage();
-/**
- * Returns the title tool tip text of this workbench part. 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
- */
-public String getTitleToolTip();
-/**
- * Removes the given property listener from this workbench part.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a property listener
- */
-public 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).
- * </p>
- */
-public void setFocus();
-}
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
deleted file mode 100644
index 9041a47..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartDescriptor.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.IEditorActionBarContributor;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * 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>
- */
-public interface IWorkbenchPartDescriptor{
-/**
- * Returns the part id.
- *
- * @return the id of the part
- */
-public String getId();
-/**
- * Returns the descriptor of the image for this part.
- *
- * @return the descriptor of the image to display next to this part
- */
-public ImageDescriptor getImageDescriptor();
-/**
- * Returns the label to show for this part.
- *
- * @return the part label
- */
-public 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
deleted file mode 100644
index 073197c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartReference.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.ui;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.*;
-/**
- * Implements a reference to a IWorkbenchPart.
- * The IWorkbenchPart will not be instanciated 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>
- */
-public interface IWorkbenchPartReference {
- /**
- * Returns the IWorkbenchPart referenced by this object.
- * Returns <code>null</code> if the editors was not instantiated or
- * it failed to be restored. Tries to restore the editor
- * if <code>restore</code> is true.
- */
- public IWorkbenchPart getPart(boolean restore);
-
- /**
- * @see IWorkbenchPart#getTitle
- */
- public String getTitle();
-
- /**
- * @see IWorkbenchPart#getTitleImage
- */
- public Image getTitleImage();
-
- /**
- * @see IWorkbenchPart#getTitleToolTip
- */
- public String getTitleToolTip();
-
- /**
- * @see IWorkbenchPartSite#getId
- */
- public String getId();
-
- /**
- * @see IWorkbenchPart#addPropertyListener
- */
- public void addPropertyListener(IPropertyListener listener);
-
- /**
- * @see IWorkbenchPart#removePropertyListener
- */
- public void removePropertyListener(IPropertyListener listener);
- /**
- * Returns the workbench page that contains this part
- */
- public IWorkbenchPage getPage();
-}
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
deleted file mode 100644
index 876e8ae..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPartSite.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-/**
- * The primary interface between a workbench part and the outside world.
- * <p>
- * This interface is not intended to be implemented or extended by clients.
- * </p>
- */
-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
- * @see #getConfigurationElement
- */
-public 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
- * @see org.eclipse.core.runtime.IPluginDescriptor#getUniqueIdentifier
- */
-public 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
- */
-public 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.
- * <p>
- * For a detailed description of context menu registration see
- * <code>registerContextMenu(MenuManager, ISelectionProvider);
- * </p>
- *
- * @param menuId the menu id
- * @param menuManager the menu manager
- * @param selectionProvider the selection provider
- */
-public 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).
- * <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
- */
-public 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.
- * </p>
- *
- * @return the key binding service in use
- * @since 2.0
- */
-public IKeyBindingService getKeyBindingService();
-}
\ No newline at end of file
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
deleted file mode 100644
index 9d7dc1c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferenceConstants.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Preference ids exposed by the Eclipse Platform User Interface.
- */
-public interface IWorkbenchPreferenceConstants {
-
- /**
- * A named preference for whether to show an editor when its
- * input file is selected in the Navigator (and vice versa).
- * <p>
- * Value is of type <code>boolean</code>.
- * </p>
- */
- public static final String LINK_NAVIGATOR_TO_EDITOR =
- "LINK_NAVIGATOR_TO_EDITOR"; //$NON-NLS-1$
-
- /**
- * 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
- * OPEN_PERSPECTIVE_REPLACE</code>.
- * </p>
- *
- */
- public static final 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.
- * <p>
- * 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.
- */
- public static final String ALTERNATE_OPEN_NEW_PERSPECTIVE =
- "ALTERNATE_OPEN_NEW_PERSPECTIVE"; //$NON-NLS-1$
-
- /**
- * 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
- * OPEN_PERSPECTIVE_REPLACE</code>.
- * </p>
- * @deprecated Workbench no longer supports shift key modifier to open
- * a new perspective. Callers should use IWorkbench.showPerspective methods.
- */
- public static final String SHIFT_OPEN_NEW_PERSPECTIVE =
- "SHIFT_OPEN_NEW_PERSPECTIVE"; //$NON-NLS-1$
-
- /**
- * 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 <code>OPEN_PERSPECTIVE_WINDOW, OPEN_PERSPECTIVE_PAGE,
- * OPEN_PERSPECTIVE_REPLACE and NO_NEW_PERSPECTIVE</code>.
- * </p>
- */
- public static final 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.
- */
- public static final 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.
- *
- * @deprecated Opening a Perspective in a new page is no longer
- * supported functionality as of 2.0.
- */
- public static final 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.
- *
- */
- public static final String OPEN_PERSPECTIVE_REPLACE =
- "OPEN_PERSPECTIVE_REPLACE"; //$NON-NLS-1$
-
- /**
- * A preference value indicating that an action should not open a
- * new perspective.
- *
- */
- public static final String NO_NEW_PERSPECTIVE = "NO_NEW_PERSPECTIVE"; //$NON-NLS-1$
-
- /**
- * A preference value indicating the default workbench perspective
- */
- public static final String DEFAULT_PERSPECTIVE_ID = "defaultPerspectiveId"; //$NON-NLS-1$
-}
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
deleted file mode 100644
index 3b8891d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPreferencePage.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.preference.IPreferencePage;
-
-/**
- * Interface for workbench preference pages.
- * <p>
- * Clients should implement this interface and include the name of their class
- * in an extension contributed to the workbench's preference extension point
- * (named <code>"org.eclipse.ui.preferencePages"</code>).
- * For example, the plug-in's XML markup might contain:
- * <pre>
- * <extension point="org.eclipse.ui.preferencePages">
- * <page id="com.example.myplugin.prefs"
- * name="Knobs"
- * class="com.example.myplugin.MyPreferencePage" />
- * </extension>
- * </pre>
- * </p>
- */
-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);
-}
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
deleted file mode 100644
index 8a3ad02..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchPropertyPage.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.preference.IPreferencePage;
-
-/**
- * Interface for workbench property pages. Property pages generally show up in
- * the workbench's Property Pages dialog.
- * <p>
- * Clients should implement this interface and include the name of their class
- * in an extension contributed to the workbench's property page extension point
- * (named <code>"org.eclipse.ui.propertyPages"</code>).
- * For example, the plug-in's XML markup might contain:
- * <pre>
- * <extension point="org.eclipse.ui.propertyPages">
- * <page id="com.example.myplugin.props"
- * name="Knobs"
- * objectClass="org.eclipse.core.resources.IResource"
- * class="com.example.myplugin.MyPropertyPage" />
- * </extension>
- * </pre>
- * </p>
- */
-public interface IWorkbenchPropertyPage extends IPreferencePage {
-/**
- * Returns the object that owns the properties shown in this property page.
- *
- * @return the object that owns the properties in this page
- */
-public IAdaptable getElement();
-/**
- * Sets the object that owns the properties shown in this property page.
- * The page is expected to store this object and provide it if
- * <code>getElement</code> is called.
- *
- * @param the object that owns the properties in this page
- */
-public void setElement(IAdaptable element);
-}
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
deleted file mode 100644
index a8bb6c3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchSite.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * The common interface between the workbench and its parts, including pages within parts.
- * <p>
- * This interface is not intended to be implemented or extended by clients.
- * </p>
- * @see IWorkbenchPartSite
- * @see IPageSite
- * @since 2.0
- */
-public interface IWorkbenchSite {
-/**
- * Returns the page containing this workbench site.
- *
- * @return the page containing this workbench site
- */
-public IWorkbenchPage getPage();
-/**
- * Returns the selection provider for this workbench site.
- *
- * @return the selection provider, or <code>null</code> if none
- */
-public ISelectionProvider getSelectionProvider();
-/**
- * Returns the shell for this workbench site.
- *
- * @return the shell for this workbench site
- */
-public Shell getShell();
-/**
- * Returns the workbench window containing this workbench site.
- *
- * @return the workbench window containing this workbench site
- */
-public IWorkbenchWindow getWorkbenchWindow();
-/**
- * Sets the selection provider for this workbench site.
- *
- * @param provider the selection provider, or <code>null</code> to clear it
- */
-public 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
deleted file mode 100644
index fdce73a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindow.java
+++ /dev/null
@@ -1,144 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * A workbench window is a top level window in a workbench. Visually, a workbench
- * window has a menubar, a toolbar, a status bar, and a main area for displaying
- * a single page consisting of a collection of views and editors.
- * <p>
- * Each workbench window has a collection of 0 or more pages; the active page is
- * the one that is being presented to the end user; at most one page is active
- * in a window at a time.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IWorkbenchPage
- */
-public interface IWorkbenchWindow extends IPageService,
- IRunnableContext {
-/**
- * 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
- */
-public boolean close();
-/**
- * Returns the currently active page for this workbench window.
- *
- * @return the active page, or <code>null</code> if none
- */
-public 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
- */
-public IWorkbenchPage[] getPages();
-/**
- * Returns the part service which tracks part activation within this workbench
- * window.
- *
- * @return the part service
- */
-public IPartService getPartService();
-/**
- * Returns the selection service which tracks selection within this workbench
- * window.
- *
- * @return the selection service
- */
-public ISelectionService getSelectionService();
-/**
- * Returns this workbench window's shell.
- *
- * @return the shell containing this window's controls
- */
-public Shell getShell();
-/**
- * Returns the workbench for this window.
- *
- * @return the workbench
- */
-public 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 is not
- */
-public 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.openPerspective</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#openPerspective
- */
-public 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.openPerspective</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#openPerspective
- */
-public IWorkbenchPage openPage(IAdaptable input)
- throws WorkbenchException;
-/**
- * Sets or clears the currently active page for this workbench window.
- *
- * @param page the new active page
- */
-public void setActivePage(IWorkbenchPage page);
-}
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
deleted file mode 100644
index 92a6413..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowActionDelegate.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * 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.
- */
-public 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
- */
-public 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
deleted file mode 100644
index 54f6aff..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Interface for a pulldown action that is contributed into the workbench window
- * 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. The menu
- * is disposed after use.
- *
- * @return the menu
- */
-public 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
deleted file mode 100644
index db9c755..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWindowPulldownDelegate2.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.ui;
-
-import org.eclipse.swt.widgets.Menu;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * 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. The menu
- * is disposed after use.
- *
- * @return the menu
- */
- public Menu getMenu(Menu parent);
-}
\ No newline at end of file
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
deleted file mode 100644
index 739e97a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkbenchWizard.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-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.
- *
- * @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);
-}
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
deleted file mode 100644
index cb18193..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSet.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.ui;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.util.IPropertyChangeListener;
-
-/**
- * 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.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @since 2.0
- */
-public interface IWorkingSet {
- /**
- * Returns the name of the working set.
- *
- * @return the name of the working set
- */
- public String getName();
- /**
- * Returns the elements that are contained in this working set.
- *
- * @return the working set's elements
- */
- public IAdaptable[] getElements();
- /**
- * Sets the elements that are contained in this working set.
- *
- * @param elements the elements to set in this working set
- */
- public void setElements(IAdaptable[] elements);
- /**
- * 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
- */
- public void setName(String name);
-}
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
deleted file mode 100644
index d8fde4f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/IWorkingSetManager.java
+++ /dev/null
@@ -1,172 +0,0 @@
-package org.eclipse.ui;
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
-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.
- * <p>
- * The workbench working set manager can be accessed using
- * <code>IWorkbench#getWorkingSetManager()</code>
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IWorkingSet
- * @since 2.0
- */
-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
- */
- public static final 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
- */
- public static final 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.
- * oldValue will be null.
- *
- * @see IPropertyChangeListener
- */
- public static final 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.
- * oldValue will be null.
- *
- * @see IPropertyChangeListener
- */
- public static final String CHANGE_WORKING_SET_NAME_CHANGE = "workingSetNameChange"; //$NON-NLS-1$
-
- /**
- * Adds a property change listener.
- *
- * @param listener the property change listener to add
- */
- public 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.
- */
- public 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
- */
- public 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 elememts the working set contents
- * @return a new working set with the specified name and content
- */
- public IWorkingSet createWorkingSet(String name, IAdaptable[] elements);
- /**
- * 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);
- * 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.
- * If the specific 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 null is returned.
- * @since 2.1
- */
- public IWorkingSetEditWizard createWorkingSetEditWizard(IWorkingSet workingSet);
- /**
- * @deprecated use createWorkingSetSelectionDialog(parent, true) instead
- */
- public 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 shell the parent of the working set selection dialog
- * @param multi true=more than one working set can be chosen
- * in the dialog. false=only one working set can be chosen. Multiple
- * working sets can still be selected and removed from the list but
- * the dialog can only be closed when a single working set is selected.
- * @return a working set selection dialog
- */
- public IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parent, boolean multi);
- /**
- * 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
- */
- public 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.
- */
- public IWorkingSet getWorkingSet(String name);
- /**
- * Returns an array of all working sets stored in the receiver.
- *
- * @return the working sets stored in the receiver
- */
- public IWorkingSet[] getWorkingSets();
- /**
- * Removes the property change listener.
- *
- * @param listener the property change listener to remove
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener);
- /**
- * Removes the working set
- *
- * @param workingSet the working set to remove
- */
- public void removeWorkingSet(IWorkingSet workingSet);
-}
\ No newline at end of file
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
deleted file mode 100644
index 4629fa4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/NavigationLocation.java
+++ /dev/null
Binary files differ
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
deleted file mode 100644
index 21f7dc7..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PartInitException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * A checked exception indicating a workbench part cannot be initialized
- * correctly. The message text provides a further description of the problem.
- * <p>
- * This exception class is not intended to be subclassed by clients.
- * </p>
- */
-public class PartInitException extends WorkbenchException {
-/**
- * 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
- * @parem 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);
-}
-}
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
deleted file mode 100644
index 139aa6d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/PlatformUI.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * 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>
- * <li>access to the workbench.</li>
- * </ul>
- * <p>
- *
- * @see IWorkbench
- */
-public final class PlatformUI {
- /**
- * Identifies the workbench plugin.
- */
- public static final String PLUGIN_ID = "org.eclipse.ui";//$NON-NLS-1$
-
- private static IWorkbench instance;
-/**
- * Block instantiation.
- */
-private PlatformUI() {
-}
-/**
- * Returns the workbench interface.
- */
-public static IWorkbench getWorkbench() {
- if (instance == null) {
- instance = WorkbenchPlugin.getDefault().getWorkbench();
- }
- return instance;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ResourceWorkingSetFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ResourceWorkingSetFilter.java
deleted file mode 100644
index 21c06c3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/ResourceWorkingSetFilter.java
+++ /dev/null
Binary files differ
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
deleted file mode 100644
index 4f45dbf..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/WorkbenchException.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.ui;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-/**
- * A checked exception indicating a recoverable error occured internal to the
- * workbench. The status provides a further description of the problem.
- * <p>
- * This exception class is not intended to be subclassed by clients.
- * </p>
- */
-public class WorkbenchException extends CoreException {
-/**
- * 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 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
deleted file mode 100644
index 11c1a23..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/XMLMemento.java
+++ /dev/null
@@ -1,402 +0,0 @@
-package org.eclipse.ui;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.ArrayList;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import org.apache.xerces.dom.DocumentImpl;
-import org.apache.xerces.dom.TextImpl;
-import org.apache.xml.serialize.OutputFormat;
-import org.apache.xml.serialize.Serializer;
-import org.apache.xml.serialize.SerializerFactory;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Text;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-/**
- * This class represents the default implementation of the
- * <code>IMemento</code> interface.
- * <p>
- * This class is not intended to be extended by clients.
- * </p>
- *
- * @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 <code>WorkbenchException</code> 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 <code>WorkbenchException</code> if IO problems, invalid format, or no element.
- */
- public static XMLMemento createReadRoot(Reader reader, String baseDir) throws WorkbenchException {
- String messageKey = "XMLMemento.noElement"; //$NON-NLS-1$
- Exception exception = null;
-
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- DocumentBuilder parser = factory.newDocumentBuilder();
- InputSource source = new InputSource(reader);
- if (baseDir != null)
- source.setSystemId(baseDir);
- 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;
- messageKey = "XMLMemento.parserConfigError"; //$NON-NLS-1$
- } catch (IOException e) {
- exception = e;
- messageKey = "XMLMemento.ioError"; //$NON-NLS-1$
- } catch (SAXException e) {
- exception = e;
- messageKey = "XMLMemento.formatError"; //$NON-NLS-1$
- }
-
- String problemText = null;
- if (exception != null)
- problemText = exception.getMessage();
- if (problemText == null || problemText.length() == 0)
- problemText = WorkbenchMessages.getString(messageKey);
- throw new WorkbenchException(problemText, exception);
- }
-
- /**
- * Returns a root memento for writing a document.
- *
- * @param type the element node type to create on the document
- * @return the root memento for writing a document
- */
- public static XMLMemento createWriteRoot(String type) {
- Document document = new DocumentImpl();
- Element element = document.createElement(type);
- document.appendChild(element);
- return new XMLMemento(document, element);
- }
-
- /**
- * 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
- * @return the memento on the specified document and element
- */
- public XMLMemento(Document document, Element element) {
- super();
- this.factory = document;
- this.element = element;
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public IMemento createChild(String type) {
- Element child = factory.createElement(type);
- element.appendChild(child);
- return new XMLMemento(factory, child);
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public IMemento createChild(String type, String id) {
- Element child = factory.createElement(type);
- child.setAttribute(TAG_ID, id);
- element.appendChild(child);
- return new XMLMemento(factory, child);
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public IMemento copyChild(IMemento child) {
- Element childElement = ((XMLMemento) child).element;
- Element newElement = (Element) factory.importNode(childElement, true);
- element.appendChild(newElement);
- return new XMLMemento(factory, newElement);
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public IMemento getChild(String type) {
-
- // 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))
- return new XMLMemento(factory, element);
- }
- }
-
- // A child was not found.
- return null;
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public IMemento[] getChildren(String type) {
-
- // Get the nodes.
- NodeList nodes = element.getChildNodes();
- int size = nodes.getLength();
- if (size == 0)
- return new IMemento[0];
-
- // Extract each node with given type.
- ArrayList 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))
- 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, (Element) list.get(x));
- }
- return results;
- }
-
- /**
- * Returns the XML element contained in this memento.
- */
- private Element getElement() {
- return element;
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public Float getFloat(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- String strValue = attr.getValue();
- try {
- return new Float(strValue);
- } catch (NumberFormatException e) {
- WorkbenchPlugin.log("Memento problem - Invalid float for key: " //$NON-NLS-1$
- + key + " value: " + strValue); //$NON-NLS-1$
- return null;
- }
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public String getID() {
- return element.getAttribute(TAG_ID);
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public Integer getInteger(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- String strValue = attr.getValue();
- try {
- return new Integer(strValue);
- } catch (NumberFormatException e) {
- WorkbenchPlugin.log("Memento problem - invalid integer for key: " + key //$NON-NLS-1$
- + " value: " + strValue); //$NON-NLS-1$
- return null;
- }
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public String getString(String key) {
- Attr attr = element.getAttributeNode(key);
- if (attr == null)
- return null;
- return attr.getValue();
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public String getTextData() {
- Text textNode = getTextNode();
- if (textNode != null) {
- return textNode.getData();
- } else {
- return null;
- }
- }
-
- /**
- * 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;
- }
-
- /**
- * Places the element's attributes into the document.
- */
- private void putElement(Element element) {
- 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();
- 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);
- }
- }
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public void putFloat(String key, float f) {
- element.setAttribute(key, String.valueOf(f));
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public void putInteger(String key, int n) {
- element.setAttribute(key, String.valueOf(n));
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public void putMemento(IMemento memento) {
- putElement(((XMLMemento) memento).element);
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public void putString(String key, String value) {
- if (value == null)
- return;
- element.setAttribute(key, value);
- }
-
- /* (non-Javadoc)
- * Method declared in IMemento.
- */
- public void putTextData(String data) {
- Text textNode = getTextNode();
- if (textNode == null) {
- textNode = factory.createTextNode(data);
- element.appendChild(textNode);
- } 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
- */
- public void save(Writer writer) throws IOException {
- OutputFormat format = new OutputFormat();
- format.setPreserveSpace(true);
- Serializer serializer = SerializerFactory.getSerializerFactory("xml").makeSerializer(writer, format); //$NON-NLS-1$
- serializer.asDOMSerializer().serialize(factory);
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index e405b1d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionContext.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-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.
- * <p>
- * 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 input element.
- */
- private Object input;
-
- /**
- * Creates a new action context with the given selection.
- */
- public ActionContext(ISelection selection) {
- setSelection(selection);
- }
-
- /**
- * Returns the selection.
- */
- public ISelection getSelection() {
- return selection;
- }
-
- /**
- * Sets the selection.
- */
- public void setSelection(ISelection selection) {
- this.selection = selection;
- }
-
- /**
- * Returns the input element.
- */
- public Object getInput() {
- return input;
- }
-
- /**
- * Sets the input element.
- *
- * @input the input element
- */
- 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
deleted file mode 100644
index f1bbdaa..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionDelegate.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-
-/**
- * Abstract base implementation of <code>IActionDelegate</code>.
- * <p>
- * Subclasses must implement <code>run</code> to do the action's work, and may
- * reimplement <code>selectionChanged</code> to react to selection changes
- * in the workbench.
- * </p>
- */
-public abstract class ActionDelegate implements IActionDelegate {
-/* (non-Javadoc)
- * Method declared on IActionBar.
- */
-public abstract void run(IAction action);
-/**
- * The <code>ActionDelegate</code> implementation of this <code>IAction</code>
- * method does nothing. Subclasses may reimplement.
- */
-public void selectionChanged(IAction action, ISelection selection) {
-}
-}
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
deleted file mode 100644
index d1dfb8d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ActionGroup.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-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.
- * <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.
- * </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;
-
- /**
- * 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;
- };
-
- /**
- * 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) {
- };
-
- /**
- * 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) {
- };
-
- /**
- * 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() {
- }
-
- /**
- * 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);
- };
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/AddBookmarkAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/AddBookmarkAction.java
deleted file mode 100644
index 86a3cff..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/AddBookmarkAction.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-
-import java.util.Iterator;
-
-/**
- * Standard action for adding a bookmark to the currently selected file
- * resource(s).
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class AddBookmarkAction extends SelectionListenerAction {
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".AddBookmarkAction";//$NON-NLS-1$
-
- /**
- * The shell in which to show any dialogs.
- */
- private Shell shell;
-/**
- * Creates a new bookmark action.
- *
- * @param shell the shell for any dialogs
- */
-public AddBookmarkAction(Shell shell) {
- super(WorkbenchMessages.getString("AddBookmarkLabel")); //$NON-NLS-1$
- setId(ID);
- Assert.isNotNull(shell);
- this.shell = shell;
- setToolTipText(WorkbenchMessages.getString("AddBookmarkToolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.ADD_BOOKMARK_ACTION);
-}
-/**
- * Creates a marker of the given type on each of the files in the
- * current selection.
- *
- * @param markerType the marker type
- */
-void createMarker(String markerType) {
- IStructuredSelection selection = getStructuredSelection();
- for (Iterator enum = selection.iterator(); enum.hasNext();) {
- Object o = enum.next();
- if (o instanceof IFile) {
- createMarker((IFile) o, markerType);
- } else if (o instanceof IAdaptable) {
- Object resource = ((IAdaptable)o).getAdapter(IResource.class);
- if (resource instanceof IFile)
- createMarker((IFile)resource, markerType);
- }
- }
-}
-/**
- * Creates a marker of the given type on the given file resource.
- *
- * @param file the file resource
- * @param markerType the marker type
- */
-void createMarker(final IFile file, final String markerType) {
- try {
- file.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- IMarker marker = file.createMarker(markerType);
- marker.setAttribute(IMarker.MESSAGE, file.getName());
- }
- }, null);
- } catch (CoreException e) {
- WorkbenchPlugin.log(null, e.getStatus()); // We don't care
- }
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void run() {
- createMarker(IMarker.BOOKMARK);
-}
-/**
- * The <code>AddBookmarkAction</code> implementation of this
- * <code>SelectionListenerAction</code> method enables the action only
- * if the selection is not empty and contains just file resources.
- */
-protected boolean updateSelection(IStructuredSelection selection) {
- return super.updateSelection(selection)
- && !selection.isEmpty()
- && selectionIsOfType(IFile.FILE);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BuildAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BuildAction.java
deleted file mode 100644
index 072ae57..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/BuildAction.java
+++ /dev/null
@@ -1,267 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.*;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.widgets.Shell;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Standard actions for full and incremental builds of the selected project(s).
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class BuildAction extends WorkspaceAction {
-
- /**
- * The id of an incremental build action.
- */
- public static final String ID_BUILD = PlatformUI.PLUGIN_ID + ".BuildAction";//$NON-NLS-1$
-
- /**
- * The id of a rebuild all action.
- */
- public static final String ID_REBUILD_ALL = PlatformUI.PLUGIN_ID + ".RebuildAllAction";//$NON-NLS-1$
-
- private int buildType;
-
- /**
- * The list of IProjects to build (computed lazily).
- */
- private List projectsToBuild = null;
-
-/**
- * Creates a new action of the appropriate type. The action id is
- * <code>ID_BUILD</code> for incremental builds and <code>ID_REBUILD_ALL</code>
- * for full builds.
- *
- * @param shell the shell for any dialogs
- * @param type the type of build; one of
- * <code>IncrementalProjectBuilder.INCREMENTAL_BUILD</code> or
- * <code>IncrementalProjectBuilder.FULL_BUILD</code>
- */
-public BuildAction(Shell shell, int type) {
- super(shell, "");//$NON-NLS-1$
-
- if (type == IncrementalProjectBuilder.INCREMENTAL_BUILD) {
- setText(WorkbenchMessages.getString("BuildAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("BuildAction.toolTip")); //$NON-NLS-1$
- setId(ID_BUILD);
- WorkbenchHelp.setHelp(this, IHelpContextIds.INCREMENTAL_BUILD_ACTION);
- }
- else {
- setText(WorkbenchMessages.getString("RebuildAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("RebuildAction.tooltip")); //$NON-NLS-1$
- setId(ID_REBUILD_ALL);
- WorkbenchHelp.setHelp(this, IHelpContextIds.FULL_BUILD_ACTION);
- }
-
- this.buildType = type;
-}
-
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-protected List getActionResources() {
- return getProjectsToBuild();
-}
-
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-String getOperationMessage() {
- return WorkbenchMessages.getString("BuildAction.operationMessage"); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-String getProblemsMessage() {
- return WorkbenchMessages.getString("BuildAction.problemMessage"); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-String getProblemsTitle() {
- return WorkbenchMessages.getString("BuildAction.problemTitle"); //$NON-NLS-1$
-}
-
-/**
- * Returns the projects to build.
- * This contains the set of projects which have builders, across all selected resources.
- */
-List getProjectsToBuild() {
- if (projectsToBuild == null) {
- projectsToBuild = new ArrayList(3);
- for (Iterator i = getSelectedResources().iterator(); i.hasNext();) {
- IResource resource = (IResource) i.next();
- IProject project = resource.getProject();
- if (project != null) {
- if (!projectsToBuild.contains(project)) {
- if (hasBuilder(project)) {
- projectsToBuild.add(project);
- }
- }
- }
- }
- }
- return projectsToBuild;
-}
-
-/**
- * Returns whether there are builders configured on the given project.
- *
- * @return <code>true</code> if it has builders,
- * <code>false</code> if not, or if this couldn't be determined
- */
-boolean hasBuilder(IProject project) {
- try {
- ICommand[] commands = project.getDescription().getBuildSpec();
- if (commands.length > 0) {
- return true;
- }
- }
- catch (CoreException e) {
- // this method is called when selection changes, so
- // just fall through if it fails.
- // this shouldn't happen anyway, since the list of selected resources
- // has already been checked for accessibility before this is called
- }
- return false;
-}
-
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-void invokeOperation(IResource resource, IProgressMonitor monitor) throws CoreException {
- ((IProject)resource).build(buildType,monitor);
-}
-/**
- * Returns whether the user's preference is set to automatically save modified
- * resources before a manual build is done.
- *
- * @return <code>true</code> if Save All Before Build is enabled
- */
-public static boolean isSaveAllSet() {
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- return store.getBoolean(IPreferenceConstants.SAVE_ALL_BEFORE_BUILD);
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- *
- * Change the order of the resources so that
- * it matches the build order. Closed and
- * non existant projects are eliminated. Also,
- * any projects in cycles are eliminated.
- */
-List pruneResources(List resourceCollection) {
- // Optimize...
- if (resourceCollection.size() < 2)
- return resourceCollection;
-
- // Try the workspace's description build order if specified
- String[] orderedNames = ResourcesPlugin.getWorkspace().getDescription().getBuildOrder();
- if (orderedNames != null) {
- List orderedProjects = new ArrayList(resourceCollection.size());
- //Projects may not be in the build order but should be built if selected
- List unorderedProjects = new ArrayList(resourceCollection.size());
- unorderedProjects.addAll(resourceCollection);
-
- for (int i = 0; i < orderedNames.length; i++) {
- String projectName = orderedNames[i];
- for (int j = 0; j < resourceCollection.size(); j++) {
- IProject project = (IProject) resourceCollection.get(j);
- if (project.getName().equals(projectName)) {
- orderedProjects.add(project);
- unorderedProjects.remove(project);
- break;
- }
- }
- }
- //Add anything not specified before we return
- orderedProjects.addAll(unorderedProjects);
- return orderedProjects;
- }
-
- // Try the project prerequisite order then
- IProject[] projects = new IProject[resourceCollection.size()];
- projects = (IProject[]) resourceCollection.toArray(projects);
- IProject[][] prereqs = ResourcesPlugin.getWorkspace().computePrerequisiteOrder(projects);
- ArrayList ordered = new ArrayList();
- ordered.addAll(Arrays.asList(prereqs[0]));
- ordered.addAll(Arrays.asList(prereqs[1]));
- return ordered;
-}
-/* (non-Javadoc)
- * Method declared on IAction; overrides method on WorkspaceAction.
- * This override allows the user to save the contents of selected
- * open editors so that the updated contents will be used for building.
- */
-public void run() {
-
- // Save all resources prior to doing build
- saveAllResources();
-
- super.run();
-}
-/**
- * Causes all editors to save any modified resources depending on the user's
- * preference.
- */
-void saveAllResources() {
- List projects = getSelectedResources();
- if (projects == null || projects.isEmpty())
- return;
-
- if (!isSaveAllSet())
- return;
-
- IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (int i = 0; i < windows.length; i++) {
- IWorkbenchPage [] pages = windows[i].getPages();
- for (int j = 0; j < pages.length; j++) {
- IWorkbenchPage page = pages[j];
- IEditorPart[] editors = page.getDirtyEditors();
- for (int k = 0; k < editors.length; k++) {
- IEditorPart editor = editors[k];
- IEditorInput input = editor.getEditorInput();
- if (input instanceof IFileEditorInput) {
- IFile inputFile = ((IFileEditorInput)input).getFile();
- if (projects.contains(inputFile.getProject())) {
- page.saveEditor(editor, false);
- }
- }
- }
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-boolean shouldPerformResourcePruning() {
- return true;
-}
-/**
- * The <code>BuildAction</code> implementation of this
- * <code>SelectionListenerAction</code> method ensures that this action is
- * enabled only if all of the selected resources have buildable projects.
- */
-protected boolean updateSelection(IStructuredSelection s) {
- projectsToBuild = null;
- return super.updateSelection(s) && getProjectsToBuild().size() > 0;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CloseResourceAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CloseResourceAction.java
deleted file mode 100644
index 520082f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CloseResourceAction.java
+++ /dev/null
@@ -1,243 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-
-/**
- * Standard action for closing the currently selected project(s)
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class CloseResourceAction extends WorkspaceAction implements IResourceChangeListener {
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".CloseResourceAction"; //$NON-NLS-1$
- /**
- * Creates a new action.
- *
- * @param shell the shell for any dialogs
- */
- public CloseResourceAction(Shell shell) {
- super(shell, WorkbenchMessages.getString("CloseResourceAction.text")); //$NON-NLS-1$
- setId(ID);
- setToolTipText(WorkbenchMessages.getString("CloseResourceAction.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.CLOSE_RESOURCE_ACTION);
- }
- /**
- * Return a list of dirty editors associated with the given projects. Return
- * editors from all perspectives.
- *
- * @return List the dirty editors
- */
- List getDirtyEditors(List projects) {
- List dirtyEditors = new ArrayList(0);
- IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
- for (int i = 0; i < windows.length; i++) {
- IWorkbenchPage[] pages = windows[i].getPages();
- for (int j = 0; j < pages.length; j++) {
- IWorkbenchPage page = pages[j];
- IEditorPart[] editors = page.getDirtyEditors();
- for (int k = 0; k < editors.length; k++) {
- IEditorPart editor = editors[k];
- IEditorInput input = editor.getEditorInput();
- if (input instanceof IFileEditorInput) {
- IFile inputFile = ((IFileEditorInput) input).getFile();
- if (projects.contains(inputFile.getProject())) {
- if (editor.isDirty()) {
- dirtyEditors.add(editor);
- }
- }
- }
- }
- }
- }
- return dirtyEditors;
- }
- /**
- * Open a dialog that can be used to select which of the given
- * editors to save. Return the list of editors to save. A value of
- * null implies that the operation was cancelled.
- *
- * @return List the editors to save
- */
- List getEditorsToSave(List dirtyEditors) {
- if (dirtyEditors.isEmpty())
- return new ArrayList(0);
-
- // The list may have multiple editors opened for the same input,
- // so process the list for duplicates.
- List saveEditors = new ArrayList(0);
- List dirtyInputs = new ArrayList(0);
- Iterator iter = dirtyEditors.iterator();
- while (iter.hasNext()) {
- IEditorPart editor = (IEditorPart) iter.next();
- IEditorInput input = editor.getEditorInput();
- IFile inputFile = ((IFileEditorInput) input).getFile();
- // if the same file is open in multiple perspectives,
- // we don't want to count it as dirty multiple times
- if (!dirtyInputs.contains(inputFile)) {
- dirtyInputs.add(inputFile);
- saveEditors.add(editor);
- }
- }
- AdaptableList input = new AdaptableList();
- input.add(saveEditors.iterator());
- ListSelectionDialog dlg =
- new ListSelectionDialog(getShell(), input, new WorkbenchContentProvider(), new WorkbenchPartLabelProvider(), WorkbenchMessages.getString("EditorManager.saveResourcesMessage")); //$NON-NLS-1$
-
- dlg.setInitialSelections(saveEditors.toArray(new Object[saveEditors.size()]));
- dlg.setTitle(WorkbenchMessages.getString("EditorManager.saveResourcesTitle")); //$NON-NLS-1$
- int result = dlg.open();
-
- if (result == IDialogConstants.CANCEL_ID)
- return null;
- return Arrays.asList(dlg.getResult());
- }
- /* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
- String getOperationMessage() {
- return ""; //$NON-NLS-1$
- }
- /* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
- String getProblemsMessage() {
- return WorkbenchMessages.getString("CloseResourceAction.problemMessage"); //$NON-NLS-1$
- }
- /* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
- String getProblemsTitle() {
- return WorkbenchMessages.getString("CloseResourceAction.title"); //$NON-NLS-1$
- }
- /* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
- void invokeOperation(IResource resource, IProgressMonitor monitor) throws CoreException {
- ((IProject) resource).close(monitor);
- }
- /**
- * The implementation of this <code>WorkspaceAction</code> method
- * method saves and closes the resource's dirty editors before closing
- * it.
- */
- public void run() {
- if (!saveDirtyEditors())
- return;
- super.run();
- }
- /**
- * Causes all dirty editors associated to the resource(s) to be saved, if so
- * specified by the user, and closed.
- */
- boolean saveDirtyEditors() {
- // Get the items to close.
- List projects = getSelectedResources();
- if (projects == null || projects.isEmpty())
- // no action needs to be taken since no projects are selected
- return false;
-
- // Collect all the dirty editors that are associated to the projects that are
- // to be closed.
- final List dirtyEditors = getDirtyEditors(projects);
-
- // See which editors should be saved.
- final List saveEditors = getEditorsToSave(dirtyEditors);
- if (saveEditors == null)
- // the operation was cancelled
- return false;
-
- // Save and close the dirty editors.
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- Iterator iter = dirtyEditors.iterator();
- while (iter.hasNext()) {
- IEditorPart editor = (IEditorPart) iter.next();
- IWorkbenchPage page = editor.getEditorSite().getPage();
- if (saveEditors.contains(editor)) {
- // do a direct save vs. using page.saveEditor, so that
- // progress dialogs do not flash up on the screen multiple
- // times
- editor.doSave(null);
- }
- page.closeEditor(editor, false);
- }
- }
- });
-
- return true;
- }
- /* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
- boolean shouldPerformResourcePruning() {
- return false;
- }
- /**
- * The <code>CloseResourceAction</code> implementation of this
- * <code>SelectionListenerAction</code> method ensures that this action is
- * enabled only if one of the selections is an open project.
- */
- protected boolean updateSelection(IStructuredSelection s) {
- // don't call super since we want to enable if open project is selected.
- if (!selectionIsOfType(IResource.PROJECT))
- return false;
-
- Iterator resources = getSelectedResources().iterator();
- while (resources.hasNext()) {
- IProject currentResource = (IProject) resources.next();
- if (currentResource.isOpen()) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Handles a resource changed event by updating the enablement
- * if one of the selected projects is opened or closed.
- */
- public void resourceChanged(IResourceChangeEvent event) {
- // Warning: code duplicated in OpenResourceAction
- List sel = getSelectedResources();
- // don't bother looking at delta if selection not applicable
- if (selectionIsOfType(IResource.PROJECT)) {
- IResourceDelta delta = event.getDelta();
- if (delta != null) {
- IResourceDelta[] projDeltas = delta.getAffectedChildren(IResourceDelta.CHANGED);
- for (int i = 0; i < projDeltas.length; ++i) {
- IResourceDelta projDelta = projDeltas[i];
- if ((projDelta.getFlags() & IResourceDelta.OPEN) != 0) {
- if (sel.contains(projDelta.getResource())) {
- selectionChanged(getStructuredSelection());
- return;
- }
- }
- }
- }
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java
deleted file mode 100644
index 9684892..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyFilesAndFoldersOperation.java
+++ /dev/null
@@ -1,811 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ContainerGenerator;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.misc.StatusUtil;
-import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
-import org.eclipse.ui.wizards.datatransfer.ImportOperation;
-
-/**
- * Perform the copy of file and folder resources from the clipboard
- * when paste action is invoked.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class CopyFilesAndFoldersOperation {
-
- /**
- * Status containing the errors detected when running the operation or
- * <code>null</code> if no errors detected.
- */
- private MultiStatus errorStatus;
-
- /**
- * The parent shell used to show any dialogs.
- */
- private Shell parentShell;
-
- /**
- * The destination of the resources to be copied.
- */
- private IResource destination;
-
- /**
- * A list of all resources against which copy errors are reported.
- */
- private ArrayList errorResources = new ArrayList();
-
- /**
- * Whether or not the copy has been canceled by the user.
- */
- private boolean canceled = false;
-
- /**
- * Overwrite all flag.
- */
- private boolean alwaysOverwrite = false;
-
- /**
- * Returns a new name for a copy of the resource at the given path in
- * the given workspace. This name is determined automatically.
- *
- * @param originalName the full path of the resource
- * @param workspace the workspace
- * @return the new full path for the copy
- */
- static IPath getAutoNewNameFor(IPath originalName, IWorkspace workspace) {
- int counter = 1;
- String resourceName = originalName.lastSegment();
- IPath leadupSegment = originalName.removeLastSegments(1);
-
- while (true) {
- String nameSegment;
-
- if (counter > 1)
- nameSegment = WorkbenchMessages.format("CopyFilesAndFoldersOperation.copyNameTwoArgs", new Object[] { new Integer(counter), resourceName }); //$NON-NLS-1$
- else
- nameSegment = WorkbenchMessages.format("CopyFilesAndFoldersOperation.copyNameOneArg", new Object[] { resourceName }); //$NON-NLS-1$
-
- IPath pathToTry = leadupSegment.append(nameSegment);
-
- if (!workspace.getRoot().exists(pathToTry))
- return pathToTry;
-
- counter++;
- }
- }
- /**
- * Creates a new operation initialized with a shell.
- *
- * @param shell parent shell for error dialogs
- */
- public CopyFilesAndFoldersOperation(Shell shell) {
- parentShell = shell;
- }
- /**
- * Returns whether this operation is able to perform on-the-fly
- * auto-renaming of resources with name collisions.
- *
- * @return <code>true</code> if auto-rename is supported,
- * and <code>false</code> otherwise
- */
- protected boolean canPerformAutoRename() {
- return true;
- }
- /**
- * Check if the user wishes to overwrite the supplied resource or
- * all resources.
- *
- * @param shell the shell to create the overwrite prompt dialog in
- * @param destination the resource to be overwritten
- * @return one of IDialogConstants.YES_ID, IDialogConstants.YES_TO_ALL_ID,
- * IDialogConstants.NO_ID, IDialogConstants.CANCEL_ID indicating whether
- * the current resource or all resources can be overwritten, or if the
- * operation should be canceled.
- */
- private int checkOverwrite(final Shell shell, final IResource destination) {
- final int[] result = new int[1];
-
- // Dialogs need to be created and opened in the UI thread
- Runnable query = new Runnable() {
- public void run() {
- String message;
- int resultId[] = {
- IDialogConstants.YES_ID,
- IDialogConstants.YES_TO_ALL_ID,
- IDialogConstants.NO_ID,
- IDialogConstants.CANCEL_ID};
-
- if (destination.getType() == IResource.FOLDER) {
- message = WorkbenchMessages.format(
- "CopyFilesAndFoldersOperation.overwriteMergeQuestion", //$NON-NLS-1$
- new Object[] { destination.getFullPath().makeRelative()});
- } else {
- message = WorkbenchMessages.format(
- "CopyFilesAndFoldersOperation.overwriteQuestion", //$NON-NLS-1$
- new Object[] { destination.getFullPath().makeRelative()});
- }
- MessageDialog dialog = new MessageDialog(
- shell,
- WorkbenchMessages.getString("CopyFilesAndFoldersOperation.resourceExists"), //$NON-NLS-1$
- null,
- message,
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL },
- 0);
- dialog.open();
- result[0] = resultId[dialog.getReturnCode()];
- }
- };
- shell.getDisplay().syncExec(query);
- return result[0];
- }
- /**
- * Copies the resources to the given destination. This method is
- * called recursively to merge folders during folder copy.
- *
- * @param resources the resources to copy
- * @param destination destination to which resources will be copied
- * @param monitor a progress monitor for showing progress and for cancelation
- */
- protected void copy(IResource[] resources, IPath destination, IProgressMonitor subMonitor) throws CoreException {
- for (int i = 0; i < resources.length; i++) {
- IResource source = resources[i];
- IPath destinationPath = destination.append(source.getName());
- IWorkspace workspace = source.getWorkspace();
- IWorkspaceRoot workspaceRoot = workspace.getRoot();
- if (source.getType() == IResource.FOLDER && workspaceRoot.exists(destinationPath)) {
- // the resource is a folder and it exists in the destination, copy the
- // children of the folder
- IResource[] children = ((IContainer) source).members();
- copy(children, destinationPath, subMonitor);
- } else {
- // if we're merging folders, we could be overwriting an existing file
- IResource existing = workspaceRoot.findMember(destinationPath);
- boolean canCopy = true;
-
- if (existing != null) {
- canCopy = delete(existing, subMonitor);
- }
- // was the resource deleted successfully or was there no existing resource to delete?
- if (canCopy) {
- source.copy(destinationPath, false, new SubProgressMonitor(subMonitor, 0));
- }
- subMonitor.worked(1);
- if (subMonitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- }
- }
- }
- /**
- * Copies the given resources to the destination.
- *
- * @param resources the resources to copy
- * @param destination destination to which resources will be copied
- */
- public IResource[] copyResources(final IResource[] resources, IContainer destination) {
- final IPath destinationPath = destination.getFullPath();
- final IResource[][] copiedResources = new IResource[1][0];
-
- String errorMsg = validateDestination(destination, resources);
- if (errorMsg != null) {
- displayError(errorMsg);
- return copiedResources[0];
- }
-
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) {
- IResource[] copyResources = resources;
-
- // Checks only required if this is an exisiting container path.
- monitor.beginTask(
- WorkbenchMessages.getString("CopyFilesAndFoldersOperation.operationTitle"), //$NON-NLS-1$
- 100);
- monitor.worked(10); // show some initial progress
- boolean copyWithAutoRename = false;
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- if (root.exists(destinationPath)) {
- IContainer container = (IContainer) root.findMember(destinationPath);
- // If we're copying to the source container then perform
- // auto-renames on all resources to avoid name collisions.
- if (isDestinationSameAsSource(copyResources, container) && canPerformAutoRename()) {
- copyWithAutoRename = true;
- } else {
- // If no auto-renaming will be happening, check for
- // potential name collisions at the target resource
- copyResources = validateNoNameCollisions(container, copyResources, monitor);
- if (copyResources == null) {
- if (canceled)
- return;
- displayError(WorkbenchMessages.getString("CopyFilesAndFoldersOperation.nameCollision")); //$NON-NLS-1$
- return;
- }
- }
- }
-
- errorStatus = null;
- if (copyResources.length > 0) {
- if (copyWithAutoRename)
- performCopyWithAutoRename(copyResources, destinationPath, monitor);
- else
- performCopy(copyResources, destinationPath, monitor);
- }
- copiedResources[0] = copyResources;
- }
- };
-
- try {
- new ProgressMonitorDialog(parentShell).run(true, true, op);
- } catch (InterruptedException e) {
- return copiedResources[0];
- } catch (InvocationTargetException e) {
- // CoreExceptions are collected above, but unexpected runtime exceptions and errors may still occur.
- Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog().log(StatusUtil.newStatus(
- IStatus.ERROR,
- MessageFormat.format(
- "Exception in {0}.performCopy(): {1}", //$NON-NLS-1$
- new Object[] {getClass().getName(), e.getTargetException()}),
- null));
- displayError(WorkbenchMessages.format(
- "CopyFilesAndFoldersOperation.internalError", //$NON-NLS-1$
- new Object[] { e.getTargetException().getMessage()}));
- }
-
- // If errors occurred, open an Error dialog
- if (errorStatus != null) {
- ErrorDialog.openError(
- parentShell,
- getProblemsTitle(),
- null, // no special message
- errorStatus);
- errorStatus = null;
- }
- return copiedResources[0];
- }
- /**
- * Copies the given files and folders to the destination.
- *
- * @param fileNames names of the files to copy
- * @param destination destination to which files will be copied
- */
- public void copyFiles(final String[] fileNames, IContainer destination) {
- alwaysOverwrite = false;
-
- String errorMsg = validateImportDestination(destination, fileNames);
- if (errorMsg != null) {
- displayError(errorMsg);
- return;
- }
- final IPath destinationPath = destination.getFullPath();
-
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) {
- // Checks only required if this is an exisiting container path.
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- if (root.exists(destinationPath)) {
- IContainer container = (IContainer) root.findMember(destinationPath);
- monitor.beginTask("", fileNames.length); //$NON-NLS-1$
- for (int k = 0; k < fileNames.length && !canceled; k++)
- performFileImport(fileNames[k], container, new SubProgressMonitor(monitor, 1));
- monitor.done();
- }
- }
- };
- try {
- new ProgressMonitorDialog(parentShell).run(true, true, op);
- } catch (InterruptedException e) {
- return;
- } catch (InvocationTargetException e) {
- // CoreExceptions are collected above, but unexpected runtime exceptions and errors may still occur.
- Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog().log(StatusUtil.newStatus(IStatus.ERROR, MessageFormat.format("Exception in {0}.performCopy(): {1}", //$NON-NLS-1$
- new Object[] { getClass().getName(), e.getTargetException()}), null));
- displayError(WorkbenchMessages.format("CopyFilesAndFoldersOperation.internalError", new Object[] { e.getTargetException().getMessage()})); //$NON-NLS-1$
- }
-
- // If errors occurred, open an Error dialog
- if (errorStatus != null) {
- ErrorDialog.openError(parentShell, getProblemsTitle(), //$NON-NLS-1$
- null, // no special message
- errorStatus);
- errorStatus = null;
- }
- }
- /**
- * Removes the given resource from the workspace.
- *
- * @param resource resource to remove from the workspace
- * @param monitor a progress monitor for showing progress and for cancelation
- * @return
- * true the resource was deleted successfully
- * false the resource was not deleted because a CoreException occurred
- */
- boolean delete(IResource resource, IProgressMonitor monitor) throws CoreException {
- boolean force = false; // don't force deletion of out-of-sync resources
-
- if (resource.getType() == IResource.PROJECT) {
- // if it's a project, ask whether content should be deleted too
- IProject project = (IProject) resource;
- try {
- project.delete(true, force, monitor);
- } catch (CoreException e) {
- recordError(e); // log error
- return false;
- }
- } else {
- // if it's not a project, just delete it
- int flags = IResource.KEEP_HISTORY;
- if (force) {
- flags = flags | IResource.FORCE;
- }
- try {
- resource.delete(flags, monitor);
- } catch (CoreException e) {
- recordError(e); // log error
- return false;
- }
- }
- return true;
- }
- /**
- * Opens an error dialog to display the given message.
- *
- * @param message the error message to show
- */
- private void displayError(final String message) {
- parentShell.getDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog.openError(parentShell, getProblemsTitle(), message);
- }
- });
- }
- /**
- * Returns a new name for a copy of the resource at the given path in the
- * given workspace.
- *
- * @param originalName the full path of the resource
- * @param workspace the workspace
- * @return the new full path for the copy, or <code>null</code> if the
- * resource should not be copied
- */
- private IPath getNewNameFor(final IPath originalName, final IWorkspace workspace) {
- final IResource resource = workspace.getRoot().findMember(originalName);
- final IPath prefix = resource.getFullPath().removeLastSegments(1);
- final String returnValue[] = { "" };
-
- parentShell.getDisplay().syncExec(new Runnable() {
- public void run() {
- IInputValidator validator = new IInputValidator() {
- public String isValid(String string) {
- if (resource.getName().equals(string)) {
- return WorkbenchMessages.getString("CopyFilesAndFoldersOperation.nameMustBeDifferent"); //$NON-NLS-1$
- }
- IStatus status = workspace.validateName(string, resource.getType());
- if (!status.isOK()) {
- return status.getMessage();
- }
- if (workspace.getRoot().exists(prefix.append(string))) {
- return WorkbenchMessages.getString("CopyFilesAndFoldersOperation.nameExists"); //$NON-NLS-1$
- }
- return null;
- }
- };
-
- InputDialog dialog = new InputDialog(parentShell, WorkbenchMessages.getString("CopyFilesAndFoldersOperation.inputDialogTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("CopyFilesAndFoldersOperation.inputDialogMessage", new String[] { resource.getName()}), //$NON-NLS-1$
- getAutoNewNameFor(originalName, workspace).lastSegment().toString(), validator);
- dialog.setBlockOnOpen(true);
- dialog.open();
- if (dialog.getReturnCode() == Window.CANCEL) {
- returnValue[0] = null;
- } else {
- returnValue[0] = dialog.getValue();
- }
- }
- });
- if (returnValue[0] == null) {
- throw new OperationCanceledException();
- }
- return prefix.append(returnValue[0]);
- }
- /**
- * Returns the message for this operation's problems dialog.
- *
- * @return the problems message
- */
- protected String getProblemsMessage() {
- return WorkbenchMessages.getString("CopyFilesAndFoldersOperation.problemMessage"); //$NON-NLS-1$
- }
- /**
- * Returns the title for this operation's problems dialog.
- *
- * @return the problems dialog title
- */
- protected String getProblemsTitle() {
- return WorkbenchMessages.getString("CopyFilesAndFoldersOperation.copyFailedTitle"); //$NON-NLS-1$
- }
- /**
- * Returns whether the given resource is accessible.
- * Files and folders are always considered accessible and a project is
- * accessible if it is open.
- *
- * @param resource the resource
- * @return <code>true</code> if the resource is accessible, and
- * <code>false</code> if it is not
- */
- private boolean isAccessible(IResource resource) {
- switch (resource.getType()) {
- case IResource.FILE :
- return true;
- case IResource.FOLDER :
- return true;
- case IResource.PROJECT :
- return ((IProject) resource).isOpen();
- default :
- return false;
- }
- }
- /**
- * Returns whether any of the given source resources are being
- * recopied to their current container.
- *
- * @param sourceResources the source resources
- * @param destination the destination container
- * @return <code>true</code> if at least one of the given source
- * resource's parent container is the same as the destination
- */
- boolean isDestinationSameAsSource(IResource[] sourceResources, IContainer destination) {
- for (int i = 0; i < sourceResources.length; i++) {
- if (sourceResources[i].getParent().equals(destination)) {
- return true;
- }
- }
- return false;
- }
- /**
- * Copies the given resources to the destination container with
- * the given name.
- * <p>
- * Note: the destination container may need to be created prior to
- * copying the resources.
- * </p>
- *
- * @param resources the resources to copy
- * @param destination the path of the destination container
- * @param monitor a progress monitor for showing progress and for cancelation
- * @return <code>true</code> if the copy operation completed without
- * errors
- */
- private boolean performCopy(final IResource[] resources, final IPath destination, IProgressMonitor monitor) {
- try {
- monitor.subTask(WorkbenchMessages.getString("CopyFilesAndFoldersOperation.copying")); //$NON-NLS-1$
- ContainerGenerator generator = new ContainerGenerator(destination);
- generator.generateContainer(new SubProgressMonitor(monitor, 10));
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 75);
- copy(resources, destination, subMonitor);
- } catch (CoreException e) {
- recordError(e); // log error
- return false;
- } finally {
- monitor.done();
- }
- return true;
- }
-
- /**
- * Individually copies the given resources to the specified destination
- * container checking for name collisions. If a collision is detected,
- * it is saved with a new name.
- * <p>
- * Note: the destination container may need to be created prior to
- * copying the resources.
- * </p>
- *
- * @param resources the resources to copy
- * @param destination the path of the destination container
- * @return <code>true</code> if the copy operation completed without errors.
- */
- private boolean performCopyWithAutoRename(IResource[] resources, IPath destination, IProgressMonitor monitor) {
- IWorkspace workspace = resources[0].getWorkspace();
-
- try {
- ContainerGenerator generator = new ContainerGenerator(destination);
- generator.generateContainer(new SubProgressMonitor(monitor, 10));
-
- IProgressMonitor subMonitor = new SubProgressMonitor(monitor, 75);
- subMonitor.beginTask(
- WorkbenchMessages.getString(
- "CopyFilesAndFoldersOperation.copying"), //$NON-NLS-1$
- resources.length);
-
- for (int i = 0; i < resources.length; i++) {
- IResource currentResource = resources[i];
- IPath destinationPath = destination.append(currentResource.getName());
-
- if (workspace.getRoot().exists(destinationPath)) {
- destinationPath = getNewNameFor(destinationPath, workspace);
- }
- if (destinationPath != null) {
- try {
- currentResource.copy(destinationPath, false, new SubProgressMonitor(subMonitor, 0));
- } catch (CoreException e) {
- recordError(e); // log error
- return false;
- }
- }
- subMonitor.worked(1);
- if (subMonitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- }
- } catch (CoreException e) {
- recordError(e); // log error
- return false;
- } finally {
- monitor.done();
- }
-
- return true;
- }
- /**
- * Performs an import of the given file into the provided
- * container. Returns a status indicating if the import was successful.
- *
- * @param filePath path to file that is to be imported
- * @param target container to which the import will be done
- * @param monitor a progress monitor for showing progress and for cancelation
- */
- private void performFileImport(String filePath, IContainer target, IProgressMonitor monitor) {
- File toImport = new File(filePath);
- if (target.getLocation().equals(toImport))
- return;
-
- IOverwriteQuery query = new IOverwriteQuery() {
- public String queryOverwrite(String pathString) {
- if (alwaysOverwrite)
- return ALL;
-
- final String returnCode[] = { CANCEL };
- final String msg = WorkbenchMessages.format("CopyFilesAndFoldersOperation.overwriteQuestion", new Object[] { pathString }); //$NON-NLS-1$
- final String[] options =
- {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL };
- parentShell.getDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog dialog = new MessageDialog(parentShell, WorkbenchMessages.getString("CopyFilesAndFoldersOperation.question"), null, msg, MessageDialog.QUESTION, options, 0); //$NON-NLS-1$
- dialog.open();
- int returnVal = dialog.getReturnCode();
- String[] returnCodes = { YES, ALL, NO, CANCEL };
- returnCode[0] = returnVal == -1 ? CANCEL : returnCodes[returnVal];
- }
- });
- if (returnCode[0] == ALL) {
- alwaysOverwrite = true;
- } else if (returnCode[0] == CANCEL) {
- canceled = true;
- }
- return returnCode[0];
- }
- };
-
- ImportOperation op =
- new ImportOperation(
- target.getFullPath(),
- new File(toImport.getParent()),
- FileSystemStructureProvider.INSTANCE,
- query,
- Arrays.asList(new File[] { toImport }));
- op.setCreateContainerStructure(false);
- try {
- op.run(monitor);
- } catch (InterruptedException e) {
- return;
- } catch (InvocationTargetException e) {
- if (e.getTargetException() instanceof CoreException) {
- final IStatus status = ((CoreException) e.getTargetException()).getStatus();
- parentShell.getDisplay().syncExec(new Runnable() {
- public void run() {
- ErrorDialog.openError(parentShell, WorkbenchMessages.getString("CopyFilesAndFoldersOperation.importErrorDialogTitle"), //$NON-NLS-1$
- null, // no special message
- status);
- }
- });
- } else {
- // CoreExceptions are handled above, but unexpected runtime exceptions and errors may still occur.
- Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog().log(StatusUtil.newStatus(IStatus.ERROR, MessageFormat.format("Exception in {0}.performFileImport(): {1}", //$NON-NLS-1$
- new Object[] { getClass().getName(), e.getTargetException()}), null));
- displayError(WorkbenchMessages.format("CopyFilesAndFoldersOperation.internalError", //$NON-NLS-1$
- new Object[] { e.getTargetException().getMessage()}));
- }
- return;
- }
- // Special case since ImportOperation doesn't throw a CoreException on
- // failure.
- IStatus status = op.getStatus();
- if (!status.isOK()) {
- if (errorStatus == null)
- errorStatus = new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.ERROR, getProblemsMessage(), null); //$NON-NLS-1$
- errorStatus.merge(status);
- }
- }
- /**
- * Records the core exception to be displayed to the user
- * once the action is finished.
- *
- * @param error a <code>CoreException</code>
- */
- private void recordError(CoreException error) {
- if (errorStatus == null)
- errorStatus = new MultiStatus(PlatformUI.PLUGIN_ID, IStatus.ERROR, getProblemsMessage(), error); //$NON-NLS-1$
-
- errorStatus.merge(error.getStatus());
- }
- /**
- * Checks whether the destination is valid for copying the source
- * resources.
- * <p>
- * Note this method is for internal use only. It is not API.
- * </p>
- *
- * @param destination the destination container
- * @param sourceResources the source resources
- * @return an error message, or <code>null</code> if the path is valid
- */
- public String validateDestination(IContainer destination, IResource[] sourceResources) {
- if (!isAccessible(destination)) {
- return WorkbenchMessages.getString("CopyFilesAndFoldersOperation.destinationAccessError"); //$NON-NLS-1$
- }
- IPath destinationPath = destination.getFullPath();
- for (int i = 0; i < sourceResources.length; i++) {
- IResource sourceResource = sourceResources[i];
- IPath sourcePath = sourceResource.getFullPath();
-
- if (sourcePath.equals(destinationPath)) {
- return WorkbenchMessages.format(
- "CopyFilesAndFoldersOperation.sameSourceAndDest", //$NON-NLS-1$
- new Object[] { sourceResource.getName()});
- }
- // is the source a parent of the destination path?
- if (sourcePath.isPrefixOf(destinationPath)) {
- return WorkbenchMessages.getString("CopyFilesAndFoldersOperation.destinationDescendentError"); //$NON-NLS-1$
- }
- }
- return null;
- }
- /**
- * Checks whether the destination is valid for copying the source
- * files.
- * <p>
- * Note this method is for internal use only. It is not API.
- * </p>
- *
- * @param destination the destination container
- * @param sourceNames the source file names
- * @return an error message, or <code>null</code> if the path is valid
- */
- public String validateImportDestination(IContainer destination, String[] sourceNames) {
- if (!isAccessible(destination)) {
- return WorkbenchMessages.getString("CopyFilesAndFoldersOperation.destinationAccessError"); //$NON-NLS-1$
- }
- // work around bug 16202. revert when fixed.
- File destinationFile = destination.getLocation().toFile();
- IPath destinationPath = destination.getLocation();
- for (int i = 0; i < sourceNames.length; i++) {
- IPath sourcePath = new Path(sourceNames[i]);
- File sourceFile = sourcePath.toFile();
- File sourceParentFile = sourcePath.removeLastSegments(1).toFile();
- if (sourceFile != null) {
- if (destinationFile.compareTo(sourceFile) == 0 ||
- (sourceParentFile != null && destinationFile.compareTo(sourceParentFile) == 0)) {
- return WorkbenchMessages.format("CopyFilesAndFoldersOperation.importSameSourceAndDest", //$NON-NLS-1$
- new Object[] {sourceFile.getName()});
- }
- // work around bug 16202. replacement for sourcePath.isPrefixOf(destinationPath)
- IPath destinationParent = destinationPath.removeLastSegments(1);
- while (destinationParent.isEmpty() == false && destinationParent.isRoot() == false) {
- destinationFile = destinationParent.toFile();
- if (sourceFile.compareTo(destinationFile) == 0) {
- return WorkbenchMessages.getString("CopyFilesAndFoldersOperation.destinationDescendentError"); //$NON-NLS-1$
- }
- destinationParent = destinationParent.removeLastSegments(1);
- }
- }
- }
- return null;
- }
- /**
- * Returns whether moving all of the given source resources to the given
- * destination container could be done without causing name collisions.
- *
- * @param destination the destination container
- * @param sourceResources the list of resources
- * @param monitor a progress monitor for showing progress and for
- * cancelation
- * @return <code>true</code> if there would be no name collisions, and
- * <code>false</code> if there would
- */
- private IResource[] validateNoNameCollisions(
- IContainer destination,
- IResource[] sourceResources,
- IProgressMonitor monitor) {
- List copyItems = new ArrayList();
- IWorkspaceRoot workspaceRoot = destination.getWorkspace().getRoot();
- int overwrite = IDialogConstants.NO_ID;
-
- // Check to see if we would be overwriting a parent folder.
- // Cancel entire copy operation if we do.
- for (int i = 0; i < sourceResources.length; i++) {
- final IResource sourceResource = sourceResources[i];
- final IPath destinationPath = destination.getFullPath().append(sourceResource.getName());
- final IPath sourcePath = sourceResource.getFullPath();
-
- IResource newResource = workspaceRoot.findMember(destinationPath);
- if (newResource != null && destinationPath.isPrefixOf(sourcePath)) {
- //Run it inside of a runnable to make sure we get to parent off of the shell as we are not
- //in the UI thread.
- Runnable notice = new Runnable() {
- public void run() {
- MessageDialog.openError(
- parentShell,
- WorkbenchMessages.getString("CopyFilesAndFoldersOperation.overwriteProblemTitle"), //$NON-NLS-1$
- WorkbenchMessages.format(
- "CopyFilesAndFoldersOperation.overwriteProblem", //$NON-NLS-1$
- new Object[] {destinationPath, sourcePath}
- )
- );
- }
- };
- parentShell.getDisplay().syncExec(notice);
- canceled = true;
- return null;
- }
- }
- // Check for overwrite conflicts
- for (int i = 0; i < sourceResources.length; i++) {
- final IResource sourceResource = sourceResources[i];
- final IPath destinationPath = destination.getFullPath().append(sourceResource.getName());
-
- IResource newResource = workspaceRoot.findMember(destinationPath);
- if (newResource != null) {
- if (overwrite != IDialogConstants.YES_TO_ALL_ID) {
- overwrite = checkOverwrite(parentShell, newResource);
- }
- if (overwrite == IDialogConstants.YES_ID || overwrite == IDialogConstants.YES_TO_ALL_ID) {
- copyItems.add(sourceResource);
- } else if (overwrite == IDialogConstants.CANCEL_ID) {
- canceled = true;
- return null;
- }
- } else {
- copyItems.add(sourceResource);
- }
- }
- return (IResource[]) copyItems.toArray(new IResource[copyItems.size()]);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyProjectAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyProjectAction.java
deleted file mode 100644
index bf69857..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyProjectAction.java
+++ /dev/null
@@ -1,248 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ProjectLocationSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-/**
- * The CopyProjectAction is the action designed to copy projects specifically
- * as they have different semantics from other resources.
- * Note that this action assumes that a single project is selected and being
- * manipulated. This should be disabled for multi select or no selection.
- */
-public class CopyProjectAction extends SelectionListenerAction {
- private static String COPY_TOOL_TIP = WorkbenchMessages.getString("CopyProjectAction.toolTip"); //$NON-NLS-1$
- private static String COPY_TITLE = WorkbenchMessages.getString("CopyProjectAction.title"); //$NON-NLS-1$
- private static String COPY_PROGRESS_TITLE = WorkbenchMessages.getString("CopyProjectAction.progressTitle"); //$NON-NLS-1$
- private static String COPY_PROJECT_FAILED_MESSAGE =
- WorkbenchMessages.getString("CopyProjectAction.copyFailedMessage"); //$NON-NLS-1$
- private static String PROBLEMS_TITLE = WorkbenchMessages.getString("CopyProjectAction.copyFailedTitle"); //$NON-NLS-1$
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".CopyProjectAction";//$NON-NLS-1$
-
- /**
- * The shell in which to show any dialogs.
- */
- protected Shell shell;
-
- /**
- * Status containing the errors detected when running the operation or
- * <code>null</code> if no errors detected.
- */
- protected IStatus errorStatus;
-/**
- * Creates a new project copy action with the default text.
- *
- * @param shell the shell for any dialogs
- * @param text the string used as the text for the action,
- * or <code>null</code> if these is no text
- */
-public CopyProjectAction(Shell shell) {
- this(shell,COPY_TITLE);
- WorkbenchHelp.setHelp(this, IHelpContextIds.COPY_PROJECT_ACTION);
-}
-/**
- * Creates a new project copy action with the given text.
- *
- * @param shell the shell for any dialogs
- * @param text the string used as the text for the action,
- * or <code>null</code> if these is no text
- */
-CopyProjectAction(Shell shell, String name) {
- super(name);
- setToolTipText(COPY_TOOL_TIP);
- setId(CopyProjectAction.ID);
- Assert.isNotNull(shell);
- this.shell = shell;
-}
-/**
- * Create a new IProjectDescription for the copy using the name and path selected
- * from the dialog.
- * @return IProjectDescription
- * @param project the source project
- * @param projectName the name for the new project
- * @param rootLocation the path the new project will be stored under.
- */
-protected IProjectDescription createDescription(
- IProject project,
- String projectName,
- IPath rootLocation)
- throws CoreException {
- //Get a copy of the current description and modify it
- IProjectDescription newDescription = project.getDescription();
- newDescription.setName(projectName);
-
- //If the location is the default then set the location to null
- if(rootLocation.equals(Platform.getLocation()))
- newDescription.setLocation(null);
- else
- newDescription.setLocation(rootLocation);
-
- return newDescription;
-}
-/**
- * Opens an error dialog to display the given message.
- * <p>
- * Note that this method must be called from UI thread.
- * </p>
- *
- * @param message the message
- */
-void displayError(String message) {
- MessageDialog.openError(this.shell,getErrorsTitle(), message);
-}
-/**
- * Return the title of the errors dialog.
- * @return java.lang.String
- */
-protected String getErrorsTitle() {
- return PROBLEMS_TITLE;
-}
-/**
- * Get the plugin used by a copy action
- * @return AbstractUIPlugin
- */
-protected org.eclipse.ui.plugin.AbstractUIPlugin getPlugin() {
- return (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
-}
-/**
- * Copies the project to the new values.
- *
- * @param project the project to copy
- * @param projectName the name of the copy
- * @param newLocation IPath
- * @return <code>true</code> if the copy operation completed, and
- * <code>false</code> if it was abandoned part way
- */
-boolean performCopy(
- final IProject project,
- final String projectName,
- final IPath newLocation) {
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) {
-
- monitor.beginTask(COPY_PROGRESS_TITLE, 100);
- try {
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- //Get a copy of the current description and modify it
- IProjectDescription newDescription =
- createDescription(project, projectName, newLocation);
- monitor.worked(50);
-
- project.copy(newDescription, true, monitor);
-
- monitor.worked(50);
-
- } catch (CoreException e) {
- recordError(e); // log error
- } finally {
- monitor.done();
- }
- }
- };
-
- try {
- new ProgressMonitorDialog(shell).run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- displayError(WorkbenchMessages.format("CopyProjectAction.internalError", new Object[] {e.getTargetException().getMessage()})); //$NON-NLS-1$
- return false;
- }
-
- return true;
-}
-/**
- * Query for a new project name and destination using the parameters in the existing
- * project.
- * @return Object [] or null if the selection is cancelled
- * @param IProject - the project we are going to copy.
- */
-protected Object [] queryDestinationParameters(IProject project) {
- ProjectLocationSelectionDialog dialog =
- new ProjectLocationSelectionDialog(shell, project);
- dialog.setTitle(WorkbenchMessages.getString("CopyProjectAction.copyTitle")); //$NON-NLS-1$
- dialog.open();
- return dialog.getResult();
-}
-/**
- * Records the core exception to be displayed to the user
- * once the action is finished.
- *
- * @param error a <code>CoreException</code>
- */
-final void recordError(CoreException error) {
- this.errorStatus = error.getStatus();
-}
-/**
- * Implementation of method defined on <code>IAction</code>.
- */
-public void run() {
-
- errorStatus = null;
-
- IProject project = (IProject) getSelectedResources().get(0);
-
- //Get the project name and location in a two element list
- Object[] destinationPaths = queryDestinationParameters(project);
- if (destinationPaths == null)
- return;
-
- String newName = (String) destinationPaths[0];
- IPath newLocation = new Path((String) destinationPaths[1]);
-
- boolean completed = performCopy(project, newName, newLocation);
-
- if (!completed) // ie.- canceled
- return; // not appropriate to show errors
-
- // If errors occurred, open an Error dialog
- if (errorStatus != null) {
- ErrorDialog.openError(this.shell, getErrorsTitle(), null, errorStatus);
- errorStatus = null;
- }
-}
-/**
- * The <code>CopyResourceAction</code> implementation of this
- * <code>SelectionListenerAction</code> method enables this action only if
- * there is a single selection which is a project.
- */
-protected boolean updateSelection(IStructuredSelection selection) {
- if (!super.updateSelection(selection)) {
- return false;
- }
- if (getSelectedNonResources().size() > 0) {
- return false;
- }
-
- // to enable this command there must be one project selected and nothing else
- List selectedResources = getSelectedResources();
- if (selectedResources.size() != 1)
- return false;
- IResource source = (IResource)selectedResources.get(0);
- if (source instanceof IProject && ((IProject)source).isOpen())
- return true;
- return false;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyProjectOperation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyProjectOperation.java
deleted file mode 100644
index 32a31fc..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyProjectOperation.java
+++ /dev/null
@@ -1,200 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ProjectLocationSelectionDialog;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Implementation class to perform the actual copying of project resources from the clipboard
- * when paste action is invoked.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class CopyProjectOperation {
-
- /**
- * Status containing the errors detected when running the operation or
- * <code>null</code> if no errors detected.
- */
- private MultiStatus errorStatus;
-
- /**
- * The parent shell used to show any dialogs.
- */
- private Shell parentShell;
-
- /**
- * Create a new operation initialized with a shell.
- *
- * @param shell parent shell for error dialogs
- */
- public CopyProjectOperation(Shell shell) {
- parentShell = shell;
- }
-
- /**
- * Paste a copy of the project on the clipboard to the workspace.
- */
- public void copyProject(IProject project) {
- errorStatus = null;
-
- //Get the project name and location in a two element list
- ProjectLocationSelectionDialog dialog =
- new ProjectLocationSelectionDialog(parentShell, project);
- dialog.setTitle(WorkbenchMessages.getString("CopyProjectOperation.copyProject")); //$NON-NLS-1$
- if (dialog.open() != Dialog.OK)
- return;
-
- Object[] destinationPaths = dialog.getResult();
- if (destinationPaths == null)
- return;
-
- String newName = (String) destinationPaths[0];
- IPath newLocation = new Path((String) destinationPaths[1]);
-
- boolean completed = performProjectCopy(project, newName, newLocation);
-
- if (!completed) // ie.- canceled
- return; // not appropriate to show errors
-
- // If errors occurred, open an Error dialog
- if (errorStatus != null) {
- ErrorDialog.openError(
- parentShell,
- WorkbenchMessages.getString("CopyProjectOperation.copyFailedTitle"), //$NON-NLS-1$
- null,
- errorStatus);
- errorStatus = null;
- }
- }
-
- /**
- * Copies the project to the new values.
- *
- * @param project the project to copy
- * @param projectName the name of the copy
- * @param newLocation IPath
- * @return <code>true</code> if the copy operation completed, and
- * <code>false</code> if it was abandoned part way
- */
- private boolean performProjectCopy(
- final IProject project,
- final String projectName,
- final IPath newLocation) {
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) {
-
- monitor.beginTask(WorkbenchMessages.getString("CopyProjectOperation.progressTitle"), 100); //$NON-NLS-1$
- try {
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- //Get a copy of the current description and modify it
- IProjectDescription newDescription =
- createProjectDescription(project, projectName, newLocation);
- monitor.worked(50);
-
- project.copy(newDescription, true, monitor);
-
- monitor.worked(50);
-
- } catch (CoreException e) {
- recordError(e); // log error
- } finally {
- monitor.done();
- }
- }
- };
-
- try {
- new ProgressMonitorDialog(parentShell).run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- final String message = e.getTargetException().getMessage();
- parentShell.getDisplay().syncExec(new Runnable() {
- public void run() {
- MessageDialog.openError(
- parentShell,
- WorkbenchMessages.getString("CopyProjectOperation.copyFailedTitle"), //$NON-NLS-1$
- WorkbenchMessages.format(
- "CopyProjectOperation.internalError", //$NON-NLS-1$
- new Object[] {message}));
- }
- });
- return false;
- }
-
- return true;
- }
-
- /**
- * Create a new IProjectDescription for the copy using the auto-generated
- * name and path.
- *
- * @return IProjectDescription
- * @param project the source project
- * @param projectName the name for the new project
- * @param rootLocation the path the new project will be stored under.
- */
- private IProjectDescription createProjectDescription(
- IProject project,
- String projectName,
- IPath rootLocation)
- throws CoreException {
- //Get a copy of the current description and modify it
- IProjectDescription newDescription = project.getDescription();
- newDescription.setName(projectName);
-
- //If the location is the default then set the location to null
- if(rootLocation.equals(Platform.getLocation()))
- newDescription.setLocation(null);
- else
- newDescription.setLocation(rootLocation);
-
- return newDescription;
- }
-
-
- /**
- * Records the core exception to be displayed to the user
- * once the action is finished.
- *
- * @param exception a <code>CoreException</code>
- */
- private void recordError(CoreException error) {
-
- if (errorStatus == null)
- errorStatus = new MultiStatus(
- PlatformUI.PLUGIN_ID,
- IStatus.ERROR,
- WorkbenchMessages.getString("CopyProjectOperation.copyFailedMessage"), //$NON-NLS-1$
- error);
-
- errorStatus.merge(error.getStatus());
- }
-
- /**
- * Set the location to the default location.
- */
- private String setLocation(String projectName) {
- IPath defaultPath = Platform.getLocation().append(projectName);
- return defaultPath.toOSString();
- }
-
-
-
-}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyResourceAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyResourceAction.java
deleted file mode 100644
index 8f2b91c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CopyResourceAction.java
+++ /dev/null
@@ -1,222 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.MessageFormat;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.misc.StatusUtil;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-/**
- * Standard action for copying the currently selected resources elsewhere
- * in the workspace. All resources being copied as a group must be siblings.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class CopyResourceAction extends SelectionListenerAction implements ISelectionValidator {
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".CopyResourceAction"; //$NON-NLS-1$
-
- /**
- * The shell in which to show any dialogs.
- */
- private Shell shell;
-
- protected CopyFilesAndFoldersOperation operation;
-
- /**
- * Returns a new name for a copy of the resource at the given path in the given
- * workspace. This name could be determined either automatically or by querying
- * the user. This name will <b>not</b> be verified by the caller, so it must be
- * valid and unique.
- * <p>
- * Note this method is for internal use only.
- * </p>
- *
- * @param originalName the full path of the resource
- * @param workspace the workspace
- * @return the new full path for the copy, or <code>null</code> if the resource
- * should not be copied
- */
- public static IPath getNewNameFor(IPath originalName, IWorkspace workspace) {
- return CopyFilesAndFoldersOperation.getAutoNewNameFor(originalName, workspace);
- }
- /**
- * Creates a new action.
- *
- * @param shell the shell for any dialogs
- */
- public CopyResourceAction(Shell shell) {
- this(shell, WorkbenchMessages.getString("CopyResourceAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.COPY_RESOURCE_ACTION);
- }
- /**
- * Creates a new action with the given text.
- *
- * @param shell the shell for any dialogs
- * @param name the string used as the name for the action,
- * or <code>null</code> if there is no name
- */
- CopyResourceAction(Shell shell, String name) {
- super(name);
- setToolTipText(WorkbenchMessages.getString("CopyResourceAction.toolTip")); //$NON-NLS-1$
- setId(CopyResourceAction.ID);
- Assert.isNotNull(shell);
- this.shell = shell;
- }
- /**
- * Returns the operation to perform when this action runs.
- *
- * @return the operation to perform when this action runs.
- */
- protected CopyFilesAndFoldersOperation createOperation() {
- return new CopyFilesAndFoldersOperation(getShell());
- }
- /**
- * Returns the path of the container to initially select in the container
- * selection dialog, or <code>null</code> if there is no initial selection
- */
- IContainer getInitialContainer() {
- List resources = getSelectedResources();
- if (resources.size() > 0) {
- IResource resource = (IResource) resources.get(0);
- return resource.getParent();
- }
- return null;
- }
- /**
- * Returns an array of resources to use for the operation from
- * the provided list.
- *
- * @return an array of resources to use for the operation
- */
- protected IResource[] getResources(List resourceList) {
- return (IResource[]) resourceList.toArray(new IResource[resourceList.size()]);
- }
- /**
- * Returns the shell in which to show any dialogs
- */
- Shell getShell() {
- return shell;
- }
- /**
- * The <code>CopyResourceAction</code> implementation of this
- * <code>ISelectionValidator</code> method checks whether the given path
- * is a good place to copy the selected resources.
- */
- public String isValid(Object destination) {
- IWorkspaceRoot root = WorkbenchPlugin.getPluginWorkspace().getRoot();
- IContainer container = (IContainer) root.findMember((IPath) destination);
-
- if (container != null) {
- // create a new operation here.
- // isValid is API and may be called in any context.
- CopyFilesAndFoldersOperation operation = createOperation();
- List sources = getSelectedResources();
- IResource[] resources = (IResource[]) sources.toArray(new IResource[sources.size()]);
- return operation.validateDestination(container, resources);
- }
- return null;
- }
- /**
- * Asks the user for the destination of this action.
- *
- * @return the path on an existing or new resource container, or
- * <code>null</code> if the operation should be abandoned
- */
- IPath queryDestinationResource() {
- // start traversal at root resource, should probably start at a
- // better location in the tree
- ContainerSelectionDialog dialog = new ContainerSelectionDialog(shell, getInitialContainer(), true, WorkbenchMessages.getString("CopyResourceAction.selectDestination")); //$NON-NLS-1$
- dialog.setValidator(this);
- dialog.showClosedProjects(false);
- dialog.open();
- Object[] result = dialog.getResult();
- if (result != null && result.length == 1) {
- return (IPath) result[0];
- }
- return null;
- }
- /* (non-Javadoc)
- * Method declared on IAction.
- */
- public void run() {
- operation = createOperation();
- IPath destination = queryDestinationResource();
- if (destination == null)
- return;
-
- IWorkspaceRoot root = WorkbenchPlugin.getPluginWorkspace().getRoot();
- IContainer container = (IContainer) root.findMember(destination);
- if (container == null) {
- return;
- }
-
- List sources = getSelectedResources();
- runOperation(getResources(sources), container);
- operation = null;
- }
- /**
- * Runs the operation created in <code>createOperaiton</code>
- *
- * @param resources source resources to pass to the operation
- * @param destination destination container to pass to the operation
- */
- protected void runOperation(IResource[] resources, IContainer destination) {
- operation.copyResources(resources, destination);
- }
- /**
- * The <code>CopyResourceAction</code> implementation of this
- * <code>SelectionListenerAction</code> method enables this action only if
- * all of the one or more selections are sibling resources which are
- * local (depth infinity).
- */
- protected boolean updateSelection(IStructuredSelection selection) {
- if (!super.updateSelection(selection)) {
- return false;
- }
- if (getSelectedNonResources().size() > 0) {
- return false;
- }
-
- // to enable this command all selected resources must be siblings
- List selectedResources = getSelectedResources();
- if (selectedResources.size() == 0)
- return false;
- IContainer firstParent = ((IResource) selectedResources.get(0)).getParent();
- if (firstParent == null) {
- return false;
- }
- Iterator resourcesEnum = selectedResources.iterator();
- while (resourcesEnum.hasNext()) {
- IResource currentResource = (IResource) resourcesEnum.next();
- if (currentResource.getType() == IResource.PROJECT) {
- return false;
- }
- if (!currentResource.getParent().equals(firstParent)) {
- return false;
- }
- }
- return true;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CreateFileAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CreateFileAction.java
deleted file mode 100644
index 5db7a9b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CreateFileAction.java
+++ /dev/null
@@ -1,92 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import java.util.Iterator;
-
-/**
- * Standard action for creating a file resource within the currently
- * selected folder or project.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- *
- * @deprecated should use NewWizardMenu to populate a New submenu instead (see Navigator view)
- */
-public class CreateFileAction extends SelectionListenerAction {
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".CreateFileAction";//$NON-NLS-1$
-
- /**
- * The shell in which to show any dialogs.
- */
- private Shell shell;
-/**
- * Creates a new action for creating a file resource.
- *
- * @param shell the shell for any dialogs
- *
- * @deprecated see deprecated tag on class
- */
-public CreateFileAction(Shell shell) {
- super(WorkbenchMessages.getString("CreateFileAction.text")); //$NON-NLS-1$
- Assert.isNotNull(shell);
- this.shell = shell;
- setToolTipText(WorkbenchMessages.getString("CreateFileAction.toolTip")); //$NON-NLS-1$
- setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE));
- setId(ID);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CREATE_FILE_ACTION);
-}
-/**
- * The <code>CreateFileAction</code> implementation of this
- * <code>IAction</code> method opens a <code>BasicNewFileResourceWizard</code>
- * in a wizard dialog under the shell passed to the constructor.
- */
-public void run() {
- BasicNewFileResourceWizard wizard = new BasicNewFileResourceWizard();
- wizard.init(PlatformUI.getWorkbench(), getStructuredSelection());
- wizard.setNeedsProgressMonitor(true);
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_FILE_WIZARD);
- dialog.open();
-}
-/**
- * The <code>CreateFileAction</code> implementation of this
- * <code>SelectionListenerAction</code> method enables the action only
- * if the selection contains folders and open projects.
- */
-protected boolean updateSelection(IStructuredSelection s) {
- if (!super.updateSelection(s)) {
- return false;
- }
- Iterator resources = getSelectedResources().iterator();
- while (resources.hasNext()) {
- IResource resource = (IResource)resources.next();
- if (!resourceIsType(resource, IResource.PROJECT | IResource.FOLDER) || !resource.isAccessible()) {
- return false;
- }
- }
- return true;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CreateFolderAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CreateFolderAction.java
deleted file mode 100644
index 947e397..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CreateFolderAction.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.wizards.newresource.BasicNewFolderResourceWizard;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import java.util.Iterator;
-
-/**
- * Standard action for creating a folder resource within the currently
- * selected folder or project.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- *
- * @deprecated should use NewWizardMenu to populate a New submenu instead (see Navigator view)
- */
-public class CreateFolderAction extends SelectionListenerAction {
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".CreateFolderAction";//$NON-NLS-1$
-
- /**
- * The shell in which to show any dialogs.
- */
- private Shell shell;
-/**
- * Creates a new action for creating a folder resource.
- *
- * @param shell the shell for any dialogs
- *
- * @deprecated see deprecated tag on class
- */
-public CreateFolderAction(Shell shell) {
- super(WorkbenchMessages.getString("CreateFolderAction.text")); //$NON-NLS-1$
- Assert.isNotNull(shell);
- this.shell = shell;
- setImageDescriptor(WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER));
- setToolTipText(WorkbenchMessages.getString("CreateFolderAction.toolTip")); //$NON-NLS-1$
- setId(ID);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CREATE_FOLDER_ACTION);
-}
-/**
- * The <code>CreateFolderAction</code> implementation of this
- * <code>IAction</code> method opens a <code>BasicNewFolderResourceWizard</code>
- * in a wizard dialog under the shell passed to the constructor.
- */
-public void run() {
- BasicNewFolderResourceWizard wizard = new BasicNewFolderResourceWizard();
- wizard.init(PlatformUI.getWorkbench(), getStructuredSelection());
- wizard.setNeedsProgressMonitor(true);
- WizardDialog dialog = new WizardDialog(shell, wizard);
- dialog.create();
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFolderAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_FOLDER_WIZARD);
- dialog.open();
-
-}
-/**
- * The <code>CreateFolderAction</code> implementation of this
- * <code>SelectionListenerAction</code> method enables the action only
- * if the selection contains folders and open projects.
- */
-protected boolean updateSelection(IStructuredSelection s) {
- if (!super.updateSelection(s)) {
- return false;
- }
- Iterator resources = getSelectedResources().iterator();
- while (resources.hasNext()) {
- IResource resource = (IResource)resources.next();
- if (!resourceIsType(resource, IResource.PROJECT | IResource.FOLDER) || !resource.isAccessible()) {
- return false;
- }
- }
- return true;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CreateProjectAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CreateProjectAction.java
deleted file mode 100644
index 94ae84e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/CreateProjectAction.java
+++ /dev/null
@@ -1,190 +0,0 @@
-package org.eclipse.ui.actions;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.dialogs.MultiStepWizardDialog;
-import org.eclipse.ui.internal.dialogs.NewProjectWizard;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.internal.registry.Capability;
-import org.eclipse.ui.internal.registry.CapabilityRegistry;
-import org.eclipse.ui.internal.registry.ICategory;
-
-/**
- * Standard action for launching the new project creation
- * wizard.
- * <p>
- * This class may be instantiated and subclassed by clients.
- * </p>
- * @deprecated This new experimental API is being temporary
- * deprecated for release 2.0 New project creation should
- * continue to make use of NewProjectAction.
- */
-public class CreateProjectAction extends Action {
- /**
- * 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 workbench window this action will run in
- */
- private IWorkbenchWindow window;
-
- /**
- * The suggested name for the new project
- */
- private String initialProjectName;
-
- /**
- * The suggested capabilities for the new project
- */
- private Capability[] initialProjectCapabilities;
-
- /**
- * The suggested categories to be selected
- */
- private ICategory[] initialSelectedCategories;
-
- /**
- * Creates a new action for launching the new project
- * selection wizard.
- *
- * @param window the workbench window to query the current
- * selection and shell for opening the wizard.
- */
- public CreateProjectAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.getString("CreateProjectAction.text")); //$NON-NLS-1$
- Assert.isNotNull(window);
- this.window = window;
- setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ));
- setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ_HOVER));
- setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ_DISABLED));
- setToolTipText(WorkbenchMessages.getString("CreateProjectAction.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.NEW_ACTION);
- }
-
- /**
- * Returns the selection to initialized the wizard with
- */
- protected IStructuredSelection getInitialSelection() {
- ISelection selection = window.getSelectionService().getSelection();
- IStructuredSelection selectionToPass = StructuredSelection.EMPTY;
- if (selection instanceof IStructuredSelection)
- selectionToPass = (IStructuredSelection) selection;
- return selectionToPass;
- }
-
- /**
- * Sets the initial categories to be selected. Ignores
- * any IDs which do not represent valid categories.
- *
- * @param ids initial category ids to select
- */
- public void setInitialSelectedCategories(String[] ids) {
- if (ids == null || ids.length == 0)
- initialSelectedCategories = null;
- else {
- CapabilityRegistry reg = WorkbenchPlugin.getDefault().getCapabilityRegistry();
- ArrayList results = new ArrayList(ids.length);
- for (int i = 0; i < ids.length; i++) {
- ICategory cat = reg.findCategory(ids[i]);
- if (cat != null)
- results.add(cat);
- }
- if (results.isEmpty())
- initialSelectedCategories = null;
- else {
- initialSelectedCategories = new ICategory[results.size()];
- results.toArray(initialSelectedCategories);
- }
- }
- }
-
- /**
- * Sets the initial project capabilities to be selected.
- * Ignores any IDs which do not represent valid capabilities.
- *
- * @param ids initial project capability ids to select
- */
- public void setInitialProjectCapabilities(String[] ids) {
- if (ids == null || ids.length == 0)
- initialProjectCapabilities = null;
- else {
- CapabilityRegistry reg = WorkbenchPlugin.getDefault().getCapabilityRegistry();
- ArrayList results = new ArrayList(ids.length);
- for (int i = 0; i < ids.length; i++) {
- Capability cap = reg.findCapability(ids[i]);
- if (cap != null && cap.isValid())
- results.add(cap);
- }
- if (results.isEmpty())
- initialProjectCapabilities = null;
- else {
- initialProjectCapabilities = new Capability[results.size()];
- results.toArray(initialProjectCapabilities);
- }
- }
- }
-
- /**
- * Sets the initial project name. Leading and trailing
- * spaces in the name are ignored.
- *
- * @param name initial project name
- */
- public void setInitialProjectName(String name) {
- if (name == null)
- initialProjectName = null;
- else
- initialProjectName = name.trim();
- }
-
- /* (non-Javadoc)
- * Method declared on IAction.
- */
- public void run() {
- // Create a new project wizard
- NewProjectWizard wizard = new NewProjectWizard();
- wizard.init(window.getWorkbench(), getInitialSelection());
- wizard.setInitialProjectName(initialProjectName);
- wizard.setInitialProjectCapabilities(initialProjectCapabilities);
- wizard.setInitialSelectedCategories(initialSelectedCategories);
-
- // Create a wizard dialog.
- WizardDialog dialog = new MultiStepWizardDialog(window.getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT );
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_PROJECT_WIZARD);
-
- // Open the wizard.
- dialog.open();
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/DeleteResourceAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/DeleteResourceAction.java
deleted file mode 100644
index 021331f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/DeleteResourceAction.java
+++ /dev/null
@@ -1,475 +0,0 @@
-package org.eclipse.ui.actions;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.Assert;
-
-/**
- * Standard action for deleting the currently selected resources.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class DeleteResourceAction extends SelectionListenerAction {
-
- static class DeleteProjectDialog extends MessageDialog {
-
- private List projects;
- private boolean deleteContent = false;
- private Button radio1;
- private Button radio2;
-
- DeleteProjectDialog(Shell parentShell, List projects) {
- super(
- parentShell,
- getTitle(projects),
- null, // accept the default window icon
- getMessage(projects),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
- 0); // yes is the default
- this.projects = projects;
- }
-
- static String getTitle(List projects) {
- if (projects.size() == 1)
- return WorkbenchMessages.getString("DeleteResourceAction.titleProject1"); //$NON-NLS-1$
- else
- return WorkbenchMessages.getString("DeleteResourceAction.titleProjectN"); //$NON-NLS-1$
- }
-
- static String getMessage(List projects) {
- if (projects.size() == 1) {
- IProject project = (IProject) projects.get(0);
- return WorkbenchMessages.format("DeleteResourceAction.confirmProject1", new Object[] { project.getName() }); //$NON-NLS-1$
- }
- else {
- return WorkbenchMessages.format("DeleteResourceAction.confirmProjectN", new Object[] { new Integer(projects.size()) }); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- WorkbenchHelp.setHelp(newShell, IHelpContextIds.DELETE_PROJECT_DIALOG);
- }
-
- protected Control createCustomArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- radio1 = new Button(composite, SWT.RADIO);
- radio1.addSelectionListener(selectionListener);
- String text1;
- if (projects.size() == 1) {
- IProject project = (IProject) projects.get(0);
- if(project == null || project.getLocation() == null)
- text1 = WorkbenchMessages.getString("DeleteResourceAction.deleteContentsN"); //$NON-NLS-1$
- else
- text1 = WorkbenchMessages.format("DeleteResourceAction.deleteContents1", new Object[] { project.getLocation().toOSString() }); //$NON-NLS-1$
- } else {
- text1 = WorkbenchMessages.getString("DeleteResourceAction.deleteContentsN"); //$NON-NLS-1$
- }
- radio1.setText(text1);
- radio1.setFont(parent.getFont());
-
- radio2 = new Button(composite, SWT.RADIO);
- radio2.addSelectionListener(selectionListener);
- String text2 = WorkbenchMessages.getString("DeleteResourceAction.doNotDeleteContents"); //$NON-NLS-1$
- radio2.setText(text2);
- radio2.setFont(parent.getFont());
-
- // set initial state
- radio1.setSelection(deleteContent);
- radio2.setSelection(!deleteContent);
-
- return composite;
- }
-
- private SelectionListener selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Button button = (Button) e.widget;
- if (button.getSelection()) {
- deleteContent = (button == radio1);
- }
- }
- };
-
- public boolean getDeleteContent() {
- return deleteContent;
- }
- }
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".DeleteResourceAction";//$NON-NLS-1$
-
- /**
- * The shell in which to show any dialogs.
- */
- private Shell shell;
-
- /**
- * Whether or not we are deleting content for projects.
- */
- private boolean deleteContent = false;
-
- /**
- * Whether or not to automatically delete out of sync resources
- */
- private boolean forceOutOfSyncDelete = false;
-/**
- * Creates a new delete resource action.
- *
- * @param shell the shell for any dialogs
- */
-public DeleteResourceAction(Shell shell) {
- super(WorkbenchMessages.getString("DeleteResourceAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("DeleteResourceAction.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.DELETE_RESOURCE_ACTION);
- setId(ID);
- Assert.isNotNull(shell);
- this.shell = shell;
-}
-/**
- * Returns whether delete can be performed on the current selection.
- *
- * @return <code>true</code> if the resources can be deleted, and
- * <code>false</code> if the selection contains non-resources or phantom
- * resources
- */
-boolean canDelete() {
- // allow only projects or only non-projects to be selected;
- // note that the selection may contain multiple types of resource
- if (!(containsOnlyProjects() || containsOnlyNonProjects())) {
- return false;
- }
-
- List resources = getSelectedResources();
- if (resources.size() == 0) return false;
- // Return true if everything in the selection exists.
- for (Iterator e = resources.iterator(); e.hasNext();) {
- IResource next = (IResource)e.next();
- if (next.isPhantom()) {
- return false;
- }
- }
- return true;
-}
-/**
- * Returns whether the selection contains only projects.
- *
- * @return <code>true</code> if the resources contains only projects, and
- * <code>false</code> otherwise
- */
-boolean containsOnlyProjects() {
- if (getSelectedNonResources().size() > 0) return false;
- int types = getSelectedResourceTypes();
- // note that the selection may contain multiple types of resource
- return types == IResource.PROJECT;
-}
-
-/**
- * Returns whether the selection contains only non-projects.
- *
- * @return <code>true</code> if the resources contains only non-projects, and
- * <code>false</code> otherwise
- */
-boolean containsOnlyNonProjects() {
- if (getSelectedNonResources().size() > 0) return false;
- int types = getSelectedResourceTypes();
- // check for empty selection
- if (types == 0) return false;
- // note that the selection may contain multiple types of resource
- return (types & IResource.PROJECT) == 0;
-}
-
-/**
- * Asks the user to confirm a delete operation.
- *
- * @return <code>true</code> if the user says to go ahead, and <code>false</code>
- * if the deletion should be abandoned
- */
-boolean confirmDelete() {
- if (containsOnlyProjects()) {
- return confirmDeleteProjects();
- }
- else {
- return confirmDeleteNonProjects();
- }
-}
-/**
- * Asks the user to confirm a delete operation,
- * where the selection contains no projects.
- *
- * @return <code>true</code> if the user says to go ahead, and <code>false</code>
- * if the deletion should be abandoned
- */
-boolean confirmDeleteNonProjects() {
- List resources = getSelectedResources();
- String title;
- String msg;
- if (resources.size() == 1) {
- title = WorkbenchMessages.getString("DeleteResourceAction.title1"); //$NON-NLS-1$
- IResource resource = (IResource) resources.get(0);
- msg = WorkbenchMessages.format("DeleteResourceAction.confirm1", new Object[] { resource.getName() }); //$NON-NLS-1$
- }
- else {
- title = WorkbenchMessages.getString("DeleteResourceAction.titleN"); //$NON-NLS-1$
- msg = WorkbenchMessages.format("DeleteResourceAction.confirmN", new Object[] { new Integer(resources.size()) }); //$NON-NLS-1$
- }
- return MessageDialog.openQuestion(shell, title, msg);
-}
-/**
- * Asks the user to confirm a delete operation,
- * where the selection contains only projects.
- * Also remembers whether project content should be deleted.
- *
- * @return <code>true</code> if the user says to go ahead, and <code>false</code>
- * if the deletion should be abandoned
- */
-boolean confirmDeleteProjects() {
- List resources = getSelectedResources();
- DeleteProjectDialog dialog = new DeleteProjectDialog(shell, resources);
- int code = dialog.open();
- deleteContent = dialog.getDeleteContent();
- return code == 0; // YES
-}
-/**
- * Deletes the given resources.
- */
-void delete(IResource[] resourcesToDelete, IProgressMonitor monitor) throws CoreException {
- forceOutOfSyncDelete = false;
- monitor.beginTask("", resourcesToDelete.length); //$NON-NLS-1$
- for (int i = 0; i < resourcesToDelete.length; ++i) {
- if (monitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- delete(resourcesToDelete[i], new SubProgressMonitor(monitor, 1, SubProgressMonitor.PREPEND_MAIN_LABEL_TO_SUBTASK));
- }
- monitor.done();
-}
-/**
- * Deletes the given resource.
- */
-void delete(IResource resourceToDelete, IProgressMonitor monitor) throws CoreException {
- boolean force = false; // don't force deletion of out-of-sync resources
- try {
- if (resourceToDelete.getType() == IResource.PROJECT) {
- // if it's a project, ask whether content should be deleted too
- IProject project = (IProject) resourceToDelete;
- project.delete(deleteContent, force, monitor);
- }
- else {
- // if it's not a project, just delete it
- resourceToDelete.delete(IResource.KEEP_HISTORY, monitor);
- }
- }
- catch (CoreException exception) {
- if (resourceToDelete.getType() == IResource.FILE) {
- IStatus[] children = exception.getStatus().getChildren();
-
- if (children.length == 1 &&
- children[0].getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
- if (forceOutOfSyncDelete) {
- resourceToDelete.delete(IResource.KEEP_HISTORY | IResource.FORCE, monitor);
- }
- else {
- int result = queryDeleteOutOfSync(resourceToDelete);
-
- if (result == IDialogConstants.YES_ID) {
- resourceToDelete.delete(IResource.KEEP_HISTORY | IResource.FORCE, monitor);
- }
- else
- if (result == IDialogConstants.YES_TO_ALL_ID) {
- forceOutOfSyncDelete = true;
- resourceToDelete.delete(IResource.KEEP_HISTORY | IResource.FORCE, monitor);
- }
- else
- if (result == IDialogConstants.CANCEL_ID) {
- throw new OperationCanceledException();
- }
- }
- }
- else {
- throw exception;
- }
- }
- else {
- throw exception;
- }
- }
-}
-/**
- * Return an array of the currently selected resources.
- *
- * @return the list of selected resources
- */
-IResource[] getSelectedResourcesArray() {
- List selection = getSelectedResources();
- IResource[] resources = new IResource[selection.size()];
- int i = 0;
- for (Iterator e = selection.iterator(); e.hasNext();)
- resources[i++] = (IResource) e.next();
- return resources;
-}
-/**
- * Returns a bit-mask containing the types of resources in the selection.
- */
-int getSelectedResourceTypes() {
- int types = 0;
- for (Iterator i = getSelectedResources().iterator(); i.hasNext();) {
- IResource r = (IResource) i.next();
- types |= r.getType();
- }
- return types;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void run() {
- if (!confirmDelete())
- return;
- final IResource[] resourcesToDelete = getResourcesToDelete();
-
- if (resourcesToDelete.length == 0)
- return;
- try {
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- delete(resourcesToDelete, monitor);
- }
- };
- new ProgressMonitorDialog(shell).run(true, true, op);
- } catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof CoreException) {
- CoreException exception = (CoreException) t;
- IStatus status = exception.getStatus();
- IStatus[] children = status.getChildren();
- boolean outOfSyncError = false;
-
- for (int i = 0; i < children.length; i++) {
- if (children[i].getCode() == IResourceStatus.OUT_OF_SYNC_LOCAL) {
- outOfSyncError = true;
- break;
- }
- }
- if (outOfSyncError) {
- ErrorDialog.openError(
- shell,
- WorkbenchMessages.getString("DeleteResourceAction.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("DeleteResourceAction.outOfSyncError"), //$NON-NLS-1$
- status);
- }
- else {
- ErrorDialog.openError(
- shell,
- WorkbenchMessages.getString("DeleteResourceAction.errorTitle"), // no special message //$NON-NLS-1$
- null, status);
- }
- }
- else {
- // CoreExceptions are collected above, but unexpected runtime exceptions and errors may still occur.
- WorkbenchPlugin.log(MessageFormat.format("Exception in {0}.run: {1}", new Object[] {getClass().getName(), t}));//$NON-NLS-1$
- MessageDialog.openError(
- shell,
- WorkbenchMessages.getString("DeleteResourceAction.messageTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("DeleteResourceAction.internalError", new Object[] {t.getMessage()})); //$NON-NLS-1$
- }
- } catch (InterruptedException e) {
- // just return
- }
-}
-/**
- * Returns the resources to delete based on the selection and their read-only status.
- *
- * @return the resources to delete
- */
-IResource[] getResourcesToDelete() {
- IResource[] selectedResources = getSelectedResourcesArray();
-
- if (containsOnlyProjects() && !deleteContent) {
- // We can just return the selection
- return selectedResources;
- }
-
- ReadOnlyStateChecker checker =
- new ReadOnlyStateChecker(
- this.shell,
- WorkbenchMessages.getString("DeleteResourceAction.title1"), //$NON-NLS-1$
- WorkbenchMessages.getString("DeleteResourceAction.readOnlyQuestion")); //$NON-NLS-1$
-
- return checker.checkReadOnlyResources(selectedResources);
-}
-/**
- * The <code>DeleteResourceAction</code> implementation of this
- * <code>SelectionListenerAction</code> method disables the action
- * if the selection contains phantom resources or non-resources
- */
-protected boolean updateSelection(IStructuredSelection selection) {
- return super.updateSelection(selection) && canDelete();
-}
-
-/**
- * Ask the user whether the given resource should be deleted
- * despite being out of sync with the file system.
- * @param resource the out of sync resource
- * @return One of the IDialogConstants constants indicating which
- * of the Yes, Yes to All, No, Cancel options has been selected by
- * the user.
- */
-private int queryDeleteOutOfSync(IResource resource) {
- final MessageDialog dialog =
- new MessageDialog(
- shell,
- WorkbenchMessages.getString("DeleteResourceAction.messageTitle"), //$NON-NLS-1$
- null,
- WorkbenchMessages.format("DeleteResourceAction.outOfSyncQuestion", new Object[] {resource.getName()}), //$NON-NLS-1$
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL },
- 0);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- dialog.open();
- }
- });
- int result = dialog.getReturnCode();
- if (result == 0)
- return IDialogConstants.YES_ID;
- if (result == 1)
- return IDialogConstants.YES_TO_ALL_ID;
- if (result == 2)
- return IDialogConstants.NO_ID;
- return IDialogConstants.CANCEL_ID;
-}
-}
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
deleted file mode 100644
index e341520..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ExportResourcesAction.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.dialogs.ExportWizard;
-
-/**
- * Action representing the initiation of an Export operation by the user.
- * <p>
- * This class may be instantiated. It is not intended to be subclassed.
- * </p>
- * @since 2.0
- */
-public class ExportResourcesAction extends SelectionListenerAction {
- private static final int SIZING_WIZARD_WIDTH = 470;
- private static final int SIZING_WIZARD_HEIGHT = 550;
- private IWorkbench workbench;
-/**
- * Create a new instance of this class
- */
-public ExportResourcesAction(IWorkbench aWorkbench) {
- this(aWorkbench,WorkbenchMessages.getString("ExportResourcesAction.text")); //$NON-NLS-1$
-}
-
-/**
- * Create a new instance of this class
- */
-public ExportResourcesAction(IWorkbench aWorkbench, String label) {
- super(label); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("ExportResourcesAction.toolTip")); //$NON-NLS-1$
- setId(IWorkbenchActionConstants.EXPORT);
- WorkbenchHelp.setHelp(this, IHelpContextIds.EXPORT_ACTION);
- this.workbench = aWorkbench;
-}
-
-
-/**
- * Invoke the Export wizards selection Wizard.
- *
- * @param browser Window
- */
-public void run() {
- ExportWizard wizard = new ExportWizard();
- IStructuredSelection selectionToPass;
- List selectedResources = getSelectedResources();
-
- if (selectedResources.isEmpty()) {
- // get the current workbench selection
- ISelection workbenchSelection =
- workbench.getActiveWorkbenchWindow().getSelectionService().getSelection();
- if (workbenchSelection instanceof IStructuredSelection)
- selectionToPass = (IStructuredSelection)workbenchSelection;
- else
- selectionToPass = StructuredSelection.EMPTY;
- }
- else
- selectionToPass = new StructuredSelection(selectedResources);
-
- wizard.init(workbench, selectionToPass);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("ExportResourcesAction");//$NON-NLS-1$
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("ExportResourcesAction");//$NON-NLS-1$
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- Shell parent = workbench.getActiveWorkbenchWindow().getShell();
- WizardDialog dialog = new WizardDialog(parent, wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT );
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.EXPORT_WIZARD);
- dialog.open();
-}
-
-/**
- * Sets the current selection.
- * In for backwards compatability. Use selectionChanged() instead.
- * @param selection the new selection
- * @deprecated
- */
-public void setSelection(IStructuredSelection selection) {
- selectionChanged(selection);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/GlobalBuildAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/GlobalBuildAction.java
deleted file mode 100644
index 9d384c1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/GlobalBuildAction.java
+++ /dev/null
@@ -1,260 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Standard action for full and incremental builds of all projects
- * within the workspace.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class GlobalBuildAction extends Action {
-
- /**
- * The type of build performed by this action. Can be either
- * <code>IncrementalProjectBuilder.INCREMENTAL_BUILD</code> or
- * <code>IncrementalProjectBuilder.FULL_BUILD</code>.
- */
- private int buildType;
-
- /**
- * The workbench this action applies to.
- */
- private IWorkbench workbench;
-
- /**
- * The window this action appears in.
- */
- private IWorkbenchWindow window;
-
- /**
- * The shell used to display message dialogs to the user
- */
- private Shell shell;
-
-/**
- * Creates a new action of the appropriate type. The action id is
- * <code>IWorkbenchActionConstants.BUILD</code> for incremental builds
- * and <code>IWorkbenchActionConstants.REBUILD_ALL</code> for full builds.
- *
- * @param workbench the active workbench
- * @param shell the shell for any dialogs
- * @param type the type of build; one of
- * <code>IncrementalProjectBuilder.INCREMENTAL_BUILD</code> or
- * <code>IncrementalProjectBuilder.FULL_BUILD</code>
- *
- * @deprecated use GlobalBuildAction(IWorkbenchWindow, type) instead
- */
-public GlobalBuildAction(IWorkbench workbench, Shell shell, int type) {
- Assert.isNotNull(workbench);
- Assert.isNotNull(shell);
- this.workbench = workbench;
- this.shell = shell;
- setBuildType(type);
-}
-
-/**
- * Creates a new action of the appropriate type. The action id is
- * <code>IWorkbenchActionConstants.BUILD</code> for incremental builds
- * and <code>IWorkbenchActionConstants.REBUILD_ALL</code> for full builds.
- *
- * @param window the window in which this action appears
- * @param type the type of build; one of
- * <code>IncrementalProjectBuilder.INCREMENTAL_BUILD</code> or
- * <code>IncrementalProjectBuilder.FULL_BUILD</code>
- */
-public GlobalBuildAction(IWorkbenchWindow window, int type) {
- Assert.isNotNull(window);
- this.workbench = window.getWorkbench();
- this.window = window;
- setBuildType(type);
-}
-
-/**
- * Sets the build type.
- *
- * @param type the type of build; one of
- * <code>IncrementalProjectBuilder.INCREMENTAL_BUILD</code> or
- * <code>IncrementalProjectBuilder.FULL_BUILD</code>
- */
-private void setBuildType(int type) {
- // allow AUTO_BUILD as well for backwards compatibility, but treat it the same as INCREMENTAL_BUILD
- switch (type) {
- case IncrementalProjectBuilder.INCREMENTAL_BUILD:
- case IncrementalProjectBuilder.AUTO_BUILD:
- setText(WorkbenchMessages.getString("GlobalBuildAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("GlobalBuildAction.toolTip")); //$NON-NLS-1$
- setId(IWorkbenchActionConstants.BUILD);
- WorkbenchHelp.setHelp(this, IHelpContextIds.GLOBAL_INCREMENTAL_BUILD_ACTION);
- setAccelerator(SWT.CTRL | 'b');
- break;
- case IncrementalProjectBuilder.FULL_BUILD:
- setText(WorkbenchMessages.getString("GlobalBuildAction.rebuildText")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("GlobalBuildAction.rebuildToolTip")); //$NON-NLS-1$
- setId(IWorkbenchActionConstants.REBUILD_ALL);
- WorkbenchHelp.setHelp(this, IHelpContextIds.GLOBAL_FULL_BUILD_ACTION);
- break;
- default:
- Assert.isTrue(false, "Invalid build type"); //$NON-NLS-1$
- break;
- }
- this.buildType = type;
-}
-
-/**
- * Returns the shell to use. Uses the window's shell if a window
- * has been set, otherwise it uses the shell passed to the deprecated constructor.
- */
-private Shell getShell() {
- if (window != null) {
- return window.getShell();
- }
- else {
- return shell;
- }
-}
-
-/**
- * Builds all projects within the workspace. Does
- * not save any open editors.
- */
-public void doBuild() {
- doBuildOperation();
-}
-/**
- * Invokes a build on all projects within the workspace.
- * Reports any errors with the build to the user.
- */
-/* package */ void doBuildOperation() {
-
- final MultiStatus status = new MultiStatus(
- PlatformUI.PLUGIN_ID,
- 0,
- WorkbenchMessages.getString("GlobalBuildAction.buildProblems"), //$NON-NLS-1$
- null);
-
- IRunnableWithProgress op = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- try {
- ResourcesPlugin.getWorkspace().build(buildType, monitor);
- }
- catch (CoreException e) {
- status.add(e.getStatus());
- }
- }
- };
-
- try {
- new ProgressMonitorDialog(getShell()).run(true, true, op);
- }
- catch (InterruptedException e) {
- // do nothing
- }
- catch (InvocationTargetException e) {
- // Unexpected runtime exceptions
- WorkbenchPlugin.log("Exception in " + getClass().getName() + ".run: " + e.getTargetException());//$NON-NLS-2$//$NON-NLS-1$
- MessageDialog.openError(
- shell,
- WorkbenchMessages.getString("GlobalBuildAction.buildProblems"), //$NON-NLS-1$
- WorkbenchMessages.format(
- "GlobalBuildAction.internalError", //$NON-NLS-1$
- new Object[] {e.getTargetException().getMessage()}));
- return;
- }
-
- // If errors occurred, open an error dialog
- if (!status.isOK()) {
- ErrorDialog.openError(
- shell,
- WorkbenchMessages.getString("GlobalBuildAction.problemTitle"), //$NON-NLS-1$
- null, // no special message
- status);
- }
-}
-/**
- * Returns an array of all projects in the workspace
- */
-/* package */ IProject[] getWorkspaceProjects() {
- return ResourcesPlugin.getWorkspace().getRoot().getProjects();
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- *
- * Builds all projects within the workspace. Saves
- * all editors prior to build depending on user's
- * preference.
- */
-public void run() {
- // Do nothing if there are no projects...
- IProject[] roots = getWorkspaceProjects();
- if (roots.length < 1)
- return;
-
- // Verify that there are builders registered on at
- // least one project
- if (!verifyBuildersAvailable(roots))
- return;
-
- // Save all resources prior to doing build
- saveAllResources();
-
- // Perform the build on all the projects
- doBuildOperation();
-}
-/**
- * Causes all editors to save any modified resources
- * depending on the user's preference.
- */
-/* package */ void saveAllResources() {
- if (!BuildAction.isSaveAllSet())
- return;
-
- IWorkbenchWindow[] windows = this.workbench.getWorkbenchWindows();
- for (int i = 0; i < windows.length; i++) {
- IWorkbenchPage[] perspectives = windows[i].getPages();
- for (int j = 0; j < perspectives.length; j++)
- perspectives[j].saveAllEditors(false);
- }
-}
-/**
- * Checks that there is at least one project with a
- * builder registered on it.
- */
-/* package */ boolean verifyBuildersAvailable(IProject[] roots) {
- try {
- for (int i = 0; i < roots.length; i++) {
- if (roots[i].isAccessible())
- if (roots[i].getDescription().getBuildSpec().length > 0)
- return true;
- }
- }
- catch (CoreException e) {
- WorkbenchPlugin.log("Exception in " + getClass().getName() + ".run: " + e);//$NON-NLS-2$//$NON-NLS-1$
- ErrorDialog.openError(
- getShell(),
- WorkbenchMessages.getString("GlobalBuildAction.buildProblems"), //$NON-NLS-1$
- WorkbenchMessages.format("GlobalBuildAction.internalError", new Object[] {e.getMessage()}), //$NON-NLS-1$
- e.getStatus());
- return false;
- }
-
- return false;
-}
-}
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
deleted file mode 100644
index f2882d5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ImportResourcesAction.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.dialogs.ImportWizard;
-
-/**
- * Action representing the initiation of an Import operation by the user.
- * <p>
- * This class may be instantiated. It is not intended to be subclassed.
- * </p>
- * @since 2.0
- */
-public class ImportResourcesAction extends SelectionListenerAction {
- private static final int SIZING_WIZARD_WIDTH = 470;
- private static final int SIZING_WIZARD_HEIGHT = 550;
- private IWorkbench workbench;
-/**
- * Create a new instance of this class
- */
-public ImportResourcesAction(IWorkbench aWorkbench) {
- super(WorkbenchMessages.getString("ImportResourcesAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("ImportResourcesAction.toolTip")); //$NON-NLS-1$
- setId(IWorkbenchActionConstants.IMPORT);
- WorkbenchHelp.setHelp(this, IHelpContextIds.IMPORT_ACTION);
- this.workbench = aWorkbench;
-}
-
-
-/**
- * Invoke the Import wizards selection Wizard.
- *
- * @param browser Window
- */
-public void run() {
- ImportWizard wizard = new ImportWizard();
- List selectedResources = getSelectedResources();;
- IStructuredSelection selectionToPass;
-
- if (selectedResources.isEmpty()) {
- // get the current workbench selection
- ISelection workbenchSelection =
- workbench.getActiveWorkbenchWindow().getSelectionService().getSelection();
- if (workbenchSelection instanceof IStructuredSelection)
- selectionToPass = (IStructuredSelection)workbenchSelection;
- else
- selectionToPass = StructuredSelection.EMPTY;
- }
- else
- selectionToPass = new StructuredSelection(selectedResources);
-
- wizard.init(workbench, selectionToPass);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("ImportResourcesAction");//$NON-NLS-1$
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("ImportResourcesAction");//$NON-NLS-1$
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- Shell parent = workbench.getActiveWorkbenchWindow().getShell();
- WizardDialog dialog = new WizardDialog(parent, wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT );
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.IMPORT_WIZARD);
- dialog.open();
-}
-
-/**
- * Sets the current selection.
- * In for backwards compatability. Use selectionChanged() instead.
- * @param selection the new selection
- * @deprecated
- */
-public void setSelection(IStructuredSelection selection) {
- selectionChanged(selection);
-}
-}
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
deleted file mode 100644
index 95bf843..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/LabelRetargetAction.java
+++ /dev/null
@@ -1,177 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.action.*;
-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..
- * <p>
- * This class may be instantiated. It is not intented to be subclassed.
- * </p>
- *
- * @since 2.0
- */
-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.
- */
-public LabelRetargetAction(String actionID, String text) {
- super(actionID, text);
- this.defaultText = text;
- this.defaultToolTipText = text;
- acceleratorText = extractAcceleratorText(text);
-}
-/**
- * The action handler has changed. Update self.
- */
-protected void propogateChange(PropertyChangeEvent event) {
- super.propogateChange(event);
- String prop = event.getProperty();
- if (prop.equals(Action.TEXT)) {
- String str = (String) event.getNewValue();
- super.setText(appendAccelerator(str));
- }
- else if (prop.equals(Action.TOOL_TIP_TEXT)) {
- String str = (String) event.getNewValue();
- super.setToolTipText(str);
- }
- else if (prop.equals(Action.IMAGE)) {
- updateImages(getActionHandler());
- }
-}
-/**
- * Sets the action handler. Update self.
- */
-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 {
- super.setText(appendAccelerator(handler.getText()));
- super.setToolTipText(handler.getToolTipText());
- }
- updateImages(handler);
-}
-
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void setDisabledImageDescriptor(ImageDescriptor image) {
- super.setDisabledImageDescriptor(image);
- defaultDisabledImage = image;
-}
-
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void setHoverImageDescriptor(ImageDescriptor image) {
- super.setHoverImageDescriptor(image);
- defaultHoverImage = image;
-}
-
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void setImageDescriptor(ImageDescriptor image) {
- super.setImageDescriptor(image);
- defaultImage = image;
-}
-
-/**
- * Sets the action's label text to the given value.
- */
-public void setText(String text) {
- super.setText(text);
- acceleratorText = extractAcceleratorText(text);
- defaultText = text;
-}
-/**
- * Sets the tooltip text to the given text.
- * The value <code>null</code> clears the tooltip text.
- */
-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)
- return null;
-
- // Remove any accelerator
- String str = removeAcceleratorText(newText);
- // Append our accelerator
- if (acceleratorText != null)
- str = str + acceleratorText;
- return str;
-}
-/**
- * Extracts the accelerator text from the given text.
- * Returns <code>null</code> if there is no accelerator text,
- * and the empty string if there is no text after the accelerator delimeter (tab or '@').
- *
- * @param text the text for the action
- * @return the accelerator text including '@' or '\t', or <code>null</code>
- */
-private String extractAcceleratorText(String text) {
- if (text == null)
- return null;
-
- int index = text.lastIndexOf('\t');
- if (index == -1)
- index = text.lastIndexOf('@');
- if (index >= 0)
- return text.substring(index);
- return null;
-}
-
-/**
- * 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/MoveFilesAndFoldersOperation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/MoveFilesAndFoldersOperation.java
deleted file mode 100644
index 9272f80..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/MoveFilesAndFoldersOperation.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Moves files and folders.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- *
- * @since 2.1
- */
-public class MoveFilesAndFoldersOperation extends CopyFilesAndFoldersOperation {
-
- /**
- * Creates a new operation initialized with a shell.
- *
- * @param shell parent shell for error dialogs
- */
- public MoveFilesAndFoldersOperation(Shell shell) {
- super(shell);
- }
- /**
- * Returns whether this operation is able to perform on-the-fly
- * auto-renaming of resources with name collisions.
- *
- * @return <code>true</code> if auto-rename is supported,
- * and <code>false</code> otherwise
- */
- protected boolean canPerformAutoRename() {
- return false;
- }
- /**
- * Moves the resources to the given destination. This method is
- * called recursively to merge folders during folder move.
- *
- * @param resources the resources to move
- * @param destination destination to which resources will be moved
- * @param monitor a progress monitor for showing progress and for cancelation
- */
- protected void copy(IResource[] resources, IPath destination, IProgressMonitor subMonitor) throws CoreException {
- for (int i = 0; i < resources.length; i++) {
- IResource source = resources[i];
- IPath destinationPath = destination.append(source.getName());
- IWorkspace workspace = source.getWorkspace();
- IWorkspaceRoot workspaceRoot = workspace.getRoot();
- boolean isFolder = source.getType() == IResource.FOLDER;
- boolean exists = workspaceRoot.exists(destinationPath);
- if (isFolder && exists) {
- // the resource is a folder and it exists in the destination, copy the
- // children of the folder
- IResource[] children = ((IContainer) source).members();
- copy(children, destinationPath, subMonitor);
- // need to explicitly delete the folder since we're not moving it
- delete(source, subMonitor);
- } else {
- // if we're merging folders, we could be overwriting an existing file
- IResource existing = workspaceRoot.findMember(destinationPath);
- boolean canMove = true;
-
- if (existing != null) {
- canMove = delete(existing, subMonitor);
- }
- // was the resource deleted successfully or was there no existing resource to delete?
- if (canMove) {
- source.move(destinationPath, IResource.KEEP_HISTORY, new SubProgressMonitor(subMonitor, 0));
- }
- subMonitor.worked(1);
- if (subMonitor.isCanceled()) {
- throw new OperationCanceledException();
- }
- }
- }
- }
- /**
- * Returns the message for this operation's problems dialog.
- *
- * @return the problems message
- */
- protected String getProblemsMessage() {
- return WorkbenchMessages.getString("MoveFilesAndFoldersOperation.problemMessage"); //$NON-NLS-1$
- }
- /**
- * Returns the title for this operation's problems dialog.
- *
- * @return the problems dialog title
- */
- protected String getProblemsTitle() {
- return WorkbenchMessages.getString("MoveFilesAndFoldersOperation.moveFailedTitle"); //$NON-NLS-1$
- }
- /* (non-Javadoc)
- * Overrides method in CopyFilesAndFoldersOperation
- *
- * Note this method is for internal use only. It is not API.
- *
- */
- public String validateDestination(IContainer destination, IResource[] sourceResources) {
- for (int i = 0; i < sourceResources.length; i++) {
- IResource sourceResource = sourceResources[i];
-
- // is the source being copied onto itself?
- if (sourceResource.getParent().equals(destination)) {
- return WorkbenchMessages.format(
- "MoveFilesAndFoldersOperation.sameSourceAndDest", //$NON-NLS-1$
- new Object[] {sourceResource.getName()});
- }
- }
- return super.validateDestination(destination, sourceResources);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/MoveProjectAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/MoveProjectAction.java
deleted file mode 100644
index 5b7df28..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/MoveProjectAction.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.ProjectLocationMoveDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.swt.widgets.Shell;
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-/**
- * The MoveProjectAction is the action designed to move projects specifically
- * as they have different semantics from other resources.
- */
-public class MoveProjectAction extends CopyProjectAction {
- private static String MOVE_TOOL_TIP = WorkbenchMessages.getString("MoveProjectAction.toolTip"); //$NON-NLS-1$
- private static String MOVE_TITLE = WorkbenchMessages.getString("MoveProjectAction.text"); //$NON-NLS-1$
- private static String PROBLEMS_TITLE = WorkbenchMessages.getString("MoveProjectAction.dialogTitle"); //$NON-NLS-1$
- private static String MOVE_PROGRESS_TITLE = WorkbenchMessages.getString("MoveProjectAction.progressMessage"); //$NON-NLS-1$
-
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".MoveProjectAction";//$NON-NLS-1$
-
-/**
- * Creates a new project move action with the given text.
- *
- * @param shell the shell for any dialogs
- */
-public MoveProjectAction(Shell shell) {
- super(shell,MOVE_TITLE);
- setToolTipText(MOVE_TOOL_TIP);
- setId(MoveProjectAction.ID);
- WorkbenchHelp.setHelp(this, IHelpContextIds.MOVE_PROJECT_ACTION);
-}
-/**
- * Return the title of the errors dialog.
- * @return java.lang.String
- */
-protected String getErrorsTitle() {
- return PROBLEMS_TITLE;
-}
-/**
- * Moves the project to the new values.
- *
- * @param project the project to copy
- * @param projectName the name of the copy
- * @param newLocation IPath
- * @return <code>true</code> if the copy operation completed, and
- * <code>false</code> if it was abandoned part way
- */
-boolean performMove(
- final IProject project,
- final String projectName,
- final IPath newLocation) {
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) {
-
- monitor.beginTask(MOVE_PROGRESS_TITLE, 100);
- try {
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- //Get a copy of the current description and modify it
- IProjectDescription newDescription =
- createDescription(project, projectName, newLocation);
-
- monitor.worked(50);
-
- project.move(newDescription, true, monitor);
-
- monitor.worked(50);
-
- } catch (CoreException e) {
- recordError(e); // log error
- } finally {
- monitor.done();
- }
- }
- };
-
- try {
- new ProgressMonitorDialog(shell).run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- // CoreExceptions are collected above, but unexpected runtime exceptions and errors may still occur.
- WorkbenchPlugin.log(
- MessageFormat.format("Exception in {0}.performMove(): {1}", new Object[] {getClass().getName(),e.getTargetException()}));//$NON-NLS-1$
- displayError(WorkbenchMessages.format("MoveProjectAction.internalError", new Object[] {e.getTargetException().getMessage()})); //$NON-NLS-1$
- return false;
- }
-
- return true;
-}
-/**
- * Query for a new project destination using the parameters in the existing
- * project.
- * @return Object[] or null if the selection is cancelled
- * @param IProject - the project we are going to move.
- */
-protected Object[] queryDestinationParameters(IProject project) {
- ProjectLocationMoveDialog dialog =
- new ProjectLocationMoveDialog(shell, project);
- dialog.setTitle(WorkbenchMessages.getString("MoveProjectAction.moveTitle")); //$NON-NLS-1$
- dialog.open();
- return dialog.getResult();
-}
-/**
- * Implementation of method defined on <code>IAction</code>.
- */
-public void run() {
-
- errorStatus = null;
-
- IProject project = (IProject) getSelectedResources().get(0);
-
- //Get the project name and location in a two element list
- Object[] destinationPaths = queryDestinationParameters(project);
- if (destinationPaths == null)
- return;
-
- String projectName = (String) destinationPaths[0];
- IPath newLocation = new Path((String) destinationPaths[1]);
-
- boolean completed = performMove(project, projectName, newLocation);
-
- if (!completed) // ie.- canceled
- return; // not appropriate to show errors
-
- // If errors occurred, open an Error dialog
- if (errorStatus != null) {
- ErrorDialog.openError(this.shell, PROBLEMS_TITLE, null, errorStatus);
- errorStatus = null;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/MoveResourceAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/MoveResourceAction.java
deleted file mode 100644
index c4445c7..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/MoveResourceAction.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.ui.dialogs.ContainerGenerator;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * Standard action for moving the currently selected resources elsewhere
- * in the workspace. All resources being moved as a group must be siblings.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class MoveResourceAction extends CopyResourceAction {
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".MoveResourceAction"; //$NON-NLS-1$
-
- /**
- * Keep a list of destinations so that any required update can be done after the
- * move.
- */
- protected List destinations;
-
- /**
- * Creates a new action.
- *
- * @param shell the shell for any dialogs
- */
- public MoveResourceAction(Shell shell) {
- super(shell, WorkbenchMessages.getString("MoveResourceAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("MoveResourceAction.toolTip")); //$NON-NLS-1$
- setId(MoveResourceAction.ID);
- WorkbenchHelp.setHelp(this, IHelpContextIds.MOVE_RESOURCE_ACTION);
- }
- /* (non-Javadoc)
- * Overrides method in CopyResourceAction
- */
- protected CopyFilesAndFoldersOperation createOperation() {
- return new MoveFilesAndFoldersOperation(getShell());
- }
- /**
- * Returns the destination resources for the resources that have been moved so far.
- *
- * @return list of destination <code>IResource</code>s
- */
- protected List getDestinations() {
- return destinations;
- }
- /* (non-Javadoc)
- * Overrides method in CopyResourceAction
- */
- protected IResource[] getResources(List resourceList) {
- ReadOnlyStateChecker checker = new ReadOnlyStateChecker(
- getShell(),
- WorkbenchMessages.getString("MoveResourceAction.title"), //$NON-NLS-1$
- WorkbenchMessages.getString("MoveResourceAction.checkMoveMessage"));//$NON-NLS-1$
- return checker.checkReadOnlyResources(super.getResources(resourceList));
- }
- /* (non-Javadoc)
- * Overrides method in CopyResourceAction
- */
- protected void runOperation(IResource[] resources, IContainer destination) {
- //Initialize the destinations
- destinations = new ArrayList();
- IResource[] copiedResources = operation.copyResources(resources, destination);
-
- for (int i = 0; i < copiedResources.length; i++) {
- destinations.add(destination.getFullPath().append(copiedResources[i].getName()));
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewProjectAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewProjectAction.java
deleted file mode 100644
index 67eb685..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewProjectAction.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.WizardDialog;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.dialogs.NewWizard;
-import org.eclipse.ui.internal.misc.Assert;
-
-/**
- * Standard action for launching the create project selection
- * wizard.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class NewProjectAction extends Action {
-
- /**
- * 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 workbench window this action will run in
- */
- private IWorkbenchWindow window;
-
-/**
- * This default constructor allows the the action to be called from the welcome page.
- */
-public NewProjectAction() {
- this(((Workbench)PlatformUI.getWorkbench()).getActiveWorkbenchWindow());
-}
-
-/**
- * Creates a new action for launching the new project
- * selection wizard.
- *
- * @param window the workbench window to query the current
- * selection and shell for opening the wizard.
- */
-public NewProjectAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.getString("NewProjectAction.text")); //$NON-NLS-1$
- Assert.isNotNull(window);
- this.window = window;
- setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ));
- setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ_HOVER));
- setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ_DISABLED));
- setToolTipText(WorkbenchMessages.getString("NewProjectAction.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.NEW_ACTION);
-}
-
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void run() {
- // Create wizard selection wizard.
- IWorkbench workbench = PlatformUI.getWorkbench();
- NewWizard wizard = new NewWizard();
- wizard.setProjectsOnly(true);
- ISelection selection = window.getSelectionService().getSelection();
- IStructuredSelection selectionToPass = StructuredSelection.EMPTY;
- if (selection instanceof IStructuredSelection)
- selectionToPass = (IStructuredSelection) selection;
- wizard.init(workbench, 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);
-
- // Create wizard dialog.
- Shell parent = window.getShell();
- WizardDialog dialog = new WizardDialog(parent, wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT );
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_PROJECT_WIZARD);
-
- // Open wizard.
- dialog.open();
-}
-}
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
deleted file mode 100644
index 753f25c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardAction.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.eclipse.ui.actions;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.dialogs.NewWizard;
-
-/**
- * Invoke the resource creation wizard selection Wizard.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class NewWizardAction extends Action {
-
- /**
- * 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 id of the category to show or <code>null</code> to
- * show all the categories.
- */
- private String categoryId = null;
-
-/**
- * Create a new instance of this class
- */
-public NewWizardAction() {
- super(WorkbenchMessages.getString("NewWizardAction.text")); //$NON-NLS-1$
- setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ));
- setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ_HOVER));
- setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ_DISABLED));
- setToolTipText(WorkbenchMessages.getString("NewWizardAction.toolTip")); //$NON-NLS-1$
- setAccelerator(SWT.CTRL | 'N'); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.NEW_ACTION);
-}
-/**
- * Returns the id of the category of wizards to show
- * or <code>null</code> to show all categories.
- */
-public String getCategoryId() {
- return categoryId;
-}
-/**
- * Sets the id of the category of wizards to show
- * or <code>null</code> to show all categories.
- */
-public void setCategoryId(String id) {
- categoryId = id;
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void run() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- NewWizard wizard = new NewWizard();
- wizard.setCategoryId(categoryId);
-
- ISelection selection = workbench.getActiveWorkbenchWindow().getSelectionService().getSelection();
- IStructuredSelection selectionToPass = StructuredSelection.EMPTY;
- if (selection instanceof IStructuredSelection) {
- selectionToPass = (IStructuredSelection) selection;
- } else {
- // Build the selection from the IFile of the editor
- IWorkbenchPart part = workbench.getActiveWorkbenchWindow().getPartService().getActivePart();
- if (part instanceof IEditorPart) {
- IEditorInput input = ((IEditorPart)part).getEditorInput();
- if (input instanceof IFileEditorInput) {
- selectionToPass = new StructuredSelection(((IFileEditorInput)input).getFile());
- }
- }
- }
-
- wizard.init(workbench, 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 = workbench.getActiveWorkbenchWindow().getShell();
- WizardDialog dialog = new WizardDialog(parent, wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT );
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_WIZARD);
- dialog.open();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardMenu.java
deleted file mode 100644
index ee332cc..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/NewWizardMenu.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.window.*;
-import java.util.*;
-
-/**
- * A <code>NewWizardMenu</code> is used to populate a menu manager with
- * New Wizard actions. The visible actions are determined by user preference
- * from the Perspective Customize dialog.
- */
-public class NewWizardMenu extends ShortcutMenu {
- private Action showDlgAction = new NewWizardAction();
- private Action newProjectAction;
- private Map actions = new HashMap(21);
- private NewWizardsRegistryReader reader = new NewWizardsRegistryReader();
- private boolean enabled = true;
-/**
- * Create a new wizard shortcut menu.
- * <p>
- * If the menu will appear on a semi-permanent basis, for instance within
- * a toolbar or menubar, the value passed for <code>register</code> should be true.
- * If set, the menu will listen to perspective activation and update itself
- * to suit. In this case clients are expected to call <code>deregister</code>
- * when the menu is no longer needed. This will unhook any perspective
- * listeners.
- * </p>
- *
- * @param innerMgr the location for the shortcut menu contents
- * @param window the window containing the menu
- * @param register if <code>true</code> the menu listens to perspective changes in
- * the window
- */
-public NewWizardMenu(IMenuManager innerMgr, IWorkbenchWindow window, boolean register) {
- super(innerMgr, window, register);
- newProjectAction = new NewProjectAction(window);
- fillMenu(); // Must be done after constructor to ensure field initialization.
-}
-/* (non-Javadoc)
- * Fills the menu with New Wizards.
- */
-protected void fillMenu() {
- // Remove all.
- IMenuManager innerMgr = getMenuManager();
- innerMgr.removeAll();
-
- if (this.enabled) {
- // Add new project ..
- innerMgr.add(newProjectAction);
- innerMgr.add(new Separator());
-
- // Get visible actions.
- List actions = null;
- IWorkbenchPage page = getWindow().getActivePage();
- if (page != null)
- actions = ((WorkbenchPage) page).getNewWizardActionIds();
- if (actions != null) {
- for (Iterator i = actions.iterator(); i.hasNext();) {
- String id = (String) i.next();
- IAction action = getAction(id);
- if (action != null)
- innerMgr.add(action);
- }
- }
-
- // Add other ..
- innerMgr.add(new Separator());
- innerMgr.add(showDlgAction);
- }
-}
-/* (non-Javadoc)
- * 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) {
- WorkbenchWizardElement element = reader.findWizard(id);
- if (element != null) {
- action = new NewWizardShortcutAction(getWindow().getWorkbench(), element);
- actions.put(id, action);
- }
- }
- return action;
-}
-/**
- * Sets the enabled state of the receiver.
- *
- * @param enabledValue if <code>true</code> the menu is enabled; else
- * it is disabled
- */
-public void setEnabled(boolean enabledValue) {
- this.enabled = enabledValue;
- updateMenu();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenFileAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenFileAction.java
deleted file mode 100644
index be94d00..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenFileAction.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.util.OpenStrategy;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.dialogs.DialogUtil;
-
-/**
- * Standard action for opening an editor on the currently selected file
- * resource(s).
- * <p>
- * Note that there is a different action for opening closed projects:
- * <code>OpenResourceAction</code>.
- * </p>
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class OpenFileAction extends OpenSystemEditorAction {
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".OpenFileAction";//$NON-NLS-1$
-
- /**
- * The editor to open.
- */
- private IEditorDescriptor editorDescriptor;
-/**
- * Creates a new action that will open editors on the then-selected file
- * resources. Equivalent to <code>OpenFileAction(page,null)</code>.
- *
- * @param page the workbench page in which to open the editor
- */
-public OpenFileAction(IWorkbenchPage page) {
- this(page, null);
-}
-/**
- * Creates a new action that will open instances of the specified editor on
- * the then-selected file resources.
- *
- * @param page the workbench page in which to open the editor
- * @param descriptor the editor descriptor, or <code>null</code> if unspecified
- */
-public OpenFileAction(IWorkbenchPage page, IEditorDescriptor descriptor) {
- super(page);
- setText(descriptor == null ? WorkbenchMessages.getString("OpenFileAction.text") : descriptor.getLabel()); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.OPEN_FILE_ACTION);
- setToolTipText(WorkbenchMessages.getString("OpenFileAction.toolTip")); //$NON-NLS-1$
- setId(ID);
- this.editorDescriptor = descriptor;
-}
-/**
- * Ensures that the contents of the given file resource are local.
- *
- * @param file the file resource
- * @return <code>true</code> if the file is local, and <code>false</code> if
- * it could not be made local for some reason
- */
-boolean ensureFileLocal(final IFile file) {
- //Currently fails due to Core PR. Don't do it for now
- //1G5I6PV: ITPCORE:WINNT - IResource.setLocal() attempts to modify immutable tree
- //file.setLocal(true, IResource.DEPTH_ZERO);
- return true;
-}
-/**
- * Opens an editor on the given file resource.
- *
- * @param file the file resource
- */
-void openFile(IFile file) {
- if (getWorkbenchPage() == null) {
- IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 1, WorkbenchMessages.getString("OpenFileAction.openFileError"), null); //$NON-NLS-1$
- WorkbenchPlugin.log(WorkbenchMessages.getString("OpenFileAction.openFileErrorTitle"), status); //$NON-NLS-1$
- return;
- }
- try {
- boolean activate = OpenStrategy.activateOnOpen();
- if (editorDescriptor == null)
- getWorkbenchPage().openEditor(file,null,activate);
- else {
- if (ensureFileLocal(file))
- getWorkbenchPage().openEditor(file, editorDescriptor.getId(),activate);
- }
- } catch (PartInitException e) {
- DialogUtil.openError(
- getWorkbenchPage().getWorkbenchWindow().getShell(),
- WorkbenchMessages.getString("OpenFileAction.openFileShellTitle"), //$NON-NLS-1$
- e.getMessage(),
- e);
- }
-}
-
-}
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
deleted file mode 100644
index 7b936b9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenInNewWindowAction.java
+++ /dev/null
@@ -1,88 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * 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 the workspace root.
- */
-public class OpenInNewWindowAction extends Action {
- private IWorkbenchWindow workbenchWindow;
- private IAdaptable pageInput;
-
- /**
- * Creates a new <code>OpenInNewWindowAction</code>. Sets
- * the new window page's input to be the workspace root
- * by default.
- *
- * @param window the workbench window containing this action
- */
- public OpenInNewWindowAction(IWorkbenchWindow window) {
- this(window, WorkbenchPlugin.getPluginWorkspace().getRoot());
- }
-
- /**
- * 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.getString("OpenInNewWindowAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("OpenInNewWindowAction.toolTip")); //$NON-NLS-1$
- workbenchWindow = window;
- pageInput = input;
- WorkbenchHelp.setHelp(this,IHelpContextIds.OPEN_NEW_WINDOW_ACTION);
- }
-
- /**
- * Set the input to use for the new window's page.
- */
- 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.
- */
- public void run() {
- try {
- String perspId;
-
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if (page != null && page.getPerspective() != null)
- perspId = page.getPerspective().getId();
- else
- perspId = workbenchWindow.getWorkbench().getPerspectiveRegistry().getDefaultPerspective();
-
- workbenchWindow.getWorkbench().openWorkbenchWindow(perspId, pageInput);
- } catch (WorkbenchException e) {
- ErrorDialog.openError(
- workbenchWindow.getShell(),
- WorkbenchMessages.getString("OpenInNewWindowAction.errorTitle"), //$NON-NLS-1$,
- e.getMessage(),
- e.getStatus());
- }
- }
-}
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
deleted file mode 100644
index 2e18af2..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewPageMenu.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import java.lang.reflect.*;
-import java.util.*;
-
-/**
- * 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>
- * The visible perspectives within the menu may also be updated dynamically to
- * reflect user preference.
- * </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>
- * 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.
- */
-public class OpenNewPageMenu extends PerspectiveMenu {
- 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>.
- *
- * @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;
-}
-/* (non-Javadoc)
- * Opens a new page with a particular perspective and input.
- */
-protected void run(IPerspectiveDescriptor desc) {
- // Verify page input.
- if (pageInput == null) {
- MessageDialog.openError(getWindow().getShell(), WorkbenchMessages.getString("OpenNewPageMenu.dialogTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("OpenNewPageMenu.unknownPageInput")); //$NON-NLS-1$
- return;
- }
-
- // Open the page.
- try {
- getWindow().openPage(desc.getId(), pageInput);
- } catch (WorkbenchException e) {
- MessageDialog.openError(getWindow().getShell(), WorkbenchMessages.getString("OpenNewPageMenu.dialogTitle"), //$NON-NLS-1$
- e.getMessage());
- }
-}
-/**
- * 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
deleted file mode 100644
index 55e971f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenNewWindowMenu.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import java.lang.reflect.*;
-import java.util.*;
-
-/**
- * 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
- * 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>
- * 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>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * @deprecated See IWorkbench.showPerspective methods.
- */
-public class OpenNewWindowMenu extends PerspectiveMenu {
- 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>.
- *
- * @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;
-}
-/* (non-Javadoc)
- * Opens a new window with a particular perspective and input.
- */
-protected void run(IPerspectiveDescriptor desc) {
- // Verify page input.
- if (pageInput == null) {
- MessageDialog.openError(getWindow().getShell(), WorkbenchMessages.getString("OpenNewWindowMenu.dialogTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("OpenNewWindowMenu.unknownInput")); //$NON-NLS-1$
- return;
- }
-
- // Open the page.
- try {
- getWindow().getWorkbench().openWorkbenchWindow(desc.getId(), pageInput);
- } catch (WorkbenchException e) {
- MessageDialog.openError(getWindow().getShell(), WorkbenchMessages.getString("OpenNewWindowMenu.dialogTitle"), //$NON-NLS-1$
- e.getMessage());
- }
-}
-/**
- * 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/OpenPerspectiveMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenPerspectiveMenu.java
deleted file mode 100644
index be0d720..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenPerspectiveMenu.java
+++ /dev/null
@@ -1,159 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-
-/**
- * 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>
- * The visible perspectives within the menu may also be updated dynamically to
- * reflect user preference.
- * </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>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * @deprecated See IWorkbench.showPerspective methods.
- */
-public class OpenPerspectiveMenu extends PerspectiveMenu {
- private IAdaptable pageInput;
- private IMenuManager parentMenuManager;
- private boolean replaceEnabled = true;
- private IWorkbenchWindow window;
- private IPerspectiveRegistry reg;
-
- private static String PAGE_PROBLEMS_TITLE = WorkbenchMessages.getString("OpenPerspectiveMenu.pageProblemsTitle"); //$NON-NLS-1$
- private static String PAGE_PROBLEMS_MESSAGE = WorkbenchMessages.getString("OpenPerspectiveMenu.errorUnknownInput"); //$NON-NLS-1$
-/**
- * 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 perspective
- * is replace and the replaceEnabled flag is false.
- * @return String
- */
-private boolean canRun() {
- if (openPerspectiveSetting()
- .equals(IWorkbenchPreferenceConstants.OPEN_NEW_PERSPECTIVE))
- return replaceEnabled;
- return true;
-}
-/**
- * Return the current perspective setting.
- * @return String
- */
-private String openPerspectiveSetting() {
- return WorkbenchPlugin.getDefault().getPreferenceStore().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
- */
-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
- */
-protected void run(IPerspectiveDescriptor desc, SelectionEvent event) {
- openPage(desc, event.stateMask);
-}
-/* (non-Javadoc)
- * Opens a new page with a particular perspective and input.
- */
-private void openPage(IPerspectiveDescriptor desc, int keyStateMask) {
- // Verify page input.
- if (pageInput == null) {
- MessageDialog.openError(
- getWindow().getShell(),
- PAGE_PROBLEMS_TITLE,
- PAGE_PROBLEMS_MESSAGE);
- return;
- }
-
- // Open the page.
- try {
- getWindow().getWorkbench().showPerspective(desc.getId(), getWindow(), pageInput);
- } catch (WorkbenchException e) {
- MessageDialog.openError(
- getWindow().getShell(),
- PAGE_PROBLEMS_TITLE,
- e.getMessage());
- }
-}
-/**
- * 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/OpenResourceAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenResourceAction.java
deleted file mode 100644
index fa0602f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenResourceAction.java
+++ /dev/null
@@ -1,126 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Standard action for opening the currently selected project(s).
- * <p>
- * Note that there is a different action for opening an editor on file resources:
- * <code>OpenFileAction</code>.
- * </p>
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class OpenResourceAction extends WorkspaceAction implements IResourceChangeListener {
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".OpenResourceAction"; //$NON-NLS-1$
- /**
- * Creates a new action.
- *
- * @param shell the shell for any dialogs
- */
- public OpenResourceAction(Shell shell) {
- super(shell, WorkbenchMessages.getString("OpenResourceAction.text")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.OPEN_RESOURCE_ACTION);
- setToolTipText(WorkbenchMessages.getString("OpenResourceAction.toolTip")); //$NON-NLS-1$
- setId(ID);
- }
- /* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
- String getOperationMessage() {
- return ""; //$NON-NLS-1$
- }
- /* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
- String getProblemsMessage() {
- return WorkbenchMessages.getString("OpenResourceAction.problemMessage"); //$NON-NLS-1$
- }
- /* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
- String getProblemsTitle() {
- return WorkbenchMessages.getString("OpenResourceAction.dialogTitle"); //$NON-NLS-1$
- }
- /* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
- void invokeOperation(IResource resource, IProgressMonitor monitor) throws CoreException {
- ((IProject) resource).open(monitor);
- }
- /* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
- boolean shouldPerformResourcePruning() {
- return false;
- }
- /**
- * The <code>OpenResourceAction</code> implementation of this
- * <code>SelectionListenerAction</code> method ensures that this action is
- * enabled only if one of the selections is a closed project.
- */
- protected boolean updateSelection(IStructuredSelection s) {
- // don't call super since we want to enable if closed project is selected.
-
- if (!selectionIsOfType(IResource.PROJECT))
- return false;
-
- Iterator resources = getSelectedResources().iterator();
- while (resources.hasNext()) {
- IProject currentResource = (IProject) resources.next();
- if (!currentResource.isOpen()) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Handles a resource changed event by updating the enablement
- * if one of the selected projects is opened or closed.
- */
- public void resourceChanged(IResourceChangeEvent event) {
- // Warning: code duplicated in CloseResourceAction
- List sel = getSelectedResources();
- // don't bother looking at delta if selection not applicable
- if (selectionIsOfType(IResource.PROJECT)) {
- IResourceDelta delta = event.getDelta();
- if (delta != null) {
- IResourceDelta[] projDeltas = delta.getAffectedChildren(IResourceDelta.CHANGED);
- for (int i = 0; i < projDeltas.length; ++i) {
- IResourceDelta projDelta = projDeltas[i];
- if ((projDelta.getFlags() & IResourceDelta.OPEN) != 0) {
- if (sel.contains(projDelta.getResource())) {
- selectionChanged(getStructuredSelection());
- return;
- }
- }
- }
- }
- }
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenSystemEditorAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenSystemEditorAction.java
deleted file mode 100644
index 32ce7e0..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenSystemEditorAction.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.internal.dialogs.DialogUtil;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import java.util.Iterator;
-
-/**
- * Standard action for opening a system editor on the currently selected file
- * resource.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class OpenSystemEditorAction extends SelectionListenerAction {
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".OpenSystemEditorAction";//$NON-NLS-1$
-
- /**
- * The workbench page to open the editor in.
- */
- private IWorkbenchPage workbenchPage;
-/**
- * Creates a new action that will open system editors on the then-selected file
- * resources.
- *
- * @param page the workbench page in which to open the editor
- */
-public OpenSystemEditorAction(IWorkbenchPage page) {
- super(WorkbenchMessages.getString("OpenSystemEditorAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("OpenSystemEditorAction.toolTip")); //$NON-NLS-1$
- setId(ID);
- WorkbenchHelp.setHelp(this, IHelpContextIds.OPEN_SYSTEM_EDITOR_ACTION);
- Assert.isNotNull(page);
- this.workbenchPage = page;
-}
-/**
- * Return the workbench page to open the editor in.
- *
- * @return the workbench page to open the editor in
- */
-IWorkbenchPage getWorkbenchPage() {
- return workbenchPage;
-}
-/**
- * Opens a system editor on the given file resource.
- *
- * @param file the file resource
- */
-void openFile(IFile file) {
- if (getWorkbenchPage() == null) {
- IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 1, WorkbenchMessages.getString("OpenSystemEditorAction.pageError"), null); //$NON-NLS-1$
- WorkbenchPlugin.log(WorkbenchMessages.getString("OpenSystemEditorAction.logTitle"), status); //$NON-NLS-1$
- return;
- }
- try {
- getWorkbenchPage().openSystemEditor(file);
- } catch (PartInitException e) {
- DialogUtil.openError(
- getWorkbenchPage().getWorkbenchWindow().getShell(),
- WorkbenchMessages.getString("OpenSystemEditorAction.dialogTitle"), //$NON-NLS-1$
- e.getMessage(),
- e);
- }
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void run() {
- Iterator enum = getSelectedResources().iterator();
- while (enum.hasNext()) {
- IResource resource = (IResource) enum.next();
- if (resource instanceof IFile)
- openFile((IFile) resource);
- }
-}
-/**
- * The <code>OpenSystemEditorAction</code> implementation of this
- * <code>SelectionListenerAction</code> method enables the action only
- * if the selection contains just file resources.
- */
-protected boolean updateSelection(IStructuredSelection selection) {
- return super.updateSelection(selection) && selectionIsOfType(IResource.FILE);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenWithMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenWithMenu.java
deleted file mode 100644
index 709d8f1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/OpenWithMenu.java
+++ /dev/null
@@ -1,276 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.Collator;
-import java.util.Hashtable;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.dialogs.DialogUtil;
-import org.eclipse.ui.internal.registry.EditorDescriptor;
-import org.eclipse.ui.internal.registry.EditorRegistry;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.misc.Sorter;
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A menu for opening files in the workbench.
- * <p>
- * An <code>OpenWithMenu</code> is used to populate a menu with
- * "Open With" actions. One action is added for each editor which is applicable
- * to the selected file. If the user selects one of these items, the corresponding
- * editor is opened on the file.
- * </p>
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class OpenWithMenu extends ContributionItem {
- private IWorkbenchPage page;
- private IAdaptable file;
- private EditorRegistry registry = (EditorRegistry) PlatformUI.getWorkbench().getEditorRegistry();
-
- private static Hashtable imageCache = new Hashtable(11);
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".OpenWithMenu";//$NON-NLS-1$
-
-
- private Sorter sorter = new Sorter() {
- private Collator collator = Collator.getInstance();
-
- public boolean compare(Object o1, Object o2) {
- String s1 = ((IEditorDescriptor)o1).getLabel();
- String s2 = ((IEditorDescriptor)o2).getLabel();
- //Return true if elementTwo is 'greater than' elementOne
- return collator.compare(s2, s1) > 0;
- }
- };
-/**
- * Constructs a new instance of <code>OpenWithMenu</code>.
- * <p>
- * If this method is used be sure to set the selected file by invoking
- * <code>setFile</code>. The file input is required when the user
- * selects an item in the menu. At that point the menu will attempt to
- * open an editor with the file as its input.
- * </p>
- *
- * @param page the page where the editor is opened if an item within
- * the menu is selected
- */
-public OpenWithMenu(IWorkbenchPage page) {
- this(page, null);
-}
-/**
- * Constructs a new instance of <code>OpenWithMenu</code>.
- *
- * @param window the window where a new page is created if an item within
- * the menu is selected
- * @param file the selected file
- */
-public OpenWithMenu(IWorkbenchPage page, IAdaptable file) {
- super(ID);
- this.page = page;
- this.file = file;
-}
-/**
- * Returns an image to show for the corresponding editor descriptor.
- *
- * @param editorDesc the editor descriptor, or null for the system editor
- * @return the image or null
- */
-private Image getImage(IEditorDescriptor editorDesc) {
- ImageDescriptor imageDesc = getImageDescriptor(editorDesc);
- if (imageDesc == null) {
- return null;
- }
- Image image = (Image) imageCache.get(imageDesc);
- if (image == null) {
- image = imageDesc.createImage();
- imageCache.put(imageDesc, image);
- }
- return image;
-}
-
-
-/**
- * Returns the image descriptor for the given editor descriptor,
- * or null if it has no image.
- */
-private ImageDescriptor getImageDescriptor(IEditorDescriptor editorDesc) {
- ImageDescriptor imageDesc = null;
- if (editorDesc == null) {
- imageDesc = registry.getImageDescriptor(getFileResource());
- }
- else {
- imageDesc = editorDesc.getImageDescriptor();
- }
- if (imageDesc == null) {
- if (editorDesc.getId().equals(IWorkbenchConstants.SYSTEM_EDITOR_ID))
- imageDesc = registry.getSystemEditorImageDescriptor(getFileResource());
- }
- return imageDesc;
-}
-/**
- * Creates the menu item for the editor descriptor.
- *
- * @param menu the menu to add the item to
- * @param descriptor the editor descriptor, or null for the system editor
- * @param preferredEditor the descriptor of the preferred editor, or <code>null</code>
- */
-private void createMenuItem(Menu menu, final IEditorDescriptor descriptor, final IEditorDescriptor preferredEditor) {
- // XXX: Would be better to use bold here, but SWT does not support it.
- MenuItem menuItem = new MenuItem(menu, SWT.RADIO);
- boolean isPreferred = preferredEditor != null && descriptor.getId().equals(preferredEditor.getId());
- menuItem.setSelection(isPreferred);
- menuItem.setText(descriptor.getLabel());
- Image image = getImage(descriptor);
- if (image != null) {
- menuItem.setImage(image);
- }
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Selection:
- openEditor(descriptor);
- break;
- }
- }
- };
- menuItem.addListener(SWT.Selection, listener);
-}
-/* (non-Javadoc)
- * Fills the menu with perspective items.
- */
-public void fill(Menu menu, int index) {
- IFile file = getFileResource();
- if (file == null) {
- return;
- }
-
- IEditorDescriptor defaultEditor = registry.getDefaultEditor(); // should not be null
- IEditorDescriptor preferredEditor = registry.getDefaultEditor(file); // may be null
-
- Object[] editors = sorter.sort(registry.getEditors(file));
- boolean defaultFound = false;
-
- for (int i = 0; i < editors.length; i++) {
- IEditorDescriptor editor = (IEditorDescriptor) editors[i];
- createMenuItem(menu, editor, preferredEditor);
- if (defaultEditor != null && editor.getId().equals(defaultEditor.getId()))
- defaultFound = true;
- }
-
- // Only add a separator if there is something to separate
- if (editors.length > 0)
- new MenuItem(menu, SWT.SEPARATOR);
-
- // Add default editor. Check it if it is saved as the preference.
- if (!defaultFound && defaultEditor != null) {
- createMenuItem(menu, defaultEditor, preferredEditor);
- }
-
- // Add system editor.
- IEditorDescriptor descriptor = EditorDescriptor.getSystemEditorDescriptor();
- createMenuItem(menu, descriptor, preferredEditor);
- createDefaultMenuItem(menu, file);
-}
-/**
- * Converts the IAdaptable file to IFile or null.
- */
-private IFile getFileResource() {
- if (this.file instanceof IFile) {
- return (IFile) this.file;
- }
- else {
- IResource resource = (IResource) this.file.getAdapter(IResource.class);
- if (resource instanceof IFile) {
- return (IFile) resource;
- }
- }
- return null;
-}
-/* (non-Javadoc)
- * Returns whether this menu is dynamic.
- */
-public boolean isDynamic() {
- return true;
-}
-/**
- * Opens the given editor on the selected file.
- *
- * @param editor the editor descriptor, or null for the system editor
- */
-private void openEditor(IEditorDescriptor editor) {
- IFile file = getFileResource();
- try {
- if (editor == null) {
- page.openSystemEditor(file);
- } else {
- page.openEditor(file, editor.getId());
- }
- } catch (PartInitException e) {
- DialogUtil.openError(
- page.getWorkbenchWindow().getShell(),
- WorkbenchMessages.getString("OpenWithMenu.dialogTitle"), //$NON-NLS-1$
- e.getMessage(),
- e);
- }
-}
-
-/**
- * Creates the menu item for clearing the current selection.
- *
- * @param menu the menu to add the item to
- * @param file the file bing edited
- * @param registry the editor registry
- */
-private void createDefaultMenuItem(Menu menu, final IFile file) {
- MenuItem menuItem;
- if (registry.getDefaultEditor(file) == null) {
- menuItem = new MenuItem(menu, SWT.CHECK);
- menuItem.setSelection(true);
- }
- else {
- menuItem = new MenuItem(menu, SWT.PUSH);
- }
- menuItem.setText(WorkbenchMessages.getString("DefaultEditorDescription.name")); //$NON-NLS-1$
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Selection:
- registry.setDefaultEditor(file,null);
- try{
- page.openEditor(file);
- }
- catch (PartInitException e) {
- DialogUtil.openError(
- page.getWorkbenchWindow().getShell(),
- WorkbenchMessages.getString("OpenWithMenu.dialogTitle"), //$NON-NLS-1$
- e.getMessage(),
- e);
- }
- break;
- }
- }
- };
-
- menuItem.addListener(SWT.Selection, listener);
-}
-}
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
deleted file mode 100644
index 43b3a54..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PartEventAction.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.jface.action.Action;
-
-/**
- * The abstract superclass for actions that listen to part activation and
- * open/close events. This implementation tracks the active part (see
- * <code>getActivePart</code>) and provides a convenient place to monitor
- * part 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>
- * </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>
- * </ul>
- * </p>
- */
-public abstract class PartEventAction extends Action implements IPartListener {
-
- /**
- * The active part, or <code>null</code> if none.
- */
- private IWorkbenchPart activePart;
-/**
- * Creates a new action with the given text.
- *
- * @param text the string used as the text for the action,
- * or <code>null</code> if these is no text
- */
-protected PartEventAction(String text) {
- super(text);
-}
-/**
- * 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.
- */
-public void partActivated(IWorkbenchPart 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.
- */
-public void partBroughtToTop(IWorkbenchPart part) {
-}
-/**
- * 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.
- */
-public void partClosed(IWorkbenchPart part) {
- 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.
- */
-public void partDeactivated(IWorkbenchPart part) {
- 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.
- */
-public void partOpened(IWorkbenchPart part) {
-}
-}
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
deleted file mode 100644
index 31d4813..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/PerspectiveMenu.java
+++ /dev/null
@@ -1,337 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.Image;
-import java.lang.reflect.*;
-import java.text.Collator;
-import java.util.*;
-import java.util.List;
-
-/**
- * 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>
- * The visible perspective items within the menu are dynamic and reflect the
- * available set generated by each subclass. The default available set consists
- * of a limited combination of the perspective shortcut list of the current
- * perspective, and the most recently used perspective list.
- * </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 {
- private static final int MAX_PERSPECTIVE_ITEMS = 9;
- private static IPerspectiveRegistry reg;
-
- private IWorkbenchWindow window;
- private boolean showActive = false;
-
- private Comparator comparator = new Comparator() {
- private Collator collator = Collator.getInstance();
-
- public int compare(Object ob1, Object ob2) {
- IPerspectiveDescriptor d1 = (IPerspectiveDescriptor) ob1;
- IPerspectiveDescriptor d2 = (IPerspectiveDescriptor) ob2;
- return collator.compare(d1.getLabel(), d2.getLabel());
- }
- };
-
- private static Hashtable imageCache = new Hashtable(11);
-
- /**
- * 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;
- if (reg == null)
- reg = PlatformUI.getWorkbench().getPerspectiveRegistry();
- }
-
- /* (non-Javadoc)
- * Creates a menu item for a perspective.
- */
- /* package */
- void createMenuItem(
- Menu menu,
- int index,
- final IPerspectiveDescriptor desc,
- boolean bCheck) {
-
- MenuItem mi = new MenuItem(menu, bCheck ? SWT.RADIO : SWT.PUSH, index);
- mi.setText(desc.getLabel());
- Image image = getImage(desc);
- if (image != null) {
- mi.setImage(image);
- }
- mi.setSelection(bCheck);
- mi.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- run(desc, e);
- }
- });
- }
-
- /* (non-Javadoc)
- * Creates a menu item for "Other...".
- */
- /* package */
- void createOtherItem(Menu menu, int index) {
- MenuItem mi = new MenuItem(menu, SWT.PUSH, index);
- mi.setText(WorkbenchMessages.getString("PerspectiveMenu.otherItem")); //$NON-NLS-1$
- mi.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- runOther(e);
- }
- });
- }
-
- /* (non-Javadoc)
- * Fills the menu with perspective items.
- */
- public void fill(Menu menu, int index) {
-
- // Get the checked persp.
- String checkID = null;
- if (showActive) {
- IWorkbenchPage activePage = window.getActivePage();
- if ((activePage != null) && (activePage.getPerspective() != null))
- checkID = activePage.getPerspective().getId();
- }
-
- // Collect and sort perspective items.
- ArrayList persps = getPerspectiveItems();
- Collections.sort(persps, comparator);
-
- // Add perspective shortcut
- for (int i = 0; i < persps.size(); i++) {
- IPerspectiveDescriptor desc = (IPerspectiveDescriptor) persps.get(i);
- createMenuItem(menu, index++, desc, desc.getId().equals(checkID));
- }
-
- // Add others item..
- if (persps.size() > 0) {
- new MenuItem(menu, SWT.SEPARATOR, index++);
- }
- createOtherItem(menu, index);
- }
-
- /**
- * Returns an image to show for the corresponding perspective descriptor.
- *
- * @param perspDesc the perspective descriptor
- * @return the image or null
- */
- private Image getImage(IPerspectiveDescriptor perspDesc) {
- ImageDescriptor imageDesc = perspDesc.getImageDescriptor();
- if (imageDesc == null) {
- imageDesc =
- WorkbenchImages.getImageDescriptor(
- IWorkbenchGraphicConstants.IMG_CTOOL_DEF_PERSPECTIVE_HOVER);
- }
- if (imageDesc == null) {
- return null;
- }
- Image image = (Image) imageCache.get(imageDesc);
- if (image == null) {
- image = imageDesc.createImage();
- imageCache.put(imageDesc, image);
- }
- return image;
- }
-
- /* (non-Javadoc)
- * Returns the perspective shortcut items for the active perspective.
- *
- * @return a list of <code>IPerspectiveDescriptor</code> items
- */
- private ArrayList getPerspectiveShortcuts() {
- ArrayList list = new ArrayList();
-
- IWorkbenchPage page = window.getActivePage();
- if (page == null)
- return list;
-
- ArrayList ids = ((WorkbenchPage) page).getPerspectiveActionIds();
- if (ids == null)
- return list;
-
- for (int i = 0; i < ids.size(); i++) {
- String perspID = (String) ids.get(i);
- IPerspectiveDescriptor desc = reg.findPerspectiveWithId(perspID);
- if (desc != null && !list.contains(desc))
- list.add(desc);
- }
-
- return list;
- }
-
- /* (non-Javadoc)
- * Gets the most recently used (MRU) shortcut perspectives
- * (<code>IPerspectiveDescriptor</code> items)
- * <p>
- * The list is formed from the global perspective history
- * in the workbench.
- * </p>
- * @param dest destination list to contain the items
- * @param destStart index in destination list to start copying items at
- * @param count number of items to copy from history
- * @return the number of items actually copied
- */
- private int getPerspectiveMru(List dest, int destStart, int count) {
- Workbench wb = (Workbench) WorkbenchPlugin.getDefault().getWorkbench();
- return wb.getPerspectiveHistory().copyItems(dest, destStart, count);
- }
-
- /**
- * Returns the available list of perspectives to display
- * in the menu.
- * <p>
- * By default, the list contains the perspective shortcuts
- * for the current perspective, the most recently used
- * perspectives, and the default perspective.
- * </p><p>
- * Subclasses can override this method to return a different list.
- * Care should be taken to keep this list to a minimum (7 +/- 2 items
- * is a good guideline to follow).
- * </p>
- *
- * @return an <code>ArrayList<code> of perspective items <code>IPerspectiveDescriptor</code>
- */
- protected ArrayList getPerspectiveItems() {
- /* Allow the user to see all the perspectives they have
- * selected via Customize Perspective. Bugzilla bug #23445 */
- ArrayList shortcuts = getPerspectiveShortcuts();
- int emptySlots = shortcuts.size();
- if (emptySlots < MAX_PERSPECTIVE_ITEMS)
- emptySlots = MAX_PERSPECTIVE_ITEMS;
- ArrayList list = new ArrayList(emptySlots);
-
- // Add default perspective.
- String id = reg.getDefaultPerspective();
- IPerspectiveDescriptor desc = reg.findPerspectiveWithId(id);
- if (desc != null) {
- list.add(desc);
- emptySlots--;
- }
-
- // Add perspective shortcuts from the active perspective
- int size = shortcuts.size();
- for (int i = 0; i < size && emptySlots > 0; i++) {
- if (!list.contains(shortcuts.get(i))) {
- list.add(shortcuts.get(i));
- emptySlots--;
- }
- }
-
- // Add perspectives from MRU list
- if (emptySlots > 0) {
- ArrayList mru = new ArrayList(MAX_PERSPECTIVE_ITEMS);
- int count = getPerspectiveMru(mru, 0, MAX_PERSPECTIVE_ITEMS);
- for (int i = 0; i < count && emptySlots > 0; i++) {
- if (!list.contains(mru.get(i))) {
- list.add(mru.get(i));
- emptySlots--;
- }
- }
- }
-
-
- 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.
- *
- * @returns the window
- */
- protected IWorkbenchWindow getWindow() {
- return window;
- }
-
- /* (non-Javadoc)
- * Returns whether this menu is dynamic.
- */
- 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.
- *
- * @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);
- }
-
- /* (non-Javadoc)
- * Show the "other" dialog, select a perspective, and run it. Pass on the selection
- * event should the meny need it.
- */
- void runOther(SelectionEvent event) {
- SelectPerspectiveDialog dlg =
- new SelectPerspectiveDialog(window.getShell(), reg);
- dlg.open();
- if (dlg.getReturnCode() == Window.CANCEL)
- return;
- IPerspectiveDescriptor desc = dlg.getSelection();
- if (desc != null) {
- run(desc, event);
- }
- }
-
- /**
- * Sets the showActive flag. If <code>showActive == true</code> then the
- * active perspective is hilighted with a check mark.
- *
- * @param the new showActive flag
- */
- protected void showActive(boolean b) {
- showActive = b;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ReadOnlyStateChecker.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ReadOnlyStateChecker.java
deleted file mode 100644
index 13ea237..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ReadOnlyStateChecker.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.actions.*;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.jface.dialogs.*;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.text.MessageFormat;
-
-/**
- * The ReadOnlyStateChecker is a helper class that takes a set of resource
- * some of which may be read only and queries the user as to whether or
- * not they wish to continue the operation on it.
- */
-public class ReadOnlyStateChecker {
- private Shell shell;
- private String titleMessage;
- private String mainMessage;
- private boolean yesToAllSelected = false;
- private boolean cancelSelected = false;
-
- private String READ_ONLY_EXCEPTION_MESSAGE = WorkbenchMessages.getString("ReadOnlyCheck.problems"); //$NON-NLS-1$
-
-/**
- * Create a new checker that parents the dialog off of parent using the supplied
- * title and message.
- * @param parent the shell used for dialogs
- * @param title the title for dialogs
- * @param message the message for a dialog - this will be prefaced with the name of the resource.
- */
-public ReadOnlyStateChecker(Shell parent, String title, String message) {
- this.shell = parent;
- this.titleMessage = title;
- this.mainMessage = message;
-}
-/**
- * Check an individual resource to see if it passed the read only query. If it is a file
- * just add it, otherwise it is a container and the children need to be checked too.
- * Return true if all items are selected and false if any are skipped.
- */
-private boolean checkAcceptedResource(
- IResource resourceToCheck,
- List selectedChildren)
- throws CoreException {
-
- if (resourceToCheck.getType() == IResource.FILE)
- selectedChildren.add(resourceToCheck);
- else {
- //Now check below
- int childCheck =
- checkReadOnlyResources(
- ((IContainer) resourceToCheck).members(),
- selectedChildren);
- //Add in the resource only if nothing was left out
- if (childCheck == IDialogConstants.YES_TO_ALL_ID)
- selectedChildren.add(resourceToCheck);
- else //Something was left out - return false
- return false;
- }
- return true;
-
-}
-/**
- * Check the supplied resources to see if they are read only. If so then prompt
- * the user to see if they can be deleted.Return those that were accepted.
- * @return the resulting selected resources
- */
-/*package*/
-public IResource[] checkReadOnlyResources(IResource[] itemsToCheck) {
-
- List selections = new ArrayList();
- int result = IDialogConstants.CANCEL_ID;
- try {
- result = checkReadOnlyResources(itemsToCheck, selections);
- } catch (final CoreException exception) {
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- ErrorDialog.openError(
- shell,
- READ_ONLY_EXCEPTION_MESSAGE,
- null,
- exception.getStatus());
- }
- });
- }
-
- if (result == IDialogConstants.CANCEL_ID)
- return new IResource[0];
-
- //All were selected so return the original items
- if (result == IDialogConstants.YES_TO_ALL_ID)
- return itemsToCheck;
-
-
- IResource[] returnValue = new IResource[selections.size()];
- selections.toArray(returnValue);
- return returnValue;
-}
-/**
- * Check the children of the container to see if they are read only.
- * @return int
- * one of
- * YES_TO_ALL_ID - all elements were selected
- * NO_ID - No was hit at some point
- * CANCEL_ID - cancel was hit
- * @param itemsToCheck IResource[]
- * @param allSelected the List of currently selected resources to add to.
- */
-private int checkReadOnlyResources(IResource[] itemsToCheck, List allSelected)
- throws CoreException {
-
- //Shortcut. If the user has already selected yes to all then just return it
- if (yesToAllSelected)
- return IDialogConstants.YES_TO_ALL_ID;
-
- boolean noneSkipped = true;
- List selectedChildren = new ArrayList();
-
- for (int i = 0; i < itemsToCheck.length; i++) {
- IResource resourceToCheck = itemsToCheck[i];
- if (!yesToAllSelected && resourceToCheck.isReadOnly()) {
- int action = queryYesToAllNoCancel(resourceToCheck);
- if (action == IDialogConstants.YES_ID) {
- boolean childResult = checkAcceptedResource(resourceToCheck, selectedChildren);
- if (!childResult)
- noneSkipped = false;
- }
- if (action == IDialogConstants.NO_ID)
- noneSkipped = false;
- if (action == IDialogConstants.CANCEL_ID) {
- cancelSelected = true;
- return IDialogConstants.CANCEL_ID;
- }
- if (action == IDialogConstants.YES_TO_ALL_ID) {
- yesToAllSelected = true;
- selectedChildren.add(resourceToCheck);
- }
- } else {
- boolean childResult = checkAcceptedResource(resourceToCheck, selectedChildren);
- if (cancelSelected)
- return IDialogConstants.CANCEL_ID;
- if (!childResult)
- noneSkipped = false;
- }
-
- }
-
- if (noneSkipped)
- return IDialogConstants.YES_TO_ALL_ID;
- else {
- allSelected.addAll(selectedChildren);
- return IDialogConstants.NO_ID;
- }
-
-}
-/**
- * Open a message dialog with Yes No, Yes To All and Cancel buttons. Return the
- * code that indicates the selection.
- * @return int
- * one of
- * YES_TO_ALL_ID
- * YES_ID
- * NO_ID
- * CANCEL_ID
- *
- * @param resource - the resource being queried.
- */
-private int queryYesToAllNoCancel(IResource resource) {
-
- final MessageDialog dialog =
- new MessageDialog(
- this.shell,
- this.titleMessage,
- null,
- MessageFormat.format(this.mainMessage, new Object[] {resource.getName()}),
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL },
- 0);
- shell.getDisplay().syncExec(new Runnable() {
- public void run() {
- dialog.open();
- }
- });
- int result = dialog.getReturnCode();
- if (result == 0)
- return IDialogConstants.YES_ID;
- if (result == 1)
- return IDialogConstants.YES_TO_ALL_ID;
- if (result == 2)
- return IDialogConstants.NO_ID;
- return IDialogConstants.CANCEL_ID;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RefreshAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RefreshAction.java
deleted file mode 100644
index ea99861..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RefreshAction.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.File;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Standard action for refreshing the workspace from the local file system for
- * the selected resources and all of their descendents.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class RefreshAction extends WorkspaceAction {
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".RefreshAction";//$NON-NLS-1$
-/**
- * Creates a new action.
- *
- * @param shell the shell for any dialogs
- */
-public RefreshAction(Shell shell) {
- super(shell, WorkbenchMessages.getString("RefreshAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("RefreshAction.toolTip")); //$NON-NLS-1$
- setId(ID);
- WorkbenchHelp.setHelp(this, IHelpContextIds.REFRESH_ACTION);
-}
-/**
- * Checks whether the given project's location has been deleted.
- * If so, prompts the user with whether to delete the project or not.
- */
-void checkLocationDeleted(IProject project) throws CoreException {
- if (!project.exists())
- return;
- File location = project.getLocation().toFile();
- if (!location.exists()) {
- String message = WorkbenchMessages.format("RefreshAction.locationDeletedMessage", new Object[] {project.getName(),location.getAbsolutePath()});//$NON-NLS-1$
-
- final MessageDialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("RefreshAction.dialogTitle"), // dialog title //$NON-NLS-1$
- null, // use default window icon
- message,
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
- 0); // yes is the default
-
- // Must prompt user in UI thread (we're in the operation thread here).
- getShell().getDisplay().syncExec(new Runnable() {
- public void run() {
- dialog.open();
- }
- });
-
- // Do the deletion back in the operation thread
- if (dialog.getReturnCode() == 0) { // yes was chosen
- project.delete(true, true, null);
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-String getOperationMessage() {
- return WorkbenchMessages.getString("RefreshAction.progressMessage"); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-String getProblemsMessage() {
- return WorkbenchMessages.getString("RefreshAction.problemMessage"); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-String getProblemsTitle() {
- return WorkbenchMessages.getString("RefreshAction.problemTitle"); //$NON-NLS-1$
-}
-/**
- * Returns a list containing the workspace root if the selection would otherwise be empty.
- */
-protected List getSelectedResources() {
- List resources = super.getSelectedResources();
- if (resources.isEmpty()) {
- resources = new ArrayList();
- resources.add(ResourcesPlugin.getWorkspace().getRoot());
- }
- return resources;
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-void invokeOperation(IResource resource, IProgressMonitor monitor) throws CoreException {
- resource.refreshLocal(IResource.DEPTH_INFINITE,monitor);
- // Check if project's location has been deleted,
- // as per 1G83UCE: ITPUI:WINNT - Refresh from local doesn't detect new or deleted projects
- if (resource.getType() == IResource.PROJECT) {
- checkLocationDeleted((IProject) resource);
- }
-}
-/**
- * The <code>RefreshAction</code> implementation of this
- * <code>SelectionListenerAction</code> method ensures that this action is
- * enabled if the selection is empty, but is disabled if any of the selected
- * elements are not resources.
- */
-protected boolean updateSelection(IStructuredSelection s) {
- return (super.updateSelection(s) || s.isEmpty()) && getSelectedNonResources().size() == 0;
-}
-
-/**
- * Handle the key release.
- */
-public void handleKeyReleased(KeyEvent event) {
-
- if (event.keyCode == SWT.F5 && event.stateMask == 0) {
- refreshAll();
- }
-}
-
-/**
- * Refreshes the entire workspace.
- */
-public void refreshAll() {
- IStructuredSelection currentSelection = getStructuredSelection();
- selectionChanged(StructuredSelection.EMPTY);
- run();
- selectionChanged(currentSelection);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RenameResourceAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RenameResourceAction.java
deleted file mode 100644
index d03ec9e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RenameResourceAction.java
+++ /dev/null
@@ -1,460 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TreeEditor;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-
-
-/**
- * Standard action for renaming the selected resources.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class RenameResourceAction extends WorkspaceAction {
-
- /*The tree editing widgets. If treeEditor is null then edit using the
- dialog. We keep the editorText around so that we can close it if
- a new selection is made. */
- private TreeEditor treeEditor;
- private Tree navigatorTree;
- private Text textEditor;
- private Composite textEditorParent;
- private TextActionHandler textActionHandler;
-
- //The resource being edited if this is being done inline
- private IResource inlinedResource;
-
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".RenameResourceAction";//$NON-NLS-1$
-
- /**
- * The new path.
- */
- private IPath newPath;
-
- private static final String CHECK_RENAME_TITLE = WorkbenchMessages.getString("RenameResourceAction.checkTitle"); //$NON-NLS-1$
-
- private static final String CHECK_RENAME_MESSAGE =
- WorkbenchMessages.getString("RenameResourceAction.readOnlyCheck"); //$NON-NLS-1$
- private static String RESOURCE_EXISTS_TITLE = WorkbenchMessages.getString("RenameResourceAction.resourceExists"); //$NON-NLS-1$
- private static String RESOURCE_EXISTS_MESSAGE = WorkbenchMessages.getString("RenameResourceAction.overwriteQuestion"); //$NON-NLS-1$
- private static String RENAMING_MESSAGE = WorkbenchMessages.getString("RenameResourceAction.progressMessage"); //$NON-NLS-1$
-
-/**
- * Creates a new action. Using this constructor directly will rename using a
- * dialog rather than the inline editor of a ResourceNavigator.
- *
- * @param shell the shell for any dialogs
- */
-public RenameResourceAction(Shell shell) {
- super(shell, WorkbenchMessages.getString("RenameResourceAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("RenameResourceAction.toolTip")); //$NON-NLS-1$
- setId(ID);
- WorkbenchHelp.setHelp(this, IHelpContextIds.RENAME_RESOURCE_ACTION);
-}
-/**
- * Creates a new action.
- *
- * @param shell the shell for any dialogs
- */
-public RenameResourceAction(Shell shell, Tree tree) {
- this(shell);
- this.navigatorTree = tree;
- this.treeEditor = new TreeEditor(tree);
-}
-/**
- * Check if the user wishes to overwrite the supplied resource
- * @returns true if there is no collision or delete was successful
- * @param shell the shell to create the dialog in
- * @param destination - the resource to be overwritten
- */
-private boolean checkOverwrite(
- final Shell shell,
- final IResource destination) {
-
- final boolean[] result = new boolean[1];
-
- //Run it inside of a runnable to make sure we get to parent off of the shell as we are not
- //in the UI thread.
-
- Runnable query = new Runnable() {
- public void run() {
- String pathName = destination.getFullPath().makeRelative().toString();
- result[0] =
- MessageDialog.openQuestion(
- shell,
- RESOURCE_EXISTS_TITLE,
- MessageFormat.format(RESOURCE_EXISTS_MESSAGE, new Object[] {pathName}));
- }
-
- };
-
- shell.getDisplay().syncExec(query);
- return result[0];
-}
-/**
- * Check if the supplied resource is read only or null. If it is then ask the user if they want
- * to continue. Return true if the resource is not read only or if the user has given
- * permission.
- * @return boolean
- */
-private boolean checkReadOnlyAndNull(IResource currentResource) {
- //Do a quick read only and null check
- if (currentResource == null)
- return false;
-
- //Do a quick read only check
- if (currentResource.isReadOnly())
- return MessageDialog.openQuestion(
- getShell(),
- CHECK_RENAME_TITLE,
- MessageFormat.format(CHECK_RENAME_MESSAGE, new Object[] {currentResource.getName()}));
- else
- return true;
-}
-Composite createParent() {
- Tree tree = getTree();
- Composite result = new Composite (tree, SWT.NONE);
- TreeItem[] selectedItems = tree.getSelection();
- treeEditor.horizontalAlignment = SWT.LEFT;
- treeEditor.grabHorizontal = true;
- treeEditor.setEditor(result, selectedItems[0]);
- return result;
-}
-/**
- * Create the text editor widget.
- *
- * @param resource the resource to rename
- */
-private void createTextEditor(final IResource resource) {
- // Create text editor parent. This draws a nice bounding rect.
- textEditorParent = createParent();
- textEditorParent.setVisible(false);
- textEditorParent.addListener(SWT.Paint, new Listener() {
- public void handleEvent (Event e) {
- Point textSize = textEditor.getSize();
- Point parentSize = textEditorParent.getSize();
- e.gc.drawRectangle(0, 0, Math.min(textSize.x + 4, parentSize.x - 1), parentSize.y - 1);
- }
- });
-
- // Create inner text editor.
- textEditor = new Text(textEditorParent, SWT.NONE);
- textEditorParent.setBackground(textEditor.getBackground());
- textEditor.addListener(SWT.Modify, new Listener() {
- public void handleEvent (Event e) {
- Point textSize = textEditor.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- textSize.x += textSize.y; // Add extra space for new characters.
- Point parentSize = textEditorParent.getSize();
- textEditor.setBounds(2, 1, Math.min(textSize.x, parentSize.x - 4), parentSize.y - 2);
- textEditorParent.redraw();
- }
- });
- textEditor.addListener(SWT.Traverse, new Listener() {
- public void handleEvent(Event event) {
-
- //Workaround for Bug 20214 due to extra
- //traverse events
- switch (event.detail) {
- case SWT.TRAVERSE_ESCAPE:
- //Do nothing in this case
- disposeTextWidget();
- event.doit = true;
- event.detail = SWT.TRAVERSE_NONE;
- break;
- case SWT.TRAVERSE_RETURN:
- saveChangesAndDispose(resource);
- event.doit = true;
- event.detail = SWT.TRAVERSE_NONE;
- break;
- }
- }
- });
- textEditor.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent fe) {
- saveChangesAndDispose(resource);
- }
- });
-
- if (textActionHandler != null)
- textActionHandler.addText(textEditor);
-}
-/**
- * Close the text widget and reset the editorText field.
- */
-private void disposeTextWidget() {
- if (textActionHandler != null)
- textActionHandler.removeText(textEditor);
-
- if (textEditorParent != null) {
- textEditorParent.dispose();
- textEditorParent = null;
- textEditor = null;
- treeEditor.setEditor(null,null);
- }
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-String getOperationMessage() {
- return WorkbenchMessages.getString("RenameResourceAction.progress"); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-String getProblemsMessage() {
- return WorkbenchMessages.getString("RenameResourceAction.problemMessage"); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-String getProblemsTitle() {
- return WorkbenchMessages.getString("RenameResourceAction.problemTitle"); //$NON-NLS-1$
-}
-/**
- * Get the Tree being edited.
- * @returnTree
- */
-private Tree getTree() {
- return this.navigatorTree;
-}
-/**
- * Get the boolean that indicates if this action should be enabled or disabled.
- */
-private boolean getUpdateValue(IStructuredSelection selection) {
- if (selection.size() > 1)
- return false;
- if (!super.updateSelection(selection))
- return false;
-
- List resources = getSelectedResources();
- if(resources.size() != 1)
- return false;
-
- return true;
-}
-
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-void invokeOperation(IResource resource, IProgressMonitor monitor)
- throws CoreException {
-
- monitor.beginTask(RENAMING_MESSAGE, 100);
- IWorkspaceRoot workspaceRoot = resource.getWorkspace().getRoot();
-
- IResource newResource = workspaceRoot.findMember(newPath);
- if (newResource != null) {
- if (checkOverwrite(getShell(), newResource))
- newResource.delete(IResource.KEEP_HISTORY, new SubProgressMonitor(monitor, 50));
- else {
- monitor.worked(100);
- return;
- }
- }
- if (resource.getType() == IResource.PROJECT) {
- IProject project = (IProject) resource;
- IProjectDescription description = project.getDescription();
- description.setName(newPath.segment(0));
- project.move(description, true, monitor);
- } else
- resource.move(newPath, IResource.KEEP_HISTORY, new SubProgressMonitor(monitor, 50));
-}
-/**
- * Return the new name to be given to the target resource.
- *
- * @return java.lang.String
- * @param context IVisualPart
- */
-protected String queryNewResourceName(final IResource resource) {
- final IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
- final IPath prefix = resource.getFullPath().removeLastSegments(1);
- IInputValidator validator = new IInputValidator() {
- public String isValid(String string) {
- if (resource.getName().equals(string)) {
- return WorkbenchMessages.getString("RenameResourceAction.nameMustBeDifferent"); //$NON-NLS-1$
- }
- IStatus status = workspace.validateName(string, resource.getType());
- if (!status.isOK()) {
- return status.getMessage();
- }
- if (workspace.getRoot().exists(prefix.append(string))) {
- return WorkbenchMessages.getString("RenameResourceAction.nameExists"); //$NON-NLS-1$
- }
- return null;
- }
- };
-
- InputDialog dialog = new InputDialog(
- getShell(),
- WorkbenchMessages.getString("RenameResourceAction.inputDialogTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("RenameResourceAction.inputDialogMessage"), //$NON-NLS-1$
- resource.getName(),
- validator);
- dialog.setBlockOnOpen(true);
- dialog.open();
- return dialog.getValue();
-}
-/**
- * Return the new name to be given to the target resource or <code>null<code>
- * if the query was canceled. Rename the currently selected resource using the table editor.
- * Continue the action when the user is done.
- *
- * @return java.lang.String
- * @param resource the resource to rename
- */
-private void queryNewResourceNameInline(final IResource resource) {
- // Make sure text editor is created only once. Simply reset text
- // editor when action is executed more than once. Fixes bug 22269.
- if (textEditorParent == null) {
- createTextEditor(resource);
- }
- textEditor.setText(resource.getName());
-
- // Open text editor with initial size.
- textEditorParent.setVisible(true);
- Point textSize = textEditor.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- textSize.x += textSize.y; // Add extra space for new characters.
- Point parentSize = textEditorParent.getSize();
- textEditor.setBounds(2, 1, Math.min(textSize.x, parentSize.x - 4), parentSize.y - 2);
- textEditorParent.redraw();
- textEditor.selectAll ();
- textEditor.setFocus ();
-}
-/* (non-Javadoc)
- * Method declared on IAction; overrides method on WorkspaceAction.
- */
-public void run() {
-
- if (this.navigatorTree == null) {
- IResource currentResource =
- (IResource) getStructuredSelection().getFirstElement();
- //Do a quick read only and null check
- if (!checkReadOnlyAndNull(currentResource))
- return;
- String newName = queryNewResourceName(currentResource);
- if (newName == null || newName.equals(""))//$NON-NLS-1$
- return;
- newPath = currentResource.getFullPath().removeLastSegments(1).append(newName);
- super.run();
- } else
- runWithInlineEditor();
-}
-/*
- * Run the receiver using an inline editor from the supplied navigator. The
- * navigator will tell the action when the path is ready to run.
- */
-private void runWithInlineEditor() {
- IResource currentResource =
- (IResource) getStructuredSelection().getFirstElement();
- if (!checkReadOnlyAndNull(currentResource))
- return;
-
- queryNewResourceNameInline(currentResource);
-
-}
-/* (non-Javadoc)
- * Run the action to completion using the supplied path.
- */
-protected void runWithNewPath(IPath path, IResource resource) {
- this.newPath = path;
- super.run();
-}
-/**
- * Save the changes and dispose of the text widget.
- * @param resource - the resource to move.
- */
-private void saveChangesAndDispose(IResource resource) {
- // Cache the resource to avoid selection loss since a selection of
- // another item can trigger this method
- inlinedResource = resource;
- final String newName = textEditor.getText();
- // Run this in an async to make sure that the operation that triggered
- // this action is completed. Otherwise this leads to problems when the
- // icon of the item being renamed is clicked (i.e., which causes the rename
- // text widget to lose focus and trigger this method).
- Runnable query = new Runnable() {
- public void run() {
- //Dispose the text widget regardless
- disposeTextWidget();
- if (!newName.equals(inlinedResource.getName())) {
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
- IStatus status = workspace.validateName(newName, inlinedResource.getType());
- if (!status.isOK()) {
- displayError(status.getMessage());
- }
- else {
- IPath newPath = inlinedResource.getFullPath().removeLastSegments(1).append(newName);
- runWithNewPath(newPath, inlinedResource);
- }
- }
- inlinedResource = null;
- }
- };
- getTree().getShell().getDisplay().asyncExec(query);
-}
-/**
- * The <code>RenameResourceAction</code> implementation of this
- * <code>SelectionListenerAction</code> method ensures that this action is
- * disabled if any of the selections are not resources or resources that are
- * not local.
- */
-protected boolean updateSelection(IStructuredSelection selection) {
- disposeTextWidget();
-
- if (selection.size() > 1)
- return false;
- if (!super.updateSelection(selection))
- return false;
-
- List resources = getSelectedResources();
- if (resources.size() != 1)
- return false;
-
- return true;
-}
-public void setTextActionHandler(TextActionHandler actionHandler){
- textActionHandler = actionHandler;
-}
-
-/**
- * Returns the elements that the action is to be performed on.
- * Return the resource cached by the action as we cannot rely
- * on the selection being correct for inlined text.
- *
- * @return list of resource elements (element type: <code>IResource</code>)
- */
- protected List getActionResources() {
- if(inlinedResource == null)
- return super.getActionResources();
-
- List actionResources = new ArrayList();
- actionResources.add(inlinedResource);
- return actionResources;
-}
-
-}
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
deleted file mode 100644
index cddb969..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/RetargetAction.java
+++ /dev/null
@@ -1,216 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.PartSite;
-import org.eclipse.ui.internal.SubActionBars;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.Event;
-
-/**
- * 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 state of the RetargetAction is determined
- * from the enable state of the handler. If the active part does not
- * provide an action handler then this action is disabled.
- * </p>
- * <p>
- * Note: instances of this class add themselves as listeners to their
- * action handler. It is important for the creator of a retarget action to call
- * dispose when the action is no longer needed. This will ensure that the
- * listener is removed.
- * </p>
- * <p>
- * This class may be instantiated. It is not intented to be subclassed.
- * </p>
- *
- * @since 2.0
- */
-public class RetargetAction extends PartEventAction {
- /**
- * The help listener assigned to this action, or <code>null</code> if none.
- */
- private HelpListener localHelpListener;
-
- private boolean enableAccelerator = true;
- private IAction handler;
- private IPropertyChangeListener propertyChangeListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- RetargetAction.this.propogateChange(event);
- }
- };
-/**
- * Constructs a RetargetAction.
- */
-public RetargetAction(String actionID, String label) {
- super(label);
- setId(actionID);
- setEnabled(false);
- super.setHelpListener(new HelpListener() {
- public void helpRequested(HelpEvent 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;
- }
- if (listener != null)
- // pass on the event
- listener.helpRequested(e);
- }
- });
-}
-/**
- * Disposes of the action and any resources held.
- *
- * @since 2.0
- */
-public void dispose() {
- if (handler != null) {
- handler.removePropertyChangeListener(propertyChangeListener);
- handler = null;
- }
-}
-
-/**
- * Enables the accelerator for this action.
- *
- * @param boolean the new enable state
- */
-public void enableAccelerator(boolean b) {
- enableAccelerator = b;
-}
-/* (non-Javadoc)
- * Retaget actions do not have accelerators. It is up to the
- * part to hook the accelerator.
- */
-public int getAccelerator() {
- if (enableAccelerator)
- return super.getAccelerator();
- else
- return 0;
-}
-/**
- * A workbench part has been activated. Try to connect
- * to it.
- *
- * @param part the workbench part that has been activated
- */
-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()));
-}
-/**
- * A workbench part has been closed.
- *
- * @param part the workbench part that has been closed
- */
-public void partClosed(IWorkbenchPart part) {
- 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;
- if (part == getActivePart())
- setActionHandler(null);
- super.partClosed(part);
-}
-/**
- * A workbench part has been deactivated. Disconnect from it.
- *
- * @param part the workbench part that has been deactivated
- */
-public void partDeactivated(IWorkbenchPart part) {
- 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)
- // 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;
-
- setActionHandler(null);
-}
-/**
- * Either the action handler itself has changed, or the configured action handlers on the action bars have changed.
- * Update self.
- */
-protected void propogateChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(Action.ENABLED)) {
- Boolean bool = (Boolean) event.getNewValue();
- setEnabled(bool.booleanValue());
- }
- else if (event.getProperty().equals(SubActionBars.P_ACTION_HANDLERS)) {
- setActionHandler(((IActionBars) event.getSource()).getGlobalActionHandler(getId()));
- }
-}
-
-/**
- * Invoked when an action occurs.
- */
-public void run() {
- if (handler != null)
- handler.run();
-}
-
-/**
- * Invoked when an action occurs.
- */
-public void runWithEvent(Event event) {
- if (handler != null)
- handler.runWithEvent(event);
-}
-
-/**
- * Returns the action handler.
- */
-protected IAction getActionHandler() {
- return 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;
- }
-
- // Set new action.
- handler = newHandler;
- if (handler == null) {
- setEnabled(false);
- } else {
- setEnabled(handler.isEnabled());
- handler.addPropertyChangeListener(propertyChangeListener);
- }
-}
-/**
- * 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.
- */
-public void setHelpListener(HelpListener listener) {
- localHelpListener = listener;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ScrubLocalAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ScrubLocalAction.java
deleted file mode 100644
index 503a37d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/ScrubLocalAction.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Standard action for scrubbing the local content in the local file system of
- * the selected resources and all of their descendents.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class ScrubLocalAction extends WorkspaceAction {
-
- /**
- * The id of this action.
- */
- public static final String ID = "org.eclipse.ui.ScrubLocalAction";//$NON-NLS-1$
-/**
- * Creates a new action.
- *
- * @param shell the shell for any dialogs
- */
-public ScrubLocalAction(Shell shell) {
- super(shell, WorkbenchMessages.getString("ScrubLocalAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("ScrubLocalAction.toolTip")); //$NON-NLS-1$
- setId(ID);
- WorkbenchHelp.setHelp(this, IHelpContextIds.SCRUB_LOCAL_ACTION);
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-String getOperationMessage() {
- return WorkbenchMessages.getString("ScrubLocalAction.progress"); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-String getProblemsMessage() {
- return WorkbenchMessages.getString("ScrubLocalAction.problemsMessage"); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-String getProblemsTitle() {
- return WorkbenchMessages.getString("ScrubLocalAction.problemsTitle"); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on WorkspaceAction.
- */
-void invokeOperation(IResource resource, IProgressMonitor monitor) throws CoreException {
- resource.setLocal(false, IResource.DEPTH_INFINITE,monitor);
-}
-/**
- * The <code>ScrubLocalAction</code> implementation of this
- * <code>SelectionListenerAction</code> method ensures that this action is
- * disabled if any of the selections are not resources.
- */
-protected boolean updateSelection(IStructuredSelection s) {
- return super.updateSelection(s)
- && getSelectedNonResources().size() == 0;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SelectionListenerAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SelectionListenerAction.java
deleted file mode 100644
index 61473f2..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SelectionListenerAction.java
+++ /dev/null
@@ -1,231 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.ui.*;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.viewers.*;
-import java.util.*;
-
-/**
- * The abstract superclass for actions that listen to selection change events.
- * This implementation tracks the current selection (see
- * <code>getStructuredSelection</code>) and provides a convenient place to
- * monitor selection changes 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>
- * </ul>
- * </p>
- * <p>
- * Subclasses may extend the <code>updateSelection</code> method to update
- * the action determine its availability based on the current selection.
- * </p>
- * <p>
- * The object instantiating the subclass is responsible for registering
- * the instance with a selection provider. Alternatively, the object can
- * notify the subclass instance directly of a selection change using the
- * methods:
- * <ul>
- * <li><code>selectionChanged(IStructuredSelection)</code> - passing the selection</li>
- * <li><code>selectionChanged(ISelectionChangedEvent)</code> - passing the selection change event</li>
- * </ul>
- * </p>
- */
-public abstract class SelectionListenerAction extends Action
- implements ISelectionChangedListener
-{
-
- /**
- * The current selection.
- */
- private IStructuredSelection selection = new StructuredSelection();
-
- /**
- * Indicates whether the selection has changes since <code>resources</code>
- * and <code>nonResources</code> were computed.
- */
- private boolean selectionDirty = true;
-
- /**
- * The list of resource elements in the current selection
- * (element type: <code>IResource</code>); meaningful only when
- * <code>selectionDirty == true</code>.
- */
- private List resources;
-
- /**
- * The list of non-resource elements in the current selection
- * (element type: <code>Object</code>); meaningful only when
- * <code>selectionDirty == true</code>.
- */
- private List nonResources;
-/**
- * Creates a new action with the given text.
- *
- * @param text the string used as the text for the action,
- * or <code>null</code> if these is no text
- */
-protected SelectionListenerAction(String text) {
- super(text);
- initCollections();
-}
-/*
- * Init <code>resources</code> and <code>nonResources</code>.
- */
-private void initCollections() {
- resources = new ArrayList();
- nonResources = new ArrayList();
-}
-/**
- * Extracts <code>IResource</code>s from the current selection and adds them to
- * the resources list, and puts non-resources in the non-resources list.
- */
-private final void computeResources() {
- initCollections();
- for (Iterator e = selection.iterator(); e.hasNext();) {
- Object next = e.next();
- if (next instanceof IResource) {
- resources.add(next);
- continue;
- }
- if (next instanceof IAdaptable) {
- Object resource = ((IAdaptable) next).getAdapter(IResource.class);
- if (resource != null) {
- resources.add(resource);
- continue;
- }
- }
- nonResources.add(next);
- }
-}
-/**
- * Returns the elements in the current selection that are not
- * <code>IResource</code>s.
- *
- * @return list of elements (element type: <code>Object</code>)
- */
-protected List getSelectedNonResources() {
- //recompute if selection has changed.
- if (selectionDirty) {
- computeResources();
- selectionDirty = false;
- }
- return nonResources;
-}
-/**
- * Returns the elements in the current selection that are
- * <code>IResource</code>s.
- *
- * @return list of resource elements (element type: <code>IResource</code>)
- */
-protected List getSelectedResources() {
- //recompute if selection has changed.
- if (selectionDirty) {
- computeResources();
- selectionDirty = false;
- }
- return resources;
-}
-/**
- * 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 whether the type of the given resource is among those in the given
- * resource type mask.
- *
- * @param resource the resource
- * @param resourceMask a bitwise OR of resource types:
- * <code>IResource</code>.{<code>FILE</code>, <code>FOLDER</code>,
- * <code>PROJECT</code>, <code>ROOT</code>}
- * @return <code>true</code> if the resource type matches, and <code>false</code>
- * otherwise
- * @see IResource
- */
-protected boolean resourceIsType(IResource resource, int resourceMask) {
- return (resource.getType() & resourceMask) != 0;
-}
-/**
- * Notifies this action that the given structured selection has changed.
- * <p>
- * The <code>SelectionListenerAction</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) {
- this.selection = selection;
- selectionDirty = true;
- initCollections();
- setEnabled(updateSelection(selection));
-}
-/**
- * The <code>SelectionListenerAction</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.
- */
-public final void selectionChanged(SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection)
- selectionChanged((IStructuredSelection) selection);
- else
- selectionChanged(StructuredSelection.EMPTY);
-}
-/**
- * Returns whether the current selection consists entirely of resources whose
- * types are among those in the given resource type mask.
- *
- * @param resourceMask a bitwise OR of resource types:
- * <code>IResource</code>.{<code>FILE</code>, <code>FOLDER</code>,
- * <code>PROJECT</code>, <code>ROOT</code>}
- * @return <code>true</code> if all resources in the current selection are of the
- * specified types or if the current selection is empty, and <code>false</code> if some
- * elements are resources of a different type or not resources
- * @see IResource
- */
-protected boolean selectionIsOfType(int resourceMask) {
- if (getSelectedNonResources().size() > 0)
- return false;
-
- for (Iterator e = getSelectedResources().iterator(); e.hasNext();) {
- IResource next = (IResource) e.next();
- if (!resourceIsType(next, resourceMask))
- return false;
- }
- return true;
-}
-/**
- * Updates this action in response to the given selection.
- * <p>
- * The <code>SelectionListenerAction</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;
-}
-}
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
deleted file mode 100644
index d9bb826..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SelectionProviderAction.java
+++ /dev/null
@@ -1,130 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.action.Action;
-
-/**
- * The abstract superclass for actions that listen to selection changes
- * from a particular selection provider. This implementation splits the current
- * selection along structured/unstructured lines, providing a convenient place
- * to monitor selection changes that require adjusting action state.
- * <p>
- * Subclasses must implement the following <code>IAction</code> method:
- * <ul>
- * <li><code>run</code> - to do the action's work</li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may reimplement either of the following methods:
- * <ul>
- * <li><code>selectionChanged(IStructuredSelection)</code></li>
- * <li><code>selectionChanged(ISelection)</code></li>
- * </ul>
- * </p>
- */
-public abstract class SelectionProviderAction extends Action
- implements ISelectionChangedListener
-{
-
- /**
- * 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 these 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);
-}
-
-/**
- * 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 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;
- else
- 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 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.
- */
-public final void selectionChanged(SelectionChangedEvent event) {
- 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
deleted file mode 100644
index 41114f1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/SimpleWildcardTester.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * 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)
- 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);
- }
-}
-/**
- * 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)
- return false;
- pattern = pattern.toLowerCase();
- str = str.toLowerCase();
- return testWildcard(pattern, str);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/TextActionHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/TextActionHandler.java
deleted file mode 100644
index a0dda13..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/TextActionHandler.java
+++ /dev/null
@@ -1,442 +0,0 @@
-package org.eclipse.ui.actions;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-
-/**
- * Handles the redirection of the global Cut, Copy, Paste, and
- * Select All actions to either the current inline text control
- * or the part's supplied action handler.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p><p>
- * Example usage:
- * <pre>
- * textActionHandler = new TextActionHandler(this.getViewSite().getActionBars());
- * textActionHandler.addText((Text)textCellEditor1.getControl());
- * textActionHandler.addText((Text)textCellEditor2.getControl());
- * textActionHandler.setSelectAllAction(selectAllAction);
- * </pre>
- * </p>
- */
-public class TextActionHandler {
- private DeleteActionHandler textDeleteAction = new DeleteActionHandler();
- private CutActionHandler textCutAction = new CutActionHandler();
- private CopyActionHandler textCopyAction = new CopyActionHandler();
- private PasteActionHandler textPasteAction = new PasteActionHandler();
- private SelectAllActionHandler textSelectAllAction = new SelectAllActionHandler();
-
- private IAction deleteAction;
- private IAction cutAction;
- private IAction copyAction;
- private IAction pasteAction;
- private IAction selectAllAction;
-
- private IPropertyChangeListener deleteActionListener = new PropertyChangeListener(textDeleteAction);
- private IPropertyChangeListener cutActionListener = new PropertyChangeListener(textCutAction);
- private IPropertyChangeListener copyActionListener = new PropertyChangeListener(textCopyAction);
- private IPropertyChangeListener pasteActionListener = new PropertyChangeListener(textPasteAction);
- private IPropertyChangeListener selectAllActionListener = new PropertyChangeListener(textSelectAllAction);
-
- private Listener textControlListener = new TextControlListener();
- private Text activeTextControl;
-
- private MouseAdapter mouseAdapter = new MouseAdapter() {
- public void mouseUp(MouseEvent e) {
- updateActionsEnableState();
- }
- };
- private KeyAdapter keyAdapter = new KeyAdapter() {
- public void keyReleased(KeyEvent e) {
- updateActionsEnableState();
- }
- };
-
- private class TextControlListener implements Listener {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Activate:
- activeTextControl = (Text) event.widget;
- updateActionsEnableState();
- break;
- case SWT.Deactivate:
- activeTextControl = null;
- updateActionsEnableState();
- break;
- default:
- break;
- }
- }
- }
-
- private class PropertyChangeListener implements IPropertyChangeListener {
- private IAction actionHandler;
- protected PropertyChangeListener(IAction actionHandler) {
- super();
- this.actionHandler = actionHandler;
- }
- public void propertyChange(PropertyChangeEvent event) {
- if (activeTextControl != null)
- return;
- if (event.getProperty().equals(IAction.ENABLED)) {
- Boolean bool = (Boolean) event.getNewValue();
- actionHandler.setEnabled(bool.booleanValue());
- }
- }
- };
-
- private class DeleteActionHandler extends Action {
- protected DeleteActionHandler() {
- super(WorkbenchMessages.getString("Delete")); //$NON-NLS-1$
- setId("TextDeleteActionHandler");//$NON-NLS-1$
- setEnabled(false);
- WorkbenchHelp.setHelp(this, IHelpContextIds.TEXT_DELETE_ACTION);
- }
- public void runWithEvent(Event event) {
- if (activeTextControl != null && !activeTextControl.isDisposed()) {
- activeTextControl.clearSelection();
- return;
- }
- if (deleteAction != null) {
- deleteAction.runWithEvent(event);
- return;
- }
- }
- public void updateEnabledState() {
- if (activeTextControl != null && !activeTextControl.isDisposed()) {
- setEnabled(activeTextControl.getSelectionCount() > 0 || activeTextControl.getCaretPosition() < activeTextControl.getCharCount());
- return;
- }
- if (deleteAction != null) {
- setEnabled(deleteAction.isEnabled());
- return;
- }
- setEnabled(false);
- }
- }
-
- private class CutActionHandler extends Action {
- protected CutActionHandler() {
- super(WorkbenchMessages.getString("Cut")); //$NON-NLS-1$
- setId("TextCutActionHandler");//$NON-NLS-1$
- setEnabled(false);
- WorkbenchHelp.setHelp(this, IHelpContextIds.TEXT_CUT_ACTION);
- }
- public void runWithEvent(Event event) {
- if (activeTextControl != null && !activeTextControl.isDisposed()) {
- activeTextControl.cut();
- return;
- }
- if (cutAction != null) {
- cutAction.runWithEvent(event);
- return;
- }
- }
- public void updateEnabledState() {
- if (activeTextControl != null && !activeTextControl.isDisposed()) {
- setEnabled(activeTextControl.getSelectionCount() > 0);
- return;
- }
- if (cutAction != null) {
- setEnabled(cutAction.isEnabled());
- return;
- }
- setEnabled(false);
- }
- }
-
- private class CopyActionHandler extends Action {
- protected CopyActionHandler() {
- super(WorkbenchMessages.getString("Copy")); //$NON-NLS-1$
- setId("TextCopyActionHandler");//$NON-NLS-1$
- setEnabled(false);
- WorkbenchHelp.setHelp(this, IHelpContextIds.TEXT_COPY_ACTION);
- }
- public void runWithEvent(Event event) {
- if (activeTextControl != null && !activeTextControl.isDisposed()) {
- activeTextControl.copy();
- return;
- }
- if (copyAction != null) {
- copyAction.runWithEvent(event);
- return;
- }
- }
- public void updateEnabledState() {
- if (activeTextControl != null && !activeTextControl.isDisposed()) {
- setEnabled(activeTextControl.getSelectionCount() > 0);
- return;
- }
- if (copyAction != null) {
- setEnabled(copyAction.isEnabled());
- return;
- }
- setEnabled(false);
- }
- }
-
- private class PasteActionHandler extends Action {
- protected PasteActionHandler() {
- super(WorkbenchMessages.getString("Paste")); //$NON-NLS-1$
- setId("TextPasteActionHandler");//$NON-NLS-1$
- setEnabled(false);
- WorkbenchHelp.setHelp(this, IHelpContextIds.TEXT_PASTE_ACTION);
- }
- public void runWithEvent(Event event) {
- if (activeTextControl != null && !activeTextControl.isDisposed()) {
- activeTextControl.paste();
- return;
- }
- if (pasteAction != null) {
- pasteAction.runWithEvent(event);
- return;
- }
- }
- public void updateEnabledState() {
- if (activeTextControl != null && !activeTextControl.isDisposed()) {
- setEnabled(true);
- return;
- }
- if (pasteAction != null) {
- setEnabled(pasteAction.isEnabled());
- return;
- }
- setEnabled(false);
- }
- }
-
- private class SelectAllActionHandler extends Action {
- protected SelectAllActionHandler() {
- super(WorkbenchMessages.getString("TextAction.selectAll")); //$NON-NLS-1$
- setId("TextSelectAllActionHandler");//$NON-NLS-1$
- setEnabled(false);
- WorkbenchHelp.setHelp(this, IHelpContextIds.TEXT_SELECT_ALL_ACTION);
- }
- public void runWithEvent(Event event) {
- if (activeTextControl != null && !activeTextControl.isDisposed()) {
- activeTextControl.selectAll();
- return;
- }
- if (selectAllAction != null) {
- selectAllAction.runWithEvent(event);
- return;
- }
- }
- public void updateEnabledState() {
- if (activeTextControl != null && !activeTextControl.isDisposed()) {
- setEnabled(true);
- return;
- }
- if (selectAllAction != null) {
- setEnabled(selectAllAction.isEnabled());
- return;
- }
- setEnabled(false);
- }
- }
-/**
- * Creates a <code>Text</code> control action handler
- * for the global Cut, Copy, Paste, Delete, and Select All
- * of the action bar.
- *
- * @param actionBar the action bar to register global
- * action handlers for Cut, Copy, Paste, Delete,
- * and Select All
- */
-public TextActionHandler(IActionBars actionBar) {
- super();
- actionBar.setGlobalActionHandler(IWorkbenchActionConstants.CUT, textCutAction);
- actionBar.setGlobalActionHandler(IWorkbenchActionConstants.COPY, textCopyAction);
- actionBar.setGlobalActionHandler(IWorkbenchActionConstants.PASTE, textPasteAction);
- actionBar.setGlobalActionHandler(IWorkbenchActionConstants.SELECT_ALL, textSelectAllAction);
- actionBar.setGlobalActionHandler(IWorkbenchActionConstants.DELETE, textDeleteAction);
-}
-/**
- * Add a <code>Text</code> control to the handler
- * so that the Cut, Copy, Paste, Delete, and Select All
- * actions are redirected to it when active.
- *
- * @param textControl the inline <code>Text</code> control
- */
-public void addText(Text textControl) {
- if (textControl == null)
- return;
-
- activeTextControl = textControl;
- textControl.addListener(SWT.Activate, textControlListener);
- textControl.addListener(SWT.Deactivate, textControlListener);
-
- // We really want a selection listener but it is not supported so we
- // use a key listener and a mouse listener to know when selection changes
- // may have occured
- textControl.addKeyListener(keyAdapter);
- textControl.addMouseListener(mouseAdapter);
-
-}
-/**
- * Dispose of this action handler
- */
-public void dispose() {
- setCutAction(null);
- setCopyAction(null);
- setPasteAction(null);
- setSelectAllAction(null);
- setDeleteAction(null);
-}
-/**
- * Removes a <code>Text</code> control from the handler
- * so that the Cut, Copy, Paste, Delete, and Select All
- * actions are no longer redirected to it when active.
- *
- * @param textControl the inline <code>Text</code> control
- */
-public void removeText(Text textControl) {
- if (textControl == null)
- return;
-
- textControl.removeListener(SWT.Activate, textControlListener);
- textControl.removeListener(SWT.Deactivate, textControlListener);
-
- textControl.removeMouseListener(mouseAdapter);
- textControl.removeKeyListener(keyAdapter);
-
- activeTextControl = null;
- updateActionsEnableState();
-}
-/**
- * Set the default <code>IAction</code> handler for the Copy
- * action. This <code>IAction</code> is run only if no active
- * inline text control.
- *
- * @param action the <code>IAction</code> to run for the
- * Copy action, or <code>null</null> if not interested.
- */
-public void setCopyAction(IAction action) {
- if (copyAction == action)
- return;
-
- if (copyAction != null)
- copyAction.removePropertyChangeListener(copyActionListener);
-
- copyAction = action;
-
- if (copyAction != null)
- copyAction.addPropertyChangeListener(copyActionListener);
-
- textCopyAction.updateEnabledState();
-}
-/**
- * Set the default <code>IAction</code> handler for the Cut
- * action. This <code>IAction</code> is run only if no active
- * inline text control.
- *
- * @param action the <code>IAction</code> to run for the
- * Cut action, or <code>null</null> if not interested.
- */
-public void setCutAction(IAction action) {
- if (cutAction == action)
- return;
-
- if (cutAction != null)
- cutAction.removePropertyChangeListener(cutActionListener);
-
- cutAction = action;
-
- if (cutAction != null)
- cutAction.addPropertyChangeListener(cutActionListener);
-
- textCutAction.updateEnabledState();
-}
-/**
- * Set the default <code>IAction</code> handler for the Paste
- * action. This <code>IAction</code> is run only if no active
- * inline text control.
- *
- * @param action the <code>IAction</code> to run for the
- * Paste action, or <code>null</null> if not interested.
- */
-public void setPasteAction(IAction action) {
- if (pasteAction == action)
- return;
-
- if (pasteAction != null)
- pasteAction.removePropertyChangeListener(pasteActionListener);
-
- pasteAction = action;
-
- if (pasteAction != null)
- pasteAction.addPropertyChangeListener(pasteActionListener);
-
- textPasteAction.updateEnabledState();
-}
-/**
- * Set the default <code>IAction</code> handler for the Select All
- * action. This <code>IAction</code> is run only if no active
- * inline text control.
- *
- * @param action the <code>IAction</code> to run for the
- * Select All action, or <code>null</null> if not interested.
- */
-public void setSelectAllAction(IAction action) {
- if (selectAllAction == action)
- return;
-
- if (selectAllAction != null)
- selectAllAction.removePropertyChangeListener(selectAllActionListener);
-
- selectAllAction = action;
-
- if (selectAllAction != null)
- selectAllAction.addPropertyChangeListener(selectAllActionListener);
-
- textSelectAllAction.updateEnabledState();
-}
-/**
- * Set the default <code>IAction</code> handler for the Delete
- * action. This <code>IAction</code> is run only if no active
- * inline text control.
- *
- * @param action the <code>IAction</code> to run for the
- * Delete action, or <code>null</null> if not interested.
- */
-public void setDeleteAction(IAction action) {
- if (deleteAction == action)
- return;
-
- if (deleteAction != null)
- deleteAction.removePropertyChangeListener(deleteActionListener);
-
- deleteAction = action;
-
- if (deleteAction != null)
- deleteAction.addPropertyChangeListener(deleteActionListener);
-
- textDeleteAction.updateEnabledState();
-}
-/**
- * Update the enable state of the Cut, Copy,
- * Paste, Delete, and Select All action handlers
- */
-private void updateActionsEnableState() {
- textCutAction.updateEnabledState();
- textCopyAction.updateEnabledState();
- textPasteAction.updateEnabledState();
- textSelectAllAction.updateEnabledState();
- textDeleteAction.updateEnabledState();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkspaceAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkspaceAction.java
deleted file mode 100644
index 91ede52..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkspaceAction.java
+++ /dev/null
@@ -1,339 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.internal.misc.StatusUtil;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Shell;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-/**
- * The abstract superclass for actions whose only role in life is to invoke
- * core commands on a set of selected resources.
- * When the action is run, all the work is done within a modal progress
- * dialog. It iterates over all selected resources; errors are collected and
- * displayed to the user via a problems dialog at the end of the operation.
- * User requests to cancel the operation are passed along to the core.
- * <p>
- * Subclasses must implement the following methods:
- * <ul>
- * <li><code>invokeOperation</code> - to perform the operation on one of the
- * selected resources</li>
- * <li><code>getOperationMessage</code> - to furnish a title for the progress
- * dialog</li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may override the following methods:
- * <ul>
- * <li><code>shouldPerformResourcePruning</code> - reimplement to turn off</li>
- * <li><code>updateSelection</code> - extend to refine enablement criteria</li>
- * <li><code>getProblemsTitle</code> - reimplement to furnish a title for the
- * problems dialog</li>
- * <li><code>getProblemsMessage</code> - reimplement to furnish a message for
- * the problems dialog</li>
- * <li><code>run</code> - extend to </li>
- * </ul>
- * </p>
- */
-public abstract class WorkspaceAction extends SelectionListenerAction {
-
- /**
- * Multi status containing the errors detected when running the operation or
- * <code>null</code> if no errors detected.
- */
- private MultiStatus errorStatus;
-
- /**
- * The shell in which to show the progress and problems dialog.
- */
- private Shell shell;
-/**
- * Creates a new action with the given text.
- *
- * @param shell the shell (for the modal progress dialog and error messages)
- * @param text the string used as the text for the action,
- * or <code>null</code> if these is no text
- */
-protected WorkspaceAction(Shell shell, String text) {
- super(text);
- Assert.isNotNull(shell);
- this.shell = shell;
-}
-/**
- * Opens an error dialog to display the given message.
- * <p>
- * Note that this method must be called from UI thread.
- * </p>
- *
- * @param message the message
- */
-void displayError(String message) {
- if (message == null) {
- message = WorkbenchMessages.getString("WorkbenchAction.internalError"); //$NON-NLS-1$
- }
- MessageDialog.openError(shell, getProblemsTitle(), message);
-}
-/**
- * Runs <code>invokeOperation</code> on each of the selected resources, reporting
- * progress and fielding cancel requests from the given progress monitor.
- *
- * @param monitor a progress monitor
- */
-final void execute(IProgressMonitor monitor) {
- //1FTIMQN: ITPCORE:WIN - clients required to do too much iteration work
- List resources = getActionResources();
- if (shouldPerformResourcePruning()) {
- resources = pruneResources(resources);
- }
- Iterator resourcesEnum = resources.iterator();
-
- // 1FV0B3Y: ITPUI:ALL - sub progress monitors granularity issues
- monitor.beginTask(getOperationMessage(), resources.size() * 1000);
-
- try {
- while (resourcesEnum.hasNext()) {
- IResource resource = (IResource)resourcesEnum.next();
-
- try {
- // 1FV0B3Y: ITPUI:ALL - sub progress monitors granularity issues
- invokeOperation(resource,new SubProgressMonitor(monitor,1000));
- } catch (CoreException e) {
- recordError(e);
- }
-
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- }
- } finally {
- monitor.done();
- }
-}
-/**
- * Returns the string to display for this action's operation.
- * <p>
- * Note that this hook method is invoked in a non-UI thread.
- * </p>
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @return the message
- */
-abstract String getOperationMessage();
-/**
- * Returns the string to display for this action's problems dialog.
- * <p>
- * The <code>WorkspaceAction</code> implementation of this method returns a
- * vague message (localized counterpart of something like "The following
- * problems occurred."). Subclasses may reimplement to provide something more
- * suited to the particular action.
- * </p>
- *
- * @return the problems message
- */
-String getProblemsMessage() {
- return WorkbenchMessages.getString("WorkbenchAction.problemsMessage"); //$NON-NLS-1$
-}
-/**
- * Returns the title for this action's problems dialog.
- * <p>
- * The <code>WorkspaceAction</code> implementation of this method returns a
- * generic title (localized counterpart of "Problems"). Subclasses may
- * reimplement to provide something more suited to the particular action.
- * </p>
- *
- * @return the problems dialog title
- */
-String getProblemsTitle() {
- return WorkbenchMessages.getString("WorkspaceAction.problemsTitle"); //$NON-NLS-1$
-}
-/**
- * Returns the shell for this action. This shell is used for the modal progress
- * and error dialogs.
- *
- * @return the shell
- */
-Shell getShell() {
- return shell;
-}
-/**
- * Performs this action's operation on each of the selected resources, reporting
- * progress to, and fielding cancel requests from, the given progress monitor.
- * <p>
- * Note that this method is invoked in a non-UI thread.
- * </p>
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @param resource one of the selected resources
- * @param monitor a progress monitor
- * @exception CoreException if the operation fails
- */
-abstract void invokeOperation(IResource resource, IProgressMonitor monitor) throws CoreException;
-/**
- * Returns whether the given resource is accessible, where files and folders
- * are always considered accessible, and where a project is accessible iff it
- * is open.
- *
- * @param resource the resource
- * @return <code>true</code> if the resource is accessible, and
- * <code>false</code> if it is not
- */
-boolean isAccessible(IResource resource) {
- switch (resource.getType()) {
- case IResource.FILE:
- return true;
- case IResource.FOLDER:
- return true;
- case IResource.PROJECT:
- return ((IProject)resource).isOpen();
- default:
- return false;
- }
-}
-/**
- * Returns whether the given resource is a descendent of any of the resources
- * in the given list.
- *
- * @param resources the list of resources (element type: <code>IResource</code>)
- * @param child the resource to check
- * @return <code>true</code> if <code>child</code> is a descendent of any of the
- * elements of <code>resources</code>
- */
-boolean isDescendent(List resources, IResource child) {
- IResource parent = child.getParent();
- return parent != null && (resources.contains(parent) || isDescendent(resources, parent));
-}
-/**
- * Performs pruning on the given list of resources, as described in
- * <code>shouldPerformResourcePruning</code>.
- *
- * @param resourceCollection the list of resources (element type:
- * <code>IResource</code>)
- * @return the list of resources (element type: <code>IResource</code>)
- * after pruning.
- * @see #shouldPerformResourcePruning
- */
-List pruneResources(List resourceCollection) {
- List prunedList = new ArrayList(resourceCollection);
- Iterator elementsEnum = prunedList.iterator();
- while (elementsEnum.hasNext()) {
- IResource currentResource = (IResource)elementsEnum.next();
- if (isDescendent(prunedList, currentResource))
- elementsEnum.remove(); //Removes currentResource
- }
-
- return prunedList;
-}
-/**
- * Records the core exception to be displayed to the user
- * once the action is finished.
- *
- * @param error a <code>CoreException</code>
- */
-private void recordError(CoreException error) {
- if (errorStatus == null)
- errorStatus = new MultiStatus(WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR, getProblemsMessage(), error);
-
- errorStatus.merge(error.getStatus());
-}
-/**
- * The <code>CoreWrapperAction</code> implementation of this <code>IAction</code>
- * method uses a <code>ProgressMonitorDialog</code> to run the operation. The
- * operation calls <code>execute</code> (which, in turn, calls
- * <code>invokeOperation</code>). Afterwards, any <code>CoreException</code>s
- * encountered while running the operation are reported to the user via a
- * problems dialog.
- * <p>
- * Subclasses may extend this method.
- * </p>
- */
-public void run() {
- try {
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) {
- WorkspaceAction.this.execute(monitor);
- }
- };
- new ProgressMonitorDialog(shell).run(true, true, op);
- } catch (InterruptedException e) {
- return;
- } catch (InvocationTargetException e) {
- // we catch CoreException in execute(), but unexpected runtime exceptions or errors may still occur
- String msg = WorkbenchMessages.format("WorkspaceAction.logTitle", new Object[] {getClass().getName(), e.getTargetException()}); //$NON-NLS-1$
- WorkbenchPlugin.log(msg,StatusUtil.newStatus(IStatus.ERROR, msg, e.getTargetException()));
- displayError(e.getTargetException().getMessage());
- }
-
- // If errors occurred, open an Error dialog & build a multi status error for it
- if (errorStatus != null) {
- ErrorDialog.openError(shell,
- getProblemsTitle(),
- null, // no special message
- errorStatus);
- }
- errorStatus = null;
-}
-/**
- * Returns whether this action should attempt to optimize the resources being
- * operated on. This kind of pruning makes sense when the operation has depth
- * infinity semantics (when the operation is applied explicitly to a resource
- * then it is also applied implicitly to all the resource's descendents).
- * <p>
- * The <code>WorkspaceAction</code> implementation of this method returns
- * <code>true</code>. Subclasses should reimplement to return <code>false</code>
- * if pruning is not required.
- * </p>
- *
- * @return <code>true</code> if pruning should be performed,
- * and <code>false</code> if pruning is not desired
- */
-boolean shouldPerformResourcePruning() {
- return true;
-}
-/**
- * The <code>WorkspaceAction</code> implementation of this
- * <code>SelectionListenerAction</code> method ensures that this action is
- * disabled if any of the selected resources are inaccessible. Subclasses may
- * extend to react to selection changes; however, if the super method returns
- * <code>false</code>, the overriding method should also return <code>false</code>.
- */
-protected boolean updateSelection(IStructuredSelection selection) {
- if (!super.updateSelection(selection) || selection.isEmpty()) {
- return false;
- }
-
- for (Iterator i = getSelectedResources().iterator(); i.hasNext();) {
- IResource r = (IResource) i.next();
- if (!isAccessible(r)) {
- return false;
- }
- }
- return true;
-}
-
-/**
- * Returns the elements that the action is to be performed on.
- * By default return the selected resources.
- *
- * @return list of resource elements (element type: <code>IResource</code>)
- */
-protected List getActionResources() {
- return getSelectedResources();
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkspaceModifyDelegatingOperation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkspaceModifyDelegatingOperation.java
deleted file mode 100644
index 2db6ffe..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkspaceModifyDelegatingOperation.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * An operation which delegates its work to a runnable that modifies the
- * workspace.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class WorkspaceModifyDelegatingOperation extends WorkspaceModifyOperation {
-
- /**
- * The runnable to delegate work to at execution time.
- */
- private IRunnableWithProgress content;
-/**
- * Creates a new operation which will delegate its work to the given runnable.
- *
- * @param content the runnable to delegate to when this operation is executed
- */
-public WorkspaceModifyDelegatingOperation(IRunnableWithProgress content) {
- super();
- this.content = content;
-}
-/* (non-Javadoc)
- * Method declared on WorkbenchModifyOperation.
- */
-protected void execute(IProgressMonitor monitor) throws CoreException, InterruptedException {
- try {
- content.run(monitor);
- }
- catch (InvocationTargetException e) {
- if (e.getTargetException() instanceof CoreException)
- throw (CoreException) e.getTargetException();
- if (e.getTargetException() instanceof RuntimeException)
- throw (RuntimeException) e.getTargetException();
- if (e.getTargetException() instanceof Error)
- throw (Error) e.getTargetException();
- e.getTargetException().printStackTrace();
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkspaceModifyOperation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkspaceModifyOperation.java
deleted file mode 100644
index c277582..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/WorkspaceModifyOperation.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.eclipse.ui.actions;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * An operation which potentially makes changes to the workspace. All resource
- * modification should be performed using this operation. The primary
- * consequence of using this operation is that events which typically occur as a
- * result of workspace changes (such as the firing of resource deltas,
- * performance of autobuilds, etc.) are deferred until the outermost operation
- * has successfully completed.
- * <p>
- * Subclasses must implement <code>execute</code> to do the work of the
- * operation.
- * </p>
- */
-public abstract class WorkspaceModifyOperation
- implements IRunnableWithProgress
-{
-/**
- * Creates a new operation.
- */
-protected WorkspaceModifyOperation() {
-}
-/**
- * Performs the steps that are to be treated as a single logical workspace
- * change.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @param monitor the progress monitor to use to display progress and field
- * user requests to cancel
- * @exception CoreException if the operation fails due to a CoreException
- * @exception InvocationTargetException if the operation fails due to an exception other than CoreException
- * @exception InterruptedException if the operation detects a request to cancel,
- * using <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing
- * <code>InterruptedException</code>
- */
-protected abstract void execute(IProgressMonitor monitor) throws CoreException, InvocationTargetException, InterruptedException;
-/**
- * The <code>WorkspaceModifyOperation</code> implementation of this
- * <code>IRunnableWithProgress</code> method initiates a batch of changes by
- * invoking the <code>execute</code> method as a workspace runnable
- * (<code>IWorkspaceRunnable</code>).
- */
-public synchronized final void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- final InvocationTargetException[] iteHolder = new InvocationTargetException[1];
- try {
- IWorkspaceRunnable workspaceRunnable = new IWorkspaceRunnable() {
- public void run(IProgressMonitor pm) throws CoreException {
- try {
- execute(pm);
- }
- catch (InvocationTargetException e) {
- // Pass it outside the workspace runnable
- iteHolder[0] = e;
- }
- catch (InterruptedException e) {
- // Re-throw as OperationCanceledException, which will be
- // caught and re-thrown as InterruptedException below.
- throw new OperationCanceledException(e.getMessage());
- }
- // CoreException and OperationCanceledException are propagated
- }
- };
- WorkbenchPlugin.getPluginWorkspace().run(workspaceRunnable, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- } catch (OperationCanceledException e) {
- throw new InterruptedException(e.getMessage());
- }
- // Re-throw the InvocationTargetException, if any occurred
- if (iteHolder[0] != null) {
- throw iteHolder[0];
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/package.html b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/package.html
deleted file mode 100644
index 968b564..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/actions/package.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (WinNT; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Classes for actions and operations used in a workbench
-window, page, or part in the Eclipse Platform User Interface.
-<h2>
-Package Specification</h2>
-Actions for resource management, project build and workbench page management
-are provided to encourage a standard look and feel across views and editors
-contributed by independent system vendors. Base classes are also provided
-for selection oriented actions which enable or disable based upon selection
-in a part or viewer. These should be used by ISV's to define actions for
-menus, toolbars, and context menus.
-<p>Action which leads to resource modification should take advantage of
-the <tt>WorkspaceModifyOperation</tt> classes. These classes are
-used to defer events which typically occur as a result of workspace changes
-(such as the firing of resource deltas, performance of autobuilds, etc.)
-until the outermost operation has successfully completed. This deferral
-leads to an optimized, faster execution of resource modification because
-fewer deltas and autobuilds are performed.
-</body>
-</html>
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
deleted file mode 100644
index 9bb5550..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/AbstractElementListSelectionDialog.java
+++ /dev/null
@@ -1,431 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.dialogs;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.ILabelProvider;
-
-import org.eclipse.ui.PlatformUI;
-
-/**
- * An abstract class to select elements out of a list of elements.
- *
- * @since 2.0
- */
-public abstract class AbstractElementListSelectionDialog extends SelectionStatusDialog {
-
- private ILabelProvider fRenderer;
- private boolean fIgnoreCase= true;
- private boolean fIsMultipleSelection= false;
- private boolean fMatchEmptyString= true;
- private boolean fAllowDuplicates= true;
-
- private Label fMessage;
-
- protected FilteredList fFilteredList;
- private Text fFilterText;
-
- private ISelectionStatusValidator fValidator;
- private String fFilter= null;
-
- private String fEmptyListMessage= ""; //$NON-NLS-1$
- private String fEmptySelectionMessage= ""; //$NON-NLS-1$
-
- private int fWidth= 60;
- private int fHeight= 18;
-
- private Object[] fSelection= new Object[0];
-
- /**
- * Constructs a list selection dialog.
- * @param renderer The label renderer used
- * @param ignoreCase Decides if the match string ignores lower/upppr case
- * @param multipleSelection Allow multiple selection
- */
- protected AbstractElementListSelectionDialog(Shell parent, ILabelProvider renderer)
- {
- super(parent);
- fRenderer= renderer;
-
- int shellStyle= getShellStyle();
- setShellStyle(shellStyle | SWT.MAX | SWT.RESIZE);
- }
-
- /**
- * 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.
- */
- public void setIgnoreCase(boolean ignoreCase) {
- fIgnoreCase= ignoreCase;
- }
-
- /**
- * Returns if sorting, filtering and folding is case sensitive.
- */
- public boolean isCaseIgnored() {
- return fIgnoreCase;
- }
-
- /**
- * Specifies whether everything or nothing should be filtered on
- * empty filter string.
- */
- public void setMatchEmptyString(boolean matchEmptyString) {
- fMatchEmptyString= matchEmptyString;
- }
-
- /**
- * Specifies if multiple selection is allowed.
- */
- public void setMultipleSelection(boolean multipleSelection) {
- fIsMultipleSelection= multipleSelection;
- }
-
- /**
- * Specifies whether duplicate entries are displayed or not.
- */
- 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).
- * To be called within open().
- * @param elements the elements of the list.
- */
- protected void setListElements(Object[] elements) {
- Assert.isNotNull(fFilteredList);
- fFilteredList.setElements(elements);
- }
-
- /**
- * Sets the filter pattern.
- * @param filter the filter pattern.
- */
- 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)
- return fFilter;
- else
- 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.
- */
- 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.
- */
- 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, "", 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();
- }
-
- /*
- * @see Dialog#cancelPressed
- */
- 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.setFilter((fFilter == null ? "" : fFilter)); //$NON-NLS-1$
-
- list.addSelectionListener(new SelectionListener() {
- public void widgetDefaultSelected(SelectionEvent e) {
- handleDefaultSelected();
- }
- 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.setText((fFilter == null ? "" : fFilter)); //$NON-NLS-1$
-
- Listener listener= new Listener() {
- public void handleEvent(Event e) {
- fFilteredList.setFilter(fFilterText.getText());
- }
- };
- text.addListener(SWT.Modify, listener);
-
- text.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.ARROW_DOWN)
- fFilteredList.setFocus();
- }
-
- public void keyReleased(KeyEvent e) {}
- });
-
- fFilterText= text;
-
- return text;
- }
-
- /*
- * @see Window#open()
- */
- public int open() {
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- access$superOpen();
- }
- });
- return getReturnCode();
- }
-
- private void access$superOpen() {
- super.open();
- }
-
- /*
- * @see Window#create(Shell)
- */
- public void create() {
- super.create();
-
- Assert.isNotNull(fFilteredList);
-
- if (fFilteredList.isEmpty()) {
- handleEmptyList();
- } else {
- validateCurrentSelection();
- fFilterText.selectAll();
- fFilterText.setFocus();
- }
- }
-
- /**
- * Handles empty list by disabling widgets.
- */
- protected void handleEmptyList() {
- fMessage.setEnabled(false);
- fFilterText.setEnabled(false);
- fFilteredList.setEnabled(false);
- }
-
-}
\ No newline at end of file
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
deleted file mode 100644
index 6f0b48a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/CheckedTreeSelectionDialog.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.dialogs;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.dialogs.ContainerCheckedTreeViewer;
-
-/**
- * A class to select elements out of a tree structure.
- *
- * @since 2.0
- */
-public class CheckedTreeSelectionDialog extends SelectionStatusDialog {
-
- private CheckboxTreeViewer fViewer;
-
- private ILabelProvider fLabelProvider;
- private ITreeContentProvider fContentProvider;
-
- private ISelectionStatusValidator fValidator= null;
- private ViewerSorter fSorter;
- private String fEmptyListMessage= WorkbenchMessages.getString("CheckedTreeSelectionDialog.nothing_available"); //$NON-NLS-1$
-
- private IStatus fCurrStatus= new Status(IStatus.OK, PlatformUI.PLUGIN_ID, 0, "", null); //$NON-NLS$
- private List fFilters;
- private Object fInput;
- private boolean fIsEmpty;
-
- private int fWidth= 60;
- private int fHeight= 18;
-
- private boolean fContainerMode;
- private Object[] fExpandedElements;
-
- /**
- * Constructs an instance of <code>ElementTreeSelectionDialog</code>.
- * @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) {
- super(parent);
-
- fLabelProvider= labelProvider;
- fContentProvider= contentProvider;
-
- setResult(new ArrayList(0));
- setStatusLineAboveButtons(true);
-
- fContainerMode= false;
- fExpandedElements= null;
-
- int shellStyle= getShellStyle();
- setShellStyle(shellStyle | SWT.MAX | SWT.RESIZE);
- }
-
- /**
- * 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(new Object[] {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 sorter used by the tree viewer.
- */
- public void setSorter(ViewerSorter sorter) {
- fSorter= sorter;
- }
-
- /**
- * 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 the tree
- */
- 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;
- }
-
- 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, "", null);
- }
- } else {
- fCurrStatus= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, fEmptyListMessage, null);
- }
- updateStatus(fCurrStatus);
- }
-
- /*
- * @see Window#open()
- */
- public int open() {
- fIsEmpty= evaluateIfTreeEmpty(fInput);
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- access$superOpen();
- }
- });
-
- return getReturnCode();
- }
-
- private void access$superOpen() {
- super.open();
- }
-
- /**
- * Handles cancel button pressed event.
- */
- protected void cancelPressed() {
- setResult(null);
- super.cancelPressed();
- }
-
- /*
- * @see SelectionStatusDialog#computeResult()
- */
- protected void computeResult() {
- setResult(Arrays.asList(fViewer.getCheckedElements()));
- }
-
- /*
- * @see Window#create()
- */
- public void create() {
- super.create();
-
- fViewer.setCheckedElements(getInitialElementSelections().toArray());
-
- if (fExpandedElements != null) {
- fViewer.setExpandedElements(fExpandedElements);
- }
-
- updateOKStatus();
- }
-
- /*
- * @see Dialog#createDialogArea(Composite)
- */
- 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);
-
- 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, SWT.BORDER);
- } else {
- fViewer= new CheckboxTreeViewer(parent, SWT.BORDER);
- }
-
- fViewer.setContentProvider(fContentProvider);
- fViewer.setLabelProvider(fLabelProvider);
- fViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- updateOKStatus();
- }
- });
-
- fViewer.setSorter(fSorter);
- 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
- */
- protected Composite createSelectionButtons(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.getString("CheckedTreeSelectionDialog.select_all"), false); //$NON-NLS-1$
-
- SelectionListener listener= new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- fViewer.setCheckedElements(fContentProvider.getElements(fInput));
- updateOKStatus();
- }
- };
- selectButton.addSelectionListener(listener);
-
- Button deselectButton= createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, WorkbenchMessages.getString("CheckedTreeSelectionDialog.deselect_all"), false); //$NON-NLS-1$
-
- listener= new SelectionAdapter() {
- public void widgetSelected(SelectionEvent 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;
- }
-
-
-
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ContainerGenerator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ContainerGenerator.java
deleted file mode 100644
index 7921802..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ContainerGenerator.java
+++ /dev/null
@@ -1,176 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * For creating non-existing folder resources along a given workspace path.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * <p>
- * Example usage:
- * <pre>
- * ContainerGenerator gen = new ContainerGenerator(new Path("/A/B"));
- * IContainer res = null;
- * try {
- * res = gen.getContainer(monitor); // creates project A and folder B if required
- * } catch (CoreException e) {
- * // handle failure
- * } catch (OperationCanceledException e) {
- * // handle cancelation
- * }
- * </pre>
- * </p>
- */
-public class ContainerGenerator {
- private IPath containerFullPath;
- private IContainer container;
-/**
- * Creates a generator for the container resource (folder or project) at the
- * given workspace path. Assumes the path has already been validated.
- * <p>
- * Call <code>getContainer</code> to create any missing resources along the
- * path.
- * </p>
- *
- * @param containerPath the workspace path of the container
- */
-public ContainerGenerator(IPath containerPath) {
- super();
- this.containerFullPath = containerPath;
-}
-/**
- * Creates a folder resource for the given folder handle.
- *
- * @param folderHandle the handle to create a folder resource
- * @param monitor the progress monitor to show visual progress
- * @return the folder handle (<code>folderHandle</code>)
- * @exception CoreException if the operation fails
- * @exception OperationCanceledException if the operation is canceled
- */
-private IFolder createFolder(IFolder folderHandle, IProgressMonitor monitor) throws CoreException {
- folderHandle.create(false, true, monitor);
-
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- return folderHandle;
-}
-/**
- * Creates a folder resource handle for the folder with the given name.
- * This method does not create the folder resource; this is the responsibility
- * of <code>createFolder</code>.
- *
- * @param container the resource container
- * @param folderName the name of the folder
- * @return the new folder resource handle
- */
-private IFolder createFolderHandle(IContainer container, String folderName) {
- return container.getFolder(new Path(folderName));
-}
-/**
- * Creates a project resource for the given project handle.
- *
- * @param projectHandle the handle to create a project resource
- * @param monitor the progress monitor to show visual progress
- * @return the project handle (<code>projectHandle</code>)
- * @exception CoreException if the operation fails
- * @exception OperationCanceledException if the operation is canceled
- */
-private IProject createProject(IProject projectHandle, IProgressMonitor monitor) throws CoreException {
- try {
- monitor.beginTask("",2000);//$NON-NLS-1$
-
- projectHandle.create(new SubProgressMonitor(monitor, 1000));
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- projectHandle.open(new SubProgressMonitor(monitor, 1000));
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- }
- finally {
- monitor.done();
- }
-
- return projectHandle;
-}
-/**
- * Creates a project resource handle for the project with the given name.
- * This method does not create the project resource; this is the responsibility
- * of <code>createProject</code>.
- *
- * @param root the workspace root resource
- * @param projectName the name of the project
- * @return the new project resource handle
- */
-private IProject createProjectHandle(IWorkspaceRoot root, String projectName) {
- return root.getProject(projectName);
-}
-/**
- * Ensures that this generator's container resource exists. Creates any missing
- * resource containers along the path; does nothing if the container resource
- * already exists.
- * <p>
- * Note: This method should be called within a workspace modify operation since
- * it may create resources.
- * </p>
- *
- * @param monitor a progress monitor
- * @return the container resource
- * @exception CoreException if the operation fails
- * @exception OperationCanceledException if the operation is canceled
- */
-public IContainer generateContainer(IProgressMonitor monitor) throws CoreException {
- WorkbenchPlugin.getPluginWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask(WorkbenchMessages.getString("ContainerGenerator.progressMessage"), 1000 * containerFullPath.segmentCount()); //$NON-NLS-1$
- if (container != null)
- return;
-
- // Does the container exist already?
- IWorkspaceRoot root = getWorkspaceRoot();
- container = (IContainer) root.findMember(containerFullPath);
- if (container != null)
- return;
-
- // Create the container for the given path
- container = root;
- for (int i = 0; i < containerFullPath.segmentCount(); i++) {
- String currentSegment = containerFullPath.segment(i);
- IResource resource = container.findMember(currentSegment);
- if (resource != null) {
- container = (IContainer) resource;
- monitor.worked(1000);
- }
- else {
- if (i == 0) {
- IProject projectHandle = createProjectHandle(root, currentSegment);
- container = createProject(projectHandle, new SubProgressMonitor(monitor,1000));
- }
- else {
- IFolder folderHandle = createFolderHandle(container, currentSegment);
- container = createFolder(folderHandle, new SubProgressMonitor(monitor,1000));
- }
- }
- }
- }
- }, monitor);
- return container;
-}
-/**
- * Returns the workspace root resource handle.
- *
- * @return the workspace root resource handle
- */
-private IWorkspaceRoot getWorkspaceRoot() {
- return WorkbenchPlugin.getPluginWorkspace().getRoot();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ContainerSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ContainerSelectionDialog.java
deleted file mode 100644
index 04d2b31..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ContainerSelectionDialog.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.misc.ContainerSelectionGroup;
-
-/**
- * A standard selection dialog which solicits a container resource from the user.
- * The <code>getResult</code> method returns the selected container resource.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * <p>
- * Example:
- * <pre>
- * ContainerSelectionDialog dialog =
- * new ContainerSelectionDialog(getShell(), initialSelection, allowNewContainerName(), msg);
- * dialog.open();
- * Object[] result = dialog.getResult();
- * </pre>
- * </p>
- */
-public class ContainerSelectionDialog extends SelectionDialog {
- // the widget group;
- private ContainerSelectionGroup group;
-
- // the root resource to populate the viewer with
- private IContainer initialSelection;
-
- // allow the user to type in a new container name
- private boolean allowNewContainerName = true;
-
- // the validation message
- private Label statusMessage;
-
- //for validating the selection
- private ISelectionValidator validator;
-
- // show closed projects by default
- private boolean showClosedProjects = true;
-
- // sizing constants
- private static final int SIZING_SELECTION_PANE_HEIGHT = 250;
- private static final int SIZING_SELECTION_PANE_WIDTH = 300;
-/**
- * Creates a resource container selection dialog rooted at the given resource.
- * All selections are considered valid.
- *
- * @param parentShell the parent shell
- * @param initialRoot the initial selection in the tree
- * @param allowNewContainerName <code>true</code> to enable the user to type in
- * a new container name, and <code>false</code> to restrict the user to just
- * selecting from existing ones
- * @param message the message to be displayed at the top of this dialog, or
- * <code>null</code> to display a default message
- */
-public ContainerSelectionDialog(Shell parentShell, IContainer initialRoot, boolean allowNewContainerName, String message) {
- super(parentShell);
- setTitle(WorkbenchMessages.getString("ContainerSelectionDialog.title")); //$NON-NLS-1$
- this.initialSelection = initialRoot;
- this.validator = validator;
- this.allowNewContainerName = allowNewContainerName;
- if (message != null)
- setMessage(message);
- else
- setMessage(WorkbenchMessages.getString("ContainerSelectionDialog.message")); //$NON-NLS-1$
- setShellStyle(getShellStyle() | SWT.RESIZE);
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- WorkbenchHelp.setHelp(shell, IHelpContextIds.CONTAINER_SELECTION_DIALOG);
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- // create composite
- Composite dialogArea = (Composite)super.createDialogArea(parent);
-
- Listener listener = new Listener() {
- public void handleEvent (Event event) {
- if (statusMessage != null && validator != null) {
- String errorMsg = validator.isValid(group.getContainerFullPath());
- if (errorMsg == null || errorMsg.equals("")) {//$NON-NLS-1$
- statusMessage.setText("");//$NON-NLS-1$
- getOkButton().setEnabled(true);
- } else {
- statusMessage.setForeground(
- JFaceColors.getErrorText(
- statusMessage.getDisplay()));
- statusMessage.setText(errorMsg);
- getOkButton().setEnabled(false);
- }
- }
- }
- };
-
- // container selection group
- group = new ContainerSelectionGroup(dialogArea, listener, allowNewContainerName, getMessage(), showClosedProjects);
- if (initialSelection != null) {
- group.setSelectedContainer(initialSelection);
- }
-
- statusMessage = new Label(parent, SWT.NONE);
- statusMessage.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- return dialogArea;
-}
-/**
- * The <code>ContainerSelectionDialog</code> implementation of this
- * <code>Dialog</code> method builds a list of the selected resource containers
- * for later retrieval by the client and closes this dialog.
- */
-protected void okPressed() {
- List chosenContainerPathList = new ArrayList();
- chosenContainerPathList.add(group.getContainerFullPath());
- setResult(chosenContainerPathList);
- super.okPressed();
-}
-/**
- * Sets the validator to use.
- *
- * @param validator A selection validator
- */
-public void setValidator(ISelectionValidator validator) {
- this.validator = validator;
-}
-/**
- * Set whether or not closed projects should be shown
- * in the selection dialog.
- *
- * @param show Whether or not to show closed projects.
- */
-public void showClosedProjects(boolean show) {
- this.showClosedProjects = show;
-}
-}
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
deleted file mode 100644
index 34e46e7..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementListSelectionDialog.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.dialogs;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.viewers.ILabelProvider;
-
-/**
- * A class to select elements out of a list of elements.
- *
- * @since 2.0
- */
-public class ElementListSelectionDialog extends AbstractElementListSelectionDialog {
-
- 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);
- }
-
- /**
- * Sets the elements of the list.
- * @param elements the elements of the list.
- */
- public void setElements(Object[] elements) {
- fElements= elements;
- }
-
- /*
- * @see SelectionStatusDialog#computeResult()
- */
- protected void computeResult() {
- setResult(Arrays.asList(getSelectedElements()));
- }
-
- /*
- * @see Dialog#createDialogArea(Composite)
- */
- protected Control createDialogArea(Composite parent) {
- Composite contents= (Composite) super.createDialogArea(parent);
-
- createMessageArea(contents);
- createFilterText(contents);
- createFilteredList(contents);
-
- setListElements(fElements);
-
- setSelection(getInitialElementSelections().toArray());
-
- return contents;
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 016e315..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ElementTreeSelectionDialog.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.dialogs;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Tree;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * A class to select elements out of a tree structure.
- *
- * @since 2.0
- */
-public class ElementTreeSelectionDialog extends SelectionStatusDialog {
-
- private TreeViewer fViewer;
- private ILabelProvider fLabelProvider;
- private ITreeContentProvider fContentProvider;
-
- private ISelectionStatusValidator fValidator= null;
- private ViewerSorter fSorter;
- private boolean fAllowMultiple= true;
- private boolean fDoubleClickSelects= true;
- private String fEmptyListMessage= WorkbenchMessages.getString("ElementTreeSelectionDialog.nothing_available"); //$NON-NLS-1$
-
- private IStatus fCurrStatus= new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", null);
- private List fFilters;
- private Object fInput;
- private boolean fIsEmpty;
-
- private int fWidth= 60;
- private int fHeight= 18;
-
- /**
- * Constructs an instance of <code>ElementTreeSelectionDialog</code>.
- * @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)
- {
- super(parent);
-
- fLabelProvider= labelProvider;
- fContentProvider= contentProvider;
-
- setResult(new ArrayList(0));
- setStatusLineAboveButtons(true);
-
- int shellStyle= getShellStyle();
- setShellStyle(shellStyle | SWT.MAX | SWT.RESIZE);
- }
-
- /**
- * Sets the initial selection.
- * Convenience method.
- * @param selection the initial selection.
- */
- public void setInitialSelection(Object selection) {
- setInitialSelections(new Object[] {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.
- */
- public void setAllowMultiple(boolean allowMultiple) {
- fAllowMultiple= allowMultiple;
- }
-
- /**
- * Specifies if default selected events (double click) are created.
- */
- public void setDoubleClickSelects(boolean doubleClickSelects) {
- fDoubleClickSelects= doubleClickSelects;
- }
-
- /**
- * Sets the sorter used by the tree viewer.
- */
- public void setSorter(ViewerSorter sorter) {
- fSorter= sorter;
- }
-
- /**
- * 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;
- }
-
- 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, "", null);
- }
- } else {
- fCurrStatus= new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.ERROR, fEmptyListMessage, null);
- }
- updateStatus(fCurrStatus);
- }
-
- /*
- * @see Window#open()
- */
- public int open() {
- fIsEmpty= evaluateIfTreeEmpty(fInput);
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- access$superOpen();
- }
- });
-
- return getReturnCode();
- }
-
- private void access$superOpen() {
- super.open();
- }
-
- /**
- * Handles cancel button pressed event.
- */
- protected void cancelPressed() {
- setResult(null);
- super.cancelPressed();
- }
-
- /*
- * @see SelectionStatusDialog#computeResult()
- */
- protected void computeResult() {
- setResult(((IStructuredSelection) fViewer.getSelection()).toList());
- }
-
- /*
- * @see Window#create()
- */
- public void create() {
- super.create();
-
- fViewer.setSelection(new StructuredSelection(getInitialElementSelections()), true);
-
- updateOKStatus();
- }
-
- /*
- * @see Dialog#createDialogArea(Composite)
- */
- 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);
-
- if (fIsEmpty) {
- messageLabel.setEnabled(false);
- treeWidget.setEnabled(false);
- }
-
- return composite;
- }
-
- /**
- * Creates the tree viewer.
- *
- * @param parent the parent composite
- * @return the tree viewer
- */
- protected TreeViewer createTreeViewer(Composite parent) {
- int style= SWT.BORDER | (fAllowMultiple ? SWT.MULTI : SWT.SINGLE);
-
- fViewer= new TreeViewer(new Tree(parent, style));
- fViewer.setContentProvider(fContentProvider);
- fViewer.setLabelProvider(fLabelProvider);
- fViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- access$setResult(((IStructuredSelection) event.getSelection()).toList());
- updateOKStatus();
- }
- });
-
- fViewer.setSorter(fSorter);
- 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(new SelectionAdapter() {
- public void widgetDefaultSelected(SelectionEvent e) {
- updateOKStatus();
- if (fCurrStatus.isOK())
- access$superButtonPressed(IDialogConstants.OK_ID);
- }
- });
- }
-
- fViewer.setInput(fInput);
-
- return fViewer;
- }
-
- /**
- * 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;
- }
-
- protected void access$superButtonPressed(int id) {
- super.buttonPressed(id);
- }
-
- protected void access$setResult(List result) {
- super.setResult(result);
- }
-
-}
\ No newline at end of file
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
deleted file mode 100644
index 0fdd382..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingContentProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * 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.
- * </p>
- *
- * @see org.eclipse.ui.IResourceTypeEditorMapping
- * @see org.eclipse.jface.viewers.IContentProvider
- */
-public class FileEditorMappingContentProvider implements IStructuredContentProvider {
-
- /**
- * Singleton instance accessor.
- */
- public final static 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();
-}
-/* (non-Javadoc)
- * Method declared on IContentProvider.
- */
-public void dispose() {}
-/* (non-Javadoc)
- * Method declared on IStructuredContentProvider.
- */
-public Object[] getElements(Object element) {
- IFileEditorMapping[] array = (IFileEditorMapping[]) element;
- return array == null ? new Object[0] : array;
-}
-/* (non-Javadoc)
- * Method declared on IContentProvider.
- */
-public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
-}
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
deleted file mode 100644
index 1fc7d2c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileEditorMappingLabelProvider.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.IFileEditorMapping;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.graphics.Image;
-import java.util.*;
-
-/**
- * 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.
- * </p>
- * <p>
- * The singleton instance hangs on to images, which get freed up when
- * <code>dispose</code> is called.
- * </p>
- *
- * @see org.eclipse.ui.IResourceTypeEditorMapping
- * @see org.eclipse.jface.viewers.ILabelProvider
- */
-public class FileEditorMappingLabelProvider extends LabelProvider implements ITableLabelProvider {
-
- /**
- * Singleton instance accessor.
- */
- public final static FileEditorMappingLabelProvider INSTANCE = new FileEditorMappingLabelProvider();
-
- /**
- * 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();
-}
-/* (non-Javadoc)
- * Method declared on ILabelProvider.
- */
-public void dispose() {
- 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>.
- */
-public Image getColumnImage(Object element, int row) {
- return getImage(element);
-}
-/* (non-Javadoc)
- * Method declared on ITableLabelProvider.
- */
-public String getColumnText(Object element, int row) {
- 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>.
- */
-public Image getImage(Object element) {
- if (element instanceof IFileEditorMapping) {
- Image image = ((IFileEditorMapping)element).getImageDescriptor().createImage();
- imagesToDispose.add(image);
- return image;
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on ILabelProvider.
- */
-public String getText(Object element) {
- if (element instanceof IFileEditorMapping)
- return ((IFileEditorMapping)element).getLabel();
-
- return null;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileSelectionDialog.java
deleted file mode 100644
index cbfc3bf..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileSelectionDialog.java
+++ /dev/null
@@ -1,243 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.CheckboxTreeAndListGroup;
-import org.eclipse.ui.model.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/**
- * A standard file selection dialog which solicits a list of files from the user.
- * The <code>getResult</code> method returns the selected files.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * <p>
- * Example:
- * <pre>
- * FileSelectionDialog dialog =
- * new FileSelectionDialog(getShell(), rootElement, msg);
- * dialog.setInitialSelections(selectedResources);
- * dialog.open();
- * return dialog.getResult();
- * </pre>
- * </p>
- */
-public class FileSelectionDialog extends SelectionDialog {
- // the root file representative to populate the viewer with
- private FileSystemElement root;
-
- // the visual selection widget group
- private CheckboxTreeAndListGroup selectionGroup;
-
- // expand all items in the tree view on dialog open
- private boolean expandAllOnOpen = false;
-
- // sizing constants
- private static final int SIZING_SELECTION_WIDGET_WIDTH = 500;
- private static final int SIZING_SELECTION_WIDGET_HEIGHT = 250;
-/**
- * Creates a file selection dialog rooted at the given file system element.
- *
- * @param parentShell the parent shell
- * @param fileSystemElement the root element to populate this dialog with
- * @param message the message to be displayed at the top of this dialog, or
- * <code>null</code> to display a default message
- */
-public FileSelectionDialog(Shell parentShell, FileSystemElement fileSystemElement, String message) {
- super(parentShell);
- setTitle(WorkbenchMessages.getString("FileSelectionDialog.title")); //$NON-NLS-1$
- root = fileSystemElement;
- if (message != null)
- setMessage(message);
- else
- setMessage(WorkbenchMessages.getString("FileSelectionDialog.message")); //$NON-NLS-1$
-}
-/**
- * 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);
- composite.setData(data);
-
- Button selectButton = new Button(buttonComposite,SWT.PUSH);
- selectButton.setText(SELECT_ALL_TITLE);
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- selectionGroup.setAllSelections(true);
- }
- };
- selectButton.addSelectionListener(listener);
-
- Button deselectButton = new Button(buttonComposite,SWT.PUSH);
- deselectButton.setText(DESELECT_ALL_TITLE);
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- selectionGroup.setAllSelections(false);
-
- }
- };
- deselectButton.addSelectionListener(listener);
-
- }
-/**
- * Visually checks the previously-specified elements in the container (left)
- * portion of this dialog's file selection viewer.
- */
-private void checkInitialSelections() {
- Iterator itemsToCheck = getInitialElementSelections().iterator();
-
- while (itemsToCheck.hasNext()) {
- FileSystemElement currentElement = (FileSystemElement)itemsToCheck.next();
-
- if (currentElement.isDirectory())
- selectionGroup.initialCheckTreeItem(currentElement);
- else
- selectionGroup.initialCheckListItem(currentElement);
- }
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- WorkbenchHelp.setHelp(shell, IHelpContextIds.FILE_SELECTION_DIALOG);
-}
-public void create() {
- super.create();
- initializeDialog();
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- // page group
- Composite composite = (Composite)super.createDialogArea(parent);
-
- createMessageArea(composite);
-
- // Create a fake parent of the root to be the dialog input element.
- // Use an empty label so that display of the element's full name
- // doesn't include a confusing label
- FileSystemElement input = new FileSystemElement("", null, true);//$NON-NLS-1$
- input.addChild(root);
- root.setParent(input);
-
- selectionGroup =
- new CheckboxTreeAndListGroup(
- composite,
- input,
- getFolderProvider(),
- new WorkbenchLabelProvider(),
- getFileProvider(),
- new WorkbenchLabelProvider(),
- SWT.NONE,
- SIZING_SELECTION_WIDGET_WIDTH, // since this page has no other significantly-sized
- SIZING_SELECTION_WIDGET_HEIGHT); // widgets we need to hardcode the combined widget's
- // size, otherwise it will open too small
-
- ICheckStateListener listener = new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- getOkButton().setEnabled(selectionGroup.getCheckedElementCount() > 0);
- }
- };
-
- WorkbenchViewerSorter sorter = new WorkbenchViewerSorter();
- selectionGroup.setTreeSorter(sorter);
- selectionGroup.setListSorter(sorter);
- selectionGroup.addCheckStateListener(listener);
-
- addSelectionButtons(composite);
-
- return composite;
-}
-/**
- * Returns whether the tree view of the file system element
- * will be fully expanded when the dialog is opened.
- *
- * @return true to expand all on dialog open, false otherwise.
- */
-public boolean getExpandAllOnOpen() {
- return expandAllOnOpen;
-}
-/**
- * Returns a content provider for <code>FileSystemElement</code>s that returns
- * only files as children.
- */
-private ITreeContentProvider getFileProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof FileSystemElement) {
- return ((FileSystemElement)o).getFiles().getChildren(o);
- }
- return new Object[0];
- }
- };
-}
-/**
- * Returns a content provider for <code>FileSystemElement</code>s that returns
- * only folders as children.
- */
-private ITreeContentProvider getFolderProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof FileSystemElement) {
- return ((FileSystemElement)o).getFolders().getChildren(o);
- }
- return new Object[0];
- }
- };
-}
-/**
- * Initializes this dialog's controls.
- */
-private void initializeDialog() {
- // initialize page
- if (getInitialElementSelections().isEmpty())
- getOkButton().setEnabled(false);
- else
- checkInitialSelections();
- selectionGroup.aboutToOpen();
- if (expandAllOnOpen)
- selectionGroup.expandAll();
-}
-/**
- * The <code>FileSelectionDialog</code> implementation of this
- * <code>Dialog</code> method builds a list of the selected files for later
- * retrieval by the client and closes this dialog.
- */
-protected void okPressed() {
- Iterator resultEnum = selectionGroup.getAllCheckedListItems();
- ArrayList list = new ArrayList();
- while (resultEnum.hasNext())
- list.add(resultEnum.next());
- setResult(list);
- super.okPressed();
-}
-/**
- * Set whether the tree view of the file system element
- * will be fully expanded when the dialog is opened.
- *
- * @parm expandAll true to expand all on dialog open, false otherwise.
- */
-public void setExpandAllOnOpen(boolean expandAll) {
- expandAllOnOpen = expandAll;
-}
-}
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
deleted file mode 100644
index a37c516..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FileSystemElement.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.ui.internal.model.WorkbenchAdapter;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.DisposeEvent;
-import java.util.*;
-
-/**
- * Instances of this class represent files or file-like entities (eg.- zip
- * file entries) on the local file system. They do not represent resources
- * within the workbench. This distinction is made because the representation of
- * a file system resource is significantly different from that of a workbench
- * resource.
- *
- * If self represents a collection (eg.- file system directory, zip directory)
- * then its icon will be the folderIcon static field. Otherwise (ie.- self
- * represents a file system file) self's icon is stored in field "icon", and is
- * determined by the extension of the file that self represents.
- *
- * This class is adaptable, and implements one adapter itself, namely the
- * IWorkbenchAdapter adapter used for navigation and display in the workbench.
- */
-public class FileSystemElement implements IAdaptable {
- private String name;
- 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;
- private AdaptableList files = null;
-
- private boolean isDirectory = false;
- private FileSystemElement parent;
-
- private final static AdaptableList EMPTY_LIST = new AdaptableList(0);
-
- private WorkbenchAdapter workbenchAdapter = new WorkbenchAdapter() {
- /**
- * Answer the children property of this element
- */
- public Object[] getChildren(Object o) {
- return getFolders().getChildren(o);
- }
- /**
- * Returns the parent of this element
- */
- public Object getParent(Object o) {
- return parent;
- }
- /**
- * Returns an appropriate label for this file system element.
- */
- public String getLabel(Object o) {
- return name;
- }
- /**
- * Returns an image descriptor for this file system element
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- if (isDirectory()) {
- return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- } else {
- return WorkbenchPlugin.getDefault().getEditorRegistry().getImageDescriptor(name);
- }
- }
-};
-/**
- * Creates a new <code>FileSystemElement</code> and initializes it
- * and its parent if applicable.
- *
- * @param name java.lang.String
- */
-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) folders = new AdaptableList(1);
- folders.add(child);
- } else {
- if (files == null) files = new AdaptableList(1);
- files.add(child);
- }
-}
-/**
- * Returns the adapter
- */
-public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) {
- return workbenchAdapter;
- }
- //defer to the platform
- return Platform.getAdapterManager().getAdapter(this, adapter);
-}
-/**
- * Returns the extension of this element's filename. Returns
- * The 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.
- */
-public AdaptableList getFiles() {
-
- if (files == null) return EMPTY_LIST;
- return files;
-}
-/**
- * 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.
- */
-public AdaptableList getFolders() {
- if (folders == null) return EMPTY_LIST;
- 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;
-}
-/**
- * Returns true if this element represents a directory, and false
- * otherwise.
- */
-public boolean isDirectory() {
- return isDirectory;
-}
-/**
- * Removes a sub-folder from this file system element.
- */
-public void removeFolder(FileSystemElement child) {
- if (folders == null) return;
- 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;
-}
-/**
- * Sets the parent of this file system element.
- */
-public void setParent(FileSystemElement element) {
- parent = element;
-}
-/**
- * For debugging purposes only.
- */
-public String toString() {
- StringBuffer buf = new StringBuffer();
- 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/FilteredList.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredList.java
deleted file mode 100644
index 72d47ca..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/FilteredList.java
+++ /dev/null
@@ -1,568 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.dialogs;
-
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.Vector;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.ILabelProvider;
-
-import org.eclipse.ui.internal.misc.StringMatcher;
-
-/**
- * A composite widget which holds a list of elements for user selection.
- * The elements are sorted alphabetically.
- * Optionally, the elements can be filtered and duplicate entries can
- * be hidden (folding).
- *
- * @since 2.0
- */
-public class FilteredList extends Composite {
-
- public interface FilterMatcher {
- /**
- * 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.
- */
- void setFilter(String pattern, boolean ignoreCase, boolean ignoreWildCards);
-
- /**
- * Returns <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.
- */
- boolean match(Object element);
- }
-
- private class DefaultFilterMatcher implements FilterMatcher {
- private StringMatcher fMatcher;
-
- public void setFilter(String pattern, boolean ignoreCase, boolean ignoreWildCards) {
- fMatcher= new StringMatcher(pattern + '*', ignoreCase, ignoreWildCards);
- }
-
- public boolean match(Object element) {
- return fMatcher.match(fRenderer.getText(element));
- }
- }
-
- private Table fList;
- private ILabelProvider fRenderer;
- private boolean fMatchEmtpyString= true;
- private boolean fIgnoreCase;
- private boolean fAllowDuplicates;
- private String fFilter= ""; //$NON-NLS-1$
- private TwoArrayQuickSorter fSorter;
-
- private Object[] fElements= new Object[0];
- private Label[] fLabels;
- private Vector fImages= new Vector();
-
- private int[] fFoldedIndices;
- private int fFoldedCount;
-
- private int[] fFilteredIndices;
- private int fFilteredCount;
-
- private FilterMatcher fFilterMatcher= new DefaultFilterMatcher();
- private Comparator fComparator;
-
- private UpdateThread fUpdateThread;
-
- private static class Label {
- public final String string;
- public final Image image;
-
- public Label(String string, Image image) {
- this.string= string;
- this.image= image;
- }
-
- public boolean equals(Label label) {
- if (label == null)
- return false;
-
- return
- string.equals(label.string) &&
- image.equals(label.image);
- }
- }
-
- private final class LabelComparator implements Comparator {
- private boolean fIgnoreCase;
-
- LabelComparator(boolean ignoreCase) {
- fIgnoreCase= ignoreCase;
- }
-
- public int compare(Object left, Object right) {
- Label leftLabel= (Label) left;
- Label rightLabel= (Label) right;
-
- int value;
-
- if (fComparator == null) {
- value= fIgnoreCase
- ? leftLabel.string.compareToIgnoreCase(rightLabel.string)
- : leftLabel.string.compareTo(rightLabel.string);
- } else {
- value= fComparator.compare(leftLabel.string, rightLabel.string);
- }
-
- if (value != 0)
- return value;
-
- // images are allowed to be null
- if (leftLabel.image == null) {
- return (rightLabel.image == null) ? 0 : -1;
- } else if (rightLabel.image == null) {
- return +1;
- } else {
- return
- fImages.indexOf(leftLabel.image) -
- fImages.indexOf(rightLabel.image);
- }
- }
-
- }
-
- /**
- * Constructs a new instance of a filtered list.
- * @param parent the parent composite.
- * @param style the widget style.
- * @param renderer 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 renderer,
- boolean ignoreCase, boolean allowDuplicates, boolean matchEmptyString)
- {
- super(parent, SWT.NONE);
-
- GridLayout layout= new GridLayout();
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- setLayout(layout);
-
- fList= new Table(this, style);
- fList.setLayoutData(new GridData(GridData.FILL_BOTH));
- fList.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- fRenderer.dispose();
- if (fUpdateThread != null)
- fUpdateThread.requestStop();
- }
- });
-
- fRenderer= renderer;
- fIgnoreCase= ignoreCase;
- fSorter= new TwoArrayQuickSorter(new LabelComparator(ignoreCase));
- fAllowDuplicates= allowDuplicates;
- fMatchEmtpyString= matchEmptyString;
- }
-
- /**
- * Sets the list of elements.
- * @param elements the elements to be shown in the list.
- */
- public void setElements(Object[] elements) {
- if (elements == null) {
- fElements= new Object[0];
- } else {
- // copy list for sorting
- fElements= new Object[elements.length];
- System.arraycopy(elements, 0, fElements, 0, elements.length);
- }
-
- int length= fElements.length;
-
- // fill labels
- fLabels= new Label[length];
- Set imageSet= new HashSet();
- for (int i= 0; i != length; i++) {
- String text= fRenderer.getText(fElements[i]);
- Image image= fRenderer.getImage(fElements[i]);
-
- fLabels[i]= new Label(text, image);
- imageSet.add(image);
- }
- fImages.clear();
- fImages.addAll(imageSet);
-
- fSorter.sort(fLabels, fElements);
-
- fFilteredIndices= new int[length];
- fFoldedIndices= new int[length];
-
- updateList();
- }
-
- /**
- * Tests if the list (before folding and filtering) is empty.
- * @return returns <code>true</code> if the list is empty, <code>false</code> otherwise.
- */
- public boolean isEmpty() {
- return (fElements == null) || (fElements.length == 0);
- }
-
- /**
- * Sets the filter matcher.
- */
- public void setFilterMatcher(FilterMatcher filterMatcher) {
- Assert.isNotNull(filterMatcher);
- fFilterMatcher= filterMatcher;
- }
-
- /**
- * Sets a custom comparator for sorting the list.
- */
- public void setComparator(Comparator comparator) {
- Assert.isNotNull(comparator);
- fComparator= comparator;
- }
-
- /**
- * Adds a selection listener to the list.
- * @param listener the selection listener to be added.
- */
- public void addSelectionListener(SelectionListener listener) {
- fList.addSelectionListener(listener);
- }
-
- /**
- * Removes a selection listener from the list.
- * @param listener the selection listener to be removed.
- */
- public void removeSelectionListener(SelectionListener listener) {
- fList.removeSelectionListener(listener);
- }
-
- /**
- * Sets the selection of the list.
- * Empty or null array removes selection.
- * @param selection an array of indices specifying the selection.
- */
- public void setSelection(int[] selection) {
- if (selection == null || selection.length == 0)
- fList.deselectAll();
- else
- fList.setSelection(selection);
- }
-
- /**
- * Returns the selection of the list.
- * @return returns an array of indices specifying the current selection.
- */
- public int[] getSelectionIndices() {
- return fList.getSelectionIndices();
- }
-
- /**
- * Returns the selection of the list.
- * This is a convenience function for <code>getSelectionIndices()</code>.
- * @return returns the index of the selection, -1 for no selection.
- */
- public int getSelectionIndex() {
- return fList.getSelectionIndex();
- }
-
- /**
- * Sets the selection of the list.
- * Empty or null array removes selection.
- * @param elements the array of elements to be selected.
- */
- public void setSelection(Object[] elements) {
- if (elements == null || elements.length == 0) {
- fList.deselectAll();
- return;
- }
-
- if (fElements == null)
- return;
-
- // fill indices
- int[] indices= new int[elements.length];
- 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 l;
- for (l= fFoldedIndices[j]; l != max; l++) {
- // found matching element?
- if (fElements[fFilteredIndices[l]].equals(elements[i])) {
- indices[i]= j;
- break;
- }
- }
-
- if (l != max)
- break;
- }
-
- // not found
- if (j == fFoldedCount)
- indices[i] = 0;
- }
-
- fList.setSelection(indices);
- }
-
- /**
- * 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.
- */
- public Object[] getSelection() {
- if (fList.isDisposed() || (fList.getSelectionCount() == 0))
- return new Object[0];
-
- int[] indices= fList.getSelectionIndices();
- Object[] elements= new Object[indices.length];
-
- for (int i= 0; i != indices.length; i++)
- elements[i]= fElements[fFilteredIndices[fFoldedIndices[indices[i]]]];
-
- return elements;
- }
-
- /**
- * Sets the filter pattern. Current only prefix filter patterns are supported.
- * @param filter the filter pattern.
- */
- public void setFilter(String filter) {
- fFilter= (filter == null) ? "" : filter; //$NON-NLS-1$
-
- updateList();
- }
-
- private void updateList() {
- fFilteredCount= filter();
- fFoldedCount= fold();
-
- if (fUpdateThread != null)
- fUpdateThread.requestStop();
- fUpdateThread= new UpdateThread(new TableUpdater(fList, fFoldedCount));
- fUpdateThread.start();
- }
-
- /**
- * Returns the filter pattern.
- * @return returns the filter pattern.
- */
- public String getFilter() {
- return fFilter;
- }
-
- /**
- * 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.
- */
- 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;
-
- Object[] elements= new Object[count];
- for (int i= 0; i != count; i++)
- elements[i]= fElements[fFilteredIndices[start + i]];
-
- return elements;
- }
-
- /*
- * 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) {
- for (int i= 0; i != fFilteredCount; i++)
- fFoldedIndices[i]= i; // identity mapping
-
- return fFilteredCount;
-
- } else {
- int k= 0;
- Label last= null;
- for (int i= 0; i != fFilteredCount; i++) {
- int j= fFilteredIndices[i];
-
- Label current= fLabels[j];
- if (! current.equals(last)) {
- fFoldedIndices[k]= i;
- k++;
- last= current;
- }
- }
- return k;
- }
- }
-
- /*
- * Filters the list with the filter pattern.
- * @return returns the number of elements after filtering.
- */
- private int filter() {
- if (((fFilter == null) || (fFilter.length() == 0)) && !fMatchEmtpyString)
- return 0;
-
- fFilterMatcher.setFilter(fFilter.trim(), fIgnoreCase, false);
-
- int k= 0;
- for (int i= 0; i != fElements.length; i++) {
- if (fFilterMatcher.match(fElements[i]))
- fFilteredIndices[k++]= i;
- }
-
- return k;
- }
-
- private interface IncrementalRunnable extends Runnable {
- public int getCount();
- public void cancel();
- }
-
- private class TableUpdater implements IncrementalRunnable {
- private final Display fDisplay;
- private final Table fTable;
- private final int fCount;
- private int fIndex;
-
- public TableUpdater(Table table, int count) {
- fTable= table;
- fDisplay= table.getDisplay();
- fCount= count;
- }
-
- /*
- * @see IncrementalRunnable#getCount()
- */
- public int getCount() {
- return fCount + 1;
- }
-
- /*
- * @see IncrementalRunnable#cancel()
- */
- public void cancel() {
- fIndex= 0;
- }
-
- /*
- * @see Runnable#run()
- */
- public void run() {
- final int index= fIndex++;
-
- fDisplay.syncExec(new Runnable() {
- public void run() {
- if (fTable.isDisposed())
- return;
-
- final int itemCount= fTable.getItemCount();
-
- if (index < fCount) {
- final TableItem item= (index < itemCount)
- ? fTable.getItem(index)
- : new TableItem(fTable, SWT.NONE);
-
- final Label label= fLabels[fFilteredIndices[fFoldedIndices[index]]];
-
- item.setText(label.string);
- item.setImage(label.image);
-
- // select first item
- if (index == 0) {
- fTable.setSelection(0);
- fTable.notifyListeners(SWT.Selection, new Event());
- }
-
- // finish
- } else {
- if (fCount < itemCount) {
- fTable.setRedraw(false);
- fTable.remove(fCount, itemCount - 1);
- fTable.setRedraw(true);
- }
-
- // table empty -> no selection
- if (fCount == 0)
- fTable.notifyListeners(SWT.Selection, new Event());
- }
- }
- });
- }
- }
-
- private static class UpdateThread extends Thread {
-
- /** The incremental runnable */
- private final IncrementalRunnable fRunnable;
- /** A flag indicating a thread stop request */
- private boolean fStop;
-
- /**
- * Creates an update thread.
- */
- public UpdateThread(IncrementalRunnable runnable) {
- fRunnable= runnable;
- }
-
- /**
- * Requests the thread to stop.
- */
- public void requestStop() {
- fStop= true;
- }
-
- /**
- * @see Runnable#run()
- */
- public void run() {
- final int count= fRunnable.getCount();
- for (int i= 0; i != count; i++) {
- if (i % 50 == 0)
- try { Thread.sleep(10); } catch (InterruptedException e) {}
-
- if (fStop) {
- fRunnable.cancel();
- break;
- }
-
- fRunnable.run();
- }
- }
- }
-
-}
\ No newline at end of file
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
deleted file mode 100644
index 10c1f35..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IOverwriteQuery.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * 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.
- */
- public static final String CANCEL = "CANCEL"; //$NON-NLS-1$
-
- /**
- * Return code indicating the entity should not be overwritten,
- * but operation should not be canceled.
- */
- public static final String NO = "NO"; //$NON-NLS-1$
-
- /**
- * Return code indicating the entity should be overwritten.
- */
- public static final String YES = "YES"; //$NON-NLS-1$
-
- /**
- * Return code indicating the entity should be overwritten,
- * and all subsequent entities should be overwritten without prompting.
- */
- public static final 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.
- */
- public static final 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);
-}
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
deleted file mode 100644
index 4b0ca43..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionStatusValidator.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.dialogs;
-
-import org.eclipse.core.runtime.IStatus;
-
-/**
- * Used in selection dialogs to validate selections
- *
- * @since 2.0
- */
-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);
-
-}
\ No newline at end of file
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
deleted file mode 100644
index 52d29cb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ISelectionValidator.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * For validating selections in some selection dialogs.
- * <p>
- * Clients should implement this interface to define specialized selection
- * validators.
- * </p>
- *
- * @see ContainerSelectionDialog
- */
-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
- */
-public 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
deleted file mode 100644
index cda6513..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetEditWizard.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-package org.eclipse.ui.dialogs;
-
-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.
- * <p>
- * Use org.eclipse.ui.IWorkingSetManager#createWorkingSetEditWizard(IWorkingSet)
- * 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
- * @since 2.1
- */
-public interface IWorkingSetEditWizard extends IWizard {
- /**
- * Returns the working set edited in the wizard.
- *
- * @return the working set edited in the wizard.
- */
- public 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
deleted file mode 100644
index 44bf5f9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetPage.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 International Business Machines Corp. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ui.dialogs;
-
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkingSet;
-
-/**
- * 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.
- * </p>
- * <p>
- * Clients implementing this interface may subclass from
- * org.eclipse.jface.wizard.WizardPage.
- * </p>
- *
- * @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.
- */
- public 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.
- */
- public 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.
- */
- public 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
deleted file mode 100644
index 98b4bee..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/IWorkingSetSelectionDialog.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.ui.dialogs;
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkingSet;
-
-/**
- * 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.
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * @see org.eclipse.ui.IWorkingSetManager
- * @since 2.0
- */
-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.
- */
- public 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
- */
- public int open();
- /**
- * Sets the working sets that are initially selected in the dialog.
- *
- * @param workingSets the working sets to select in the dialog.
- */
- public void setSelection(IWorkingSet[] workingSets);
-}
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
deleted file mode 100644
index f2856e7..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ListSelectionDialog.java
+++ /dev/null
@@ -1,213 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * A standard dialog which solicits a list of selections from the user.
- * This class is configured with an arbitrary data model represented by content
- * and label provider objects. The <code>getResult</code> method returns the
- * selected elements.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * <p>
- * Example:
- * <pre>
- * ListSelectionDialog dlg =
- * new ListSelectionDialog(
- * getShell(),
- * input,
- * new WorkbenchContentProvider(),
- * new WorkbenchLabelProvider(),
- * "Select the resources to save.");
- * dlg.setInitialSelections(dirtyEditors);
- * dlg.setTitle("Save Resources");
- * dlg.open();
- * </pre>
- * </p>
- */
-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
- private CheckboxTableViewer listViewer;
-
- // sizing constants
- private final static int SIZING_SELECTION_WIDGET_HEIGHT = 250;
- private final static 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.getString("ListSelection.title")); //$NON-NLS-1$
- inputElement = input;
- this.contentProvider = contentProvider;
- this.labelProvider = labelProvider;
- if (message != null)
- setMessage(message);
- else
- setMessage(WorkbenchMessages.getString("ListSelection.message")); //$NON-NLS-1$
-}
-/**
- * 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);
- buttonComposite.setFont(composite.getFont());
- 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, SELECT_ALL_TITLE, false);
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(true);
- }
- };
- selectButton.addSelectionListener(listener);
-
-
- Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, DESELECT_ALL_TITLE, false);
-
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent 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();
-
- while (itemsToCheck.hasNext())
- listViewer.setChecked(itemsToCheck.next(),true);
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- WorkbenchHelp.setHelp(shell, IHelpContextIds.LIST_SELECTION_DIALOG);
-}
-
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- // page group
- Composite composite = (Composite)super.createDialogArea(parent);
-
- Font font = parent.getFont();
- composite.setFont(font);
-
- 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.setLabelProvider(labelProvider);
- listViewer.setContentProvider(contentProvider);
- listViewer.getControl().setFont(font);
-
- addSelectionButtons(composite);
-
- initializeViewer();
-
- // initialize page
- if (!getInitialElementSelections().isEmpty())
- checkInitialSelections();
-
- 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.
- */
-protected void okPressed() {
-
- // Get the input children.
- Object[] children = contentProvider.getElements(inputElement);
-
- // Build a list of selected children.
- if (children != null) {
- ArrayList list = new ArrayList();
- for (int i = 0; i < children.length; ++i) {
- Object element = children[i];
- if (listViewer.getChecked(element))
- list.add(element);
- }
- setResult(list);
- }
-
- super.okPressed();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/MarkerResolutionSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/MarkerResolutionSelectionDialog.java
deleted file mode 100644
index 6c470c1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/MarkerResolutionSelectionDialog.java
+++ /dev/null
@@ -1,133 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IMarkerResolution;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.dialogs.SimpleListContentProvider;
-import org.eclipse.ui.internal.misc.Assert;
-
-/**
- * Dialog to allow the user to select from a list of marker
- * resolutions.
- * <p>
- * This dialog may be instantiated, it is not intented to
- * be subclassed.
- * </p>
- *
- * @since 2.0
- */
-public class MarkerResolutionSelectionDialog extends SelectionDialog {
- /**
- * List width in characters.
- */
- private final static int LIST_WIDTH = 60;
- /**
- * List height in characters.
- */
- private final static int LIST_HEIGHT = 10;
- /**
- * The marker resolutions.
- */
- private IMarkerResolution[] resolutions;
- /**
- * List to display the resolutions.
- */
- private ListViewer listViewer;
-
- /**
- * Creates an instance of this dialog to display
- * the given resolutions.
- * <p>
- * There must be at least one resolution.
- * </p>
- *
- * @param shell the parent shell
- * @param markerResolutions the resolutions to display
- */
- public MarkerResolutionSelectionDialog(Shell shell, IMarkerResolution[] markerResolutions) {
- super(shell);
- Assert.isTrue(markerResolutions != null && markerResolutions.length > 0);
- resolutions = markerResolutions;
- setTitle(WorkbenchMessages.getString("MarkerResolutionSelectionDialog.title")); //$NON-NLS-1$
- setMessage(WorkbenchMessages.getString("MarkerResolutionSelectionDialog.messageLabel")); //$NON-NLS-1$
- setInitialSelections(new Object[]{markerResolutions[0]});
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- WorkbenchHelp.setHelp(newShell, IHelpContextIds.MARKER_RESOLUTION_SELECTION_DIALOG);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite)super.createDialogArea(parent);
-
- // Create label
- createMessageArea(composite);
- // Create list viewer
- listViewer = new ListViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = convertHeightInCharsToPixels(LIST_HEIGHT);
- data.widthHint = convertWidthInCharsToPixels(LIST_WIDTH);
- listViewer.getList().setLayoutData(data);
- // Set the label provider
- listViewer.setLabelProvider(new LabelProvider() {
- public String getText(Object element) {
- // Return the resolution's label.
- return element == null ? "" : ((IMarkerResolution)element).getLabel(); //$NON-NLS-1$
- }
- });
-
- // Set the content provider
- SimpleListContentProvider cp = new SimpleListContentProvider();
- cp.setElements(resolutions);
- listViewer.setContentProvider(cp);
- listViewer.setInput(new Object()); // it is ignored but must be non-null
-
- // Set the initial selection
- listViewer.setSelection(new StructuredSelection(getInitialElementSelections()), true);
-
- // Add a selection change listener
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- // Update OK button enablement
- getOkButton().setEnabled(!event.getSelection().isEmpty());
- }
- });
-
- // Add double-click listener
- listViewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- okPressed();
- }
- });
- return composite;
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void okPressed() {
- IStructuredSelection selection = (IStructuredSelection)listViewer.getSelection();
- setResult(selection.toList());
- super.okPressed();
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ProjectLocationMoveDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ProjectLocationMoveDialog.java
deleted file mode 100644
index 5fd0508..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ProjectLocationMoveDialog.java
+++ /dev/null
@@ -1,308 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.internal.*;
-import java.io.File;
-import java.util.ArrayList;
-
-/**
- * The ProjectLocationMoveDialog is the dialog used to select the
- * location of a project for moving.
- */
-public class ProjectLocationMoveDialog extends SelectionDialog {
- private IProject project;
- private IPath originalPath;
-
- // widgets
- private Text locationPathField;
- private Label locationLabel;
- private Label statusMessageLabel;
- private Button browseButton;
-
- private static String LOCATION_LABEL = WorkbenchMessages.getString("ProjectLocationSelectionDialog.locationLabel"); //$NON-NLS-1$
- private static String BROWSE_LABEL = WorkbenchMessages.getString("ProjectLocationSelectionDialog.browseLabel"); //$NON-NLS-1$
- private static String DIRECTORY_DIALOG_LABEL = WorkbenchMessages.getString("ProjectLocationSelectionDialog.directoryLabel"); //$NON-NLS-1$
- private static String INVALID_LOCATION_MESSAGE = WorkbenchMessages.getString("ProjectLocationSelectionDialog.locationError"); //$NON-NLS-1$
- private static String PROJECT_LOCATION_SELECTION_TITLE = WorkbenchMessages.getString("ProjectLocationSelectionDialog.selectionTitle"); //$NON-NLS-1$
-
- // constants
- private static final int SIZING_TEXT_FIELD_WIDTH = 250;
- private static final int SIZING_INDENTATION_WIDTH = 10;
-
- private boolean useDefaults = true;
-
-/**
- * Create a ProjectLocationMoveDialog on the supplied project parented by the parentShell.
- * @param parentShell
- * @param existingProject
- */
-public ProjectLocationMoveDialog(Shell parentShell, IProject existingProject) {
- super(parentShell);
- setTitle(PROJECT_LOCATION_SELECTION_TITLE);
- this.project = existingProject;
- try {
- this.originalPath = this.getProject().getDescription().getLocation();
- this.useDefaults = this.originalPath == null;
- } catch (CoreException exception) {
- // Leave it as the default.
- }
-}
-/**
- * Check the message. If it is null then continue otherwise inform the user via the
- * status value and disable the OK.
- * @param message - the error message to show if it is not null.
- */
-private void applyValidationResult(String errorMsg) {
-
- if (errorMsg == null) {
- statusMessageLabel.setText("");//$NON-NLS-1$
- statusMessageLabel.setToolTipText("");//$NON-NLS-1$
- getOkButton().setEnabled(true);
- } else {
- statusMessageLabel.setForeground(
- JFaceColors.getErrorText(
- statusMessageLabel.getDisplay()));
- statusMessageLabel.setText(errorMsg);
- statusMessageLabel.setToolTipText(errorMsg);
- getOkButton().setEnabled(false);
- }
-}
-/**
- * Check whether the entries are valid. If so return null. Otherwise
- * return a string that indicates the problem.
- */
-private String checkValid() {
- return checkValidLocation();
-}
-/**
- * Check if the entry in the widget location is valid. If it is valid return null.
- * Otherwise return a string that indicates the problem.
- */
-private String checkValidLocation() {
-
- if (useDefaults) {
- if (this.originalPath == null)
- return INVALID_LOCATION_MESSAGE;
- return null;
- }
- else {
- String locationFieldContents = locationPathField.getText();
- if (locationFieldContents.equals("")) {//$NON-NLS-1$
- return(WorkbenchMessages.getString("WizardNewProjectCreationPage.projectLocationEmpty")); //$NON-NLS-1$
- }
- else{
- IPath path = new Path("");//$NON-NLS-1$
- if (!path.isValidPath(locationFieldContents)) {
- return INVALID_LOCATION_MESSAGE;
- }
- }
-
- Path newPath = new Path(locationFieldContents);
- IStatus locationStatus =
- this.project.getWorkspace().validateProjectLocation(
- this.project,
- newPath);
-
- if (!locationStatus.isOK())
- return locationStatus.getMessage();
-
- if (originalPath != null && originalPath.equals(newPath)) {
- return INVALID_LOCATION_MESSAGE;
- }
-
- return null;
- }
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- WorkbenchHelp.setHelp(shell, IHelpContextIds.PROJECT_LOCATION_SELECTION_DIALOG);
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createContents(Composite parent) {
- Control content = super.createContents(parent);
- getOkButton().setEnabled(false);
- return content;
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- // page group
- Composite composite = (Composite) super.createDialogArea(parent);
-
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createProjectLocationGroup(composite);
-
- //Add in a label for status messages if required
- statusMessageLabel = new Label(composite, SWT.NONE);
- statusMessageLabel.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- return composite;
-}
-/**
- * Create the listener that is used to validate the location entered by the iser
- */
-private void createLocationListener() {
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- applyValidationResult(checkValid());
- }
- };
-
- this.locationPathField.addListener(SWT.Modify, listener);
-}
-/**
- * Creates the project location specification controls.
- *
- * @param parent the parent composite
- */
-private final void createProjectLocationGroup(Composite parent) {
-
- // project specification group
- Composite projectGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- final Button useDefaultsButton =
- new Button(projectGroup, SWT.CHECK | SWT.RIGHT);
- useDefaultsButton.setText(WorkbenchMessages.getString("ProjectLocationSelectionDialog.useDefaultLabel")); //$NON-NLS-1$
- useDefaultsButton.setSelection(this.useDefaults);
- GridData buttonData = new GridData();
- buttonData.horizontalSpan = 3;
- useDefaultsButton.setLayoutData(buttonData);
-
- createUserSpecifiedProjectLocationGroup(projectGroup, !this.useDefaults);
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- useDefaults = useDefaultsButton.getSelection();
- browseButton.setEnabled(!useDefaults);
- locationPathField.setEnabled(!useDefaults);
- locationLabel.setEnabled(!useDefaults);
- setLocationForSelection();
- if (!useDefaults) {
- if (originalPath != null)
- locationPathField.setText(originalPath.toOSString());
- else
- locationPathField.setText(""); //$NON-NLS-1$
- }
- }
- };
- useDefaultsButton.addSelectionListener(listener);
-}
-/**
- * Creates the project location specification controls.
- *
- * @return the parent of the widgets created
- * @param projectGroup the parent composite
- * @param enabled - sets the initial enabled state of the widgets
- */
-private Composite createUserSpecifiedProjectLocationGroup(Composite projectGroup, boolean enabled) {
-
- // location label
- locationLabel = new Label(projectGroup, SWT.NONE);
- locationLabel.setText(LOCATION_LABEL);
- locationLabel.setEnabled(enabled);
-
- // project location entry field
- locationPathField = new Text(projectGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- locationPathField.setLayoutData(data);
- locationPathField.setEnabled(enabled);
-
- // browse button
- this.browseButton = new Button(projectGroup, SWT.PUSH);
- this.browseButton.setText(BROWSE_LABEL);
- this.browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- handleLocationBrowseButtonPressed();
- }
- });
- this.browseButton.setEnabled(enabled);
-
- // Set the initial value first before listener
- // to avoid handling an event during the creation.
- if (originalPath == null)
- setLocationForSelection();
- else
- locationPathField.setText(originalPath.toOSString());
-
- createLocationListener();
- return projectGroup;
-
-}
-/**
- * Get the project being manipulated.
- */
-private IProject getProject() {
- return this.project;
-}
-/**
- * Open an appropriate directory browser
- */
-private void handleLocationBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell());
- dialog.setMessage(DIRECTORY_DIALOG_LABEL);
-
- String dirName = locationPathField.getText();
- if (!dirName.equals("")) {//$NON-NLS-1$
- File path = new File(dirName);
- if (path.exists())
- dialog.setFilterPath(dirName);
- }
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null)
- locationPathField.setText(selectedDirectory);
-}
-/**
- * The <code>ProjectLocationMoveDialog</code> implementation of this
- * <code>Dialog</code> method builds a two element list - the first element
- * is the project name and the second one is the location.
- */
-protected void okPressed() {
-
- ArrayList list = new ArrayList();
- list.add(getProject().getName());
- if(useDefaults)
- list.add(Platform.getLocation().toString());
- else
- list.add(this.locationPathField.getText());
- setResult(list);
- super.okPressed();
-}
-/**
- * Set the location to the default location if we are set to useDefaults.
- */
-private void setLocationForSelection() {
- if (useDefaults) {
- IPath defaultPath = Platform.getLocation().append(getProject().getName());
- locationPathField.setText(defaultPath.toOSString());
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ProjectLocationSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ProjectLocationSelectionDialog.java
deleted file mode 100644
index 09a5401..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ProjectLocationSelectionDialog.java
+++ /dev/null
@@ -1,390 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.File;
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * The ProjectLocationSelectionDialog is the dialog used to select the name
- * and location of a project for copying.
- */
-public class ProjectLocationSelectionDialog extends SelectionDialog {
- // widgets
- private Text projectNameField;
- private Text locationPathField;
- private Label locationLabel;
- private IProject project;
- private Label statusMessageLabel;
- private Button browseButton;
-
- private static String PROJECT_NAME_LABEL = WorkbenchMessages.getString("ProjectLocationSelectionDialog.nameLabel"); //$NON-NLS-1$
- private static String LOCATION_LABEL = WorkbenchMessages.getString("ProjectLocationSelectionDialog.locationLabel"); //$NON-NLS-1$
- private static String BROWSE_LABEL = WorkbenchMessages.getString("ProjectLocationSelectionDialog.browseLabel"); //$NON-NLS-1$
- private static String DIRECTORY_DIALOG_LABEL = WorkbenchMessages.getString("ProjectLocationSelectionDialog.directoryLabel"); //$NON-NLS-1$
- private static String INVALID_LOCATION_MESSAGE = WorkbenchMessages.getString("ProjectLocationSelectionDialog.locationError"); //$NON-NLS-1$
- private static String PROJECT_LOCATION_SELECTION_TITLE = WorkbenchMessages.getString("ProjectLocationSelectionDialog.selectionTitle"); //$NON-NLS-1$
-
- // constants
- private static final int SIZING_TEXT_FIELD_WIDTH = 250;
- private static final int SIZING_INDENTATION_WIDTH = 10;
-
- private boolean useDefaults = true;
-
-/**
- * Create a ProjectLocationSelectionDialog on the supplied project parented by the parentShell.
- * @param parentShell
- * @param existingProject
- */
-public ProjectLocationSelectionDialog(
- Shell parentShell,
- IProject existingProject) {
- super(parentShell);
- setTitle(PROJECT_LOCATION_SELECTION_TITLE);
- this.project = existingProject;
- try {
- this.useDefaults = this.getProject().getDescription().getLocation() == null;
- } catch (CoreException exception) {
- //Leave it as the default if we get a selection.
- }
-}
-/**
- * Check the message. If it is null then continue otherwise inform the user via the
- * status value and disable the OK.
- * @param message - the error message to show if it is not null.
- */
-private void applyValidationResult(String errorMsg) {
-
- if (errorMsg == null) {
- statusMessageLabel.setText("");//$NON-NLS-1$
- getOkButton().setEnabled(true);
- } else {
- statusMessageLabel.setForeground(
- JFaceColors.getErrorText(
- statusMessageLabel.getDisplay()));
- statusMessageLabel.setText(errorMsg);
- getOkButton().setEnabled(false);
- }
-}
-/**
- * Check whether the entries are valid. If so return null. Otherwise
- * return a string that indicates the problem.
- */
-private String checkValid() {
- String valid = checkValidName();
- if (valid != null)
- return valid;
- return checkValidLocation();
-}
-/**
- * Check if the entry in the widget location is valid. If it is valid return null. Otherwise
- * return a string that indicates the problem.
- */
-private String checkValidLocation() {
-
- if (useDefaults)
- return null;
- else {
- String locationFieldContents = locationPathField.getText();
- if (locationFieldContents.equals("")) {//$NON-NLS-1$
- return(WorkbenchMessages.getString("WizardNewProjectCreationPage.projectLocationEmpty")); //$NON-NLS-1$
- }
- else{
- IPath path = new Path("");//$NON-NLS-1$
- if (!path.isValidPath(locationFieldContents)) {
- return INVALID_LOCATION_MESSAGE;
- }
- }
-
- IStatus locationStatus =
- this.project.getWorkspace().validateProjectLocation(
- this.project,
- new Path(locationFieldContents));
-
- if (!locationStatus.isOK())
- return locationStatus.getMessage();
-
- return null;
- }
-}
-/**
- * Check if the entries in the widget are valid. If they are return null otherwise
- * return a string that indicates the problem.
- */
-private String checkValidName() {
-
- String name = this.projectNameField.getText();
- IWorkspace workspace = getProject().getWorkspace();
- IStatus nameStatus = workspace.validateName(name, IResource.PROJECT);
- if (!nameStatus.isOK())
- return nameStatus.getMessage();
- IProject newProject = workspace.getRoot().getProject(name);
- if (newProject.exists()) {
- return WorkbenchMessages.format("CopyProjectAction.alreadyExists", new Object[] { name }); //$NON-NLS-1$
- }
-
- return null;
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- WorkbenchHelp.setHelp(shell, IHelpContextIds.PROJECT_LOCATION_SELECTION_DIALOG);
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- // page group
- Composite composite = (Composite) super.createDialogArea(parent);
-
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createProjectNameGroup(composite);
- createProjectLocationGroup(composite);
-
- //Add in a label for status messages if required
- statusMessageLabel = new Label(composite, SWT.NONE);
- statusMessageLabel.setLayoutData(new GridData(GridData.FILL_BOTH));
- statusMessageLabel.setFont(parent.getFont());
-
- return composite;
-}
-/**
- * Create the listener that is used to validate the location entered by the iser
- */
-private void createLocationListener() {
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
-
- applyValidationResult(checkValid());
- }
- };
-
- this.locationPathField.addListener(SWT.Modify, listener);
-}
-/**
- * Create the listener that is used to validate the entries for the receiver
- */
-private void createNameListener() {
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- setLocationForSelection();
- applyValidationResult(checkValid());
- }
- };
-
- this.projectNameField.addListener(SWT.Modify, listener);
-}
-/**
- * Creates the project location specification controls.
- *
- * @param parent the parent composite
- */
-private final void createProjectLocationGroup(Composite parent) {
-
- // project specification group
- Composite projectGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- final Button useDefaultsButton =
- new Button(projectGroup, SWT.CHECK | SWT.RIGHT);
- useDefaultsButton.setText(WorkbenchMessages.getString("ProjectLocationSelectionDialog.useDefaultLabel")); //$NON-NLS-1$
- useDefaultsButton.setSelection(this.useDefaults);
- GridData buttonData = new GridData();
- buttonData.horizontalSpan = 3;
- useDefaultsButton.setLayoutData(buttonData);
-
- createUserSpecifiedProjectLocationGroup(projectGroup, !this.useDefaults);
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- useDefaults = useDefaultsButton.getSelection();
- browseButton.setEnabled(!useDefaults);
- locationPathField.setEnabled(!useDefaults);
- locationLabel.setEnabled(!useDefaults);
- setLocationForSelection();
- if (!useDefaults)
- locationPathField.setText(""); //$NON-NLS-1$
- }
- };
- useDefaultsButton.addSelectionListener(listener);
-}
-/**
- * Creates the project name specification controls.
- *
- * @param parent the parent composite
- */
-private void createProjectNameGroup(Composite parent) {
- // project specification group
- Composite projectGroup = new Composite(parent,SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // new project label
- Label projectLabel = new Label(projectGroup,SWT.NONE);
- projectLabel.setText(PROJECT_NAME_LABEL);
-
- // new project name entry field
- projectNameField = new Text(projectGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- projectNameField.setLayoutData(data);
-
- // Set the initial value first before listener
- // to avoid handling an event during the creation.
- projectNameField.setText(getCopyNameFor(getProject().getName()));
- projectNameField.selectAll();
-
- createNameListener();
-
-}
-/**
- * Creates the project location specification controls.
- *
- * @return the parent of the widgets created
- * @param projectGroup the parent composite
- * @param enabled - sets the initial enabled state of the widgets
- */
-private Composite createUserSpecifiedProjectLocationGroup(
- Composite projectGroup,
- boolean enabled) {
-
- // location label
- locationLabel = new Label(projectGroup, SWT.NONE);
- locationLabel.setText(LOCATION_LABEL);
- locationLabel.setEnabled(enabled);
-
- // project location entry field
- locationPathField = new Text(projectGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- locationPathField.setLayoutData(data);
- locationPathField.setEnabled(enabled);
-
- // browse button
- this.browseButton = new Button(projectGroup, SWT.PUSH);
- this.browseButton.setText(BROWSE_LABEL);
- this.browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- handleLocationBrowseButtonPressed();
- }
- });
- this.browseButton.setEnabled(enabled);
-
- // Set the initial value first before listener
- // to avoid handling an event during the creation.
- try {
- IPath location = this.getProject().getDescription().getLocation();
- if (location == null)
- setLocationForSelection();
- else
- locationPathField.setText(location.toString());
- } catch (CoreException exception) {
- //Set it to the default if possible as there is no info yet
- setLocationForSelection();
- }
-
- createLocationListener();
- return projectGroup;
-
-}
-/**
- * Generates a new name for the project that does not have any collisions.
- */
-private String getCopyNameFor(String projectName) {
-
- IWorkspace workspace = getProject().getWorkspace();
- if (!workspace.getRoot().getProject(projectName).exists())
- return projectName;
-
- int counter = 1;
- while (true) {
- String nameSegment;
- if (counter > 1) {
- nameSegment = WorkbenchMessages.format(WorkbenchMessages.getString("CopyProjectAction.copyNameTwoArgs"), new Object[] {new Integer(counter), projectName}); //$NON-NLS-1$
- }
- else {
- nameSegment = WorkbenchMessages.format(WorkbenchMessages.getString("CopyProjectAction.copyNameOneArg"), new Object[] {projectName}); //$NON-NLS-1$
- }
-
- if (!workspace.getRoot().getProject(nameSegment).exists())
- return nameSegment;
-
- counter++;
- }
-
-}
-/**
- * Get the project being manipulated.
- */
-private IProject getProject() {
- return this.project;
-}
-/**
- * Open an appropriate directory browser
- */
-private void handleLocationBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell());
- dialog.setMessage(DIRECTORY_DIALOG_LABEL);
-
- String dirName = locationPathField.getText();
- if (!dirName.equals("")) {//$NON-NLS-1$
- File path = new File(dirName);
- if (path.exists())
- dialog.setFilterPath(dirName);
- }
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null)
- locationPathField.setText(selectedDirectory);
-}
-/**
- * The <code>ProjectLocationSelectionDialog</code> implementation of this
- * <code>Dialog</code> method builds a two element list - the first element
- * is the project name and the second one is the location.
- */
-protected void okPressed() {
-
- ArrayList list = new ArrayList();
- list.add(this.projectNameField.getText());
- if(useDefaults)
- list.add(Platform.getLocation().toString());
- else
- list.add(this.locationPathField.getText());
- setResult(list);
- super.okPressed();
-}
-/**
- * Set the location to the default location if we are set to useDefaults.
- */
-private void setLocationForSelection() {
- if (useDefaults) {
- IPath defaultPath = Platform.getLocation().append(projectNameField.getText());
- locationPathField.setText(defaultPath.toOSString());
- }
-}
-}
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
deleted file mode 100644
index 1e1dd0e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyDialogAction.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.internal.dialogs.PropertyPageContributorManager;
-import org.eclipse.ui.internal.dialogs.PropertyPageManager;
-import org.eclipse.ui.internal.dialogs.PropertyDialog;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.SelectionProviderAction;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.preference.PreferenceManager;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.widgets.Shell;
-import java.util.*;
-
-/**
- * Standard action for opening a Property Pages Dialog on the currently selected
- * element.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * <p>
- * Generally speaking, this action is useful in pop-up menus because it allows
- * the user to browse and change properties of selected elements. When performed,
- * the action will bring up a Property Pages Dialog containing property pages
- * registered with the workbench for elements of the selected type.
- * </p>
- * <p>
- * Although the action is capable of calculating if there are any applicable
- * pages for the current selection, this calculation is costly because it
- * require searching the workbench registry. Where performance is critical, the
- * 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>
- */
-public class PropertyDialogAction extends SelectionProviderAction {
-
- /**
- * The shell in which to open the property dialog.
- */
- private Shell shell;
-/**
- * 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
- */
-public PropertyDialogAction(Shell shell, ISelectionProvider provider) {
- super(provider, WorkbenchMessages.getString("PropertyDialog.text")); //$NON-NLS-1$
- Assert.isNotNull(shell);
- this.shell = shell;
- setToolTipText(WorkbenchMessages.getString("PropertyDialog.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.PROPERTY_DIALOG_ACTION);
-}
-/**
- * Returns the name of the given element.
- *
- * @param element the element
- * @return the name of the element
- */
-private String getName(IAdaptable element) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter)element.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- return adapter.getLabel(element);
- } else {
- return "";//$NON-NLS-1$
- }
-}
-/**
- * Returns whether the provided object has pages registered in the property page
- * manager.
- */
-private boolean hasPropertyPagesFor(Object object) {
- PropertyPageContributorManager manager = PropertyPageContributorManager.getManager();
- return manager.hasContributorsFor(object);
-}
-/**
- * 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.
- * </p>
- *
- * @return <code>true</code> if the selection is of size 1 and there are
- * property pages for the selected element, and <code>false</code> otherwise
- */
-public boolean isApplicableForSelection() {
- if (!isEnabled()) return false;
- return isApplicableForSelection(getStructuredSelection());
-}
-
-/**
- * Returns whether this action is applicable to the current selection.
- * This checks that the selection is of size 1, and checks 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.
- * </p>
- *
- * @return <code>true</code> if the selection is of size 1 and there are
- * property pages for the selected element, and <code>false</code> otherwise
- */
-public boolean isApplicableForSelection(IStructuredSelection selection) {
- return selection.size() == 1 && hasPropertyPagesFor(selection.getFirstElement());
-}
-
-/**
- * The <code>PropertyDialogAction</code> implementation of this
- * <code>IAction</code> method performs the action by opening the Property Page
- * Dialog for the current selection. If no pages are found, an informative
- * message dialog is presented instead.
- */
-public void run() {
- PropertyPageManager pageManager = new PropertyPageManager();
- String title = "";//$NON-NLS-1$
-
- // get selection
- IAdaptable element = (IAdaptable) getStructuredSelection().getFirstElement();
- if (element == null)
- return;
-
- // load pages for the selection
- // fill the manager with contributions from the matching contributors
- PropertyPageContributorManager.getManager().contribute(pageManager, element);
-
- // testing if there are pages in the manager
- Iterator pages = pageManager.getElements(PreferenceManager.PRE_ORDER).iterator();
- String name = getName(element);
- if (!pages.hasNext()) {
- MessageDialog.openInformation(
- shell,
- WorkbenchMessages.getString("PropertyDialog.messageTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("PropertyDialog.noPropertyMessage", new Object[] {name})); //$NON-NLS-1$
- return;
- } else
- title = WorkbenchMessages.format("PropertyDialog.propertyMessage", new Object[] {name}); //$NON-NLS-1$
-
- PropertyDialog propertyDialog = new PropertyDialog(shell, pageManager, getStructuredSelection());
- propertyDialog.create();
- propertyDialog.getShell().setText(title);
- WorkbenchHelp.setHelp(propertyDialog.getShell(), IHelpContextIds.PROPERTY_DIALOG);
- propertyDialog.open();
-}
-/**
- * The <code>PropertyDialogAction</code> implementation of this
- * <code>SelectionProviderAction</code> method enables the action only if the
- * given selection contains exactly one element.
- */
-public void selectionChanged(IStructuredSelection selection) {
- setEnabled(selection.size() == 1 && selection.getFirstElement() != null);
-}
-}
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
deleted file mode 100644
index 175f803..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/PropertyPage.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.ui.IWorkbenchPropertyPage;
-
-/**
- * Abstract base implementation of a workbench property page
- * (<code>IWorkbenchPropertyPage</code>).
- * The implementation is a JFace preference page with an adapatable element.
- * <p>
- * Subclasses must implement the <code>createContents</code> framework
- * method to supply the property page's main control.
- * </p>
- * <p>
- * Subclasses should extend the <code>doComputeSize</code> framework
- * method to 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.
- * </p>
- * <p>
- * Subclasses may call the <code>noDefaultAndApplyButton</code> framework
- * method before the page's control has been created to suppress
- * the standard Apply and Defaults buttons.
- * </p>
- *
- * @see IWorkbenchPropertyPage
- */
-public abstract class PropertyPage extends PreferencePage implements IWorkbenchPropertyPage {
-
- /**
- * The element.
- */
- private IAdaptable element;
-/**
- * Creates a new property page.
- */
-public PropertyPage() {}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPropertyPage.
- */
-public IAdaptable getElement() {
- return element;
-}
-/**
- * Sets the element that owns properties shown on this page.
- *
- * @param element the element
- */
-public void setElement(IAdaptable element) {
- this.element = element;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ResourceSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ResourceSelectionDialog.java
deleted file mode 100644
index ddcc5ce..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/ResourceSelectionDialog.java
+++ /dev/null
@@ -1,205 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.internal.misc.CheckboxTreeAndListGroup;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.model.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.events.ControlEvent;
-import org.eclipse.swt.events.ControlListener;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import java.util.Iterator;
-import java.util.ArrayList;
-
-/**
- * A standard resource selection dialog which solicits a list of resources from
- * the user. The <code>getResult</code> method returns the selected resources.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * <p>
- * Example:
- * <pre>
- * ResourceSelectionDialog dialog =
- * new ResourceSelectionDialog(getShell(), rootResource, msg);
- * dialog.setInitialSelections(selectedResources));
- * dialog.open();
- * return dialog.getResult();
- * </pre>
- * </p>
- */
-public class ResourceSelectionDialog extends SelectionDialog {
- // the root element to populate the viewer with
- private IAdaptable root;
-
- // the visual selection widget group
- private CheckboxTreeAndListGroup selectionGroup;
- // constants
- private final static int SIZING_SELECTION_WIDGET_WIDTH = 400;
- private final static int SIZING_SELECTION_WIDGET_HEIGHT = 300;
-/**
- * Creates a resource selection dialog rooted at the given element.
- *
- * @param parentShell the parent shell
- * @param rootElement the root element to populate this dialog with
- * @param message the message to be displayed at the top of this dialog, or
- * <code>null</code> to display a default message
- */
-public ResourceSelectionDialog(Shell parentShell, IAdaptable rootElement, String message) {
- super(parentShell);
- setTitle(WorkbenchMessages.getString("ResourceSelectionDialog.title")); //$NON-NLS-1$
- root = rootElement;
- if (message != null)
- setMessage(message);
- else
- setMessage(WorkbenchMessages.getString("ResourceSelectionDialog.message")); //$NON-NLS-1$
- setShellStyle(getShellStyle() | SWT.RESIZE);
-}
-/**
- * Visually checks the previously-specified elements in the container (left)
- * portion of this dialog's resource selection viewer.
- */
-private void checkInitialSelections() {
- Iterator itemsToCheck = getInitialElementSelections().iterator();
-
- while (itemsToCheck.hasNext()) {
- IResource currentElement = (IResource)itemsToCheck.next();
-
- if (currentElement.getType() == IResource.FILE)
- selectionGroup.initialCheckListItem(currentElement);
- else
- selectionGroup.initialCheckTreeItem(currentElement);
- }
-}
-/* (non-Javadoc)
- * Method declared on ICheckStateListener.
- */
-public void checkStateChanged(CheckStateChangedEvent event) {
- getOkButton().setEnabled(selectionGroup.getCheckedElementCount() > 0);
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- WorkbenchHelp.setHelp(shell, IHelpContextIds.RESOURCE_SELECTION_DIALOG);
-}
-public void create() {
- super.create();
- initializeDialog();
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- // page group
- Composite composite = (Composite) super.createDialogArea(parent);
-
- //create the input element, which has the root resource
- //as its only child
- ArrayList input = new ArrayList();
- input.add(root);
-
- createMessageArea(composite);
- selectionGroup =
- new CheckboxTreeAndListGroup(
- composite,
- input,
- getResourceProvider(IResource.FOLDER | IResource.PROJECT | IResource.ROOT),
- new WorkbenchLabelProvider(),
- getResourceProvider(IResource.FILE),
- new WorkbenchLabelProvider(),
- SWT.NONE,
- // since this page has no other significantly-sized
- // widgets we need to hardcode the combined widget's
- // size, otherwise it will open too small
- SIZING_SELECTION_WIDGET_WIDTH,
- SIZING_SELECTION_WIDGET_HEIGHT);
-
- composite.addControlListener(new ControlListener() {
- public void controlMoved(ControlEvent e) {};
- public void controlResized(ControlEvent e) {
- //Also try and reset the size of the columns as appropriate
- TableColumn[] columns = selectionGroup.getListTable().getColumns();
- for (int i = 0; i < columns.length; i++) {
- columns[i].pack();
- }
- }
- });
-
- return composite;
-}
-/**
- * Returns a content provider for <code>IResource</code>s that returns
- * only children of the given resource type.
- */
-private ITreeContentProvider getResourceProvider(final int resourceType) {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof IContainer) {
- IResource[] members = null;
- try {
- members = ((IContainer)o).members();
- } catch (CoreException e) {
- //just return an empty set of children
- return new Object[0];
- }
-
- //filter out the desired resource types
- ArrayList results = new ArrayList();
- for (int i = 0; i < members.length; i++) {
- //And the test bits with the resource types to see if they are what we want
- if ((members[i].getType() & resourceType) > 0) {
- results.add(members[i]);
- }
- }
- return results.toArray();
- } else {
- //input element case
- if (o instanceof ArrayList) {
- return ((ArrayList)o).toArray();
- } else {
- return new Object[0];
- }
- }
- }
- };
-}
-/**
- * Initializes this dialog's controls.
- */
-private void initializeDialog() {
- selectionGroup.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- getOkButton().setEnabled(selectionGroup.getCheckedElementCount() > 0);
- }
- });
-
- if (getInitialElementSelections().isEmpty())
- getOkButton().setEnabled(false);
- else
- checkInitialSelections();
-}
-/**
- * The <code>ResourceSelectionDialog</code> implementation of this
- * <code>Dialog</code> method builds a list of the selected resources for later
- * retrieval by the client and closes this dialog.
- */
-protected void okPressed() {
- Iterator resultEnum = selectionGroup.getAllCheckedListItems();
- ArrayList list = new ArrayList();
- while (resultEnum.hasNext())
- list.add(resultEnum.next());
- setResult(list);
- super.okPressed();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SaveAsDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SaveAsDialog.java
deleted file mode 100644
index bba617a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SaveAsDialog.java
+++ /dev/null
@@ -1,264 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Bob Foster <bob@objfac.com>
- - Fix for bug 23025 - SaveAsDialog should not assume what is being saved is an IFile
-**********************************************************************/
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.misc.ResourceAndContainerGroup;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog; // disambiguate from SWT
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.Image;
-import java.util.*;
-
-/**
- * A standard "Save As" dialog which solicits a path from the user. The
- * <code>getResult</code> method returns the path. Note that the folder
- * at the specified path might not exist and might need to be created.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- *
- * @see IFile#create
- * @see ContainerGenerator
- */
-public class SaveAsDialog extends TitleAreaDialog {
- private IStructuredSelection currentSelection;
- private IContainer currentParent;
- private int lastContainerSegmentCount = 0;
- private IFile originalFile = null;
- private String originalName = null;
- private IPath result;
-
- // widgets
- private ResourceAndContainerGroup resourceGroup;
- private Button okButton;
- private Button cancelButton;
-
- /**
- * Image for title area
- */
- private Image dlgTitleImage = null;
-
-/**
- * Creates a new Save As dialog for no specific file.
- *
- * @param parentShell the parent shell
- */
-public SaveAsDialog(Shell parentShell) {
- super(parentShell);
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(WorkbenchMessages.getString("SaveAsDialog.text")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(shell, IHelpContextIds.SAVE_AS_DIALOG);
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected Control createContents(Composite parent) {
-
- Control contents = super.createContents(parent);
-
- initializeControls();
- validatePage();
- resourceGroup.setFocus();
- setTitle(WorkbenchMessages.getString("SaveAsDialog.title")); //$NON-NLS-1$
- dlgTitleImage = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_DLGBAN_SAVEAS_DLG).createImage();
- setTitleImage(dlgTitleImage);
- setMessage(WorkbenchMessages.getString("SaveAsDialog.message")); //$NON-NLS-1$
-
- return contents;
-}
-/**
- * The <code>SaveAsDialog</code> implementation of this <code>Window</code>
- * method disposes of the banner image when the dialog is closed.
- */
-public boolean close() {
- if (dlgTitleImage != null)
- dlgTitleImage.dispose();
- return super.close();
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void createButtonsForButtonBar(Composite parent) {
- okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- // top level composite
- Composite parentComposite = (Composite)super.createDialogArea(parent);
-
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parentComposite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
- composite.setFont(parentComposite.getFont());
-
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- setDialogComplete(validatePage());
- }
- };
-
- resourceGroup = new ResourceAndContainerGroup(composite, listener, WorkbenchMessages.getString("SaveAsDialog.fileLabel"), WorkbenchMessages.getString("SaveAsDialog.file")); //$NON-NLS-2$ //$NON-NLS-1$
- resourceGroup.setAllowExistingResources(true);
-
- return parentComposite;
-}
-/**
- * Returns the full path entered by the user.
- * <p>
- * Note that the file and container might not exist and would need to be created.
- * See the <code>IFile.create</code> method and the
- * <code>ContainerGenerator</code> class.
- * </p>
- *
- * @return the path, or <code>null</code> if Cancel was pressed
- */
-public IPath getResult() {
- return result;
-}
-/**
- * Initializes the controls of this dialog.
- */
-private void initializeControls() {
- if (originalFile != null) {
- resourceGroup.setContainerFullPath(originalFile.getParent().getFullPath());
- resourceGroup.setResource(originalFile.getName());
- }
- else if (originalName != null)
- resourceGroup.setResource(originalName);
- setDialogComplete(validatePage());
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void okPressed() {
- // Get new path.
- IPath path = resourceGroup.getContainerFullPath().append(resourceGroup.getResource());
-
-
- //If the user does not supply a file extension and if the save
- //as dialog was provided a default file name append the extension
- //of the default filename to the new name
- if(path.getFileExtension() == null) {
- if (originalFile != null && originalFile.getFileExtension() != null)
- path = path.addFileExtension(originalFile.getFileExtension());
- else if (originalName != null) {
- int pos = originalName.lastIndexOf('.');
- if (++pos > 0 && pos < originalName.length())
- path = path.addFileExtension(originalName.substring(pos));
- }
- }
-
- // If the path already exists then confirm overwrite.
- IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- if (file.exists()) {
- String [] buttons= new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL
- };
- String question = WorkbenchMessages.format("SaveAsDialog.overwriteQuestion", //$NON-NLS-1$
- new Object[] { path.toOSString() } );
- MessageDialog d= new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("Question"), //$NON-NLS-1$
- null,
- question,
- MessageDialog.QUESTION,
- buttons,
- 0
- );
- int overwrite = d.open();
- switch (overwrite) {
- case 0: // Yes
- break;
- case 1: // No
- return;
- case 2: // Cancel
- default:
- cancelPressed();
- return;
- }
- }
-
- // Store path and close.
- result = path;
- close();
-}
-/**
- * Sets the completion state of this dialog and adjusts the enable state of
- * the Ok button accordingly.
- *
- * @param value <code>true</code> if this dialog is compelete, and
- * <code>false</code> otherwise
- */
-protected void setDialogComplete(boolean value) {
- okButton.setEnabled(value);
-}
-/**
- * Sets the original file to use.
- *
- * @param originalFile the original file
- */
-public void setOriginalFile(IFile originalFile) {
- this.originalFile = originalFile;
-}
-/**
- * Set the original file name to use.
- * Used instead of <code>setOriginalFile</code>
- * when the original resource is not an IFile.
- * Must be called before <code>create</code>.
- * @param originalName default file name
- */
-public void setOriginalName(String originalName) {
- this.originalName = originalName;
-}
-/**
- * Returns whether this page's visual components all contain valid values.
- *
- * @return <code>true</code> if valid, and <code>false</code> otherwise
- */
-private boolean validatePage() {
- setErrorMessage(null);
-
- if (!resourceGroup.areAllValuesValid()) {
- if (!resourceGroup.getResource().equals("")) // if blank name then fail silently//$NON-NLS-1$
- setErrorMessage(resourceGroup.getProblemMessage());
- return false;
- }
-
- return true;
-}
-}
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
deleted file mode 100644
index 6e64622..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionDialog.java
+++ /dev/null
Binary files differ
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
deleted file mode 100644
index 20f0ba6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionStatusDialog.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.dialogs;
-
-import java.util.Arrays;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.core.runtime.IStatus;
-
-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.
- *
- * @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>.
- */
- 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.
- */
- 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();
-
- /*
- * @see Window#configureShell(shell)
- */
- protected void configureShell(Shell shell) {
- 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.
- */
- 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.
- */
- protected void updateButtonsEnableState(IStatus status) {
- Button okButton= getOkButton();
- if (okButton != null && !okButton.isDisposed())
- okButton.setEnabled(!status.matches(IStatus.ERROR));
- }
-
- /*
- * @see Dialog#okPressed()
- */
- protected void okPressed() {
- computeResult();
- super.okPressed();
- }
-
- /*
- * @see Window#create()
- */
- public void create() {
- super.create();
- if (fLastStatus != null)
- updateStatus(fLastStatus);
- }
-
- /*
- * @see Dialog#createButtonBar(Composite)
- */
- protected Control createButtonBar(Composite parent) {
- Composite composite= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- if (fStatusLineAboveButtons) {
- layout.marginWidth= 5;
- } else {
- layout.numColumns= 2;
- }
- layout.marginHeight= 0; layout.marginWidth= 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- fStatusLine= new MessageLine(composite);
- fStatusLine.setAlignment(SWT.LEFT);
- fStatusLine.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- fStatusLine.setErrorStatus(null); //$NON-NLS-1$
-
- GridData gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalIndent= convertWidthInCharsToPixels(1);
- fStatusLine.setLayoutData(gd);
-
- super.createButtonBar(composite);
- return composite;
- }
-
-}
\ No newline at end of file
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
deleted file mode 100644
index 28488a1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoArrayQuickSorter.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.dialogs;
-
-import java.util.Comparator;
-
-import org.eclipse.jface.util.Assert;
-
-/**
- * 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;
-
- /**
- * Default comparator.
- */
- public static final class StringComparator implements Comparator {
- private boolean fIgnoreCase;
-
- StringComparator(boolean ignoreCase) {
- fIgnoreCase= ignoreCase;
- }
-
- 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;
-
- 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;
-
- Object mid= keys[(left + right) / 2];
- do {
- while (fComparator.compare(keys[left], mid) < 0)
- left++;
-
- 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 (original_left < right)
- internalSort(keys , values, original_left, 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;
- }
-
-}
\ No newline at end of file
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
deleted file mode 100644
index 0b9d62e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TwoPaneElementSelector.java
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.dialogs;
-
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-
-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).
- *
- * @since 2.0
- */
-public class TwoPaneElementSelector extends AbstractElementListSelectionDialog {
-
- private String fUpperListLabel;
- private String fLowerListLabel;
- private ILabelProvider fQualifierRenderer;
- private Object[] fElements= new Object[0];
-
- private Table fLowerList;
- private Object[] fQualifierElements;
-
- /**
- * Creates the two pane element selector.
- * @param paren the parent shell.
- * @param elementRenderer the element renderer.
- * @param qualifier 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.
- */
- public void setUpperListLabel(String label) {
- fUpperListLabel= label;
- }
-
- /**
- * Sets the lower list label. If the label is <code>null</code> (default),
- * no label is created.
- */
- public void setLowerListLabel(String label) {
- fLowerListLabel= label;
- }
-
- /**
- * Sets the elements to be displayed.
- * @param elements the elements to be displayed.
- */
- public void setElements(Object[] elements) {
- fElements= elements;
- }
-
- /**
- * @see Dialog#createDialogArea(Composite)
- */
- 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)
- return null;
-
- Label label= new Label(parent, SWT.NONE);
- label.setText(name);
-
- 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, new Listener() {
- public void handleEvent(Event evt) {
- handleLowerSelectionChanged();
- }
- });
-
- list.addListener(SWT.MouseDoubleClick, new Listener() {
- public void handleEvent(Event evt) {
- handleDefaultSelected();
- }
- });
-
- list.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent 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);
-
- fLowerList= list;
-
- return list;
- }
-
- /**
- * @see SelectionStatusDialog#computeResult()
- */
- protected void computeResult() {
- Object[] results= new Object[] {getLowerSelectedElement()};
- setResult(Arrays.asList(results));
- }
-
- /**
- * @see AbstractElementListSelectionDialog#handleDefaultSelected()
- */
- protected void handleDefaultSelected() {
- if (validateCurrentSelection() && (getLowerSelectedElement() != null))
- buttonPressed(IDialogConstants.OK_ID);
- }
-
- /**
- * @see AbstractElementListSelectionDialog#handleSelectionChanged()
- */
- protected void handleSelectionChanged() {
- super.handleSelectionChanged();
- handleUpperSelectionChanged();
- }
-
- private void handleUpperSelectionChanged() {
- int index= getSelectionIndex();
-
- fLowerList.removeAll();
-
- if (index < 0)
- return;
-
- fQualifierElements= getFoldedElements(index);
- if (fQualifierElements == null)
- updateLowerListWidget(new Object[] {});
- else
- updateLowerListWidget(fQualifierElements);
-
- updateOkState();
- }
-
- private void handleLowerSelectionChanged() {
- updateOkState();
- }
-
- /**
- * Selects an element in the lower pane.
- */
- protected void setLowerSelectedElement(Object element) {
- if (fQualifierElements == null)
- return;
-
- // find matching index
- int i;
- for (i= 0; i != fQualifierElements.length; i++)
- if (fQualifierElements[i].equals(element))
- break;
-
- // set selection
- if (i != fQualifierElements.length)
- fLowerList.setSelection(i);
- }
-
- /**
- * Returns the selected element from the lower pane.
- */
- protected Object getLowerSelectedElement() {
- int index= fLowerList.getSelectionIndex();
-
- if (index >= 0)
- return fQualifierElements[index];
-
- return null;
- }
-
- private void updateOkState() {
- Button okButton= getOkButton();
- if (okButton != null)
- okButton.setEnabled(getSelectedElements().length != 0);
- }
-
- private void updateLowerListWidget(Object[] elements) {
- int length= elements.length;
-
- String[] qualifiers= new String[length];
- for (int i= 0; i != length; i++)
- qualifiers[i]= fQualifierRenderer.getText(elements[i]);
-
- TwoArrayQuickSorter sorter= new TwoArrayQuickSorter(isCaseIgnored());
- 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()
- */
- protected void handleEmptyList() {
- super.handleEmptyList();
- fLowerList.setEnabled(false);
- }
-
-}
\ No newline at end of file
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
deleted file mode 100644
index d7f448b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/TypeFilteringDialog.java
+++ /dev/null
@@ -1,284 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IFileEditorMapping;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * The TypeSelectionDialog is a SelectionDialog that allows the user to select a file editor.
- */
-public class TypeFilteringDialog extends SelectionDialog {
- Button addTypesButton;
-
- Collection initialSelections;
-
- // the visual selection widget group
- private CheckboxTableViewer listViewer;
-
- // sizing constants
- private final static int SIZING_SELECTION_WIDGET_HEIGHT = 250;
- private final static int SIZING_SELECTION_WIDGET_WIDTH = 300;
-
- private final static String TYPE_DELIMITER = WorkbenchMessages.getString("TypesFiltering.typeDelimiter"); //$NON-NLS-1$
-
- //Define a title for the filter entry field.
- private String filterTitle = WorkbenchMessages.getString("TypesFiltering.otherExtensions");
-
-
- Text userDefinedText;
-
- IFileEditorMapping[] currentInput;
-/**
- * Creates a type selection dialog using the supplied entries. Set the initial selections to those
- * whose extensions match the preselections.
- * @param Shell
- * @param Collection of String - a Collection of String to define the preselected types
- */
-public TypeFilteringDialog(Shell parentShell, Collection preselections) {
- super(parentShell);
- setTitle(WorkbenchMessages.getString("TypesFiltering.title")); //$NON-NLS-1$
- this.initialSelections = preselections;
- setMessage(WorkbenchMessages.getString("TypesFiltering.message")); //$NON-NLS-1$
-}
-
-/**
- * Creates a type selection dialog using the supplied entries. Set the initial selections to those
- * whose extensions match the preselections.
- * @param Shell
- * @param Collection of String - a Collection of String to define the preselected types
- * @param String - 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.getString("WizardTransferPage.selectAll"), false); //$NON-NLS-1$
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(true);
- }
- };
- selectButton.addSelectionListener(listener);
-
-
- Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, WorkbenchMessages.getString("WizardTransferPage.deselectAll"), false); //$NON-NLS-1$
-
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- listViewer.setAllChecked(false);
-
- }
- };
- deselectButton.addSelectionListener(listener);
-
-
-}
-/**
- * Add the currently-specified extensions.
- */
-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$
- 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[] =
- PlatformUI.getWorkbench().getEditorRegistry().getFileEditorMappings();
- ArrayList selectedMappings = new ArrayList();
-
- for (int i = 0; i < editorMappings.length; i++) {
- IFileEditorMapping mapping = editorMappings[i];
-
- //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();
- StringBuffer entries = new StringBuffer();
- while(initialIterator.hasNext()){
- String nextExtension = (String) initialIterator.next();
- if(!selectedMappings.contains(nextExtension)){
- entries.append(nextExtension);
- //Only add a comma if we are not at the end
- if(initialIterator.hasNext())
- entries.append(',');
- }
- }
- this.userDefinedText.setText(entries.toString());
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- WorkbenchHelp.setHelp(shell, IHelpContextIds.TYPE_FILTERING_DIALOG);
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-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.setLabelProvider(FileEditorMappingLabelProvider.INSTANCE);
- listViewer.setContentProvider(FileEditorMappingContentProvider.INSTANCE);
-
- addSelectionButtons(composite);
-
- createUserEntryGroup(composite);
-
- initializeViewer();
-
- // initialize page
- if (this.initialSelections != null && !this.initialSelections.isEmpty())
- checkInitialSelections();
-
- 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) {
-
- // 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));
-
- new Label(userDefinedGroup, SWT.NONE).setText(filterTitle); //$NON-NLS-1$
-
- // user defined entry field
- userDefinedText = new Text(userDefinedGroup, SWT.SINGLE | SWT.BORDER);
- GridData data =
- new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- userDefinedText.setLayoutData(data);
-}
-/**
- * Return the input to the dialog.
- */
-private IFileEditorMapping[] getInput() {
-
- //Filter the mappings to be just those with a wildcard extension
- if (currentInput == null) {
- List wildcardEditors = new ArrayList();
- IFileEditorMapping [] allMappings =
- PlatformUI.getWorkbench().getEditorRegistry().getFileEditorMappings();
- for (int i = 0; i < allMappings.length; i++) {
- if (allMappings[i].getName().equals("*"))//$NON-NLS-1$
- wildcardEditors.add(allMappings[i]);
- }
- 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());
-}
-/**
- * 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.
- */
-protected void okPressed() {
-
- // Get the input children.
- IFileEditorMapping[] children = getInput();
-
- List list = new ArrayList();
-
- // Build a list of selected children.
- for (int i = 0; i < children.length; ++i) {
- IFileEditorMapping element = children[i];
- if (listViewer.getChecked(element))
- list.add(element.getExtension());
- }
-
- addUserDefinedEntries(list);
- setResult(list);
- super.okPressed();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardDataTransferPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardDataTransferPage.java
deleted file mode 100644
index 5a8fc53..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardDataTransferPage.java
+++ /dev/null
@@ -1,404 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-import java.util.Vector;
-import java.util.List;
-import java.util.Arrays;
-
-/**
- * The common superclass for wizard import and export pages.
- * <p>
- * This class is not intended to be subclassed outside outside of the workbench.
- * </p>
- */
-public abstract class WizardDataTransferPage extends WizardPage implements Listener, IOverwriteQuery {
-
- // constants
- protected static final int SIZING_TEXT_FIELD_WIDTH = 250;
- protected static final int COMBO_HISTORY_LENGTH = 5;
-/**
- * Creates a new wizard page.
- *
- * @param pageName the name of the page
- */
-protected WizardDataTransferPage(String pageName) {
- super(pageName);
-}
-/**
- * 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);
-}
-/**
- * Return whether the user is allowed to enter a new container name or just
- * choose from existing ones.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @return <code>true</code> if new ones are okay, and <code>false</code>
- * if only existing ones are allowed
- */
-protected abstract boolean allowNewContainerName();
-/**
- * Creates a new label with a bold font.
- *
- * @param parent the parent control
- * @param text the label text
- * @return the new label control
- */
-protected Label createBoldLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.NONE);
- label.setFont(JFaceResources.getBannerFont());
- label.setText(text);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
-}
-/**
- * Creates the import/export options group controls.
- * <p>
- * The <code>WizardDataTransferPage</code> implementation of this method does
- * nothing. Subclasses wishing to define such components should reimplement
- * this hook method.
- * </p>
- *
- * @param parent the parent control
- */
-protected void createOptionsGroupButtons(Group optionsGroup) {
-}
-/**
- * Creates a new label with a bold font.
- *
- * @param parent the parent control
- * @param text the label text
- * @return the new label control
- */
-protected Label createPlainLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.NONE);
- label.setText(text);
- label.setFont(parent.getFont());
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
-}
-/**
- * Creates a horizontal spacer line that fills the width of its container.
- *
- * @param parent the parent control
- */
-protected void createSpacer(Composite parent) {
- Label spacer = new Label(parent, SWT.NONE);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.BEGINNING;
- spacer.setLayoutData(data);
-}
-/**
- * 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
- * @see #validateSourceGroup
- * @see #validateOptionsGroup
- */
-protected boolean determinePageCompletion() {
- boolean complete = validateSourceGroup()
- && validateDestinationGroup()
- && validateOptionsGroup();
-
- // Avoid draw flicker by not clearing the error
- // message unless all is valid.
- if (complete)
- setErrorMessage(null);
-
- return complete;
-}
-/**
- * Get a path from the supplied text widget.
- * @return org.eclipse.core.runtime.IPath
- */
-protected IPath getPathFromText(Text textField) {
- String text = textField.getText();
- //Do not make an empty path absolute so as not to confuse with the root
- if(text.length() == 0)
- return new Path(text);
- else
- return (new Path(text)).makeAbsolute();
-}
-/**
- * Queries the user to supply a container resource.
- *
- * @return the path to an existing or new container, or <code>null</code> if the
- * user cancelled the dialog
- */
-protected IPath queryForContainer(IContainer initialSelection, String msg) {
- ContainerSelectionDialog dialog =
- new ContainerSelectionDialog(getControl().getShell(), initialSelection, allowNewContainerName(), msg);
- dialog.showClosedProjects(false);
- dialog.open();
- Object[] result = dialog.getResult();
- if (result != null && result.length == 1) {
- return (IPath)result[0];
- }
- return null;
-}
-/**
- * The <code>WizardDataTransfer</code> implementation of this
- * <code>IOverwriteQuery</code> method asks the user whether the existing
- * resource at the given path should be overwritten.
- *
- * @param pathString
- * @return the user's reply: one of <code>"YES"</code>, <code>"NO"</code>, <code>"ALL"</code>,
- * or <code>"CANCEL"</code>
- */
-public String queryOverwrite(String pathString) {
-
- Path path = new Path(pathString);
-
- String messageString;
- //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 =
- WorkbenchMessages.format(
- "WizardDataTransfer.existsQuestion",
- new String[] {pathString});
-
- else
- messageString =
- WorkbenchMessages.format(
- "WizardDataTransfer.overwriteNameAndPathQuestion",
- new String[] {path.lastSegment(), path.removeLastSegments(1).toOSString()});
-
-
- final MessageDialog dialog =
- new MessageDialog(
- getContainer().getShell(),
- WorkbenchMessages.getString("Question"), //$NON-NLS-1$
- null,
- messageString,
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.NO_TO_ALL_LABEL,
- IDialogConstants.CANCEL_LABEL},
- 0);
- String[] response = new String[] {YES, ALL, NO, NO_ALL, CANCEL};
- //run in syncExec because callback is from an operation,
- //which is probably not running in the UI thread.
- getControl().getDisplay().syncExec(
- new Runnable() {
- public void run() {
- dialog.open();
- }
- });
- return dialog.getReturnCode() < 0 ? CANCEL : response[dialog.getReturnCode()];
-}
-/**
- * Displays a Yes/No question to the user with the specified message and returns
- * the user's response.
- *
- * @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(),
- WorkbenchMessages.getString("Question"), //$NON-NLS-1$
- (Image)null,
- message,
- MessageDialog.NONE,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
- 0); // ensure yes is the default
-
- return dialog.open() == 0;
-}
-/**
- * Restores control settings that were saved in the previous instance of this
- * page.
- * <p>
- * The <code>WizardDataTransferPage</code> implementation of this method does
- * nothing. Subclasses may override this hook method.
- * </p>
- */
-protected void restoreWidgetValues() {
-}
-/**
- * Saves control settings that are to be restored in the next instance of
- * this page.
- * <p>
- * The <code>WizardDataTransferPage</code> implementation of this method does
- * nothing. Subclasses may override this hook method.
- * </p>
- */
-protected void saveWidgetValues() {
-}
-/**
- * Determine if the page is complete and update the page appropriately.
- */
-protected void updatePageCompletion() {
- boolean pageComplete = determinePageCompletion();
- setPageComplete(pageComplete);
- if (pageComplete) {
- setMessage(null);
- }
-}
-/**
- * Updates the enable state of this page's controls.
- * <p>
- * The <code>WizardDataTransferPage</code> implementation of this method does
- * nothing. Subclasses may extend this hook method.
- * </p>
- */
-protected void updateWidgetEnablements() {
-}
-/**
- * Returns whether this page's destination 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.
- * </p>
- *
- * @return <code>true</code> indicating validity of all controls in the
- * destination specification group
- */
-protected boolean validateDestinationGroup() {
- return true;
-}
-/**
- * Returns whether this page's options group's 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.
- * </p>
- *
- * @return <code>true</code> indicating validity of all controls in the options
- * group
- */
-protected boolean validateOptionsGroup() {
- return true;
-}
-/**
- * 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.
- * </p>
- *
- * @return <code>true</code> indicating validity of all controls in the
- * source specification group
- */
-protected boolean validateSourceGroup() {
- return true;
-}
-
-/**
- * Create the options specification widgets.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- */
-protected void createOptionsGroup(Composite parent) {
- // options group
- Group optionsGroup = new Group(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- optionsGroup.setLayout(layout);
- optionsGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
- optionsGroup.setText(WorkbenchMessages.getString("WizardExportPage.options")); //$NON-NLS-1$
- optionsGroup.setFont(parent.getFont());
-
- createOptionsGroupButtons(optionsGroup);
-
-}
-
-/**
- * Display an error dialog with the specified message.
- *
- * @param message the error message
- */
-protected void displayErrorDialog(String message) {
- MessageDialog.openError(getContainer().getShell(),getErrorDialogTitle(),message); //$NON-NLS-1$
-}
-
-/**
- * Display an error dislog with the information from the
- * supplied exception.
- * @param exception Throwable
- */
-protected void displayErrorDialog(Throwable exception){
- String message = exception.getMessage();
- //Some system exceptions have no message
- if(message == null)
- message =
- WorkbenchMessages.format(
- "WizardDataTransfer.exceptionMessage",
- new String [] {exception.toString()});
- displayErrorDialog(message);
-}
-
-/**
- * Get the title for an error dialog. Subclasses should
- * override.
- */
-protected String getErrorDialogTitle(){
- return WorkbenchMessages.getString("WizardExportPage.internalErrorTitle");
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardExportPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardExportPage.java
deleted file mode 100644
index 3eb7767..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardExportPage.java
+++ /dev/null
@@ -1,843 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IFileEditorMapping;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.internal.misc.StatusUtil;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List; // disambiguate from SWT
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-/**
- * Abstract superclass for a typical export wizard's main page.
- * <p>
- * Clients may subclass this page to inherit its common destination resource
- * selection facilities.
- * </p>
- * <p>
- * Subclasses must implement
- * <ul>
- * <li><code>createDestinationGroup</code></li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may override
- * <ul>
- * <li><code>allowNewContainerName</code></li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may extend
- * <ul>
- * <li><code>handleEvent</code></li>
- * <li><code>internalSaveWidgetValues</code></li>
- * <li><code>updateWidgetEnablements</code></li>
- * </ul>
- * </p>
- * @deprecated use WizardExportResourcePage
- */
-public abstract class WizardExportPage extends WizardDataTransferPage {
- private IStructuredSelection currentResourceSelection;
- private List selectedResources;
- private List selectedTypes;
- private boolean exportCurrentSelection = false;
- private boolean exportAllResourcesPreSet = false;
-
- // widgets
- private Combo typesToExportField;
- private Button typesToExportEditButton;
- private Button exportAllTypesRadio;
- private Button exportSpecifiedTypesRadio;
- private Button resourceDetailsButton;
- private Label resourceDetailsDescription;
- private Text resourceNameField;
- private Button resourceBrowseButton;
-
- // initial value stores
- private boolean initialExportAllTypesValue = true;
- private String initialExportFieldValue;
- private String initialTypesFieldValue;
-
- // constants
- private static final String CURRENT_SELECTION = "<current selection>";//$NON-NLS-1$
- private static final String TYPE_DELIMITER = ",";//$NON-NLS-1$
-
- // dialog store id constants
- private static final String STORE_SELECTED_TYPES_ID = "WizardFileSystemExportPage1.STORE_SELECTED_TYPES_ID.";//$NON-NLS-1$
- private static final String STORE_EXPORT_ALL_RESOURCES_ID = "WizardFileSystemExportPage1.STORE_EXPORT_ALL_RESOURCES_ID.";//$NON-NLS-1$
-/**
- * Creates an export wizard page. If the current resource selection
- * is not empty then it will be used as the initial collection of resources
- * selected for export.
- *
- * @param pageName the name of the page
- * @param selection the current resource selection
- */
-protected WizardExportPage(String pageName, IStructuredSelection selection) {
- super(pageName);
- this.currentResourceSelection = selection;
-}
-/**
- * The <code>WizardExportPage</code> implementation of this
- * <code>WizardDataTransferPage</code> method returns <code>false</code>.
- * Subclasses may override this method.
- */
-protected boolean allowNewContainerName() {
- return false;
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(
- GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- createBoldLabel(composite, WorkbenchMessages.getString("WizardExportPage.whatLabel")); //$NON-NLS-1$
- createSourceGroup(composite);
-
- createSpacer(composite);
-
- createBoldLabel(composite, WorkbenchMessages.getString("WizardExportPage.whereLabel")); //$NON-NLS-1$
- createDestinationGroup(composite);
-
- createSpacer(composite);
-
- createBoldLabel(composite, WorkbenchMessages.getString("WizardExportPage.options")); //$NON-NLS-1$
- createOptionsGroup(composite);
-
- restoreResourceSpecificationWidgetValues(); // ie.- local
- restoreWidgetValues(); // ie.- subclass hook
- if (currentResourceSelection != null)
- setupBasedOnInitialSelections();
-
- updateWidgetEnablements();
- setPageComplete(determinePageCompletion());
-
- setControl(composite);
-}
-/**
- * Creates the export destination specification visual components.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @param parent the parent control
- */
-protected abstract void createDestinationGroup(Composite parent);
-/**
- * Creates the export source resource specification controls.
- *
- * @param parent the parent control
- */
-protected final void createSourceGroup(Composite parent) {
- // top level group
- Composite sourceGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- sourceGroup.setLayout(layout);
- sourceGroup.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- // resource label
- new Label(sourceGroup, SWT.NONE).setText(WorkbenchMessages.getString("WizardExportPage.folder")); //$NON-NLS-1$
-
- // resource name entry field
- resourceNameField = new Text(sourceGroup, SWT.SINGLE | SWT.BORDER);
- resourceNameField.addListener(SWT.KeyDown, this);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- resourceNameField.setLayoutData(data);
-
- // resource browse button
- resourceBrowseButton = new Button(sourceGroup, SWT.PUSH);
- resourceBrowseButton.setText(WorkbenchMessages.getString("WizardExportPage.browse")); //$NON-NLS-1$
- resourceBrowseButton.addListener(SWT.Selection, this);
- resourceBrowseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- // export all types radio
- exportAllTypesRadio = new Button(sourceGroup, SWT.RADIO);
- exportAllTypesRadio.setText(WorkbenchMessages.getString("WizardExportPage.allTypes")); //$NON-NLS-1$
- exportAllTypesRadio.addListener(SWT.Selection, this);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 3;
- exportAllTypesRadio.setLayoutData(data);
-
- // export specific types radio
- exportSpecifiedTypesRadio = new Button(sourceGroup, SWT.RADIO);
- exportSpecifiedTypesRadio.setText(WorkbenchMessages.getString("WizardExportPage.specificTypes")); //$NON-NLS-1$
- exportSpecifiedTypesRadio.addListener(SWT.Selection, this);
-
- // types combo
- typesToExportField = new Combo(sourceGroup, SWT.NONE);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- typesToExportField.setLayoutData(data);
- typesToExportField.addListener(SWT.Modify, this);
-
- // types edit button
- typesToExportEditButton = new Button(sourceGroup, SWT.PUSH);
- typesToExportEditButton.setText(WorkbenchMessages.getString("WizardExportPage.edit")); //$NON-NLS-1$
- typesToExportEditButton.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_END));
- typesToExportEditButton.addListener(SWT.Selection, this);
-
- // details button
- resourceDetailsButton = new Button(sourceGroup, SWT.PUSH);
- resourceDetailsButton.setText(WorkbenchMessages.getString("WizardExportPage.details")); //$NON-NLS-1$
- resourceDetailsButton.addListener(SWT.Selection,this);
-
- // details label
- resourceDetailsDescription = new Label(sourceGroup, SWT.NONE);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 2;
- resourceDetailsDescription.setLayoutData(data);
-
- // initial setup
- resetSelectedResources();
- exportAllTypesRadio.setSelection(initialExportAllTypesValue);
- exportSpecifiedTypesRadio.setSelection(!initialExportAllTypesValue);
- typesToExportField.setEnabled(!initialExportAllTypesValue);
- typesToExportEditButton.setEnabled(!initialExportAllTypesValue);
-
- if (initialExportFieldValue != null)
- resourceNameField.setText(initialExportFieldValue);
- if (initialTypesFieldValue != null)
- typesToExportField.setText(initialTypesFieldValue);
-}
-/**
- * Display an error dialog with the specified message.
- *
- * @param message the error message
- */
-protected void displayErrorDialog(String message) {
- MessageDialog.openError(getContainer().getShell(),WorkbenchMessages.getString("WizardExportPage.errorDialogTitle"),message); //$NON-NLS-1$
-}
-/**
- * Displays a description message that indicates a selection of resources
- * of the specified size.
- *
- * @param selectedResourceCount the resource selection size to display
- */
-protected void displayResourcesSelectedCount(int selectedResourceCount) {
- if (selectedResourceCount == 1)
- resourceDetailsDescription.setText(WorkbenchMessages.getString("WizardExportPage.oneResourceSelected")); //$NON-NLS-1$
- else
- resourceDetailsDescription.setText(WorkbenchMessages.format("WizardExportPage.resourceCountMessage", new Object[] {new Integer(selectedResourceCount)})); //$NON-NLS-1$
-}
-/**
- * Obsolete method. This was implemented to handle the case where ensureLocal()
- * needed to be called but it doesn't use it any longer.
- *
- * @param resources the list of resources to ensure locality for
- * @return <code>true</code> for successful completion
- * @deprecated Only retained for backwards compatibility.
- */
-protected boolean ensureResourcesLocal(List resources) {
- return true;
-}
-
-/**
- * Returns a new subcollection containing only those resources which are not
- * local.
- *
- * @param originalList the original list of resources (element type:
- * <code>IResource</code>)
- * @return the new list of non-local resources (element type:
- * <code>IResource</code>)
- */
-protected List extractNonLocalResources(List originalList) {
- Vector result = new Vector(originalList.size());
- Iterator resourcesEnum = originalList.iterator();
-
- while (resourcesEnum.hasNext()) {
- IResource currentResource = (IResource)resourcesEnum.next();
- if (!currentResource.isLocal(IResource.DEPTH_ZERO))
- result.addElement(currentResource);
- }
-
- return result;
-}
-/**
- * Returns the current selection value of the "Export all types" radio,
- * or its set initial value if it does not exist yet.
- *
- * @return the "Export All Types" radio's current value or anticipated initial
- * value
- */
-public boolean getExportAllTypesValue() {
- if (exportAllTypesRadio == null)
- return initialExportAllTypesValue;
-
- return exportAllTypesRadio.getSelection();
-}
-/**
- * Returns the current contents of the resource name entry field,
- * or its set initial value if it does not exist yet (which could
- * be <code>null</code>).
- *
- * @return the resource name field's current value or anticipated initial value,
- * or <code>null</code>
- */
-public String getResourceFieldValue() {
- if (resourceNameField == null)
- return initialExportFieldValue;
-
- return resourceNameField.getText();
-}
-/**
- * Return the path for the resource field.
- * @return org.eclipse.core.runtime.IPath
- */
-protected IPath getResourcePath() {
- return getPathFromText(this.resourceNameField);
-}
-/**
- * Returns this page's collection of currently-specified resources to be
- * exported. This is the primary resource selection facility accessor for
- * subclasses.
- *
- * @return the collection of resources currently selected for export (element
- * type: <code>IResource</code>)
- */
-protected List getSelectedResources() {
- if (selectedResources == null) {
- IResource sourceResource = getSourceResource();
-
- if (sourceResource != null)
- selectAppropriateResources(sourceResource);
- }
-
- return selectedResources;
-}
-/**
- * Returns the resource object specified in the resource name entry field,
- * or <code>null</code> if such a resource does not exist in the workbench.
- *
- * @return the resource specified in the resource name entry field, or
- * <code>null</code>
- */
-protected IResource getSourceResource() {
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
- //make the path absolute to allow for optional leading slash
- IPath testPath = getResourcePath();
-
- IStatus result =
- workspace.validatePath(
- testPath.toString(),
- IResource.ROOT | IResource.PROJECT | IResource.FOLDER | IResource.FILE);
-
- if (result.isOK() && workspace.getRoot().exists(testPath))
- return workspace.getRoot().findMember(testPath);
-
- return null;
-}
-/**
- * Returns the current contents of the types entry field, or its set
- * initial value if it does not exist yet (which could be <code>null</code>).
- *
- * @return the types entry field's current value or anticipated initial value,
- * or <code>null</code>
- */
-public String getTypesFieldValue() {
- if (typesToExportField == null)
- return initialTypesFieldValue;
-
- return typesToExportField.getText();
-}
-/**
- * Returns the resource extensions currently specified to be exported.
- *
- * @return the resource extensions currently specified to be exported (element
- * type: <code>String</code>)
- */
-protected List getTypesToExport() {
- List result = new ArrayList();
- StringTokenizer tokenizer = new StringTokenizer(typesToExportField.getText(),TYPE_DELIMITER);
-
- while (tokenizer.hasMoreTokens()) {
- String currentExtension = tokenizer.nextToken().trim();
- if (!currentExtension.equals(""))//$NON-NLS-1$
- result.add(currentExtension);
- }
-
- return result;
-}
-/**
- * The <code>WizardExportPage</code> implementation of this
- * <code>Listener</code> method handles all events and enablements for controls
- * on this page. Subclasses may extend.
- */
-public void handleEvent(Event event) {
- Widget source = event.widget;
-
- if (source == exportAllTypesRadio || source == typesToExportField || source == resourceNameField)
- resetSelectedResources();
- else if (source == exportSpecifiedTypesRadio) {
- resetSelectedResources();
- typesToExportField.setFocus();
- } else if (source == resourceDetailsButton)
- handleResourceDetailsButtonPressed();
- else if (source == resourceBrowseButton)
- handleResourceBrowseButtonPressed();
- else if (source == typesToExportEditButton)
- handleTypesEditButtonPressed();
-
- setPageComplete(determinePageCompletion());
- updateWidgetEnablements();
-}
-/**
- * Opens a container selection dialog and displays the user's subsequent
- * container selection in this page's resource name field.
- */
-protected void handleResourceBrowseButtonPressed() {
- IResource currentFolder = getSourceResource();
- if (currentFolder != null && currentFolder.getType() == IResource.FILE)
- currentFolder = currentFolder.getParent();
-
- IPath containerPath =
- queryForContainer((IContainer) currentFolder, WorkbenchMessages.getString("WizardExportPage.selectResourcesToExport")); //$NON-NLS-1$
- if (containerPath != null) { // null means user cancelled
- String relativePath = containerPath.makeRelative().toString();
- if (!relativePath.toString().equals(resourceNameField.getText())) {
- resetSelectedResources();
- resourceNameField.setText(relativePath);
- }
- }
-}
-/**
- * Opens a resource selection dialog and records the user's subsequent
- * resource selections.
- */
-protected void handleResourceDetailsButtonPressed() {
- IAdaptable source = getSourceResource();
-
- if (source == null)
- source = ResourcesPlugin.getWorkspace().getRoot();
-
- selectAppropriateResources(source);
-
- if (source instanceof IFile) {
- source = ((IFile) source).getParent();
- setResourceToDisplay((IResource) source);
- }
-
- Object[] newlySelectedResources =
- queryIndividualResourcesToExport(source);
-
- if (newlySelectedResources != null) {
- selectedResources = Arrays.asList(newlySelectedResources);
- displayResourcesSelectedCount(selectedResources.size());
- }
-}
-/**
- * Queries the user for the types of resources to be exported and
- * displays these types in this page's "Types to export" field.
- */
-protected void handleTypesEditButtonPressed() {
- Object[] newSelectedTypes = queryResourceTypesToExport();
-
- if (newSelectedTypes != null) { // ie.- did not press Cancel
- List result = new ArrayList(newSelectedTypes.length);
- for (int i = 0; i < newSelectedTypes.length; i++)
- result.add(((IFileEditorMapping)newSelectedTypes[i]).getExtension());
- setTypesToExport(result);
- }
-}
-/**
- * Returns whether the extension of the given resource name is an extension that
- * has been specified for export by the user.
- *
- * @param resourceName the resource name
- * @return <code>true</code> if the resource name is suitable for export based
- * upon its extension
- */
-protected boolean hasExportableExtension(String resourceName) {
- if (selectedTypes == null) // ie.- all extensions are acceptable
- return true;
-
- int separatorIndex = resourceName.lastIndexOf(".");//$NON-NLS-1$
- if (separatorIndex == -1)
- return false;
-
- String extension = resourceName.substring(separatorIndex + 1);
-
- Iterator enum = selectedTypes.iterator();
- while (enum.hasNext()) {
- if (extension.equalsIgnoreCase((String)enum.next()))
- return true;
- }
-
- return false;
-}
-/**
- * Persists additional setting that are to be restored in the next instance of
- * this page.
- * <p>
- * The <code>WizardImportPage</code> implementation of this method does
- * nothing. Subclasses may extend to persist additional settings.
- * </p>
- */
-protected void internalSaveWidgetValues() {
-}
-/**
- * Queries the user for the individual resources that are to be exported
- * and returns these resources as a collection.
- * <p>
- * A similar method is available which queries the user for a single root
- * resource selection to export. To get this functionality instead, use
- * <code>queryRootResourceToExport</code>.
- * </p>
- *
- * @param rootResource the resource to use as the root of the selection query
- * @return the resources selected for export (element type:
- * <code>IResource</code>), or <code>null</code> if the user canceled the
- * selection
- * @see #queryRootResourceToExport
- */
-protected Object[] queryIndividualResourcesToExport(IAdaptable rootResource) {
- ResourceSelectionDialog dialog =
- new ResourceSelectionDialog(getContainer().getShell(), rootResource,WorkbenchMessages.getString("WizardExportPage.selectResourcesTitle")); //$NON-NLS-1$
- dialog.setInitialSelections(selectedResources.toArray(new Object[selectedResources.size()]));
- dialog.open();
- return dialog.getResult();
-}
-/**
- * Queries the user for the resource types that are to be exported and returns
- * these types as a collection.
- *
- * @return the resource types selected for export (element type:
- * <code>String</code>), or <code>null</code> if the user canceled the
- * selection
- */
-protected Object[] queryResourceTypesToExport() {
- IFileEditorMapping editorMappings[] =
- WorkbenchPlugin.getDefault().getEditorRegistry().getFileEditorMappings();
-
- int mappingsSize = editorMappings.length;
- List selectedTypes = getTypesToExport();
- List initialSelections = new ArrayList(selectedTypes.size());
-
- for (int i = 0; i < mappingsSize; i++) {
- IFileEditorMapping currentMapping = editorMappings[i];
- if (selectedTypes.contains(currentMapping.getExtension()))
- initialSelections.add(currentMapping);
- }
-
- ListSelectionDialog dialog =
- new ListSelectionDialog(
- getContainer().getShell(),
- editorMappings,
- FileEditorMappingContentProvider.INSTANCE,
- FileEditorMappingLabelProvider.INSTANCE,
- WorkbenchMessages.getString("WizardExportPage.selectionDialogMessage")); //$NON-NLS-1$
-
-
- dialog.setTitle(WorkbenchMessages.getString("WizardExportPage.resourceTypeDialog")); //$NON-NLS-1$
- dialog.open();
-
- return dialog.getResult();
-}
-/**
- * Resets this page's selected resources collection and updates its controls
- * accordingly.
- */
-protected void resetSelectedResources() {
- resourceDetailsDescription.setText(WorkbenchMessages.getString("WizardExportPage.detailsMessage")); //$NON-NLS-1$
- selectedResources = null;
-
- if (exportCurrentSelection) {
- exportCurrentSelection = false;
-
- if (resourceNameField.getText().length() > CURRENT_SELECTION.length())
- resourceNameField.setText(
- resourceNameField.getText().substring(CURRENT_SELECTION.length()));
- else
- resourceNameField.setText("");//$NON-NLS-1$
- }
-}
-/**
- * Restores resource specification control settings that were persisted
- * in the previous instance of this page. Subclasses wishing to restore
- * persisted values for their controls may extend.
- */
-protected void restoreResourceSpecificationWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- String pageName = getName();
- boolean exportAllResources = settings.getBoolean(STORE_EXPORT_ALL_RESOURCES_ID + pageName);
-
- // restore all/typed radio values iff not already explicitly set
- if (!exportAllResourcesPreSet) {
- exportAllTypesRadio.setSelection(exportAllResources);
- exportSpecifiedTypesRadio.setSelection(!exportAllResources);
- }
-
- // restore selected types iff not explicitly already set
- if (initialTypesFieldValue == null) {
- String[] selectedTypes = settings.getArray(STORE_SELECTED_TYPES_ID + pageName);
- if(selectedTypes != null) {
- if (selectedTypes.length > 0)
- typesToExportField.setText(selectedTypes[0]);
- for (int i = 0; i < selectedTypes.length; i++)
- typesToExportField.add(selectedTypes[i]);
- }
- }
- }
-}
-/**
- * Persists resource specification control setting that are to be restored
- * in the next instance of this page. Subclasses wishing to persist additional
- * setting for their controls should extend hook method
- * <code>internalSaveWidgetValues</code>.
- */
-protected void saveWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- String pageName = getName();
-
- // update specific types to export history
- String[] selectedTypesNames = settings.getArray(STORE_SELECTED_TYPES_ID + pageName);
- if (selectedTypesNames == null)
- selectedTypesNames = new String[0];
-
- if (exportSpecifiedTypesRadio.getSelection()) {
- selectedTypesNames = addToHistory(selectedTypesNames,typesToExportField.getText());
- }
-
- settings.put(
- STORE_SELECTED_TYPES_ID + pageName,
- selectedTypesNames);
-
- // radio buttons
- settings.put(
- STORE_EXPORT_ALL_RESOURCES_ID + pageName,
- exportAllTypesRadio.getSelection());
- }
-
- // allow subclasses to save values
- internalSaveWidgetValues();
-
-}
-/**
- * Records a container's recursive file descendents which have an extension
- * that has been specified for export by the user.
- *
- * @param resource the parent container
- */
-protected void selectAppropriateFolderContents(IContainer resource) {
- try {
- IResource[] members = resource.members();
-
- for (int i = 0; i < members.length; i++) {
- if (members[i].getType() == IResource.FILE) {
- IFile currentFile = (IFile)members[i];
- if (hasExportableExtension(currentFile.getFullPath().toString()))
- selectedResources.add(currentFile);
- }
- if (members[i].getType() == IResource.FOLDER) {
- selectAppropriateFolderContents((IContainer)members[i]);
- }
- }
- } catch (CoreException e) {
- //don't show children if there are errors -- should at least log this
- }
-}
-/**
- * Records a resource's recursive descendents which are appropriate
- * for export based upon this page's current controls contents.
- *
- * @param resource the parent resource
- */
-protected void selectAppropriateResources(Object resource) {
- if (selectedResources == null) {
-
- if (exportSpecifiedTypesRadio.getSelection())
- selectedTypes = getTypesToExport();
- else
- selectedTypes = null; // sentinel for select all extensions
-
- selectedResources = new ArrayList();
- if (resource instanceof IWorkspaceRoot) {
- IProject[] projects = ((IWorkspaceRoot) resource).getProjects();
- for (int i = 0; i < projects.length; i++) {
- selectAppropriateFolderContents(projects[i]);
- }
- } else
- if (resource instanceof IFile) {
- IFile file = (IFile) resource;
- if (hasExportableExtension(file.getFullPath().toString()))
- selectedResources.add(file);
- } else {
- selectAppropriateFolderContents((IContainer) resource);
- }
- }
-}
-/**
- * Sets the selection value of this page's "Export all types" radio, or stores
- * it for future use if this visual component does not exist yet.
- *
- * @param value new selection value
- */
-public void setExportAllTypesValue(boolean value) {
- if (exportAllTypesRadio == null) {
- initialExportAllTypesValue = value;
- exportAllResourcesPreSet = true;
- } else {
- exportAllTypesRadio.setSelection(value);
- exportSpecifiedTypesRadio.setSelection(!value);
- }
-}
-/**
- * Sets the value of this page's source resource field, or stores
- * it for future use if this visual component does not exist yet.
- *
- * @param value new value
- */
-public void setResourceFieldValue(String value) {
- if (resourceNameField == null)
- initialExportFieldValue = value;
- else
- resourceNameField.setText(value);
-}
-/**
- * Set the resource whos name we will display.
- * @param resource
- */
-protected void setResourceToDisplay(IResource resource) {
- setResourceFieldValue(resource.getFullPath().makeRelative().toString());
-}
-/**
- * Sets the value of this page's "Types to export" field, or stores
- * it for future use if this visual component does not exist yet.
- *
- * @param value new value
- */
-public void setTypesFieldValue(String value) {
- if (typesToExportField == null)
- initialTypesFieldValue = value;
- else
- typesToExportField.setText(value);
-}
-/**
- * Sets the value of this page's "Types to export" field based upon the
- * collection of extensions.
- *
- * @param typeStrings the collection of extensions to populate the "Types to
- * export" field with (element type: <code>String</code>)
- */
-protected void setTypesToExport(List typeStrings) {
- StringBuffer result = new StringBuffer();
- Iterator typesEnum = typeStrings.iterator();
-
- while (typesEnum.hasNext()) {
- result.append(typesEnum.next());
- result.append(TYPE_DELIMITER);
- result.append(" ");//$NON-NLS-1$
- }
-
- typesToExportField.setText(result.toString());
-}
-/**
- * Populates the resource name field based upon the currently selected resources.
- */
-protected void setupBasedOnInitialSelections() {
- if (initialExportFieldValue != null) {
- // a source resource has been programatically specified, which overrides
- // the current workbench resource selection
- IResource specifiedSourceResource = getSourceResource();
- if (specifiedSourceResource == null)
- currentResourceSelection = new StructuredSelection();
- else
- currentResourceSelection = new StructuredSelection(specifiedSourceResource);
- }
-
- if (currentResourceSelection.isEmpty())
- return; // no setup needed
-
- List selections = new ArrayList();
- Iterator enum = currentResourceSelection.iterator();
- while (enum.hasNext()) {
- IResource currentResource = (IResource) enum.next();
- // do not add inaccessible elements
- if (currentResource.isAccessible())
- selections.add(currentResource);
- }
-
- if (selections.isEmpty())
- return; // setup not needed anymore
-
- int selectedResourceCount = selections.size();
- if (selectedResourceCount == 1) {
- IResource resource = (IResource) selections.get(0);
- setResourceToDisplay(resource);
- } else {
- selectedResources = selections;
- exportAllTypesRadio.setSelection(true);
- exportSpecifiedTypesRadio.setSelection(false);
- resourceNameField.setText(CURRENT_SELECTION);
- exportCurrentSelection = true;
- displayResourcesSelectedCount(selectedResourceCount);
- }
-}
-/**
- * Updates the enablements of this page's controls. Subclasses may extend.
- */
-protected void updateWidgetEnablements() {
- if (exportCurrentSelection)
- resourceDetailsButton.setEnabled(true);
- else {
- IResource resource = getSourceResource();
- resourceDetailsButton.setEnabled(resource != null && resource.isAccessible());
- }
-
- exportSpecifiedTypesRadio.setEnabled(!exportCurrentSelection);
- typesToExportField.setEnabled(exportSpecifiedTypesRadio.getSelection());
- typesToExportEditButton.setEnabled(exportSpecifiedTypesRadio.getSelection());
-}
-/* (non-Javadoc)
- * Method declared on WizardDataTransferPage.
- */
-protected final boolean validateSourceGroup() {
- if (exportCurrentSelection) // ie.- no more checking needed
- return true;
-
- String sourceString = resourceNameField.getText();
- if (sourceString.equals("")) {//$NON-NLS-1$
- setErrorMessage(null);
- return false;
- }
-
- IResource resource = getSourceResource();
-
- if (resource == null) {
- setErrorMessage(WorkbenchMessages.getString("WizardExportPage.mustExistMessage")); //$NON-NLS-1$
- return false;
- }
-
- if (!resource.isAccessible()) {
- setErrorMessage(WorkbenchMessages.getString("WizardExportPage.mustBeAccessibleMessage")); //$NON-NLS-1$
- return false;
- }
-
- return true;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardExportResourcesPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardExportResourcesPage.java
deleted file mode 100644
index 02e7bc3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardExportResourcesPage.java
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardImportPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardImportPage.java
deleted file mode 100644
index 6bf5894..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardImportPage.java
+++ /dev/null
@@ -1,285 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-/**
- * The abstract superclass for a typical import wizard's main page.
- * <p>
- * Clients may subclass this page to inherit its common destination resource
- * selection facilities.
- * </p>
- * <p>
- * Subclasses must implement
- * <ul>
- * <li><code>createSourceGroup</code></li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may override
- * <ul>
- * <li><code>allowNewContainerName</code></li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may extend
- * <ul>
- * <li><code>handleEvent</code></li>
- * </ul>
- * </p>
- * @deprecated use WizardResourceImportPage
- */
-public abstract class WizardImportPage extends WizardDataTransferPage {
- private IResource currentResourceSelection;
-
- // initial value stores
- private String initialContainerFieldValue;
-
- // widgets
- private Text containerNameField;
- private Button containerBrowseButton;
-/**
- * Creates an import wizard page. If the initial resource selection
- * contains exactly one container resource then it will be used as the default
- * import destination.
- *
- * @param pageName the name of the page
- * @param selection the current resource selection
- */
-protected WizardImportPage(String name, IStructuredSelection selection) {
- super(name);
-
- if (selection.size() == 1)
- currentResourceSelection = (IResource) selection.getFirstElement();
- else
- currentResourceSelection = null;
-
- if (currentResourceSelection != null) {
- if (currentResourceSelection.getType() == IResource.FILE)
- currentResourceSelection = currentResourceSelection.getParent();
-
- if (!currentResourceSelection.isAccessible())
- currentResourceSelection = null;
- }
-
-}
-/**
- * The <code>WizardImportPage</code> implementation of this
- * <code>WizardDataTransferPage</code> method returns <code>true</code>.
- * Subclasses may override this method.
- */
-protected boolean allowNewContainerName() {
- return true;
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite 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.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
-
- createSourceGroup(composite);
-
- createSpacer(composite);
-
- createBoldLabel(composite, WorkbenchMessages.getString("WizardImportPage.destinationLabel")); //$NON-NLS-1$
- createDestinationGroup(composite);
-
- createSpacer(composite);
-
- createBoldLabel(composite, WorkbenchMessages.getString("WizardImportPage.options")); //$NON-NLS-1$
- createOptionsGroup(composite);
-
- restoreWidgetValues();
- updateWidgetEnablements();
- setPageComplete(determinePageCompletion());
-
- setControl(composite);
-}
-/**
- * Creates the import destination specification controls.
- *
- * @param parent the parent control
- */
-protected final void createDestinationGroup(Composite parent) {
- // container specification group
- Composite containerGroup = new Composite(parent,SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- containerGroup.setLayout(layout);
- containerGroup.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- // container label
- Label resourcesLabel = new Label(containerGroup,SWT.NONE);
- resourcesLabel.setText(WorkbenchMessages.getString("WizardImportPage.folder")); //$NON-NLS-1$
-
- // container name entry field
- containerNameField = new Text(containerGroup,SWT.SINGLE|SWT.BORDER);
- containerNameField.addListener(SWT.Modify,this);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- containerNameField.setLayoutData(data);
-
- // container browse button
- containerBrowseButton = new Button(containerGroup,SWT.PUSH);
- containerBrowseButton.setText(WorkbenchMessages.getString("WizardImportPage.browseLabel")); //$NON-NLS-1$
- containerBrowseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- containerBrowseButton.addListener(SWT.Selection,this);
-
- initialPopulateContainerField();
-}
-/**
- * Creates the import source specification controls.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @param parent the parent control
- */
-protected abstract void createSourceGroup(Composite parent);
-/**
- * Display an error dialog with the specified message.
- *
- * @param message the error message
- */
-protected void displayErrorDialog(String message) {
- MessageDialog.openError(getContainer().getShell(),WorkbenchMessages.getString("WizardImportPage.errorDialogTitle"),message); //$NON-NLS-1$
-}
-/**
- * Returns the path of the container resource specified in the container
- * name entry field, or <code>null</code> if no name has been typed in.
- * <p>
- * The container specified by the full path might not exist and would need to
- * be created.
- * </p>
- *
- * @return the full path of the container resource specified in
- * the container name entry field, or <code>null</code>
- */
-protected IPath getContainerFullPath() {
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
-
- //make the path absolute to allow for optional leading slash
- IPath testPath = getResourcePath();
-
- IStatus result =
- workspace.validatePath(
- testPath.toString(),
- IResource.PROJECT | IResource.FOLDER);
- if (result.isOK()) {
- return testPath;
- }
-
- return null;
-}
-/**
- * Return the path for the resource field.
- * @return org.eclipse.core.runtime.IPath
- */
-protected IPath getResourcePath() {
- return getPathFromText(this.containerNameField);
-}
-/**
- * Returns the container resource specified in the container name entry field,
- * or <code>null</code> if such a container does not exist in the workbench.
- *
- * @return the container resource specified in the container name entry field,
- * or <code>null</code>
- */
-protected IContainer getSpecifiedContainer() {
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
- IPath path = getContainerFullPath();
- if (workspace.getRoot().exists(path))
- return (IContainer) workspace.getRoot().findMember(path);
-
- return null;
-}
-/**
- * Opens a container selection dialog and displays the user's subsequent
- * container resource selection in this page's container name field.
- */
-protected void handleContainerBrowseButtonPressed() {
- // see if the user wishes to modify this container selection
- IPath containerPath = queryForContainer(getSpecifiedContainer(), WorkbenchMessages.getString("WizardImportPage.selectFolderLabel")); //$NON-NLS-1$
-
- // if a container was selected then put its name in the container name field
- if (containerPath != null) // null means user cancelled
- containerNameField.setText(containerPath.makeRelative().toString());
-}
-/**
- * The <code>WizardImportPage</code> implementation of this
- * <code>Listener</code> method handles all events and enablements for controls
- * on this page. Subclasses may extend.
- */
-public void handleEvent(Event event) {
- Widget source = event.widget;
-
- if (source == containerBrowseButton)
- handleContainerBrowseButtonPressed();
-
- setPageComplete(determinePageCompletion());
- updateWidgetEnablements();
-}
-/**
- * Sets the initial contents of the container name field.
- */
-protected final void initialPopulateContainerField() {
- if (initialContainerFieldValue != null)
- containerNameField.setText(initialContainerFieldValue);
- else if (currentResourceSelection != null)
- containerNameField.setText(currentResourceSelection.getFullPath().toString());
-}
-/**
- * Sets the value of this page's container resource field, or stores
- * it for future use if this page's controls do not exist yet.
- *
- * @param value new value
- */
-public void setContainerFieldValue(String value) {
- if (containerNameField == null)
- initialContainerFieldValue = value;
- else
- containerNameField.setText(value);
-}
-/* (non-Javadoc)
- * Method declared on WizardDataTransferPage.
- */
-protected final boolean validateDestinationGroup() {
- if (getContainerFullPath() == null)
- return false;
-
- // If the container exist, validate it
- IContainer container = getSpecifiedContainer();
- if (container != null) {
- if (!container.isAccessible()) {
- setErrorMessage(WorkbenchMessages.getString("WizardImportPage.folderMustExist")); //$NON-NLS-1$
- return false;
- }
- }
-
- return true;
-
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewFileCreationPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewFileCreationPage.java
deleted file mode 100644
index 94000aa..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewFileCreationPage.java
+++ /dev/null
@@ -1,378 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.ResourceAndContainerGroup;
-/**
- * Standard main page for a wizard that creates a file resource.
- * <p>
- * This page may be used by clients as-is; it may be also be subclassed to suit.
- * </p>
- * <p>
- * Subclasses may override
- * <ul>
- * <li><code>getInitialContents</code></li>
- * <li><code>getNewFileLabel</code></li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may extend
- * <ul>
- * <li><code>handleEvent</code></li>
- * </ul>
- * </p>
- */
-public class WizardNewFileCreationPage extends WizardPage implements Listener {
- // the current resource selection
- private IStructuredSelection currentSelection;
-
-
- // cache of newly-created file
- private IFile newFile;
-
- // initial value stores
- private String initialFileName;
- private IPath initialContainerFullPath;
-
- // widgets
- private Composite topLevel;
- private ResourceAndContainerGroup resourceGroup;
-/**
- * Creates a new file creation wizard page. If the initial resource selection
- * contains exactly one container resource then it will be used as the default
- * container resource.
- *
- * @param pageName the name of the page
- * @param selection the current resource selection
- */
-public WizardNewFileCreationPage(String pageName, IStructuredSelection selection) {
- super(pageName);
- setPageComplete(false);
- this.currentSelection = selection;
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
- // top level group
- topLevel = new Composite(parent,SWT.NONE);
- topLevel.setLayout(new GridLayout());
- topLevel.setLayoutData(new GridData(
- GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
- topLevel.setFont(parent.getFont());
- WorkbenchHelp.setHelp(topLevel, IHelpContextIds.NEW_FILE_WIZARD_PAGE);
-
- // resource and container group
- resourceGroup = new ResourceAndContainerGroup(topLevel, this, getNewFileLabel(), WorkbenchMessages.getString("WizardNewFileCreationPage.file"), false); //$NON-NLS-1$
- resourceGroup.setAllowExistingResources(false);
- initialPopulateContainerNameField();
- if (initialFileName != null)
- resourceGroup.setResource(initialFileName);
- validatePage();
- // Show description on opening
- setErrorMessage(null);
- setMessage(null);
- setControl(topLevel);
-}
-/**
- * Creates a file resource given the file handle and contents.
- *
- * @param fileHandle the file handle to create a file resource with
- * @param contents the initial contents of the new file resource, or
- * <code>null</code> if none (equivalent to an empty stream)
- * @param monitor the progress monitor to show visual progress with
- * @exception CoreException if the operation fails
- * @exception OperationCanceledException if the operation is canceled
- */
-protected void createFile(IFile fileHandle, InputStream contents, IProgressMonitor monitor) throws CoreException {
- if (contents == null)
- contents = new ByteArrayInputStream(new byte[0]);
-
- try {
- // Create a new file resource in the workspace
- fileHandle.create(contents, false, monitor);
- }
- catch (CoreException e) {
- // If the file already existed locally, just refresh to get contents
- if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED)
- fileHandle.refreshLocal(IResource.DEPTH_ZERO, null);
- else
- throw e;
- }
-
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-}
-/**
- * Creates a file resource handle for the file with the given workspace path.
- * This method does not create the file resource; this is the responsibility
- * of <code>createFile</code>.
- *
- * @param filePath the path of the file resource to create a handle for
- * @return the new file resource handle
- * @see #createFile
- */
-protected IFile createFileHandle(IPath filePath) {
- return WorkbenchPlugin.getPluginWorkspace().getRoot().getFile(filePath);
-}
-/**
- * Creates a new file resource in the selected container and with the selected
- * name. Creates any missing resource containers along the path; does nothing if
- * the container resources already exist.
- * <p>
- * In normal usage, this method is invoked after the user has pressed Finish on
- * the wizard; the enablement of the Finish button implies that all controls on
- * on this page currently contain valid values.
- * </p>
- * <p>
- * Note that this page caches the new file once it has been successfully
- * created; subsequent invocations of this method will answer the same
- * file resource without attempting to create it again.
- * </p>
- * <p>
- * This method should be called within a workspace modify operation since
- * it creates resources.
- * </p>
- *
- * @return the created file resource, or <code>null</code> if the file
- * was not created
- */
-public IFile createNewFile() {
- if (newFile != null)
- return newFile;
-
- // create the new file and cache it if successful
-
- final IPath containerPath = resourceGroup.getContainerFullPath();
- IPath newFilePath = containerPath.append(resourceGroup.getResource());
- final IFile newFileHandle = createFileHandle(newFilePath);
- final InputStream initialContents = getInitialContents();
-
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException,
- InterruptedException
- {
- try {
- monitor.beginTask(WorkbenchMessages.getString("WizardNewFileCreationPage.progress"), 2000); //$NON-NLS-1$
- ContainerGenerator generator = new ContainerGenerator(containerPath);
- generator.generateContainer(new SubProgressMonitor(monitor, 1000));
- createFile(newFileHandle,initialContents, new SubProgressMonitor(monitor, 1000));
- } finally {
- monitor.done();
- }
- }
- };
-
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return null;
- } catch (InvocationTargetException e) {
- if (e.getTargetException() instanceof CoreException) {
- ErrorDialog.openError(
- getContainer().getShell(), // Was Utilities.getFocusShell()
- WorkbenchMessages.getString("WizardNewFileCreationPage.errorTitle"), //$NON-NLS-1$
- null, // no special message
- ((CoreException) e.getTargetException()).getStatus());
- }
- else {
- // CoreExceptions are handled above, but unexpected runtime exceptions and errors may still occur.
- WorkbenchPlugin.log(MessageFormat.format("Exception in {0}.getNewFile(): {1}", new Object[] {getClass().getName(), e.getTargetException()}));//$NON-NLS-1$
- MessageDialog.openError(getContainer().getShell(), WorkbenchMessages.getString("WizardNewFileCreationPage.internalErrorTitle"), WorkbenchMessages.format("WizardNewFileCreationPage.internalErrorMessage", new Object[] {e.getTargetException().getMessage()})); //$NON-NLS-2$ //$NON-NLS-1$
- }
- return null;
- }
-
- newFile = newFileHandle;
-
- return newFile;
-}
-/**
- * Returns the current full path of the containing resource as entered or
- * selected by the user, or its anticipated initial value.
- *
- * @return the container's full path, anticipated initial value,
- * or <code>null</code> if no path is known
- */
-public IPath getContainerFullPath() {
- return resourceGroup.getContainerFullPath();
-}
-/**
- * Returns the current file name as entered by the user, or its anticipated
- * initial value.
- *
- * @return the file name, its anticipated initial value, or <code>null</code>
- * if no file name is known
- */
-public String getFileName() {
- if (resourceGroup == null)
- return initialFileName;
-
- return resourceGroup.getResource();
-}
-/**
- * Returns a stream containing the initial contents to be given to new file resource
- * instances. <b>Subclasses</b> may wish to override. This default implementation
- * provides no initial contents.
- *
- * @return initial contents to be given to new file resource instances
- */
-protected InputStream getInitialContents() {
- return null;
-}
-/**
- * Returns the label to display in the file name specification visual
- * component group.
- * <p>
- * Subclasses may reimplement.
- * </p>
- *
- * @return the label to display in the file name specification visual
- * component group
- */
-protected String getNewFileLabel() {
- return WorkbenchMessages.getString("WizardNewFileCreationPage.fileLabel"); //$NON-NLS-1$
-}
-/**
- * The <code>WizardNewFileCreationPage</code> implementation of this
- * <code>Listener</code> method handles all events and enablements for controls
- * on this page. Subclasses may extend.
- */
-public void handleEvent(Event event) {
- setPageComplete(validatePage());
-}
-/**
- * Sets the initial contents of the container name entry field, based upon
- * either a previously-specified initial value or the ability to determine
- * such a value.
- */
-protected void initialPopulateContainerNameField() {
- if (initialContainerFullPath != null)
- resourceGroup.setContainerFullPath(initialContainerFullPath);
- else {
- Iterator enum = currentSelection.iterator();
- if (enum.hasNext()) {
- Object object = enum.next();
- IResource selectedResource = null;
- if (object instanceof IResource) {
- selectedResource = (IResource)object;
- } else if (object instanceof IAdaptable) {
- selectedResource = (IResource)((IAdaptable)object).getAdapter(IResource.class);
- }
- if (selectedResource != null) {
- if (selectedResource.getType() == IResource.FILE)
- selectedResource = selectedResource.getParent();
- if (selectedResource.isAccessible())
- resourceGroup.setContainerFullPath(selectedResource.getFullPath());
- }
- }
- }
-}
-/**
- * Sets the value of this page's container name field, or stores
- * it for future use if this page's controls do not exist yet.
- *
- * @param path the full path to the container
- */
-public void setContainerFullPath(IPath path) {
- if (resourceGroup == null)
- initialContainerFullPath = path;
- else
- resourceGroup.setContainerFullPath(path);
-}
-/**
- * Sets the value of this page's file name field, or stores
- * it for future use if this page's controls do not exist yet.
- *
- * @param value new file name
- */
-public void setFileName(String value) {
- if (resourceGroup == null)
- initialFileName = value;
- else
- resourceGroup.setResource(value);
-}
-/**
- * Returns whether this page's controls currently all contain valid
- * values.
- *
- * @return <code>true</code> if all controls are valid, and
- * <code>false</code> if at least one is invalid
- */
-protected boolean validatePage() {
- boolean valid = true;
-
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
-
- String fileName = getFileName();
-
- IStatus nameStatus =
- workspace.validateName(fileName, IResource.FILE);
- if (!nameStatus.isOK()) {
- setErrorMessage(nameStatus.getMessage());
- return false;
- }
-
- if (!resourceGroup.areAllValuesValid()) {
- // if blank name then fail silently
- if (resourceGroup.getProblemType() == ResourceAndContainerGroup.PROBLEM_RESOURCE_EMPTY
- || resourceGroup.getProblemType() == ResourceAndContainerGroup.PROBLEM_CONTAINER_EMPTY) {
- setMessage(resourceGroup.getProblemMessage());
- setErrorMessage(null);
- } else
- setErrorMessage(resourceGroup.getProblemMessage());
- valid = false;
- }
-
- IPath container = workspace.getRoot().getLocation().append(getContainerFullPath());
- java.io.File systemFile = new java.io.File(container.toOSString(),fileName);
- if(systemFile.exists()){
- setErrorMessage(WorkbenchMessages.format("WizardNewFileCreationPage.fileExistsMessage", new String[] {systemFile.getPath()}));
- valid = false;
- }
-
- // Avoid draw flicker by clearing error message
- // if all is valid.
- if (valid) {
- setMessage(null);
- setErrorMessage(null);
- }
-
- return valid;
-}
-
-/*
- * @see DialogPage.setVisible(boolean)
- */
-public void setVisible(boolean visible) {
- super.setVisible(visible);
- if(visible)
- resourceGroup.setFocus();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewFolderMainPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewFolderMainPage.java
deleted file mode 100644
index f1275a3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewFolderMainPage.java
+++ /dev/null
@@ -1,319 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/**
- * Copyright (c) 2000, 2002 IBM Corp. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * Nick Edgar: Initial Implementation
- * Simon Arsenault: Fix for PR 2248, 2473
- * Randy Giffen: Help Support
- * Karice MacIntyre: Print Support
- * Leon J. Breedt: Added multiple folder creation support
- * Tod Creasey: Integration of patches
- */
-
-import java.lang.reflect.InvocationTargetException;
-import java.text.MessageFormat;
-import java.util.Iterator;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.misc.ResourceAndContainerGroup;
-/**
- * Standard main page for a wizard that creates a folder resource.
- * <p>
- * This page may be used by clients as-is; it may be also be subclassed to suit.
- * </p>
- * <p>
- * Subclasses may extend
- * <ul>
- * <li><code>handleEvent</code></li>
- * </ul>
- * </p>
- */
-public class WizardNewFolderMainPage extends WizardPage implements Listener {
- private IStructuredSelection currentSelection;
- private IContainer currentParent;
-
- private IFolder newFolder;
-
- // widgets
- private ResourceAndContainerGroup resourceGroup;
-/**
- * Creates a new folder creation wizard page. If the initial resource selection
- * contains exactly one container resource then it will be used as the default
- * container resource.
- *
- * @param pageName the name of the page
- * @param selection the current resource selection
- */
-public WizardNewFolderMainPage(String pageName, IStructuredSelection selection) {
- super("newFolderPage1");//$NON-NLS-1$
- setTitle(pageName);
- setDescription(WorkbenchMessages.getString("WizardNewFolderMainPage.description")); //$NON-NLS-1$
- this.currentSelection = selection;
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
- // top level group
- Composite composite = new Composite(parent,SWT.NONE);
- composite.setFont(parent.getFont());
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(
- GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.NEW_FOLDER_WIZARD_PAGE);
-
- resourceGroup = new ResourceAndContainerGroup(composite,this,WorkbenchMessages.getString("WizardNewFolderMainPage.folderName"), WorkbenchMessages.getString("WizardNewFolderMainPage.folderLabel"), false); //$NON-NLS-2$ //$NON-NLS-1$
- resourceGroup.setAllowExistingResources(false);
- initializePage();
- validatePage();
- // Show description on opening
- setErrorMessage(null);
- setMessage(null);
- setControl(composite);
-}
-/**
- * Creates a folder resource given the folder handle.
- *
- * @param folderHandle the folder handle to create a folder resource for
- * @param monitor the progress monitor to show visual progress with
- * @exception CoreException if the operation fails
- * @exception OperationCanceledException if the operation is canceled
- */
-protected void createFolder(IFolder folderHandle, IProgressMonitor monitor) throws CoreException {
- try {
- // Create the folder resource in the workspace
- // Update: Recursive to create any folders which do not exist already
- if (!folderHandle.exists()) {
- IContainer parent= folderHandle.getParent();
- if (parent instanceof IFolder && (!((IFolder)parent).exists())) {
- createFolder((IFolder)parent, monitor);
- }
- folderHandle.create(false, true, monitor);
- }
- }
- catch (CoreException e) {
- // If the folder already existed locally, just refresh to get contents
- if (e.getStatus().getCode() == IResourceStatus.PATH_OCCUPIED)
- folderHandle.refreshLocal(IResource.DEPTH_INFINITE, new SubProgressMonitor(monitor, 500));
- else
- throw e;
- }
-
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-}
-
-/**
- * Creates a folder resource handle for the folder with the given workspace path.
- * This method does not create the folder resource; this is the responsibility
- * of <code>createFolder</code>.
- *
- * @param folderPath the path of the folder resource to create a handle for
- * @return the new folder resource handle
- * @see #createFolder
- */
-protected IFolder createFolderHandle(IPath folderPath) {
- return WorkbenchPlugin.getPluginWorkspace().getRoot().getFolder(folderPath);
-}
-/**
- * Creates a new folder resource in the selected container and with the selected
- * name. Creates any missing resource containers along the path; does nothing if
- * the container resources already exist.
- * <p>
- * In normal usage, this method is invoked after the user has pressed Finish on
- * the wizard; the enablement of the Finish button implies that all controls on
- * this page currently contain valid values.
- * </p>
- * <p>
- * Note that this page caches the new folder once it has been successfully
- * created; subsequent invocations of this method will answer the same
- * folder resource without attempting to create it again.
- * </p>
- * <p>
- * This method should be called within a workspace modify operation since
- * it creates resources.
- * </p>
- *
- * @return the created folder resource, or <code>null</code> if the folder
- * was not created
- */
-public IFolder createNewFolder() {
- if (newFolder != null)
- return newFolder;
-
- // create the new folder and cache it if successful
- final IPath containerPath = resourceGroup.getContainerFullPath();
- IPath newFolderPath = containerPath.append(resourceGroup.getResource());
- final IFolder newFolderHandle = createFolderHandle(newFolderPath);
-
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(IProgressMonitor monitor) throws CoreException {
- try {
- monitor.beginTask(WorkbenchMessages.getString("WizardNewFolderCreationPage.progress"), 2000); //$NON-NLS-1$
- ContainerGenerator generator = new ContainerGenerator(containerPath);
- generator.generateContainer(new SubProgressMonitor(monitor, 1000));
- createFolder(newFolderHandle, new SubProgressMonitor(monitor, 1000));
- } finally {
- monitor.done();
- }
- }
- };
-
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return null;
- } catch (InvocationTargetException e) {
- if (e.getTargetException() instanceof CoreException) {
- ErrorDialog.openError(
- getContainer().getShell(), // Was Utilities.getFocusShell()
- WorkbenchMessages.getString("WizardNewFolderCreationPage.errorTitle"), //$NON-NLS-1$
- null, // no special message
- ((CoreException) e.getTargetException()).getStatus());
- }
- else {
- // CoreExceptions are handled above, but unexpected runtime exceptions and errors may still occur.
-
- WorkbenchPlugin.log(MessageFormat.format("Exception in {0}.getNewFolder(): {1}", new Object[] {getClass().getName(),e.getTargetException()}));//$NON-NLS-1$
- MessageDialog.openError(getContainer().getShell(), WorkbenchMessages.getString("WizardNewFolderCreationPage.internalErrorTitle"), WorkbenchMessages.format("WizardNewFolder.internalError", new Object[] {e.getTargetException().getMessage()})); //$NON-NLS-2$ //$NON-NLS-1$
- }
- return null; // ie.- one of the steps resulted in a core exception
- }
-
- newFolder = newFolderHandle;
-
- return newFolder;
-}
-/**
- * The <code>WizardNewFolderCreationPage</code> implementation of this
- * <code>Listener</code> method handles all events and enablements for controls
- * on this page. Subclasses may extend.
- */
-public void handleEvent(Event ev) {
- setPageComplete(validatePage());
-}
-/**
- * Initializes this page's controls.
- */
-protected void initializePage() {
- Iterator enum = currentSelection.iterator();
- if (enum.hasNext()) {
- Object next = enum.next();
- IResource selectedResource = null;
- if (next instanceof IResource) {
- selectedResource = (IResource)next;
- } else if (next instanceof IAdaptable) {
- selectedResource = (IResource)((IAdaptable)next).getAdapter(IResource.class);
- }
- if (selectedResource != null) {
- if (selectedResource.getType() == IResource.FILE)
- selectedResource = selectedResource.getParent();
- if (selectedResource.isAccessible())
- resourceGroup.setContainerFullPath(selectedResource.getFullPath());
- }
- }
-
- setPageComplete(false);
-}
-/**
- * Returns whether this page's controls currently all contain valid
- * values.
- *
- * @return <code>true</code> if all controls are valid, and
- * <code>false</code> if at least one is invalid
- */
-protected boolean validatePage() {
- boolean valid = true;
-
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
-
- IStatus nameStatus = null;
- String folderName = resourceGroup.getResource();
- if (folderName.indexOf(IPath.SEPARATOR) != -1) {
- StringTokenizer tok = new StringTokenizer(folderName, String.valueOf(IPath.SEPARATOR));
- while (tok.hasMoreTokens()) {
- String pathFragment = tok.nextToken();
- nameStatus = workspace.validateName(pathFragment, IResource.FOLDER);
- if (!nameStatus.isOK()) {
- break;
- }
- }
- }
-
- //If the name status was not set validate using the name
- if(nameStatus == null)
- nameStatus =
- workspace.validateName(folderName, IResource.FOLDER);
-
- if (!nameStatus.isOK()) {
- setErrorMessage(nameStatus.getMessage());
- return false;
- }
-
- if (!resourceGroup.areAllValuesValid()) {
- // if blank name then fail silently
- if (resourceGroup.getProblemType() == ResourceAndContainerGroup.PROBLEM_RESOURCE_EMPTY
- || resourceGroup.getProblemType() == ResourceAndContainerGroup.PROBLEM_CONTAINER_EMPTY) {
- setMessage(resourceGroup.getProblemMessage());
- setErrorMessage(null);
- } else
- setErrorMessage(resourceGroup.getProblemMessage());
- valid = false;
- }
-
- // Avoid draw flicker by clearing error message
- // if all is valid.
- if (valid) {
- setErrorMessage(null);
- setMessage(null);
- }
-
- return valid;
-}
-
-/*
- * @see DialogPage.setVisible(boolean)
- */
-public void setVisible(boolean visible) {
- super.setVisible(visible);
- if(visible)
- resourceGroup.setFocus();
-}
-
-}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewProjectCreationPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewProjectCreationPage.java
deleted file mode 100644
index 365dd9d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewProjectCreationPage.java
+++ /dev/null
@@ -1,407 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.File;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-
-/**
- * Standard main page for a wizard that is creates a project resource.
- * <p>
- * This page may be used by clients as-is; it may be also be subclassed to suit.
- * </p>
- * <p>
- * Example useage:
- * <pre>
- * mainPage = new WizardNewProjectCreationPage("basicNewProjectPage");
- * mainPage.setTitle("Project");
- * mainPage.setDescription("Create a new project resource.");
- * </pre>
- * </p>
- */
-public class WizardNewProjectCreationPage extends WizardPage {
-
- private boolean useDefaults = true;
-
- // initial value stores
- private String initialProjectFieldValue;
- private IPath initialLocationFieldValue;
-
- // the value the user has entered
- private String customLocationFieldValue;
-
- // widgets
- private Text projectNameField;
- private Text locationPathField;
- private Label locationLabel;
- private Button browseButton;
-
- private Listener nameModifyListener = new Listener() {
- public void handleEvent(Event e) {
- setLocationForSelection();
- setPageComplete(validatePage());
- }
- };
-
- private Listener locationModifyListener = new Listener() {
- public void handleEvent(Event e) {
- setPageComplete(validatePage());
- }
- };
-
- // constants
- private static final int SIZING_TEXT_FIELD_WIDTH = 250;
- private static final int SIZING_INDENTATION_WIDTH = 10;
-/**
- * Creates a new project creation wizard page.
- *
- * @param pageName the name of this page
- */
-public WizardNewProjectCreationPage(String pageName) {
- super(pageName);
- setPageComplete(false);
- initialLocationFieldValue = Platform.getLocation();
- customLocationFieldValue = ""; //$NON-NLS-1$
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setFont(parent.getFont());
-
- initializeDialogUnits(parent);
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.NEW_PROJECT_WIZARD_PAGE);
-
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createProjectNameGroup(composite);
- createProjectLocationGroup(composite);
- setPageComplete(validatePage());
- // Show description on opening
- setErrorMessage(null);
- setMessage(null);
- setControl(composite);
-}
-/**
- * Creates the project location specification controls.
- *
- * @param parent the parent composite
- */
-private final void createProjectLocationGroup(Composite parent) {
-
-
- Font font = parent.getFont();
- // project specification group
- Group projectGroup = new Group(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- projectGroup.setFont(font);
- projectGroup.setText(WorkbenchMessages.getString("WizardNewProjectCreationPage.projectContentsLabel")); //$NON-NLS-1$
-
- final Button useDefaultsButton = new Button(projectGroup, SWT.CHECK | SWT.RIGHT);
- useDefaultsButton.setText(WorkbenchMessages.getString("WizardNewProjectCreationPage.useDefaultLabel")); //$NON-NLS-1$
- useDefaultsButton.setSelection(useDefaults);
- useDefaultsButton.setFont(font);
-
- GridData buttonData = new GridData();
- buttonData.horizontalSpan = 3;
- useDefaultsButton.setLayoutData(buttonData);
-
- createUserSpecifiedProjectLocationGroup(projectGroup, !useDefaults);
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- useDefaults = useDefaultsButton.getSelection();
- browseButton.setEnabled(!useDefaults);
- locationPathField.setEnabled(!useDefaults);
- locationLabel.setEnabled(!useDefaults);
- if (useDefaults) {
- customLocationFieldValue = locationPathField.getText();
- setLocationForSelection();
- } else {
- locationPathField.setText(customLocationFieldValue);
- }
- }
- };
- useDefaultsButton.addSelectionListener(listener);
-}
-/**
- * Creates the project name specification controls.
- *
- * @param parent the parent composite
- */
-private final void createProjectNameGroup(Composite parent) {
- // project specification group
- Composite projectGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // new project label
- Label projectLabel = new Label(projectGroup, SWT.NONE);
- projectLabel.setText(WorkbenchMessages.getString("WizardNewProjectCreationPage.nameLabel")); //$NON-NLS-1$
- projectLabel.setFont(parent.getFont());
-
- // new project name entry field
- projectNameField = new Text(projectGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- projectNameField.setLayoutData(data);
- projectNameField.setFont(parent.getFont());
-
- // Set the initial value first before listener
- // to avoid handling an event during the creation.
- if (initialProjectFieldValue != null)
- projectNameField.setText(initialProjectFieldValue);
- projectNameField.addListener(SWT.Modify, nameModifyListener);
-}
-/**
- * Creates the project location specification controls.
- *
- * @param projectGroup the parent composite
- * @param boolean - the initial enabled state of the widgets created
- */
-private void createUserSpecifiedProjectLocationGroup(Composite projectGroup, boolean enabled) {
-
- Font font = projectGroup.getFont();
-
- // location label
- locationLabel = new Label(projectGroup,SWT.NONE);
- locationLabel.setText(WorkbenchMessages.getString("WizardNewProjectCreationPage.locationLabel")); //$NON-NLS-1$
- locationLabel.setEnabled(enabled);
- locationLabel.setFont(font);
-
- // project location entry field
- locationPathField = new Text(projectGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- locationPathField.setLayoutData(data);
- locationPathField.setEnabled(enabled);
- locationPathField.setFont(font);
-
- // browse button
- browseButton = new Button(projectGroup, SWT.PUSH);
- browseButton.setText(WorkbenchMessages.getString("WizardNewProjectCreationPage.browseLabel")); //$NON-NLS-1$
- browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- handleLocationBrowseButtonPressed();
- }
- });
-
- browseButton.setEnabled(enabled);
- browseButton.setFont(font);
- setButtonLayoutData(browseButton);
-
- // Set the initial value first before listener
- // to avoid handling an event during the creation.
- locationPathField.setText(initialLocationFieldValue.toOSString());
- locationPathField.addListener(SWT.Modify, locationModifyListener);
-}
-/**
- * Returns the current project location path as entered by
- * the user, or its anticipated initial value.
- * Note that if the default has been returned the path
- * in a project description used to create a project
- * should not be set.
- *
- * @return the project location path or its anticipated initial value.
- */
-public IPath getLocationPath() {
- if (useDefaults)
- return initialLocationFieldValue;
-
- return new Path(getProjectLocationFieldValue());
-}
-/**
- * Creates a project resource handle for the current project name field value.
- * <p>
- * This method does not create the project resource; this is the responsibility
- * of <code>IProject::create</code> invoked by the new project resource wizard.
- * </p>
- *
- * @return the new project resource handle
- */
-public IProject getProjectHandle() {
- return ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName());
-}
-/**
- * Returns the current project name as entered by the user, or its anticipated
- * initial value.
- *
- * @return the project name, its anticipated initial value, or <code>null</code>
- * if no project name is known
- */
-public String getProjectName() {
- if (projectNameField == null)
- return initialProjectFieldValue;
-
- return getProjectNameFieldValue();
-}
-/**
- * Returns the value of the project name field
- * with leading and trailing spaces removed.
- *
- * @return the project name in the field
- */
-private String getProjectNameFieldValue() {
- if (projectNameField == null)
- return ""; //$NON-NLS-1$
- else
- return projectNameField.getText().trim();
-}
-/**
- * Returns the value of the project location field
- * with leading and trailing spaces removed.
- *
- * @return the project location directory in the field
- */
-private String getProjectLocationFieldValue() {
- if (locationPathField == null)
- return ""; //$NON-NLS-1$
- else
- return locationPathField.getText().trim();
-}
-/**
- * Open an appropriate directory browser
- */
-private void handleLocationBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell());
- dialog.setMessage(WorkbenchMessages.getString("WizardNewProjectCreationPage.directoryLabel")); //$NON-NLS-1$
-
- String dirName = getProjectLocationFieldValue();
- if (!dirName.equals("")) { //$NON-NLS-1$
- File path = new File(dirName);
- if (path.exists())
- dialog.setFilterPath(new Path(dirName).toOSString());
- }
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null) {
- customLocationFieldValue = selectedDirectory;
- locationPathField.setText(customLocationFieldValue);
- }
-}
-/**
- * Sets the initial project name that this page will use when
- * created. The name is ignored if the createControl(Composite)
- * method has already been called. Leading and trailing spaces
- * in the name are ignored.
- *
- * @param name initial project name for this page
- */
-public void setInitialProjectName(String name) {
- if (name == null)
- initialProjectFieldValue = null;
- else{
- initialProjectFieldValue = name.trim();
- initialLocationFieldValue = new Path(getDefaultLocationForName(initialProjectFieldValue));
- }
-}
-/**
- * Set the location to the default location if we are set to useDefaults.
- */
-private void setLocationForSelection() {
- if (useDefaults)
- locationPathField.setText(getDefaultLocationForName(getProjectNameFieldValue()));
-}
-
-/**
- * Get the defualt location for the provided name.
- * @return String
- * @param String
- */
-
-private String getDefaultLocationForName(String nameValue) {
- IPath defaultPath = Platform.getLocation().append(nameValue);
- return defaultPath.toOSString();
-}
-/**
- * Returns whether this page's controls currently all contain valid
- * values.
- *
- * @return <code>true</code> if all controls are valid, and
- * <code>false</code> if at least one is invalid
- */
-protected boolean validatePage() {
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
-
- String projectFieldContents = getProjectNameFieldValue();
- if (projectFieldContents.equals("")) { //$NON-NLS-1$
- setErrorMessage(null);
- setMessage(WorkbenchMessages.getString("WizardNewProjectCreationPage.projectNameEmpty")); //$NON-NLS-1$
- return false;
- }
-
- IStatus nameStatus =
- workspace.validateName(projectFieldContents, IResource.PROJECT);
- if (!nameStatus.isOK()) {
- setErrorMessage(nameStatus.getMessage());
- return false;
- }
-
- String locationFieldContents = getProjectLocationFieldValue();
-
- if (locationFieldContents.equals("")) { //$NON-NLS-1$
- setErrorMessage(null);
- setMessage(WorkbenchMessages.getString("WizardNewProjectCreationPage.projectLocationEmpty")); //$NON-NLS-1$
- return false;
- }
-
- IPath path = new Path("");//$NON-NLS-1$
- if (!path.isValidPath(locationFieldContents)) {
- setErrorMessage(WorkbenchMessages.getString("WizardNewProjectCreationPage.locationError")); //$NON-NLS-1$
- return false;
- }
- if (!useDefaults && Platform.getLocation().isPrefixOf(new Path(locationFieldContents))) {
- setErrorMessage(WorkbenchMessages.getString("WizardNewProjectCreationPage.defaultLocationError")); //$NON-NLS-1$
- return false;
- }
-
-
- if (getProjectHandle().exists()) {
- setErrorMessage(WorkbenchMessages.getString("WizardNewProjectCreationPage.projectExistsMessage")); //$NON-NLS-1$
- return false;
- }
-
- setErrorMessage(null);
- setMessage(null);
- return true;
-}
-
-/*
- * see @DialogPage.setVisible(boolean)
- */
-public void setVisible(boolean visible) {
- super.setVisible(visible);
- if(visible)
- projectNameField.setFocus();
-}
-
-/**
- * Returns the useDefaults.
- * @return boolean
- */
-public boolean useDefaults() {
- return useDefaults;
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewProjectReferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewProjectReferencePage.java
deleted file mode 100644
index 745c9a9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardNewProjectReferencePage.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.*;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * Standard project reference page for a wizard that creates a
- * project resource.
- * <p>
- * This page may be used by clients as-is; it may be also be
- * subclassed to suit.
- * </p>
- * <p>
- * Example useage:
- * <pre>
- * referencePage = new WizardNewProjectReferencePage("basicReferenceProjectPage");
- * referencePage.setTitle("Project");
- * referencePage.setDescription("Select referenced projects.");
- * </pre>
- * </p>
- */
-public class WizardNewProjectReferencePage extends WizardPage {
- // widgets
- private CheckboxTableViewer referenceProjectsViewer;
-
- private static final String REFERENCED_PROJECTS_TITLE = WorkbenchMessages.getString("WizardNewProjectReferences.title"); //$NON-NLS-1$
- private static final int PROJECT_LIST_MULTIPLIER = 15;
-/**
- * Creates a new project reference wizard page.
- *
- * @param pageName the name of this page
- */
-public WizardNewProjectReferencePage(String pageName) {
- super(pageName);
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
-
- Font font = parent.getFont();
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- composite.setFont(font);
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.NEW_PROJECT_REFERENCE_WIZARD_PAGE);
-
- Label referenceLabel = new Label(composite, SWT.NONE);
- referenceLabel.setText(REFERENCED_PROJECTS_TITLE);
- referenceLabel.setFont(font);
-
- referenceProjectsViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
- referenceProjectsViewer.getTable().setFont(composite.getFont());
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
-
- data.heightHint =
- getDefaultFontHeight(
- referenceProjectsViewer.getTable(),
- PROJECT_LIST_MULTIPLIER);
- referenceProjectsViewer.getTable().setLayoutData(data);
- referenceProjectsViewer.setLabelProvider(new WorkbenchLabelProvider());
- referenceProjectsViewer.setContentProvider(getContentProvider());
- referenceProjectsViewer.setInput(ResourcesPlugin.getWorkspace());
-
- setControl(composite);
-}
-/**
- * Returns a content provider for the reference project
- * viewer. It will return all projects in the workspace.
- *
- * @return the content provider
- */
-protected IStructuredContentProvider getContentProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object element) {
- if (!(element instanceof IWorkspace))
- return new Object[0];
- IProject[] projects = ((IWorkspace)element).getRoot().getProjects();
- return projects == null ? new Object[0] : projects;
- }
- };
-}
-/**
- * Get the defualt widget height for the supplied control.
- * @return int
- * @param control - the control being queried about fonts
- * @param lines - the number of lines to be shown on the table.
- */
-private static int getDefaultFontHeight(Control control, int lines) {
- FontData[] viewerFontData = control.getFont().getFontData();
- int fontHeight = 10;
-
- //If we have no font data use our guess
- if (viewerFontData.length > 0)
- fontHeight = viewerFontData[0].getHeight();
- return lines * fontHeight;
-
-}
-/**
- * Returns the referenced projects selected by the user.
- *
- * @return the referenced projects
- */
-public IProject[] getReferencedProjects() {
- Object[] elements = referenceProjectsViewer.getCheckedElements();
- IProject[] projects = new IProject[elements.length];
- System.arraycopy(elements, 0, projects, 0, elements.length);
- return projects;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardResourceImportPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardResourceImportPage.java
deleted file mode 100644
index 401a4c7..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/WizardResourceImportPage.java
+++ /dev/null
@@ -1,514 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.Map;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.dialogs.IElementFilter;
-import org.eclipse.ui.internal.dialogs.ResourceTreeAndListGroup;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.model.WorkbenchViewerSorter;
-
-/**
- * The abstract superclass for a typical import wizard's main page.
- * <p>
- * Clients may subclass this page to inherit its common destination resource
- * selection facilities.
- * </p>
- * <p>
- * Subclasses must implement
- * <ul>
- * <li><code>createSourceGroup</code></li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may override
- * <ul>
- * <li><code>allowNewContainerName</code></li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may extend
- * <ul>
- * <li><code>handleEvent</code></li>
- * </ul>
- * </p>
- */
-public abstract class WizardResourceImportPage extends WizardDataTransferPage {
- private IResource currentResourceSelection;
-
- // initial value stores
- private String initialContainerFieldValue;
- protected java.util.List selectedTypes = new ArrayList();
-
- // widgets
- private Text containerNameField;
- private Button containerBrowseButton;
- protected ResourceTreeAndListGroup selectionGroup;
-
- private final static int SIZING_SELECTION_WIDGET_WIDTH = 400;
- private final static int SIZING_SELECTION_WIDGET_HEIGHT = 150;
-
-
- //messages
- private static final String EMPTY_FOLDER_MESSAGE = WorkbenchMessages.getString("WizardImportPage.specifyFolder"); //$NON-NLS-1$
- private static final String INACCESSABLE_FOLDER_MESSAGE = WorkbenchMessages.getString("WizardImportPage.folderMustExist"); //$NON-NLS-1$
-
-/**
- * Creates an import wizard page. If the initial resource selection
- * contains exactly one container resource then it will be used as the default
- * import destination.
- *
- * @param pageName the name of the page
- * @param selection the current resource selection
- */
-protected WizardResourceImportPage(String name, IStructuredSelection selection) {
- super(name);
-
- //Initialize to null
- currentResourceSelection = null;
- if (selection.size() == 1){
- Object firstElement = selection.getFirstElement();
- if(firstElement instanceof IAdaptable){
- Object resource = ((IAdaptable) firstElement).getAdapter(IResource.class);
- if(resource != null)
- currentResourceSelection = (IResource) resource;
- }
- }
-
- if (currentResourceSelection != null) {
- if (currentResourceSelection.getType() == IResource.FILE)
- currentResourceSelection = currentResourceSelection.getParent();
-
- if (!currentResourceSelection.isAccessible())
- currentResourceSelection = null;
- }
-
-}
-/**
- * The <code>WizardResourceImportPage</code> implementation of this
- * <code>WizardDataTransferPage</code> method returns <code>true</code>.
- * Subclasses may override this method.
- */
-protected boolean allowNewContainerName() {
- return true;
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
-
- 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.setSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- composite.setFont(parent.getFont());
-
- createSourceGroup(composite);
-
- createSpacer(composite);
-
- createPlainLabel(composite, WorkbenchMessages.getString("WizardImportPage.destinationLabel")); //$NON-NLS-1$
- createDestinationGroup(composite);
-
- createOptionsGroup(composite);
-
- restoreWidgetValues();
- updateWidgetEnablements();
- setPageComplete(determinePageCompletion());
-
- setControl(composite);
-}
-/**
- * Creates the import destination specification controls.
- *
- * @param parent the parent control
- */
-protected final void createDestinationGroup(Composite parent) {
- // container specification group
- Composite containerGroup = new Composite(parent,SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- containerGroup.setLayout(layout);
- containerGroup.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
- containerGroup.setFont(parent.getFont());
-
-
- // container label
- Label resourcesLabel = new Label(containerGroup,SWT.NONE);
- resourcesLabel.setText(WorkbenchMessages.getString("WizardExportPage.folder")); //$NON-NLS-1$
- resourcesLabel.setFont(parent.getFont());
-
- // container name entry field
- containerNameField = new Text(containerGroup,SWT.SINGLE|SWT.BORDER);
- containerNameField.addListener(SWT.Modify,this);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- containerNameField.setLayoutData(data);
- containerNameField.setFont(parent.getFont());
-
- // container browse button
- containerBrowseButton = new Button(containerGroup,SWT.PUSH);
- containerBrowseButton.setText(WorkbenchMessages.getString("WizardImportPage.browse2")); //$NON-NLS-1$
- containerBrowseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- containerBrowseButton.addListener(SWT.Selection,this);
- containerBrowseButton.setFont(parent.getFont());
-
- initialPopulateContainerField();
-}
-/**
- * Create the import source selection widget
- */
-protected void createFileSelectionGroup(Composite parent) {
-
- //Just create with a dummy root.
- this.selectionGroup =
- new ResourceTreeAndListGroup(
- parent,
- new FileSystemElement("Dummy", null, true),//$NON-NLS-1$
- getFolderProvider(),
- new WorkbenchLabelProvider(),
- getFileProvider(),
- new WorkbenchLabelProvider(),
- SWT.NONE,
- SIZING_SELECTION_WIDGET_WIDTH,
- SIZING_SELECTION_WIDGET_HEIGHT);
-
- ICheckStateListener listener = new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- updateWidgetEnablements();
- }
- };
-
- WorkbenchViewerSorter sorter = new WorkbenchViewerSorter();
- this.selectionGroup.setTreeSorter(sorter);
- this.selectionGroup.setListSorter(sorter);
- this.selectionGroup.addCheckStateListener(listener);
-
-}
-/**
- * Creates the import source specification controls.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @param parent the parent control
- */
-protected abstract void createSourceGroup(Composite parent);
-
-/*
- * @see WizardDataTransferPage.getErrorDialogTitle()
- */
-protected String getErrorDialogTitle(){
- return WorkbenchMessages.getString("WizardImportPage.errorDialogTitle");
-}
-
-/**
- * Returns the path of the container resource specified in the container
- * name entry field, or <code>null</code> if no name has been typed in.
- * <p>
- * The container specified by the full path might not exist and would need to
- * be created.
- * </p>
- *
- * @return the full path of the container resource specified in
- * the container name entry field, or <code>null</code>
- */
-protected IPath getContainerFullPath() {
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
-
- //make the path absolute to allow for optional leading slash
- IPath testPath = getResourcePath();
-
- if(testPath.equals(workspace.getRoot().getFullPath()))
- return testPath;
-
- IStatus result =
- workspace.validatePath(
- testPath.toString(),
- IResource.PROJECT | IResource.FOLDER | IResource.ROOT);
- if (result.isOK()) {
- return testPath;
- }
-
- return null;
-}
-/**
- * Returns a content provider for <code>FileSystemElement</code>s that returns
- * only files as children.
- */
-protected abstract ITreeContentProvider getFileProvider();
-/**
- * Returns a content provider for <code>FileSystemElement</code>s that returns
- * only folders as children.
- */
-protected abstract ITreeContentProvider getFolderProvider();
-/**
- * Return the path for the resource field.
- * @return IPath
- */
-protected IPath getResourcePath() {
- return getPathFromText(this.containerNameField);
-}
-/**
- * Returns this page's list of currently-specified resources to be
- * imported. This is the primary resource selection facility accessor for
- * subclasses.
- *
- * @return a list of resources currently selected
- * for export (element type: <code>IResource</code>)
- */
-protected java.util.List getSelectedResources() {
- return this.selectionGroup.getAllCheckedListItems();
-}
-
-/**
- * Returns this page's list of currently-specified resources to be
- * imported filtered by the IElementFilter.
- *
- */
-protected void getSelectedResources(IElementFilter filter, IProgressMonitor monitor) throws InterruptedException{
- this.selectionGroup.getAllCheckedListItems(filter,monitor);
-}
-
-/**
- * Returns the container resource specified in the container name entry field,
- * or <code>null</code> if such a container does not exist in the workbench.
- *
- * @return the container resource specified in the container name entry field,
- * or <code>null</code>
- */
-protected IContainer getSpecifiedContainer() {
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
- IPath path = getContainerFullPath();
- if (workspace.getRoot().exists(path))
- return (IContainer) workspace.getRoot().findMember(path);
-
- return null;
-}
-/**
- * Returns a collection of the currently-specified resource types for
- * use by the type selection dialog.
- */
-protected java.util.List getTypesToImport() {
-
- return selectedTypes;
-}
-/**
- * Opens a container selection dialog and displays the user's subsequent
- * container resource selection in this page's container name field.
- */
-protected void handleContainerBrowseButtonPressed() {
- // see if the user wishes to modify this container selection
- IPath containerPath =
- queryForContainer(getSpecifiedContainer(), WorkbenchMessages.getString("WizardImportPage.selectFolderLabel")); //$NON-NLS-1$
-
- // if a container was selected then put its name in the container name field
- if (containerPath != null) { // null means user cancelled
- setErrorMessage(null);
- containerNameField.setText(containerPath.makeRelative().toString());
- }
-}
-/**
- * The <code>WizardResourceImportPage</code> implementation of this
- * <code>Listener</code> method handles all events and enablements for controls
- * on this page. Subclasses may extend.
- * @param event Event
- */
-public void handleEvent(Event event) {
- Widget source = event.widget;
-
- if (source == containerBrowseButton)
- handleContainerBrowseButtonPressed();
-
- updateWidgetEnablements();
-}
-/**
- * Open a registered type selection dialog and note the selections
- * in the receivers types-to-export field
- */
-protected void handleTypesEditButtonPressed() {
-
- TypeFilteringDialog dialog =
- new TypeFilteringDialog(getContainer().getShell(), getTypesToImport());
-
- dialog.open();
-
- Object[] newSelectedTypes = dialog.getResult();
- if (newSelectedTypes != null) { // ie.- did not press Cancel
- this.selectedTypes = new ArrayList(newSelectedTypes.length);
- for (int i = 0; i < newSelectedTypes.length; i++)
- this.selectedTypes.add(newSelectedTypes[i]);
-
- setupSelectionsBasedOnSelectedTypes();
- }
-
-}
-/**
- * Sets the initial contents of the container name field.
- */
-protected final void initialPopulateContainerField() {
- if (initialContainerFieldValue != null)
- containerNameField.setText(initialContainerFieldValue);
- else if (currentResourceSelection != null)
- containerNameField.setText(currentResourceSelection.getFullPath().makeRelative().toString());
-}
-/**
- * Set all of the selections in the selection group to value
- * @param value boolean
- */
-protected void setAllSelections(boolean value) {
- selectionGroup.setAllSelections(value);
-}
-/**
- * Sets the value of this page's container resource field, or stores
- * it for future use if this page's controls do not exist yet.
- *
- * @param value String
- */
-public void setContainerFieldValue(String value) {
- if (containerNameField == null)
- initialContainerFieldValue = value;
- else
- containerNameField.setText(value);
-}
-/**
- * Update the tree to only select those elements that match the selected types.
- * Do nothing by default.
- */
-protected void setupSelectionsBasedOnSelectedTypes() {
-}
-/**
- * Update the selections with those in map .
- * @param map Map - key tree elements, values Lists of list elements
- */
-protected void updateSelections(final Map map) {
-
- Runnable runnable = new Runnable() {
- public void run(){
- selectionGroup.updateSelections(map);
- }
- };
-
- BusyIndicator.showWhile(getShell().getDisplay(),runnable);
-}
-/**
- * Check if widgets are enabled or disabled by a change in the dialog.
- * @param event Event
- */
-protected void updateWidgetEnablements() {
-
- boolean pageComplete = determinePageCompletion();
- setPageComplete(pageComplete);
- if (pageComplete)
- setMessage(null);
- super.updateWidgetEnablements();
-}
-/* (non-Javadoc)
- * Method declared on WizardDataTransferPage.
- */
-protected final boolean validateDestinationGroup() {
-
- IPath containerPath = getContainerFullPath();
- if (containerPath == null) {
- setMessage(EMPTY_FOLDER_MESSAGE);
- return false;
- }
-
- // If the container exist, validate it
- IContainer container = getSpecifiedContainer();
- if (container == null) {
- //if it is does not exist be sure the project does
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
- IPath projectPath =
- containerPath.removeLastSegments(containerPath.segmentCount() - 1);
-
- if (workspace.getRoot().exists(projectPath))
- return true;
- else {
- setErrorMessage(WorkbenchMessages.getString("WizardImportPage.projectNotExist")); //$NON-NLS-1$
- return false;
- }
- } else {
- if (!container.isAccessible()) {
- setErrorMessage(INACCESSABLE_FOLDER_MESSAGE);
- return false;
- }
- }
-
- if(sourceConflictsWithDestination(containerPath)){
- setErrorMessage(getSourceConflictMessage());
- return false;
- }
-
- return true;
-
-}
-
-/**
- * Returns the error message for when the source conflicts
- * with the destination.
- */
-protected final String getSourceConflictMessage(){
- return(
- WorkbenchMessages.getString(
- "WizardImportPage.importOnReceiver")); //$NON-NLS-1$
-}
-
-
-/**
- * Returns whether or not the source location conflicts
- * with the destination resource. By default this is not
- * checked, so <code>false</code> is returned.
- *
- * @param sourcePath the path being checked
- * @return <code>true</code> if the source location conflicts with the
- * destination resource, <code>false</code> if not
- */
-protected boolean sourceConflictsWithDestination(IPath sourcePath){
- return false;
-}
-
-/**
- * @see WizardDataTransferPage.determinePageCompletion.
- */
-protected boolean determinePageCompletion() {
- //Check for valid projects before making the user do anything
- if(noOpenProjects()){
- setErrorMessage(WorkbenchMessages.getString("WizardImportPage.noOpenProjects"));
- return false;
- }
- return super.determinePageCompletion();
-}
-
-/**
- * Returns whether or not the passed workspace has any
- * open projects
- * @return boolean
- */
-private boolean noOpenProjects(){
- IProject[] projects = WorkbenchPlugin.getPluginWorkspace().getRoot().getProjects();
- for(int i = 0; i < projects.length; i ++){
- if(projects[i].isOpen())
- return false;
- }
- return true;
-}
-}
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
deleted file mode 100644
index 50886ca..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/YesNoCancelListSelectionDialog.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.eclipse.ui.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * YesNoCancelListSelectionDialog is a list selection dialog that also allows the user
- * to select no as a result.
- *
- * @deprecated Providing Cancel in addition to Yes/No is confusing.
- * It is better to subclass the regular ListSelectionDialog, which uses OK/Cancel,
- * and provide a separate checkbox if necessary.
- */
-public class YesNoCancelListSelectionDialog extends ListSelectionDialog {
-/**
- * Create a list selection dialog with a possible Yes/No or Cancel result.
- *
- * @deprecated see class comment
- */
-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);
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-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;
- }
- }
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- WorkbenchHelp.setHelp(shell, IHelpContextIds.YES_NO_CANCEL_LIST_SELECTION_DIALOG);
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-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);
-
-}
-/**
- * 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);
-
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/package.html b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/package.html
deleted file mode 100644
index 9364ccb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/package.html
+++ /dev/null
@@ -1,18 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (WinNT; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Classes for standard dialogs, wizards, and preference
-pages in the Eclipse Platform User Interface.
-<h2>
-Package Specification</h2>
-This package provides useful classes for the definition of wizards, property
-pages and preference pages. It also provides standard dialogs such
-as the Save As dialog.
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/DialogPageContextComputer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/DialogPageContextComputer.java
deleted file mode 100644
index 6435d54..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/DialogPageContextComputer.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.ui.help;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.help.IContext;
-import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.swt.widgets.Control;
-import java.util.*;
-
-/**
- * For determining the help context for controls in a dialog page.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * @deprecated nested contexts are no longer supported by the help support system
- *
- * <p>
- */
-public class DialogPageContextComputer implements IContextComputer {
- private IDialogPage page;
- private ArrayList contextList;
- private Object context;
-/**
- * Creates a new context computer for the given dialog page and help context.
- *
- * @param page the dialog page
- * @param helpContext a single help context id (type <code>String</code>) or
- * help context object (type <code>IContext</code>)
- */
-public DialogPageContextComputer(IDialogPage page, Object helpContext) {
- Assert.isTrue(helpContext instanceof String || helpContext instanceof IContext);
- this.page = page;
- context = helpContext;
-}
-/**
- * Add the contexts to the context list.
- *
- * @param object the contexts (<code>Object[]</code> or <code>IContextComputer</code>)
- * @param event the help event
- */
-private void addContexts(Object object, HelpEvent event) {
- Assert.isTrue(
- object instanceof Object[] ||
- object instanceof IContextComputer ||
- object instanceof String);
-
- if (object instanceof String) {
- contextList.add(object);
- return;
- }
-
- Object[] contexts;
- if (object instanceof IContextComputer)
- // get local contexts
- contexts = ((IContextComputer)object).getLocalContexts(event);
- else
- contexts = (Object[])object;
-
- // copy the contexts into our list
- for (int i = 0; i < contexts.length; i++)
- contextList.add(contexts[i]);
-}
-/**
- * Add the contexts for the given control to the context list.
- *
- * @param event the control from which to obtain the contexts
- * @param event the help event
- */
-private void addContextsForControl(Control control, HelpEvent event) {
- // See if there is are help contexts on the control
- Object object = WorkbenchHelp.getHelp(control);
-
- if (object == null || object == this)
- // We need to check for this in order to avoid recursion
- return;
-
- addContexts(object, event);
-}
-/* (non-Javadoc)
- * Method declared on IContextComputer.
- */
-public Object[] computeContexts(HelpEvent event) {
- contextList = new ArrayList();
-
- // Add the local context
- contextList.add(context);
-
- // Add the contexts for the page
- addContextsForControl(page.getControl(), event);
-
- // Add the contexts for the container shell
- addContextsForControl(page.getControl().getShell(), event);
-
- // Return the contexts
- return contextList.toArray();
-}
-/**
- * Returns the context set on this page.
- *
- * @return the context set on this page. (type <code>String</code>) or
- * help context object (type <code>IContext</code>)
- */
-private Object getContext() {
- return context;
-}
-/* (non-Javadoc)
- * Method declared on IContextComputer.
- */
-public Object[] getLocalContexts(HelpEvent event) {
- return new Object[] {context};
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/IContextComputer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/IContextComputer.java
deleted file mode 100644
index 5883e7f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/IContextComputer.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.ui.help;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.events.HelpEvent;
-
-/**
- * A content computer is used to dynamically calculate help support contexts at the
- * time the user requests help.
- * <p>
- * This interface may be implemented by clients.
- * </p>
- * @deprecated nested contexts are no longer supported by the help support system
- *
- */
-public interface IContextComputer {
-/**
- * Computes contexts for the help system.
- *
- * @param event the help event which triggered this request for help
- * @return a mixed-type array of context ids (type <code>String</code>)
- * and/or help contexts (type <code>IContext</code>)
- * @see org.eclipse.help.IContext
- */
-public Object[] computeContexts(HelpEvent event);
-/**
- * Returns the local contexts for this context computer
- * <p>
- * Typically this method is called by other instances of
- * <code>IContextComputer</code> in their <code>computeContexts</code>
- * method.
- * </p>
- * <p>
- * The important concept here is that the value returned by
- * <code>computeContexts</code> represents the complete help
- * contexts and is passed directly to the help support system.
- * </p>
- * <p>
- * However the value returned by this method represents the
- * only the contexts for the particular control with which this
- * <code>IContextComputer</code> is associated.
- * </p>
- * @param event the help event which triggered this request for help
- * @return a mixed-type array of context ids (type <code>String</code>)
- * and/or help contexts (type <code>IContext</code>)
- * @see org.eclipse.help.IContext
- */
-public Object[] getLocalContexts(HelpEvent event);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/ViewContextComputer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/ViewContextComputer.java
deleted file mode 100644
index 5164822..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/ViewContextComputer.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.ui.help;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.help.*;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.swt.widgets.Control;
-import java.util.*;
-
-/**
- * For determining the help context for controls in a view.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * @deprecated nested contexts are no longer supported by the help support system
- */
-public class ViewContextComputer implements IContextComputer {
- private IViewPart view;
- private ArrayList contextList;
- private Object context;
-/**
- * Creates a new context computer for the given view and help context.
- *
- * @param viewPart the view
- * @param helpContext a single help context id (type <code>String</code>) or
- * help context object (type <code>IContext</code>)
- */
-public ViewContextComputer(IViewPart viewPart, Object helpContext) {
- Assert.isTrue(helpContext instanceof String || helpContext instanceof IContext);
- view = viewPart;
- context = helpContext;
-}
-/**
- * Add the contexts to the context list.
- *
- * @param object the contexts (<code>Object[]</code> or <code>IContextComputer</code>)
- * @param event the help event
- */
-private void addContexts(Object object, HelpEvent event) {
- Assert.isTrue(
- object instanceof Object[] ||
- object instanceof IContextComputer ||
- object instanceof String);
-
- if (object instanceof String) {
- contextList.add(object);
- return;
- }
-
- Object[] contexts;
- if (object instanceof IContextComputer)
- // get local contexts
- contexts = ((IContextComputer)object).getLocalContexts(event);
- else
- contexts = (Object[])object;
-
- // copy the contexts into our list
- for (int i = 0; i < contexts.length; i++)
- contextList.add(contexts[i]);
-}
-/**
- * Add the contexts for the given control to the context list.
- *
- * @param event the control from which to obtain the contexts
- * @param event the help event
- */
-private void addContextsForControl(Control control, HelpEvent event) {
- // See if there is are help contexts on the control
- Object object = WorkbenchHelp.getHelp(control);
-
- if (object == null || object == this)
- // We need to check for this in order to avoid recursion
- return;
-
- addContexts(object, event);
-}
-/* (non-Javadoc)
- * Method declared on IContextComputer.
- */
-public Object[] computeContexts(HelpEvent event) {
- contextList = new ArrayList();
-
- // Add the local context
- contextList.add(context);
-
- // Add the contexts for the window shell
- addContextsForControl(view.getSite().getShell(), event);
-
- // Return the contexts
- return contextList.toArray();
-}
-/* (non-Javadoc)
- * Method declared on IContextComputer.
- */
-public Object[] getLocalContexts(HelpEvent event) {
- return new Object[] {context};
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/WorkbenchHelp.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/WorkbenchHelp.java
deleted file mode 100644
index 1761c78..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/WorkbenchHelp.java
+++ /dev/null
@@ -1,546 +0,0 @@
-package org.eclipse.ui.help;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.help.*;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.swt.events.HelpListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Provides methods for accessing the help support system and for hooking
- * it in.
- * <p>
- * The help support system is optional, to allow some products to be configured
- * without one. The <code>getHelpSupport</code> method returns the help support
- * system if available.
- * </p>
- * <p>
- * The various <code>setHelp</code> methods allow help to be hooked in to SWT
- * menus, menu items, and controls, and into JFace actions. This involves
- * furnishing a help context id. When the user requests help for one of the
- * established widgets (for instance, by hitting F1), the context id is retrieved
- * and passed to the help support system using <code>IHelp.displayHelp(helpContexts,position)</code>.
- * </p>
- * <p>
- * In cases more dynamic situations, clients may hook their own help listner then
- * call <code>displayHelp</code> with a context id or <code>IContext</code>.
- * </p>
- * <p>
- * This class provides static methods only; it is not intended to be instantiated
- * or subclassed.
- * </p>
- *
- * @see org.eclipse.help.IHelp
- * @see #getHelpSupport
- */
-public class WorkbenchHelp {
- /**
- * Key used for stashing help-related data on SWT widgets.
- *
- * @see org.eclipse.swt.Widget.getData(java.lang.String)
- */
- private static final String HELP_KEY = "org.eclipse.ui.help";//$NON-NLS-1$
- private static final String HELP_SYSTEM_EXTENSION_ID = "org.eclipse.help.support";//$NON-NLS-1$
- private static final String HELP_SYSTEM_CLASS_ATTRIBUTE = "class";//$NON-NLS-1$
- private static IHelp helpSupport;
- private static boolean isIntialized = false;
- private static HelpListener helpListener = null;
-/**
- * This class is not intented to be instantiated
- */
-private WorkbenchHelp() {
-}
-/**
- * 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
- */
-private static Point computePopUpLocation(Display display) {
- Point point = display.getCursorLocation();
- return new Point(point.x + 15, point.y);
-}
-/**
- * Calls the help support system to display the given help context
- *
- * @param helpContext the id of the context to display
- * @param point the location for the help popup
- */
-private static void displayHelp(String helpContext, Point point) {
- IHelp helpSupport = getHelpSupport();
- if (helpSupport == null)
- return;
-
- helpSupport.displayContext(helpContext, point.x, point.y);
-}
-/**
- * Calls the help support system to display the given help context
- *
- * @param helpContext the context to display
- * @param point the location for the help popup
- */
-private static void displayHelp(IContext helpContext, Point point) {
- IHelp helpSupport = getHelpSupport();
- if (helpSupport == null)
- return;
-
- helpSupport.displayContext(helpContext, point.x, point.y);
-}
-/**
- * Calls the help support system to display the given help context id.
- * <p>
- * May only be called from a UI thread.
- * <p>
- *
- * @param contextId the id of the context to display
- * @since 2.0
- */
-public static void displayHelp(String contextId) {
- Point point = computePopUpLocation(Display.getCurrent());
-
- displayHelp(contextId, point);
-}
-/**
- * Calls the help support system to display the given help context.
- * <p>
- * May only be called from a UI thread.
- * <p>
- *
- * @param context the context to display
- * @since 2.0
- */
-public static void displayHelp(IContext context) {
- Point point = computePopUpLocation(Display.getCurrent());
-
- displayHelp(context, point);
-}
-/**
- * Returns the help contexts on the given control.
- * <p>
- * Instances of <code>IContextComputer</code> may use this method
- * to obtain the prevviously registered help contexts of a control.
- * </p>
- *
- * @param control the control on which the contexts are registered
- * @return 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>) or an <code>IContextComputer</code> or
- * <code>null</code> if no contexts have been set.
- * @deprecated as context computers are no longer supported
- */
-public static Object getHelp(Control control) {
- return control.getData(HELP_KEY);
-}
-/**
- * Returns the help contexts on the given menu.
- * <p>
- * Instances of <code>IContextComputer</code> may use this method
- * to obtain the prevviously registered help contexts of a menu.
- * </p>
- *
- * @param menu the menu on which the contexts are registered
- * @return 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>) or an <code>IContextComputer</code> or
- * <code>null</code> if no contexts have been set.
- * @deprecated as context computers are no longer supported
- */
-public static Object getHelp(Menu menu) {
- return menu.getData(HELP_KEY);
-}
-/**
- * Returns the help contexts on the given menu item.
- * <p>
- * Instances of <code>IContextComputer</code> may use this method
- * to obtain the prevviously registered help contexts of a menu.
- * </p>
- *
- * @param menuItem the menu item on which the contexts are registered
- * @return 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>) or an <code>IContextComputer</code> or
- * <code>null</code> if no contexts have been set.
- * @deprecated as context computers are no longer supported
- */
-public static Object getHelp(MenuItem menuItem) {
- return menuItem.getData(HELP_KEY);
-}
-/**
- * Returns the help listener which activates the help support system.
- *
- * @return the help listener
- */
-private static HelpListener getHelpListener() {
- if (helpListener == null)
- initializeHelpListener();
- return helpListener;
-}
-/**
- * Returns the help support system for the platform, if available.
- *
- * @return the help support system, or <code>null</code> if none
- */
-public static IHelp getHelpSupport() {
- if (!isIntialized) {
- isIntialized = true;
- initializeHelpSupport();
- }
- return helpSupport;
-}
-
-/**
- * Initializes the help listener.
- */
-private static void initializeHelpListener() {
- helpListener = new HelpListener() {
- public void helpRequested(HelpEvent event) {
- if (getHelpSupport() == null)
- return;
-
- // get the help context from the widget
- Object object = event.widget.getData(HELP_KEY);
-
- // Since 2.0 we can expect that object is a String, however
- // for backward compatability we handle context computers and arrays.
-
- if (object instanceof String) {
- // determine a location in the upper right corner of the widget
- Point point = computePopUpLocation(event.widget.getDisplay());
-
- // display the help
- displayHelp((String)object, point);
-
- return;
- }
-
-
- Object[] helpContext = null;
- if (object instanceof IContextComputer)
- // if it is a computed context, compute it now
- helpContext = ((IContextComputer)object).computeContexts(event);
- else if (object instanceof Object[])
- helpContext = (Object[])object;
-
- if (helpContext != null) {
- // determine a location in the upper right corner of the widget
- Point point = computePopUpLocation(event.widget.getDisplay());
-
- // display the help
- displayHelp(helpContext, point);
- }
- }
- };
-}
-
-/**
- * Calls the help support system to display the given help context
- *
- * @param helpContexts the contexts to display a mixed-type
- * array of context ids (type <code>String</code>) and/or help contexts (type
- * <code>IContext</code>)
- * @param point the location for point to help popup
- * @deprecated
- */
-private static void displayHelp(Object[] helpContexts, Point point) {
- if (getHelpSupport() == null)
- return;
-
- // Since 2.0 the help support system no longer provides
- // API for an array of help contexts.
- // Therefore we only use the first context in the array.
- if (helpContexts[0] instanceof IContext)
- getHelpSupport().displayContext((IContext)helpContexts[0], point.x, point.y);
- else
- getHelpSupport().displayContext((String)helpContexts[0], point.x, point.y);
-}
-/**
- * Initializes the help support system by getting an instance via the extension
- * point.
- */
-private static void initializeHelpSupport() {
- BusyIndicator.showWhile(Display.getCurrent(), new Runnable() {
- public void run() {
- // get the help support extension from the system plugin registry
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- IExtensionPoint point = pluginRegistry.getExtensionPoint(HELP_SYSTEM_EXTENSION_ID);
- if (point == null) return;
- IExtension[] extensions = point.getExtensions();
- if (extensions.length == 0) return;
- // There should only be one extension/config element so we just take the first
- IConfigurationElement[] elements = extensions[0].getConfigurationElements();
- if (elements.length == 0) return;
- // Instantiate the help support system
- try {
- helpSupport = (IHelp)WorkbenchPlugin.createExtension(elements[0],
- HELP_SYSTEM_CLASS_ATTRIBUTE);
- } catch (CoreException e) {
- WorkbenchPlugin.log("Unable to instantiate help support system" + e.getStatus());//$NON-NLS-1$
- }
- }
- });
-}
-
-/**
- * Returns <code>true</code> if the context-sensitive help
- * window is currently being displayed, <code>false</code> if not.
- * This avoid activating the help support if it is not already activated.
- */
-public static boolean isContextHelpDisplayed() {
- return helpSupport != null && helpSupport.isContextHelpDisplayed();
-}
-
-/**
- * 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).
- * </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>)
- * @deprecated use setHelp with a single context id parameter
- */
-public static void setHelp(IAction action, final Object[] contexts) {
- for (int i = 0; i < contexts.length; i++)
- Assert.isTrue(contexts[i] instanceof String || contexts[i] instanceof IContext);
- action.setHelpListener(new HelpListener() {
- public void helpRequested(HelpEvent event) {
- if (getHelpSupport() != null) {
- // determine a location in the upper right corner of the widget
- Point point = computePopUpLocation(event.widget.getDisplay());
-
- // display the help
- displayHelp(contexts, point);
- }
- }
- });
-}
-
-/**
- * Sets the given help context computer on the given action.
- * <p>
- * Use this method when the help contexts cannot be computed in advance.
- * Help 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 computer the computer to determine the help contexts for the control
- * when F1 help is invoked
- * @deprecated context computers are no longer supported, clients should implement
- * their own help listener
- */
-public static void setHelp(IAction action, final IContextComputer computer) {
- action.setHelpListener(new HelpListener() {
- public void helpRequested(HelpEvent event) {
- Object[] helpContext = computer.computeContexts(event);
- if (helpContext != null && getHelpSupport() != null) {
- // determine a location in the upper right corner of the widget
- Point point = computePopUpLocation(event.widget.getDisplay());
-
- // display the help
- displayHelp(helpContext, point);
- }
- }
- });
-}
-/**
- * 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).
- * </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>)
- * @deprecated use setHelp with single context id parameter
- */
-public static void setHelp(Control control, Object[] contexts) {
- for (int i = 0; i < contexts.length; i++)
- Assert.isTrue(contexts[i] instanceof String || contexts[i] instanceof IContext);
-
- control.setData(HELP_KEY, contexts);
- // ensure that the listener is only registered once
- control.removeHelpListener(getHelpListener());
- control.addHelpListener(getHelpListener());
-}
-/**
- * Sets the given help context computer on the given control.
- * <p>
- * Use this method when the help contexts cannot be computed in advance.
- * Help 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 computer
- * @param computer the computer to determine the help contexts for the control
- * when F1 help is invoked
- * @deprecated context computers are no longer supported, clients should implement
- * their own help listener
- */
-public static void setHelp(Control control, IContextComputer computer) {
- control.setData(HELP_KEY, computer);
- // ensure that the listener is only registered once
- control.removeHelpListener(getHelpListener());
- control.addHelpListener(getHelpListener());
-}
-/**
- * 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).
- * </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>)
- * @deprecated use setHelp with single context id parameter
- */
-public static void setHelp(Menu menu, Object[] contexts) {
- for (int i = 0; i < contexts.length; i++)
- Assert.isTrue(contexts[i] instanceof String || contexts[i] instanceof IContext);
- menu.setData(HELP_KEY, contexts);
- // ensure that the listener is only registered once
- menu.removeHelpListener(getHelpListener());
- menu.addHelpListener(getHelpListener());
-}
-/**
- * Sets the given help context computer on the given menu.
- * <p>
- * Use this method when the help contexts cannot be computed in advance.
- * Help 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 computer
- * @param computer the computer to determine the help contexts for the control
- * when F1 help is invoked
- * @deprecated context computers are no longer supported, clients should implement
- * their own help listener
- */
-public static void setHelp(Menu menu, IContextComputer computer) {
- menu.setData(HELP_KEY, computer);
- // ensure that the listener is only registered once
- menu.removeHelpListener(getHelpListener());
- menu.addHelpListener(getHelpListener());
-}
-/**
- * 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).
- * </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>)
- * @deprecated use setHelp with single context id parameter
- */
-public static void setHelp(MenuItem item, Object[] contexts) {
- for (int i = 0; i < contexts.length; i++)
- Assert.isTrue(contexts[i] instanceof String || contexts[i] instanceof IContext);
- item.setData(HELP_KEY, contexts);
- // ensure that the listener is only registered once
- item.removeHelpListener(getHelpListener());
- item.addHelpListener(getHelpListener());
-}
-/**
- * Sets the given help context computer on the given menu item.
- * <p>
- * Use this method when the help contexts cannot be computed in advance.
- * Help 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 computer
- * @param computer the computer to determine the help contexts for the control
- * when F1 help is invoked
- * @deprecated context computers are no longer supported, clients should implement
- * their own help listener
- */
-public static void setHelp(MenuItem item, IContextComputer computer) {
- item.setData(HELP_KEY, computer);
- // ensure that the listener is only registered once
- item.removeHelpListener(getHelpListener());
- item.addHelpListener(getHelpListener());
-}
-/**
- * Sets the given help context id on the given action.
- *
- * @param action the action on which to register the context id
- * @param contextId the context id to use when F1 help is invoked
- * @since 2.0
- */
-public static void setHelp(IAction action, final String contextId) {
- action.setHelpListener(new HelpListener() {
- public void helpRequested(HelpEvent event) {
- if (getHelpSupport() != null) {
- // determine a location in the upper right corner of the widget
- Point point = computePopUpLocation(event.widget.getDisplay());
-
- // display the help
- displayHelp(contextId, point);
- }
- }
- });
-}
-/**
- * Sets the given help context id on the given control.
- *
- * @param control the control on which to register the context id
- * @param contextId the context id to use when F1 help is invoked
- * @since 2.0
- */
-public static void setHelp(Control control, String contextId) {
- control.setData(HELP_KEY, contextId);
- // ensure that the listener is only registered once
- control.removeHelpListener(getHelpListener());
- control.addHelpListener(getHelpListener());
-}
-/**
- * Sets the given help context id on the given menu.
- *
- * @param menu the menu on which to register the context id
- * @param contextId the context id to use when F1 help is invoked
- * @since 2.0
- */
-public static void setHelp(Menu menu, String contextId) {
- menu.setData(HELP_KEY, contextId);
- // ensure that the listener is only registered once
- menu.removeHelpListener(getHelpListener());
- menu.addHelpListener(getHelpListener());
-}
-/**
- * Sets the given help context id on the given menu item.
- *
- * @param item the menu item on which to register the context id
- * @param contextId the context id to use when F1 help is invoked
- * @since 2.0
- */
-public static void setHelp(MenuItem item, String contextId) {
- item.setData(HELP_KEY, contextId);
- // ensure that the listener is only registered once
- item.removeHelpListener(getHelpListener());
- item.addHelpListener(getHelpListener());
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/package.html b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/package.html
deleted file mode 100644
index bd881ff..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/help/package.html
+++ /dev/null
@@ -1,21 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (WinNT; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Classes for integration with the help support system
-in the Eclipse Platform User Interface.
-<h2>
-Package Specification</h2>
-Within the Eclipse Platform UI each user interface component should integrate
-with the help support system. The simplest form of help integration
-is accomplished using <b>WorkbenchHelp</b>. This class provides the
-client with methods to define a help context for SWT Controls. Once
-defined, the help support system will automatically launch help with the
-appropriate context if a user request for help occurs.
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AboutAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AboutAction.java
deleted file mode 100644
index fa2afab..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AboutAction.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.action.Action;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.dialogs.AboutDialog;
-
-/**
- * Creates an About dialog and opens it.
- */
-public class AboutAction extends Action {
- private IWorkbenchWindow workbenchWindow;
-
-/**
- * Creates a new <code>AboutAction</code> with the given label
- */
-public AboutAction(IWorkbenchWindow window) {
- this.workbenchWindow = window;
- AboutInfo aboutInfo = ((Workbench) PlatformUI.getWorkbench()).getAboutInfo();
- String productName = aboutInfo.getProductName();
- if (productName == null) {
- productName = ""; //$NON-NLS$
- }
- setText(WorkbenchMessages.format("AboutAction.text", new Object[] { productName })); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.format("AboutAction.toolTip", new Object[] { productName})); //$NON-NLS-1$
- setId(IWorkbenchActionConstants.ABOUT);
- WorkbenchHelp.setHelp(this, IHelpContextIds.ABOUT_ACTION);
-}
-
-/**
- * Perform the action: show about dialog.
- */
-public void run() {
- new AboutDialog(workbenchWindow.getShell()).open();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AboutInfo.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AboutInfo.java
deleted file mode 100644
index 4a8c90f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AboutInfo.java
+++ /dev/null
@@ -1,361 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.boot.*;
-import org.eclipse.ui.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import java.io.*;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.*;
-import java.util.zip.CRC32;
-
-/**
- * The about info class;
- * <p>
- * The information within this object is obtained from the about "ini" file".
- * This file resides within an install configurations directory and must be a
- * standard java property file.
- * </p>
- */
-public class AboutInfo extends NewConfigurationInfo {
-
- private String appName;
- private String productName;
- private ImageDescriptor windowImage;
- private ImageDescriptor aboutImage;
- private ImageDescriptor featureImage;
- private String aboutText;
- private URL welcomePageURL;
- private String welcomePerspective;
- private String featureImageName;
- private Long featureImageCRC;
- private boolean calculatedImageCRC = false;
- private final static int BYTE_ARRAY_SIZE = 2048;
-
- /**
- * Constructs a new instance of the about info.
- */
- public AboutInfo(String featureId, PluginVersionIdentifier versionId) {
- super(featureId, versionId, "about.ini", "about.properties", "about.mappings"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
-
- /**
- * 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() {
- return aboutImage;
- }
-
- /**
- * Returns the descriptor for an image which can be shown in an "about features"
- * dialog.
- * Products designed to run "headless" typically would not have such an image.
- *
- * @return the descriptor for a feature image, or <code>null</code> if none
- */
- public ImageDescriptor getFeatureImage() {
- return featureImage;
- }
-
- /**
- * Returns the name of the feature image as supplied in the properties file.
- *
- * @return the name of the feature image, or <code>null</code> if none
- */
- public String getFeatureImageName() {
- return featureImageName;
- }
-
- /**
- * Returns the CRC of the feature image as supplied in the properties file.
- *
- * @return the CRC of the feature image, or <code>null</code> if none
- */
- public Long getFeatureImageCRC() {
- if (!calculatedImageCRC && featureImageName != null) {
- featureImageCRC = calculateFeatureImageCRC();
- calculatedImageCRC = true;
- }
- return featureImageCRC;
- }
-
- /**
- * Calculate a CRC for the feature image
- */
- private Long calculateFeatureImageCRC() {
- URL url = null;
- if (featureImageName != null) {
- url = getDescriptor().find(new Path("$nl$").append(featureImageName));
- }
- if (url == null)
- return null;
- // Get the image bytes
- InputStream in = null;
- ByteArrayOutputStream out = null;
- try {
- in = url.openStream();
- out = new ByteArrayOutputStream();
- byte[] buffer = new byte[BYTE_ARRAY_SIZE];
- int readResult = BYTE_ARRAY_SIZE;
- while (readResult == BYTE_ARRAY_SIZE) {
- readResult = in.read(buffer);
- if (readResult > 0)
- out.write(buffer, 0, readResult);
- }
- byte[] contents = out.toByteArray();
- // Calculate the crc
- CRC32 crc = new CRC32();
- crc.update(contents);
- return new Long(crc.getValue());
- } catch (IOException e) {
- return null;
- } finally {
- if (in != null)
- try {
- in.close();
- } catch (IOException e) {
- }
- if (out != null)
- try {
- out.close();
- } catch (IOException e) {
- }
- }
- }
-
-
- /**
- * Returns a label for the feature, we use the descriptor label
- */
- public String getFeatureLabel() {
- if (getDescriptor() == null)
- return null;
- return getDescriptor().getLabel();
- }
-
- /**
- * 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() {
- return aboutText;
- }
-
- /**
- * Returns the app 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 app name, or <code>null</code>
- *
- * @see org.eclipse.swt.widgets.Display#setAppName
- */
- public String getAppName() {
- return appName;
- }
-
- /**
- * 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() {
- IPluginDescriptor desc = getDescriptor();
- if (desc == null)
- return null;
- return desc.getLabel();
- }
-
- /**
- * Returns the provider name or <code>null</code>.
- *
- * @return the provider name, or <code>null</code>
- */
- public String getProviderName() {
- IPluginDescriptor desc = getDescriptor();
- if (desc == null)
- return null;
- return desc.getProviderName();
- }
-
- /**
- * Returns the version or <code>null</code>.
- *
- * @return the version, or <code>null</code>
- */
- public String getVersion() {
- PluginVersionIdentifier versionId = getVersionId();
- if (versionId == null)
- return null;
- return versionId.toString();
- }
-
- /**
- * Returns a <code>URL</code> for the welcome page.
- * Products designed to run "headless" typically would not have such an page.
- *
- * @return the welcome page, or <code>null</code> if none
- */
- public URL getWelcomePageURL() {
- return welcomePageURL;
- }
-
- /**
- * Returns the id of a perspective in which to show the welcome page.
- * May be <code>null</code>.
- *
- * @return the welcome page perspective id, or <code>null</code> if none
- */
- public String getWelcomePerspective() {
- return welcomePerspective;
- }
-
- /**
- * Returns the image descriptor for the window image to use for this product.
- * Products designed to run "headless" typically would not have such an image.
- *
- * @return the image descriptor for the window image, or <code>null</code> if none
- */
- public ImageDescriptor getWindowImage() {
- return windowImage;
- }
-
- /**
- * Reads the ini file.
- */
- protected void readINIFile(URL iniURL, URL propertiesURL, URL mappingsURL)
- throws CoreException {
-
- Properties ini = new Properties();
- InputStream is = null;
- try {
- is = iniURL.openStream();
- ini.load(is);
- } catch (IOException e) {
- reportINIFailure(e, "Cannot read about info file " + iniURL); //$NON-NLS-1$
- return;
- } finally {
- try {
- if (is != null)
- is.close();
- } catch (IOException e) {
- }
- }
-
- PropertyResourceBundle bundle = null;
-
- if (propertiesURL != null) {
- InputStream bundleStream = null;
- try {
- bundleStream = propertiesURL.openStream();
- bundle = new PropertyResourceBundle(bundleStream);
- } catch (IOException e) {
- reportINIFailure(e, "Cannot read about properties file " + propertiesURL); //$NON-NLS-1$
- bundle = null;
- } finally {
- try {
- if (bundleStream != null)
- bundleStream.close();
- } catch (IOException e) {
- }
- }
- }
-
- PropertyResourceBundle mappingsBundle = null;
-
- if (mappingsURL != null) {
- InputStream bundleStream = null;
- try {
- bundleStream = mappingsURL.openStream();
- mappingsBundle = new PropertyResourceBundle(bundleStream);
- } catch (IOException e) {
- reportINIFailure(e, "Cannot read about mappings file " + mappingsURL); //$NON-NLS-1$
- mappingsBundle = null;
- } finally {
- try {
- if (bundleStream != null)
- bundleStream.close();
- } catch (IOException e) {
- }
- }
- }
-
- // Create the mappings array
- ArrayList mappingsList = new ArrayList();
- if (mappingsBundle != null) {
- boolean found = true;
- int i = 0;
- while (found) {
- try {
- mappingsList.add(mappingsBundle.getString(new Integer(i).toString()));
- } catch (MissingResourceException e) {
- found = false;
- }
- i++;
- }
- }
- String[] mappingsArray = (String[])mappingsList.toArray(new String[mappingsList.size()]);
-
- windowImage = getImage(ini, "windowImage"); //$NON-NLS-1$
-
- aboutText = (String) ini.get("aboutText"); //$NON-NLS-1$
- aboutText = getResourceString(aboutText, bundle, mappingsArray);
-
- aboutImage = getImage(ini, "aboutImage"); //$NON-NLS-1$
-
- featureImageName = (String) ini.get("featureImage"); //$NON-NLS-1$
- featureImage = getImage(ini, "featureImage"); //$NON-NLS-1$
-
- welcomePageURL = getURL(ini, "welcomePage"); //$NON-NLS-1$
- welcomePerspective = (String) ini.get("welcomePerspective"); //$NON-NLS-1$
-
- appName = (String) ini.get("appName"); //$NON-NLS-1$
- appName = getResourceString(appName, bundle, mappingsArray);
-
- }
-
- /**
- * Returns a URL for the given key, or <code>null</code>.
- *
- * @return a URL for the given key, or <code>null</code>
- */
- private URL getURL(Properties ini, String key) {
- URL url = null;
- String fileName = (String) ini.get(key);
- if (fileName != null) {
- url = getDescriptor().find(new Path(fileName));
- }
- return url;
- }
-
- /**
- * Returns an image descriptor for the given key, or <code>null</code>.
- *
- * @return an image descriptor for the given key, or <code>null</code>
- */
- private ImageDescriptor getImage(Properties ini, String key) {
- URL url = getURL(ini, key);
- if (url != null) {
- return ImageDescriptor.createFromURL(url);
- }
- return null;
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AboutItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AboutItem.java
deleted file mode 100644
index 1880a56..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AboutItem.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.*;
-import org.eclipse.help.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.swt.custom.BusyIndicator;
-/**
- * Holds the information for text appearing in the about dialog
- */
-public class AboutItem {
- private String text;
- private int[][] linkRanges;
- private String[] hrefs;
-/**
- * Creates a new about item
- */
-public AboutItem(
- String text,
- int[][] linkRanges,
- String[] hrefs) {
-
- this.text = text;
- this.linkRanges = linkRanges;
- this.hrefs = hrefs;
-}
-/**
- * Returns the link ranges (character locations)
- */
-public int[][] getLinkRanges() {
- return linkRanges;
-}
-/**
- * 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 i = 0; i < linkRanges.length; i++){
- if (offset > linkRanges[i][0] && offset <= linkRanges[i][0] + linkRanges[i][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;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractPartSelectionTracker.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractPartSelectionTracker.java
deleted file mode 100644
index 822c4b4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractPartSelectionTracker.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.INullSelectionListener;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Provides per-part selection tracking for the selection service.
- */
-public abstract class AbstractPartSelectionTracker {
- /**
- * List of selection listeners for this tracker
- */
- private ListenerList fListeners = new ListenerList(2);
- /**
- * List of post selection listeners for this tracker
- */
- private ListenerList postListeners = new ListenerList(2);
- /**
- * The id of the part this tracls
- */
- private String fPartId;
-
- /**
- * Constructs a part selection tracker for the part with the given id.
- *
- * @param id part identifier
- */
- public AbstractPartSelectionTracker(String partId) {
- setPartId(partId);
- }
-
- /**
- * Adds a selection listener to this tracker
- *
- * @param listener the listener to add
- */
- public void addSelectionListener(ISelectionListener listener) {
- fListeners.add(listener);
- }
- /**
- * Adds a post selection listener to this tracker
- *
- * @param listener the listener to add
- */
- public void addPostSelectionListener(ISelectionListener listener) {
- postListeners.add(listener);
- }
- /**
- * Returns the selection from the part being tracked,
- * or <code>null</code> if the part is closed or has no selection.
- */
- public abstract ISelection getSelection();
-
- /**
- * Removes a selection listener from this tracker.
- *
- * @param listener the listener to remove
- */
- public void removeSelectionListener(ISelectionListener listener) {
- fListeners.remove(listener);
- }
- /**
- * Removes a post selection listener from this tracker.
- *
- * @param listener the listener to remove
- */
- public void removePostSelectionListener(ISelectionListener listener) {
- postListeners.remove(listener);
- }
- /**
- * Disposes this selection tracker. This removes all listeners currently registered.
- */
- public void dispose() {
- synchronized (fListeners) {
- Object[] listeners = fListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- fListeners.remove(listeners[i]);
- postListeners.remove(listeners[i]);
- }
- }
- }
-
- /**
- * Fires a selection event to the listeners.
- *
- * @param part the part or <code>null</code> if no active part
- * @param sel the selection or <code>null</code> if no active selection
- * @param listeners the list of listeners to notify
- */
- protected void fireSelection(final IWorkbenchPart part, final ISelection sel) {
- Object [] array = fListeners.getListeners();
- for (int i = 0; i < array.length; i ++) {
- final ISelectionListener l = (ISelectionListener)array[i];
- if ((part != null && sel != null) || l instanceof INullSelectionListener) {
- Platform.run(new SafeRunnable() {
- public void run() {
- l.selectionChanged(part, sel);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- // If an unexpected exception happens, remove the listener
- // to make sure the workbench keeps running.
- removeSelectionListener(l);
- }
- });
- }
- }
- }
- /**
- * Fires a post selection event to the listeners.
- *
- * @param part the part or <code>null</code> if no active part
- * @param sel the selection or <code>null</code> if no active selection
- * @param listeners the list of listeners to notify
- */
- protected void firePostSelection(final IWorkbenchPart part, final ISelection sel) {
- Object [] array = postListeners.getListeners();
- for (int i = 0; i < array.length; i ++) {
- final ISelectionListener l = (ISelectionListener)array[i];
- if ((part != null && sel != null) || l instanceof INullSelectionListener) {
- Platform.run(new SafeRunnable() {
- public void run() {
- l.selectionChanged(part, sel);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- // If an unexpected exception happens, remove the listener
- // to make sure the workbench keeps running.
- removePostSelectionListener(l);
- }
- });
- }
- }
- }
- /**
- * Sets the id of the part that this tracks.
- *
- * @param id view identifier
- */
- private void setPartId(String partId) {
- fPartId = partId;
- }
-
- /**
- * Returns the id of the part that this tracks.
- *
- * @return part identifier
- */
- protected String getPartId() {
- return fPartId;
- }
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractSelectionService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractSelectionService.java
deleted file mode 100644
index 4f0f735..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AbstractSelectionService.java
+++ /dev/null
@@ -1,307 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Hashtable;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.ui.*;
-
-/**
- * Abstract selection service.
- */
-public abstract class AbstractSelectionService implements ISelectionService, IPartListener {
-
- /**
- * The list of selection listeners (not per-part).
- */
- private ListenerList listeners = new ListenerList();
- /**
- * The list of post selection listeners (not per-part).
- */
- private ListenerList postListeners = new ListenerList();
- /**
- * The currently active part.
- */
- private IWorkbenchPart activePart;
-
- /**
- * The active part's selection provider, remembered in case the part
- * replaces its selection provider after we hooked a listener.
- */
- private ISelectionProvider activeProvider;
-
- /**
- * Map from part id (String) to per-part tracker (AbstractPartSelectionTracker).
- */
- private Hashtable perPartTrackers;
-
- /**
- * The JFace selection listener to hook on the active part's selection provider.
- */
- private ISelectionChangedListener
- selListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- fireSelection(activePart, event.getSelection());
- }
- };
-
- /**
- * The JFace post selection listener to hook on the active part's selection provider.
- */
- private ISelectionChangedListener
- postSelListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- firePostSelection(activePart, event.getSelection());
- }
- };
-
-/**
- * Creates a new SelectionService.
- */
-protected AbstractSelectionService() {
-}
-
-/* (non-Javadoc)
- * Method declared on ISelectionService.
- */
-public void addSelectionListener(ISelectionListener l) {
- listeners.add(l);
-}
-
-/* (non-Javadoc)
- * Method declared on ISelectionService.
- */
-public void addSelectionListener(String partId, ISelectionListener listener) {
- getPerPartTracker(partId).addSelectionListener(listener);
-}
-/* (non-Javadoc)
- * Method declared on ISelectionService.
- */
-public void addPostSelectionListener(ISelectionListener l) {
- postListeners.add(l);
-}
-
-/* (non-Javadoc)
- * Method declared on ISelectionService.
- */
-public void addPostSelectionListener(String partId, ISelectionListener listener) {
- getPerPartTracker(partId).addPostSelectionListener(listener);
-}
-/* (non-Javadoc)
- * Method declared on ISelectionService.
- */
-public void removeSelectionListener(ISelectionListener l) {
- listeners.remove(l);
-}
-
-/*
- * (non-Javadoc)
- * Method declared on ISelectionListener.
- */
-public void removePostSelectionListener(String partId, ISelectionListener listener) {
- getPerPartTracker(partId).removePostSelectionListener(listener);
-}
-/* (non-Javadoc)
- * Method declared on ISelectionService.
- */
-public void removePostSelectionListener(ISelectionListener l) {
- postListeners.remove(l);
-}
-
-/*
- * (non-Javadoc)
- * Method declared on ISelectionListener.
- */
-public void removeSelectionListener(String partId, ISelectionListener listener) {
- getPerPartTracker(partId).removeSelectionListener(listener);
-}
-/**
- * Fires a selection event to the given listeners.
- *
- * @param part the part or <code>null</code> if no active part
- * @param sel the selection or <code>null</code> if no active selection
- */
-protected void fireSelection(final IWorkbenchPart part, final ISelection sel) {
- Object [] array = listeners.getListeners();
- for (int i = 0; i < array.length; i ++) {
- final ISelectionListener l = (ISelectionListener)array[i];
- if ((part != null && sel != null) || l instanceof INullSelectionListener) {
- Platform.run(new SafeRunnable() {
- public void run() {
- l.selectionChanged(part, sel);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- // If an unexpected exception happens, remove the listener
- // to make sure the workbench keeps running.
- removeSelectionListener(l);
- }
- });
- }
- }
-}
-/**
- * Fires a selection event to the given listeners.
- *
- * @param part the part or <code>null</code> if no active part
- * @param sel the selection or <code>null</code> if no active selection
- */
-protected void firePostSelection(final IWorkbenchPart part, final ISelection sel) {
- Object [] array = postListeners.getListeners();
- for (int i = 0; i < array.length; i ++) {
- final ISelectionListener l = (ISelectionListener)array[i];
- if ((part != null && sel != null) || l instanceof INullSelectionListener) {
- Platform.run(new SafeRunnable() {
- public void run() {
- l.selectionChanged(part, sel);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- // If an unexpected exception happens, remove the listener
- // to make sure the workbench keeps running.
- removePostSelectionListener(l);
- }
- });
- }
- }
-}
-/**
- * Returns the per-part selection tracker for the given part id.
- *
- * @param partId part identifier
- * @return per-part selection tracker
- */
-protected AbstractPartSelectionTracker getPerPartTracker(String partId) {
- if (perPartTrackers == null) {
- perPartTrackers = new Hashtable(4);
- }
- AbstractPartSelectionTracker tracker = (AbstractPartSelectionTracker) perPartTrackers.get(partId);
- if (tracker == null) {
- tracker = createPartTracker(partId);
- perPartTrackers.put(partId, tracker);
- }
- return tracker;
-}
-
-/**
- * Creates a new per-part selection tracker for the given part id.
- *
- * @param partId part identifier
- * @return per-part selection tracker
- */
-protected abstract AbstractPartSelectionTracker createPartTracker(String partId);
-
-/**
- * Returns the selection.
- */
-public ISelection getSelection() {
- if (activeProvider != null)
- return activeProvider.getSelection();
- else
- return null;
-}
-
-/*
- * @see ISelectionService#getSelection(String)
- */
-public ISelection getSelection(String partId) {
- return getPerPartTracker(partId).getSelection();
-}
-
-/**
- * Notifies the listener that a part has been activated.
- */
-public void partActivated(IWorkbenchPart newPart) {
- // Optimize.
- if (newPart == activePart)
- return;
-
- // Unhook selection from the old part.
- reset();
-
- // Update active part.
- activePart = newPart;
-
- // Hook selection on the new part.
- if (activePart != null) {
- activeProvider = activePart.getSite().getSelectionProvider();
- if (activeProvider != null) {
- // Fire an event if there's an active provider
- activeProvider.addSelectionChangedListener(selListener);
- ISelection sel = activeProvider.getSelection();
- fireSelection(newPart, sel);
- if(activeProvider instanceof StructuredViewer)
- ((StructuredViewer)activeProvider).addPostSelectionChangedListener(postSelListener);
- else
- activeProvider.addSelectionChangedListener(postSelListener);
- firePostSelection(newPart, sel);
- } else {
- //Reset active part. activeProvider may not be null next time this method is called.
- activePart = null;
- }
- }
- // No need to fire an event if no active provider, since this was done in reset()
-}
-
-/**
- * Notifies the listener that a part has been brought to the front.
- */
-public void partBroughtToTop(IWorkbenchPart newPart) {
- // do nothing, the active part has not changed,
- // so the selection is unaffected
-}
-
-/**
- * Notifies the listener that a part has been closed
- */
-public void partClosed(IWorkbenchPart part) {
- // Unhook selection from the part.
- if (part == activePart) {
- reset();
- }
-}
-
-/**
- * Notifies the listener that a part has been deactivated.
- */
-public void partDeactivated(IWorkbenchPart part) {
- // Unhook selection from the part.
- if (part == activePart) {
- reset();
- }
-}
-
-/**
- * Notifies the listener that a part has been opened.
- */
-public void partOpened(IWorkbenchPart part) {
- // Wait for activation.
-}
-
-/**
- * Resets the service. The active part and selection provider are
- * dereferenced.
- */
-public void reset() {
- if (activePart != null) {
- fireSelection(null, null);
- firePostSelection(null,null);
- if (activeProvider != null) {
- activeProvider.removeSelectionChangedListener(selListener);
- if(activeProvider instanceof StructuredViewer)
- ((StructuredViewer)activeProvider).removePostSelectionChangedListener(postSelListener);
- else
- activeProvider.removeSelectionChangedListener(postSelListener);
- activeProvider = null;
- }
- activePart = null;
- }
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AcceleratorMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AcceleratorMenu.java
deleted file mode 100644
index 1bb4772..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/AcceleratorMenu.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.eclipse.ui.internal;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-
-public class AcceleratorMenu {
-
- private int[] accelerators;
- private Menu parent, menu;
- private MenuItem item;
- private Control focusControl;
- private SelectionListener selectionListener;
- private VerifyListener verifyListener;
- private Listener menuItemListener, parentListener, focusControlListener;
-
-public AcceleratorMenu(Menu parent) {
-
- this.parent = parent;
- menu = new Menu(parent.getParent(), SWT.DROP_DOWN);
- if (!parent.isVisible()) {
- item = new MenuItem(parent, SWT.CASCADE,0);
- item.setText("");
- item.setMenu(menu);
- }
-
- focusControlListener = new Listener () {
- public void handleEvent (Event event) {
- if (verifyListener == null || menu.isDisposed()) return;
- if (event.type == SWT.KeyDown) {
- switch (event.keyCode) {
- case SWT.CONTROL:
- case SWT.SHIFT:
- case SWT.ALT:
- return;
- }
- }
- VerifyEvent verifyEvent = new VerifyEvent (event);
- if (event.text == null) event.text = "";
- verifyListener.verifyText(verifyEvent);
- event.text = verifyEvent.text;
- event.doit = verifyEvent.doit;
- }
- };
-
- menuItemListener = new Listener() {
- public void handleEvent(Event event) {
- if (selectionListener != null) {
- SelectionEvent selectionEvent = new SelectionEvent (event);
- //FIX ME or get EP to just call getAccelerator
- MenuItem item = (MenuItem) event.widget;
- selectionEvent.detail = item.getAccelerator();
- selectionListener.widgetSelected(selectionEvent);
- }
- }
- };
-
- parentListener = new Listener () {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Dispose:
- dispose ();
- break;
- case SWT.Show:
- if(item == null || item.isDisposed())
- break;
- item.setMenu(null);
- item.dispose();
- item = null;
- break;
- case SWT.Hide:
- item = new MenuItem(AcceleratorMenu.this.parent, SWT.CASCADE,0);
- if(menu.isDisposed()) {
- //doing more than needed;
- setAccelerators(getAccelerators());
- } else {
- item.setMenu(menu);
- }
- break;
- }
- }
- };
- parent.addListener(SWT.Show, parentListener);
- parent.addListener(SWT.Hide, parentListener);
- parent.addListener(SWT.Dispose, parentListener);
-}
-
-public void addSelectionListener(SelectionListener selectionListener) {
- this.selectionListener = selectionListener;
-}
-
-public void addVerifyListener(VerifyListener listener) {
- verifyListener = listener;
- setMultiMode(true);
-}
-
-public boolean isDisposed() {
- return item == null || item.isDisposed();
-}
-
-public void dispose() {
- setMultiMode(false);
- parent.removeListener(SWT.Show, parentListener);
- parent.removeListener(SWT.Hide, parentListener);
- parent.removeListener(SWT.Dispose, parentListener);
- menu.dispose();
- menu = null;
- if (item != null) item.dispose();
- item = null;
- focusControl = null;
- parent = null;
- verifyListener = null;
- parentListener = null;
- selectionListener = null;
- focusControlListener = null;
- menuItemListener = null;
-}
-
-public int[] getAccelerators() {
- if (accelerators == null) return null;
- int[] accelerators = new int[this.accelerators.length];
- System.arraycopy(this.accelerators, 0, accelerators, 0, this.accelerators.length);
- return accelerators;
-}
-
-public void removeSelectionListener(SelectionListener selectionListener) {
- selectionListener = null;
-}
-
-public void removeVerifyListener(VerifyListener listener) {
- verifyListener = null;
- setMultiMode(false);
-}
-
-public void setAccelerators(final int[] accelerators) {
- if (accelerators == null) {
- this.accelerators = null;
- } else {
- this.accelerators = new int[accelerators.length];
- System.arraycopy(accelerators, 0, this.accelerators, 0, accelerators.length);
- }
-
- menu.dispose();
- menu = new Menu(parent.getParent(), SWT.DROP_DOWN);
- if (item != null) item.setMenu (menu);
-
- for (int i = 0; i < accelerators.length; i++) {
- final int key = accelerators[i];
- MenuItem keyMenuItem = new MenuItem(menu, SWT.PUSH);
- keyMenuItem.setAccelerator(key);
- keyMenuItem.addListener(SWT.Selection, menuItemListener);
- }
-}
-
-private void setMultiMode (boolean mode) {
- if (focusControl != null && !focusControl.isDisposed ()) {
- focusControl.removeListener (SWT.KeyDown, focusControlListener);
- focusControl.removeListener (SWT.Verify, focusControlListener);
- focusControl.removeListener (SWT.FocusOut, focusControlListener);
- focusControl.removeListener (SWT.Dispose, focusControlListener);
- }
- if (mode) {
- Display display = menu.getDisplay ();
- focusControl = display.getFocusControl ();
- if (focusControl != null) {
- focusControl.addListener (SWT.KeyDown, focusControlListener);
- focusControl.addListener (SWT.Verify, focusControlListener);
- focusControl.addListener (SWT.FocusOut, focusControlListener);
- focusControl.addListener (SWT.Dispose, focusControlListener);
- }
- }
-}
-}
\ No newline at end of file
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
deleted file mode 100644
index d117d56..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionDescriptor.java
+++ /dev/null
@@ -1,243 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-/**
- * 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 {
- private PluginAction action;
- private String toolbarPath;
- private String menuPath;
- private String id;
- private String definitionId;
- private String menuGroup;
- private String toolbarGroup;
-
- public static final int T_POPUP=0x1;
- public static final int T_VIEW=0x2;
- public static final int T_WORKBENCH=0x3;
- public static final int T_EDITOR=0x4;
- public static final int T_WORKBENCH_PULLDOWN=0x5;
-
- public static final String ATT_ID = "id";//$NON-NLS-1$
- public static final String ATT_DEFINITION_ID = "definitionId";//$NON-NLS-1$
- public static final String ATT_HELP_CONTEXT_ID = "helpContextId";//$NON-NLS-1$
- public static final String ATT_LABEL = "label";//$NON-NLS-1$
- public static final String ATT_STATE = "state";//$NON-NLS-1$
- public static final String ATT_DESCRIPTION = "description";//$NON-NLS-1$
- public static final String ATT_TOOLTIP = "tooltip";//$NON-NLS-1$
- public static final String ATT_MENUBAR_PATH = "menubarPath";//$NON-NLS-1$
- public static final String ATT_TOOLBAR_PATH = "toolbarPath";//$NON-NLS-1$
- public static final String ATT_ICON = "icon";//$NON-NLS-1$
- public static final String ATT_HOVERICON = "hoverIcon";//$NON-NLS-1$
- public static final String ATT_DISABLEDICON = "disabledIcon";//$NON-NLS-1$
- public static final String ATT_CLASS = "class";//$NON-NLS-1$
- public static final String ATT_RETARGET = "retarget";//$NON-NLS-1$
- public static final String ATT_ALLOW_LABEL_UPDATE = "allowLabelUpdate";//$NON-NLS-1$
- public static final String ATT_ACCELERATOR = "accelerator";//$NON-NLS-1$
-/**
- * Creates a new descriptor with the specified target.
- */
-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.
- */
-public ActionDescriptor(IConfigurationElement actionElement, int targetType, Object target) {
- // Load attributes.
- id = actionElement.getAttribute(ATT_ID);
- String label = actionElement.getAttribute(ATT_LABEL);
- String defId = actionElement.getAttribute(ATT_DEFINITION_ID);
- String tooltip = actionElement.getAttribute(ATT_TOOLTIP);
- String helpContextId = actionElement.getAttribute(ATT_HELP_CONTEXT_ID);
- String mpath = actionElement.getAttribute(ATT_MENUBAR_PATH);
- String tpath = actionElement.getAttribute(ATT_TOOLBAR_PATH);
- String state = actionElement.getAttribute(ATT_STATE);
- String icon = actionElement.getAttribute(ATT_ICON);
- String hoverIcon = actionElement.getAttribute(ATT_HOVERICON);
- String disabledIcon = actionElement.getAttribute(ATT_DISABLEDICON);
- String description = actionElement.getAttribute(ATT_DESCRIPTION);
- String accelerator = actionElement.getAttribute(ATT_ACCELERATOR);
-
- // Verify input.
- if (label == null) {
- WorkbenchPlugin.log("Invalid action declaration (label == null): " + id); //$NON-NLS-1$
- label = WorkbenchMessages.getString("ActionDescriptor.invalidLabel"); //$NON-NLS-1$
- }
- definitionId = defId;
-// if(defId == null)
-// WorkbenchPlugin.log("Invalid action declaration (definitionId == null): " + id);
-// }
- // 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;
- toolbarPath = tpath;
- toolbarGroup = tgroup;
-
- // Create action.
- action = createAction(targetType, actionElement, target);
- if (action.getText() == null) // may have been set by delegate
- action.setText(label);
- action.setId(id);
- if (action.getToolTipText() == null && tooltip != null) // may have been set by delegate
- action.setToolTipText(tooltip);
- if (helpContextId != null) {
- String fullID = helpContextId;
- if (helpContextId.indexOf(".") == -1) //$NON-NLS-1$
- // For backward compatibility we auto qualify the id if it is not qualified)
- fullID = actionElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier() + "." + helpContextId;//$NON-NLS-1$
- WorkbenchHelp.setHelp(action, fullID);
- }
- if (description != null)
- action.setDescription(description);
- if (state != null) {
- action.setChecked(state.equals("true"));//$NON-NLS-1$
- }
- if (icon != null) {
- action.setImageDescriptor(WorkbenchImages.getImageDescriptorFromExtension(actionElement.getDeclaringExtension(), icon));
- }
- if (hoverIcon != null) {
- action.setHoverImageDescriptor(WorkbenchImages.getImageDescriptorFromExtension(actionElement.getDeclaringExtension(), hoverIcon));
- }
- if (disabledIcon != null) {
- action.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptorFromExtension(actionElement.getDeclaringExtension(), 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) {
- switch (targetType) {
- case T_VIEW:
- return new ViewPluginAction(actionElement, ATT_CLASS, (IViewPart)target,definitionId);
- case T_EDITOR:
- return new EditorPluginAction(actionElement, ATT_CLASS, (IEditorPart)target,definitionId);
- case T_WORKBENCH:
- return new WWinPluginAction(actionElement, ATT_CLASS, (IWorkbenchWindow)target,definitionId);
- case T_WORKBENCH_PULLDOWN:
- return new WWinPluginPulldown(actionElement, ATT_CLASS, (IWorkbenchWindow)target,definitionId);
- case T_POPUP:
- return new ObjectPluginAction(actionElement, ATT_CLASS,definitionId);
- default:
- WorkbenchPlugin.log("Unknown Action Type: " + targetType);//$NON-NLS-1$
- return null;
- }
-}
-/**
- * Returns the action object held in this descriptor.
- */
-public PluginAction getAction() {
- return action;
-}
-/**
- * Returns action's id as defined in the registry.
- */
-public String getId() {
- return id;
-}
-/**
- * Returns named slot (group) in the menu where this action
- * should be added.
- */
-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.
- */
-
-public String getMenuPath() {
- return menuPath;
-}
-/**
- * Returns the named slot (group) in the tool bar where this
- * action should be added.
- */
-
-public String getToolbarGroup() {
- return toolbarGroup;
-}
-/**
- * Returns path in the tool bar where this action should be added.
- * If null, action will not be added to the tool bar.
- */
-public String getToolbarPath() {
- return toolbarPath;
-}
-/**
- * For debugging only.
- */
-public String toString() {
- 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){
-
- 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 exception){
- WorkbenchPlugin.log("Invalid accelerator declaration: " + id); //$NON-NLS-1$
- }
- }
- else
- action.setAccelerator(Action.convertAccelerator(acceleratorText));
-}
-
-}
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
deleted file mode 100644
index 30437a9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionExpression.java
+++ /dev/null
@@ -1,293 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IActionFilter;
-
-/**
- * An ActionExpression is used to evaluate the enablement / visibility
- * criteria for an action.
- */
-public class ActionExpression {
-
- private SingleExpression root;
-
- public ActionExpression(IConfigurationElement element) {
- try {
- root = new SingleExpression();
- root.readFrom(element);
- } catch (IllegalStateException e) {
- e.printStackTrace();
- root = null;
- }
- }
-
- public boolean isEnabledFor(Object object) {
- if (root == null)
- return false;
- return root.isEnabledFor(object);
- }
-
- public boolean isEnabledFor(IStructuredSelection ssel) {
- if (root == null)
- return false;
- if (ssel.isEmpty()) {
- // We should pass a safe object in when there is no
- // selection, to avoid NPE's.
- return root.isEnabledFor(this);
- }
- for (Iterator elements=ssel.iterator(); elements.hasNext();) {
- Object obj = elements.next();
- if (!isEnabledFor(obj))
- return false;
- }
- return true;
- }
-
- protected AbstractExpression createExpression(IConfigurationElement element)
- throws IllegalStateException
- {
- AbstractExpression childExpr = null;
- String tag = element.getName();
- if (tag.equals("or")) { //$NON-NLS-1$
- childExpr = new OrExpression();
- childExpr.readFrom(element);
- } else if (tag.equals("and")) { //$NON-NLS-1$
- childExpr = new AndExpression();
- childExpr.readFrom(element);
- } else if (tag.equals("not")) { //$NON-NLS-1$
- childExpr = new NotExpression();
- childExpr.readFrom(element);
- } else if (tag.equals("objectState")) { //$NON-NLS-1$
- childExpr = new ObjectStateExpression();
- childExpr.readFrom(element);
- } else if (tag.equals("objectClass")) { //$NON-NLS-1$
- childExpr = new ObjectClassExpression();
- childExpr.readFrom(element);
- } else if (tag.equals("pluginState")) { //$NON-NLS-1$
- childExpr = new PluginStateExpression();
- childExpr.readFrom(element);
- } else if (tag.equals("systemProperty")) { //$NON-NLS-1$
- childExpr = new SystemPropertyExpression();
- childExpr.readFrom(element);
- } else {
- throw new IllegalStateException("Unreconized element: " + tag); //$NON-NLS-1$
- }
- return childExpr;
- }
-
- protected abstract class AbstractExpression {
- public abstract void readFrom(IConfigurationElement element)
- throws IllegalStateException;
- public abstract boolean isEnabledFor(Object obj);
- }
-
- protected abstract class CompositeExpression extends AbstractExpression {
- protected ArrayList list = new ArrayList();
- public void readFrom(IConfigurationElement element)
- throws IllegalStateException
- {
- IConfigurationElement [] children = element.getChildren();
- if (children.length == 0)
- throw new IllegalStateException("Expression must have 1 or more children"); //$NON-NLS-1$
- for (int nX = 0; nX < children.length; nX ++) {
- String tag = children[nX].getName();
- AbstractExpression expr = createExpression(children[nX]);
- if (tag.equals("objectClass")) //$NON-NLS-1$
- prepend(expr);
- else
- append(expr);
- }
- }
- public void append(AbstractExpression expr) {
- list.add(expr);
- list.trimToSize();
- }
- public void prepend(AbstractExpression expr) {
- list.add(0, expr);
- list.trimToSize();
- }
- }
-
- protected class SingleExpression extends AbstractExpression {
- AbstractExpression child;
- public void readFrom(IConfigurationElement element)
- throws IllegalStateException
- {
- IConfigurationElement [] children = element.getChildren();
- if (children.length != 1)
- throw new IllegalStateException("Expression must have 1 child"); //$NON-NLS-1$
- child = createExpression(children[0]);
- }
- public boolean isEnabledFor(Object obj) {
- return child.isEnabledFor(obj);
- }
- }
-
- protected class NotExpression extends SingleExpression {
- public boolean isEnabledFor(Object obj) {
- return !super.isEnabledFor(obj);
- }
- }
-
- protected class OrExpression extends CompositeExpression {
- public boolean isEnabledFor(Object obj) {
- Iterator iter = list.iterator();
- while (iter.hasNext()) {
- AbstractExpression expr = (AbstractExpression)iter.next();
- if (expr.isEnabledFor(obj))
- return true;
- }
- return false;
- }
- }
-
- protected class AndExpression extends CompositeExpression {
- public boolean isEnabledFor(Object obj) {
- Iterator iter = list.iterator();
- while (iter.hasNext()) {
- AbstractExpression expr = (AbstractExpression)iter.next();
- if (!expr.isEnabledFor(obj))
- return false;
- }
- return true;
- }
- }
-
- protected class ObjectStateExpression extends AbstractExpression {
- private String name, value;
- public void readFrom(IConfigurationElement element)
- throws IllegalStateException
- {
- name = element.getAttribute("name");//$NON-NLS-1$
- value = element.getAttribute("value");//$NON-NLS-1$
- if (name == null || value == null)
- throw new IllegalStateException();
- }
- public boolean isEnabledFor(Object object) {
- // Try out the object.
- if (this.preciselyMatches(object))
- return true;
-
- // If not adaptable, or the object is a resource, just return.
- if (object instanceof IResource)
- return false;
-
- // Try out the underlying resource.
- IResource res = null;
- if (object instanceof IAdaptable)
- res = (IResource)((IAdaptable)object).getAdapter(IResource.class);
- if (res == null)
- return false;
- return this.preciselyMatches(res);
- }
- private boolean preciselyMatches(Object object) {
- // Get the action filter.
- IActionFilter filter = getActionFilter(object);
- if (filter == null)
- return false;
-
- // Run the action filter.
- return filter.testAttribute(object, name, value);
- }
- private IActionFilter getActionFilter(Object object) {
- IActionFilter filter = null;
- if (object instanceof IActionFilter)
- filter = (IActionFilter)object;
- else if (object instanceof IAdaptable)
- filter = (IActionFilter)((IAdaptable)object).getAdapter(IActionFilter.class);
- return filter;
- }
- }
-
- protected class ObjectClassExpression extends AbstractExpression {
- private String className;
- public void readFrom(IConfigurationElement element)
- throws IllegalStateException
- {
- className = element.getAttribute("name");//$NON-NLS-1$
- if (className == null)
- throw new IllegalStateException();
- }
- public boolean isEnabledFor(Object element) {
- Class eclass = element.getClass();
- Class clazz = eclass;
- boolean match = false;
- while (clazz != null) {
- // test the class itself
- if (clazz.getName().equals(className)) {
- match = true;
- break;
- }
- // test all the interfaces it implements
- Class[] interfaces = clazz.getInterfaces();
- for (int i = 0; i < interfaces.length; i++) {
- if (interfaces[i].getName().equals(className)) {
- match = true;
- break;
- }
- }
- if (match == true)
- break;
- // get the superclass
- clazz = clazz.getSuperclass();
- }
- return match;
- }
- }
-
- protected class PluginStateExpression extends AbstractExpression {
- private String id, value;
- public void readFrom(IConfigurationElement element)
- throws IllegalStateException
- {
- id = element.getAttribute("id");//$NON-NLS-1$
- value = element.getAttribute("value");//$NON-NLS-1$
- if (id == null || value == null)
- throw new IllegalStateException();
- }
- public boolean isEnabledFor(Object object) {
- IPluginRegistry reg = Platform.getPluginRegistry();
- IPluginDescriptor desc = reg.getPluginDescriptor(id);
- if (desc == null)
- return false;
- if (value.equals("installed")) //$NON-NLS-1$
- return true;
- else if (value.equals("activated")) //$NON-NLS-1$
- return desc.isPluginActivated();
- else
- return false;
- }
- }
-
- protected class SystemPropertyExpression extends AbstractExpression {
- private String name, value;
- public void readFrom(IConfigurationElement element)
- throws IllegalStateException
- {
- name = element.getAttribute("name");//$NON-NLS-1$
- value = element.getAttribute("value");//$NON-NLS-1$
- if (name == null || value == null)
- throw new IllegalStateException();
- }
- public boolean isEnabledFor(Object object) {
- String str = System.getProperty(name);
- if (str == null)
- return false;
- boolean b = value.equals(str);
- return b;
- }
- }
-
-}
-
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
deleted file mode 100644
index 5cb9048..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionPresentation.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.registry.*;
-import java.util.*;
-
-/**
- * Manage the configurable actions for one window.
- */
-public class ActionPresentation {
- private WorkbenchWindow window;
- private HashMap mapDescToRec = new HashMap(3);
-
- private class SetRec {
- public SetRec(IActionSetDescriptor desc, IActionSet set,
- SubActionBars bars) {
- this.desc = desc;
- this.set = set;
- this.bars = bars;
- }
- public IActionSetDescriptor desc;
- public IActionSet set;
- public SubActionBars bars;
- }
-/**
- * ActionPresentation constructor comment.
- */
-public ActionPresentation(WorkbenchWindow window) {
- super();
- this.window = window;
-}
-/**
- * Create an action set from a descriptor.
- */
-public void addActionSet(IActionSetDescriptor desc) {
- try {
- IActionSet set = desc.createActionSet();
- SubActionBars bars = new ActionSetActionBars(window.getActionBars(),
- desc.getId());
- SetRec rec = new SetRec(desc, set, bars);
- mapDescToRec.put(desc, rec);
- set.init(window, bars);
- bars.activate();
- } catch (CoreException e) {
- WorkbenchPlugin.log("Unable to create ActionSet: " + desc.getId());//$NON-NLS-1$
- }
-}
-/**
- * Remove all action sets.
- */
-public void clearActionSets() {
- List oldList = copyActionSets();
- Iterator iter = oldList.iterator();
- while (iter.hasNext()) {
- IActionSetDescriptor desc = (IActionSetDescriptor)iter.next();
- removeActionSet(desc);
- }
-}
-/**
- * Returns a copy of the visible action set.
- */
-private List copyActionSets() {
- Set keys = mapDescToRec.keySet();
- ArrayList list = new ArrayList(keys.size());
- Iterator iter = keys.iterator();
- while (iter.hasNext()) {
- list.add(iter.next());
- }
- return list;
-}
-/**
- * Destroy an action set.
- */
-public void removeActionSet(IActionSetDescriptor desc) {
- SetRec rec = (SetRec)mapDescToRec.get(desc);
- if (rec != null) {
- mapDescToRec.remove(desc);
- IActionSet set = rec.set;
- SubActionBars bars = rec.bars;
- bars.dispose();
- set.dispose();
- }
-}
-/**
- * Sets the list of visible action set.
- */
-public void setActionSets(IActionSetDescriptor [] newArray) {
- // Convert array to list.
- List newList = Arrays.asList(newArray);
- List oldList = copyActionSets();
-
- // Remove obsolete actions.
- Iterator iter = oldList.iterator();
- while (iter.hasNext()) {
- IActionSetDescriptor desc = (IActionSetDescriptor)iter.next();
- if (!newList.contains(desc)) {
- removeActionSet(desc);
- }
- }
-
- // Add new actions.
- iter = newList.iterator();
- while (iter.hasNext()) {
- IActionSetDescriptor desc = (IActionSetDescriptor)iter.next();
- if (!mapDescToRec.containsKey(desc)) {
- addActionSet(desc);
- }
- }
-}
-/**
- */
-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;
-}
-}
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
deleted file mode 100644
index bdae5a3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetActionBars.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.*;
-
-/**
- * This class represents the action bars for an action set.
- */
-public class ActionSetActionBars extends SubActionBars {
- private String actionSetId;
- private CoolItemToolBarManager coolItemToolBarMgr;
-/**
- * Constructs a new action bars object
- */
-public ActionSetActionBars(IActionBars parent, String actionSetId) {
- super(parent);
- this.actionSetId = actionSetId;
-}
-/* (non-Javadoc)
- * Inherited from SubActionBars.
- */
-protected SubMenuManager createSubMenuManager(IMenuManager parent) {
- return new ActionSetMenuManager(parent, actionSetId);
-}
-/* (non-Javadoc)
- * Inherited from SubActionBars.
- */
-protected SubToolBarManager createSubToolBarManager(IToolBarManager parent) {
- return new ActionSetToolBarManager(parent, actionSetId);
-}
-/**
- * Dispose the contributions.
- */
-public void dispose() {
- super.dispose();
- if (coolItemToolBarMgr != null)
- coolItemToolBarMgr.removeAll();
-}
-/**
- * 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
- */
-public IToolBarManager getToolBarManager() {
- IToolBarManager parentMgr = parent.getToolBarManager();
- if (parentMgr instanceof ToolBarManager) {
- return super.getToolBarManager();
- } else if (parentMgr instanceof CoolBarManager) {
- if (coolItemToolBarMgr == null) {
- // Create a CoolBar item for this action bar.
- CoolBarManager cBarMgr = ((CoolBarManager)parentMgr);
- coolItemToolBarMgr = new CoolItemToolBarManager(cBarMgr.getStyle());
- toolBarMgr = createSubToolBarManager(coolItemToolBarMgr);
- // Just create the CoolBarContributionItem, PluginActionSetBuilder will add the item to
- // the CoolBarManager.
- new CoolBarContributionItem(cBarMgr, coolItemToolBarMgr, actionSetId);
- coolItemToolBarMgr.setVisible(active);
- }
- return coolItemToolBarMgr;
- }
- return null;
-}
-/**
- * Activate / Deactivate the contributions.
- */
-protected void setActive(boolean set) {
- super.setActive(set);
- if (coolItemToolBarMgr != null)
- coolItemToolBarMgr.setVisible(set);
-}
-}
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
deleted file mode 100644
index 9bac142..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetContributionItem.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-
-/**
- * This class marks a sub contribution item as belonging to
- * an action set.
- */
-public class ActionSetContributionItem extends SubContributionItem
- implements IActionSetContributionItem
-{
- private String actionSetId;
-/**
- * Constructs a new item
- */
-public ActionSetContributionItem(IContributionItem item, String actionSetId) {
- super(item);
- this.actionSetId = actionSetId;
-}
-/**
- * Returns the action set id.
- */
-public String getActionSetId() {
- return actionSetId;
-}
-/**
- * Sets the action set id.
- */
-public void setActionSetId(String newActionSetId) {
- actionSetId = newActionSetId;
-}
-}
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
deleted file mode 100644
index 61ad129..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetMenuManager.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.*;
-import java.util.*;
-
-/**
- * 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 IMenuManager parentMgr;
- private String actionSetId;
-/**
- * Constructs a new editor manager.
- */
-public ActionSetMenuManager(IMenuManager mgr, String actionSetId) {
- super(mgr);
- parentMgr = mgr;
- this.actionSetId = actionSetId;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- *
- * 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.
- */
-public IContributionItem find(String id) {
- IContributionItem item = parentMgr.find(id);
- if (item instanceof SubContributionItem)
- // Return the item passed to us, not the wrapper.
- 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)
- // 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();
- item = getWrapper(menu);
- }
-
- return item;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionItem[] getItems() {
- return parentMgr.getItems();
-}
-/* (non-Javadoc)
- * Method declared on SubContributionManager.
- */
-protected SubContributionItem wrap(IContributionItem item) {
- return new ActionSetContributionItem(item, actionSetId);
-}
-/* (non-Javadoc)
- * Method declared on SubMenuManager.
- */
-protected SubMenuManager wrapMenu(IMenuManager menu) {
- return new ActionSetMenuManager(menu, actionSetId);
-}
-}
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
deleted file mode 100644
index 6e79659..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetSeparator.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.action.*;
-
-/**
- * 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;
-/**
- * Constructs a new group marker.
- */
-public ActionSetSeparator(String groupName, String newActionSetId) {
- super(groupName);
- actionSetId = newActionSetId;
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- * Fills the given menu with a SWT separator MenuItem.
- */
-public void fill(Menu menu, int index) {
- if (index >= 0)
- new MenuItem(menu, SWT.SEPARATOR, index);
- else
- new MenuItem(menu, SWT.SEPARATOR);
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- * Fills the given tool bar with a SWT separator ToolItem.
- */
-public void fill(ToolBar toolbar, int index) {
- if (index >= 0)
- new ToolItem(toolbar, SWT.SEPARATOR, index);
- else
- new ToolItem(toolbar, SWT.SEPARATOR);
-}
-/**
- * Returns the action set id.
- */
-public String getActionSetId() {
- return actionSetId;
-}
-/**
- * The <code>Separator</code> implementation of this <code>IContributionItem</code>
- * method returns <code>true</code>
- */
-public boolean isSeparator() {
- return true;
-}
-/**
- * Sets the action set id.
- */
-public void setActionSetId(String newActionSetId) {
- actionSetId = newActionSetId;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetToolBarManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetToolBarManager.java
deleted file mode 100644
index e24f1e5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActionSetToolBarManager.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.*;
-import java.util.*;
-
-/**
- * An <code>EditorToolBarManager</code> is used to sort the contributions
- * made by an editor so that they always appear after the action sets.
- */
-public class ActionSetToolBarManager extends SubToolBarManager
-{
- private IToolBarManager parentMgr;
- private String actionSetId;
-/**
- * Constructs a new manager.
- *
- * @param mgr the parent manager. All contributions made to the
- * <code>EditorToolBarManager</code> are forwarded and appear in the
- * parent manager.
- */
-public ActionSetToolBarManager(IToolBarManager mgr, String actionSetId) {
- super(mgr);
- parentMgr = mgr;
- this.actionSetId = actionSetId;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionItem[] getItems() {
- return parentMgr.getItems();
-}
-/* (non-Javadoc)
- * Method declared on SubContributionManager.
- */
-protected SubContributionItem wrap(IContributionItem item) {
- return new ActionSetContributionItem(item, actionSetId);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivateEditorAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivateEditorAction.java
deleted file mode 100644
index d9db9b2..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActivateEditorAction.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Activates the most recently used editor in the current window.
- */
-public class ActivateEditorAction extends PageEventAction {
-
-/**
- * Creates an ActivateEditorAction.
- */
-protected ActivateEditorAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.getString("ActivateEditorAction.text"), window); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("ActivateEditorAction.toolTip")); //$NON-NLS-1$
- setAccelerator(SWT.F12);
- window.getPartService().addPartListener(this);
- updateState();
- WorkbenchHelp.setHelp(this, IHelpContextIds.ACTIVATE_EDITOR_ACTION);
-}
-
-public void pageActivated(IWorkbenchPage page) {
- super.pageActivated(page);
- updateState();
-}
-
-public void pageClosed(IWorkbenchPage page) {
- super.pageClosed(page);
- updateState();
-}
-
-public void partOpened(IWorkbenchPart part) {
- super.partOpened(part);
- if (part instanceof IEditorPart) {
- updateState();
- }
-}
-
-public void partClosed(IWorkbenchPart part) {
- super.partClosed(part);
- if (part instanceof IEditorPart) {
- updateState();
- }
-}
-
-/**
- * @see Action#run()
- */
-public void run() {
- IWorkbenchPage page = getActivePage();
- if (page != null) {
- IEditorPart editor = page.getActiveEditor(); // may not actually be active
- if (editor != null) {
- page.activate(editor);
- }
- }
-}
-
-/**
- * Updates the enabled state.
- */
-public void updateState() {
- WorkbenchPage page = (WorkbenchPage)getActivePage();
- if (page == null) {
- setEnabled(false);
- return;
- }
- setEnabled(page.getSortedEditors().length >= 1);
-}
-
-}
-
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
deleted file mode 100644
index ba51ecc..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ActiveEditorAction.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.actions.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.ui.internal.IHelpContextIds;
-
-/**
- * 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>
- * </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>
- * </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>
- * </ul>
- * </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 these 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 can overwrite.
- */
-protected void editorActivated(IEditorPart part) {
-}
-/**
- * Notification that the active editor tracked
- * by the action is being deactivated.
- *
- * Subclasses can overwrite.
- */
-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 IEditorPart getActiveEditor() {
- return activeEditor;
-}
-/* (non-Javadoc)
- * Method declared on PageEventAction.
- */
-public void pageActivated(IWorkbenchPage page) {
- super.pageActivated(page);
- updateActiveEditor();
- updateState();
-}
-/* (non-Javadoc)
- * Method declared on PageEventAction.
- */
-public void pageClosed(IWorkbenchPage page) {
- super.pageClosed(page);
- updateActiveEditor();
- updateState();
-}
-/* (non-Javadoc)
- * Method declared on PartEventAction.
- */
-public void partActivated(IWorkbenchPart part) {
- super.partActivated(part);
- if (part instanceof IEditorPart) {
- updateActiveEditor();
- updateState();
- }
-}
-/* (non-Javadoc)
- * Method declared on PartEventAction.
- */
-public void partBroughtToTop(IWorkbenchPart part) {
- super.partBroughtToTop(part);
- if (part instanceof IEditorPart) {
- updateActiveEditor();
- updateState();
- }
-}
-/* (non-Javadoc)
- * Method declared on PartEventAction.
- */
-public void partClosed(IWorkbenchPart part) {
- super.partClosed(part);
- if (part instanceof IEditorPart) {
- updateActiveEditor();
- updateState();
- }
-}
-/* (non-Javadoc)
- * Method declared on PartEventAction.
- */
-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 overwrite this method.
- */
-protected void updateState() {
- setEnabled(getActiveEditor() != null);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BaseSaveAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BaseSaveAction.java
deleted file mode 100644
index ed6fa0a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/BaseSaveAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-
-/**
- * The abstract superclass for save actions that depend on the active editor.
- */
-public abstract class BaseSaveAction extends ActiveEditorAction
- implements IPropertyListener
-{
-/**
- * Creates a new action with the given text.
- *
- * @param text the string used as the text for the action,
- * or <code>null</code> if these is no text
- * @param window the workbench window this action is
- * registered with.
- */
-protected BaseSaveAction(String text, IWorkbenchWindow window) {
- super(text, window);
-}
-/* (non-Javadoc)
- * Method declared on ActiveEditorAction.
- */
-protected void editorActivated(IEditorPart part) {
- if (part != null)
- part.addPropertyListener(this);
-}
-/* (non-Javadoc)
- * Method declared on ActiveEditorAction.
- */
-protected void editorDeactivated(IEditorPart part) {
- if (part != null)
- part.removePropertyListener(this);
-}
-/* (non-Javadoc)
- * Method declared on IPropertyListener.
- */
-public void propertyChanged(Object source, int propID) {
- if (source == getActiveEditor()) {
- if (propID == IWorkbenchPart.PROP_TITLE || propID == IEditorPart.PROP_DIRTY)
- updateState();
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CTabPartDragDrop.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CTabPartDragDrop.java
deleted file mode 100644
index b6c24fe..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CTabPartDragDrop.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.graphics.*;
-
-/**
- * Controls the drag and drop of the part
- * which is contained within the CTabFolder
- * tab.
- */
-public class CTabPartDragDrop extends PartDragDrop {
- private CTabItem tab;
-public CTabPartDragDrop(LayoutPart dragPart, CTabFolder tabFolder, CTabItem tabItem) {
- super(dragPart, tabFolder);
- this.tab = tabItem;
-}
-protected CTabFolder getCTabFolder() {
- return (CTabFolder) getDragControl();
-}
-/**
- * Returns the source's bounds
- */
-protected Rectangle getSourceBounds() {
- return PartTabFolder.calculatePageBounds(getCTabFolder());
-}
-/**
- * @see MouseListener::mouseDown
- */
-public void mouseDown(MouseEvent e) {
- if (e.button != 1) return;
-
- // Verify that the tab under the mouse pointer
- // is the same as for this drag operation
- CTabFolder tabFolder = getCTabFolder();
- CTabItem tabUnderPointer = tabFolder.getItem(new Point(e.x, e.y));
- if (tabUnderPointer != tab)
- return;
- if(tabUnderPointer == null) {
- //Avoid drag from the borders.
- Rectangle clientArea = tabFolder.getClientArea();
- if((tabFolder.getStyle() & SWT.TOP) != 0) {
- if(e.y > clientArea.y)
- return;
- } else {
- if(e.y < clientArea.y + clientArea.height)
- return;
- }
- }
-
- super.mouseDown(e);
-}
-public void setTab(CTabItem newTab) {
- tab = newTab;
-}
-}
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
deleted file mode 100644
index cd8220c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ChangeToPerspectiveMenu.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.actions.PerspectiveMenu;
-
-/**
- * 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.
- */
- public ChangeToPerspectiveMenu(IWorkbenchWindow window) {
- super(window, "ChangeToPerspectiveMenu"); //$NON-NLS-1$
- showActive(true);
- }
-
- /* (non-Javadoc)
- * @see PerspectiveMenu#run(IPerspectiveDescriptor)
- */
- protected void run(IPerspectiveDescriptor desc) {
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- int mode = store.getInt(IPreferenceConstants.OPEN_PERSP_MODE);
- IWorkbenchPage page = getWindow().getActivePage();
- IPerspectiveDescriptor persp = null;
- if (page != null)
- persp = page.getPerspective();
-
- // 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) {
- try {
- IAdaptable input = WorkbenchPlugin.getPluginWorkspace().getRoot();
- IWorkbench workbench = getWindow().getWorkbench();
- workbench.openWorkbenchWindow(desc.getId(), input);
- } catch (WorkbenchException e) {
- handleWorkbenchException(e);
- }
- } else {
- if (page != null) {
- page.setPerspective(desc);
- } else {
- try {
- IAdaptable input = WorkbenchPlugin.getPluginWorkspace().getRoot();
- getWindow().openPage(desc.getId(), input);
- } catch(WorkbenchException e) {
- handleWorkbenchException(e);
- }
- }
- }
- }
-
- /**
- * Handles workbench exception
- */
- private void handleWorkbenchException(WorkbenchException e) {
- ErrorDialog.openError(
- getWindow().getShell(),
- WorkbenchMessages.getString("ChangeToPerspectiveMenu.errorTitle"), //$NON-NLS-1$,
- e.getMessage(),
- e.getStatus());
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllAction.java
deleted file mode 100644
index e5c34c7..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllAction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.actions.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.ui.internal.IHelpContextIds;
-
-/**
- * Closes all active editors
- */
-public class CloseAllAction extends PartEventAction implements IPageListener {
- private IWorkbenchWindow workbench;
-/**
- * Create an instance of this class
- */
-public CloseAllAction(IWorkbenchWindow aWorkbench) {
- super(WorkbenchMessages.getString("CloseAllAction.text")); //$NON-NLS-1$
- this.workbench = aWorkbench;
- setToolTipText(WorkbenchMessages.getString("CloseAllAction.toolTip")); //$NON-NLS-1$
- setEnabled(false);
- setId(IWorkbenchActionConstants.CLOSE_ALL);
- updateState();
- aWorkbench.addPageListener(this);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CLOSE_ALL_ACTION);
- setAccelerator(SWT.CTRL | SWT.SHIFT | SWT.F4);
-}
-/**
- * Notifies this listener that the given page has been activated.
- *
- * @param page the page that was activated
- * @see IWorkbenchWindow#setActivePage
- */
-public void pageActivated(org.eclipse.ui.IWorkbenchPage page) {
- updateState();
-}
-/**
- * Notifies this listener that the given page has been closed.
- *
- * @param page the page that was closed
- * @see IWorkbenchPage#close
- */
-public void pageClosed(org.eclipse.ui.IWorkbenchPage page) {
- updateState();
-}
-/**
- * Notifies this listener that the given page has been opened.
- *
- * @param page the page that was opened
- * @see IWorkbenchWindow#openPage
- */
-public void pageOpened(org.eclipse.ui.IWorkbenchPage page) {}
-/**
- * A part has been closed.
- */
-public void partClosed(IWorkbenchPart part) {
- updateState();
-}
-/**
- * A part has been opened.
- */
-public void partOpened(IWorkbenchPart part) {
- updateState();
-}
-/**
- * The user has invoked this action
- */
-public void run() {
- IWorkbenchPage page = workbench.getActivePage();
- if (page != null)
- page.closeAllEditors(true);
-}
-/**
- * Enable the action if there at least one editor open.
- */
-private void updateState() {
- WorkbenchPage page = (WorkbenchPage)workbench.getActivePage();
- if (page != null) {
- setEnabled(page.getSortedEditors().length >= 1);
- } else {
- setEnabled(false);
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllPerspectivesAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllPerspectivesAction.java
deleted file mode 100644
index 9ecdcd4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllPerspectivesAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * The <code>CloseAllPerspectivesAction</code> is used to close all of
- * the opened perspectives in the workbench window's active page.
- */
-public class CloseAllPerspectivesAction extends Action {
- private WorkbenchWindow window;
-
- /**
- * Create a new instance of <code>CloseAllPerspectivesAction</code>
- *
- * @param window the workbench window this action applies to
- */
- public CloseAllPerspectivesAction(WorkbenchWindow window) {
- super(WorkbenchMessages.getString("CloseAllPerspectivesAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("CloseAllPerspectivesAction.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.CLOSE_ALL_PAGES_ACTION);
- setEnabled(false);
- this.window = window;
- }
-
- /* (non-Javadoc)
- * Method declared on IAction.
- */
- public void run() {
- WorkbenchPage page = (WorkbenchPage)window.getActivePage();
- if (page != null)
- page.closeAllPerspectives(true);
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index a2d5a35..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseAllSavedAction.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.actions.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.ui.internal.IHelpContextIds;
-
-/**
- * Closes all active editors
- */
-public class CloseAllSavedAction extends PartEventAction implements IPageListener, IPropertyListener{
- private IWorkbenchWindow workbench;
-/**
- * Create an instance of this class
- */
-public CloseAllSavedAction(IWorkbenchWindow aWorkbench) {
- super(WorkbenchMessages.getString("CloseAllSavedAction.text")); //$NON-NLS-1$
- this.workbench = aWorkbench;
- setToolTipText(WorkbenchMessages.getString("CloseAllSavedAction.toolTip")); //$NON-NLS-1$
- //Should create a ID in IWorkbenchActionConstants when it becames API?
- setId("closeAllSaved");
- updateState();
- aWorkbench.addPageListener(this);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CLOSE_ALL_SAVED_ACTION);
- setAccelerator(SWT.CTRL | SWT.SHIFT | 'W');
-}
-/**
- * Notifies this listener that the given page has been activated.
- *
- * @param page the page that was activated
- * @see IWorkbenchWindow#setActivePage
- */
-public void pageActivated(org.eclipse.ui.IWorkbenchPage page) {
- updateState();
-}
-/**
- * Notifies this listener that the given page has been closed.
- *
- * @param page the page that was closed
- * @see IWorkbenchPage#close
- */
-public void pageClosed(org.eclipse.ui.IWorkbenchPage page) {
- updateState();
-}
-/**
- * Notifies this listener that the given page has been opened.
- *
- * @param page the page that was opened
- * @see IWorkbenchWindow#openPage
- */
-public void pageOpened(org.eclipse.ui.IWorkbenchPage page) {}
-/**
- * A part has been closed.
- */
-public void partClosed(IWorkbenchPart part) {
- if (part instanceof IEditorPart) {
- part.removePropertyListener(this);
- updateState();
- }
-}
-/**
- * A part has been opened.
- */
-public void partOpened(IWorkbenchPart part) {
- if (part instanceof IEditorPart) {
- part.addPropertyListener(this);
- updateState();
- }
-}
-/**
- * Indicates that a property has changed.
- *
- * @param source the object whose property has changed
- * @param propID the property which has changed. In most cases this property ID
- * should be defined as a constant on the source class.
- */
-public void propertyChanged(Object source, int propID) {
- if (source instanceof IEditorPart) {
- if (propID == IEditorPart.PROP_DIRTY) {
- updateState();
- }
- }
-}
-/**
- * The user has invoked this action
- */
-public void run() {
- WorkbenchPage page = (WorkbenchPage)workbench.getActivePage();
- if (page != null)
- page.closeAllSavedEditors();
-}
-/**
- * Enable the action if there at least one editor open.
- */
-private void updateState() {
- WorkbenchPage page = (WorkbenchPage)workbench.getActivePage();
- if(page == null) {
- setEnabled(false);
- return;
- }
- IEditorReference editors[] = page.getSortedEditors();
- for (int i = 0; i < editors.length; i++) {
- if(!editors[i].isDirty()) {
- setEnabled(true);
- return;
- }
- }
- setEnabled(false);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseEditorAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseEditorAction.java
deleted file mode 100644
index d1f6582..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CloseEditorAction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Closes the active editor.
- */
-public class CloseEditorAction extends ActiveEditorAction {
-/**
- * Create an instance of this class
- */
-public CloseEditorAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.getString("CloseEditorAction.text"), window); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("CloseEditorAction.toolTip")); //$NON-NLS-1$
- setId(IWorkbenchActionConstants.CLOSE);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CLOSE_PART_ACTION);
- setAccelerator(SWT.CTRL | SWT.F4);
-}
-/* (non-Javadoc)
- * Method declared on IAction.
- */
-public void run() {
- IEditorPart part = getActiveEditor();
- if (part != null)
- getActivePage().closeEditor(part, true);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ClosePerspectiveAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ClosePerspectiveAction.java
deleted file mode 100644
index 21bc5ef..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ClosePerspectiveAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * The <code>ClosePerspectiveAction</code> is used to close the
- * active perspective in the workbench window's active page.
- */
-public class ClosePerspectiveAction extends Action {
- private WorkbenchWindow window;
-
- /**
- * Create a new instance of <code>ClosePerspectiveAction</code>
- *
- * @param window the workbench window this action applies to
- */
- public ClosePerspectiveAction(WorkbenchWindow window) {
- super(WorkbenchMessages.getString("ClosePerspectiveAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("ClosePerspectiveAction.toolTip")); //$NON-NLS-1$
- setEnabled(false);
- this.window = window;
- WorkbenchHelp.setHelp(this, IHelpContextIds.CLOSE_PAGE_ACTION);
- }
-
- /* (non-Javadoc)
- * Method declared on IAction.
- */
- public void run() {
- WorkbenchPage page = (WorkbenchPage) window.getActivePage();
- if (page != null) {
- Perspective persp = page.getActivePerspective();
- if (persp != null)
- page.closePerspective(persp, true);
- }
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 6438a9e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ConfigurationInfo.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.boot.BootLoader;
-import org.eclipse.core.boot.IPlatformConfiguration;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.PluginVersionIdentifier;
-import org.eclipse.core.runtime.Status;
-
-/**
- * Configuation info class;
- * <p>
- * The information within subclasses of this object is obtained from a configuration
- * "ini" file". This file resides within an install configurations directory and must
- * be a standard java property file. A properties file may also be used to NL values
- * in the ini file.
- * </p>
- */
-
-public abstract class ConfigurationInfo {
-
- private IPluginDescriptor desc;
- private URL baseURL;
- private String iniFilename;
- private String propertiesFilename;
-
- private static final String KEY_PREFIX = "%"; //$NON-NLS-1$
- private static final String KEY_DOUBLE_PREFIX = "%%"; //$NON-NLS-1$
-
- protected ConfigurationInfo(String ini, String properties) {
- iniFilename = ini;
- propertiesFilename = properties;
- }
-
- /**
- * R1.0 platform.ini handling using "main" plugin and fragments for NL
- */
- public void readINIFile() throws CoreException {
- // determine the identifier of the "dominant" application
- IPlatformConfiguration conf = BootLoader.getCurrentPlatformConfiguration();
- String configName = conf.getPrimaryFeatureIdentifier();
- if (configName == null) {
- reportINIFailure(null, "Unknown configuration identifier"); //$NON-NLS-1$
- return;
- }
-
- // attempt to locate its corresponding "main" plugin
- IPluginRegistry reg = Platform.getPluginRegistry();
- if (reg == null) {
- reportINIFailure(null, "Plugin registry is null"); //$NON-NLS-1$
- return;
- }
- int index = configName.lastIndexOf("_"); //$NON-NLS-1$
- if (index == -1)
- this.desc = reg.getPluginDescriptor(configName);
- else {
- String mainPluginName = configName.substring(0, index);
- PluginVersionIdentifier mainPluginVersion = null;
- try {
- mainPluginVersion =
- new PluginVersionIdentifier(configName.substring(index + 1));
- } catch (Exception e) {
- reportINIFailure(e, "Unknown plugin version " + configName); //$NON-NLS-1$
- return;
- }
- this.desc = reg.getPluginDescriptor(mainPluginName, mainPluginVersion);
- }
- if (this.desc == null) {
- reportINIFailure(null, "Missing plugin descriptor for " + configName); //$NON-NLS-1$
- return;
- }
- this.baseURL = desc.getInstallURL();
-
- // load the platform.ini and platform.properties file
- URL iniURL = desc.find(new Path(iniFilename));
- if (iniURL == null) {
- reportINIFailure(null, "Unable to load plugin file: " + iniFilename); //$NON-NLS-1$
- return;
- }
-
- URL propertiesURL = desc.find(new Path(propertiesFilename));
- // OK to pass null properties file
- readINIFile(iniURL, propertiesURL);
- }
-
- /**
- * Gets the descriptor
- * @return Returns a IPluginDescriptor
- */
- protected IPluginDescriptor getDescriptor() {
- return desc;
- }
- /**
- * Gets the baseURL
- * @return Returns a URL
- */
- protected URL getBaseURL() {
- return baseURL;
- }
- /**
- * Returns a resource string corresponding to the given argument
- * value and bundle.
- * If the argument value specifies a resource key, the string
- * is looked up in the given resource bundle. If the argument does not
- * specify a valid key, the argument itself is returned as the
- * resource string. The key lookup is performed against the
- * specified resource bundle. If a resource string
- * corresponding to the key is not found in the resource bundle
- * the key value, or any default text following the key in the
- * argument value is returned as the resource string.
- * A key is identified as a string begining with the "%" character.
- * Note that the "%" character is stripped off prior to lookup
- * in the resource bundle.
- * <p>
- * For example, assume resource bundle plugin.properties contains
- * name = Project Name
- * <pre>
- * <li>getResourceString("Hello World") returns "Hello World"</li>
- * <li>getResourceString("%name") returns "Project Name"</li>
- * <li>getResourceString("%name Hello World") returns "Project Name"</li>
- * <li>getResourceString("%abcd Hello World") returns "Hello World"</li>
- * <li>getResourceString("%abcd") returns "%abcd"</li>
- * <li>getResourceString("%%name") returns "%name"</li>
- * <li>getResourceString(<code>null</code>) returns <code>null</code></li>
- * </pre>
- * </p>
- *
- * @param value the value or <code>null</code>
- * @param b the resource bundle or <code>null</code>
- * @return the resource string
- */
- protected String getResourceString(String value, ResourceBundle b) {
-
- if(value == null)
- return null;
- String s = value.trim();
-
- if (!s.startsWith(KEY_PREFIX))
- return s;
-
- if (s.startsWith(KEY_DOUBLE_PREFIX))
- return s.substring(1);
-
- int ix = s.indexOf(" "); //$NON-NLS-1$
- String key = ix == -1 ? s : s.substring(0, ix);
- String dflt = ix == -1 ? s : s.substring(ix + 1);
-
- if (b == null)
- return dflt;
-
- try {
- return b.getString(key.substring(1));
- } catch (MissingResourceException e) {
- reportINIFailure(e, "Property \"" + key + "\" not found");//$NON-NLS-1$ //$NON-NLS-2$
- return dflt;
- }
- }
-
- /**
- * Read the ini file.
- */
- protected abstract void readINIFile(URL iniURL, URL propertiesURL)
- throws CoreException;
-
- /**
- * Report an ini failure
- */
- protected void reportINIFailure(Exception e, String message) {
- if (!WorkbenchPlugin.DEBUG) {
- // only report ini problems if the -debug command line argument is used
- return;
- }
-
- IStatus iniStatus = new Status(IStatus.ERROR, WorkbenchPlugin.getDefault().getDescriptor().getUniqueIdentifier(),
- 0, message, e);
- WorkbenchPlugin.log("Problem reading configuration info.", iniStatus);//$NON-NLS-1$
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ContainerPlaceholder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ContainerPlaceholder.java
deleted file mode 100644
index 05d6723..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ContainerPlaceholder.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-public class ContainerPlaceholder extends PartPlaceholder
- implements ILayoutContainer
-{
- private static int nextId = 0;
- private ILayoutContainer realContainer;
-/**
- * ContainerPlaceholder constructor comment.
- * @param id java.lang.String
- * @param label java.lang.String
- */
-public ContainerPlaceholder(String id) {
- super(((id == null)?"Container Placeholder "+nextId++:id));//$NON-NLS-1$
-}
-/**
- * add method comment.
- */
-public void add(LayoutPart child) {
- if (!(child instanceof PartPlaceholder)) return;
- realContainer.add(child);
-}
-/**
- * See ILayoutContainer::allowBorder
- */
-public boolean allowsBorder() {
- return true;
-}
-/**
- * getChildren method comment.
- */
-public LayoutPart[] getChildren() {
- return realContainer.getChildren();
-}
-/**
- * getFocus method comment.
- */
-public LayoutPart getFocus() {
- return null;
-}
-/**
- * getFocus method comment.
- */
-public LayoutPart getRealContainer() {
- return (LayoutPart)realContainer;
-}
-/**
- * isChildVisible method comment.
- */
-public boolean isChildVisible(LayoutPart child) {
- return false;
-}
-/**
- * remove method comment.
- */
-public void remove(LayoutPart child) {
- if (!(child instanceof PartPlaceholder)) return;
- realContainer.remove(child);
-}
-/**
- * replace method comment.
- */
-public void replace(LayoutPart oldChild, LayoutPart newChild) {
- if (!(oldChild instanceof PartPlaceholder) && !(newChild instanceof PartPlaceholder)) return;
- realContainer.replace(oldChild, newChild);
-}
-/**
- * setChildVisible method comment.
- */
-public void setChildVisible(LayoutPart child, boolean visible) {}
-/**
- * setFocus method comment.
- */
-public void setFocus(LayoutPart child) {}
-public void setRealContainer(ILayoutContainer container) {
-
- if (container == null) {
- // set the parent container of the children back to the real container
- if (realContainer != null) {
- LayoutPart[] children = realContainer.getChildren();
- if (children != null) {
- for (int i = 0, length = children.length; i < length; i++){
- children[i].setContainer(realContainer);
- }
- }
- }
- } else {
- // replace the real container with this place holder
- LayoutPart[] children = container.getChildren();
- if (children != null) {
- for (int i = 0, length = children.length; i < length; i++){
- children[i].setContainer(this);
- }
- }
- }
-
- this.realContainer = container;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarContributionItem.java
deleted file mode 100644
index 0250f11..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarContributionItem.java
+++ /dev/null
@@ -1,277 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A CoolBarContributionItem is an item which realizes itself and its items
- * in as a CoolItem in a CoolBar control. CoolItems map to ToolBars within a
- * CoolBar.
- */
-public class CoolBarContributionItem extends ContributionItem implements IContributionItem {
- /**
- * The visibility of the item,
- */
- private boolean visible = true;
-
- /**
- * The toolbar contribution manager.
- */
- private CoolItemToolBarManager toolBarManager;
-
- /**
- * Need to remember order information about the item since
- * item layout order is dynamic for coolbars. We know the
- * order the of all of the CoolBarContribution items, but when
- * an item is dynamically added and removed we need to remember
- * its order relationship to the items around it.
- */
- private boolean orderBefore = false;
- private boolean orderAfter = false;
- /**
- */
- public CoolBarContributionItem() {
- }
- /**
- * Creates a CoolBarContributionItem for the given CoolBarManager.
- */
- public CoolBarContributionItem(CoolBarManager parent, String id) {
- this(parent, new CoolItemToolBarManager(parent.getStyle()), id);
- }
- /**
- * Creates a CoolBarContributionItem for the given CoolBarManager and CoolItemToolBarManager.
- */
- public CoolBarContributionItem(CoolBarManager parent, CoolItemToolBarManager tBarMgr, String id) {
- super(id);
- this.toolBarManager = tBarMgr;
- tBarMgr.setParentMgr(parent);
- tBarMgr.setCoolBarItem(this);
- }
- /**
- * Creates the SWT control for the CoolBarContributionItem.
- */
- protected ToolBar createControl() {
- ToolBar tBar = null;
- CoolBar parentControl = getParentManager().getControl();
- if (parentControl != null) {
- tBar = toolBarManager.createControl(parentControl);
- }
- return tBar;
- }
- /**
- */
- public void dispose() {
- if (toolBarManager != null) {
- toolBarManager.removeAll();
- }
- }
- /**
- */
- public boolean equals(Object object) {
- if (object instanceof CoolBarContributionItem) {
- CoolBarContributionItem item = (CoolBarContributionItem) object;
- return getId().equals(item.getId());
- }
- return false;
- }
- /**
- * Fills the given composite control with controls representing this
- * contribution item. Used by <code>StatusLineManager</code>.
- *
- * @param parent the parent control
- */
- public void fill(Composite parent) {
- // invalid
- }
- /**
- * Fills the given menu with controls representing this contribution item.
- * Used by <code>MenuManager</code>.
- *
- * @param parent the parent menu
- * @param index the index where the controls are inserted,
- * or <code>-1</code> to insert at the end
- */
- public void fill(Menu parent, int index) {
- // invalid
- }
- /**
- * Fills the given tool bar with controls representing this contribution item.
- * Used by <code>ToolBarManager</code>.
- *
- * @param parent the parent tool bar
- * @param index the index where the controls are inserted,
- * or <code>-1</code> to insert at the end
- */
- public void fill(ToolBar parent, int index) {
- // invalid
- }
- /**
- */
- public ToolBar getControl() {
- ToolBar tBar = toolBarManager.getControl();
- if (tBar == null) {
- tBar = createControl();
- }
- return tBar;
- }
- /**
- */
- public IContributionItem[] getItems() {
- return toolBarManager.getItems();
- }
- /**
- * Returns the parent manager.
- *
- * @return the parent manager
- */
- public CoolBarManager getParentManager() {
- return getToolBarManager().getParentManager();
- }
- /**
- * Returns the toolbar manager for this contribution item
- */
- public CoolItemToolBarManager getToolBarManager() {
- return toolBarManager;
- }
- /**
- */
- public boolean hasDisplayableItems() {
- IContributionItem[] items = toolBarManager.getItems();
- for (int i=0; i<items.length; i++) {
- IContributionItem item = items[i];
- if (item.isSeparator() || item.isGroupMarker() || (!item.isVisible())) continue;
- return true;
- }
- return false;
- }
- /**
- */
- public int hashCode() {
- return getId().hashCode();
- }
- /**
- * Returns whether this contribution item is dynamic. A dynamic contribution
- * item contributes items conditionally, dependent on some internal state.
- *
- * @return <code>true</code> if this item is dynamic, and
- * <code>false</code> for normal items
- */
- public boolean isDynamic() {
- return true;
- }
- /**
- * Returns whether this contribution item is a group marker.
- * This information is used when adding items to a group.
- *
- * @return <code>true</code> if this item is a group marker, and
- * <code>false</code> for normal items
- *
- * @see IContributionManager#appendToGroup
- * @see IContributionManager#prependToGroup
- */
- public boolean isGroupMarker() {
- return true;
- }
- /**
- * Returns whether this contribution item is ordered after the
- * the item before it.
- */
- protected boolean isOrderAfter() {
- return orderAfter;
- }
- /**
- * Returns whether this contribution item is ordered before a the
- * item after it.
- */
- protected boolean isOrderBefore() {
- return orderBefore;
- }
- /**
- * Returns whether this contribution item is a separator.
- * This information is used to enable hiding of unnecessary separators.
- *
- * @return <code>true</code> if this item is a separator, and
- * <code>false</code> for normal items
- * @see Separator
- */
- public boolean isSeparator() {
- return false;
- }
- /**
- * 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.
- *
- * @return <code>true</code> if the manager is visible
- */
- public boolean isVisible() {
- if (getParentManager() == null)
- return true;
- return visible;
- }
- /**
- * Sets whether this contribution item is ordered after the
- * item before it.
- */
- protected void setOrderAfter(boolean orderAfter) {
- this.orderAfter = orderAfter;
- }
- /**
- * Sets whether this contribution item is ordered before the
- * item after it.
- */
- protected void setOrderBefore(boolean orderBefore) {
- this.orderBefore = orderBefore;
- }
- /**
- * 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
- */
- public void setVisible(boolean visible) {
- this.visible = visible;
- if (getParentManager() != null)
- getParentManager().markDirty();
- }
- /**
- * 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.</p>
- *
- * @param visible the new visibility
- * @param forceVisibility whether to change the visibility or just the
- * enablement state. This parameter is ignored if visible is
- * <code>true</code>.
- */
- public void setVisible(boolean visible, boolean forceVisibility) {
- if (visible) {
- if (!isVisible()) setVisible(true);
- } else {
- if (forceVisibility) {
- if (isVisible()) setVisible(false);
- } else {
- if (!isVisible()) setVisible(true);
- }
- }
- }
- /**
- * Updates any SWT controls cached by this contribution item with any
- * changes which have been made to this contribution item since the last update.
- * Called by contribution manager update methods.
- */
- public void update(boolean force) {
- toolBarManager.update(force);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarLayout.java
deleted file mode 100644
index 9c8a0e9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarLayout.java
+++ /dev/null
@@ -1,302 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.CoolBar;
-import org.eclipse.swt.widgets.CoolItem;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.PlatformUI;
-
-public class CoolBarLayout {
- public Point[] itemSizes = new Point[0];
- public int[] itemWrapIndices = new int[0];
-
- // the coolbar contribution items in order of display
- // store the item id instead of indexes because the coolbar
- // items may change between saving/restoring
- ArrayList items = new ArrayList(0);
-
- ArrayList rememberedPositions = new ArrayList();
-
- public CoolBarLayout() {
- }
- public CoolBarLayout(CoolBar coolBar) {
- this();
- initialize(coolBar);
- }
- void initialize(CoolBar coolBar) {
- CoolItem[] coolItems = coolBar.getItems();
- ArrayList newItems = new ArrayList(coolItems.length);
- for (int i = 0; i < coolItems.length; i++) {
- CoolBarContributionItem item = (CoolBarContributionItem) coolItems[i].getData();
- if (item != null) {
- newItems.add(item.getId());
- }
- }
- items = newItems;
- itemSizes = coolBar.getItemSizes();
- itemWrapIndices = getAdjustedWrapIndices(coolBar.getWrapIndices());
-
- // Save the preferred size as actual size for the last item on a row
- int count = coolBar.getItemCount();
- int[] lastIndices = coolBar.getWrapIndices();
- int n = lastIndices.length;
- if (n == 0) {
- if (count == 0) lastIndices = new int[0];
- else lastIndices = new int[] {count - 1};
- } else {
- // convert from first item indices to last item indices
- for (int i = 0; i < n - 1; ++i) {
- lastIndices[i] = lastIndices[i+1] - 1;
- }
- lastIndices[n - 1] = count - 1;
- }
- for (int i = 0; i < lastIndices.length; i++) {
- int lastIndex = lastIndices[i];
- if (lastIndex >= 0 && lastIndex < coolItems.length) {
- CoolItem lastItem = coolItems[lastIndex];
- itemSizes[lastIndex] = lastItem.getPreferredSize();
- }
- }
- }
- public CoolBarLayout(ArrayList items, int[] itemWrapIndices, Point[] itemSizes, ArrayList rememberedPositions) {
- this.items = items;
- this.itemWrapIndices = itemWrapIndices;
- this.itemSizes = itemSizes;
- this.rememberedPositions = rememberedPositions;
- }
- /**
- * Return the set of wrap indices that would be a result of adding
- * an item at the given itemIndex on the the given row.
- */
- int[] wrapsForNewItem(int rowIndex, int itemIndex) {
- int[] newWraps = null;
- int rowStartIndex = getStartIndexOfRow(rowIndex);
- if (itemIndex == rowStartIndex) {
- // if itemIndex is the start of the row, we are adding the item
- // to the beginning of the row, so adjust the wrap indices
- newWraps = new int[itemWrapIndices.length];
- System.arraycopy(itemWrapIndices, 0, newWraps, 0, itemWrapIndices.length);
- newWraps[rowIndex] = itemIndex;
- for (int i = rowIndex + 1; i < newWraps.length; i++) {
- newWraps[i]++;
- }
- }
- return newWraps;
- }
- /**
- * Return the set of wrap indices that would be a result of adding
- * an item at the given itemIndex on the given new row.
- */
- int[] wrapsForNewRow(int rowIndex, int itemIndex) {
- int[] newWraps = new int[itemWrapIndices.length + 1];
- for (int j = 0; j < rowIndex; j++) {
- newWraps[j]=itemWrapIndices[j];
- }
- newWraps[rowIndex] = itemIndex;
- for (int j = rowIndex; j < itemWrapIndices.length; j++) {
- newWraps[j+1]=itemWrapIndices[j]+1;
- }
- return newWraps;
- }
- /**
- * Return a consistent set of wrap indices. The return value
- * will always include at least one entry and the first entry will
- * always be zero. CoolBar.getWrapIndices() is inconsistent
- * in whether or not it returns an index for the first row.
- */
- private int[] getAdjustedWrapIndices(int[] wraps) {
- int[] adjustedWrapIndices;
- if (wraps.length == 0) {
- adjustedWrapIndices = new int[] { 0 };
- } else {
- if (wraps[0] != 0) {
- adjustedWrapIndices = new int[wraps.length + 1];
- adjustedWrapIndices[0] = 0;
- for (int i = 0; i < wraps.length; i++) {
- adjustedWrapIndices[i + 1] = wraps[i];
- }
- } else {
- adjustedWrapIndices = wraps;
- }
- }
- return adjustedWrapIndices;
- }
- /**
- * Return the number of rows in the layout.
- */
- int getNumberOfRows() {
- return itemWrapIndices.length;
- }
- /**
- */
- int getRowOfIndex(int index) {
- int row = -1;
- for (row = 0; row < itemWrapIndices.length; row++) {
- if (itemWrapIndices[row] > index) break;
- }
- if (row > 0) row--;
- return row;
- }
- /**
- * Return the item index of the first item on the given row.
- */
- int getStartIndexOfRow(int rowIndex) {
- // return the item index of the first item in the given row
- if (rowIndex > itemWrapIndices.length - 1) return -1; // row doesn't exist
- return itemWrapIndices[rowIndex];
- }
- boolean isOnRowAlone(int itemIndex) {
- int row = getRowOfIndex(itemIndex);
- int rowStart = getStartIndexOfRow(row);
- int nextRowStart = getStartIndexOfRow(row + 1);
- if (nextRowStart == -1) nextRowStart = rowStart;
- return (rowStart == itemIndex) && (nextRowStart - rowStart <= 1);
- }
- /**
- * Return whether or not the items from this layout that are in
- * otherLayout are in the same order within the layouts.
- */
- /* package */ boolean isDerivativeOf(CoolBarLayout otherLayout) {
- // for the items that are in this layout,
- // get the indexes of these items in otherLayout
- ArrayList indexes = new ArrayList();
- for (int i=0; i<this.items.size(); i++) {
- String itemId = (String)this.items.get(i);
- int index = otherLayout.items.indexOf(itemId);
- if (index != -1) indexes.add(new Integer(index));
- }
- // see if the items that are shared across the two
- // layouts are in the same order, if not return
- // false
- int previous = -1;
- for (int i=0; i<indexes.size(); i++) {
- int value = ((Integer)indexes.get(i)).intValue();
- if (value > previous) {
- previous = value;
- } else {
- return false;
- }
- }
- return true;
- }
- /**
- * Restores the object state in the given memento. Returns whether or not the
- * restoration was successful.
- *
- * @param memento the memento to save the object state in
- */
- public boolean restoreState(IMemento memento) {
- IMemento [] sizes = memento.getChildren(IWorkbenchConstants.TAG_ITEM_SIZE);
- if (sizes == null) return false;
- itemSizes = new Point[sizes.length];
- for (int i = 0; i < sizes.length; i++) {
- IMemento sizeMem = sizes[i];
- Integer x = sizeMem.getInteger(IWorkbenchConstants.TAG_X);
- if (x == null) return false;
- Integer y = sizeMem.getInteger(IWorkbenchConstants.TAG_Y);
- if (y == null) return false;
- itemSizes[i] = new Point(x.intValue(), y.intValue());
- }
- IMemento [] wraps = memento.getChildren(IWorkbenchConstants.TAG_ITEM_WRAP_INDEX);
- if (wraps == null) return false;
- itemWrapIndices = new int[wraps.length];
- for (int i = 0; i < wraps.length; i++) {
- IMemento wrapMem = wraps[i];
- Integer index = wrapMem.getInteger(IWorkbenchConstants.TAG_INDEX);
- if (index == null) return false;
- itemWrapIndices[i] = index.intValue();
- }
- IMemento [] savedItems = memento.getChildren(IWorkbenchConstants.TAG_ITEM);
- if (savedItems == null) return false;
- items = new ArrayList(savedItems.length);
- for (int i = 0; i < savedItems.length; i++) {
- IMemento savedMem = savedItems[i];
- String id = savedMem.getString(IWorkbenchConstants.TAG_ID);
- if (id == null) return false;
- items.add(id);
- }
- IMemento [] savedPositions = memento.getChildren(IWorkbenchConstants.TAG_POSITION);
- rememberedPositions = new ArrayList(savedPositions.length);
- for (int i=0; i < savedPositions.length; i++) {
- CoolItemPosition position = new CoolItemPosition();
- IMemento savedPos = savedPositions[i];
- position.id = savedPos.getString(IWorkbenchConstants.TAG_ID);
- if (position.id == null) return false;
- Integer pos = savedPos.getInteger(IWorkbenchConstants.TAG_ADDED);
- if (pos == null) return false;
- int added = pos.intValue();
- position.added = added == 1;
- position.layout = new CoolBarLayout();
- IMemento layoutMemento = savedPos.getChild(IWorkbenchConstants.TAG_LAYOUT);
- if (layoutMemento == null) return false;
- position.layout.restoreState(layoutMemento);
- rememberedPositions.add(position);
- }
- return true;
- }
- /**
- * Saves the object state in the given memento.
- *
- * @param memento the memento to save the object state in
- */
- public IStatus saveState(IMemento memento) {
- for (int i = 0; i < itemSizes.length; i++) {
- IMemento child = memento.createChild(IWorkbenchConstants.TAG_ITEM_SIZE);
- Point pt = itemSizes[i];
- child.putInteger(IWorkbenchConstants.TAG_X, pt.x);
- child.putInteger(IWorkbenchConstants.TAG_Y, pt.y);
- }
- for (int i = 0; i < itemWrapIndices.length; i++) {
- IMemento child = memento.createChild(IWorkbenchConstants.TAG_ITEM_WRAP_INDEX);
- child.putInteger(IWorkbenchConstants.TAG_INDEX, itemWrapIndices[i]);
- }
- Iterator iter = items.iterator();
- while (iter.hasNext()) {
- IMemento child = memento.createChild(IWorkbenchConstants.TAG_ITEM);
- String item = (String)iter.next();
- child.putString(IWorkbenchConstants.TAG_ID, item);
- }
- iter = rememberedPositions.iterator();
- while (iter.hasNext()) {
- IMemento child = memento.createChild(IWorkbenchConstants.TAG_POSITION);
- CoolItemPosition position = (CoolItemPosition)iter.next();
- child.putString(IWorkbenchConstants.TAG_ID, position.id);
- int value = 0;
- if (position.added) value = 1;
- child.putInteger(IWorkbenchConstants.TAG_ADDED, value);
- IMemento layout = child.createChild(IWorkbenchConstants.TAG_LAYOUT);
- position.layout.saveState(layout);
- }
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
- }
- public String toString() {
- StringBuffer buffer = new StringBuffer(20);
- buffer.append("items "); //$NON-NLS-1$
- for (int i = 0; i < items.size(); i++) {
- String item = (String)items.get(i);
- buffer.append(item + " ");
- }
- buffer.append('\n');
- buffer.append("item wrap indices "); //$NON-NLS-1$
- for (int i = 0; i < itemWrapIndices.length; i++) {
- buffer.append(itemWrapIndices[i] + " "); //$NON-NLS-1$
- }
- buffer.append('\n');
- buffer.append("item sizes "); //$NON-NLS-1$
- for (int i = 0; i < itemSizes.length; i++) {
- buffer.append(itemSizes[i] + " "); //$NON-NLS-1$
- }
- buffer.append('\n');
- return buffer.toString();
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarManager.java
deleted file mode 100644
index eb87e7d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolBarManager.java
+++ /dev/null
@@ -1,1141 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.*;
-
-/**
- */
-public class CoolBarManager extends ContributionManager implements IToolBarManager {
- /**
- * The cool bar style; <code>SWT.NONE</code> by default.
- */
- private int style = SWT.NONE;
-
- /**
- * The cool bar control; <code>null</code> before creation
- * and after disposal.
- */
- private CoolBar coolBar = null;
-
- /**
- * MenuManager for chevron menu when CoolItems not fully displayed.
- */
- private MenuManager chevronMenuManager;
-
- /**
- * MenuManager for coolbar popup menu
- */
- private MenuManager coolBarMenuManager = new MenuManager();
-
- /**
- * Flag to track whether or not to remember coolbar item positions when an item
- * is deleted.
- */
- private boolean rememberPositions = false;
- /**
- * Stack for remembering positions of coolitems that have been removed.
- */
- private ArrayList rememberedPositions = new ArrayList();
-
- private class RestoreItemData {
- CoolItemPosition savedPosition;
- String beforeItemId; // found afterItemId, restore item after this item
- String afterItemId; // found beforeItemId, restore item before this item
- int beforeIndex = -1; // index in current layout of beforeItemId
- int afterIndex = -1; // index in current layout of afterItemId
-
- RestoreItemData() {
- }
- }
- /**
- */
- public CoolBarManager() {
- }
- /**
- */
- public CoolBarManager(int style) {
- this.style = style;
- }
- /**
- * Adds an action as a contribution item to this manager.
- * Equivalent to <code>add(new ActionContributionItem(action))</code>.
- *
- * Not valid for CoolBarManager. Only CoolBarContributionItems may be added
- * to this manager.
- *
- * @param action the action
- */
- public void add(IAction action) {
- Assert.isTrue(false);
- }
- /**
- * Adds a CoolBarContributionItem to this manager.
- *
- * @exception AssertionFailedException if the type of item is
- * not valid
- */
- public void add(IContributionItem item) {
- Assert.isTrue(item instanceof CoolBarContributionItem);
- super.add(item);
- }
- /**
- * Adds a contribution item to the coolbar's menu.
- */
- public void addToMenu(ActionContributionItem item) {
- coolBarMenuManager.add(item.getAction());
- }
- /**
- * Adds a contribution item to the start or end of the group
- * with the given id.
- *
- * Not valid for CoolBarManager. Only CoolBarContributionItems are items
- * of this manager.
- */
- private void addToGroup(String itemId, IContributionItem item, boolean append) {
- Assert.isTrue(false);
- }
- /**
- */
- private boolean coolBarExist() {
- return coolBar != null && !coolBar.isDisposed();
- }
- /**
- */
- /* package */ CoolBar createControl(Composite parent) {
- if (!coolBarExist() && parent != null) {
- // Create the CoolBar and its popup menu.
- coolBar = new CoolBar(parent, style);
- coolBar.setLocked(false);
- coolBar.addListener(SWT.Resize, new Listener() {
- public void handleEvent(Event event) {
- coolBar.getParent().layout();
- }
- });
- coolBar.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- popupCoolBarMenu(e);
- }
- });
- }
- return coolBar;
- }
- /**
- * Create the coolbar item for the given contribution item.
- */
- private CoolItem createCoolItem(CoolBarContributionItem cbItem, ToolBar toolBar) {
- CoolItem coolItem;
- toolBar.setVisible(true);
- CoolItemPosition position = getRememberedPosition(cbItem.getId());
- if (position != null) {
- coolItem = createRememberedCoolItem(cbItem, toolBar, position);
- } else {
- coolItem = createNewCoolItem(cbItem, toolBar);
- }
- coolItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- if (event.detail == SWT.ARROW) {
- handleChevron(event);
- }
- }
- });
- return coolItem;
- }
- /**
- * Create a new coolbar item for the given contribution item. Put the item in its original
- * creation position.
- */
- private CoolItem createNewCoolItem(CoolBarContributionItem cbItem, ToolBar toolBar) {
- CoolItem coolItem;
- int index = -1;
- if (cbItem.isOrderBefore()) {
- index = getInsertBeforeIndex(cbItem);
- } else if (cbItem.isOrderAfter()) {
- index = getInsertAfterIndex(cbItem);
- }
- if (index == -1) {
- index = coolBar.getItemCount();
- coolItem = new CoolItem(coolBar, SWT.DROP_DOWN);
- } else {
- coolItem = new CoolItem(coolBar, SWT.DROP_DOWN, index);
- }
- coolItem.setControl(toolBar);
- coolItem.setData(cbItem);
- setSizeFor(coolItem);
-
- return coolItem;
- }
- /**
- * Create a new coolbar item for the given contribution item. Put the item in its rememberedl
- * position.
- */
- private CoolItem createRememberedCoolItem(CoolBarContributionItem cbItem, ToolBar toolBar, CoolItemPosition position) {
- RestoreItemData data = getRestoreData(cbItem, position);
- int savedAfterRow = -1;
- int currentAfterRow = -1;
- int savedBeforeRow = -1;
- int currentBeforeRow = -1;
- int savedItemRow = -1;
- CoolBarLayout currentLayout = getLayout();
- if (data.savedPosition != null) {
- savedItemRow = data.savedPosition.getRowOf(cbItem.getId());
- if (data.afterItemId != null) {
- savedAfterRow = data.savedPosition.getRowOf(data.afterItemId);
- currentAfterRow = currentLayout.getRowOfIndex(data.afterIndex);
- }
- if (data.beforeItemId != null) {
- savedBeforeRow = data.savedPosition.getRowOf(data.beforeItemId);
- currentBeforeRow = currentLayout.getRowOfIndex(data.beforeIndex);
- }
- }
-
- int createIndex = -1;
- int row;
- int[] newWraps = null;
-
- // Figure out where to place the item and how to adjust the wrap indices.
- // When adding the item at the afterIndex, wrap indices may need to be
- // adjusted if the index represents the beginning of a row in the current
- // coolbar layout.
- if (data.afterIndex != -1 && data.beforeIndex != -1) {
- // both a beforeItem and afterItem were found in the current coolbar layout
- // for the item to be added
- if ((savedItemRow == savedAfterRow) && (savedItemRow == savedBeforeRow)) {
- // in the saved layout the item was on the same row as both the beforeItem
- // and the afterItem, compare this to the current coolbar layout
- if (currentAfterRow == currentBeforeRow) {
- // in the current layout, both the before and after item are on the
- // same row, so add the item to this row
- createIndex = data.beforeIndex + 1;
- row = currentBeforeRow;
- } else {
- // in the current layout, both the before and after item are not on
- // the same row
- if (currentBeforeRow == savedBeforeRow) {
- // the beforeItem is on the same row as in the saved layout
- createIndex = data.beforeIndex + 1;
- row = currentBeforeRow;
- } else if (currentAfterRow == savedAfterRow) {
- // the afterItem is on the same row as in the saved layout
- createIndex = data.afterIndex;
- row = currentAfterRow;
- newWraps = currentLayout.wrapsForNewItem(row, createIndex);
- } else {
- // current layout rows are different than when the item
- // was deleted, just add the item to the currentBeforeRow
- createIndex = data.beforeIndex + 1;
- row = currentBeforeRow;
- }
-
- }
- } else if (savedItemRow == savedBeforeRow) {
- // in the saved layout, the item was on the same row as the beforeItem,
- // add the item to the before row
- createIndex = data.beforeIndex + 1;
- row = currentBeforeRow;
- } else if (savedItemRow == savedAfterRow) {
- // in the saved layout, the item was on the same row as the afterItem
- // add the item to the currentAfterRow
- createIndex = data.afterIndex;
- row = currentAfterRow;
- newWraps = currentLayout.wrapsForNewItem(row, createIndex);
- } else {
- // in the saved layout, the item was on a row by itself
- // put the item on a row by itself after currentBeforeRow
- row = currentBeforeRow + 1;
- createIndex = currentLayout.getStartIndexOfRow(row);
- if (createIndex == -1) {
- // row does not exist
- createIndex = coolBar.getItemCount();
- }
- newWraps = currentLayout.wrapsForNewRow(row, createIndex);
- }
- } else if (data.afterIndex != -1) {
- // only an afterItem was found in the current coolbar layout
- // for the item to be added
- createIndex = data.afterIndex;
- if (savedItemRow == savedAfterRow) {
- // in the saved layout, the item was on the same row as the afterItem,
- // put the item on the currentAfterRow
- row = currentAfterRow;
- newWraps = currentLayout.wrapsForNewItem(row, createIndex);
- } else {
- // in the saved layout, the item was not on the same row as the
- // afterItem, create a new row before currentAfterRow
- row = currentAfterRow;
- createIndex = currentLayout.getStartIndexOfRow(row);
- newWraps = currentLayout.wrapsForNewRow(row, createIndex);
- }
- } else if (data.beforeIndex != -1) {
- // only a beforeItem was found in the current coolbar layout
- // for the item to be added
- createIndex = data.beforeIndex + 1;
- if (savedItemRow == savedBeforeRow) {
- // in the saved layout, the item was on the same row as the beforeItem,
- // put the item on currentBeforeRow
- row = currentBeforeRow;
- newWraps = currentLayout.wrapsForNewItem(row, createIndex);
- } else {
- // in the saved layout, the item was not on the same row as the
- // beforeItem, create a new row with the item after currentBeforeRow
- row = currentBeforeRow + 1;
- createIndex = currentLayout.getStartIndexOfRow(row);
- if (createIndex == -1) {
- // row does not exist
- createIndex = coolBar.getItemCount();
- }
- newWraps = currentLayout.wrapsForNewRow(row, createIndex);
- }
- } else {
- // neither a before or after item was found in the current coolbar
- // layout, just add the item to the end of the coolbar
- createIndex = coolBar.getItemCount();
- }
-
- // create the item
- if (newWraps != null) {
- // item will be added and then the wraps will set, so use
- // since the position of the item will change
- coolBar.setRedraw(false);
- }
- CoolItem coolItem = new CoolItem(coolBar, SWT.DROP_DOWN, createIndex);
- coolItem.setControl(toolBar);
- coolItem.setData(cbItem);
-// setSizeFor(coolItem, position.getSizeOf(cbItem.getId()).x);
- setSizeFor(coolItem);
- if (newWraps != null) {
- coolBar.setWrapIndices(newWraps);
- coolBar.setRedraw(true);
- }
-
- positionAdded(position);
-
- return coolItem;
- }
- /**
- */
- private void dispose(CoolBarContributionItem cbItem) {
- CoolItem coolItem = findCoolItem(cbItem);
- if (coolItem != null) {
- dispose(coolItem);
- }
- remove(cbItem);
- cbItem.getToolBarManager().dispose();
- }
- /**
- */
- private void dispose(CoolItem coolItem) {
- if ((coolItem != null) && !coolItem.isDisposed()) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem)coolItem.getData();
- if (cbItem != null && rememberPositions) rememberPositionFor(cbItem.getId(), getLayout());
- coolItem.setData(null);
- Control control = coolItem.getControl();
- // if the control is already disposed, setting the coolitem
- // control to null will cause an SWT exception, workaround
- // for 19630
- if ((control != null) && !control.isDisposed()) {
- coolItem.setControl(null);
- }
- coolItem.dispose();
- }
- }
- /**
- */
- /* package */ void dispose() {
- if (coolBarExist()) {
- IContributionItem[] cbItems = getItems();
- for (int i=0; i<cbItems.length; i++) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem)cbItems[i];
- dispose(cbItem);
- }
- coolBar.dispose();
- coolBar = null;
- }
- if (chevronMenuManager != null) {
- chevronMenuManager.dispose();
- chevronMenuManager = null;
- }
- if (coolBarMenuManager != null) {
- coolBarMenuManager.dispose();
- coolBarMenuManager = null;
- }
- }
- /**
- */
- private CoolItem findCoolItem(CoolBarContributionItem item) {
- if (coolBar == null) return null;
- CoolItem[] items = coolBar.getItems();
- for (int i = 0; i < items.length; i++) {
- CoolItem coolItem = items[i];
- CoolBarContributionItem data = (CoolBarContributionItem)coolItem.getData();
- if (data != null && data.equals(item)) return coolItem;
- }
- return null;
- }
- /**
- */
- /* package */ CoolBarContributionItem findSubId(String id) {
- IContributionItem[] items = getItems();
- for (int i = 0; i < items.length; i++) {
- CoolBarContributionItem item = (CoolBarContributionItem)items[i];
- IContributionItem subItem = item.getToolBarManager().find(id);
- if (subItem != null) return item;
- }
- return null;
- }
- /**
- */
- private ArrayList getContributionIds() {
- IContributionItem[] items = getItems();
- ArrayList ids = new ArrayList(items.length);
- for (int i = 0; i < items.length; i++) {
- IContributionItem item = items[i];
- ids.add(item.getId());
- }
- return ids;
- }
- /**
- */
- private ArrayList getCoolItemIds() {
- CoolItem[] coolItems = coolBar.getItems();
- ArrayList ids = new ArrayList(coolItems.length);
- for (int i = 0; i < coolItems.length; i++) {
- CoolBarContributionItem group = (CoolBarContributionItem) coolItems[i].getData();
- if (group != null) ids.add(group.getId());
- }
- return ids;
- }
- /**
- * Return the SWT control for this manager.
- */
- /* package */ CoolBar getControl() {
- return coolBar;
- }
- /**
- */
- private int getInsertAfterIndex(CoolBarContributionItem coolBarItem) {
- IContributionItem[] items = getItems();
- int index = -1;
- CoolBarContributionItem afterItem = null;
- // find out which item should be after this item
- for (int i=0; i<items.length; i++) {
- if (items[i].equals(coolBarItem)) {
- if (i > 0) {
- while (i > 0) {
- afterItem = (CoolBarContributionItem)items[i-1];
- if (afterItem.isVisible()) break;
- i--;
- }
- } else {
- // item is not after anything
- index = 0;
- }
- break;
- }
- }
- // get the coolbar location of the after item
- if (afterItem != null) {
- CoolItem afterCoolItem = findCoolItem(afterItem);
- if (afterCoolItem != null) {
- index = coolBar.indexOf(afterCoolItem);
- index++;
- }
- }
- return index;
- }
- /**
- */
- private int getInsertBeforeIndex(CoolBarContributionItem coolBarItem) {
- IContributionItem[] items = getItems();
- int index = -1;
- CoolBarContributionItem beforeItem = null;
- // find out which item should be before this item
- for (int i=0; i<items.length; i++) {
- if (items[i].equals(coolBarItem)) {
- if (i < items.length - 1) {
- while (i < items.length - 1) {
- beforeItem = (CoolBarContributionItem)items[i+1];
- if (beforeItem.isVisible()) break;
- i++;
- }
- } else {
- // item is not before anything
- index = coolBar.getItems().length;
- }
- break;
- }
- }
- // get the coolbar location of the before item
- if (beforeItem != null) {
- CoolItem beforeCoolItem = findCoolItem(beforeItem);
- if (beforeCoolItem != null) {
- index = coolBar.indexOf(beforeCoolItem);
- }
- }
- return index;
- }
- /**
- */
- private CoolBarLayout getLayout() {
- if (!coolBarExist())
- return null;
- CoolBarLayout layout = new CoolBarLayout(coolBar);
- layout.rememberedPositions = new ArrayList();
- layout.rememberedPositions.addAll(rememberedPositions);
- return layout;
- }
- private RestoreItemData getRestoreData(CoolBarContributionItem cbItem, CoolItemPosition position) {
- RestoreItemData bestMatch = new RestoreItemData();
- ArrayList coolBarItems = getLayout().items;
-
- // Look at the remembered layouts starting at the layout for the item and heading
- // down the stack looking for the best saved layout to use for restoring the
- // item position. Stop processing when an exact match is found or the position of
- // the item has changed in the remembered layouts.
- int startIndex = rememberedPositions.indexOf(position);
- CoolBarLayout previousLayout = null;
- for (int i=startIndex; i < rememberedPositions.size(); i++) {
- CoolItemPosition savedPosition = (CoolItemPosition)rememberedPositions.get(i);
- ArrayList savedItems = savedPosition.getItems();
-
- // the item we are trying to restore is not in the saved layout, so stop
- int savedItemIndex = savedItems.indexOf(cbItem.getId());
- if (savedItemIndex == -1) break;
-
- // if the previousLayout is not similar to the next layout, stop
- if (previousLayout != null) {
- if (!previousLayout.isDerivativeOf(savedPosition.layout)) break;
- }
-
- boolean afterBeforeItemFound = bestMatch.afterIndex != -1 && bestMatch.beforeIndex != -1;
- String afterId = null;
- String beforeId = null;
- int beforeIndex = -1;
- int afterIndex = -1;
-
- // look at the saved items after savedItemIndex, see if any of these items
- // is in the current coolbar layout
- for (int j = savedItemIndex + 1; j < savedItems.size(); j++) {
- //
- afterId = (String)savedItems.get(j);
- afterIndex = coolBarItems.indexOf(afterId);
- if (afterIndex != -1) {
- break;
- }
- }
- // look at the saved items before savedItemIndex, see if any of these items
- // is in the current coolbar layout
- for (int j = savedItemIndex - 1; j >= 0; j--) {
- //
- beforeId = (String)savedItems.get(j);
- beforeIndex = coolBarItems.indexOf(beforeId);
- if (beforeIndex != -1) {
- break;
- }
- }
- if (beforeIndex != -1 && afterIndex != -1) {
- // test whether or not we've found an exact position,
- // if we have use this savedPosition
- bestMatch.savedPosition = savedPosition;
- bestMatch.afterItemId = afterId;
- bestMatch.afterIndex = afterIndex;
- bestMatch.beforeItemId = beforeId;
- bestMatch.beforeIndex = beforeIndex;
- if (beforeIndex + 1 == afterIndex) {
- break;
- }
- } else if (beforeIndex != -1) {
- // If we found both items previously, that is the best match.
- // This condition can happen if items were added between this
- // savedPosition and the previous savedPosition.
- if (afterBeforeItemFound) break;
- bestMatch.savedPosition = savedPosition;
- bestMatch.beforeItemId = beforeId;
- bestMatch.beforeIndex = beforeIndex;
- bestMatch.afterItemId = null;
- bestMatch.afterIndex = -1;
- // there are no after before index on the coolbar
- if (beforeIndex == coolBarItems.size() - 1) break;
- } else if (afterIndex != -1) {
- // If we found both items previously, that is the best match.
- // This condition can happen if items were added between this
- // savedPosition and the previous savedPosition.
- if (afterBeforeItemFound) break;
- bestMatch.savedPosition = savedPosition;
- bestMatch.afterItemId = afterId;
- bestMatch.afterIndex = afterIndex;
- bestMatch.beforeItemId = null;
- bestMatch.beforeIndex = -1;
- // there are no items before afterIndex on the coolbar
- if (afterIndex == 0) break;
- } else {
- // nothing found
- break;
- }
- previousLayout = savedPosition.layout;
- }
- return bestMatch;
- }
- /**
- * Return the remembered position for the given CoolBarContributionItem. If a position
- * was not remembered, return null.
- */
- private CoolItemPosition getRememberedPosition (String cbItemId) {
- for (int i=0; i<rememberedPositions.size(); i++) {
- CoolItemPosition position = (CoolItemPosition)rememberedPositions.get(i);
- if (position.id.equals(cbItemId) && !position.added) return position;
- }
- return null;
- }
- /* package */ int getStyle() {
- return style;
- }
- /**
- * Create and display the chevron menu.
- */
- private void handleChevron(SelectionEvent event) {
- CoolItem item = (CoolItem) event.widget;
- Control control = item.getControl();
- if ((control instanceof ToolBar) == false) {
- return;
- }
-
- Point chevronPosition = coolBar.toDisplay(new Point(event.x, event.y));
- ToolBar toolBar = (ToolBar) control;
- ToolItem[] tools = toolBar.getItems();
- int toolCount = tools.length;
- int visibleItemCount = 0;
- while (visibleItemCount < toolCount) {
- Rectangle toolBounds = tools[visibleItemCount].getBounds();
- Point point = toolBar.toDisplay(new Point(toolBounds.x, toolBounds.y));
- toolBounds.x = point.x;
- toolBounds.y = point.y;
- // stop if the tool is at least partially hidden by the drop down chevron
- if (chevronPosition.x >= toolBounds.x && chevronPosition.x - toolBounds.x <= toolBounds.width) {
- break;
- }
- visibleItemCount++;
- }
-
- // Create a pop-up menu with items for each of the hidden buttons.
- if (chevronMenuManager != null) {
- chevronMenuManager.dispose();
- }
- chevronMenuManager = new MenuManager();
- for (int i = visibleItemCount; i < toolCount; i++) {
- IContributionItem data = (IContributionItem) tools[i].getData();
- if (data instanceof ActionContributionItem) {
- ActionContributionItem contribution = new ActionContributionItem(((ActionContributionItem) data).getAction());
- chevronMenuManager.add(contribution);
- } else if (data instanceof SubContributionItem) {
- IContributionItem innerData = ((SubContributionItem)data).getInnerItem();
- if (innerData instanceof ActionContributionItem) {
- ActionContributionItem contribution = new ActionContributionItem(((ActionContributionItem) innerData).getAction());
- chevronMenuManager.add(contribution);
- }
- } else if (data.isSeparator()) {
- chevronMenuManager.add(new Separator());
- }
- }
- Menu popup = chevronMenuManager.createContextMenu(coolBar);
- popup.setLocation(chevronPosition.x, chevronPosition.y);
- popup.setVisible(true);
- }
- /**
- * Inserts a contribution item for the given action after the item
- * with the given id.
- * Equivalent to
- * <code>insertAfter(id,new ActionContributionItem(action))</code>.
- *
- * Not valid for CoolBarManager. Only CoolBarContributionItems may be added
- * to this manager.
- *
- * @param id the contribution item id
- * @param action the action to insert
- */
- public void insertAfter(String id, IAction action) {
- Assert.isTrue(false);
- }
- /**
- * Inserts a contribution item after the item with the given id.
- *
- * @param id the CoolBarContributionItem
- * @param item the CoolBarContributionItem to insert
- * @exception IllegalArgumentException if there is no item with
- * the given id
- * @exception IllegalArgumentException if the type of item is
- * not valid
- */
- public void insertAfter(String id, IContributionItem item) {
- Assert.isTrue(item instanceof CoolBarContributionItem);
- super.insertAfter(id, item);
- ((CoolBarContributionItem)item).setOrderAfter(true);
- }
- /**
- * Inserts a contribution item for the given action before the item
- * with the given id.
- * Equivalent to
- * <code>insertBefore(id,new ActionContributionItem(action))</code>.
- *
- * Not valid for CoolBarManager. Only CoolBarContributionItems may be added
- * to this manager.
- *
- * @param id the contribution item id
- * @param action the action to insert
- */
- public void insertBefore(String id, IAction action) {
- Assert.isTrue(false);
- }
- /**
- * Inserts a contribution item before the item with the given id.
- *
- * @param id the CoolBarContributionItem
- * @param item the CoolBarContributionItem to insert
- * @exception IllegalArgumentException if there is no item with
- * the given id
- * @exception IllegalArgumentException if the type of item is
- * not valid
- */
- public void insertBefore(String id, IContributionItem item) {
- Assert.isTrue(item instanceof CoolBarContributionItem);
- super.insertBefore(id, item);
- ((CoolBarContributionItem)item).setOrderBefore(true);
- }
- /**
- */
- /* package */ boolean isLayoutLocked() {
- if (!coolBarExist()) return false;
- return coolBar.getLocked();
- }
- /**
- */
- /* package */ void lockLayout(boolean value) {
- coolBar.setLocked(value);
- }
- /**
- */
- /* package */ void popupCoolBarMenu(MouseEvent e) {
- if (e.button != 3)
- return;
- Point pt = new Point(e.x, e.y);
- pt = ((Control) e.widget).toDisplay(pt);
- Menu coolBarMenu = coolBarMenuManager.createContextMenu(coolBar);
- coolBarMenu.setLocation(pt.x, pt.y);
- coolBarMenu.setVisible(true);
- }
- /**
- */
- private void positionAdded(CoolItemPosition position) {
- // mark the position as added back
- position.added = true;
-
- // remembered positions on the top of the stack that have been added can be removed
- boolean done = rememberedPositions.size() == 0;
- while (!done) {
- CoolItemPosition topLayout = (CoolItemPosition)rememberedPositions.get(0);
- if (topLayout.added) {
- rememberedPositions.remove(0);
- done = rememberedPositions.size() == 0;
- } else {
- done = true;
- }
- }
- // all except the least recently added position in a set of contiguously added positions
- // can be removed from the stack within each g
- int testIndex = 1;
- done = testIndex + 1 > rememberedPositions.size() - 1;
- while (!done) {
- CoolItemPosition pos = (CoolItemPosition)rememberedPositions.get(testIndex);
- if (pos.added) {
- CoolItemPosition nextPos = (CoolItemPosition)rememberedPositions.get(testIndex + 1);
- CoolItemPosition prevPos = (CoolItemPosition)rememberedPositions.get(testIndex - 1);
- boolean nextSameGroup = pos.layout.isDerivativeOf(nextPos.layout);
- boolean prevSameGroup = prevPos.layout.isDerivativeOf(pos.layout);
- if (!nextSameGroup && !prevSameGroup) {
- // only item in this group
- rememberedPositions.remove(testIndex);
- } else if (nextPos.added && nextSameGroup && !prevSameGroup) {
- rememberedPositions.remove(testIndex);
- } else {
- testIndex++;
- }
- } else {
- testIndex++;
- }
- done = testIndex + 1 > rememberedPositions.size() - 1;
- }
- }
- /**
- * Layout out the coolbar items so that each one is sized to its preferred size.
- */
- /* package */ void redoLayout() {
- // Reset the wrap indices and the cool item sizes. The coolbar will automatically
- // wrap the items to the next row that do not fit.
- coolBar.setWrapIndices(new int[0]);
- CoolItem[] coolItems = coolBar.getItems();
- for (int i = 0; i < coolItems.length; i++) {
- CoolItem coolItem = coolItems[i];
- setSizeFor(coolItem);
- }
- // clear any remembered data
- rememberedPositions = new ArrayList();
- relayout();
- }
- /**
- */
- private void resetLayout() {
- coolBar.setRedraw(false);
- CoolItem[] coolItems = coolBar.getItems();
- for (int i = 0; i < coolItems.length; i++) {
- CoolItem coolItem = coolItems[i];
- dispose(coolItem);
- }
- coolBar.setWrapIndices(new int[] {});
- update(true);
- coolBar.setRedraw(true);
- }
- /**
- * Removes the given contribution item from the contribution items
- * known to this manager.
- *
- * @param item the contribution item
- * @return the <code>item</code> parameter if the item was removed,
- * and <code>null</code> if it was not found
- * @exception IllegalArgumentException if the type of item is
- * not valid
- */
- public IContributionItem remove(IContributionItem item) {
- Assert.isTrue(item instanceof CoolBarContributionItem);
- return super.remove(item);
- }
- /**
- */
- private void relayout() {
- coolBar.getParent().layout();
- }
- /**
- * Save the position of the given CoolItem for restoring the item later.
- */
- private CoolItemPosition rememberPositionFor(String cbItemId, CoolBarLayout layout) {
- // create a CoolItemPosition for the given cbItem, no need to save
- // remembered positions as part of the layout
- layout.rememberedPositions = new ArrayList();
- CoolItemPosition position = new CoolItemPosition(cbItemId, layout);
-
- // remove the previously remembered position for the item if
- // it exists
- int index = -1;
- for (int i=0; i<rememberedPositions.size(); i++) {
- CoolItemPosition item = (CoolItemPosition)rememberedPositions.get(i);
- if (position.id.equals(item.id)) index = i;
- }
- if (index != -1) rememberedPositions.remove(index);
-
- // add the position to the beginning of the stack of remembered
- // positions
- rememberedPositions.add(0, position);
- return position;
- }
- void saveLayoutFor(Perspective perspective) {
- perspective.setToolBarLayout(getLayout());
- rememberPositions = false;
- rememberedPositions = new ArrayList();
- }
- void setLayoutFor(Perspective perspective) {
- rememberedPositions = new ArrayList();
- setLayout(perspective.getToolBarLayout());
- rememberPositions = true;
- }
- /**
- */
- private void setLayout(CoolBarLayout layout) {
- try {
- setLayoutTo(layout);
- } catch (Exception e) {
- // A lot can go wrong if the layout is out of sync with the coolbar state.
- // Try to recover by resetting the layout.
- WorkbenchPlugin.log("An error has occurred restoring the coolbar layout. " + e.toString()); //$NON-NLS-1$
- resetLayout();
- }
- }
- /**
- */
- private void setLayoutTo(CoolBarLayout layout) {
- // This method is called after update. All of the coolbar items have
- // been created, now apply the layout to the coolbar.
-
- if (layout == null) {
- coolBar.setRedraw(false);
- CoolItem[] coolItems = coolBar.getItems();
- int[] newItemOrder = new int[coolItems.length];
- // Reset the coolitem order to their original order. This order is
- // based on the order of the ContributionItems. Note that the only
- // way to reset item order is to setItemLayout (no setItemOrder API).
- IContributionItem[] items = getItems();
- int j = 0;
- int[] oldItemOrder = coolBar.getItemOrder();
- for (int i = 0; i < items.length; i++) {
- CoolBarContributionItem item = (CoolBarContributionItem)items[i];
- CoolItem coolItem = findCoolItem(item);
- if (coolItem != null) {
- int visualIndex = coolBar.indexOf(coolItem);
- int creationIndex = oldItemOrder[visualIndex];
- newItemOrder[j] = creationIndex;
- j++;
- }
- }
- coolBar.setItemLayout(newItemOrder, coolBar.getWrapIndices(), coolBar.getItemSizes());
- redoLayout();
- coolBar.setRedraw(true);
- return;
- }
-
- int maxItemCount = coolBar.getItemCount();
- int[] itemOrder = new int[maxItemCount];
- Point[] itemSizes = new Point[maxItemCount];
-
- // Used to keep track of what cool items have been accounted for in
- // layout. New items that were added after the layout was saved, will
- // not be accounted for.
- int[] found = new int[maxItemCount];
- for (int i = 0; i < found.length; i++) {
- found[i] = -1;
- }
- int[] currentItemOrder = coolBar.getItemOrder();
- Vector foundItemOrder = new Vector();
- Vector foundItemSizes = new Vector();
- for (int i=0; i<layout.items.size(); i++) {
- CoolItem coolItem = findCoolItem((CoolBarContributionItem)find((String)layout.items.get(i)));
- if (coolItem != null) {
- int index = currentItemOrder[coolBar.indexOf(coolItem)];
- foundItemOrder.add(new Integer(index));
- foundItemSizes.add(layout.itemSizes[i]);
- // the cool item at the given index has been accounted for,
- // so set the found value for that index to 0
- found[index]=0;
- }
- }
- int count=0;
- for (count=0; count<foundItemOrder.size(); count++) {
- itemOrder[count]=((Integer)foundItemOrder.elementAt(count)).intValue();
- itemSizes[count]=(Point)foundItemSizes.elementAt(count);
- }
-
- rememberedPositions = layout.rememberedPositions;
- // Handle those items that are on the coolbar, but not in the layout.
- // Just add these items at the end of the coolbar for now.
- ArrayList rememberedAddedItems = new ArrayList();
- for (int i=0; i<found.length; i++) {
- if (found[i] == -1) {
- itemOrder[count]=i;
- CoolItem cItem = coolBar.getItem(i);
- itemSizes[count]=cItem.getSize();
- CoolBarContributionItem cbItem = (CoolBarContributionItem)cItem.getData();
- CoolItemPosition position = getRememberedPosition(cbItem.getId());
- if (position != null) {
- rememberedAddedItems.add(cItem);
- }
- count++;
- }
- }
-
- coolBar.setRedraw(false);
- coolBar.setItemLayout(itemOrder, new int[0], itemSizes);
-
- // restore the wrap indices after the new item order is restored, wrap on the same items that
- // were specified in the layout
- String[] wrapItems = new String[layout.itemWrapIndices.length];
- for (int i = 0; i < layout.itemWrapIndices.length; i++) {
- wrapItems[i] = (String) layout.items.get(layout.itemWrapIndices[i]);
- }
- int[] wrapIndices = new int[wrapItems.length];
- ArrayList currentCoolItemIds = getCoolItemIds();
- int j = 0;
- int k = 0;
- while (k < wrapItems.length) {
- int index = currentCoolItemIds.indexOf(wrapItems[k]);
- if (index != -1) {
- wrapIndices[j] = index;
- j++;
- k++;
- } else {
- // wrap item no longer exists, try wrapping on the next item in the
- // saved layout, if we hit a new row, stop
- int visualIndex = layout.items.indexOf(wrapItems[k]);
- int row = layout.getRowOfIndex(visualIndex);
- int nextIndex = visualIndex + 1;
- int nextRow = layout.getRowOfIndex(nextIndex);
- if (nextIndex < layout.items.size() && nextRow == row) {
- String nextItem = (String)layout.items.get(nextIndex);
- wrapItems[k]=nextItem;
- } else {
- k++;
- }
- }
- }
- int[] itemWraps = new int[j];
- System.arraycopy(wrapIndices, 0, itemWraps, 0, j);
- coolBar.setWrapIndices(itemWraps);
-
- // restore the position of items whose position was remembered
- ArrayList cbItems = new ArrayList();
- ArrayList toolbars = new ArrayList();
- // dispose of the coolitems, then add back one at a time - necessary to restore the
- // original layout
- for (int i=0; i<rememberedAddedItems.size(); i++) {
- CoolItem item = (CoolItem)rememberedAddedItems.get(i);
- CoolBarContributionItem cbItem = (CoolBarContributionItem)item.getData();
- cbItems.add(cbItem);
- ToolBar tBar = (ToolBar) item.getControl();
- toolbars.add(tBar);
- dispose(item);
- }
- for (int i=0; i<cbItems.size(); i++) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem)cbItems.get(i);
- CoolItemPosition position = getRememberedPosition(cbItem.getId());
- // restore the item's saved position
- ToolBar tBar = (ToolBar)toolbars.get(i);
- createRememberedCoolItem(cbItem, tBar, position);
- }
-
- // need to remember position for any item that was in the layout but not
- // currently on the coolbar
- ArrayList currentIds = getCoolItemIds();
- for (int i=0; i<layout.items.size(); i++) {
- String id = (String)layout.items.get(i);
- if (!currentIds.contains(id)) {
- rememberPositionFor(id, layout);
- }
- }
- coolBar.setRedraw(true);
- }
- private void setSizeFor(CoolItem coolItem) {
- setSizeFor(coolItem, -1);
- }
- /**
- */
- private void setSizeFor(CoolItem coolItem, int coolWidth) {
- ToolBar toolBar = (ToolBar) coolItem.getControl();
- Point size = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Point coolSize = coolItem.computeSize(size.x, size.y);
- // note setMinimumSize must be called before setSize, see PR 15565
- coolItem.setMinimumSize(size.x, size.y);
- coolItem.setPreferredSize(coolSize);
- if (coolWidth == -1) {
- coolItem.setSize(coolSize);
- } else {
- coolItem.setSize(new Point(coolWidth, coolSize.y));
- }
- }
- /**
- */
- public void update(boolean force) {
- if (isDirty() || force) {
- if (coolBarExist()) {
- boolean useRedraw = false;
- CoolBarLayout layout = getLayout();
-
- // remove CoolBarItemContributions that are empty
- IContributionItem[] items = getItems();
- ArrayList cbItemsToRemove = new ArrayList(items.length);
- for (int i = 0; i < items.length; i++) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem) items[i];
- if (cbItem.getItems().length == 0) {
- CoolItem coolItem = findCoolItem(cbItem);
- if (!useRedraw && coolItem != null) {
- int visualIndex = coolBar.indexOf(coolItem);
- if (layout.isOnRowAlone(visualIndex)) {
- useRedraw = true;
- }
- }
- cbItemsToRemove.add(cbItem);
- }
- }
-
- // remove non-visible CoolBarContributionItems
- CoolItem[] coolItems = coolBar.getItems();
- ArrayList coolItemsToRemove = new ArrayList(coolItems.length);
- for (int i = 0; i < coolItems.length; i++) {
- CoolItem coolItem = coolItems[i];
- CoolBarContributionItem cbItem = (CoolBarContributionItem) coolItem.getData();
- if ((cbItem != null) && !cbItem.isVisible() && (!cbItemsToRemove.contains(cbItem))) {
- if (!useRedraw) {
- int visualIndex = coolBar.indexOf(coolItem);
- if (layout.isOnRowAlone(visualIndex)) {
- useRedraw = true;
- }
- }
- coolItemsToRemove.add(coolItem);
- }
- }
- // set redraw off if deleting a sole item from a row to reduce jumpiness in the
- // case that an item gets added back on that row as part of the update
- if (!useRedraw && (cbItemsToRemove.size() + coolItemsToRemove.size() > 2)) {
- useRedraw = true;
- }
- if (useRedraw) coolBar.setRedraw(false);
-
- for (Iterator e = cbItemsToRemove.iterator(); e.hasNext();) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem) e.next();
- dispose(cbItem);
- }
- for (Iterator e = coolItemsToRemove.iterator(); e.hasNext();) {
- CoolItem coolItem = (CoolItem) e.next();
- ToolBar tBar = (ToolBar) coolItem.getControl();
- tBar.setVisible(false);
- dispose(coolItem);
- }
-
- // create a CoolItem for each group of items that does not have a CoolItem
- ArrayList coolItemIds = getCoolItemIds();
- items = getItems();
- boolean changed = false;
- boolean relock = false;
- for (int i = 0; i < items.length; i++) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem) items[i];
- if (!coolItemIds.contains(cbItem.getId())) {
- if (cbItem.isVisible()) {
- ToolBar toolBar = cbItem.getControl();
- if ((toolBar != null) && (!toolBar.isDisposed()) && (toolBar.getItemCount() > 0) && cbItem.hasDisplayableItems()) {
- if (!changed) {
- // workaround for 14330
- changed = true;
- if (coolBar.getLocked()) {
- coolBar.setLocked(false);
- relock = true;
- }
- }
- createCoolItem(cbItem, toolBar);
- }
- }
- }
- }
-
- setDirty(false);
-
- // workaround for 14330
- if(relock) {
- coolBar.setLocked(true);
- }
- if (useRedraw) coolBar.setRedraw(true);
- }
- }
- }
- /**
- * Recalculate and set the size for the given CoolBarContributionItem's coolitem.
- */
- /* package */ void updateSizeFor(CoolBarContributionItem cbItem) {
- CoolItem coolItem = findCoolItem(cbItem);
- if (coolItem != null) setSizeFor(coolItem);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolItemMultiToolBarManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolItemMultiToolBarManager.java
deleted file mode 100644
index 44c7ea1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolItemMultiToolBarManager.java
+++ /dev/null
@@ -1,429 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.ui.part.CoolItemGroupMarker;
-import org.eclipse.ui.IWorkbenchActionConstants;
-
-/**
- * CoolItemMultiToolBarManager class
- */
-public class CoolItemMultiToolBarManager extends CoolItemToolBarManager {
- ArrayList coolBarItems = new ArrayList();
- boolean active = false;
- String id;
- boolean coolItemsCreated = false;
-
- public void add(IAction action) {
- if (!coolItemsCreated) {
- super.add(action);
- return;
- }
- CoolBarContributionItem cbItem = ((CoolBarContributionItem) coolBarItems.get(coolBarItems.size() - 1));
- cbItem.getToolBarManager().add(action);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- }
- public void add(IContributionItem item) {
- if (!coolItemsCreated) {
- super.add(item);
- return;
- }
- CoolBarContributionItem cbItem = ((CoolBarContributionItem) coolBarItems.get(coolBarItems.size() - 1));
- cbItem.getToolBarManager().add(item);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- }
- public void appendToGroup(String groupName, IAction action) {
- if (!coolItemsCreated) {
- super.appendToGroup(groupName, action);
- return;
- }
- CoolBarContributionItem cbItem = findGroup(groupName);
- if (cbItem != null) {
- cbItem.getToolBarManager().add(action);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- } else {
- cbItem = findGroupFor(groupName);
- if (cbItem != null) {
- cbItem.getToolBarManager().appendToGroup(groupName, action);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- }
- }
-
- }
- public void appendToGroup(String groupName, IContributionItem item) {
- if (!coolItemsCreated) {
- super.appendToGroup(groupName, item);
- return;
- }
- CoolBarContributionItem cbItem = findGroup(groupName);
- if (cbItem != null) {
- cbItem.getToolBarManager().add(item);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- } else {
- cbItem = findGroupFor(groupName);
- if (cbItem != null) {
- cbItem.getToolBarManager().appendToGroup(groupName, item);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- }
- }
- }
- /**
- * NOT VALID for multiple CoolItem case
- */
- public ToolBar createControl(Composite parent) {
- if (!coolItemsCreated) {
- return super.createControl(parent);
- }
- return null;
- }
-
- /**
- * Disposes of this tool bar manager and frees all allocated SWT resources.
- * Note that this method does not clean up references between this tool bar
- * manager and its associated contribution items.
- * Use <code>removeAll</code> for that purpose.
- */
- public void dispose() {
- if (!coolItemsCreated) {
- super.dispose();
- return;
- }
- for (Iterator e = coolBarItems.iterator(); e.hasNext();) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem) e.next();
- cbItem.getToolBarManager().dispose();
- }
- super.dispose();
- }
-
- public IContributionItem find(String id) {
- if (!coolItemsCreated) {
- return super.find(id);
- }
- for (Iterator e = coolBarItems.iterator(); e.hasNext();) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem) e.next();
- IContributionItem item = cbItem.getToolBarManager().find(id);
- if (item != null) return item;
- }
- return null;
- }
-
- protected CoolBarContributionItem findGroup(String id) {
- for (Iterator e = coolBarItems.iterator(); e.hasNext();) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem) e.next();
- if (cbItem.getId().equals(id))
- return cbItem;
- }
- return null;
- }
- protected CoolBarContributionItem findGroupFor(String id) {
- for (Iterator e = coolBarItems.iterator(); e.hasNext();) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem) e.next();
- IContributionItem item = cbItem.getToolBarManager().find(id);
- if (item != null)
- return cbItem;
- }
- return null;
- }
- /**
- * NOT VALID for multiple CoolItem case
- */
- public ToolBar getControl() {
- if (!coolItemsCreated) {
- return super.getControl();
- }
- return null;
- }
-
- public void prependToGroup(String groupName, IAction action) {
- if (!coolItemsCreated) {
- super.prependToGroup(groupName, action);
- return;
- }
- CoolBarContributionItem cbItem = findGroup(groupName);
- if (cbItem != null) {
- cbItem.getToolBarManager().prependToGroup(groupName, action);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- } else {
- cbItem = findGroupFor(groupName);
- if (cbItem != null) {
- cbItem.getToolBarManager().prependToGroup(groupName, action);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- }
- }
- }
- public void prependToGroup(String groupName, IContributionItem item) {
- if (!coolItemsCreated) {
- super.prependToGroup(groupName, item);
- return;
- }
- CoolBarContributionItem cbItem = findGroup(groupName);
- if (cbItem != null) {
- cbItem.getToolBarManager().prependToGroup(groupName, item);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- } else {
- cbItem = findGroupFor(groupName);
- if (cbItem != null) {
- cbItem.getToolBarManager().prependToGroup(groupName, item);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- }
- }
- }
-
-
- public void update(boolean force) {
- if (!coolItemsCreated) {
- super.update(force);
- return;
- }
- for (Iterator e = coolBarItems.iterator(); e.hasNext();) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem) e.next();
- cbItem.getToolBarManager().update(force);
- }
- getParentManager().update(force);
- }
-
- public CoolItemMultiToolBarManager(CoolBarManager parentManager, String id, boolean active) {
- super(parentManager.getStyle());
- this.parentManager = parentManager;
- this.active = active;
- this.id = id;
- }
- public void createCoolBarContributionItems() {
- if (!isCoolItemGrouped()) {
- // Don't create groups.
- this.add(new GroupMarker(IWorkbenchActionConstants.GROUP_EDITOR));
- CoolBarContributionItem coolBarItem = new CoolBarContributionItem(parentManager, this, id);
- parentManager.add(coolBarItem);
- this.setVisible(active);
- return;
- }
- ArrayList groupedItems = getGroups();
- if (groupedItems.size() > 0) {
- coolItemsCreated = true;
- }
- for (Iterator groupIter = groupedItems.iterator(); groupIter.hasNext();) {
- ArrayList items = (ArrayList) groupIter.next();
- if (!items.isEmpty()) {
- String groupId = ((IContributionItem) items.get(0)).getId();
- CoolItemToolBarManager tBarMgr = createGroup(groupId);
- for (Iterator itemIter = items.iterator(); itemIter.hasNext();) {
- tBarMgr.add((IContributionItem) itemIter.next());
- }
- }
- }
- }
- protected CoolItemToolBarManager createGroup(String groupId) {
- CoolItemToolBarManager tBarMgr = new CoolItemToolBarManager(parentManager.getStyle());
- tBarMgr.setOverrides(getOverrides());
- CoolBarContributionItem coolBarItem = new CoolBarContributionItem(parentManager, tBarMgr, groupId);
- parentManager.add(coolBarItem);
- coolBarItems.add(coolBarItem);
- coolBarItem.setVisible(active);
- return tBarMgr;
- }
- /**
- * NOT VALID for multiple CoolItem case
- */
- protected CoolBarContributionItem getCoolBarItem() {
- if (!coolItemsCreated) {
- return super.getCoolBarItem();
- }
- return null;
- }
- public IContributionItem[] getItems() {
- if (!coolItemsCreated) {
- return super.getItems();
- }
- ArrayList allItems = new ArrayList();
- for (Iterator e = coolBarItems.iterator(); e.hasNext();) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem) e.next();
- IContributionItem[] items = cbItem.getToolBarManager().getItems();
- for (int i=0; i<items.length; i++) {
- allItems.add(items[i]);
- }
- }
- IContributionItem[] items = new IContributionItem[allItems.size()];
- allItems.toArray(items);
- return items;
- }
- protected boolean hasDynamicItems() {
- if (!coolItemsCreated) {
- return super.hasDynamicItems();
- }
- return false;
- }
- protected ArrayList getGroups() {
- ArrayList groups = new ArrayList();
- IContributionItem[] items = getItems();
- if (items.length == 0)
- return groups;
- ArrayList group = new ArrayList();
- IContributionItem firstItem = items[0];
- int start = 0;
- if (isCoolItemMarker(firstItem)) {
- group.add(firstItem);
- start = 1;
- } else {
- group.add(new CoolItemGroupMarker(id));
- }
-
- for (int i = start; i < items.length; i++) {
- IContributionItem item = items[i];
- if (isCoolItemMarker(item)) {
- groups.add(group);
- group = new ArrayList();
- group.add(item);
- } else {
- group.add(item);
- }
- }
- groups.add(group);
- return groups;
- }
-
- public void insertAfter(String ID, IAction action) {
- if (!coolItemsCreated) {
- super.insertAfter(ID, action);
- return;
- }
- CoolBarContributionItem cbItem = findGroupFor(ID);
- if (cbItem != null) {
- cbItem.getToolBarManager().insertAfter(ID, action);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- }
- }
- public void insertAfter(String ID, IContributionItem item) {
- if (!coolItemsCreated) {
- super.insertAfter(ID, item);
- return;
- }
- CoolBarContributionItem cbItem = findGroupFor(ID);
- if (cbItem != null) {
- cbItem.getToolBarManager().insertAfter(ID, item);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- }
- }
- public void insertBefore(String ID, IAction action) {
- if (!coolItemsCreated) {
- super.insertBefore(ID, action);
- return;
- }
- CoolBarContributionItem cbItem = findGroupFor(ID);
- if (cbItem != null) {
- cbItem.getToolBarManager().insertBefore(ID, action);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- }
- }
- public void insertBefore(String ID, IContributionItem item) {
- if (!coolItemsCreated) {
- super.insertBefore(ID, item);
- return;
- }
- CoolBarContributionItem cbItem = findGroupFor(ID);
- if (cbItem != null) {
- cbItem.getToolBarManager().insertBefore(ID, item);
- if (cbItem.hasDisplayableItems()) setVisible(true);
- }
- }
- public boolean isDirty() {
- if (!coolItemsCreated) {
- return super.isDirty();
- }
- for (Iterator e = coolBarItems.iterator(); e.hasNext();) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem) e.next();
- if (cbItem.getToolBarManager().isDirty())
- return true;
- }
- return super.isDirty();
- }
- protected boolean isCoolItemMarker(IContributionItem item) {
- return item instanceof CoolItemGroupMarker;
- }
- protected boolean isCoolItemGrouped() {
- IContributionItem[] items = getItems();
- for (int i=0; i<items.length; i++) {
- IContributionItem item = items[i];
- if (isCoolItemMarker(item)) return true;
- }
- return false;
- }
-
-
-public IContributionItem remove(IContributionItem item) {
- if (!coolItemsCreated) {
- return super.remove(item);
- }
- CoolBarContributionItem cbItem = findGroupFor(item.getId());
- if (cbItem != null) {
- IContributionItem removed = cbItem.getToolBarManager().remove(item);
- if (!cbItem.hasDisplayableItems()) cbItem.setVisible(false);
- return removed;
- }
- return null;
-}
-
- public IContributionItem remove(String ID) {
- if (!coolItemsCreated) {
- return super.remove(ID);
- }
- CoolBarContributionItem cbItem = findGroupFor(ID);
- if (cbItem != null) {
- IContributionItem removed = cbItem.getToolBarManager().remove(ID);
- if (!cbItem.hasDisplayableItems()) cbItem.setVisible(false);
- return removed;
- }
- return null;
- }
- public void removeAll() {
- if (!coolItemsCreated) {
- super.removeAll();
- return;
- }
- for (Iterator e = coolBarItems.iterator(); e.hasNext();) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem) e.next();
- cbItem.getToolBarManager().removeAll();
- }
- coolBarItems.clear();
- setDirty(true);
- }
-
- /**
- * NOT VALID for multiple CoolItem case
- */
- protected void setCoolBarItem(CoolBarContributionItem coolBarItem) {
- if (!coolItemsCreated) {
- super.setCoolBarItem(coolBarItem);
- }
- }
- protected void setVisible(boolean set) {
- super.setVisible(set);
- if (!coolItemsCreated) {
- return;
- }
- for (Iterator e = coolBarItems.iterator(); e.hasNext();) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem) e.next();
- cbItem.setVisible(set);
- }
- }
- protected void setVisible(boolean set, boolean forceVisibility) {
- super.setVisible(set, forceVisibility);
- if (!coolItemsCreated) {
- return;
- }
- for (Iterator e = coolBarItems.iterator(); e.hasNext();) {
- CoolBarContributionItem cbItem = (CoolBarContributionItem) e.next();
- cbItem.setVisible(set, forceVisibility);
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolItemPosition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolItemPosition.java
deleted file mode 100644
index 211989a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolItemPosition.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.ui.internal;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import org.eclipse.swt.graphics.Point;
-
-/**
- * Class for remembering information about the position of a removed cool item.
- */
-public class CoolItemPosition {
-
- boolean added = false; // indicates whether or not the item has been added back
-
- String id; // id of the cool bar contribution item associated to the removed cool item
-
- CoolBarLayout layout; // the coolbar layout before the item is removed
-
- CoolItemPosition() {
- }
- CoolItemPosition(String id, CoolBarLayout layout) {
- this.id = id;
- this.layout = layout;
- }
- /**
- * Return the items on the saved layout, an ArrayList of Strings (i.e., CoolBarContributionItem ids).
- */
- ArrayList getItems() {
- return layout.items;
- }
- /**
- * Return the row index for cbItemId. The saved layout will be looked at and the index
- * will be relative to this layout.
- */
- int getRowOf(String cbItemId) {
- int index = layout.items.indexOf(cbItemId);
- if (index == -1)
- return -1;
- return layout.getRowOfIndex(index);
- }
- /**
- * Return the CoolItem size for the CoolBarContributionItem with an id of cbItemId.
- */
- Point getSizeOf(String cbItemId) {
- int index = layout.items.indexOf(cbItemId);
- if (index == -1)
- return null;
- return layout.itemSizes[index];
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolItemToolBarManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolItemToolBarManager.java
deleted file mode 100644
index 2bdedae..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CoolItemToolBarManager.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.*;
-
-/**
- * CoolItemToolBarManager class
- */
-public class CoolItemToolBarManager extends ToolBarManager {
- CoolBarManager parentManager;
- CoolBarContributionItem coolBarItem;
-
- public CoolItemToolBarManager(int style) {
- super(style);
- }
- public ToolBar createControl(Composite parent) {
- ToolBar tBar = super.createControl(parent);
- // add support for popup menu, must hook the mouse
- // down event for each toolbar on the coolbar
- tBar.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- parentManager.popupCoolBarMenu(e);
- }
- });
- return tBar;
- }
- protected CoolBarContributionItem getCoolBarItem() {
- return coolBarItem;
- }
- protected CoolBarManager getParentManager() {
- return parentManager;
- }
- protected void itemAdded(IContributionItem item) {
- super.itemAdded(item);
- update(true);
- parentManager.updateSizeFor(coolBarItem);
- }
- protected void itemRemoved(IContributionItem item) {
- super.itemRemoved(item);
- update(true);
- parentManager.updateSizeFor(coolBarItem);
- }
- protected void relayout(ToolBar toolBar, int oldCount, int newCount) {
- if (oldCount == newCount) return;
- CoolBar coolBar = (CoolBar)toolBar.getParent();
- CoolItem[] coolItems = coolBar.getItems();
- CoolItem coolItem = null;
- for (int i = 0; i < coolItems.length; i++) {
- CoolItem item = coolItems[i];
- if (item.getControl() == toolBar) {
- coolItem = item;
- break;
- }
- }
- // recompute preferred size so chevron will work correctly when
- // items are added/removed from the toolbar, don't set the size of
- // the coolItem since that would affect the position of other
- // coolItems on the toolbar
- if (coolItem != null) {
- Point size = toolBar.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- Point coolSize = coolItem.computeSize (size.x, size.y);
- coolItem.setPreferredSize(coolSize);
- }
- coolBar.layout();
- }
- protected void setCoolBarItem(CoolBarContributionItem coolBarItem) {
- this.coolBarItem = coolBarItem;
- }
- protected void setParentMgr(CoolBarManager parentManager) {
- this.parentManager = parentManager;
- }
-
- protected void setVisible(boolean set) {
- if (coolBarItem != null) {
- coolBarItem.setVisible(set);
- }
- }
- protected void setVisible(boolean set, boolean forceVisibility) {
- if (coolBarItem != null) {
- coolBarItem.setVisible(set, forceVisibility);
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleEditorAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleEditorAction.java
deleted file mode 100644
index 693e3d5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CycleEditorAction.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This is the abstract superclass for NextEditorAction and PrevEditorAction.
- */
-public class CycleEditorAction extends CyclePartAction {
-
-/**
- * Creates a CycleEditorAction.
- */
-protected CycleEditorAction(IWorkbenchWindow window, boolean forward) {
- super(window,forward); //$NON-NLS-1$
- window.getPartService().addPartListener(this);
- updateState();
-}
-
-protected void setText() {
- // TBD: Remove text and tooltip when this becomes an invisible action.
- if (forward) {
- setText(WorkbenchMessages.getString("CycleEditorAction.next.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("CycleEditorAction.next.toolTip")); //$NON-NLS-1$
- setAccelerator(SWT.CTRL | SWT.F6);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CYCLE_EDITOR_FORWARD_ACTION);
- }
- else {
- setText(WorkbenchMessages.getString("CycleEditorAction.prev.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("CycleEditorAction.prev.toolTip")); //$NON-NLS-1$
- setAccelerator(SWT.CTRL | SWT.SHIFT | SWT.F6);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CYCLE_EDITOR_BACKWARD_ACTION);
- }
-}
-
-/**
- * Updates the enabled state.
- */
-public void updateState() {
- WorkbenchPage page = (WorkbenchPage)getActivePage();
- if (page == null) {
- setEnabled(false);
- return;
- }
- // enable iff there is at least one other editor to switch to
- setEnabled(page.getSortedEditors().length >= 1);
-}
-
-/**
- * Add all views to the dialog in the activation order
- */
-protected void addItems(Table table,WorkbenchPage page) {
- IEditorReference refs[] = page.getSortedEditors();
- for (int i = refs.length - 1; i >= 0 ; i--) {
- TableItem item = null;
- item = new TableItem(table,SWT.NONE);
- if(refs[i].isDirty())
- item.setText("*" + refs[i].getName()); //$NON-NLS-1$
- else
- item.setText(refs[i].getName());
- item.setImage(refs[i].getTitleImage());
- item.setData(refs[i]);
- }
-}
-/**
- * Returns the string which will be shown in the table header.
- */
-protected String getTableHeader() {
- return WorkbenchMessages.getString("CycleEditorAction.header"); //$NON-NLS-1$
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CyclePartAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CyclePartAction.java
deleted file mode 100644
index 97077bb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CyclePartAction.java
+++ /dev/null
@@ -1,313 +0,0 @@
-package org.eclipse.ui.internal;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Implements a action to enable the user switch between parts
- * using keyboard.
- */
-public class CyclePartAction extends PageEventAction {
- boolean forward;
- private Object selection;
-
-/**
- * Creates a CyclePartAction.
- */
-protected CyclePartAction(IWorkbenchWindow window, boolean forward) {
- super("", window); //$NON-NLS-1$
- this.forward = forward;
- setText();
- window.getPartService().addPartListener(this);
- updateState();
-}
-/**
- * Set text and tooltips in the action.
- */
-protected void setText() {
- // TBD: Remove text and tooltip when this becomes an invisible action.
- if (forward) {
- setText(WorkbenchMessages.getString("CyclePartAction.next.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("CyclePartAction.next.toolTip")); //$NON-NLS-1$
- setAccelerator(SWT.CTRL | SWT.F7);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CYCLE_PART_FORWARD_ACTION);
- } else {
- setText(WorkbenchMessages.getString("CyclePartAction.prev.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("CyclePartAction.prev.toolTip")); //$NON-NLS-1$
- setAccelerator(SWT.CTRL | SWT.SHIFT | SWT.F7);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CYCLE_PART_BACKWARD_ACTION);
- }
-}
-/**
- * See IPageListener
- */
-public void pageActivated(IWorkbenchPage page) {
- super.pageActivated(page);
- updateState();
-}
-/**
- * See IPageListener
- */
-public void pageClosed(IWorkbenchPage page) {
- super.pageClosed(page);
- updateState();
-}
-/**
- * See IPartListener
- */
-public void partOpened(IWorkbenchPart part) {
- super.partOpened(part);
- updateState();
-}
-/**
- * See IPartListener
- */
-public void partClosed(IWorkbenchPart part) {
- super.partClosed(part);
- updateState();
-}
-/**
- * Dispose the resources cached by this action.
- */
-protected void dispose() {
-}
-/**
- * Updates the enabled state.
- */
-protected void updateState() {
- WorkbenchPage page = (WorkbenchPage)getActivePage();
- if (page == null) {
- setEnabled(false);
- return;
- }
- // enable iff there is at least one other part to switch to
- // (the editor area counts as one entry)
- int count = page.getViewReferences().length;
- if (page.getSortedEditors().length > 0) {
- ++count;
- }
- setEnabled(count >= 1);
-}
-/**
- * @see Action#run()
- */
-public void run() {
- boolean direction = forward;
- try {
- IWorkbenchPage page = getActivePage();
- openDialog((WorkbenchPage)page);
- activate(page,selection);
- } finally {
- forward = direction;
- }
-}
-/**
- * Activate the selected item.
- */
-public void activate(IWorkbenchPage page,Object selection) {
- if(selection != null) {
- if (selection instanceof IEditorReference) {
- page.setEditorAreaVisible(true);
- }
- page.activate(((IWorkbenchPartReference)selection).getPart(true));
- }
-}
-/*
- * Open a dialog showing all views in the activation order
- */
-private void openDialog(WorkbenchPage page) {
- selection = null;
- final Shell dialog = new Shell(getWorkbenchWindow().getShell(),SWT.MODELESS);
- Display display = dialog.getDisplay();
- dialog.setLayout(new FillLayout());
-
- final Table table = new Table(dialog,SWT.SINGLE | SWT.FULL_SELECTION);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
- TableColumn tc = new TableColumn(table,SWT.NONE);
- tc.setResizable(false);
- tc.setText(getTableHeader());
- addItems(table,page);
- switch (table.getItemCount()) {
- case 0:
- // do nothing;
- break;
- case 1:
- table.setSelection(0);
- break;
- default:
- if(forward)
- table.setSelection(1);
- else
- table.setSelection(table.getItemCount() - 1);
- }
- tc.pack();
- table.pack();
- dialog.pack();
-
- tc.setWidth(table.getClientArea().width);
- table.setFocus();
- table.addFocusListener(new FocusListener() {
- public void focusGained(FocusEvent e){}
- public void focusLost(FocusEvent e) {
- cancel(dialog);
- }
- });
-
- Rectangle dialogBounds = dialog.getBounds();
- Rectangle displayBounds = display.getClientArea();
- dialogBounds.x = (displayBounds.width - dialogBounds.width) / 2;
- dialogBounds.y = (displayBounds.height - dialogBounds.height) / 2;
- dialogBounds.height = dialogBounds.height + 3 - table.getHorizontalBar().getSize().y;
-
- dialog.setBounds(dialogBounds);
-
- table.removeHelpListener(getHelpListener());
- table.addHelpListener(new HelpListener() {
- public void helpRequested(HelpEvent event) {
- }
- });
-
- addMouseListener(table,dialog);
- addKeyListener(table,dialog);
-
- try {
- dialog.open();
- while (!dialog.isDisposed()) {
- if (!display.readAndDispatch())
- display.sleep();
- }
- } finally {
- if(!dialog.isDisposed()) {
- cancel(dialog);
- }
- }
-}
-/**
- * Returns the string which will be shown in the table header.
- */
-protected String getTableHeader() {
- return WorkbenchMessages.getString("CyclePartAction.header"); //$NON-NLS-1$
-}
-/**
- * Add all views to the dialog in the activation order
- */
-protected void addItems(Table table,WorkbenchPage page) {
- IWorkbenchPartReference refs[] = page.getSortedParts();
- boolean includeEditor = true;
- for (int i = refs.length - 1; i >= 0 ; i--) {
- if(refs[i] instanceof IEditorReference) {
- if(includeEditor) {
- IEditorReference activeEditor = (IEditorReference)refs[i];
- TableItem item = new TableItem(table,SWT.NONE);
- item.setText(WorkbenchMessages.getString("CyclePartAction.editor")); //$NON-NLS-1$
- item.setImage(activeEditor.getTitleImage());
- item.setData(activeEditor);
- includeEditor = false;
- }
- } else {
- TableItem item = new TableItem(table,SWT.NONE);
- item.setText(refs[i].getTitle());
- item.setImage(refs[i].getTitleImage());
- item.setData(refs[i]);
- }
- }
-}
-/*
- * Add a key listener to the table shifting the selection when
- * the acelarator key is pressed and closing the dialog when
- * Control or Alt is released.
- */
-private void addKeyListener(final Table table,final Shell dialog) {
- table.addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent e) {
- int acelaratorKey = getAcceleratorKey();
- if((e.character == SWT.CR) || (e.character == SWT.LF)) {
- ok(dialog,table);
- } else if(e.keyCode == SWT.SHIFT) {
- forward = false;
- } else if(e.keyCode == acelaratorKey) {
- int index = table.getSelectionIndex();
- if(forward) {
- index = (index + 1) % table.getItemCount();
- } else {
- index--;
- index = index >= 0 ? index : table.getItemCount() - 1;
- }
- table.setSelection(index);
- } else if ((e.keyCode == SWT.ARROW_DOWN) ||
- (e.keyCode == SWT.ARROW_UP) ||
- (e.keyCode == SWT.ARROW_LEFT) ||
- (e.keyCode == SWT.ARROW_RIGHT)) {
- //Do nothing.
- } else {
- cancel(dialog);
- }
- }
- public void keyReleased(KeyEvent e) {
- if(e.keyCode == SWT.SHIFT) {
- forward = true;
- } else if((e.keyCode == SWT.ALT) || (e.keyCode == SWT.CTRL)) {
- ok(dialog, table);
- }
- }
- });
-}
-/*
- * Close the dialog saving the selection
- */
-private void ok(Shell dialog, final Table table) {
- TableItem[] items = table.getSelection();
- if (items != null && items.length == 1)
- selection = items[0].getData();
- dialog.close();
- dispose();
-}
-/*
- * Close the dialog and set selection to null.
- */
-private void cancel(Shell dialog) {
- selection = null;
- dialog.close();
- dispose();
-}
-/*
- * Add mouse listener to the table closing it when
- * the mouse is pressed.
- */
-private void addMouseListener(final Table table,final Shell dialog) {
- table.addMouseListener(new MouseListener() {
- public void mouseDoubleClick(MouseEvent e){
- ok(dialog,table);
- }
- public void mouseDown(MouseEvent e){
- ok(dialog,table);
- }
- public void mouseUp(MouseEvent e){
- ok(dialog,table);
- }
- });
-}
-/*
- * If the acelarator is CTRL+ALT+SHIFT+F6
- * or any combination of CTRL ALT SHIFT
- * return F6
- */
-private int getAcceleratorKey() {
- int acelaratorKey = getAccelerator();
- acelaratorKey = acelaratorKey & ~ SWT.CTRL;
- acelaratorKey = acelaratorKey & ~ SWT.SHIFT;
- acelaratorKey = acelaratorKey & ~ SWT.ALT;
- return acelaratorKey;
-}
-}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CyclePerspectiveAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CyclePerspectiveAction.java
deleted file mode 100644
index 69a7bec..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/CyclePerspectiveAction.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.eclipse.ui.internal;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.dialogs.PerspLabelProvider;
-/**
- * Implements a action to enable the user switch between perspectives
- * using keyboard.
- */
-public class CyclePerspectiveAction extends CyclePartAction {
- private PerspLabelProvider labelProvider = new PerspLabelProvider(false);;
-/**
- * Creates a CyclePerspectiveAction.
- */
-protected CyclePerspectiveAction(IWorkbenchWindow window, boolean forward) {
- super(window,forward); //$NON-NLS-1$
- window.addPerspectiveListener(new IPerspectiveListener() {
- public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- updateState();
- }
- public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {}
- });
- updateState();
-}
-
-protected void setText() {
- // TBD: Remove text and tooltip when this becomes an invisible action.
- if (forward) {
- setText(WorkbenchMessages.getString("CyclePerspectiveAction.next.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("CyclePerspectiveAction.next.toolTip")); //$NON-NLS-1$
- setAccelerator(SWT.CTRL | SWT.F8);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CYCLE_PERSPECTIVE_FORWARD_ACTION);
- }
- else {
- setText(WorkbenchMessages.getString("CyclePerspectiveAction.prev.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("CyclePerspectiveAction.prev.toolTip")); //$NON-NLS-1$
- setAccelerator(SWT.CTRL | SWT.SHIFT | SWT.F8);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CYCLE_PERSPECTIVE_BACKWARD_ACTION);
- }
-}
-/**
- * Dispose the resources cached by this action.
- */
-protected void dispose() {
- labelProvider.dispose();
-}
-/**
- * Activate the selected item.
- */
-public void activate(IWorkbenchPage page, Object selection) {
- if (selection != null) {
- IPerspectiveDescriptor persp = (IPerspectiveDescriptor)selection;
- page.setPerspective(persp);
- }
-}
-/**
- * Updates the enabled state.
- */
-public void updateState() {
- WorkbenchPage page = (WorkbenchPage) getActivePage();
- if (page == null) {
- setEnabled(false);
- return;
- }
- // enable iff there is at least one other editor to switch to
- setEnabled(page.getSortedPerspectives().length >= 1);
-}
-
-/**
- * Add all views to the dialog in the activation order
- */
-protected void addItems(Table table,WorkbenchPage page) {
- IPerspectiveDescriptor perspectives[] = page.getSortedPerspectives();
- for (int i = perspectives.length - 1; i >= 0 ; i--) {
- TableItem item = new TableItem(table,SWT.NONE);
- IPerspectiveDescriptor desc = perspectives[i];
- item.setText(labelProvider.getText(desc));
- item.setImage(labelProvider.getImage(desc));
- item.setData(desc);
- }
-}
-/**
- * Returns the string which will be shown in the table header.
- */
-protected String getTableHeader() {
- return WorkbenchMessages.getString("CyclePerspectiveAction.header"); //$NON-NLS-1$
-}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DecoratorDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DecoratorDefinition.java
deleted file mode 100644
index f097ad8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DecoratorDefinition.java
+++ /dev/null
@@ -1,312 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.internal.registry.WizardsRegistryReader;
-
-/**
- * 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 class DecoratorDefinition {
-
- private String name;
- private String objectClass;
- private String description;
- private ILabelDecorator decorator;
- private boolean adaptable;
- private boolean enabled;
- private boolean defaultEnabled;
-
- //A flag that is set if there is an error creating the decorator
- private boolean decoratorCreationFailed = false;
- private String id;
- private IConfigurationElement element;
-
- /**
- * Create a new instance of the receiver with the
- * supplied values.
- */
-
- DecoratorDefinition(
- String identifier,
- String label,
- String decoratorDescription,
- String className,
- boolean isAdaptable,
- boolean initEnabled,
- IConfigurationElement configElement) {
- this.id = identifier;
- this.name = label;
- this.objectClass = className;
- this.adaptable = isAdaptable;
- this.element = configElement;
- this.description = decoratorDescription;
- this.enabled = initEnabled;
- this.defaultEnabled = initEnabled;
- }
-
- /**
- * Gets the name.
- * @return Returns a String
- */
- public String getName() {
- return name;
- }
-
- /**
- * Returns the description.
- * @return String
- */
- public String getDescription(){
- return this.description;
- }
-
- /**
- * Gets the objectClass.
- * @return Returns a String
- */
- public String getObjectClass() {
- return objectClass;
- }
-
- /**
- * 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
- */
- private ILabelDecorator internalGetDecorator() throws CoreException {
- if (decoratorCreationFailed)
- return null;
-
- final CoreException[] exceptions = new CoreException[1];
-
- if (decorator == null) {
- Platform.run(new SafeRunnable(WorkbenchMessages.format("DecoratorManager.ErrorActivatingDecorator", new String[] { getName()})) { //$NON-NLS-1$
- public void run() {
- try {
- decorator =
- (ILabelDecorator) WorkbenchPlugin.createExtension(
- element,
- WizardsRegistryReader.ATT_CLASS);
- } catch (CoreException exception) {
- exceptions[0] = exception;
- }
- }
- });
- }
-
- if (decorator == null) {
- this.decoratorCreationFailed = true;
- this.enabled = false;
- }
-
- if (exceptions[0] != null)
- throw exceptions[0];
-
- return decorator;
- }
-
- /**
- * 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 enabled The enabled to set
- */
- public void setEnabled(boolean newState) throws CoreException {
-
- //Only refresh if there has been a change
- if (this.enabled != newState) {
- this.enabled = newState;
- refreshDecorator();
- }
- }
-
- /**
- * Sets the enabled flag and adds or removes the decorator
- * manager as a listener as appropriate. Handle any exceptions
- * within this class
- * @param enabled The enabled to set
- */
- public void setEnabledWithErrorHandling(boolean newState) {
-
- try {
- setEnabled(newState);
- } catch (CoreException exception) {
- handleCoreException(exception);
- }
- }
-
- /**
- * Refresh the current decorator based on our enable
- * state.
- */
-
- private void refreshDecorator() throws CoreException {
- DecoratorManager manager =
- (DecoratorManager) WorkbenchPlugin
- .getDefault()
- .getDecoratorManager();
-
- if (this.enabled) {
- //Internal decorator might be null so be prepared
- ILabelDecorator currentDecorator = internalGetDecorator();
- if (currentDecorator != null)
- currentDecorator.addListener(manager);
- } else {
- if (decorator != null) {
- ILabelDecorator cached = decorator;
- cached.removeListener(manager);
- //Clear the decorator before disposing
- decorator = null;
- cached.dispose();
- }
- }
-
- }
-
- /**
- * Return whether or not this decorator should be
- * applied to adapted types.
- */
-
- public boolean isAdaptable() {
- return adaptable;
- }
- /**
- * Gets the id.
- * @return Returns a String
- */
- public String getId() {
- return id;
- }
-
- /**
- * A CoreException has occured. Inform the user and disable
- * the receiver.
- */
-
- private void handleCoreException(CoreException exception) {
-
- //If there is an error then reset the enabling to false
- ErrorDialog.openError(
- null,
- WorkbenchMessages.getString("Internal_error"), //$NON-NLS-1$
- exception.getLocalizedMessage(),
- exception.getStatus());
- this.enabled = false;
- }
-
- /**
- * 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)
- return currentDecorator.decorateText(text, element);
- } catch (CoreException exception) {
- handleCoreException(exception);
- }
- return 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
- ILabelDecorator currentDecorator = internalGetDecorator();
- 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
- ILabelDecorator currentDecorator = internalGetDecorator();
- if (currentDecorator != null)
- return currentDecorator.isLabelProperty(element, property);
- } catch (CoreException exception) {
- handleCoreException(exception);
- return false;
- }
- return false;
- }
-
- /**
- * Return the default value for this type - this value
- * is the value read from the element description.
- */
- public boolean getDefaultValue(){
- return defaultEnabled;
- }
-
- /**
- * Gets the decorator.
- * @return Returns a ILabelDecorator
- * @throws CoreException. This will be removed and is only
- * here for backwards compatability.
- */
- public ILabelDecorator getDecorator() throws CoreException{
- return decorator;
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DecoratorManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DecoratorManager.java
deleted file mode 100644
index ed5adb9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DecoratorManager.java
+++ /dev/null
@@ -1,508 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IContributorResourceAdapter;
-import org.eclipse.ui.IDecoratorManager;
-
-/**
- * The DecoratorManager is the class that handles all of the
- * decorators defined in the image.
- *
- * @since 2.0
- */
-public class DecoratorManager
- implements
- ILabelDecorator,
- ILabelProviderListener,
- IDecoratorManager {
-
- //Hold onto the list of listeners to be told if a change has occured
- private HashSet listeners = new HashSet();
-
- //The cachedDecorators are a 1-many mapping of type to decorator.
- private HashMap cachedDecorators = new HashMap();
-
- //The definitions are definitions read from the registry
- private DecoratorDefinition[] definitions;
-
- private static final DecoratorDefinition[] EMPTY_DEF =
- new DecoratorDefinition[0];
-
- private final String PREFERENCE_SEPARATOR = ","; //$NON-NLS-1$
- private final String VALUE_SEPARATOR = ":"; //$NON-NLS-1$
- private final String P_TRUE = "true"; //$NON-NLS-1$
- private final String P_FALSE = "false"; //$NON-NLS-1$
-
- /**
- * Create a new instance of the receiver and load the
- * settings from the installed plug-ins.
- */
- public DecoratorManager() {
- DecoratorRegistryReader reader = new DecoratorRegistryReader();
- Collection values = reader.readRegistry(Platform.getPluginRegistry());
- definitions = new DecoratorDefinition[values.size()];
- values.toArray(definitions);
- }
-
- /**
- * Restore the stored values from the preference
- * store and register the receiver as a listener
- * for all of the enabled decorators.
- */
-
- public void restoreListeners() {
- applyDecoratorsPreference();
- for (int i = 0; i < definitions.length; i++) {
- //Add a listener if it is an enabled option
- if (definitions[i].isEnabled())
- definitions[i].addListener(this);
- }
- }
-
- /**
- * Add the listener to the list of listeners.
- */
- public void addListener(ILabelProviderListener listener) {
- listeners.add(listener);
- }
-
- /**
- * Remove the listener from the list.
- */
- public void removeListener(ILabelProviderListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Inform all of the listeners that require an update
- */
- private void fireListeners(LabelProviderChangedEvent event) {
- Iterator iterator = listeners.iterator();
- while (iterator.hasNext()) {
- ILabelProviderListener listener = (ILabelProviderListener) iterator.next();
- listener.labelProviderChanged(event);
- }
- }
-
- /**
- * Decorate the image provided for the element type.
- * Then look for an IResource that adapts to it an apply
- * all of the adaptable decorators.
- * @return String or null if there are none defined for this type.
- * @param Image
- * @param Object
- */
- public String decorateText(String text, Object element) {
-
- DecoratorDefinition[] decorators = getDecoratorsFor(element);
- String result = text;
- for (int i = 0; i < decorators.length; i++) {
- String newResult = decorators[i].decorateText(result, element);
- if (newResult != null)
- result = newResult;
- }
-
- //Get any adaptions to IResource
- Object adapted = getResourceAdapter(element);
- if (adapted != null){
- DecoratorDefinition[] adaptedDecorators = getDecoratorsFor(adapted);
- for (int i = 0; i < adaptedDecorators.length; i++) {
- if(adaptedDecorators[i].isAdaptable()){
- String newResult = adaptedDecorators[i].decorateText(result, adapted);
- if (newResult != null)
- result = newResult;
- }
- }
- }
-
- return result;
- }
-
- /**
- * Decorate the image provided for the element type.
- * Then look for an IResource that adapts to it an apply
- * all of the adaptable decorators.
- * @return Image or null if there are none defined for this type.
- * @param Image
- * @param Object
- */
- public Image decorateImage(Image image, Object element) {
-
- DecoratorDefinition[] decorators = getDecoratorsFor(element);
- Image result = image;
- for (int i = 0; i < decorators.length; i++) {
- Image newResult = decorators[i].decorateImage(result, element);
- if (newResult != null)
- result = newResult;
- }
-
- //Get any adaptions to IResource
- Object adapted = getResourceAdapter(element);
- if (adapted != null){
- DecoratorDefinition[] adaptedDecorators = getDecoratorsFor(adapted);
- for (int i = 0; i < adaptedDecorators.length; i++) {
- if(adaptedDecorators[i].isAdaptable()){
- Image newResult = adaptedDecorators[i].decorateImage(result, adapted);
- if (newResult != null)
- result = newResult;
- }
- }
- }
-
- return result;
- }
-
- /**
- * Get the resource adapted object for the supplied
- * element. Return null if there isn't one.
- */
- private Object getResourceAdapter(Object element) {
-
- //Get any adaptions to IResource
- if (element instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable) element;
- Object resourceAdapter =
- adaptable.getAdapter(IContributorResourceAdapter.class);
- if (resourceAdapter == null)
- resourceAdapter = DefaultContributorResourceAdapter.getDefault();
-
- Object adapted =
- ((IContributorResourceAdapter) resourceAdapter).getAdaptedResource(adaptable);
- if (adapted != element)
- return adapted; //Avoid applying decorator twice
- }
- return null;
- }
-
- /**
- * Get the decoratordefinitionss registered for elements of this type.
- * If there is one return it. If not search for one first
- * via superclasses and then via interfaces.
- * If still nothing is found then add in a decorator that
- * does nothing.
- */
- private DecoratorDefinition[] getDecoratorsFor(Object element) {
-
- if (element == null)
- return EMPTY_DEF;
-
- Class elementClass = element.getClass();
- String className = elementClass.getName();
- DecoratorDefinition[] decoratorArray =
- (DecoratorDefinition[]) cachedDecorators.get(className);
- if (decoratorArray != null) {
- return decoratorArray;
- }
-
- List allClasses = computeClassOrder(elementClass);
- ArrayList decorators = new ArrayList();
- DecoratorDefinition[] enabledDefinitions = enabledDefinitions();
-
- findDecorators(allClasses, enabledDefinitions, decorators);
-
- findDecorators(
- computeInterfaceOrder(allClasses),
- enabledDefinitions,
- decorators);
-
- decoratorArray = new DecoratorDefinition[decorators.size()];
- decorators.toArray(decoratorArray);
- cachedDecorators.put(element.getClass().getName(), decoratorArray);
- return decoratorArray;
- }
-
- /**
- * Find a defined decorators that have a type that is the same
- * as one of the classes.
- */
- private void findDecorators(
- Collection classList,
- DecoratorDefinition[] enabledDefinitions,
- ArrayList result) {
-
- Iterator classes = classList.iterator();
- while (classes.hasNext()) {
- String className = ((Class) classes.next()).getName();
- for (int i = 0; i < enabledDefinitions.length; i++) {
- if (className.equals(enabledDefinitions[i].getObjectClass()))
- result.add(enabledDefinitions[i]);
- }
- }
-
- }
-
- /**
- * Return whether or not the decorator registered for element
- * has a label property called property name.
- */
- public boolean isLabelProperty(Object element, String property) {
- return isLabelProperty(element, property, true);
- }
-
- /**
- * 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.
- */
- public boolean isLabelProperty(
- Object element,
- String property,
- boolean checkAdapted) {
- DecoratorDefinition[] decorators = getDecoratorsFor(element);
- for (int i = 0; i < decorators.length; i++) {
- if (decorators[i].isLabelProperty(element, property))
- return true;
- }
-
- if (checkAdapted) {
- //Get any adaptions to IResource
- Object adapted = getResourceAdapter(element);
- if (adapted != null && adapted != element) {
- if (isLabelProperty(adapted, property, false))
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Returns the class search order starting with <code>extensibleClass</code>.
- * The search order is defined in this class' comment.
- */
- private Vector computeClassOrder(Class extensibleClass) {
- Vector result = new Vector(4);
- Class clazz = extensibleClass;
- while (clazz != null) {
- result.addElement(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.
- */
- private List computeInterfaceOrder(List classList) {
- List 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;
- }
-
- /**
- * 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 (int i = 0; i < interfaces.length; i++) {
- Class interfac = interfaces[i];
- if (seen.get(interfac) == null) {
- result.add(interfac);
- seen.put(interfac, interfac);
- newInterfaces.add(interfac);
- }
- }
- for (Iterator newList = newInterfaces.iterator(); newList.hasNext();)
- internalComputeInterfaceOrder(
- ((Class) newList.next()).getInterfaces(),
- result,
- seen);
- }
-
- /**
- * Return the enabled decorator definitions
- */
- private DecoratorDefinition[] enabledDefinitions() {
- ArrayList result = new ArrayList();
- for (int i = 0; i < definitions.length; i++) {
- if (definitions[i].isEnabled())
- result.add(definitions[i]);
- }
- DecoratorDefinition[] returnArray = new DecoratorDefinition[result.size()];
- result.toArray(returnArray);
- return returnArray;
- }
- /*
- * @see IBaseLabelProvider#dispose()
- */
- public void dispose() {
- //Do nothing as this is not viewer dependant
- }
-
- /*
- * @see IDecoratorManager.reset()
- */
- public void reset() {
- cachedDecorators = new HashMap();
- fireListeners(new LabelProviderChangedEvent(this));
- writeDecoratorsPreference();
- }
-
- /**
- * Get the DecoratorDefinitions defined on the receiver.
- */
- public DecoratorDefinition[] getDecoratorDefinitions() {
- return definitions;
- }
-
- /*
- * @see ILabelProviderListener#labelProviderChanged(LabelProviderChangedEvent)
- */
- public void labelProviderChanged(LabelProviderChangedEvent event) {
- fireListeners(event);
- }
-
- /**
- * Store the currently enabled decorators in
- * preference store.
- */
- private void writeDecoratorsPreference() {
- StringBuffer enabledIds = new StringBuffer();
- for (int i = 0; i < definitions.length; i++) {
- enabledIds.append(definitions[i].getId());
- enabledIds.append(VALUE_SEPARATOR);
- if (definitions[i].isEnabled())
- enabledIds.append(P_TRUE);
- else
- enabledIds.append(P_FALSE);
-
- enabledIds.append(PREFERENCE_SEPARATOR);
- }
-
- WorkbenchPlugin.getDefault().getPreferenceStore().setValue(
- IPreferenceConstants.ENABLED_DECORATORS,
- enabledIds.toString());
- }
-
- /**
- * Get the currently enabled decorators in
- * preference store and set the state of the
- * current definitions accordingly.
- */
- private void applyDecoratorsPreference() {
-
- String preferenceValue =
- WorkbenchPlugin.getDefault().getPreferenceStore().getString(
- IPreferenceConstants.ENABLED_DECORATORS);
-
- 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));
- if (nextValuePair.endsWith(P_TRUE))
- enabledIds.add(id);
- else
- disabledIds.add(id);
- }
-
- for (int i = 0; i < definitions.length; i++) {
- String id = definitions[i].getId();
- if (enabledIds.contains(id))
- definitions[i].setEnabledWithErrorHandling(true);
- else {
- if (disabledIds.contains(id))
- definitions[i].setEnabledWithErrorHandling(false);
- }
- }
-
- }
-
- /**
- * Shutdown the decorator manager by disabling all
- * of the decorators so that dispose() will be called
- * on them.
- */
- public void shutdown() {
- //Disable all fo the enabled decorators
- //so as to force a dispose of thier decorators
- for (int i = 0; i < definitions.length; i++) {
- if (definitions[i].isEnabled())
- definitions[i].setEnabledWithErrorHandling(false);
- }
- }
- /**
- * @see IDecoratorManager#getEnabled(String)
- */
- public boolean getEnabled(String decoratorId) {
- DecoratorDefinition definition = getDecoratorDefinition(decoratorId);
- if (definition == null)
- return false;
- else
- return definition.isEnabled();
- }
-
- /**
- * @see IDecoratorManager#getLabelDecorator()
- */
- public ILabelDecorator getLabelDecorator() {
- return this;
- }
-
- /**
- * @see IDecoratorManager#setEnabled(String, boolean)
- */
- public void setEnabled(String decoratorId, boolean enabled) throws CoreException{
- DecoratorDefinition definition = getDecoratorDefinition(decoratorId);
- if (definition != null)
- definition.setEnabled(enabled);
- }
-
- /**
- * @see IDecoratorManager#getLabelDecorator(String)
- */
- public ILabelDecorator getLabelDecorator(String decoratorId) {
- DecoratorDefinition definition =
- getDecoratorDefinition(decoratorId);
-
- //Do not return for a disabled decorator
- if(definition.isEnabled()){
- try{
- return definition.getDecorator();
- }
- catch (CoreException exception){
- //Cannot be thrown - remove when API is updated
- }
- }
- return null;
- }
-
- /**
- * Get the DecoratorDefinition with the supplied id
- * @return DecoratorDefinition or <code>null</code> if it is not found
- * @param decoratorId String
- */
- private DecoratorDefinition getDecoratorDefinition(String decoratorId) {
- for (int i = 0; i < definitions.length; i++) {
- if (definitions[i].getId().equals(decoratorId))
- return definitions[i];
- }
- return null;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DecoratorRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DecoratorRegistryReader.java
deleted file mode 100644
index a025a27..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DecoratorRegistryReader.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.Collection;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.registry.RegistryReader;
-import org.eclipse.ui.internal.registry.WizardsRegistryReader;
-
-/**
- * The DecoratorRegistryReader is the class that reads the
- * decorator descriptions from the registry
- */
-
-class DecoratorRegistryReader extends RegistryReader {
-
- //The registry values are the ones read from the registry
- static Collection values;
-
- private static String EXTENSION_ID = "decorators"; //$NON-NLS-1$
- private static String ATT_OBJECT_CLASS = "objectClass"; //$NON-NLS-1$
- private static String ATT_LABEL = "label"; //$NON-NLS-1$
- private static String ATT_ADAPTABLE = "adaptable"; //$NON-NLS-1$
- private static String ATT_ID = "id"; //$NON-NLS-1$
- private static String ATT_DESCRIPTION = "description"; //$NON-NLS-1$
- private static String ATT_ENABLED = "state"; //$NON-NLS-1$
- private static String P_TRUE = "true"; //$NON-NLS-1$
-
- /**
- * Constructor for DecoratorRegistryReader.
- */
- protected DecoratorRegistryReader() {
- super();
- }
-
- /*
- * @see RegistryReader#readElement(IConfigurationElement)
- */
- protected boolean readElement(IConfigurationElement element) {
-
- String className = element.getAttribute(ATT_OBJECT_CLASS);
-
- String name = element.getAttribute(ATT_LABEL);
-
- String id = element.getAttribute(ATT_ID);
-
- String description = ""; //$NON-NLS-1$
-
- IConfigurationElement[] descriptions =
- element.getChildren(ATT_DESCRIPTION);
-
- if(descriptions.length > 0)
- description = descriptions[0].getValue();
-
- boolean adaptable = P_TRUE.equals(element.getAttribute(ATT_ADAPTABLE));
-
- boolean enabled = P_TRUE.equals(element.getAttribute(ATT_ENABLED));
-
- values.add(
- new DecoratorDefinition(id, name, description, className, adaptable, enabled, element));
-
- return true;
-
- }
-
- /**
- * Read the decorator extensions within a registry and set
- * up the registry values.
- */
- Collection readRegistry(IPluginRegistry in) {
- values = new ArrayList();
- readRegistry(in, PlatformUI.PLUGIN_ID, EXTENSION_ID);
- return values;
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DefaultContributorResourceAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DefaultContributorResourceAdapter.java
deleted file mode 100644
index 68ccb20..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DefaultContributorResourceAdapter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.IContributorResourceAdapter;
-
-/**
- * The DefaultContributorResourceAdapter is the default
- * implementation of the IContributorResourceAdapter used for
- * one to one resource adaption.
- */
-
-public class DefaultContributorResourceAdapter
- implements IContributorResourceAdapter {
-
- private static IContributorResourceAdapter singleton;
-
- /**
- * Constructor for DefaultContributorResourceAdapter.
- */
- public DefaultContributorResourceAdapter() {
- super();
- }
-
- /**
- * Return the default instance used for TaskList adapting.
- */
- public static IContributorResourceAdapter getDefault(){
- if(singleton == null)
- singleton = new DefaultContributorResourceAdapter();
- return singleton;
- }
-
- /*
- * @see IContributorResourceAdapter#getAdaptedResource(IAdaptable)
- */
- public IResource getAdaptedResource(IAdaptable adaptable) {
- return (IResource) adaptable.getAdapter(IResource.class);
- }
-
-}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DetachedPlaceHolder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DetachedPlaceHolder.java
deleted file mode 100644
index 7adb713..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DetachedPlaceHolder.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.ui.IMemento;
-
-public class DetachedPlaceHolder extends PartPlaceholder implements ILayoutContainer {
- ArrayList children = new ArrayList();
- Rectangle bounds;
-/**
- * DetachedPlaceHolder constructor comment.
- * @param id java.lang.String
- */
-public DetachedPlaceHolder(String id,Rectangle bounds) {
- super(id);
- this.bounds = bounds;
-}
-/**
- * Add a child to the container.
- */
-public void add(LayoutPart newPart) {
- if (!(newPart instanceof PartPlaceholder)) return;
- children.add(newPart);
-}
-/**
- * Return true if the container allows its
- * parts to show a border if they choose to,
- * else false if the container does not want
- * its parts to show a border.
- */
-public boolean allowsBorder() {
- return false;
-}
-public Rectangle getBounds() {
- return bounds;
-}
-/**
- * Returns a list of layout children.
- */
-public LayoutPart[] getChildren() {
- LayoutPart result[] = new LayoutPart[children.size()];
- children.toArray(result);
- return result;
-}
-/**
- * Remove a child from the container.
- */
-public void remove(LayoutPart part) {
- children.remove(part);
-}
-/**
- * Replace one child with another
- */
-public void replace(LayoutPart oldPart, LayoutPart newPart) {
- remove(oldPart);
- add(newPart);
-}
-/**
- * @see IPersistablePart
- */
-public void restoreState(IMemento memento)
-{
- // Read the bounds.
- Integer bigInt;
- bigInt = memento.getInteger(IWorkbenchConstants.TAG_X);
- int x = bigInt.intValue();
- bigInt = memento.getInteger(IWorkbenchConstants.TAG_Y);
- int y = bigInt.intValue();
- bigInt = memento.getInteger(IWorkbenchConstants.TAG_WIDTH);
- int width = bigInt.intValue();
- bigInt = memento.getInteger(IWorkbenchConstants.TAG_HEIGHT);
- int height = bigInt.intValue();
-
- bounds = new Rectangle(x, y, width, height);
-
- // Restore the placeholders.
- IMemento childrenMem[] = memento.getChildren(IWorkbenchConstants.TAG_VIEW);
- for (int i = 0; i < childrenMem.length; i++){
- PartPlaceholder holder = new PartPlaceholder(childrenMem[i].getString(IWorkbenchConstants.TAG_ID));
- holder.setContainer(this);
- children.add(holder);
- }
-}
-/**
- * @see IPersistablePart
- */
-public void saveState(IMemento memento)
-{
- // Save the bounds.
- memento.putInteger(IWorkbenchConstants.TAG_X, bounds.x);
- memento.putInteger(IWorkbenchConstants.TAG_Y, bounds.y);
- memento.putInteger(IWorkbenchConstants.TAG_WIDTH, bounds.width);
- memento.putInteger(IWorkbenchConstants.TAG_HEIGHT, bounds.height);
-
- // Save the views.
- for (int i = 0; i < children.size(); i++){
- IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_VIEW);
- LayoutPart child = (LayoutPart)children.get(i);
- childMem.putString(IWorkbenchConstants.TAG_ID,child.getID());
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DetachedWindow.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DetachedWindow.java
deleted file mode 100644
index a396ba5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DetachedWindow.java
+++ /dev/null
@@ -1,199 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.jface.window.*;
-import java.util.*;
-import java.util.List;
-
-public class DetachedWindow extends Window {
-
- private static int fgCount= 0;
- private PartTabFolder folder;
- private int fID;
- private WorkbenchPage page;
-
- //Keep the state of a DetachedWindow when switching perspectives.
- private String title;
- private Rectangle bounds;
-/**
- * Create a new FloatingWindow.
- */
-public DetachedWindow(WorkbenchPage workbenchPage) {
- super(workbenchPage.getWorkbenchWindow().getShell());
- setShellStyle(/* SWT.CLOSE | SWT.MIN | SWT.MAX | */ SWT.RESIZE);
- this.page = workbenchPage;
- folder = new PartTabFolder();
-}
-/**
- * Adds a visual part to this window.
- * Supports reparenting.
- */
-public void add(ViewPane part, IPartDropListener listener) {
- Shell shell = getShell();
- if (shell != null)
- part.reparent(shell);
- folder.add(part);
- folder.enableDrag(part, listener);
-}
-public boolean belongsToWorkbenchPage(IWorkbenchPage workbenchPage) {
- return (this.page == workbenchPage);
-}
-/**
- * Closes this window and disposes its shell.
- */
-public boolean close() {
- Shell s = getShell();
- if(s != null) {
- title = s.getText();
- bounds = s.getBounds();
- }
-
- if (folder != null)
- folder.dispose();
-
- return super.close();
-}
-/**
- * Answer a list of the view panes.
- */
-private void collectViewPanes(List result, LayoutPart [] parts) {
- for (int i = 0, length = parts.length; i < length; i++) {
- LayoutPart part = parts[i];
- if (part instanceof ViewPane) {
- result.add(part);
- }
- }
-}
-/**
- * This method will be called to initialize the given Shell's layout
- */
-protected void configureShell(Shell shell) {
- if(title != null) shell.setText(title);
- shell.addListener(SWT.Resize, new Listener() {
- public void handleEvent(Event event) {
- Shell shell = (Shell)event.widget;
- Control[] children = shell.getChildren();
- if (children != null) {
- for (int i = 0, length = children.length; i < length; i++){
- if (children[i] instanceof CTabFolder) {
- children[i].setBounds(shell.getClientArea());
- break;
- }
- }
- }
- }
- });
-
- WorkbenchHelp.setHelp(shell, IHelpContextIds.DETACHED_WINDOW);
-}
-/**
- * Override this method to create the widget tree that is used as the window's contents.
- */
-protected Control createContents(Composite parent) {
- // Create the tab folder.
- folder.createControl(parent);
-
- // Reparent each view in the tab folder.
- Vector detachedChildren = new Vector();
- collectViewPanes(detachedChildren, getChildren());
- Enumeration enum = detachedChildren.elements();
- while (enum.hasMoreElements()) {
- LayoutPart part = (LayoutPart)enum.nextElement();
- part.reparent(parent);
- }
-
- // Return tab folder control.
- return folder.getControl();
-}
-public LayoutPart [] getChildren() {
- return folder.getChildren();
-}
-public WorkbenchPage getWorkbenchPage() {
- return this.page;
-}
-/**
- * Close has been pressed. Close all views.
- */
-protected void handleShellCloseEvent() {
-// List views = new ArrayList();
-// collectViewPanes(views, getChildren());
-// Iterator enum = views.iterator();
-// while (enum.hasNext()) {
-// ViewPane child = (ViewPane)enum.next();
-// page.hideView(child.getViewPart());
-// }
-// close();
-}
-protected void initializeBounds() {
- if(bounds != null)
- getShell().setBounds(bounds);
- else
- super.initializeBounds();
-}
-/**
- * @see IPersistablePart
- */
-public void restoreState(IMemento memento)
-{
- // Read the title.
- title = memento.getString(IWorkbenchConstants.TAG_TITLE);
-
- // Read the bounds.
- Integer bigInt;
- bigInt = memento.getInteger(IWorkbenchConstants.TAG_X);
- int x = bigInt.intValue();
- bigInt = memento.getInteger(IWorkbenchConstants.TAG_Y);
- int y = bigInt.intValue();
- bigInt = memento.getInteger(IWorkbenchConstants.TAG_WIDTH);
- int width = bigInt.intValue();
- bigInt = memento.getInteger(IWorkbenchConstants.TAG_HEIGHT);
- int height = bigInt.intValue();
-
- // Set the bounds.
- bounds = new Rectangle(x, y, width, height);
- if(getShell() != null) {
- getShell().setText(title);
- getShell().setBounds(bounds);
- }
-
- // Create the folder.
- IMemento childMem = memento.getChild(IWorkbenchConstants.TAG_FOLDER);
- if (childMem != null)
- folder.restoreState(childMem);
-}
-/**
- * @see IPersistablePart
- */
-public void saveState(IMemento memento)
-{
- if(getShell() != null) {
- title = getShell().getText();
- bounds = getShell().getBounds();
- }
- // Save the title.
- memento.putString(IWorkbenchConstants.TAG_TITLE,title);
-
- // Save the bounds.
- memento.putInteger(IWorkbenchConstants.TAG_X, bounds.x);
- memento.putInteger(IWorkbenchConstants.TAG_Y, bounds.y);
- memento.putInteger(IWorkbenchConstants.TAG_WIDTH, bounds.width);
- memento.putInteger(IWorkbenchConstants.TAG_HEIGHT, bounds.height);
-
- // Save the views.
- IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_FOLDER);
- folder.saveState(childMem);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DynamicMenuManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DynamicMenuManager.java
deleted file mode 100644
index 72f73ec..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/DynamicMenuManager.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.MenuManager;
-
-/**
- * A dynamic menu manager is a contribution manager which realizes itself and its items
- * dynamically in a menu control; either as a menu bar, a sub-menu, or a context menu.
- * <p>
- * This class may be instantiated; it may also be subclassed.
- * </p>
- */
-public class DynamicMenuManager extends MenuManager {
- /**
- * Creates a menu manager. The text and id are <code>null</code>.
- * Typically used for creating a context menu, where it doesn't need to be referred to by id.
- */
- public DynamicMenuManager() {
- this(null, null);
- }
- /**
- * Creates a menu manager with the given text. The id of the menu
- * is <code>null</code>.
- * Typically used for creating a sub-menu, where it doesn't need to be referred to by id.
- *
- * @param text the text for the menu, or <code>null</code> if none
- */
- public DynamicMenuManager(String text) {
- this(text, null);
- }
- /**
- * Creates a menu manager with the given text and id.
- * Typically used for creating a sub-menu, where it needs to be referred to by id.
- *
- * @param text the text for the menu, or <code>null</code> if none
- * @param id the menu id, or <code>null</code> if it is to have no id
- */
- public DynamicMenuManager(String text, String id) {
- super(text, id);
- }
- /* (non-Javadoc)
- * Method declared on IContributionItem.
- */
- public boolean isDynamic() {
- return true;
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditActionSetsAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditActionSetsAction.java
deleted file mode 100644
index 262fc1e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditActionSetsAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.model.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import java.util.*;
-
-/**
- * Edit the action sets.
- */
-public class EditActionSetsAction extends Action {
- private IWorkbenchWindow window;
-/**
- * This default constructor allows the the action to be called from the welcome page.
- */
-public EditActionSetsAction() {
- this(((Workbench)PlatformUI.getWorkbench()).getActiveWorkbenchWindow());
-}
-/**
- *
- */
-public EditActionSetsAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.getString("EditorActionSetsAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("EditorActionSetsAction.toolTip")); //$NON-NLS-1$
- setEnabled(false);
- this.window = window;
- WorkbenchHelp.setHelp(this, IHelpContextIds.EDIT_ACTION_SETS_ACTION);
-}
-/**
- * Open the selected resource in the default page.
- */
-public void run() {
- WorkbenchPage page = (WorkbenchPage)window.getActivePage();
- if (page == null)
- return;
- page.editActionSets();
-}
-}
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
deleted file mode 100644
index e272596..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBars.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.CoolItemToolBarManager;
-
-/**
- * The action bars for an editor.
- */
-public class EditorActionBars extends SubActionBars
-{
- private String type;
- private int refCount;
- private IEditorActionBarContributor editorContributor;
- private IEditorActionBarContributor extensionContributor;
- private CoolItemMultiToolBarManager coolItemToolBarMgr;
-
-/**
- * Constructs the EditorActionBars for an editor.
- */
-public EditorActionBars(IActionBars parent, String type) {
- super(parent);
- this.type = type;
-}
-/**
- * Activate the contributions.
- */
-public void activate(boolean forceVisibility) {
- setActive(true, forceVisibility);
-}
-/**
- * Add one ref to the bars.
- */
-public void addRef() {
- ++ refCount;
-}
-/* (non-Javadoc)
- * Method declared on SubActionBars.
- */
-protected SubMenuManager createSubMenuManager(IMenuManager parent) {
- return new EditorMenuManager(parent);
-}
-/* (non-Javadoc)
- * Method declared on SubActionBars.
- */
-protected SubToolBarManager createSubToolBarManager(IToolBarManager parent) {
- return new EditorToolBarManager(parent);
-}
-/**
- * Deactivate the contributions.
- */
-public void deactivate(boolean forceVisibility) {
- setActive(false, forceVisibility);
-}
-/**
- * Dispose the contributions.
- */
-public void dispose() {
- super.dispose();
- if (editorContributor != null)
- editorContributor.dispose();
- if (coolItemToolBarMgr != null)
- coolItemToolBarMgr.removeAll();
-}
-/**
- * Gets the editor contributor
- */
-public IEditorActionBarContributor getEditorContributor() {
- return editorContributor;
-}
-/**
- * Gets the extension contributor
- */
-public IEditorActionBarContributor getExtensionContributor() {
- return extensionContributor;
-}
-/**
- * Returns the editor type.
- */
-public String getEditorType() {
- return type;
-}
-/**
- * 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
- */
-public IToolBarManager getToolBarManager() {
- IToolBarManager parentMgr = parent.getToolBarManager();
- if (parentMgr instanceof ToolBarManager) {
- return super.getToolBarManager();
- } else if (parentMgr instanceof CoolBarManager) {
- if (coolItemToolBarMgr == null) {
- // Create a CoolItem manager for this action bar. The CoolBarContributionItem(s)
- // will be created when the EditorActionBar is initialized.
- CoolBarManager cBarMgr = ((CoolBarManager)parentMgr);
- coolItemToolBarMgr = new CoolItemMultiToolBarManager(cBarMgr, type, active);
- coolItemToolBarMgr.setParentMgr(cBarMgr);
- toolBarMgr = createSubToolBarManager(coolItemToolBarMgr);
- coolItemToolBarMgr.setOverrides(toolBarMgr.getOverrides());
- }
- return coolItemToolBarMgr;
- }
- return null;
-}
-/**
- * Returns the reference count.
- */
-public int getRef() {
- return refCount;
-}
-/**
- * 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.
- */
-public void partChanged(IWorkbenchPart part) {
- super.partChanged(part);
- if (part instanceof IEditorPart) {
- IEditorPart editor = (IEditorPart)part;
- if (editorContributor != null)
- editorContributor.setActiveEditor(editor);
- if (extensionContributor != null)
- extensionContributor.setActiveEditor(editor);
- }
-}
-/**
- * Remove one ref to the bars.
- */
-public void removeRef() {
- -- refCount;
-}
-/**
- * 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.
- */
-private void setActive(boolean set, boolean forceVisibility) {
- active = set;
- if (menuMgr != null)
- ((EditorMenuManager)menuMgr).setVisible(set, forceVisibility);
-
- if (statusLineMgr != null)
- statusLineMgr.setVisible(set);
-
- if (toolBarMgr != null)
- ((EditorToolBarManager)toolBarMgr).setVisible(set, forceVisibility);
-
- if (coolItemToolBarMgr != null)
- coolItemToolBarMgr.setVisible(set, forceVisibility);
-}
-/**
- * Sets the editor contributor
- */
-public void setEditorContributor(IEditorActionBarContributor c) {
- editorContributor = c;
-}
-/**
- * Sets the extension contributor
- */
-public void setExtensionContributor(IEditorActionBarContributor c) {
- extensionContributor = c;
-}
-}
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
deleted file mode 100644
index e924f60..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorActionBuilder.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.jface.action.*;
-import java.util.*;
-
-/**
- * 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$
- public class ExternalContributor implements IEditorActionBarContributor {
- private List cache;
- public ExternalContributor(List cache) {
- this.cache = cache;
- }
- public void dispose() {
- };
- public ActionDescriptor[] getExtendedActions() {
- if(cache == null)
- return new ActionDescriptor[0];
- ArrayList result = new ArrayList(cache.size());
- for (Iterator iter = cache.iterator(); iter.hasNext();) {
- Object element = (Object) iter.next();
- if (element instanceof ActionDescriptor) {
- result.add(element);
- }
- }
- return (ActionDescriptor[])result.toArray(new ActionDescriptor[result.size()]);
- }
- public void init(IActionBars bars, IWorkbenchPage page) {
- contributeToMenu(bars.getMenuManager());
- contributeToToolBar(bars.getToolBarManager());
- contributeToStatusLine(bars.getStatusLineManager());
- }
- public void contributeToMenu(IMenuManager menu) {
- for (int i = 0; i < cache.size(); i++) {
- Object obj = cache.get(i);
- if (obj instanceof IConfigurationElement) {
- IConfigurationElement menuElement = (IConfigurationElement) obj;
- contributeMenu(menuElement, menu, false);
- } else
- if (obj instanceof ActionDescriptor) {
- ActionDescriptor ad = (ActionDescriptor) obj;
- contributeMenuAction(ad, menu, false);
- }
- }
- }
- public void contributeToToolBar(IToolBarManager manager) {
- for (int i = 0; i < cache.size(); i++) {
- Object obj = cache.get(i);
- if (obj instanceof ActionDescriptor) {
- ActionDescriptor ad = (ActionDescriptor) obj;
- contributeToolbarAction(ad, manager, true);
- }
- }
- }
- public void setActiveEditor(IEditorPart editor) {
- for (int i=0; i<cache.size(); i++) {
- Object obj = cache.get(i);
- if (obj instanceof ActionDescriptor) {
- ActionDescriptor ad = (ActionDescriptor) obj;
- EditorPluginAction action = (EditorPluginAction)ad.getAction();
- action.editorChanged(editor);
- }
- }
- }
- public void contributeToStatusLine(IStatusLineManager manager) {
- }
- }
-/**
- * The constructor.
- */
-public EditorActionBuilder() {
-}
-/**
- * This factory method returns a new ActionDescriptor for the
- * configuration element. It should be implemented by subclasses.
- */
-protected ActionDescriptor createActionDescriptor(IConfigurationElement element) {
- return new ActionDescriptor(element, ActionDescriptor.T_EDITOR);
-}
-/**
- * Reads editor contributor if specified directly in the 'editor' extension point,
- * and all external contributions for this editor's ID registered in
- * 'editorActions' extension point.
- */
-public IEditorActionBarContributor readActionExtensions(IEditorDescriptor desc, IActionBars bars)
-{
- ExternalContributor ext = null;
- readContributions(desc.getId(), TAG_CONTRIBUTION_TYPE,
- IWorkbenchConstants.PL_EDITOR_ACTIONS);
- if (cache != null) {
- ext = new ExternalContributor(cache);
- cache = null;
- }
- return ext;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorArea.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorArea.java
deleted file mode 100644
index e17a6ab..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorArea.java
+++ /dev/null
@@ -1,316 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.*;
-import java.util.List;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.window.Window;
-import org.eclipse.ui.*;
-
-/**
- * Represents the area set aside for editor workbooks.
- * This container only accepts EditorWorkbook and PartSash
- * as layout parts.
- *
- * Note no views are allowed within this container.
- */
-public class EditorArea extends PartSashContainer {
-
- private static final String DEFAULT_WORKBOOK_ID = "DefaultEditorWorkbook";//$NON-NLS-1$
- private IPartDropListener partDropListener;
- private ArrayList editorWorkbooks = new ArrayList(3);
- private EditorWorkbook activeEditorWorkbook;
-
-public EditorArea(String editorId, IPartDropListener listener, Listener mouseDownListener) {
- super(editorId);
-
- this.partDropListener = listener;
- this.mouseDownListener = mouseDownListener;
- createDefaultWorkbook();
-}
-/**
- * Add an editor to the active workbook.
- */
-public void addEditor(EditorPane pane) {
- EditorWorkbook workbook = getActiveWorkbook();
- workbook.add(pane);
-}
-/**
- * Notification that a child layout part has been
- * added to the container. Subclasses may override
- * this method to perform any container specific
- * work.
- */
-protected void childAdded(LayoutPart child) {
- if (child instanceof EditorWorkbook)
- editorWorkbooks.add(child);
-}
-/**
- * Notification that a child layout part has been
- * removed from the container. Subclasses may override
- * this method to perform any container specific
- * work.
- */
-protected void childRemoved(LayoutPart child) {
- if (child instanceof EditorWorkbook) {
- editorWorkbooks.remove(child);
- if (activeEditorWorkbook == child)
- setActiveWorkbook(null, false);
- }
-}
-protected EditorWorkbook createDefaultWorkbook() {
- EditorWorkbook newWorkbook = new EditorWorkbook(this);
- newWorkbook.setID(DEFAULT_WORKBOOK_ID);
- add(newWorkbook);
- return newWorkbook;
-}
-/**
- * Subclasses override this method to specify
- * the composite to use to parent all children
- * layout parts it contains.
- */
-protected Composite createParent(Composite parentWidget) {
- return new Composite(parentWidget, SWT.NONE);
-}
-/**
- * Dispose of the editor area.
- */
-public void dispose() {
- // Free editor workbooks.
- Iterator iter = editorWorkbooks.iterator();
- while (iter.hasNext()) {
- EditorWorkbook wb = (EditorWorkbook)iter.next();
- wb.dispose();
- }
- editorWorkbooks.clear();
-
- // Free rest.
- super.dispose();
-}
-/**
- * Subclasses override this method to dispose
- * of any swt resources created during createParent.
- */
-protected void disposeParent() {
- this.parent.dispose();
-}
-/**
- * Return the editor workbook which is active.
- */
-public EditorWorkbook getActiveWorkbook() {
- if (activeEditorWorkbook == null) {
- if (editorWorkbooks.size() < 1)
- setActiveWorkbook(createDefaultWorkbook(), false);
- else
- setActiveWorkbook((EditorWorkbook)editorWorkbooks.get(0), false);
- }
-
- return activeEditorWorkbook;
-}
-/**
- * Return the editor workbook id which is active.
- */
-public String getActiveWorkbookID() {
- return getActiveWorkbook().getID();
-}
-/**
- * Return the all the editor workbooks.
- */
-public ArrayList getEditorWorkbooks() {
- return (ArrayList)editorWorkbooks.clone();
-}
-/**
- * Return the all the editor workbooks.
- */
-public int getEditorWorkbookCount() {
- return editorWorkbooks.size();
-}
-/**
- * Return the interested listener of d&d events.
- */
-public IPartDropListener getPartDropListener() {
- return partDropListener;
-}
-/**
- * Return true is the workbook specified
- * is the active one.
- */
-protected boolean isActiveWorkbook(EditorWorkbook workbook) {
- return activeEditorWorkbook == workbook;
-}
-/**
- * Find the sashs around the specified part.
- */
-public void findSashes(LayoutPart pane,PartPane.Sashes sashes) {
- //Find the sashes around the current editor and
- //then the sashes around the editor area.
- super.findSashes(pane,sashes);
- getRootContainer().findSashes(this,sashes);
-}
-/**
- * Remove all the editors
- */
-public void removeAllEditors() {
- EditorWorkbook currentWorkbook = getActiveWorkbook();
-
- // Iterate over a copy so the original can be modified.
- Iterator workbooks = ((ArrayList)editorWorkbooks.clone()).iterator();
- while (workbooks.hasNext()) {
- EditorWorkbook workbook = (EditorWorkbook)workbooks.next();
- workbook.removeAll();
- if (workbook != currentWorkbook) {
- remove(workbook);
- workbook.dispose();
- }
- }
-}
-/**
- * Remove an editor from its' workbook.
- */
-public void removeEditor(EditorPane pane) {
- EditorWorkbook workbook = pane.getWorkbook();
- if (workbook == null)
- return;
- workbook.remove(pane);
-
- // remove the editor workbook if empty and
- // there are other workbooks
- if (workbook.getItemCount() < 1 && editorWorkbooks.size() > 1) {
- remove(workbook);
- workbook.dispose();
- }
-}
-/**
- * @see IPersistablePart
- */
-public IStatus restoreState(IMemento memento) {
- // Remove the default editor workbook that is
- // initialy created with the editor area.
- if (children != null) {
- EditorWorkbook defaultWorkbook = null;
- for (int i = 0; i < children.size(); i++) {
- LayoutPart child = (LayoutPart)children.get(i);
- if (child.getID() == DEFAULT_WORKBOOK_ID) {
- defaultWorkbook = (EditorWorkbook)child;
- if (defaultWorkbook.getItemCount() > 0)
- defaultWorkbook = null;
- }
- }
- if (defaultWorkbook != null)
- remove(defaultWorkbook);
- }
-
- // Restore the relationship/layout
- IMemento [] infos = memento.getChildren(IWorkbenchConstants.TAG_INFO);
- Map mapIDtoPart = new HashMap(infos.length);
-
- for (int i = 0; i < infos.length; i ++) {
- // Get the info details.
- IMemento childMem = infos[i];
- String partID = childMem.getString(IWorkbenchConstants.TAG_PART);
- String relativeID = childMem.getString(IWorkbenchConstants.TAG_RELATIVE);
- int relationship = 0;
- float ratio = 0.0f;
- if (relativeID != null) {
- relationship = childMem.getInteger(IWorkbenchConstants.TAG_RELATIONSHIP).intValue();
- ratio = childMem.getFloat(IWorkbenchConstants.TAG_RATIO).floatValue();
- }
-
- // Create the part.
- EditorWorkbook workbook = new EditorWorkbook(this);
- workbook.setID(partID);
- // 1FUN70C: ITPUI:WIN - Shouldn't set Container when not active
- workbook.setContainer(this);
-
- // Add the part to the layout
- if (relativeID == null) {
- add(workbook);
- } else {
- LayoutPart refPart = (LayoutPart)mapIDtoPart.get(relativeID);
- if (refPart != null) {
- add(workbook, relationship, ratio, refPart);
- } else {
- WorkbenchPlugin.log("Unable to find part for ID: " + relativeID);//$NON-NLS-1$
- }
- }
- mapIDtoPart.put(partID, workbook);
- }
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
-}
-/**
- * @see IPersistablePart
- */
-public IStatus saveState(IMemento memento) {
- RelationshipInfo[] relationships = computeRelation();
- for (int i = 0; i < relationships.length; i ++) {
- // Save the relationship info ..
- // private LayoutPart part;
- // private int relationship;
- // private float ratio;
- // private LayoutPart relative;
- RelationshipInfo info = relationships[i];
- IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_INFO);
- childMem.putString(IWorkbenchConstants.TAG_PART, info.part.getID());
- if (info.relative != null) {
- childMem.putString(IWorkbenchConstants.TAG_RELATIVE, info.relative.getID());
- childMem.putInteger(IWorkbenchConstants.TAG_RELATIONSHIP, info.relationship);
- childMem.putFloat(IWorkbenchConstants.TAG_RATIO, info.ratio);
- }
- }
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
-}
-/**
- * Set the editor workbook which is active.
- */
-public void setActiveWorkbook(EditorWorkbook newWorkbook, boolean hasFocus) {
- EditorWorkbook oldWorkbook = activeEditorWorkbook;
- activeEditorWorkbook = newWorkbook;
-
- if (oldWorkbook != null && oldWorkbook != newWorkbook)
- oldWorkbook.tabFocusHide();
-
- if (newWorkbook != null)
- newWorkbook.tabFocusShow(hasFocus);
-
- updateTabList();
-}
-/**
- * Set the editor workbook which is active.
- */
-public void setActiveWorkbookFromID(String id) {
- for (int i = 0; i < editorWorkbooks.size(); i++) {
- EditorWorkbook workbook = (EditorWorkbook) editorWorkbooks.get(i);
- if (workbook.getID().equals(id))
- setActiveWorkbook(workbook, false);
- }
-}
-
-/**
- * Updates the editor area's tab list to include the active
- * editor and its tab.
- */
-public void updateTabList() {
- Composite parent = getParent();
- if (parent != null) { // parent may be null on startup
- EditorWorkbook wb = getActiveWorkbook();
- if (wb == null) {
- parent.setTabList(new Control[0]);
- }
- else {
- parent.setTabList(wb.getTabList());
- }
- }
-}
-
-
-}
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
deleted file mode 100644
index 86f7319..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistory.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.ui.*;
-
-/**
- * This class is used to record "open editor" actions as they
- * happen. The input and type of each edior are recorded so that
- * the user can reopen an item from the "File Most Recently Used"
- * list.
- */
-public class EditorHistory {
- private int size;
- private ArrayList fifoList;
- /**
- * Constructs a new history.
- */
- public EditorHistory() {
- this(10);
- }
- /**
- * Constructs a new history.
- */
- public EditorHistory(int size) {
- this.size = size;
- fifoList = new ArrayList(size);
- }
- /**
- * Adds an item to the history. Added in fifo fashion.
- */
- public void add(IEditorInput input) {
- add(input, null);
- }
- /**
- * Adds an item to the history. Added in fifo fashion.
- */
- public void add(IEditorInput input, IEditorDescriptor desc) {
- 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.
- remove(newItem.getInput());
-
- // Add the new item.
- fifoList.add(index, newItem);
- if (fifoList.size() > size) {
- fifoList.remove(size);
- }
- }
- /**
- * 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()];
- int length = array.length;
- for (int i = 0; i < length; i++) {
- array[i] = (EditorHistoryItem) fifoList.get(i);
- }
- return array;
- }
- /**
- * Returns the stack height.
- */
- public int getSize() {
- return fifoList.size();
- }
- /**
- * Refresh the editor list. Any stale items are removed.
- */
- public void refresh() {
- Iterator iter = fifoList.iterator();
- while (iter.hasNext()) {
- EditorHistoryItem item = (EditorHistoryItem) iter.next();
- if (!item.getInput().exists())
- iter.remove();
- }
- }
- /**
- * Removes all traces of an editor input from the history.
- */
- public void remove(IEditorInput input) {
- Iterator iter = fifoList.iterator();
- while (iter.hasNext()) {
- EditorHistoryItem item = (EditorHistoryItem) iter.next();
- if (input.equals(item.getInput()))
- iter.remove();
- }
- }
- /**
- * Reset the editor history to have the specified size. Trim the list if
- * it does not conforms to the new size.
- */
- public void reset(int size) {
- this.size = size;
- while (fifoList.size() > size) {
- fifoList.remove(size);
- }
- }
- /**
- * 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) {
- IMemento[] mementos = memento.getChildren(IWorkbenchConstants.TAG_FILE);
- for (int i = 0; i < mementos.length; i++) {
- EditorHistoryItem item = new EditorHistoryItem();
- item.restoreState(mementos[i]);
- if (item.getInput() != null) {
- add(item, fifoList.size());
- }
- }
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
- }
- /**
- * 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 historyItem = (EditorHistoryItem) iterator.next();
- IEditorInput editorInput = historyItem.getInput();
-
- if (editorInput != null && editorInput.getPersistable() != null) {
- IMemento itemMemento = memento.createChild(IWorkbenchConstants.TAG_FILE);
- historyItem.saveState(itemMemento);
- }
- }
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 6b7ccbf..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorHistoryItem.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.ui.*;
-
-/**
- * An item in the editor history.
- */
-public class EditorHistoryItem {
- private IEditorInput input;
- private IEditorDescriptor descriptor;
-
-/**
- * Constructs a new item.
- */
-public EditorHistoryItem() {
-}
-/**
- * Constructs a new item.
- */
-public EditorHistoryItem(IEditorInput input, IEditorDescriptor descriptor) {
- this.input = input;
- this.descriptor = descriptor;
-}
-/**
- * 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;
-}
-/**
- * Restores the object state from the given memento.
- *
- * @param memento the memento to restore the object state from
- */
-public IStatus restoreState(IMemento memento) {
- String factoryId = memento.getString(IWorkbenchConstants.TAG_FACTORY_ID);
-
- Status result = new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
- if (factoryId == null) {
- WorkbenchPlugin.log("Unable to restore mru list - no input factory ID.");//$NON-NLS-1$
- return result;
- }
- IElementFactory factory = WorkbenchPlugin.getDefault().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;
-}
-/**
- * Saves the object state in the given memento.
- *
- * @param memento the memento to save the object state in
- */
-public IStatus saveState(IMemento memento) {
- 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());
- }
- }
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorManager.java
deleted file mode 100644
index 52cf8f6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorManager.java
+++ /dev/null
@@ -1,1220 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.window.ApplicationWindow;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.program.Program;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-import org.eclipse.ui.internal.dialogs.EventLoopProgressMonitor;
-import org.eclipse.ui.internal.editorsupport.ComponentSupport;
-import org.eclipse.ui.internal.misc.ExternalEditor;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.ui.internal.registry.EditorDescriptor;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.part.MultiEditor;
-import org.eclipse.ui.part.MultiEditorInput;
-
-/**
- * Manage a group of element editors. Prevent the creation of two editors on
- * the same element.
- *
- * 06/12/00 - DS - Given the ambiguous editor input type, the manager delegates
- * a number of responsabilities to the editor itself.
- *
- * <ol>
- * <li>The editor should determine its own title.</li>
- * <li>The editor shoudl listen to resource deltas and close itself if the input is deleted.
- * It may also choose to stay open if the editor has dirty state.</li>
- * <li>The editor should persist its own state plus editor input.</li>
- * </ol>
- */
-public class EditorManager {
- private EditorPresentation editorPresentation;
- private WorkbenchWindow window;
- private WorkbenchPage page;
- private Map actionCache = new HashMap();
-
- private static final String RESOURCES_TO_SAVE_MESSAGE = WorkbenchMessages.getString("EditorManager.saveResourcesMessage"); //$NON-NLS-1$
- private static final String SAVE_RESOURCES_TITLE = WorkbenchMessages.getString("EditorManager.saveResourcesTitle"); //$NON-NLS-1$
- /**
- * EditorManager constructor comment.
- */
- public EditorManager(WorkbenchWindow window, WorkbenchPage workbenchPage, EditorPresentation pres) {
- this.window = window;
- this.page = workbenchPage;
- this.editorPresentation = pres;
- }
- /**
- * Closes all of the editors in the workbench. The contents are not saved.
- *
- * This method will close the presentation for each editor.
- * The IEditorPart.dispose method must be called at a higher level.
- */
- public void closeAll() {
- // Close the pane, action bars, pane, etc.
- IEditorReference[] editors = editorPresentation.getEditors();
- editorPresentation.closeAllEditors();
- for (int i = 0; i < editors.length; i++) {
- IEditorPart part = (IEditorPart)editors[i].getPart(false);
- if(part != null) {
- PartSite site = (PartSite) part.getSite();
- disposeEditorActionBars((EditorActionBars) site.getActionBars());
- site.dispose();
- }
- }
- }
- /**
- * Closes an editor. The contents are not saved.
- *
- * This method will close the presentation for the editor.
- * The IEditorPart.dispose method must be called at a higher level.
- */
- public void closeEditor(IEditorReference ref) {
- // Close the pane, action bars, pane, etc.
- IEditorPart part = ref.getEditor(false);
- if(part != null) {
- if(part instanceof MultiEditor) {
- IEditorPart innerEditors[] = ((MultiEditor)part).getInnerEditors();
- for (int i = 0; i < innerEditors.length; i++) {
- EditorSite site = (EditorSite) innerEditors[i].getEditorSite();
- editorPresentation.closeEditor(innerEditors[i]);
- disposeEditorActionBars((EditorActionBars) site.getActionBars());
- site.dispose();
- }
- } else {
- EditorSite site = (EditorSite) part.getEditorSite();
- if(site.getPane() instanceof MultiEditorInnerPane) {
- MultiEditorInnerPane pane = (MultiEditorInnerPane)site.getPane();
- page.closeEditor((IEditorReference)pane.getParentPane().getPartReference(),true);
- return;
- }
- }
- EditorSite site = (EditorSite) part.getEditorSite();
- editorPresentation.closeEditor(part);
- disposeEditorActionBars((EditorActionBars) site.getActionBars());
- site.dispose();
- } else {
- editorPresentation.closeEditor(ref);
- ((Editor)ref).dispose();
- }
- }
- /**
- * Answer a list of dirty editors.
- */
- private List collectDirtyEditors() {
- List result = new ArrayList(3);
- IEditorReference[] editors = editorPresentation.getEditors();
- for (int i = 0; i < editors.length; i++) {
- IEditorPart part = (IEditorPart)editors[i].getPart(false);
- if (part != null && part.isDirty())
- result.add(part);
-
- }
- return result;
- }
- /**
- * Returns whether the manager contains an editor.
- */
- public boolean containsEditor(IEditorReference ref) {
- IEditorReference[] editors = editorPresentation.getEditors();
- for (int i = 0; i < editors.length; i++) {
- if (ref == editors[i])
- return true;
- }
- return false;
- }
- /*
- * 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 EditorActionBars createEditorActionBars(EditorDescriptor desc) {
- // Get the editor type.
- String type = desc.getId();
-
- // If an action bar already exists for this editor type return it.
- EditorActionBars actionBars = (EditorActionBars) actionCache.get(type);
- if (actionBars != null) {
- actionBars.addRef();
- return actionBars;
- }
-
- // Create a new action bar set.
- actionBars = new EditorActionBars(page.getActionBars(), type);
- actionBars.addRef();
- actionCache.put(type, actionBars);
-
- // Read base contributor.
- IEditorActionBarContributor contr = desc.createActionBarContributor();
- if (contr != null) {
- actionBars.setEditorContributor(contr);
- contr.init(actionBars, page);
- }
-
- // Read action extensions.
- EditorActionBuilder builder = new EditorActionBuilder();
- contr = builder.readActionExtensions(desc, actionBars);
- if (contr != null) {
- actionBars.setExtensionContributor(contr);
- contr.init(actionBars, page);
- }
-
- // Return action bars.
- return actionBars;
- }
- /*
- * Creates the action bars for an editor.
- */
- private EditorActionBars createEmptyEditorActionBars() {
- // Get the editor type.
- String type = String.valueOf(System.currentTimeMillis());
-
- // Create a new action bar set.
- // Note: It is an empty set.
- EditorActionBars actionBars = new EditorActionBars(page.getActionBars(), type);
- actionBars.addRef();
- actionCache.put(type, actionBars);
-
- // Return action bars.
- return actionBars;
- }
- /*
- * Dispose
- */
- private void disposeEditorActionBars(EditorActionBars actionBars) {
- actionBars.removeRef();
- if (actionBars.getRef() <= 0) {
- String type = actionBars.getEditorType();
- actionCache.remove(type);
- actionBars.dispose();
- }
- }
- /*
- * Answer an open editor for the input element. If none
- * exists return null.
- */
- public IEditorPart findEditor(IEditorInput input) {
- IEditorReference[] editors = editorPresentation.getEditors();
- for (int i = 0; i < editors.length; i++) {
- IEditorPart part = (IEditorPart)editors[i].getPart(false);
- if (part != null && input.equals(part.getEditorInput()))
- return part;
- }
- String name = input.getName();
- IPersistableElement persistable = input.getPersistable();
- if(name == null || persistable == null)
- return null;
- String id = persistable.getFactoryId();
- if(id == null)
- return null;
- for (int i = 0; i < editors.length; i++) {
- Editor e = (Editor)editors[i];
- if(name.equals(e.getName()) && id.equals(e.getFactoryId())) {
- IEditorPart editor = e.getEditor(true);
- if(editor != null) {
- if(input.equals(editor.getEditorInput()))
- return editor;
- }
- }
- }
- return null;
- }
- /**
- * Returns the SWT Display.
- */
- private Display getDisplay() {
- return window.getShell().getDisplay();
- }
- /**
- * Answer the number of editors.
- */
- public int getEditorCount() {
- return editorPresentation.getEditors().length;
- }
- /*
- * Answer the editor registry.
- */
- private IEditorRegistry getEditorRegistry() {
- return WorkbenchPlugin.getDefault().getEditorRegistry();
- }
- /*
- * See IWorkbenchPage.
- */
- public IEditorPart[] getDirtyEditors() {
- List dirtyEditors = collectDirtyEditors();
- return (IEditorPart[])dirtyEditors.toArray(new IEditorPart[dirtyEditors.size()]);
- }
- /*
- * See IWorkbenchPage.
- */
- public IEditorReference[] getEditors() {
- return editorPresentation.getEditors();
- }
- /*
- * See IWorkbenchPage#getFocusEditor
- */
- public IEditorPart getVisibleEditor() {
- if(editorPresentation.getVisibleEditor() == null)
- return null;
- return (IEditorPart)editorPresentation.getVisibleEditor().getPart(true);
- }
- /**
- * Answer true if save is needed in any one of the editors.
- */
- public boolean isSaveAllNeeded() {
- IEditorReference[] editors = editorPresentation.getEditors();
- for (int i = 0; i < editors.length; i++) {
- IEditorReference ed = editors[i];
- if (ed.isDirty())
- return true;
- }
- return false;
- }
- /*
- * @see IWorkbenchPage.
- */
- private IEditorReference openEditorFromInput(IEditorReference ref,IEditorInput editorInput, boolean setVisible) throws PartInitException {
- if (!(editorInput instanceof IFileEditorInput))
- throw new PartInitException(
- WorkbenchMessages.format(
- "EditorManager.unableToOpenEditor", //$NON-NLS-1$
- new Object[] { editorInput.getName() }));
-
- IFileEditorInput input = (IFileEditorInput)editorInput;
- IFile file = input.getFile();
- // If there is a registered editor for the file use it.
- EditorDescriptor desc = (EditorDescriptor) getEditorRegistry().getDefaultEditor(file);
- if (desc != null) {
- return openEditorFromDescriptor(ref,desc, input);
- }
-
- // Try to open an OLE editor.
- IEditorPart componentEditor = ComponentSupport.getComponentEditor(file);
- if (componentEditor != null) {
- createSite(componentEditor, desc, input);
- ((Editor)ref).setPart(componentEditor);
- createEditorTab(ref, null, input, setVisible);
- Workbench wb = (Workbench) window.getWorkbench();
- wb.getEditorHistory().add(input, desc);
- return ref;
- }
-
- // Try to open a system editor.
- if (testForSystemEditor(file)) {
- openSystemEditor(file);
- Workbench wb = (Workbench) window.getWorkbench();
- wb.getEditorHistory().add(input, desc);
- return null;
- }
-
- // There is no registered editor.
- // Use the default text editor.
- desc = (EditorDescriptor) getEditorRegistry().getDefaultEditor();
- return openEditorFromDescriptor(ref,desc, input);
- }
- /*
- * Prompt the user to save the reusable editor.
- * Return false if a new editor should be opened.
- */
- private IEditorReference findReusableEditor(EditorDescriptor desc) {
-
- IEditorReference editors[] = page.getSortedEditors();
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- boolean reuse = store.getBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN);
- if(!reuse)
- return null;
-
- if (editors.length < page.getEditorReuseThreshold())
- return null;
-
- IEditorReference dirtyEditor = null;
-
- //Find a editor to be reused
- for (int i = 0; i < editors.length; i++) {
- IEditorReference editor = editors[i];
- // if(editor == activePart)
- // continue;
- if (editor.isPinned())
- continue;
- if (editor.isDirty()) {
- if (dirtyEditor == null) //ensure least recently used
- dirtyEditor = editor;
- continue;
- }
- return editor;
- }
- if (dirtyEditor == null)
- return null;
-
- /*fix for 11122*/
- boolean reuseDirty = store.getBoolean(IPreferenceConstants.REUSE_DIRTY_EDITORS);
- if (!reuseDirty)
- return null;
-
- MessageDialog dialog =
- new MessageDialog(window.getShell(), WorkbenchMessages.getString("EditorManager.reuseEditorDialogTitle"), null, // accept the default window icon //$NON-NLS-1$
- WorkbenchMessages.format("EditorManager.saveChangesQuestion", new String[] { dirtyEditor.getName()}), //$NON-NLS-1$
- MessageDialog.QUESTION,
- new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, WorkbenchMessages.getString("EditorManager.openNewEditorLabel")}, //$NON-NLS-1$
- 0);
- int result = dialog.open();
- if (result == 0) { //YES
- ProgressMonitorDialog pmd = new ProgressMonitorDialog(dialog.getShell());
- pmd.open();
- dirtyEditor.getEditor(true).doSave(pmd.getProgressMonitor());
- pmd.close();
- } else if ((result == 2) || (result == -1)){
- return null;
- }
- return dirtyEditor;
- }
- /*
- * See IWorkbenchPage.
- */
- public IEditorReference openEditor(String editorId,IEditorInput input,boolean setVisible) throws PartInitException {
- if(editorId == null) {
- return openEditorFromInput(new Editor(),input,setVisible);
- } else {
- IEditorRegistry reg = getEditorRegistry();
- EditorDescriptor desc = (EditorDescriptor) reg.findEditor(editorId);
- if (desc == null) {
- throw new PartInitException(WorkbenchMessages.format("EditorManager.unknownEditorIDMessage", new Object[] { editorId })); //$NON-NLS-1$
- }
- IEditorReference result = openEditorFromDescriptor(new Editor(),desc, input);
- if(input instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput)input).getFile();
- if(file != null) {
- // Update the default editor for this file.
- IEditorDescriptor defaultDesc = (EditorDescriptor)getEditorRegistry().getDefaultEditor(file);
- if (defaultDesc == null)
- defaultDesc = (EditorDescriptor)getEditorRegistry().getDefaultEditor();
- String editorID = desc.getId();
- if(defaultDesc.getId().equals(editorId)) {
- getEditorRegistry().setDefaultEditor(file, null);
- } else {
- getEditorRegistry().setDefaultEditor(file, editorID);
- }
- }
- }
- return result;
- }
- }
- /*
- * Open a new
- */
- private IEditorReference openEditorFromDescriptor(IEditorReference ref,EditorDescriptor desc, IEditorInput input) throws PartInitException {
- IEditorReference result = ref;
- if (desc.isInternal()) {
- result = reuseInternalEditor(desc, input);
- if (result == null) {
- result = ref;
- openInternalEditor(ref,desc, input, true);
- }
- } else if (desc.isOpenInPlace()) {
- IEditorPart cEditor = ComponentSupport.getComponentEditor();
- if (cEditor == null) {
- return null;
- } else {
- createSite(cEditor, desc, input);
- ((Editor)ref).setPart(cEditor);
- createEditorTab(ref, desc, input, true);
- }
- } else if (desc.getId().equals(IWorkbenchConstants.SYSTEM_EDITOR_ID)) {
- if (input instanceof IFileEditorInput) {
- openSystemEditor(((IFileEditorInput) input).getFile());
- result = null;
- } else
- throw new PartInitException(WorkbenchMessages.getString("EditorManager.systemEditorError")); //$NON-NLS-1$
- } else {
- openExternalEditor(desc, input);
- result = null;
- }
- Workbench wb = (Workbench) window.getWorkbench();
- wb.getEditorHistory().add(input, desc);
- return result;
- }
- /**
- * Open an external viewer on an file. Throw up an error dialog if
- * an exception occurs.
- */
- private void openExternalEditor(final EditorDescriptor desc, final Object input) throws PartInitException {
- // Convert input to file.
- if (!(input instanceof IFileEditorInput))
- throw new PartInitException(WorkbenchMessages.format("EditorManager.errorOpeningExternalEditor", new Object[] { desc.getFileName(), desc.getId()})); //$NON-NLS-1$
- //$NON-NLS-1$
-
- final IFileEditorInput fileInput = (IFileEditorInput) input;
-
- //Must catch CoreException inside the runnable because
- //the Runnable.run() does not throw exceptions.
- final CoreException ex[] = new CoreException[1];
- // Start busy indicator.
- BusyIndicator.showWhile(getDisplay(), new Runnable() {
- public void run() {
- // Open an external editor.
- try {
- if (desc.getLauncher() != null) {
- // Open using launcher
- Object launcher = WorkbenchPlugin.createExtension(desc.getConfigurationElement(), "launcher"); //$NON-NLS-1$
- ((IEditorLauncher) launcher).open(fileInput.getFile());
- } else {
- // Open using command
- ExternalEditor oEditor = new ExternalEditor(fileInput.getFile(), desc);
- oEditor.open();
- }
- } catch (CoreException e) {
- ex[0] = e;
- }
- }
- });
-
- // Test the result.
- if (ex[0] != null) {
- throw new PartInitException(ex[0].getMessage()); //$NON-NLS-1$
- }
- }
- /*
- * Create the site and action bars for each inner editor.
- */
- private IEditorReference[] openMultiEditor(final IEditorReference ref, final MultiEditor part, final EditorDescriptor desc, final MultiEditorInput input, final boolean setVisible)
- throws PartInitException {
-
- String[] editorArray = input.getEditors();
- IEditorInput[] inputArray = input.getInput();
-
- //find all descriptors
- EditorDescriptor[] descArray = new EditorDescriptor[editorArray.length];
- IEditorReference refArray[] = new IEditorReference[editorArray.length];
- IEditorPart partArray[] = new IEditorPart[editorArray.length];
-
-
- IEditorRegistry reg = getEditorRegistry();
- for (int i = 0; i < editorArray.length; i++) {
- EditorDescriptor innerDesc = (EditorDescriptor) reg.findEditor(editorArray[i]);
- if (innerDesc == null)
- throw new PartInitException(WorkbenchMessages.format("EditorManager.unknownEditorIDMessage", new Object[] { editorArray[i] })); //$NON-NLS-1$
- descArray[i] = innerDesc;
- partArray[i] = createPart(descArray[i]);
- refArray[i] = new Editor();
- createSite(partArray[i],descArray[i],inputArray[i]);
- ((Editor)refArray[i]).setPart(partArray[i]);
- }
- part.setChildren(partArray);
- return refArray;
- }
- /*
- * Opens an editor part.
- */
- private void createEditorTab(final IEditorReference ref, final EditorDescriptor desc, final IEditorInput input, final boolean setVisible)
- throws PartInitException {
-
- //Check it there is already a tab for this ref.
- IEditorReference refs[] = editorPresentation.getEditors();
- for (int i = 0; i < refs.length; i++) {
- if(ref == refs[i])
- return;
- }
-
- final PartInitException ex[] = new PartInitException[1];
- BusyIndicator.showWhile(getDisplay(), new Runnable() {
- public void run() {
- try {
- if(input != null) {
- IEditorPart part = ref.getEditor(false);
- if (part != null && part instanceof MultiEditor) {
- IEditorReference refArray[] = openMultiEditor(ref, (MultiEditor)part, desc, (MultiEditorInput)input, setVisible);
- editorPresentation.openEditor(ref,refArray,setVisible);
- return;
- }
- }
- editorPresentation.openEditor(ref, setVisible);
- } catch (PartInitException e) {
- ex[0] = e;
- }
- }
- });
-
- // If the opening failed for any reason throw an exception.
- if (ex[0] != null)
- throw ex[0];
- }
- /*
- * Create the site and initialize it with its action bars.
- */
- private void createSite(final IEditorPart part, final EditorDescriptor desc, final IEditorInput input) throws PartInitException {
- EditorSite site = new EditorSite(part, page, desc);
- part.init(site, input);
- if (part.getSite() != site)
- throw new PartInitException(WorkbenchMessages.format("EditorManager.siteIncorrect", new Object[] { desc.getId()})); //$NON-NLS-1$
-
- if (desc != null)
- site.setActionBars(createEditorActionBars(desc));
- else
- site.setActionBars(createEmptyEditorActionBars());
- }
- /*
- * See IWorkbenchPage.
- */
- private IEditorReference reuseInternalEditor(EditorDescriptor desc, IEditorInput input) throws PartInitException {
- IEditorReference reusableEditorRef = findReusableEditor(desc);
- if (reusableEditorRef != null) {
- IEditorPart reusableEditor = reusableEditorRef.getEditor(false);
- if(reusableEditor == null) {
- IEditorReference result = new Editor();
- openInternalEditor(result,desc, input, true);
- page.closeEditor(reusableEditorRef,false);
- return result;
- }
- EditorSite site = (EditorSite) reusableEditor.getEditorSite();
- EditorDescriptor oldDesc = site.getEditorDescriptor();
- if (oldDesc == null)
- oldDesc = (EditorDescriptor) getEditorRegistry().getDefaultEditor();
- if ((desc.getId().equals(oldDesc.getId())) && (reusableEditor instanceof IReusableEditor)) {
- Workbench wb = (Workbench) window.getWorkbench();
- editorPresentation.moveEditor(reusableEditor, -1);
- wb.getEditorHistory().add(reusableEditor.getEditorInput(), site.getEditorDescriptor());
- ((IReusableEditor) reusableEditor).setInput(input);
- return reusableEditorRef;
- } else {
- //findReusableEditor(...) checks pinned and saves editor if necessary
- IEditorReference ref = new Editor();
- openInternalEditor(ref,desc, input, true);
- reusableEditor.getEditorSite().getPage().closeEditor(reusableEditor, false);
- return ref;
- }
- }
- return null;
- }
- /**
- * Open an internal editor on an file. Throw up an error dialog if
- * an exception occurs.
- */
- private void openInternalEditor(IEditorReference ref,final EditorDescriptor desc, IEditorInput input, boolean setVisible) throws PartInitException {
- // Create an editor instance.
- final IEditorPart editor = createPart(desc);
- // Open the instance.
- createSite(editor, desc, input);
- ((Editor)ref).setPart(editor);
- createEditorTab(ref, desc, input, setVisible);
- }
-
- private IEditorPart createPart(final EditorDescriptor desc) throws PartInitException {
- final IEditorPart editor[] = new IEditorPart[1];
- final Throwable ex[] = new Throwable[1];
- Platform.run(new SafeRunnable() {
- public void run() throws CoreException {
- editor[0] = (IEditorPart) WorkbenchPlugin.createExtension(desc.getConfigurationElement(), "class"); //$NON-NLS-1$
- }
- public void handleException(Throwable e) {
- ex[0] = e;
- }
- });
-
- if (ex[0] != null)
- throw new PartInitException(WorkbenchMessages.format("EditorManager.unableToInstantiate", new Object[] { desc.getId(), ex[0] })); //$NON-NLS-1$
- return editor[0];
- }
- /**
- * Open a system editor on the input file. Throw up an error dialog if
- * an error occurs.
- */
- public void openSystemEditor(final IFile input) throws PartInitException {
- // Start busy indicator.
- final boolean result[] = new boolean[1];
- BusyIndicator.showWhile(getDisplay(), new Runnable() {
- public void run() {
- // Open file using shell.
- String path = input.getLocation().toOSString();
- result[0] = Program.launch(path);
- }
- });
-
- // ShellExecute returns whether call was successful
- if (!result[0]) {
- throw new PartInitException(WorkbenchMessages.format("EditorManager.unableToOpenExternalEditor", new Object[] { input.getName()})); //$NON-NLS-1$
- }
- }
-
- private ImageDescriptor findImage(EditorDescriptor desc,IFile file) {
- ImageDescriptor iDesc;
- if(desc != null) {
- iDesc = desc.getImageDescriptor();
- } else if(file != null && (testForSystemEditor(file) || ComponentSupport.testForOleEditor(file))) {
- iDesc = PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(file);;
- } else {
- // There is no registered editor.
- // Use the default text editor's.
- IEditorRegistry reg = getEditorRegistry();
- iDesc = reg.getDefaultEditor().getImageDescriptor();
- }
- return iDesc;
- }
- /**
- * @see IPersistablePart
- */
- public IStatus restoreState(IMemento memento) {
- // Restore the editor area workbooks layout/relationship
- final MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.getString("EditorManager.problemsRestoringEditors"),null);
- final String activeWorkbookID[] = new String[1];
- final ArrayList visibleEditors = new ArrayList(5);
- final IEditorPart activeEditor[] = new IEditorPart[1];
- final ArrayList errorWorkbooks = new ArrayList(1);
-
- IMemento areaMem = memento.getChild(IWorkbenchConstants.TAG_AREA);
- if (areaMem != null) {
- result.add(editorPresentation.restoreState(areaMem));
- activeWorkbookID[0] = areaMem.getString(IWorkbenchConstants.TAG_ACTIVE_WORKBOOK);
- }
-
- // Loop through the editors.
-
- IMemento[] editorMems = memento.getChildren(IWorkbenchConstants.TAG_EDITOR);
- for (int x = 0; x < editorMems.length; x++) {
- final IMemento editorMem = editorMems[x];
- String strFocus = editorMem.getString(IWorkbenchConstants.TAG_FOCUS);
- boolean visibleEditor = "true".equals(strFocus); //$NON-NLS-1$
- if(visibleEditor) {
- Editor e = new Editor();
- e.setPinned("true".equals(editorMem.getString(IWorkbenchConstants.TAG_PINNED)));
- visibleEditors.add(e);
- page.addPart(e);
- result.add(restoreEditor(e,editorMem));
- if(e.getPart(true) != null) {
- String strActivePart = editorMem.getString(IWorkbenchConstants.TAG_ACTIVE_PART);
- if ("true".equals(strActivePart)) //$NON-NLS-1$
- activeEditor[0] = (IEditorPart)e.getPart(true);
- } else {
- page.closeEditor(e,false);
- visibleEditors.remove(e);
- errorWorkbooks.add(editorMem.getString(IWorkbenchConstants.TAG_WORKBOOK));
- }
- } else {
- String editorTitle = editorMem.getString(IWorkbenchConstants.TAG_TITLE);
- String editorName = editorMem.getString(IWorkbenchConstants.TAG_NAME);
- String editorID = editorMem.getString(IWorkbenchConstants.TAG_ID);
- boolean pinned = "true".equals(editorMem.getString(IWorkbenchConstants.TAG_PINNED));
- IMemento inputMem = editorMem.getChild(IWorkbenchConstants.TAG_INPUT);
- String factoryID = inputMem.getString(IWorkbenchConstants.TAG_FACTORY_ID);
- if (factoryID == null)
- WorkbenchPlugin.log("Unable to restore editor - no input factory ID."); //$NON-NLS-1$
-
- if(editorTitle == null) { //backward compatible format of workbench.xml
- Editor e = new Editor();
- e.setPinned("true".equals(editorMem.getString(IWorkbenchConstants.TAG_PINNED)));
- result.add(restoreEditor(e,editorMem));
- page.addPart(e);
- } else {
- // Get the editor descriptor.
- EditorDescriptor desc = null;
- if (editorID != null) {
- IEditorRegistry reg = WorkbenchPlugin.getDefault().getEditorRegistry();
- desc = (EditorDescriptor) reg.findEditor(editorID);
- }
- IFile file = null;
- if(desc == null) {
- String path = editorMem.getString(IWorkbenchConstants.TAG_PATH);
- IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(path));
- if (res instanceof IFile)
- file = (IFile)res;
- }
- ImageDescriptor iDesc = findImage(desc,file);
-
- String tooltip = editorMem.getString(IWorkbenchConstants.TAG_TOOLTIP);
- if(tooltip == null) tooltip = "";
-
- Editor e = new Editor(editorID,editorMem,editorName,editorTitle,tooltip,iDesc,factoryID,pinned);
- page.addPart(e);
- try {
- createEditorTab(e,null,null,false);
- } catch (PartInitException ex) {
- result.add(ex.getStatus());
- }
- }
- }
- }
-
- Platform.run(new SafeRunnable() {
- public void run() {
- // Update each workbook with its visible editor.
- for (int i = 0; i < visibleEditors.size(); i++)
- setVisibleEditor((IEditorReference) visibleEditors.get(i), false);
- for (Iterator iter = errorWorkbooks.iterator(); iter.hasNext();) {
- iter.next();
- editorPresentation.setActiveEditorWorkbookFromID(activeWorkbookID[0]);
- editorPresentation.fixVisibleEditor();
- }
-
- // Update the active workbook
- if (activeWorkbookID[0] != null)
- editorPresentation.setActiveEditorWorkbookFromID(activeWorkbookID[0]);
-
- if (activeEditor[0] != null)
- page.activate(activeEditor[0]);
- }
- public void handleException(Throwable e) {
- //The exception is already logged.
- result.add(new Status(
- IStatus.ERROR,PlatformUI.PLUGIN_ID,0,
- WorkbenchMessages.getString("EditorManager.exceptionRestoringEditor"),e));
- }
- });
- return result;
- }
- public IStatus restoreEditor(final Editor ref,final IMemento editorMem) {
- final IStatus result[] = new IStatus[1];
- BusyIndicator.showWhile(
- Display.getCurrent(),
- new Runnable() {
- public void run() {
- result[0] = busyRestoreEditor(ref,editorMem);
- }
- });
- return result[0];
- }
- public IStatus busyRestoreEditor(final Editor ref,final IMemento editorMem) {
- final IStatus result[] = new IStatus[1];
- Platform.run(new SafeRunnable() {
- public void run() {
- // Get the input factory.
- IMemento inputMem = editorMem.getChild(IWorkbenchConstants.TAG_INPUT);
- String factoryID = inputMem.getString(IWorkbenchConstants.TAG_FACTORY_ID);
- if (factoryID == null) {
- WorkbenchPlugin.log("Unable to restore editor - no input factory ID."); //$NON-NLS-1$
- result[0] = unableToCreateEditor(editorMem,null);
- return;
- }
- IElementFactory factory = WorkbenchPlugin.getDefault().getElementFactory(factoryID);
- if (factory == null) {
- WorkbenchPlugin.log("Unable to restore editor - cannot instantiate input element factory: " + factoryID); //$NON-NLS-1$
- result[0] = unableToCreateEditor(editorMem,null);
- return;
- }
-
- // Get the input element.
- IAdaptable input = factory.createElement(inputMem);
- if (input == null) {
- WorkbenchPlugin.log("Unable to restore editor - createElement returned null for input element factory: " + factoryID); //$NON-NLS-1$
- result[0] = unableToCreateEditor(editorMem,null);
- return;
- }
- if (!(input instanceof IEditorInput)) {
- WorkbenchPlugin.log("Unable to restore editor - createElement result is not an IEditorInput for input element factory: " + factoryID); //$NON-NLS-1$
- result[0] = unableToCreateEditor(editorMem,null);
- return;
- }
- IEditorInput editorInput = (IEditorInput) input;
-
- // Get the editor descriptor.
- String editorID = editorMem.getString(IWorkbenchConstants.TAG_ID);
- EditorDescriptor desc = null;
- if (editorID != null) {
- IEditorRegistry reg = WorkbenchPlugin.getDefault().getEditorRegistry();
- desc = (EditorDescriptor) reg.findEditor(editorID);
- }
-
- // Open the editor.
- try {
- String workbookID = editorMem.getString(IWorkbenchConstants.TAG_WORKBOOK);
- editorPresentation.setActiveEditorWorkbookFromID(workbookID);
- if (desc == null) {
- openEditorFromInput(ref,editorInput, false);
- } else {
- openInternalEditor(ref,desc, editorInput, false);
- }
- ref.getPane().createChildControl();
- } catch (PartInitException e) {
- WorkbenchPlugin.log("Exception creating editor: " + e.getMessage()); //$NON-NLS-1$
- result[0] = unableToCreateEditor(editorMem,e);
- }
- }
- public void handleException(Throwable e) {
- result[0] = unableToCreateEditor(editorMem,e);
- }
- });
- if(result[0] != null)
- return result[0];
- else
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
- }
- /**
- * Returns an error status to be displayed when unable to create an editor.
- */
- private IStatus unableToCreateEditor(IMemento editorMem,Throwable t) {
- String name = editorMem.getString(IWorkbenchConstants.TAG_NAME);
- return new Status(
- IStatus.ERROR,PlatformUI.PLUGIN_ID,0,
- WorkbenchMessages.format("EditorManager.unableToCreateEditor",new String[]{name}),t);
- }
- /**
- * Runs a progress monitor operation.
- * Returns true if success, false if cancelled.
- */
- private static boolean runProgressMonitorOperation(String opName, final IRunnableWithProgress progressOp,IWorkbenchWindow window) {
- IRunnableContext ctx;
- if (window instanceof ApplicationWindow) {
- ctx = window;
- } else {
- ctx = new ProgressMonitorDialog(window.getShell());
- }
- final boolean[] wasCanceled = new boolean[1];
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- progressOp.run(monitor);
- wasCanceled[0] = monitor.isCanceled();
- }
- };
-
- try {
- ctx.run(false, true, runnable);
- } catch (InvocationTargetException e) {
- String title = WorkbenchMessages.format("EditorManager.operationFailed", new Object[] { opName }); //$NON-NLS-1$
- Throwable targetExc = e.getTargetException();
- WorkbenchPlugin.log(title, new Status(Status.WARNING, PlatformUI.PLUGIN_ID, 0, title, targetExc));
- MessageDialog.openError(window.getShell(), WorkbenchMessages.getString("Error"), //$NON-NLS-1$
- title + ':' + targetExc.getMessage());
- } catch (InterruptedException e) {
- // Ignore. The user pressed cancel.
- }
- return !wasCanceled[0];
- }
- /**
- * Save all of the editors in the workbench.
- * Return true if successful. Return false if the
- * user has cancelled the command.
- */
- public boolean saveAll(boolean confirm, boolean closing) {
- // Get the list of dirty editors. If it is
- // empty just return.
- List dirtyEditors = collectDirtyEditors();
- if (dirtyEditors.size() == 0)
- return true;
-
- // If confirmation is required ..
- return saveAll(dirtyEditors,confirm,window); //$NON-NLS-1$
- }
-
- public static boolean saveAll(List dirtyEditors,boolean confirm,final IWorkbenchWindow window) {
- if (confirm) {
- // Convert the list into an element collection.
- AdaptableList input = new AdaptableList();
- input.add(dirtyEditors.iterator());
-
- ListSelectionDialog dlg =
- new ListSelectionDialog(window.getShell(), input, new WorkbenchContentProvider(), new WorkbenchPartLabelProvider(), RESOURCES_TO_SAVE_MESSAGE);
-
- dlg.setInitialSelections(dirtyEditors.toArray(new Object[dirtyEditors.size()]));
- dlg.setTitle(SAVE_RESOURCES_TITLE);
- int result = dlg.open();
-
- //Just return false to prevent the operation continuing
- if (result == IDialogConstants.CANCEL_ID)
- return false;
-
- dirtyEditors = Arrays.asList(dlg.getResult());
- if (dirtyEditors == null)
- return false;
-
- // If the editor list is empty return.
- if (dirtyEditors.size() == 0)
- return true;
- }
-
- // Create save block.
- final List finalEditors = dirtyEditors;
- final IWorkspaceRunnable workspaceOp = new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- monitor.beginTask("", finalEditors.size()); //$NON-NLS-1$
- Iterator enum = finalEditors.iterator();
- while (enum.hasNext()) {
- IEditorPart part = (IEditorPart) enum.next();
- part.doSave(new SubProgressMonitor(monitor, 1));
- if (monitor.isCanceled())
- break;
- }
- }
- };
- IRunnableWithProgress progressOp = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- try {
- IProgressMonitor monitorWrap = new EventLoopProgressMonitor(monitor);
- ResourcesPlugin.getWorkspace().run(workspaceOp, monitorWrap);
- } catch (CoreException e) {
- IStatus status = new Status(Status.WARNING, PlatformUI.PLUGIN_ID, 0, WorkbenchMessages.getString("EditorManager.saveFailed"), e); //$NON-NLS-1$
- WorkbenchPlugin.log(WorkbenchMessages.getString("EditorManager.saveFailed"), status); //$NON-NLS-1$
- ErrorDialog.openError(
- window.getShell(),
- WorkbenchMessages.getString("Error"), //$NON-NLS-1$
- WorkbenchMessages.format("EditorManager.saveFailedMessage", new Object[] { e.getMessage()}), //$NON-NLS-1$
- e.getStatus());
- }
- }
- };
-
- // Do the save.
- return runProgressMonitorOperation(WorkbenchMessages.getString("Save_All"), progressOp,window); //$NON-NLS-1$
- }
- /**
- * Save and close an editor.
- * Return true if successful. Return false if the
- * user has cancelled the command.
- */
- public boolean saveEditor(final IEditorPart part, boolean confirm) {
- // Short circuit.
- if (!part.isDirty())
- return true;
-
- // If confirmation is required ..
- if (confirm) {
- String message = WorkbenchMessages.format("EditorManager.saveChangesQuestion", new Object[] { part.getTitle()}); //$NON-NLS-1$
- // Show a dialog.
- String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL };
- MessageDialog d = new MessageDialog(
- window.getShell(), WorkbenchMessages.getString("Save_Resource"), //$NON-NLS-1$
- null, message, MessageDialog.QUESTION, buttons, 0);
- int choice = d.open();
-
- // Branch on the user choice.
- // The choice id is based on the order of button labels above.
- switch (choice) {
- case 0 : //yes
- break;
- case 1 : //no
- return true;
- default :
- case 2 : //cancel
- return false;
- }
- }
-
- // Create save block.
- IRunnableWithProgress progressOp = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) {
- IProgressMonitor monitorWrap = new EventLoopProgressMonitor(monitor);
- part.doSave(monitorWrap);
- }
- };
-
- // Do the save.
- return runProgressMonitorOperation(WorkbenchMessages.getString("Save"), progressOp,window); //$NON-NLS-1$
- }
- /**
- * @see IPersistablePart
- */
- public IStatus saveState(final IMemento memento) {
-
- final MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.getString("EditorManager.problemsSavingEditors"),null);
-
- // Save the editor area workbooks layout/relationship
- IMemento editorAreaMem = memento.createChild(IWorkbenchConstants.TAG_AREA);
- result.add(editorPresentation.saveState(editorAreaMem));
-
- // Save the active workbook id
- editorAreaMem.putString(IWorkbenchConstants.TAG_ACTIVE_WORKBOOK, editorPresentation.getActiveEditorWorkbookID());
-
- // Save each open editor.
- IEditorReference editors[] = editorPresentation.getEditors();
- for (int i = 0; i < editors.length; i++) {
- IEditorReference editorReference = (IEditorReference)editors[i];
- final IEditorPart editor = editorReference.getEditor(false);
- if(editor == null) {
- IMemento editorMem = memento.createChild(IWorkbenchConstants.TAG_EDITOR);
- editorMem.putMemento(((Editor)editorReference).getMemento());
- continue;
- }
- final EditorSite site = (EditorSite)editor.getEditorSite();
- if(site.getPane() instanceof MultiEditorInnerPane)
- continue;
-
- Platform.run(new SafeRunnable() {
- public void run() {
- // Get the input.
- IEditorInput input = editor.getEditorInput();
- IPersistableElement persistable = input.getPersistable();
- if (persistable == null)
- return;
-
- // Save editor.
- IMemento editorMem = memento.createChild(IWorkbenchConstants.TAG_EDITOR);
- editorMem.putString(IWorkbenchConstants.TAG_TITLE,editor.getTitle());
- editorMem.putString(IWorkbenchConstants.TAG_NAME,input.getName());
- editorMem.putString(IWorkbenchConstants.TAG_ID, editor.getSite().getId());
- editorMem.putString(IWorkbenchConstants.TAG_TOOLTIP, editor.getTitleToolTip()); //$NON-NLS-1$
-
- if(!site.getReuseEditor())
- editorMem.putString(IWorkbenchConstants.TAG_PINNED,"true");
-
- EditorPane editorPane = (EditorPane) ((EditorSite) editor.getEditorSite()).getPane();
- editorMem.putString(IWorkbenchConstants.TAG_WORKBOOK, editorPane.getWorkbook().getID());
-
- if (editor == page.getActivePart())
- editorMem.putString(IWorkbenchConstants.TAG_ACTIVE_PART, "true"); //$NON-NLS-1$
-
- if (editorPane == editorPane.getWorkbook().getVisibleEditor())
- editorMem.putString(IWorkbenchConstants.TAG_FOCUS, "true"); //$NON-NLS-1$
-
- if (input instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput)input).getFile();
- editorMem.putString(IWorkbenchConstants.TAG_PATH,file.getFullPath().toString());
- }
-
- // Save input.
- IMemento inputMem = editorMem.createChild(IWorkbenchConstants.TAG_INPUT);
- inputMem.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable.getFactoryId());
- persistable.saveState(inputMem);
- }
- public void handleException(Throwable e) {
- result.add(new Status(
- IStatus.ERROR,PlatformUI.PLUGIN_ID,0,
- WorkbenchMessages.format("EditorManager.unableToSaveEditor",new String[]{editor.getTitle()}),
- e));
- }
- });
- }
- return result;
- }
- /**
- * Shows an editor. If <code>setFocus == true</code> then
- * give it focus, too.
- *
- * @return true if the active editor was changed, false if not.
- */
- public boolean setVisibleEditor(IEditorReference newEd, boolean setFocus) {
- return editorPresentation.setVisibleEditor(newEd, setFocus);
- }
- /**
- * Answer true if a system editor exists for the input file.
- * @see openSystemEditor.
- */
- private boolean testForSystemEditor(IFile input) {
- String strName = input.getName();
- int nDot = strName.lastIndexOf('.');
- if (nDot >= 0) {
- strName = strName.substring(nDot);
- return Program.findProgram(strName) != null;
- }
- return false;
- }
-
- private class Editor extends WorkbenchPartReference implements IEditorReference {
-
- private IMemento editorMemento;
- private String name;
- private String factoryId;
- private boolean pinned = false;
-
- Editor(String id,IMemento memento,String name,String title,String tooltip,ImageDescriptor desc,String factoryId,boolean pinned) {
- init(id,title,tooltip,desc);
- this.editorMemento = memento;
- this.name = name;
- this.factoryId = factoryId;
- this.pinned = pinned;
- //make it backward compatible.
- if(this.name == null)
- this.name = title;
- }
- Editor() {
- this.name = name;
- }
-
- public String getFactoryId() {
- IEditorPart part = getEditor(false);
- if(part != null) {
- IPersistableElement persistable = part.getEditorInput().getPersistable();
- if(persistable != null)
- return persistable.getFactoryId();
- return null;
- }
- return factoryId;
- }
- public String getName() {
- if(part != null)
- return getEditor(false).getEditorInput().getName();
- return name;
- }
- public String getRegisteredName() {
- if(part != null)
- return part.getSite().getRegisteredName();
- return getName();
- }
- public IWorkbenchPart getPart(boolean restore) {
- return getEditor(restore);
- }
- public IEditorPart getEditor(boolean restore) {
- if(part != null)
- return (IEditorPart)part;
- if(!restore || editorMemento == null)
- return null;
-
- IStatus status = restoreEditor(this,editorMemento);
- Workbench workbench = (Workbench)window.getWorkbench();
- if(status.getSeverity() == IStatus.ERROR) {
- editorMemento = null;
- page.closeEditor(this,false);
- if(!workbench.isStarting()) {
- ErrorDialog.openError(
- window.getShell(),
- WorkbenchMessages.getString("EditorManager.unableToRestoreEditorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("EditorManager.unableToRestoreEditorMessage",new String[]{getName()}), //$NON-NLS-1$
- status,
- IStatus.WARNING | IStatus.ERROR);
- }
- }
- setPane(getPane());
- releaseReferences();
- return (IEditorPart)part;
- }
- public void releaseReferences() {
- super.releaseReferences();
- editorMemento = null;
- name = null;
- factoryId = null;
- }
-
- public void setPart(IWorkbenchPart part) {
- super.setPart(part);
- EditorSite site = (EditorSite)part.getSite();
- if(site != null) {
- site.setReuseEditor(!pinned);
- }
- }
- public IMemento getMemento() {
- return editorMemento;
- }
- public boolean isDirty() {
- if(part == null)
- return false;
- return ((IEditorPart)part).isDirty();
- }
- public boolean isPinned() {
- if(part != null)
- return !((EditorSite)((IEditorPart)part).getEditorSite()).getReuseEditor();
- return pinned;
- }
- public void setPinned(boolean pinned) {
- this.pinned = pinned;
- }
- public IWorkbenchPage getPage() {
- return page;
- }
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 81199db..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorMenuManager.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.RetargetAction;
-
-import java.util.*;
-
-/**
- * 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 IMenuManager parentMgr;
- private ArrayList wrappers;
- 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
- IContributionItem[] items = EditorMenuManager.super.getItems();
- for (int i = 0; i < items.length; i++) {
- IContributionItem item = items[i];
- 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);
- }
- }
- }
- public Boolean getEnabled(IContributionItem item) {
- if (((item instanceof ActionContributionItem) &&
- (((ActionContributionItem)item).getAction() instanceof RetargetAction)) ||
- enabledAllowed)
- return null;
- else
- return Boolean.FALSE;
- }
- public Integer getAccelerator(IContributionItem item) {
- if (getEnabled(item) == null)
- return parentMgr.getOverrides().getAccelerator(item);
- else
- // no acclerator if the item is disabled
- return new Integer(0);
- }
- public String getAcceleratorText(IContributionItem item) {
- return parentMgr.getOverrides().getAcceleratorText(item);
- }
- public String getText(IContributionItem item) {
- return parentMgr.getOverrides().getText(item);
- }
- }
- private Overrides overrides = new Overrides();
-/**
- * Constructs a new editor manager.
- */
-public EditorMenuManager(IMenuManager mgr) {
- super(mgr);
- parentMgr = mgr;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionItem[] getItems() {
- return parentMgr.getItems();
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionManagerOverrides getOverrides() {
- return overrides;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- * Inserts the new item after any action set contributions which may
- * exist within the toolbar to ensure a consistent order for actions.
- */
-public void insertAfter(String id, IContributionItem item) {
- IContributionItem refItem = PluginActionSetBuilder.findInsertionPoint(id,
- null, parentMgr, false);
- if (refItem != null) {
- super.insertAfter(refItem.getId(), item);
- } else {
- WorkbenchPlugin.log("Reference item " + id + " not found for action " + item.getId()); //$NON-NLS-1$
- }
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- * Inserts the new item after any action set contributions which may
- * exist within the toolbar to ensure a consistent order for actions.
- */
-public void prependToGroup(String groupName, IContributionItem item) {
- insertAfter(groupName, item);
-}
-/**
- * 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)
- setEnabledAllowed(false);
- }
- if (!isVisible())
- setVisible(true);
- }
- else {
- if (forceVisibility)
- // Remove the editor menu items
- setVisible(false);
- else
- // Disable the editor menu items.
- 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)
- return;
- this.enabledAllowed = enabledAllowed;
- overrides.updateEnabledAllowed();
-}
-/* (non-Javadoc)
- * Method declared on SubMenuManager.
- */
-protected SubMenuManager wrapMenu(IMenuManager menu) {
- if (wrappers == null)
- wrappers = new ArrayList();
- EditorMenuManager manager = new EditorMenuManager(menu);
- wrappers.add(manager);
- return manager;
-}
-
-protected IAction[] getAllContributedActions() {
- HashSet set = new HashSet();
- getAllContributedActions(set);
- return (IAction[])set.toArray(new IAction[set.size()]);
-}
-protected void getAllContributedActions(HashSet set) {
- IContributionItem[] items = super.getItems();
- for (int i = 0; i < items.length; i++)
- getAllContributedActions(set, items[i]);
- 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) {
- IContributionItem subItems[] = ((MenuManager)item).getItems();
- for (int j = 0; j < subItems.length; j++)
- getAllContributedActions(set,subItems[j]);
- } else if(item instanceof ActionContributionItem) {
- set.add(((ActionContributionItem)item).getAction());
- }
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPane.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPane.java
deleted file mode 100644
index c6acee3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPane.java
+++ /dev/null
@@ -1,247 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * An EditorPane is a subclass of PartPane offering extended
- * behavior for workbench editors.
- */
-public class EditorPane extends PartPane {
- private EditorWorkbook workbook;
- private PinEditorAction pinEditorAction;
-/**
- * Constructs an editor pane for an editor part.
- */
-public EditorPane(IEditorReference ref, WorkbenchPage page, EditorWorkbook workbook) {
- super(ref, page);
- this.workbook = workbook;
-}
-protected WorkbenchPart createErrorPart(WorkbenchPart oldPart) {
- class ErrorEditorPart extends EditorPart {
- private Text text;
- public void doSave(IProgressMonitor monitor) {}
- public void doSaveAs() {}
- public void gotoMarker(IMarker marker) {}
- public void init(IEditorSite site, IEditorInput input) {
- setSite(site);
- setInput(input);
- }
- public boolean isDirty() {return false;}
- public boolean isSaveAsAllowed() {return false;}
- public void createPartControl(Composite parent) {
- 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.getString("EditorPane.errorMessage")); //$NON-NLS-1$
- }
- public void setFocus() {
- if (text != null) text.setFocus();
- }
- protected void setTitle(String title) {
- super.setTitle(title);
- }
- protected void setTitleToolTip(String text) {
- super.setTitleToolTip(text);
- }
- }
- IEditorPart oldEditorPart = (IEditorPart)oldPart;
- EditorSite oldEditorSite = (EditorSite)oldEditorPart.getEditorSite();
- ErrorEditorPart newPart = new ErrorEditorPart();
- newPart.setTitle(oldPart.getTitle());
- newPart.setTitleToolTip(oldPart.getTitleToolTip());
- oldEditorSite.setPart(newPart);
- newPart.init(oldEditorSite, oldEditorPart.getEditorInput());
- return newPart;
-}
-/**
- * Editor panes do not need a title bar. The editor
- * title and close icon are part of the tab containing
- * the editor. Tools and menus are added directly into
- * the workbench toolbar and menu bar.
- */
-protected void createTitleBar() {
- // do nothing
-}
-/**
- * @see PartPane::doHide
- */
-public void doHide() {
- getPage().closeEditor(getEditorReference(), true);
-}
-/**
- * Answer the editor part child.
- */
-public IEditorReference getEditorReference() {
- return (IEditorReference)getPartReference();
-}
-/**
- * Answer the SWT widget style.
- */
-int getStyle() {
- return SWT.NONE;
-}
-/**
- * Answer the editor workbook container
- */
-public EditorWorkbook getWorkbook() {
- return workbook;
-}
-/**
- * See LayoutPart
- */
-public boolean isDragAllowed(Point p) {
- // See also similar restrictions in addMoveItems method
-
- if (workbook.overImage(this, p.x))
- return false;
-
- int wbCount = workbook.getEditorArea().getEditorWorkbookCount();
- int editorCount = workbook.getItemCount();
- if (isZoomed())
- return editorCount > 1;
- else
- return editorCount > 1 || wbCount > 1;
-}
-
-/**
- * Notify the workbook page that the part pane has
- * been activated by the user.
- */
-protected void requestActivation() {
- // By clearing the active workbook if its not the one
- // associated with the editor, we reduce draw flicker
- if (!workbook.isActiveWorkbook())
- workbook.getEditorArea().setActiveWorkbook(null, false);
-
- super.requestActivation();
-}
-/**
- * Set the editor workbook container
- */
-public void setWorkbook(EditorWorkbook editorWorkbook) {
- workbook = editorWorkbook;
-}
-/* (non-Javadoc)
- * Method declared on PartPane.
- */
-/* package */ void shellActivated() {
- this.workbook.drawGradient();
-}
-
-/* (non-Javadoc)
- * Method declared on PartPane.
- */
-/* package */ void shellDeactivated() {
- this.workbook.drawGradient();
-}
-/**
- * Indicate focus in part.
- */
-public void showFocus(boolean inFocus) {
- if (inFocus)
- this.workbook.becomeActiveWorkbook(true);
- else
- this.workbook.tabFocusHide();
-}
-/**
- * Add the Editor and Tab Group items to the Move menu.
- */
-protected void addMoveItems(Menu moveMenu) {
- // See also similar restrictions in isDragAllowed method
- // No need to worry about mouse cursor over image.
-
- int wbCount = workbook.getEditorArea().getEditorWorkbookCount();
- int editorCount = workbook.getItemCount();
-
- MenuItem item = new MenuItem(moveMenu, SWT.NONE);
- item.setText(WorkbenchMessages.getString("EditorPane.moveEditor")); //$NON-NLS-1$
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- workbook.openTracker(EditorPane.this);
- }
- });
- if (isZoomed())
- item.setEnabled(editorCount > 1);
- else
- item.setEnabled(editorCount > 1 || wbCount > 1);
-
- item = new MenuItem(moveMenu, SWT.NONE);
- item.setText(WorkbenchMessages.getString("EditorPane.moveFolder")); //$NON-NLS-1$
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- workbook.openTracker(getWorkbook());
- }
- });
- if (isZoomed())
- item.setEnabled(false);
- else
- item.setEnabled(wbCount > 1);
-}
-/**
- * Set the action to pin/unpin an editor.
- */
-protected void setPinEditorAction(PinEditorAction action) {
- pinEditorAction = action;
-}
-/**
- * Add the pin menu item on the editor system menu
- */
-protected void addPinEditorItem(Menu parent) {
- // add fast view item
- if(pinEditorAction == null || !pinEditorAction.getVisible())
- return;
-
- final MenuItem item = new MenuItem(parent, SWT.CHECK);
- item.setText(WorkbenchMessages.getString("EditorPane.pinEditor")); //$NON-NLS-1$
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if(pinEditorAction != null) {
- pinEditorAction.setChecked(!pinEditorAction.isChecked());
- pinEditorAction.run();
- }
- }
- });
- item.setEnabled(pinEditorAction.isEnabled());
- item.setSelection(pinEditorAction.isChecked());
-}
-
-/**
- * Return the sashes around this part.
- */
-protected Sashes findSashes() {
- Sashes result = new Sashes();
- workbook.getEditorArea().findSashes(workbook,result);
- return result;
-}
-/**
- * Update the title attributes for the pane.
- */
-public void updateTitles() {
- workbook.updateEditorTab(getEditorReference());
-}
-/**
- * Show a title label menu for this pane.
- */
-public void showPaneMenu() {
- workbook.showPaneMenu();
-}
-/**
- * Show the context menu for this part.
- */
-public void showViewMenu(){
- //Do nothing. Editors do not have menus
-}
-}
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
deleted file mode 100644
index f9990b1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPluginAction.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.*;
-/**
- * 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;
-/**
- * This class adds the requirement that action delegates
- * loaded on demand implement IViewActionDelegate
- */
-public EditorPluginAction(IConfigurationElement actionElement, String runAttribute, IEditorPart part,String definitionId) {
- super(actionElement, runAttribute,definitionId);
- if (part != null)
- editorChanged(part);
-}
-
-/**
- * Initialize an action delegate.
- * Subclasses may override this.
- */
-protected IActionDelegate initDelegate(Object obj)
- throws WorkbenchException
-{
- if (obj instanceof IEditorActionDelegate) {
- IEditorActionDelegate ead = (IEditorActionDelegate)obj;
- ead.setActiveEditor(this, currentEditor);
- return ead;
- } else
- throw new WorkbenchException("Action must implement IEditorActionDelegate"); //$NON-NLS-1$
-}
-
-/**
- * Handles editor change by re-registering for selection
- * changes and updating IEditorActionDelegate.
- */
-public void editorChanged(IEditorPart part) {
- if (currentEditor!=null) {
- unregisterSelectionListener(currentEditor);
- }
- currentEditor = part;
- if (getDelegate() == null) {
- if (isOkToCreateDelegate())
- createDelegate();
- }
- if (getDelegate() != null) {
- IEditorActionDelegate editorDelegate = (IEditorActionDelegate)getDelegate();
- editorDelegate.setActiveEditor(this, part);
- }
- registerSelectionListener(part);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPresentation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPresentation.java
deleted file mode 100644
index dbc6951..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorPresentation.java
+++ /dev/null
@@ -1,441 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.EditorPart;
-import org.eclipse.ui.part.MultiEditor;
-
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FillLayout;
-
-/**
- * EditorPresentation is a wrapper for PartTabworkbook.
- */
-public class EditorPresentation {
- private WorkbenchPage page;
- private ArrayList editorTable = new ArrayList(4);
- private Map mapEditorToPane = new HashMap(11);
- private EditorArea editorArea;
-/**
- * Creates a new EditorPresentation.
- */
-public EditorPresentation(WorkbenchPage workbenchPage, Listener mouseDownListener) {
- IPartDropListener partDropListener = new IPartDropListener() {
- public void dragOver(PartDropEvent e) {
- onPartDragOver(e);
- };
- public void drop(PartDropEvent e){
- onPartDrop(e);
- };
- };
-
- this.page = workbenchPage;
- this.editorArea = new EditorArea(IPageLayout.ID_EDITOR_AREA, partDropListener,
- mouseDownListener);
-}
-/**
- * Closes all of the editors.
- */
-public void closeAllEditors() {
- editorArea.removeAllEditors();
- ArrayList editorsToDispose = (ArrayList) editorTable.clone();
- editorTable.clear();
- for (int i = 0; i < editorsToDispose.size(); i++){
- ((EditorPane)editorsToDispose.get(i)).dispose();
- }
-}
-/**
- * Closes an editor.
- *
- * @param part the editor to close
- */
-public void closeEditor(IEditorReference ref) {
- EditorPane pane = (EditorPane)((WorkbenchPartReference)ref).getPane();
- closeEditor(pane);
-}
-/**
- * Closes an editor.
- *
- * @param part the editor to close
- */
-public void closeEditor(IEditorPart part) {
- EditorPane pane = (EditorPane)((PartSite)part.getEditorSite()).getPane();
- closeEditor(pane);
-}
-/**
- * Closes an editor.
- *
- * @param part the editor to close
- */
-private void closeEditor(EditorPane pane) {
- if (pane != null) {
- if (!(pane instanceof MultiEditorInnerPane))
- editorArea.removeEditor(pane);
- editorTable.remove(pane);
- pane.dispose();
- }
-}
-/**
- * Deref a given part. Deconstruct its container as required.
- * Do not remove drag listeners.
- */
-private void derefPart(LayoutPart part) {
- // Get vital part stats before reparenting.
- ILayoutContainer oldContainer = part.getContainer();
-
- // Reparent the part back to the main window
- part.reparent(editorArea.getParent());
- // Update container.
- if (oldContainer == null)
- return;
- oldContainer.remove(part);
- LayoutPart[] children = oldContainer.getChildren();
- if (children == null || children.length == 0){
- // There are no more children in this container, so get rid of it
- if (oldContainer instanceof LayoutPart) {
- LayoutPart parent = (LayoutPart)oldContainer;
- ILayoutContainer parentContainer = parent.getContainer();
- if (parentContainer != null) {
- parentContainer.remove(parent);
- parent.dispose();
- }
- }
- }
-}
-/**
- * Dispose of the editor presentation.
- */
-public void dispose() {
- if (editorArea != null) {
- editorArea.dispose();
- }
-}
-/**
- * @see IEditorPresentation
- */
-public String getActiveEditorWorkbookID() {
- return editorArea.getActiveWorkbookID();
-}
-/**
- * Returns an array of the open editors.
- *
- * @return an array of open editors
- */
-public IEditorReference[] getEditors() {
- int nSize = editorTable.size();
- IEditorReference [] retArray = new IEditorReference[nSize];
- for (int i = 0; i < retArray.length; i++){
- retArray[i] = ((EditorPane)editorTable.get(i)).getEditorReference();
- }
- return retArray;
-}
-/**
- * Returns the editor area.
- */
-public LayoutPart getLayoutPart() {
- return editorArea;
-}
-/**
- * Returns the active editor in this perspective. If the editors appear
- * in a workbook this will be the visible editor. If the editors are
- * scattered around the workbench this will be the most recent editor
- * to hold focus.
- *
- * @return the active editor, or <code>null</code> if no editor is active
- */
-public IEditorReference getVisibleEditor() {
- EditorWorkbook activeWorkbook = editorArea.getActiveWorkbook();
- EditorPane pane = activeWorkbook.getVisibleEditor();
- if (pane != null) {
- IEditorReference result = pane.getEditorReference();
- IEditorPart editorPart = (IEditorPart)result.getPart(false);
- if((editorPart != null) && (editorPart instanceof MultiEditor)) {
- editorPart = ((MultiEditor)result.getPart(true)).getActiveEditor();
- EditorSite site = (EditorSite)editorPart.getSite();
- result = (IEditorReference)site.getPane().getPartReference();
- }
- return result;
- }
- return null;
-}
-/**
- * The active editor has failed to be restored. Find another editor, restore it
- * and make it visible.
- */
-public void fixVisibleEditor() {
- EditorWorkbook activeWorkbook = editorArea.getActiveWorkbook();
- EditorPane pane = activeWorkbook.getVisibleEditor();
- if(pane == null) {
- LayoutPart editors[] = activeWorkbook.getChildren();
- if(editors.length > 0)
- pane = (EditorPane)editors[0];
- }
- if(pane != null) {
- IEditorReference result = pane.getEditorReference();
- IEditorPart editorPart = (IEditorPart)result.getPart(true);
- if(editorPart != null)
- activeWorkbook.setVisibleEditor(pane);
- }
-}
-
-public void moveEditor(IEditorPart part,int position) {
- EditorPane pane = (EditorPane)((EditorSite)part.getSite()).getPane();
- pane.getWorkbook().reorderTab(pane,position);
-}
-/**
- * Move a part from one position to another.
- * This implementation assumes the target is
- * an editor workbook.
- */
-private void movePart(LayoutPart part, int position, EditorWorkbook relativePart) {
- EditorArea sashContainer = relativePart.getEditorArea();
- if (sashContainer == null)
- return;
-
- // Remove the part from the current container.
- derefPart(part);
- // Add the part.
- int relativePosition = IPageLayout.LEFT;
- if (position == PartDragDrop.RIGHT)
- relativePosition = IPageLayout.RIGHT;
- else if (position == PartDragDrop.TOP)
- relativePosition = IPageLayout.TOP;
- else if (position == PartDragDrop.BOTTOM)
- relativePosition = IPageLayout.BOTTOM;
- if (part instanceof EditorWorkbook) {
- sashContainer.add(part, relativePosition, (float) 0.5, relativePart);
- ((EditorWorkbook)part).becomeActiveWorkbook(true);
- }
- else {
- EditorWorkbook newWorkbook = new EditorWorkbook(editorArea);
- sashContainer.add(newWorkbook, relativePosition, (float) 0.5, relativePart);
- newWorkbook.add(part);
- newWorkbook.becomeActiveWorkbook(true);
- }
-}
-/**
- * Notification sent during drag and drop operation.
- * Only allow editors and editor workbooks to participate
- * in the drag. Only allow the drop on an editor workbook
- * within the same editor area.
- */
-private void onPartDragOver(PartDropEvent e) {
- // If source and target are in different windows reject.
- if (e.dragSource != null && e.dropTarget != null) {
- if (e.dragSource.getWorkbenchWindow() != e.dropTarget.getWorkbenchWindow()) {
- e.relativePosition = PartDragDrop.INVALID;
- return;
- }
- }
-
- // can't detach editor into its own window
- if (/*!detachable &&*/ e.relativePosition == PartDragDrop.OFFSCREEN){
- e.relativePosition = PartDragDrop.INVALID;
- return;
- }
- // can't drop unless over an editor workbook
- if (!(e.dropTarget instanceof EditorWorkbook)) {
- e.relativePosition = PartDragDrop.INVALID;
- return;
- }
- // handle drag of an editor
- if (e.dragSource instanceof EditorPane) {
- EditorWorkbook sourceWorkbook = ((EditorPane)e.dragSource).getWorkbook();
- // limitations when drop is over editor's own workbook
- if (sourceWorkbook == e.dropTarget) {
- // can't stack/detach/attach from same workbook when only one editor
- if (sourceWorkbook.getItemCount() == 1) {
- e.relativePosition = PartDragDrop.INVALID;
- return;
- }
- }
-
- // can't drop into another editor area
- EditorWorkbook targetWorkbook = (EditorWorkbook)e.dropTarget;
- if (sourceWorkbook.getEditorArea() != targetWorkbook.getEditorArea()) {
- e.relativePosition = PartDragDrop.INVALID;
- return;
- }
- // all seems well
- return;
- }
- // handle drag of an editor workbook
- if (e.dragSource instanceof EditorWorkbook) {
- // can't attach nor stack in same workbook
- if (e.dragSource == e.dropTarget) {
- e.relativePosition = PartDragDrop.INVALID;
- return;
- }
- // can't drop into another editor area
- EditorWorkbook sourceWorkbook = (EditorWorkbook)e.dragSource;
- EditorWorkbook targetWorkbook = (EditorWorkbook)e.dropTarget;
- if (sourceWorkbook.getEditorArea() != targetWorkbook.getEditorArea()) {
- e.relativePosition = PartDragDrop.INVALID;
- return;
- }
-
- // all seems well
- return;
- }
- // invalid case - do not allow a drop to happen
- e.relativePosition = PartDragDrop.INVALID;
-}
-/**
- * Notification sent when drop happens. Only editors
- * and editor workbooks were allowed to participate.
- * Only an editor workbook in the same editor area as
- * the drag started can accept the drop.
- */
-private void onPartDrop(PartDropEvent e) {
- switch (e.relativePosition) {
- case PartDragDrop.OFFSCREEN:
- // This case is not supported and should never
- // happen. See onPartDragOver
- //detach(e.dragSource, e.x, e.y);
- break;
- case PartDragDrop.CENTER:
- if (e.dragSource instanceof EditorPane) {
- EditorWorkbook sourceWorkbook = ((EditorPane)e.dragSource).getWorkbook();
- if (sourceWorkbook == e.dropTarget) {
- sourceWorkbook.reorderTab((EditorPane)e.dragSource, e.cursorX, e.cursorY);
- break;
- }
- }
- stack(e.dragSource, (EditorWorkbook)e.dropTarget);
- break;
- case PartDragDrop.LEFT:
- case PartDragDrop.RIGHT:
- case PartDragDrop.TOP:
- case PartDragDrop.BOTTOM:
- if (page.isZoomed())
- page.zoomOut();
- movePart(e.dragSource, e.relativePosition, (EditorWorkbook)e.dropTarget);
- break;
- }
-}
-/**
- * Opens an editor within the presentation.
- * </p>
- * @param part the editor
- */
-public void openEditor(IEditorReference ref,IEditorReference[] innerEditors, boolean setVisible) {
- EditorPane pane = new MultiEditorOuterPane(ref, page, editorArea.getActiveWorkbook());
- initPane(pane,ref);
- for (int i = 0; i < innerEditors.length; i++) {
- EditorPane innerPane = new MultiEditorInnerPane(pane,innerEditors[i], page, editorArea.getActiveWorkbook());
- initPane(innerPane,innerEditors[i]);
- }
- // Show the editor.
- editorArea.addEditor(pane);
- if(setVisible)
- setVisibleEditor(ref, true);
-}
-/**
- * Opens an editor within the presentation.
- * </p>
- * @param part the editor
- */
-public void openEditor(IEditorReference ref,boolean setVisible) {
-
- EditorPane pane = new EditorPane(ref, page, editorArea.getActiveWorkbook());
- initPane(pane,ref);
-
- // Show the editor.
- editorArea.addEditor(pane);
- if(setVisible)
- setVisibleEditor(ref, true);
-}
-private EditorPane initPane(EditorPane pane, IEditorReference ref) {
- ((WorkbenchPartReference)ref).setPane(pane);
- // Record the new editor.
- editorTable.add(pane);
- return pane;
-}
-/**
- * @see IPersistablePart
- */
-public IStatus restoreState(IMemento memento) {
- // Restore the editor area workbooks layout/relationship
- return editorArea.restoreState(memento);
-}
-/**
- * @see IPersistablePart
- */
-public IStatus saveState(IMemento memento) {
- // Save the editor area workbooks layout/relationship
- return editorArea.saveState(memento);
-}
-/**
- * @see IEditorPresentation
- */
-public void setActiveEditorWorkbookFromID(String id) {
- editorArea.setActiveWorkbookFromID(id);
-}
-/**
- * Brings an editor to the front and gives it focus.
- *
- * @param part the editor to make visible
- * @param setFocus whether to give the editor focus
- * @return true if the active editor was changed, false if not.
- */
-public boolean setVisibleEditor(IEditorReference ref, boolean setFocus) {
- IEditorReference visibleEditor = getVisibleEditor();
- if (ref != visibleEditor) {
- IEditorPart part = (IEditorPart)ref.getPart(true);
- EditorPane pane = (EditorPane)((PartSite)part.getEditorSite()).getPane();
- if (pane != null) {
- if(pane instanceof MultiEditorInnerPane) {
- EditorPane parentPane = ((MultiEditorInnerPane)pane).getParentPane();
- EditorWorkbook activeWorkbook = parentPane.getWorkbook();
- EditorPane activePane = activeWorkbook.getVisibleEditor();
- if(activePane != parentPane)
- parentPane.getWorkbook().setVisibleEditor(parentPane);
- else
- return false;
- } else {
- pane.getWorkbook().setVisibleEditor(pane);
- }
- if (setFocus)
- part.setFocus();
- return true;
- }
- }
- return false;
-}
-private void stack(LayoutPart newPart, EditorWorkbook refPart) {
- editorArea.getControl().setRedraw(false);
- if (newPart instanceof EditorWorkbook) {
- EditorPane visibleEditor = ((EditorWorkbook)newPart).getVisibleEditor();
- LayoutPart[] children = ((EditorWorkbook)newPart).getChildren();
- for (int i = 0; i < children.length; i++)
- stackEditor((EditorPane)children[i], refPart);
- if (visibleEditor != null) {
- visibleEditor.setFocus();
- refPart.becomeActiveWorkbook(true);
- refPart.setVisibleEditor(visibleEditor);
- }
- }
- else {
- stackEditor((EditorPane)newPart, refPart);
- newPart.setFocus();
- refPart.becomeActiveWorkbook(true);
- refPart.setVisibleEditor((EditorPane)newPart);
- }
- editorArea.getControl().setRedraw(true);
-}
-private void stackEditor(EditorPane newPart, EditorWorkbook refPart) {
- // Remove the part from old container.
- derefPart(newPart);
- // Reparent part and add it to the workbook
- newPart.reparent(refPart.getParent());
- refPart.add(newPart);
-}
-}
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
deleted file mode 100644
index 8510f17..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorSite.java
+++ /dev/null
@@ -1,82 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.registry.EditorDescriptor;
-
-/**
- * An editor container manages the services for an editor.
- */
-public class EditorSite extends PartSite
- implements IEditorSite
-{
- private EditorDescriptor desc;
- private boolean reuseEditor = true;
-
-/**
- * Constructs an EditorSite for an editor. The resource editor descriptor
- * may be omitted for an OLE editor.
- */
-public EditorSite(IEditorPart editor, WorkbenchPage page,
- EditorDescriptor desc)
-{
- super(editor, page);
- if (desc != null) {
- this.desc = desc;
- setConfigurationElement(desc.getConfigurationElement());
- }
-}
-
-/**
- * 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
- */
-public IEditorActionBarContributor getActionBarContributor() {
- EditorActionBars bars = (EditorActionBars)getActionBars();
- if (bars != null)
- return bars.getEditorContributor();
- else
- return null;
-}
-/**
- * Returns the extension editor action bar contributor for this editor.
- */
-public IEditorActionBarContributor getExtensionActionBarContributor() {
- EditorActionBars bars = (EditorActionBars)getActionBars();
- if (bars != null)
- return bars.getExtensionContributor();
- else
- return null;
-}
-/**
- * Returns the editor
- */
-public IEditorPart getEditorPart() {
- return (IEditorPart)getPart();
-}
-
-public EditorDescriptor getEditorDescriptor() {
- return desc;
-}
-
-public boolean getReuseEditor() {
- return reuseEditor;
-}
-
-public void setReuseEditor(boolean reuse) {
- reuseEditor = reuse;
-}
-protected String getInitialScopeId() {
- return "org.eclipse.ui.textEditorScope";
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorToolBarManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorToolBarManager.java
deleted file mode 100644
index dcf4bf5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorToolBarManager.java
+++ /dev/null
@@ -1,175 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.RetargetAction;
-
-import java.util.*;
-import java.util.List;
-
-/**
- * An <code>EditorToolBarManager</code> is used to sort the contributions
- * made by an editor so that they always appear after the action sets.
- */
-public class EditorToolBarManager extends SubToolBarManager
-{
- private IToolBarManager parentMgr;
- 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() {
- IContributionItem[] items;
- if (parentMgr instanceof CoolItemToolBarManager) {
- items = getItems();
- } else {
- items = EditorToolBarManager.super.getItems();
- }
- for (int i = 0; i < items.length; i++) {
- IContributionItem item = items[i];
- item.update(IContributionManagerOverrides.P_ENABLED);
- }
- }
- public Boolean getEnabled(IContributionItem item) {
- if (((item instanceof ActionContributionItem) &&
- (((ActionContributionItem)item).getAction() instanceof RetargetAction)) ||
- enabledAllowed)
- return null;
- else
- return Boolean.FALSE;
- }
- public Integer getAccelerator(IContributionItem item) {
- return null;
- }
- public String getAcceleratorText(IContributionItem item) {
- return null;
- }
- public String getText(IContributionItem item) {
- return null;
- }
- }
- private Overrides overrides = new Overrides();
-
-/**
- * Constructs a new manager.
- *
- * @param mgr the parent manager. All contributions made to the
- * <code>EditorToolBarManager</code> are forwarded and appear in the
- * parent manager.
- */
-public EditorToolBarManager(IToolBarManager mgr) {
- super(mgr);
- parentMgr = mgr;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionItem[] getItems() {
- return parentMgr.getItems();
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public IContributionManagerOverrides getOverrides() {
- return overrides;
-}
-/**
- * Return the toolbar into which this manager will
- * contribute to.
- */
-private ToolBar getToolBar() {
- if (parentMgr == null)
- return null;
-
- IContributionManager mgr = parentMgr;
- while (mgr instanceof SubToolBarManager)
- mgr = ((SubToolBarManager)mgr).getParent();
-
- if (mgr instanceof ToolBarManager)
- return ((ToolBarManager)mgr).getControl();
-
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-/**
- * Inserts the new item after any action set contributions which may
- * exist within the toolbar to ensure a consistent order for actions.
- */
-public void insertAfter(String id, IContributionItem item) {
- IContributionItem refItem = PluginActionSetBuilder.findInsertionPoint(id,
- null, parentMgr, false);
- if (refItem != null) {
- super.insertAfter(refItem.getId(), item);
- } else {
- WorkbenchPlugin.log("Reference item " + id + " not found for action " + item.getId()); //$NON-NLS-1$
- }
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-/**
- * Inserts the new item after any action set contributions which may
- * exist within the toolbar to ensure a consistent order for actions.
- */
-public void prependToGroup(String groupName, IContributionItem item) {
- insertAfter(groupName, item);
-}
-/**
- * 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.</p>
- *
- * @param visible the new visibility
- * @param forceVisibility whether to change the visibility or just the
- * enablement state. This parameter is ignored if visible is
- * <code>true</code>.
- */
-public void setVisible(boolean visible, boolean forceVisibility) {
- if (visible) {
- if (forceVisibility) {
- // Make the items visible
- if (!enabledAllowed)
- setEnabledAllowed(true);
- } else {
- if (enabledAllowed)
- setEnabledAllowed(false);
- }
- if (!isVisible())
- setVisible(true);
- }
- else {
- if (forceVisibility)
- // Remove the editor tool bar items
- setVisible(false);
- else
- // Disabled the tool bar items.
- 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)
- return;
- this.enabledAllowed = enabledAllowed;
- overrides.updateEnabledAllowed();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorWorkbook.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorWorkbook.java
deleted file mode 100644
index 197ca91..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/EditorWorkbook.java
+++ /dev/null
@@ -1,909 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Cagatay Kavukcuoglu <cagatayk@acm.org>
- - Fix for bug 10025 - Resizing views should not use height ratios
-**********************************************************************/
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.*;
-import java.util.*;
-import java.util.List;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
-
-
-/**
- * Represents a tab folder of editors. This layout part
- * container only accepts EditorPane parts.
- */
-public class EditorWorkbook extends LayoutPart
- implements ILayoutContainer, IPropertyListener
-{
- private static final int INACTIVE = 0;
- private static final int ACTIVE_FOCUS = 1;
- private static final int ACTIVE_NOFOCUS = 2;
-
- private static int tabLocation = -1; // Initialized in constructor.
-
- private int activeState = INACTIVE;
- private boolean assignFocusOnSelection = true;
- private boolean ignoreTabFocusHide = false;
- private boolean handleTabSelection = true;
- private boolean mouseDownListenerAdded = false;
-
- private boolean isZoomed = false;
- private Composite parent;
- private CTabFolder tabFolder;
- private EditorArea editorArea;
- private EditorPane visibleEditor;
- private Map mapPartToDragMonitor = new HashMap();
-
- private Map mapTabToEditor = new HashMap();
- private List editors = new ArrayList();
-/**
- * EditorWorkbook constructor comment.
- */
-public EditorWorkbook(EditorArea editorArea) {
- super("editor workbook");//$NON-NLS-1$
- this.editorArea = editorArea;
- // Each workbook has a unique ID so
- // relative positioning is unambiguous.
- setID(this.toString());
-
- // Get tab location preference.
- if (tabLocation == -1)
- tabLocation = getPreferenceStore().getInt(
- IPreferenceConstants.EDITOR_TAB_POSITION);
-}
-/**
- * See ILayoutContainer::add
- *
- * Note: the workbook currently only accepts
- * editor parts.
- */
-public void add(LayoutPart part) {
- if (part instanceof EditorPane) {
- EditorPane editorPane = (EditorPane) part;
- editors.add(editorPane);
- editorPane.setWorkbook(this);
- editorPane.setZoomed(isZoomed);
- if (tabFolder != null) {
- createTab(editorPane);
- createPage(editorPane);
- setVisibleEditor(editorPane);
- }
- }
-}
-/**
- * See ILayoutContainer::allowBorder
- *
- * There is already a border around the tab
- * folder so no need for one from the parts.
- */
-public boolean allowsBorder() {
- return false;
-}
-public void becomeActiveWorkbook(boolean hasFocus) {
- EditorArea area = getEditorArea();
- if (area != null)
- area.setActiveWorkbook(this, hasFocus);
-}
-public void createControl(Composite parent) {
-
- if (tabFolder != null)
- return;
-
- this.parent = parent;
- tabFolder = new CTabFolder(parent, SWT.BORDER | tabLocation);
-
- // prevent close button and scroll buttons from taking focus
- tabFolder.setTabList(new Control[0]);
-
- // redirect drop request to the workbook
- tabFolder.setData((IPartDropTarget) this);
-
- // listener to close the editor
- tabFolder.addCTabFolderListener(new CTabFolderAdapter() {
- public void itemClosed(CTabFolderEvent e) {
- e.doit = false; // otherwise tab is auto disposed on return
- EditorPane pane = (EditorPane) mapTabToEditor.get(e.item);
- pane.doHide();
- }
- });
-
- // listener to switch between visible tabItems
- tabFolder.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (handleTabSelection) {
- EditorPane pane = (EditorPane) mapTabToEditor.get(e.item);
- // Pane can be null when tab is just created but not map yet.
- if (pane != null) {
- setVisibleEditor(pane);
- if (assignFocusOnSelection) {
- // If we get a tab focus hide request, it's from
- // the previous editor in this workbook which had focus.
- // Therefore ignore it to avoid paint flicker
- ignoreTabFocusHide = true;
- pane.setFocus();
- ignoreTabFocusHide = false;
- }
- }
- }
- }
- });
-
- // listener to resize visible components
- tabFolder.addListener(SWT.Resize, new Listener() {
- public void handleEvent(Event e) {
- setControlSize(visibleEditor);
- }
- });
-
- // listen for mouse down on tab area to set focus.
- tabFolder.addMouseListener(new MouseAdapter() {
- public void mouseDoubleClick(MouseEvent event) {
- doZoom();
- }
-
- public void mouseDown(MouseEvent e) {
- if (visibleEditor != null) {
- visibleEditor.setFocus();
- CTabItem item = getTab(visibleEditor);
- Rectangle bounds = item.getBounds();
- if(bounds.contains(e.x,e.y)) {
- if (e.button == 3)
- visibleEditor.showPaneMenu(tabFolder,new Point(e.x, e.y));
- else if((e.button == 1) && overImage(item,e.x))
- visibleEditor.showPaneMenu();
- }
- }
- }
- });
-
- // register the interested mouse down listener
- if (!mouseDownListenerAdded && getEditorArea() != null) {
- tabFolder.addListener(SWT.MouseDown, getEditorArea().getMouseDownListener());
- mouseDownListenerAdded = true;
- }
-
- // Enable drop target data
- enableDrop(this);
-
- // Create tabs.
- Iterator enum = editors.iterator();
- while (enum.hasNext()) {
- EditorPane pane = (EditorPane) enum.next();
- createTab(pane);
- createPage(pane);
- }
-
- // Set active tab.
- if (visibleEditor != null)
- setVisibleEditor(visibleEditor);
- else
- if (getItemCount() > 0)
- setVisibleEditor((EditorPane) editors.get(0));
-}
-
-/**
- * Show a title label menu for this pane.
- */
-public void showPaneMenu() {
- if (visibleEditor != null) {
- CTabItem item = getTab(visibleEditor);
- Rectangle bounds = item.getBounds();
- visibleEditor.showPaneMenu(tabFolder,new Point(bounds.x,bounds.height));
- }
-}
-/**
- * Returns true if the mouse pointer is over the
- * image of the tab's label
- */
-/*package*/ boolean overImage(EditorPane pane, int x) {
- CTabItem item = getTab(pane);
- return overImage(item, x);
-}
-/*
- * Return true if <code>x</code> is over the label image.
- */
-private boolean overImage(CTabItem item,int x) {
- Rectangle imageBounds = item.getImage().getBounds();
- return x < (item.getBounds().x + imageBounds.x + imageBounds.width);
-}
-/**
- * Create a page and tab for an editor.
- */
-private void createPage(EditorPane editorPane) {
- editorPane.createControl(parent);
- editorPane.setContainer(this);
- enableDrop(editorPane);
- // Update tab to be in-sync after creation of
- // pane's control since prop listener was not on
- IEditorReference editorRef = editorPane.getEditorReference();
- updateEditorTab(editorRef);
- editorRef.addPropertyListener(this);
-
- // When first editor added, also enable workbook for
- // D&D - this avoids dragging the initial empty workbook
- if (mapPartToDragMonitor.size() == 1)
- enableTabDrag(this, null);
-}
-/**
- * Create a new tab for an item.
- */
-private CTabItem createTab(EditorPane editorPane) {
- return createTab(editorPane, tabFolder.getItemCount());
-}
-/**
- * Create a new tab for an item at a particular index.
- */
-private CTabItem createTab(EditorPane editorPane, int index) {
- CTabItem tab = new CTabItem(tabFolder, SWT.NONE, index);
- mapTabToEditor.put(tab, editorPane);
- enableTabDrag(editorPane, tab);
- updateEditorTab((IEditorReference)editorPane.getPartReference());
- return tab;
-}
-private void disableTabDrag(LayoutPart part) {
- PartDragDrop partDragDrop = (PartDragDrop)mapPartToDragMonitor.get(part);
- if (partDragDrop != null) {
- partDragDrop.dispose();
- mapPartToDragMonitor.remove(part);
- }
-}
-
-/**
- * See LayoutPart#dispose
- */
-public void dispose() {
- if (tabFolder == null)
- return;
-
- for (int i = 0; i < editors.size(); i++)
- removeListeners((EditorPane)editors.get(i));
- editors.clear();
- //Reset the visible editor so that no references are made to it.
- setVisibleEditor(null);
-
- // dispose of disabled images
- for(int i = 0; i < tabFolder.getItemCount(); i++) {
- CTabItem tab = tabFolder.getItem(i);
- if (tab.getDisabledImage() != null)
- tab.getDisabledImage().dispose();
- }
-
- tabFolder.dispose();
- tabFolder = null;
- mouseDownListenerAdded = false;
-
- mapTabToEditor.clear();
-}
-/**
- * Zooms in on the active page in this workbook.
- */
-private void doZoom() {
- if (visibleEditor == null)
- return;
- ((WorkbenchPage)(getWorkbenchWindow().getActivePage())).toggleZoom(visibleEditor.getPartReference().getPart(true));
-}
-/**
- * Draws the applicable gradient on the active tab
- */
-/* package */ void drawGradient() {
- if (tabFolder == null)
- return;
-
- Color fgColor;
- Color[] bgColors;
- int[] bgPercents;
-
- switch (activeState) {
- case ACTIVE_FOCUS :
- if (getShellActivated()) {
- fgColor = WorkbenchColors.getSystemColor(SWT.COLOR_TITLE_FOREGROUND);
- bgColors = WorkbenchColors.getActiveEditorGradient();
- bgPercents = WorkbenchColors.getActiveEditorGradientPercents();
- }
- else {
- fgColor = WorkbenchColors.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND);
- bgColors = WorkbenchColors.getDeactivatedEditorGradient();
- bgPercents = WorkbenchColors.getDeactivatedEditorGradientPercents();
- }
- break;
- case ACTIVE_NOFOCUS :
- fgColor = WorkbenchColors.getSystemColor(SWT.COLOR_LIST_FOREGROUND);
- bgColors = WorkbenchColors.getActiveNoFocusEditorGradient();
- bgPercents = WorkbenchColors.getActiveNoFocusEditorGradientPercents();
- break;
- case INACTIVE :
- default :
- fgColor = null;
- bgColors = null;
- bgPercents = null;
- break;
- }
-
- tabFolder.setSelectionForeground(fgColor);
- tabFolder.setSelectionBackground(bgColors, bgPercents);
- tabFolder.update();
-}
-/**
- * enableDrop
- */
-private void enableDrop(LayoutPart part) {
- Control control = part.getControl();
- if (control != null)
- control.setData((IPartDropTarget)this); // Use workbook as drop target, not part itself.
-}
-private void enableTabDrag(LayoutPart part, CTabItem tab) {
- CTabPartDragDrop dragSource = new CTabPartDragDrop(part, this.tabFolder, tab);
- mapPartToDragMonitor.put(part, dragSource);
- dragSource.addDropListener(getEditorArea().getPartDropListener());
-}
-/**
- * Gets the presentation bounds.
- */
-public Rectangle getBounds() {
- if (tabFolder == null)
- return new Rectangle(0, 0, 0, 0);
- return tabFolder.getBounds();
-}
-
-// getMinimumHeight() added by cagatayk@acm.org
-/**
- * @see LayoutPart#getMinimumHeight()
- */
-public int getMinimumHeight() {
- if (tabFolder != null && !tabFolder.isDisposed() && getItemCount() > 0)
- /* Subtract 1 for divider line, bottom border is enough
- * for editor tabs.
- */
- return tabFolder.computeTrim(0, 0, 0, 0).height - 1;
- else
- return super.getMinimumHeight();
-}
-
-/**
- * See ILayoutContainer::getChildren
- */
-public LayoutPart[] getChildren() {
- int nSize = editors.size();
- LayoutPart [] children = new LayoutPart[nSize];
- editors.toArray(children);
- return children;
-}
-/**
- * Get the part control. This method may return null.
- */
-public Control getControl() {
- return tabFolder;
-}
-/**
- * Return the editor area to which this editor
- * workbook belongs to.
- */
-public EditorArea getEditorArea() {
- return editorArea;
-}
-/**
- * Answer the number of children.
- */
-public int getItemCount() {
- return editors.size();
-}
-/**
- * Return the composite used to parent all
- * editors within this workbook.
- */
-public Composite getParent() {
- return this.parent;
-}
-/**
- * Returns the tab for a part.
- */
-private CTabItem getTab(IEditorReference editorRef) {
- Iterator tabs = mapTabToEditor.keySet().iterator();
- PartPane pane = ((WorkbenchPartReference)editorRef).getPane();
- while (tabs.hasNext()) {
- CTabItem tab = (CTabItem) tabs.next();
- PartPane p = (PartPane)mapTabToEditor.get(tab);
- if (p != null && p == pane)
- return tab;
- }
-
- return null;
-}
-/**
- * Returns the tab for a part.
- */
-private CTabItem getTab(LayoutPart child) {
- Iterator tabs = mapTabToEditor.keySet().iterator();
- while (tabs.hasNext()) {
- CTabItem tab = (CTabItem) tabs.next();
- if (mapTabToEditor.get(tab) == child)
- return tab;
- }
-
- return null;
-}
-
-/**
- * Returns the tab list to use when this workbook is active.
- * Includes the active editor and its tab, in the appropriate order.
- */
-public Control[] getTabList() {
- if (tabFolder == null) {
- return new Control[0];
- }
- if (visibleEditor == null) {
- return new Control[] { tabFolder };
- }
- if ((tabFolder.getStyle() & SWT.TOP) != 0) {
- return new Control[] { tabFolder, visibleEditor.getControl() };
- }
- else {
- return new Control[] { visibleEditor.getControl(), tabFolder };
- }
-}
-
-/**
- * Returns the visible child.
- */
-public EditorPane getVisibleEditor() {
- return visibleEditor;
-}
-/**
- * Returns true if this editor workbook is the
- * active one within the editor area.
- */
-public boolean isActiveWorkbook() {
- return getEditorArea().isActiveWorkbook(this);
-}
-/**
- * See LayoutPart
- */
-public boolean isDragAllowed(Point p) {
- if (isZoomed) {
- return false;
- } else if (getEditorArea().getEditorWorkbookCount() == 1) {
- return false;
- } else if (visibleEditor != null) {
- if(!overImage(visibleEditor, p.x))
- return true;
- }
- return false;
-}
-/**
- * Open the tracker to allow the user to move
- * the specified part using keyboard.
- */
-public void openTracker(LayoutPart part) {
- CTabPartDragDrop dnd = (CTabPartDragDrop)mapPartToDragMonitor.get(part);
- dnd.openTracker();
-}
-
-/**
- * Returns true if this part is visible. A part is visible if it has a control.
- */
-public boolean isVisible() {
- return (tabFolder != null);
-}
-/**
- * Listen for notifications from the editor part
- * that its title has change or it's dirty, and
- * update the corresponding tab
- *
- * @see IPropertyListener
- */
-public void propertyChanged(Object source, int property) {
- if (property == IEditorPart.PROP_DIRTY || property == IWorkbenchPart.PROP_TITLE) {
- if (source instanceof IEditorPart) {
- updateEditorTab((IEditorPart)source);
- }
- }
-}
-/**
- * See ILayoutContainer::remove
- *
- * Note: workbook only handles editor parts.
- */
-public void remove(LayoutPart child) {
- // Get editor position.
- int tabIndex = editors.indexOf(child);
- if (tabIndex < 0)
- return;
-
- // Dereference the old editor.
- // This must be done before "show" to get accurate decorations.
- editors.remove(child);
- removeListeners((EditorPane)child);
-
- // Show new editor
- if (visibleEditor == child) {
- EditorPane nextEditor = null;
- int maxIndex = editors.size() - 1;
- if (maxIndex >= 0) {
- tabIndex = Math.min(tabIndex, maxIndex);
- nextEditor = (EditorPane)editors.get(tabIndex);
- }
- if (tabFolder != null) {
- // Dispose old editor.
- removeTab(getTab(child));
- child.setContainer(null);
- }
- setVisibleEditor(nextEditor);
- } else if (tabFolder != null) {
- // Dispose old editor.
- removeTab(getTab(child));
- child.setContainer(null);
- }
-}
-/**
- * See IVisualContainer#remove
- */
-public void removeAll() {
- // turn off tab selection handling so as
- // not to activate another editor when a
- // tab is disposed. See PR 1GBXAWZ
- handleTabSelection = false;
-
- // Show empty space.
- setVisibleEditor(null);
-
- // Dispose of all tabs.
- if (tabFolder != null) {
- Iterator tabs = mapTabToEditor.keySet().iterator();
- while (tabs.hasNext()) {
- CTabItem tab = (CTabItem) tabs.next();
- if (tab.getDisabledImage() != null)
- tab.getDisabledImage().dispose();
- tab.dispose();
- EditorPane child = (EditorPane)mapTabToEditor.get(tab);
- removeListeners(child);
- child.setContainer(null);
- }
- }
-
- // Clean up
- mapTabToEditor.clear();
- editors.clear();
- handleTabSelection = true;
-}
-private void removeListeners(EditorPane editor) {
- if (editor == null)
- return;
-
- disableTabDrag(editor);
-
- // When last editor removed, also disable workbook for
- // D&D - this avoids dragging the initial empty workbook
- if (mapPartToDragMonitor.size() == 1)
- disableTabDrag(this);
-
- editor.getPartReference().removePropertyListener(this);
-}
-/**
- * Remove the tab item from the tab folder
- */
-private void removeTab(CTabItem tab) {
- if (tabFolder != null) {
- if (tab != null) {
- mapTabToEditor.remove(tab);
- if (tab.getDisabledImage() != null)
- tab.getDisabledImage().dispose();
- // Note, that disposing of the tab causes the
- // tab folder to select another tab and fires
- // a selection event. In this situation, do
- // not assign focus.
- assignFocusOnSelection = false;
- tab.dispose();
- assignFocusOnSelection = true;
- }
- }
-}
-/**
- * Reorder the tab representing the specified pane.
- * If a tab exists under the specified x,y location,
- * then move the tab before it, otherwise place it
- * as the last tab.
- */
-public void reorderTab(EditorPane pane, int x, int y) {
- CTabItem sourceTab = getTab(pane);
- if (sourceTab == null)
- return;
-
- // adjust the y coordinate to fall within the tab area
- Point location = new Point(1, 1);
- if ((tabFolder.getStyle() & SWT.BOTTOM) != 0)
- location.y = tabFolder.getSize().y - 4; // account for 3 pixel border
-
- // adjust the x coordinate to be within the tab area
- if (x > location.x)
- location.x = x;
-
- // find the tab under the adjusted location.
- CTabItem targetTab = tabFolder.getItem(location);
-
- // no tab under location so move editor's tab to end
- if (targetTab == null) {
- // do nothing if already at the end
- if (tabFolder.indexOf(sourceTab) != tabFolder.getItemCount() - 1)
- reorderTab(pane, sourceTab, -1);
-
- return;
- }
-
- // do nothing if over editor's own tab
- if (targetTab == sourceTab)
- return;
-
- // do nothing if already before target tab
- int sourceIndex = tabFolder.indexOf(sourceTab);
- int targetIndex = tabFolder.indexOf(targetTab);
-
- if (sourceIndex == targetIndex - 1)
- return;
-
- //Source is going to be dispose so the target index will change.
- if (sourceIndex < targetIndex)
- targetIndex--;
-
- reorderTab(pane, sourceTab, targetIndex);
-}
-/**
- * Move the specified editor to the a new position.
- * Move to the end if <code>newIndex</code> is less then
- * zero.
- */
-public void reorderTab(EditorPane pane,int newIndex) {
- reorderTab(pane,getTab(pane),newIndex);
-}
-
-/**
- * Reorder the tab representing the specified pane.
- */
-private void reorderTab(EditorPane pane, CTabItem sourceTab, int newIndex) {
- // remember if the source tab was the visible one
- boolean wasVisible = (tabFolder.getSelection() == sourceTab);
-
- // Remove old tab.
- disableTabDrag(pane);
- removeTab(sourceTab);
-
- // Create the new tab at the specified index
- CTabItem newTab;
- if (newIndex < 0)
- newTab = createTab(pane);
- else
- newTab = createTab(pane, newIndex);
- CTabPartDragDrop partDragDrop = (CTabPartDragDrop)mapPartToDragMonitor.get(pane);
- partDragDrop.setTab(newTab);
-
- // update order of editors.
- editors.remove(pane);
- if (newIndex < 0)
- editors.add(pane);
- else
- editors.add(newIndex, pane);
-
- // update the new tab's visibility but do
- // not set focus...caller's responsibility.
- // Note, if the pane already had focus, it
- // will still have it after the tab order change.
- if (wasVisible) {
- tabFolder.setSelection(newTab);
- setVisibleEditor(pane);
- }
-}
-/**
- * See ILayoutContainer::replace
- *
- * Note: this is not currently supported
- */
-public void replace(LayoutPart oldPart, LayoutPart newPart) {
-}
-/**
- * Sets the gradient state of the active tab
- */
-private void setActiveState(int state) {
- if (activeState != state) {
- activeState = state;
- drawGradient();
- }
-}
-/**
- * Sets the presentation bounds.
- */
-public void setBounds(Rectangle r) {
- if (tabFolder != null) {
- tabFolder.setBounds(r);
- setControlSize(visibleEditor);
- }
-}
-/**
- * Sets the parent for this part.
- */
-public void setContainer(ILayoutContainer container) {
- super.setContainer(container);
-
- // register the interested mouse down listener
- if (!mouseDownListenerAdded && getEditorArea() != null && tabFolder != null) {
- tabFolder.addListener(SWT.MouseDown, getEditorArea().getMouseDownListener());
- mouseDownListenerAdded = true;
- }
-}
-/**
- * Set the size of a page in the folder.
- */
-private void setControlSize(LayoutPart part) {
- if (part == null || tabFolder == null)
- return;
- Rectangle bounds = PartTabFolder.calculatePageBounds(tabFolder);
- part.setBounds(bounds);
- part.moveAbove(tabFolder);
-}
-public void setVisibleEditor(EditorPane comp) {
-
- if (tabFolder == null) {
- visibleEditor = comp;
- return;
- }
-
- if(comp != null) {
- //Make sure the EditorPart is created.
- Object part = comp.getPartReference().getPart(true);
- if(part == null)
- comp = null;
- }
-
- // Hide old part. Be sure that it is not in the middle of closing
- if (visibleEditor != null && visibleEditor != comp && visibleEditor.getControl()!= null){
- visibleEditor.getControl().setVisible(false);
- }
-
- // Show new part.
- visibleEditor = comp;
- if (visibleEditor != null) {
- CTabItem key = getTab(visibleEditor);
- if (key != null) {
- int index = tabFolder.indexOf(key);
- tabFolder.setSelection(index);
- }
- setControlSize(visibleEditor);
- if(visibleEditor.getControl() != null)
- visibleEditor.getControl().setVisible(true);
-
- becomeActiveWorkbook(activeState == ACTIVE_FOCUS);
- }
-}
-public void tabFocusHide() {
- if (tabFolder == null || ignoreTabFocusHide)
- return;
-
- if (isActiveWorkbook())
- setActiveState(ACTIVE_NOFOCUS);
- else
- setActiveState(INACTIVE);
-}
-public void tabFocusShow(boolean hasFocus) {
- if (tabFolder == null)
- return;
-
- if (hasFocus)
- setActiveState(ACTIVE_FOCUS);
- else
- setActiveState(ACTIVE_NOFOCUS);
-}
-/**
- * @see IPartDropTarget::targetPartFor
- */
-public LayoutPart targetPartFor(LayoutPart dragSource) {
- if (dragSource instanceof EditorPane || dragSource instanceof EditorWorkbook)
- return this;
- else
- return getEditorArea();
-}
-/**
- * Update the tab for an editor. This is typically called
- * by a site when the tab title changes.
- */
-public void updateEditorTab(IEditorPart part) {
- PartPane pane = ((EditorSite)part.getSite()).getPane();
- String title = part.getTitle();
- boolean isDirty = part.isDirty();
- Image image = part.getTitleImage();
- String toolTip = part.getTitleToolTip();
- updateEditorTab(pane,title,isDirty,image,toolTip);
-}
-/**
- * Update the tab for an editor. This is typically called
- * by a site when the tab title changes.
- */
-public void updateEditorTab(IEditorReference ref) {
- PartPane pane = ((WorkbenchPartReference)ref).getPane();
- String title = ref.getTitle();
- boolean isDirty = ref.isDirty();
- Image image = ref.getTitleImage();
- String toolTip = ref.getTitleToolTip();
- updateEditorTab(pane,title,isDirty,image,toolTip);
-}
-/**
- * Update the tab for an editor. This is typically called
- * by a site when the tab title changes.
- */
-public void updateEditorTab(PartPane pane,String title,boolean isDirty,Image image,String toolTip) {
- // Get tab.
- CTabItem tab = getTab(pane);
- if(tab == null) return;
-
- // Update title.
- if (isDirty)
- title = "*" + title;//$NON-NLS-1$
- tab.setText(title);
-
- // Update the tab image
- if (image == null) {
- // Normal image.
- tab.setImage(null);
- // Disabled image.
- Image disableImage = tab.getDisabledImage();
- if (disableImage != null) {
- disableImage.dispose();
- tab.setDisabledImage(null);
- }
- } else if (!image.equals(tab.getImage())) {
- // Normal image.
- tab.setImage(image);
- // Disabled image.
- Image disableImage = tab.getDisabledImage();
- if (disableImage != null)
- disableImage.dispose();
- Display display = tab.getDisplay();
- disableImage = new Image(display, image, SWT.IMAGE_DISABLE);
- tab.setDisabledImage(disableImage);
- }
-
- // Tool tip.
- tab.setToolTipText(toolTip);
- tab.getParent().update();
-}
-/**
- * Zoom in on the active part.
- */
-public void zoomIn() {
- if (isZoomed)
- return;
- isZoomed = true;
-
- // Mark it's editors as zoom in
- Iterator iterator = editors.iterator();
- while (iterator.hasNext())
- ((EditorPane) iterator.next()).setZoomed(true);
-}
-/**
- * Zoom out and show all editors.
- */
-public void zoomOut() {
- if (!isZoomed)
- return;
- isZoomed = false;
-
- // Mark it's editors as zoom out
- Iterator iterator = editors.iterator();
- while (iterator.hasNext())
- ((EditorPane) iterator.next()).setZoomed(false);
-}
-}
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
deleted file mode 100644
index c95ceab..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ExceptionHandler.java
+++ /dev/null
@@ -1,223 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.*;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.boot.IPlatformRunnable;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.dialogs.InternalErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Handles exceptions or errors caught in the event loop.
- * In case of a "simpler" exception such as NPE, log the exception,
- * open a dialog to inform the user and try to keep running.
- * In case of a exception like OutOfMemory and SWTError, log the exception,
- * open a dialog to ask the user to decide with the workbench should
- * be terminated.
- */
-class ExceptionHandler implements Window.IExceptionHandler {
-
- private int exceptionCount = 0; //To avoid recursive errors
- private InternalErrorDialog dialog;
- //Workaround. MessageDialog should accept null as parent;
- private Shell defaultParent = new Shell();
- private boolean closing = false;
- private Workbench workbench;
-
- private static boolean OPEN_DIALOG = "true".equals(Platform.getDebugOption("org.eclipse.ui/debug/internalerror/openDialog")); //$NON-NLS-1$
-
- //Pre-load all Strings trying to run as light as possible in case of fatal errors.
- private static String MSG_UNHANDLED_EXCEPTION = WorkbenchMessages.getString("Unhandled_exception"); //$NON-NLS-1$
- private static String MSG_OutOfMemoryError = WorkbenchMessages.getString("FatalError_OutOfMemoryError"); //$NON-NLS-1$
- private static String MSG_StackOverflowError = WorkbenchMessages.getString("FatalError_StackOverflowError"); //$NON-NLS-1$
- private static String MSG_VirtualMachineError = WorkbenchMessages.getString("FatalError_VirtualMachineError"); //$NON-NLS-1$
- private static String MSG_SWTError = WorkbenchMessages.getString("FatalError_SWTError"); //$NON-NLS-1$
- private static String MSG_FATAL_ERROR = WorkbenchMessages.getString("FatalError"); //$NON-NLS-1$
- private static String MSG_FATAL_ERROR_Recursive = WorkbenchMessages.getString("FatalError_RecursiveError"); //$NON-NLS-1$
- private static String MSG_FATAL_ERROR_RecursiveTitle = WorkbenchMessages.getString("Internal_error"); //$NON-NLS-1$
-
-
-/**
- * Initializes a new ExceptionHandler with its workbench.
- */
-public ExceptionHandler(Workbench w) {
- workbench = w;
-}
-/**
- * @See IExceptionHandler
- */
-public void handleException(Throwable t) {
- try {
- exceptionCount++;
- if(exceptionCount > 2) {
- //Avoid recursive error.
- if(t instanceof RuntimeException)
- throw (RuntimeException)t;
- else
- throw (Error)t;
- }
- if(t instanceof ThreadDeath) {
- // Don't catch ThreadDeath as this is a normal occurrence when the thread dies
- throw (ThreadDeath)t;
- } if(exceptionCount == 2) {
- if(closing)
- return;
- log(t);
- Shell parent = defaultParent;
- if(dialog != null && dialog.getShell() != null && !dialog.getShell().isDisposed())
- parent = dialog.getShell();
- MessageBox box = new MessageBox(parent,SWT.ICON_ERROR | SWT.YES | SWT.NO | SWT.SYSTEM_MODAL);
- box.setText(MSG_FATAL_ERROR_RecursiveTitle);
- box.setMessage(MSG_FATAL_ERROR_Recursive + MSG_FATAL_ERROR);
- int result = box.open();
- if(result == SWT.YES) {
- if(!closing)
- closeWorkbench();
- }
- } else {
- log(t);
- if(openQuestionDialog(t)) {
- if(!closing)
- closeWorkbench();
- }
- }
- } finally {
- exceptionCount--;
- }
-}
-/**
- * Close the workbench and make sure all exceptions are handled.
- */
-private void closeWorkbench() {
- try {
- closing = true;
- if(dialog != null && dialog.getShell() != null && !dialog.getShell().isDisposed())
- dialog.close();
- workbench.close(IPlatformRunnable.EXIT_OK,true);
- } catch (RuntimeException th) {
- /* It may not be possible to show the inform the user about this exception we may not
- * have more memory or OS handles etc. */
- System.err.println("Another fatal error happened while closing the workbench."); //$NON-NLS-1$
- th.printStackTrace();
- throw th;
- } catch (Error th) {
- /* It may not be possible to show the inform the user about this exception we may not
- * have more memory or OS handles etc. */
- System.err.println("Another fatal error happened while closing the workbench."); //$NON-NLS-1$
- th.printStackTrace();
- throw th;
- }
-}
-/**
- * Log the specified exception and make sure all exceptions are handled..
- */
-private void log(Throwable t) {
- try {
- // For the status object, use the exception's message, or the exception name if no message.
- String msg = t.getMessage() == null ? t.toString() : t.getMessage();
- WorkbenchPlugin.log(MSG_UNHANDLED_EXCEPTION, new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, msg, t));
-
- // special case for SWTException and SWTError to handle workaround for bug 6312
- Throwable nested = null;
- if (t instanceof SWTException)
- nested = ((SWTException)t).throwable;
- else if(t instanceof SWTError)
- nested = ((SWTError)t).throwable;
- if (nested != null) {
- msg = nested.getMessage() == null ? nested.toString() : nested.getMessage();
- WorkbenchPlugin.log("\n*** Stack trace of contained exception ***", new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, 0, msg, nested)); //$NON-NLS-1$
- }
- if (WorkbenchPlugin.DEBUG) {
- t.printStackTrace();
- }
- } catch (Throwable th) {
- /* Probably: a log listener is crashing while we are handling exceptions.
- We can't do much here. Core should have already logged the exception since it
- should be the first log listener */
- System.err.println("A fatal error happened while logging a fatal error."); //$NON-NLS-1$
- t.printStackTrace();
- System.err.println("New exception."); //$NON-NLS-1$
- th.printStackTrace();
- }
-}
-/**
- * Inform the user about a fatal error. Return true if the user decide to
- * exit workspace or if another faltal error happens while reporting it.
- */
-private boolean openQuestionDialog(Throwable internalError) {
- try {
- String msg = null;
- if(internalError instanceof OutOfMemoryError) {
- msg = MSG_OutOfMemoryError;
- } else if(internalError instanceof StackOverflowError) {
- msg = MSG_StackOverflowError;
- } else if(internalError instanceof VirtualMachineError) {
- msg = MSG_VirtualMachineError;
- } else if(internalError instanceof SWTError) {
- msg = MSG_SWTError;
- } else {
- if (internalError.getMessage() == null) {
- msg = WorkbenchMessages.getString("InternalErrorNoArg"); //$NON-NLS-1$
- } else {
- msg = WorkbenchMessages.format("InternalErrorOneArg", new Object[] {internalError.getMessage()}); //$NON-NLS-1$
- }
- if(OPEN_DIALOG)
- return openQuestion(null, WorkbenchMessages.getString("Internal_error"), msg,internalError,1); //$NON-NLS-1$
- else
- return false;
- }
- //Allways open the dialog in case of major error but does not show the detail button
- //if OPEN_DIALOG is false.
- Throwable detail = internalError;
- if(!OPEN_DIALOG)
- detail = null;
- return InternalErrorDialog.openQuestion(null, WorkbenchMessages.getString("Internal_error"), msg + MSG_FATAL_ERROR,detail,1); //$NON-NLS-1$
- } catch (Throwable th) {
- /* It may not be possible to show the inform the user about this exception we may not
- * have more memory or OS handles etc. */
- System.err.println("A fatal error happened while informing the user about a fatal error."); //$NON-NLS-1$
- internalError.printStackTrace();
- System.err.println("New exception."); //$NON-NLS-1$
- th.printStackTrace();
- return true;
- }
-}
-
-private boolean openQuestion(Shell parent, String title, String message, Throwable detail,int defaultIndex) {
- String[] labels;
- if(detail == null)
- labels = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL};
- else
- labels = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,IDialogConstants.SHOW_DETAILS_LABEL};
-
- dialog = new InternalErrorDialog(
- parent,
- title,
- null, // accept the default window icon
- message,
- detail,
- InternalErrorDialog.QUESTION,
- labels,
- defaultIndex);
-
- if(detail != null)
- dialog.setDetailButton(2);
- boolean result = dialog.open() == 0;
- dialog = null;
- return result;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FolderLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FolderLayout.java
deleted file mode 100644
index f5e535b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/FolderLayout.java
+++ /dev/null
@@ -1,89 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.registry.*;
-import java.util.*;
-
-/**
- * This layout is used to define the initial set of views and placeholders
- * in a folder.
- * <p>
- * Views are added to the folder by ID. This id is used to identify
- * a view descriptor in the view registry, and this descriptor is used to
- * instantiate the IViewPart.
- * </p>
- */
-public class FolderLayout implements IFolderLayout {
- private ViewFactory viewFactory;
- private PartTabFolder folder;
- private PageLayout pageLayout;
-
-/**
- * Create an instance of a FolderLayout belonging to an PageLayout.
- */
-public FolderLayout(PageLayout pageLayout, PartTabFolder folder, ViewFactory viewFactory) {
- super();
- this.folder = folder;
- this.viewFactory = viewFactory;
- this.pageLayout = pageLayout;
-}
-/**
- * @see IFolderLayout
- */
-public void addPlaceholder(String viewId) {
- if (pageLayout.checkPartInLayout(viewId))
- return;
-
- // Get the view's label.
- IViewRegistry reg = WorkbenchPlugin.getDefault().getViewRegistry();
- IViewDescriptor desc = reg.find(viewId);
- if (desc == null) {
- // cannot safely open the dialog so log the problem
- WorkbenchPlugin.log("Unable to find view label: " + viewId);//$NON-NLS-1$
- return;
- }
-
- // Create the placeholder.
- LayoutPart newPart = new PartPlaceholder(viewId);
- linkPartToPageLayout(viewId, newPart);
-
- // Add it to the folder layout.
- String label = desc.getLabel();
- folder.add(label, folder.getItemCount(), newPart);
-}
-/**
- * @see IFolderLayout
- */
-public void addView(String viewId) {
- if (pageLayout.checkPartInLayout(viewId))
- return;
-
- try {
- // Create the part.
- IViewReference ref = viewFactory.createView(viewId);
- IViewPart view = (IViewPart)ref.getPart(true);
- ViewSite site = (ViewSite)view.getSite();
- LayoutPart newPart = site.getPane();
- linkPartToPageLayout(viewId, newPart);
-
- // Add it to the folder.
- folder.add(newPart);
- } catch (PartInitException e) {
- // cannot safely open the dialog so log the problem
- WorkbenchPlugin.log(e.getMessage()) ;
- }
-}
-/**
- * Inform the page layout of the new part created
- * and the folder the part belongs to.
- */
-private void linkPartToPageLayout(String viewId, LayoutPart newPart) {
- pageLayout.setRefPart(viewId, newPart);
- pageLayout.setFolderPart(viewId, folder);
-}
-}
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
deleted file mode 100644
index 7b89e90..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IActionSetContributionItem.java
+++ /dev/null
@@ -1,21 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * This interface should be implemented by all contribution items
- * defined by an action set.
- */
-public interface IActionSetContributionItem {
-
-/**
- * Returns the action set id.
- */
-public String getActionSetId();
-/**
- * Sets the action set id.
- */
-public void setActionSetId(String newActionSetId);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IHelpContextIds.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IHelpContextIds.java
deleted file mode 100644
index 04b18d0..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IHelpContextIds.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Help context ids for the workbench.
- * <p>
- * This interface contains constants only; it is not intended to be implemented
- * or extended.
- * </p>
- *
- */
-public interface IHelpContextIds {
- public static final String PREFIX = PlatformUI.PLUGIN_ID + "."; //$NON-NLS-1$
-
- // Actions
- public static final String ADD_BOOKMARK_ACTION = PREFIX + "add_bookmark_action_context"; //$NON-NLS-1$
- public static final String ADD_TASK_ACTION = PREFIX + "add_task_action_context"; //$NON-NLS-1$
- public static final String INCREMENTAL_BUILD_ACTION = PREFIX + "incremental_build_action_context"; //$NON-NLS-1$
- public static final String FULL_BUILD_ACTION = PREFIX + "full_build_action_context"; //$NON-NLS-1$
- public static final String CLOSE_RESOURCE_ACTION = PREFIX + "close_resource_action_context"; //$NON-NLS-1$
- public static final String OPEN_RESOURCE_ACTION = PREFIX + "open_resource_action_context"; //$NON-NLS-1$
- public static final String OPEN_FILE_ACTION = PREFIX + "open_file_action_context"; //$NON-NLS-1$
- public static final String OPEN_SYSTEM_EDITOR_ACTION = PREFIX + "open_system_editor_action_context"; //$NON-NLS-1$
- public static final String REFRESH_ACTION = PREFIX + "refresh_action_context"; //$NON-NLS-1$
- public static final String MOVE_RESOURCE_ACTION = PREFIX + "move_resource_action_context"; //$NON-NLS-1$
- public static final String COPY_RESOURCE_ACTION = PREFIX + "copy_resource_action_context"; //$NON-NLS-1$
- public static final String MOVE_PROJECT_ACTION = PREFIX + "move_project_action_context"; //$NON-NLS-1$
- public static final String COPY_PROJECT_ACTION = PREFIX + "copy_project_action_context"; //$NON-NLS-1$
- public static final String RENAME_RESOURCE_ACTION = PREFIX + "rename_resource_action_context"; //$NON-NLS-1$
- public static final String DELETE_RESOURCE_ACTION = PREFIX + "delete_resource_action_context"; //$NON-NLS-1$
- public static final String PROPERTY_DIALOG_ACTION = PREFIX + "property_dialog_action_context"; //$NON-NLS-1$
- public static final String CREATE_FOLDER_ACTION = PREFIX + "create_folder_action_context"; //$NON-NLS-1$
- public static final String CREATE_FILE_ACTION = PREFIX + "create_file_action_context"; //$NON-NLS-1$
- public static final String NEW_ACTION = PREFIX + "new_action_context"; //$NON-NLS-1$
- public static final String IMPORT_ACTION = PREFIX + "import_action_context"; //$NON-NLS-1$
- public static final String EXPORT_ACTION = PREFIX + "export_action_context"; //$NON-NLS-1$
- public static final String SCRUB_LOCAL_ACTION = PREFIX + "scrub_local_action_context"; //$NON-NLS-1$
- public static final String SET_PAGE_ACTION = PREFIX + "set_page_action_context"; //$NON-NLS-1$
- public static final String SAVE_PERSPECTIVE_ACTION = PREFIX + "save_perspective_action_context"; //$NON-NLS-1$
- public static final String SAVE_AS_ACTION = PREFIX + "save_as_action_context"; //$NON-NLS-1$
- public static final String SAVE_ALL_ACTION = PREFIX + "save_all_action_context"; //$NON-NLS-1$
- public static final String SAVE_ACTION = PREFIX + "save_action_context"; //$NON-NLS-1$
- public static final String ABOUT_ACTION = PREFIX + "about_action_context"; //$NON-NLS-1$
- public static final String CLOSE_ALL_ACTION = PREFIX + "close_all_action_context"; //$NON-NLS-1$
- public static final String LOCK_TOOLBAR_ACTION = PREFIX + "lock_toolbar_action_context"; //$NON-NLS-1$
- public static final String CLOSE_PAGE_ACTION = PREFIX + "close_page_action_context"; //$NON-NLS-1$
- public static final String CLOSE_PART_ACTION = PREFIX + "close_part_action_context"; //$NON-NLS-1$
- public static final String EDIT_ACTION_SETS_ACTION = PREFIX + "edit_action_sets_action_context"; //$NON-NLS-1$
- public static final String EDIT_PERSPECTIVES_ACTION = PREFIX + "edit_perspectives_action_context"; //$NON-NLS-1$
- public static final String GLOBAL_INCREMENTAL_BUILD_ACTION = PREFIX + "global_incremental_build_action_context"; //$NON-NLS-1$
- public static final String GLOBAL_FULL_BUILD_ACTION = PREFIX + "global_full_build_action_context"; //$NON-NLS-1$
- public static final String DELETE_RETARGET_ACTION = PREFIX + "delete_retarget_action_context"; //$NON-NLS-1$
- public static final String CLOSE_ALL_PAGES_ACTION = PREFIX + "close_all_pages_action_context"; //$NON-NLS-1$
- public static final String OPEN_NEW_PAGE_ACTION = PREFIX + "open_new_page_action_context"; //$NON-NLS-1$
- public static final String OPEN_NEW_WINDOW_ACTION = PREFIX + "open_new_window_action_context"; //$NON-NLS-1$
- public static final String OPEN_PREFERENCES_ACTION = PREFIX + "open_preferences_action_context"; //$NON-NLS-1$
- public static final String OPEN_NEW_ACTION = PREFIX + "open_new_action_context"; //$NON-NLS-1$
- public static final String NEXT_PAGE_ACTION = PREFIX + "next_page_action_context"; //$NON-NLS-1$
- public static final String QUICK_START_ACTION = PREFIX + "quick_start_action_context"; //$NON-NLS-1$
- public static final String QUIT_ACTION = PREFIX + "quit_action_context"; //$NON-NLS-1$
- public static final String RESET_PERSPECTIVE_ACTION = PREFIX + "reset_perspective_action_context"; //$NON-NLS-1$
- public static final String RESET_TOOLBAR_ACTION = PREFIX + "reset_toolbar_action_context"; //$NON-NLS-1$
- public static final String TOGGLE_EDITORS_VISIBILITY_ACTION = PREFIX + "target_editors_visibility_action_context"; //$NON-NLS-1$
- public static final String SWITCH_TO_PERSPECTIVE_ACTION = PREFIX + "switch_to_perspective_action_context"; //$NON-NLS-1$
- public static final String SHOW_VIEW_ACTION = PREFIX + "show_view_action_context"; //$NON-NLS-1$
- public static final String CLOSE_ALL_SAVED_ACTION = PREFIX + "close_all_saved_action_context"; //$NON-NLS-1$
- public static final String SHOW_VIEW_MENU_ACTION = PREFIX + "show_view_menu_action_context"; //$NON-NLS-1$
- public static final String WORKBENCH_EDITORS_ACTION = PREFIX + "workbench_editors_action_context"; //$NON-NLS-1$
- public static final String NEW_WIZARD_SHORTCUT_ACTION = PREFIX + "new_wizard_shortcut_action_context"; //$NON-NLS-1$
- public static final String TEXT_CUT_ACTION = PREFIX + "text_cut_action_context"; //$NON-NLS-1$
- public static final String TEXT_COPY_ACTION = PREFIX + "text_copy_action_context"; //$NON-NLS-1$
- public static final String TEXT_PASTE_ACTION = PREFIX + "text_paste_action_context"; //$NON-NLS-1$
- public static final String TEXT_DELETE_ACTION = PREFIX + "text_delete_action_context"; //$NON-NLS-1$
- public static final String TEXT_SELECT_ALL_ACTION = PREFIX + "text_select_all_action_context"; //$NON-NLS-1$
- public static final String CELL_CUT_ACTION = PREFIX + "cell_cut_action_context"; //$NON-NLS-1$
- public static final String CELL_COPY_ACTION = PREFIX + "cell_copy_action_context"; //$NON-NLS-1$
- public static final String CELL_PASTE_ACTION = PREFIX + "cell_paste_action_context"; //$NON-NLS-1$
- public static final String CELL_DELETE_ACTION = PREFIX + "cell_delete_action_context"; //$NON-NLS-1$
- public static final String CELL_FIND_ACTION = PREFIX + "cell_find_action_context"; //$NON-NLS-1$
- public static final String CELL_SELECT_ALL_ACTION = PREFIX + "cell_select_all_action_context"; //$NON-NLS-1$
- public static final String CELL_UNDO_ACTION = PREFIX + "cell_undo_action_context"; //$NON-NLS-1$
- public static final String CELL_REDO_ACTION = PREFIX + "cell_redo_action_context"; //$NON-NLS-1$
- public static final String SHOW_PART_PANE_MENU_ACTION = PREFIX + "show_part_pane_menu_action_context"; //$NON-NLS-1$
- public static final String CYCLE_PART_FORWARD_ACTION = PREFIX + "cycle_part_forward_action_context"; //$NON-NLS-1$
- public static final String CYCLE_PART_BACKWARD_ACTION = PREFIX + "cycle_part_backward_action_context"; //$NON-NLS-1$
- public static final String CYCLE_EDITOR_FORWARD_ACTION = PREFIX + "cycle_editor_forward_action_context"; //$NON-NLS-1$
- public static final String CYCLE_EDITOR_BACKWARD_ACTION = PREFIX + "cycle_editor_backward_action_context"; //$NON-NLS-1$
- public static final String CYCLE_PERSPECTIVE_FORWARD_ACTION = PREFIX + "cycle_perspective_forward_action_context"; //$NON-NLS-1$
- public static final String CYCLE_PERSPECTIVE_BACKWARD_ACTION = PREFIX + "cycle_perspective_backward_action_context"; //$NON-NLS-1$
- public static final String ACTIVATE_EDITOR_ACTION = PREFIX + "activate_editor_action_context"; //$NON-NLS-1$
-
- // Dialogs
- public static final String ABOUT_DIALOG = PREFIX + "about_dialog_context"; //$NON-NLS-1$
- public static final String ABOUT_PLUGINS_DIALOG = PREFIX + "about_plugins_dialog_context"; //$NON-NLS-1$
- public static final String ABOUT_FEATURES_DIALOG = PREFIX + "about_features_dialog_context"; //$NON-NLS-1$
- public static final String ACTION_SET_SELECTION_DIALOG = PREFIX + "action_set_selection_dialog_context"; //$NON-NLS-1$
- public static final String EDITOR_SELECTION_DIALOG = PREFIX + "editor_selection_dialog_context"; //$NON-NLS-1$
- public static final String FILE_EXTENSION_DIALOG = PREFIX + "file_extension_dialog_context"; //$NON-NLS-1$
- public static final String PREFERENCE_DIALOG = PREFIX + "preference_dialog_context"; //$NON-NLS-1$
- public static final String PROPERTY_DIALOG = PREFIX + "property_dialog_context"; //$NON-NLS-1$
- public static final String SAVE_PERSPECTIVE_DIALOG = PREFIX + "save_perspective_dialog_context"; //$NON-NLS-1$
- public static final String SELECT_PERSPECTIVE_DIALOG = PREFIX + "select_perspective_dialog_context"; //$NON-NLS-1$
- public static final String PROJECT_LOCATION_SELECTION_DIALOG = PREFIX + "project_location_selection_dialog_context"; //$NON-NLS-1$
- public static final String SHOW_VIEW_DIALOG = PREFIX + "show_view_dialog_context"; //$NON-NLS-1$
- public static final String SHOW_PROJECT_PERSPECTIVE_DIALOG = PREFIX + "show_project_perspective_dialog_context"; //$NON-NLS-1$
- public static final String SAVE_AS_DIALOG = PREFIX + "save_as_dialog_context"; //$NON-NLS-1$
- public static final String TYPE_FILTERING_DIALOG = PREFIX + "type_filtering_dialog_context"; //$NON-NLS-1$
- public static final String CONTAINER_SELECTION_DIALOG = PREFIX + "container_selection_dialog_context"; //$NON-NLS-1$
- public static final String FILE_SELECTION_DIALOG = PREFIX + "file_selection_dialog_context"; //$NON-NLS-1$
- public static final String LIST_SELECTION_DIALOG = PREFIX + "list_selection_dialog_context"; //$NON-NLS-1$
- public static final String YES_NO_CANCEL_LIST_SELECTION_DIALOG = PREFIX + "yes_no_cancel_list_selection_dialog_context"; //$NON-NLS-1$
- public static final String RESOURCE_SELECTION_DIALOG = PREFIX + "resource_selection_dialog_context"; //$NON-NLS-1$
- public static final String GOTO_LINE_DIALOG = PREFIX + "goto_line_dialog_context"; //$NON-NLS-1$
- public static final String WORKING_SET_SELECTION_DIALOG = PREFIX + "working_set_selection_dialog_context" ; //$NON-NLS-1$
- public static final String DELETE_PROJECT_DIALOG = PREFIX + "delete_project_dialog_context"; //$NON-NLS-1$
- public static final String FILTER_DIALOG = PREFIX + "filter_dialog_context"; //$NON-NLS-1$
- public static final String MARKER_RESOLUTION_SELECTION_DIALOG = PREFIX + "marker_resolution_selection_dialog_context"; //$NON-NLS-1$
- public static final String WORKBENCH_EDITORS_DIALOG = PREFIX + "workbench_editors_dialog"; //$NON-NLS-1$
- public static final String WELCOME_PAGE_SELECTION_DIALOG = PREFIX + "welcome_page_selection_dialog"; //$NON-NLS-1$
-
- // Editors
- public static final String WELCOME_EDITOR = PREFIX + "welcome_editor_context"; //$NON-NLS-1$
-
- // Preference pages
- public static final String BUILD_ORDER_PREFERENCE_PAGE = PREFIX + "build_order_preference_page_context"; //$NON-NLS-1$
- public static final String FILE_EDITORS_PREFERENCE_PAGE = PREFIX + "file_editors_preference_page_context"; //$NON-NLS-1$
- public static final String FILE_STATES_PREFERENCE_PAGE = PREFIX + "file_states_preference_page_context"; //$NON-NLS-1$
- public static final String PERSPECTIVES_PREFERENCE_PAGE = PREFIX + "perspectives_preference_page_context"; //$NON-NLS-1$
- public static final String VIEWS_PREFERENCE_PAGE = PREFIX + "views_preference_page_context"; //$NON-NLS-1$
- public static final String COMPARE_VIEWERS_PREFERENCE_PAGE = PREFIX + "compare_viewers_preference_page_context"; //$NON-NLS-1$
- public static final String WORKBENCH_EDITOR_PREFERENCE_PAGE = PREFIX + "workbench_editor_preference_page_context"; //$NON-NLS-1$
- public static final String WORKBENCH_PREFERENCE_PAGE = PREFIX + "workbench_preference_page_context"; //$NON-NLS-1$
- public static final String FONT_PREFERENCE_PAGE = PREFIX + "font_preference_page_context"; //$NON-NLS-1$
- public static final String DECORATORS_PREFERENCE_PAGE = PREFIX + "decorators_preference_page_context"; //$NON-NLS-1$
- public static final String STARTUP_PREFERENCE_PAGE = PREFIX + "startup_preference_page_context"; //$NON-NLS-1$
-
- // Property pages
- public static final String PROJECT_REFERENCE_PROPERTY_PAGE = PREFIX + "project_reference_property_page_context"; //$NON-NLS-1$
- public static final String PROJECT_CAPABILITY_PROPERTY_PAGE = PREFIX + "project_capability_property_page_context"; //$NON-NLS-1$
- public static final String RESOURCE_INFO_PROPERTY_PAGE = PREFIX + "resource_info_property_page_context"; //$NON-NLS-1$
-
- // Windows
- public static final String DETACHED_WINDOW = PREFIX + "detached_window_context"; //$NON-NLS-1$
- public static final String WORKBENCH_WINDOW = PREFIX + "workbench_window_context"; //$NON-NLS-1$
-
- // Wizard pages
- public static final String NEW_PROJECT_WIZARD_PAGE = PREFIX + "new_project_wizard_page_context"; //$NON-NLS-1$
- public static final String NEW_PROJECT_REFERENCE_WIZARD_PAGE = PREFIX + "new_project_reference_wizard_page_context"; //$NON-NLS-1$
- public static final String NEW_PROJECT_CAPABILITY_WIZARD_PAGE = PREFIX + "new_project_capability_wizard_page_context"; //$NON-NLS-1$
- public static final String NEW_PROJECT_REVIEW_WIZARD_PAGE = PREFIX + "new_project_review_wizard_page_context"; //$NON-NLS-1$
- public static final String NEW_PROJECT_CONFIGURE_WIZARD_PAGE = PREFIX + "new_project_configure_wizard_page_context"; //$NON-NLS-1$
- public static final String NEW_FOLDER_WIZARD_PAGE = PREFIX + "new_folder_wizard_page_context"; //$NON-NLS-1$
- public static final String NEW_FILE_WIZARD_PAGE = PREFIX + "new_file_wizard_page_context"; //$NON-NLS-1$
- public static final String NEW_WIZARD_SELECTION_WIZARD_PAGE = PREFIX + "new_wizard_selection_wizard_page_context"; //$NON-NLS-1$
- public static final String EXPORT_WIZARD_SELECTION_WIZARD_PAGE = PREFIX + "export_wizard_selection_wizard_page_context"; //$NON-NLS-1$
- public static final String IMPORT_WIZARD_SELECTION_WIZARD_PAGE = PREFIX + "import_wizard_selection_wizard_page_context"; //$NON-NLS-1$
- public static final String WORKING_SET_RESOURCE_PAGE = PREFIX + "working_set_resource_page"; //$NON-NLS-1$
- public static final String WORKING_SET_TYPE_PAGE = PREFIX + "working_set_type_page"; //$NON-NLS-1$
-
- // Wizards
- public static final String NEW_WIZARD = PREFIX + "new_wizard_context"; //$NON-NLS-1$
- public static final String NEW_WIZARD_SHORTCUT = PREFIX + "new_wizard_shortcut_context"; //$NON-NLS-1$
- public static final String NEW_FILE_WIZARD = PREFIX + "new_file_wizard_context"; //$NON-NLS-1$
- public static final String NEW_FOLDER_WIZARD = PREFIX + "new_folder_wizard_context"; //$NON-NLS-1$
- public static final String NEW_PROJECT_WIZARD = PREFIX + "new_project_wizard_context"; //$NON-NLS-1$
- public static final String IMPORT_WIZARD = PREFIX + "import_wizard_context"; //$NON-NLS-1$
- public static final String EXPORT_WIZARD = PREFIX + "export_wizard_context"; //$NON-NLS-1$
- public static final String UPDATE_CAPABILITY_WIZARD = PREFIX + "update_capability_wizard_context"; //$NON-NLS-1$
- public static final String WORKING_SET_NEW_WIZARD = PREFIX + "working_set_new_wizard_context"; //$NON-NLS-1$
- public static final String WORKING_SET_EDIT_WIZARD = PREFIX + "working_set_edit_wizard_context"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IInternalPerspectiveListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IInternalPerspectiveListener.java
deleted file mode 100644
index edaea49..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IInternalPerspectiveListener.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.ui.*;
-
-/**
- * Interface for listening to a perspective lifecycle events.
- * <p>
- * This interface may be implemented by clients.
- * </p>
- *
- * @see IPerspectiveService
- */
-public interface IInternalPerspectiveListener extends IPerspectiveListener {
-
- /**
- * Notifies this listener that the given page's perspective
- * has been closed.
- *
- * @param page the page whose perspective was closed
- * @param perspective the descriptor of the perspective that was closed
- */
- public void perspectiveClosed(IWorkbenchPage page, IPerspectiveDescriptor perspective);
-
- /**
- * Notifies this listener that the given page's perspective
- * has been opened. The perspective is not active yet.
- *
- * @param page the page whose perspective was opened
- * @param perspective the descriptor of the perspective that was opened
- */
- public void perspectiveOpened(IWorkbenchPage page, IPerspectiveDescriptor perspective);
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ILayoutContainer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ILayoutContainer.java
deleted file mode 100644
index fcfddd5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ILayoutContainer.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-public interface ILayoutContainer {
-/**
- * Add a child to the container.
- */
-public void add(LayoutPart newPart);
-/**
- * Return true if the container allows its
- * parts to show a border if they choose to,
- * else false if the container does not want
- * its parts to show a border.
- */
-public boolean allowsBorder();
-/**
- * Returns a list of layout children.
- */
-public LayoutPart [] getChildren();
-/**
- * Remove a child from the container.
- */
-public void remove(LayoutPart part);
-/**
- * Replace one child with another
- */
-public void replace(LayoutPart oldPart, LayoutPart newPart);
-/**
- * Gets the parent for this container.
- */
-public ILayoutContainer getContainer();
-/**
- * Gets root container for this part.
- */
-public RootLayoutContainer getRootContainer();
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IMarkerImageProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IMarkerImageProvider.java
deleted file mode 100644
index 175717c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IMarkerImageProvider.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.core.resources.IMarker;
-/**
- * Clients should implement this interface when creating an
- * extension to define images for marker dynamically.
- * <p>
- * The name of the class should be specified in the extension contributed
- * to the workbench's maker image provider extension point
- * (named <code>"org.eclipse.ui.makerImageProvider"</code>).
- * For example, the plug-in's XML markup might contain:
- * <pre>
- * <extension point="org.eclipse.ui.makerImageProvider">
- * <imageprovider
- * id="com.example.myplugin.myprofiderID"
- * makertype="com.example.myMarkerType"
- * icon="icons/basic/view16/myGIF.gif"/>
- * </extension>
- * </pre>
- * It can also define the image provider using the tag <code>class</code>
- * instead of icon.
- * </p>
- * Either the image path specified by the tag <code>icon</code> or
- * the path returned from <code>getImagePath</code> will be used
- * to create the image when the following code is executed:
- * <p><code>myMarker.getAdapter(IWorkbenchAdapter).getImageDescriptor(myMarker);</code></p>
- */
-public interface IMarkerImageProvider {
-/**
- * Returns the relative path for the image
- * to be used for displaying an marker in the workbench.
- * This path is relative to the plugin location
- *
- * Returns <code>null</code> if there is no appropriate image.
- *
- * @param marker The marker to get an image path for.
- *
- * @see org.eclipse.jface.resource.FileImageDescriptor
- */
-public String getImagePath(IMarker marker);
-}
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
deleted file mode 100644
index 26342ff..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectActionContributor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.IMenuManager;
-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.
- */
-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 True if any contributions were made, and false otherwise.
- */
-public boolean contributeObjectActions(IWorkbenchPart part, 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 True if any contributions were made, and false otherwise.
- */
-public boolean contributeObjectMenus(IMenuManager menu, ISelectionProvider selProv);
-}
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
deleted file mode 100644
index 2610d6a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IObjectContributor.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * 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.
- *
- * @see IObjectContributorManager
- */
-
-public interface IObjectContributor {
-/**
- * Returns true if this contributor should be considered
- * for the given object.
- */
-public boolean isApplicableTo(Object object);
-
-/**
- * Return whether or not the receiver can adapt to IResource.
- */
-public boolean canAdapt();
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPartDropListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPartDropListener.java
deleted file mode 100644
index e8cd810..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPartDropListener.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-public interface IPartDropListener {
-public void dragOver(PartDropEvent event);
-public void drop(PartDropEvent event);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPartDropTarget.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPartDropTarget.java
deleted file mode 100644
index 0a139c4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPartDropTarget.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Specifies the target layout part that accepts
- * the source part during drag and drop.
- *
- * @see PartDragDrop
- */
-public interface IPartDropTarget {
-/**
- * Return the layout part that would accept
- * the drag source part, or null if not applicable.
- *
- * @return org.eclipse.ui.internal.LayoutPart
- * @param dragSource org.eclipse.ui.internal.LayoutPart
- */
-LayoutPart targetPartFor(LayoutPart dragSource);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPerspectiveService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPerspectiveService.java
deleted file mode 100644
index f0ec2ad..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPerspectiveService.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.ui.*;
-
-/**
- * A perspective service tracks the activation and reset of perspectives within a
- * workbench page.
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- *
- * @see IWorkbenchPage
- */
-public interface IPerspectiveService {
-/**
- * Adds the given listener for a page's perspective lifecycle events.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a perspective listener
- */
-public void addPerspectiveListener(IInternalPerspectiveListener listener);
-/*
- * Returns the active perspective descriptor in the active workbench page.
- *
- * @return the active perspective descriptor, or <code>null</code> if no perspective is currently active
- */
-public IPerspectiveDescriptor getActivePerspective();
-/**
- * Removes the given page's perspective listener.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a perspective listener
- */
-public void removePerspectiveListener(IInternalPerspectiveListener listener);
-}
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
deleted file mode 100644
index bcb7980..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IPreferenceConstants.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * The IPreferenceConstants are the internal constants used by the Workbench.
- */
-public interface IPreferenceConstants {
- // (boolean) Whether or not to display the Welcome dialog on startup.
- public static final String WELCOME_DIALOG = "WELCOME_DIALOG"; //$NON-NLS-1$
-
- // (boolean) Cause all editors to save modified resources prior
- // to running a full or incremental manual build.
- public static final String SAVE_ALL_BEFORE_BUILD = "SAVE_ALL_BEFORE_BUILD"; //$NON-NLS-1$
-
- // (boolean) Whether or not to automatically run a build
- // when a resource is modified. NOTE: The value is not
- // actually in the preference store but available from
- // IWorkspace. This constant is used solely for property
- // change notification from the preference store so
- // interested parties can listen for all preference changes.
- public static final String AUTO_BUILD = "AUTO_BUILD"; //$NON-NLS-1$
-
- //Do we show tabs up or down for views
- public static final String VIEW_TAB_POSITION = "VIEW_TAB_POSITION"; //$NON-NLS-1$
-
- //Boolean: true = single click opens editor; false = double click opens it.
- public static final String OPEN_ON_SINGLE_CLICK = "OPEN_ON_SINGLE_CLICK"; //$NON-NLS-1$
- //Boolean: true = select on hover;
- public static final String SELECT_ON_HOVER = "SELECT_ON_HOVER"; //$NON-NLS-1$
- //Boolean: true = open after delay
- public static final String OPEN_AFTER_DELAY = "OPEN_AFTER_DELAY"; //$NON-NLS-1$
-
- //Do we show tabs up or down for editors
- public static final String EDITOR_TAB_POSITION = "EDITOR_TAB_POSITION"; //$NON-NLS-1$
-
- //mappings for type/extension to an editor
- public final static String EDITORS = "editors"; //$NON-NLS-1$
- public final static String RESOURCES = "resourcetypes"; //$NON-NLS-1$
-
- // (int) If > 0, an editor will be reused once 'N' editors are opened.
- public static final String REUSE_EDITORS = "REUSE_OPEN_EDITORS"; //$NON-NLS-1$
- //Boolean: true = replace dirty editor if no other editors to reuse (prompt for save);
- // false = open a new editor if no other editors to resuse
- public static final String REUSE_DIRTY_EDITORS = "REUSE_DIRTY_EDITORS"; //$NON-NLS-1$
- //On/Off option for the two preceding options.
- public static final 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.
- public static final String RECENT_FILES = "RECENT_FILES"; //$NON-NLS-1$
- public static final int MAX_RECENT_FILES_SIZE = 15;
-
- // (integer) Mode for opening a view.
- public static final String OPEN_VIEW_MODE = "OPEN_VIEW_MODE"; //$NON-NLS-1$
- public static final int OVM_EMBED = 0;
- public static final int OVM_FAST = 1;
- public static final int OVM_FLOAT = 2;
-
- // (int) Mode for opening a new perspective
- public static final String OPEN_PERSP_MODE = "OPEN_PERSPECTIVE_MODE"; //$NON-NLS-1$
- public static final int OPM_ACTIVE_PAGE = 0;
- //public static final int OPM_NEW_PAGE = 1;
- public static final int OPM_NEW_WINDOW = 2;
-
- //Identifier for enabled decorators
- public static final String ENABLED_DECORATORS = "ENABLED_DECORATORS"; //$NON-NLS-1$
-
- //Boolean: true = refresh workspace on startup if the command line does
- //not have the -refresh option
- public static final String REFRESH_WORKSPACE_ON_STARTUP = "REFRESH_WORKSPACE_ON_STARTUP"; //$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 ";"
- public static final String PLUGINS_NOT_ACTIVATED_ON_STARTUP = "PLUGINS_NOT_ACTIVATED_ON_STARTUP"; //$NON-NLS-1$
-
- //Separator for PLUGINS_NOT_ACTIVATED_ON_STARTUP
- public static char SEPARATOR = ';'; //$NON-NLS-1$
-
- //Preference key for default editors
- public final static String DEFAULT_EDITORS = "defaultEditors"; //$NON-NLS-1$
-
- //Preference key for default editors
- public final static String DEFAULT_EDITORS_CACHE = "defaultEditorsCache"; //$NON-NLS-1$
-
- //Workspace save interval in minutes
- public final static String SAVE_INTERVAL = "saveInterval";
- public static final int MAX_SAVE_INTERVAL = 9999;
-}
\ No newline at end of file
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
deleted file mode 100644
index c55f6f9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchConstants.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import org.eclipse.ui.PlatformUI;
-
-/**
- * General constants used by the workbench.
- */
-public interface IWorkbenchConstants {
-
- // Workbench Extension Point Names
- public static final String PL_ACTION_SETS = "actionSets"; //$NON-NLS-1$
- public static final String PL_VIEW_ACTIONS = "viewActions"; //$NON-NLS-1$
- public static final String PL_EDITOR_ACTIONS = "editorActions"; //$NON-NLS-1$
- public static final String PL_PERSPECTIVES ="perspectives"; //$NON-NLS-1$
- public static final String PL_PERSPECTIVE_EXTENSIONS ="perspectiveExtensions"; //$NON-NLS-1$
- public static final String PL_ACTION_SET_PART_ASSOCIATIONS ="actionSetPartAssociations"; //$NON-NLS-1$
- public static final String PL_PREFERENCES ="preferencePages"; //$NON-NLS-1$
- public static final String PL_PROPERTY_PAGES ="propertyPages"; //$NON-NLS-1$
- public static final String PL_EDITOR ="editors"; //$NON-NLS-1$
- public static final String PL_VIEWS ="views"; //$NON-NLS-1$
- public static final String PL_POPUP_MENU ="popupMenus"; //$NON-NLS-1$
- public static final String PL_IMPORT ="importWizards"; //$NON-NLS-1$
- public static final String PL_EXPORT ="exportWizards"; //$NON-NLS-1$
- public static final String PL_NEW ="newWizards"; //$NON-NLS-1$
- public static final String PL_ELEMENT_FACTORY ="elementFactories"; //$NON-NLS-1$
- public static final String PL_DROP_ACTIONS ="dropActions"; //$NON-NLS-1$
- public static final String PL_MARKER_IMAGE_PROVIDER ="markerImageProviders"; //$NON-NLS-1$
- public static final String PL_MARKER_HELP ="markerHelp"; //$NON-NLS-1$
- public static final String PL_MARKER_RESOLUTION ="markerResolution"; //$NON-NLS-1$
- public static final String PL_ACCELERATOR_CONFIGURATIONS ="acceleratorConfigurations"; //$NON-NLS-1$
- public static final String PL_ACCELERATOR_SCOPES ="acceleratorScopes"; //$NON-NLS-1$
- public static final String PL_ACCELERATOR_SETS ="acceleratorSets"; //$NON-NLS-1$
- public static final String PL_ACTION_DEFINITIONS ="actionDefinitions"; //$NON-NLS-1$
- public static final String PL_CAPABILITIES = "capabilities"; //$NON-NLS-1$
- public static final String PL_WORKINGSETS = "workingSets"; //$NON-NLS-1$
-
- /**
- * @deprecated Extension point no longer applicable with new project capability
- */
- public static final String PL_PROJECT_NATURE_IMAGES ="projectNatureImages"; //$NON-NLS-1$
-
- // Key binding service defaults
- public static final String ACCELERATOR_CONFIGURATION_ID = "acceleratorConfigurationId"; //$NON-NLS-1$
- public static final String DEFAULT_ACCELERATOR_CONFIGURATION_ID = "org.eclipse.ui.defaultAcceleratorConfiguration"; //$NON-NLS-1$
- public static final String DEFAULT_ACCELERATOR_SCOPE_ID = "org.eclipse.ui.globalScope"; //$NON-NLS-1$
-
- //mappings for type/extension to an editor - backward compatibility only.
- public final static String EDITOR_FILE_NAME = "editors.xml"; //$NON-NLS-1$
- public final static String RESOURCE_TYPE_FILE_NAME = "resourcetypes.xml"; //$NON-NLS-1$
-
- // Filename containing the workbench's preferences
- public static final String PREFERENCE_BUNDLE_FILE_NAME = "workbench.ini"; //$NON-NLS-1$
-
- // Identifier for visible view parts.
- public static final String WORKBENCH_VISIBLE_VIEW_ID = "Workbench.visibleViewID"; //$NON-NLS-1$
-
- // String to show in preference dialog as root node of workbench preferences
- public static final String WORKBENCH_PREFERENCE_CATEGORY_ID = PlatformUI.PLUGIN_ID + ".preferencePages.Workbench"; //$NON-NLS-1$
-
- // Identifier of workbench info properties page
- public static final String WORKBENCH_PROPERTIES_PAGE_INFO = PlatformUI.PLUGIN_ID + ".propertypages.info.file"; //$NON-NLS-1$
-
- // Default layout.
- public static final String DEFAULT_LAYOUT_ID = PlatformUI.PLUGIN_ID + ".resourcePerspective"; //$NON-NLS-1$
-
- // Various editor.
- public static final String DEFAULT_EDITOR_ID = PlatformUI.PLUGIN_ID + ".DefaultTextEditor"; //$NON-NLS-1$
- public static final String OLE_EDITOR_ID = PlatformUI.PLUGIN_ID + ".OleEditor"; //$NON-NLS-1$
- public static final String SYSTEM_EDITOR_ID = PlatformUI.PLUGIN_ID + ".SystemEditor"; //$NON-NLS-1$
-
- // Default view category.
- public static final String DEFAULT_CATEGORY_ID = PlatformUI.PLUGIN_ID;
-
- // Persistance tags.
- public static final String TAG_ID = "id"; //$NON-NLS-1$
- public static final String TAG_FOCUS = "focus"; //$NON-NLS-1$
- public static final String TAG_EDITOR = "editor"; //$NON-NLS-1$
- public static final String TAG_DELETED_EDITOR = "deletedEditor"; //$NON-NLS-1$
- public static final String TAG_EDITORS = "editors"; //$NON-NLS-1$
- public static final String TAG_WORKBOOK = "workbook"; //$NON-NLS-1$
- public static final String TAG_ACTIVE_WORKBOOK = "activeWorkbook"; //$NON-NLS-1$
- public static final String TAG_AREA = "editorArea"; //$NON-NLS-1$
- public static final String TAG_AREA_VISIBLE = "editorAreaVisible"; //$NON-NLS-1$
- public static final String TAG_INPUT = "input"; //$NON-NLS-1$
- public static final String TAG_FACTORY_ID = "factoryID"; //$NON-NLS-1$
- public static final String TAG_TITLE = "title"; //$NON-NLS-1$
- public static final String TAG_X = "x"; //$NON-NLS-1$
- public static final String TAG_Y = "y"; //$NON-NLS-1$
- public static final String TAG_WIDTH = "width"; //$NON-NLS-1$
- public static final String TAG_HEIGHT = "height"; //$NON-NLS-1$
- public static final String TAG_FOLDER = "folder"; //$NON-NLS-1$
- public static final String TAG_INFO = "info"; //$NON-NLS-1$
- public static final String TAG_PART = "part"; //$NON-NLS-1$
- public static final String TAG_RELATIVE = "relative"; //$NON-NLS-1$
- public static final String TAG_RELATIONSHIP = "relationship"; //$NON-NLS-1$
- public static final String TAG_RATIO = "ratio"; //$NON-NLS-1$
- public static final String TAG_ACTIVE_PAGE_ID = "activePageID"; //$NON-NLS-1$
- public static final String TAG_PAGE = "page"; //$NON-NLS-1$
- public static final String TAG_LABEL = "label"; //$NON-NLS-1$
- public static final String TAG_CONTENT = "content"; //$NON-NLS-1$
- public static final String TAG_CLASS = "class"; //$NON-NLS-1$
- public static final String TAG_FILE = "file"; //$NON-NLS-1$
- public static final String TAG_DESCRIPTOR = "descriptor"; //$NON-NLS-1$
- public static final String TAG_MAIN_WINDOW = "mainWindow"; //$NON-NLS-1$
- public static final String TAG_DETACHED_WINDOW = "detachedWindow"; //$NON-NLS-1$
- public static final String TAG_HIDDEN_WINDOW = "hiddenWindow"; //$NON-NLS-1$
- public static final String TAG_WORKBENCH = "workbench"; //$NON-NLS-1$
- public static final String TAG_WINDOW = "window"; //$NON-NLS-1$
- public static final String TAG_VERSION = "version"; //$NON-NLS-1$
- public static final String TAG_PERSPECTIVES = "perspectives"; //$NON-NLS-1$
- public static final String TAG_PERSPECTIVE = "perspective"; //$NON-NLS-1$
- public static final String TAG_ACTIVE_PERSPECTIVE = "activePerspective"; //$NON-NLS-1$
- public static final String TAG_ACTIVE_PART = "activePart"; //$NON-NLS-1$
- public static final String TAG_ACTION_SET = "actionSet"; //$NON-NLS-1$
- public static final String TAG_ALWAYS_ON_ACTION_SET = "alwaysOnActionSet"; //$NON-NLS-1$
- public static final String TAG_ALWAYS_OFF_ACTION_SET = "alwaysOffActionSet"; //$NON-NLS-1$
- public static final String TAG_SHOW_VIEW_ACTION = "show_view_action"; //$NON-NLS-1$
- public static final String TAG_NEW_WIZARD_ACTION = "new_wizard_action"; //$NON-NLS-1$
- public static final String TAG_PERSPECTIVE_ACTION = "perspective_action"; //$NON-NLS-1$
- public static final String TAG_VIEW = "view"; //$NON-NLS-1$
- public static final String TAG_LAYOUT = "layout"; //$NON-NLS-1$
- public static final String TAG_EXTENSION = "extension"; //$NON-NLS-1$
- public static final String TAG_NAME = "name"; //$NON-NLS-1$
- public static final String TAG_IMAGE = "image"; //$NON-NLS-1$
- public static final String TAG_LAUNCHER = "launcher"; //$NON-NLS-1$
- public static final String TAG_PLUGING = "plugin"; //$NON-NLS-1$
- public static final String TAG_INTERNAL = "internal"; //$NON-NLS-1$
- public static final String TAG_OPEN_IN_PLACE = "open_in_place"; //$NON-NLS-1$
- public static final String TAG_PROGRAM_NAME = "program_name"; //$NON-NLS-1$
- public static final String TAG_FAST_VIEWS = "fastViews"; //$NON-NLS-1$
- public static final String TAG_VIEW_STATE = "viewState"; //$NON-NLS-1$
- public static final String TAG_SINGLETON="singleton"; //$NON-NLS-1$
- public static final String TAG_EDITOR_REUSE_THRESHOLD="editorReuseThreshold"; //$NON-NLS-1$
- public static final String TAG_PERSISTABLE = "persistable"; //$NON-NLS-1$
- public static final String TAG_MRU_LIST = "mruList"; //$NON-NLS-1$
- public static final String TAG_PERSPECTIVE_HISTORY = "perspHistory"; //$NON-NLS-1$
- public static final String TAG_WORKING_SET_MANAGER = "workingSetManager"; //$NON-NLS-1$
- public static final String TAG_WORKING_SETS = "workingSets"; //$NON-NLS-1$
- public static final String TAG_WORKING_SET = "workingSet"; //$NON-NLS-1$
- public static final String TAG_ITEM = "item"; //$NON-NLS-1$
- public static final String TAG_EDIT_PAGE_ID = "editPageId"; //$NON-NLS-1$
- public static final String TAG_TOOLBAR_LAYOUT = "toolbarLayout"; //$NON-NLS-1$
- public static final String TAG_ITEM_SIZE = "itemSize"; //$NON-NLS-1$
- public static final String TAG_ITEM_WRAP_INDEX = "wrapIndex"; //$NON-NLS-1$
- public static final String TAG_INDEX = "index"; //$NON-NLS-1$
- public static final String TAG_PINNED = "pinned"; //$NON-NLS-1$
- public static final String TAG_PATH = "path";//$NON-NLS-1$
- public static final String TAG_TOOLTIP = "tooltip";//$NON-NLS-1$
- public static final String TAG_VIEWS = "views";//$NON-NLS-1$
- public static final String TAG_ADDED = "added";//$NON-NLS-1$
- public static final String TAG_POSITION = "position";//$NON-NLS-1$
- public static final String TAG_NAVIGATION_HISTORY = "navigationHistory";//$NON-NLS-1$
- public static final String TAG_ACTIVE = "active";//$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
deleted file mode 100644
index a019d85..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/IWorkbenchGraphicConstants.java
+++ /dev/null
@@ -1,209 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * This class defines constants for looking up resources that are available
- * only within the Eclipse UI and Eclipse UI Standard Components projects.
- *
- * See ISharedGraphicConstants for a description of how the keys are named.
- */
-public interface IWorkbenchGraphicConstants {
-
- /*** Constants for Images ***/
-
- // toolbar buttons for wizards
-
- public final static String IMG_CTOOL_NEW_WIZ = "IMG_CTOOL_NEW_WIZ"; //$NON-NLS-1$
- public final static String IMG_CTOOL_NEW_WIZ_HOVER = "IMG_CTOOL_NEW_WIZ_HOVER"; //$NON-NLS-1$
- public final static String IMG_CTOOL_NEW_WIZ_DISABLED = "IMG_CTOOL_NEW_WIZ_DIS"; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_IMPORT_WIZ = "IMG_CTOOL_IMPORT_WIZ"; //$NON-NLS-1$
- public final static String IMG_CTOOL_IMPORT_WIZ_HOVER = "IMG_CTOOL_IMPORT_WIZ_HOVER"; //$NON-NLS-1$
- public final static String IMG_CTOOL_IMPORT_WIZ_DISABLED = "IMG_CTOOL_IMPORT_WIZ_DISABLED"; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_EXPORT_WIZ = "IMG_CTOOL_EXPORT_WIZ"; //$NON-NLS-1$
- public final static String IMG_CTOOL_EXPORT_WIZ_HOVER = "IMG_CTOOL_EXPORT_WIZ_HOVER"; //$NON-NLS-1$
- public final static String IMG_CTOOL_EXPORT_WIZ_DISABLED = "IMG_CTOOL_EXPORT_WIZ_DISABLED"; //$NON-NLS-1$
-
- // other toolbar buttons
- public final static String IMG_CTOOL_BUILD_EXEC = "IMG_CTOOL_BUILD_EXEC" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_BUILD_EXEC_HOVER = "IMG_CTOOL_BUILD_EXEC_HOVER" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_BUILD_EXEC_DISABLED = "IMG_CTOOL_BUILD_EXEC_DISABLED" ; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_CLOSE_EDIT = "IMG_CTOOL_CLOSE_EDIT" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_CLOSE_EDIT_HOVER = "IMG_CTOOL_CLOSE_EDIT_HOVER" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_CLOSE_EDIT_DISABLED = "IMG_CTOOL_CLOSE_EDIT_DISABLED" ; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_SAVE_EDIT = "IMG_CTOOL_SAVE_EDIT" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_SAVE_EDIT_HOVER = "IMG_CTOOL_SAVE_EDIT_HOVER" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_SAVE_EDIT_DISABLED = "IMG_CTOOL_SAVE_EDIT_DISABLED" ; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_SAVEAS_EDIT = "IMG_CTOOL_SAVEAS_EDIT" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_SAVEAS_EDIT_HOVER = "IMG_CTOOL_SAVEAS_EDIT_HOVER" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_SAVEAS_EDIT_DISABLED = "IMG_CTOOL_SAVEAS_EDIT_DISABLED" ; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_SAVEALL_EDIT = "IMG_CTOOL_SAVEALL_EDIT" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_SAVEALL_EDIT_HOVER = "IMG_CTOOL_SAVEALL_EDIT_HOVER" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_SAVEALL_EDIT_DISABLED = "IMG_CTOOL_SAVEALL_EDIT_DISABLED" ; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_PRINT_EDIT = "IMG_CTOOL_PRINT_EDIT" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_PRINT_EDIT_HOVER = "IMG_CTOOL_PRINT_EDIT_HOVER" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_PRINT_EDIT_DISABLED = "IMG_CTOOL_PRINT_EDIT_DISABLED" ; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_UNDO_EDIT = "IMG_CTOOL_UNDO_EDIT" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_UNDO_EDIT_HOVER = "IMG_CTOOL_UNDO_EDIT_HOVER" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_UNDO_EDIT_DISABLED = "IMG_CTOOL_UNDO_EDIT_DISABLED" ; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_REDO_EDIT = "IMG_CTOOL_REDO_EDIT" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_REDO_EDIT_HOVER = "IMG_CTOOL_REDO_EDIT_HOVER" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_REDO_EDIT_DISABLED= "IMG_CTOOL_REDO_EDIT_DISABLED" ; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_CUT_EDIT = "IMG_CTOOL_CUT_EDIT" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_CUT_EDIT_HOVER = "IMG_CTOOL_CUT_EDIT_HOVER" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_CUT_EDIT_DISABLED = "IMG_CTOOL_CUT_EDIT_DISABLED" ; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_COPY_EDIT = "IMG_CTOOL_COPY_EDIT" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_COPY_EDIT_HOVER = "IMG_CTOOL_COPY_EDIT_HOVER" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_COPY_EDIT_DISABLED = "IMG_CTOOL_COPY_EDIT_DISABLED" ; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_DELETE_EDIT = "IMG_CTOOL_DELETE_EDIT" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_DELETE_EDIT_HOVER = "IMG_CTOOL_DELETE_EDIT_HOVER" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_DELETE_EDIT_DISABLED = "IMG_CTOOL_DELETE_EDIT_DISABLED" ; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_PASTE_EDIT = "IMG_CTOOL_PASTE_EDIT" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_PASTE_EDIT_HOVER = "IMG_CTOOL_PASTE_EDIT_HOVER" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_PASTE_EDIT_DISABLED= "IMG_CTOOL_PASTE_EDIT_DISABLED" ; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_SEARCH_SRC = "IMG_CTOOL_SEARCH_SRC" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_SEARCH_SRC_HOVER = "IMG_CTOOL_SEARCH_SRC_HOVER" ; //$NON-NLS-1$
- public final static String IMG_CTOOL_SEARCH_SRC_DISABLED = "IMG_CTOOL_SEARCH_SRC_DISABLED" ; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_REFRESH_NAV = "IMG_CTOOL_REFRESH_NAV"; //$NON-NLS-1$
- public final static String IMG_CTOOL_REFRESH_NAV_HOVER = "IMG_CTOOL_REFRESH_NAV_HOVER"; //$NON-NLS-1$
- public final static String IMG_CTOOL_REFRESH_NAV_DISABLED = "IMG_CTOOL_REFRESH_NAV_DISABLED"; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_FORWARD_NAV = "IMG_CTOOL_FORWARD_NAV"; //$NON-NLS-1$
- public final static String IMG_CTOOL_FORWARD_NAV_HOVER = "IMG_CTOOL_FORWARD_NAV_HOVER"; //$NON-NLS-1$
- public final static String IMG_CTOOL_FORWARD_NAV_DISABLED = "IMG_CTOOL_FORWARD_NAV_DISABLED"; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_BACKWARD_NAV = "IMG_CTOOL_BACKWARD_NAV"; //$NON-NLS-1$
- public final static String IMG_CTOOL_BACKWARD_NAV_HOVER = "IMG_CTOOL_BACKWARD_NAV_HOVER"; //$NON-NLS-1$
- public final static String IMG_CTOOL_BACKWARD_NAV_DISABLED = "IMG_CTOOL_BACKWARD_NAV_DISABLED"; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_STOP_NAV = "IMG_CTOOL_STOP_NAV"; //$NON-NLS-1$
- public final static String IMG_CTOOL_STOP_NAV_HOVER = "IMG_CTOOL_STOP_NAV_HOVER"; //$NON-NLS-1$
- public final static String IMG_CTOOL_STOP_NAV_DISABLED = "IMG_CTOOL_STOP_NAV_DISABLED"; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_HOME_NAV = "IMG_CTOOL_HOME_NAV"; //$NON-NLS-1$
- public final static String IMG_CTOOL_HOME_NAV_HOVER = "IMG_CTOOL_HOME_NAV_HOVER"; //$NON-NLS-1$
- public final static String IMG_CTOOL_HOME_NAV_DISABLED = "IMG_CTOOL_HOME_NAV_DISABLED"; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_NEXT_NAV = "IMG_CTOOL_NEXT_NAV"; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_PREVIOUS_NAV = "IMG_CTOOL_PREVIOUS_NAV"; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_NEW_PAGE = "IMG_CTOOL_NEW_PAGE"; //$NON-NLS-1$
- public final static String IMG_CTOOL_NEW_PAGE_HOVER = "IMG_CTOOL_NEW_PAGE_HOVER"; //$NON-NLS-1$
- public final static String IMG_CTOOL_NEW_PAGE_DISABLED = "IMG_CTOOL_NEW_PAGE_DISABLED"; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_SET_PAGE = "IMG_CTOOL_SET_PAGE"; //$NON-NLS-1$
- public final static String IMG_CTOOL_SET_PAGE_HOVER = "IMG_CTOOL_SET_PAGE_HOVER"; //$NON-NLS-1$
- public final static String IMG_CTOOL_SET_PAGE_DISABLED = "IMG_CTOOL_SET_PAGE_DISABLED"; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_NEW_WND = "IMG_CTOOL_NEW_WND"; //$NON-NLS-1$
- public final static String IMG_CTOOL_NEW_WND_HOVER = "IMG_CTOOL_NEW_WND_HOVER"; //$NON-NLS-1$
- public final static String IMG_CTOOL_NEW_WND_DISABLED = "IMG_CTOOL_NEW_WND_DISABLED"; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_PIN_EDITOR = "IMG_CTOOL_PIN_EDITOR"; //$NON-NLS-1$
- public final static String IMG_CTOOL_PIN_EDITOR_HOVER = "IMG_CTOOL_PIN_EDITOR_HOVER"; //$NON-NLS-1$
- public final static String IMG_CTOOL_PIN_EDITOR_DISABLED = "IMG_CTOOL_PIN_EDITOR_DISABLED"; //$NON-NLS-1$
-
- public final static String IMG_CTOOL_DEF_PERSPECTIVE = "IMG_CTOOL_DEF_PERSPECTIVE"; //$NON-NLS-1$
- public final static String IMG_CTOOL_DEF_PERSPECTIVE_HOVER = "IMG_CTOOL_DEF_PERSPECTIVE_HOVER"; //$NON-NLS-1$
-
- // local toolbars
- public final static String IMG_LCL_CLOSE_VIEW = "IMG_LCL_CLOSE_VIEW" ; //$NON-NLS-1$
- public final static String IMG_LCL_PIN_VIEW = "IMG_LCL_PIN_VIEW" ; //$NON-NLS-1$
- public final static String IMG_LCL_MIN_VIEW = "IMG_LCL_MIN_VIEW" ; //$NON-NLS-1$
- public final static String IMG_LCL_GOTOOBJ_TSK = "IMG_LCL_GOTOOBJ_TSK"; //$NON-NLS-1$
- public final static String IMG_LCL_ADDTSK_TSK = "IMG_LCL_ADDTSK_TSK"; //$NON-NLS-1$
- public final static String IMG_LCL_REMTSK_TSK = "IMG_LCL_REMTSK_TSK"; //$NON-NLS-1$
- public final static String IMG_LCL_SHOWCOMPLETE_TSK = "IMG_LCL_SHOWCOMPLETE_TSK"; //$NON-NLS-1$
- public final static String IMG_LCL_VIEW_MENU = "IMG_LCL_VIEW_MENU"; //$NON-NLS-1$
- public final static String IMG_LCL_SELECTED_MODE = "IMG_LCL_SELECTED_MODE"; //$NON-NLS-1$
- public final static String IMG_LCL_SHOWCHILD_MODE = "IMG_LCL_SHOWCHILD_MODE"; //$NON-NLS-1$
-
- public final static String IMG_LCL_TREE_MODE = "IMG_LCL_TREE_MODE"; //$NON-NLS-1$
-
- public final static String IMG_LCL_DEFAULTS_PS = "IMG_LCL_DEFAULTS_PS"; //$NON-NLS-1$
- public final static String IMG_LCL_FILTER_PS = "IMG_LCL_FILTER_PS"; //$NON-NLS-1$
- public final static String IMG_LCL_REMBKMRK_TSK = "IMG_LCL_REMBKMRK_TSK"; //$NON-NLS-1$
-
- public final static String IMG_LCL_SHOWSYNC_RN = "IMG_LCL_SHOWSYNC_RN"; //$NON-NLS-1$
-
- //wizard images
- public final static String IMG_WIZBAN_NEW_WIZ = "IMG_WIZBAN_NEW_WIZ"; //$NON-NLS-1$
- public final static String IMG_WIZBAN_NEWPRJ_WIZ = "IMG_WIZBAN_NEWPRJ_WIZ"; //$NON-NLS-1$
- public final static String IMG_WIZBAN_NEWFOLDER_WIZ = "IMG_WIZBAN_NEWFOLDER_WIZ"; //$NON-NLS-1$
- public final static String IMG_WIZBAN_NEWFILE_WIZ = "IMG_WIZBAN_NEWFILE_WIZ"; //$NON-NLS-1$
-
- public final static String IMG_WIZBAN_IMPORT_WIZ = "IMG_WIZBAN_IMPORT_WIZ"; //$NON-NLS-1$
- public final static String IMG_WIZBAN_IMPORTDIR_WIZ = "IMG_WIZBAN_IMPORTDIR_WIZ"; //$NON-NLS-1$
- public final static String IMG_WIZBAN_IMPORTZIP_WIZ = "IMG_WIZBAN_IMPORTZIP_WIZ"; //$NON-NLS-1$
-
- public final static String IMG_WIZBAN_EXPORT_WIZ = "IMG_WIZBAN_EXPORT_WIZ"; //$NON-NLS-1$
- public final static String IMG_WIZBAN_EXPORTDIR_WIZ = "IMG_WIZBAN_EXPORTDIR_WIZ"; //$NON-NLS-1$
- public final static String IMG_WIZBAN_EXPORTZIP_WIZ = "IMG_WIZBAN_EXPORTZIP_WIZ"; //$NON-NLS-1$
-
- public final static String IMG_WIZBAN_RESOURCEWORKINGSET_WIZ = "IMG_WIZBAN_EXPORTZIP_WIZ"; //$NON-NLS-1$
-
- public final static String IMG_VIEW_DEFAULTVIEW_MISC = "IMG_VIEW_DEFAULTVIEW_MISC"; //$NON-NLS-1$
-
- // dialog images
- public final static String IMG_DLGBAN_SAVEAS_DLG = "IMG_DLGBAN_SAVEAS_DLG"; //$NON-NLS-1$
-
- // task objects
- public final static String IMG_OBJS_HPRIO_TSK = "IMG_OBJS_HPRIO_TSK"; //$NON-NLS-1$
- public final static String IMG_OBJS_MPRIO_TSK = "IMG_OBJS_MPRIO_TSK"; //$NON-NLS-1$
- public final static String IMG_OBJS_LPRIO_TSK = "IMG_OBJS_LPRIO_TSK"; //$NON-NLS-1$
- public final static String IMG_OBJS_COMPLETE_TSK = "IMG_OBJS_COMPLETE_TSK"; //$NON-NLS-1$
- public final static String IMG_OBJS_INCOMPLETE_TSK = "IMG_OBJS_INCOMPLETE_TSK"; //$NON-NLS-1$
- public final static String IMG_OBJS_BRKPT_TSK = "IMG_OBJS_BRKPT_TSK"; //$NON-NLS-1$
-
- // product
- public final static String IMG_OBJS_DEFAULT_PROD = "IMG_OBJS_DEFAULT_PROD"; //$NON-NLS-1$
-
- // welcome
- public final static String IMG_OBJS_WELCOME_ITEM = "IMG_OBJS_WELCOME_ITEM"; //$NON-NLS-1$
- public final static String IMG_OBJS_WELCOME_BANNER = "IMG_OBJS_WELCOME_BANNER"; //$NON-NLS-1$
-
- // synchronization indicator objects
- public final static String IMG_OBJS_WBET_STAT = "IMG_OBJS_WBET_STAT"; //$NON-NLS-1$
- public final static String IMG_OBJS_SBET_STAT = "IMG_OBJS_SBET_STAT"; //$NON-NLS-1$
- public final static String IMG_OBJS_CONFLICT_STAT = "IMG_OBJS_CONFLICT_STAT"; //$NON-NLS-1$
-
- // local content indicator objects
- public final static String IMG_OBJS_NOTLOCAL_STAT = "IMG_OBJS_NOTLOCAL_STAT"; //$NON-NLS-1$
- public final static String IMG_OBJS_LOCAL_STAT = "IMG_OBJS_LOCAL_STAT"; //$NON-NLS-1$
- public final static String IMG_OBJS_FILLLOCAL_STAT = "IMG_OBJS_FILLLOCAL_STAT"; //$NON-NLS-1$
-
- // part direct manipulation objects
- public final static String IMG_OBJS_DND_LEFT_SOURCE = "IMG_OBJS_DND_LEFT_SOURCE"; //$NON-NLS-1$
- public final static String IMG_OBJS_DND_LEFT_MASK = "IMG_OBJS_DND_LEFT_MASK"; //$NON-NLS-1$
- public final static String IMG_OBJS_DND_RIGHT_SOURCE = "IMG_OBJS_DND_RIGHT_SOURCE"; //$NON-NLS-1$
- public final static String IMG_OBJS_DND_RIGHT_MASK = "IMG_OBJS_DND_RIGHT_MASK"; //$NON-NLS-1$
- public final static String IMG_OBJS_DND_TOP_SOURCE = "IMG_OBJS_DND_TOP_SOURCE"; //$NON-NLS-1$
- public final static String IMG_OBJS_DND_TOP_MASK = "IMG_OBJS_DND_TOP_MASK"; //$NON-NLS-1$
- public final static String IMG_OBJS_DND_BOTTOM_SOURCE = "IMG_OBJS_DND_BOTTOM_SOURCE"; //$NON-NLS-1$
- public final static String IMG_OBJS_DND_BOTTOM_MASK = "IMG_OBJS_DND_BOTTOM_MASK"; //$NON-NLS-1$
- public final static String IMG_OBJS_DND_INVALID_SOURCE = "IMG_OBJS_DND_INVALID_SOURCE"; //$NON-NLS-1$
- public final static String IMG_OBJS_DND_INVALID_MASK = "IMG_OBJS_DND_INVALID_MASK"; //$NON-NLS-1$
- public final static String IMG_OBJS_DND_STACK_SOURCE = "IMG_OBJS_DND_STACK_SOURCE"; //$NON-NLS-1$
- public final static String IMG_OBJS_DND_STACK_MASK = "IMG_OBJS_DND_STACK_MASK"; //$NON-NLS-1$
- public final static String IMG_OBJS_DND_OFFSCREEN_SOURCE = "IMG_OBJS_DND_OFFSCREEN_SOURCE"; //$NON-NLS-1$
- public final static String IMG_OBJS_DND_OFFSCREEN_MASK = "IMG_OBJS_DND_OFFSCREEN_MASK"; //$NON-NLS-1$
-}
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
deleted file mode 100644
index d554383..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/KeyBindingService.java
+++ /dev/null
@@ -1,205 +0,0 @@
-package org.eclipse.ui.internal;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-import java.util.HashMap;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.internal.registry.*;
-
-/**
- * Implementation of an IKeyBindingService.
- * Notes:
- * <ul>
- * <li>One instance is created for each editor site</li>
- * <li>Each editor has to register all its actions by calling registerAction()</li>
- * <li>The editor should call setActiveAcceleratorScopeId() once</li>
- * </ul>
- */
-public class KeyBindingService implements IKeyBindingService {
-
- private IPartListener partListener;
- private ShellListener shellListener;
-
- /* Maps action definition id to action. */
- private HashMap defIdToAction = new HashMap();
-
- /* Maps action definition id to action. Includes the actions
- * registered in this service and its parent so that only one
- * lookup is needed.
- */
- private HashMap allDefIdToAction = new HashMap();
-
- /* The active accelerator scope which is set by the editor */
- private String[] scopeIds = new String[] { IWorkbenchConstants.DEFAULT_ACCELERATOR_SCOPE_ID };
-
- /* The Workbench window key binding service which manages the
- * global actions and the action sets
- */
- private WWinKeyBindingService parent;
-
- /* A number increased by the parent whenever a new action
- * is registered so that this instance can update its mapping
- * when it is out of sync.
- */
- private long parentUpdateNumber;
-
- /**
- * Create an instance of KeyBindingService and initializes
- * it with its parent.
- */
- public KeyBindingService(WWinKeyBindingService service,PartSite site) {
- partListener = new IPartListener() {
- public void partActivated(IWorkbenchPart part) {}
- public void partBroughtToTop(IWorkbenchPart part) {}
- public void partClosed(IWorkbenchPart part) {}
- public void partDeactivated(IWorkbenchPart part) {
- parent.clear();
- }
- public void partOpened(IWorkbenchPart part) {}
- };
-
- shellListener = new ShellAdapter() {
- public void shellDeactivated(ShellEvent e) {
- parent.clear();
- }
- };
-
- parent = service;
- parentUpdateNumber = parent.getUpdateNumber() - 1;
- service.getWindow().getPartService().addPartListener(partListener);
- service.getWindow().getShell().addShellListener(shellListener);
- ActionDescriptor actionDescriptors[] = null;
-
- if(site instanceof EditorSite) {
- EditorActionBuilder.ExternalContributor contributor = (EditorActionBuilder.ExternalContributor)((EditorSite)site).getExtensionActionBarContributor();
- if(contributor == null)
- actionDescriptors = new ActionDescriptor[0];
- else
- actionDescriptors = contributor.getExtendedActions();
- } else {
- actionDescriptors = ((ViewPane)site.getPane()).getExtendedActions();
- }
-
- for (int i = 0; i < actionDescriptors.length; i++) {
- IAction action = actionDescriptors[i].getAction();
-
- if (action.getActionDefinitionId() != null)
- registerAction(action);
- }
- }
-
- /*
- * @see IKeyBindingService#getScopeIds()
- */
- public String[] getScopeIds() {
- return (String[]) scopeIds.clone();
- }
-
- /*
- * @see IKeyBindingService#setScopeIds(String[] scopeIds)
- */
- public void setScopeIds(String[] scopeIds)
- throws IllegalArgumentException {
- if (scopeIds == null || scopeIds.length < 1)
- throw new IllegalArgumentException();
-
- this.scopeIds = (String[]) scopeIds.clone();
-
- for (int i = 0; i < scopeIds.length; i++)
- if (scopeIds[i] == null)
- throw new IllegalArgumentException();
- }
-
- /*
- * @see IKeyBindingService#registerAction(IAction)
- */
- public void registerAction(IAction action) {
- if(parentUpdateNumber != parent.getUpdateNumber())
- initializeMapping();
- String defId = action.getActionDefinitionId();
- Assert.isNotNull(defId,"All registered action must have a definition id"); //$NON-NLS-1$
- defIdToAction.put(defId,action);
- allDefIdToAction.put(defId,action);
- }
-
- /*
- * @see IKeyBindingService#unregisterAction(IAction)
- */
- public void unregisterAction(IAction action) {
- String defId = action.getActionDefinitionId();
- Assert.isNotNull(defId,"All registered action must have a definition id"); //$NON-NLS-1$
- defIdToAction.remove(defId);
- allDefIdToAction.remove(defId);
- }
-
- /*
- * Merge the actions from its parents with its registered actions
- * in one HashMap
- */
- private void initializeMapping() {
- parentUpdateNumber = parent.getUpdateNumber();
- allDefIdToAction = parent.getMapping();
- allDefIdToAction.putAll(defIdToAction);
- }
-
- /**
- * Remove the part listener when the editor site is disposed.
- */
- public void dispose() {
- parent.getWindow().getPartService().removePartListener(partListener);
- parent.getWindow().getShell().removeShellListener(shellListener);
- }
-
- /**
- * Returns the action mapped with the specified <code>definitionId</code>
- */
- public IAction getAction(String definitionId) {
- //Chech if parent has changed. E.g. added action sets.
- if (parentUpdateNumber != parent.getUpdateNumber())
- initializeMapping();
-
- return (IAction) allDefIdToAction.get(definitionId);
- }
-
- /*
- * @see IKeyBindingService#getActiveAcceleratorConfigurationId()
- */
- public String getActiveAcceleratorConfigurationId() {
- return ((Workbench)PlatformUI.getWorkbench()).getActiveAcceleratorConfiguration().getId();
- }
-
- /*
- * @see IKeyBindingService#getActiveAcceleratorScopeId()
- */
- public String getActiveAcceleratorScopeId() {
- return getScopeIds()[0];
- }
-
- /*
- * @see IKeyBindingService#setActiveAcceleratorScopeId(String)
- */
- public void setActiveAcceleratorScopeId(String scopeId)
- throws IllegalArgumentException {
- setScopeIds(new String[] { scopeId });
- }
-
- /*
- * @see IKeyBindingService#processKey(Event)
- */
- public boolean processKey(KeyEvent event) {
- return false;
- }
-
- /*
- * @see IKeyBindingService#registerAction(IAction)
- */
- public void enable(boolean enable) {
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/KeyTable.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/KeyTable.java
deleted file mode 100644
index d4418b5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/KeyTable.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package org.eclipse.ui.internal;
-
-import java.util.Arrays;
-
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-
-public class KeyTable {
-
- public interface KeyTableListener {
- void keyPressed(int key);
- }
-
- private Shell shell;
- private int[] keys;
- private Menu menu;
- private MenuItem menuItem;
-
- public KeyTable(Shell shell) {
- this.shell = shell;
- initMenu();
- }
-
- public void initMenu() {
- Menu parent = shell.getMenuBar();
-
- if (parent == null || parent.getItemCount() < 1)
- throw new SWTException();
-
- MenuItem parentItem = parent.getItem(parent.getItemCount() - 1);
- final Menu child = parentItem.getMenu();
-
- if (child == null)
- throw new SWTException();
-
- menuItem = new MenuItem(child, SWT.CASCADE,0);
- menuItem.setMenu(menu = new Menu(menuItem));
-
- child.addListener(SWT.Show, new Listener () {
- public void handleEvent(Event event) {
- if(menuItem == null || menuItem.isDisposed())
- return;
- menuItem.setMenu(null);
- menuItem.dispose();
- }
- });
-
- child.addListener(SWT.Hide, new Listener () {
- public void handleEvent(Event event) {
- //It seems that we are getting this event twice
- if(menuItem == null || menuItem.isDisposed()) {
- menuItem = new MenuItem(child, SWT.CASCADE,0);
- menuItem.setMenu(menu);
- }
- }
- });
- }
-
- private KeyTableListener keyTableListener;
-
- public void addKeyTableListener(KeyTableListener keyTableListener) {
- this.keyTableListener = keyTableListener;
- // TBD: add listener to list
- }
-
- public void removeKeyTableListener(KeyTableListener keyTableListener) {
- // TBD: remove listener from list
- }
-
- void handleEvent(Event event) {
- MenuItem eventMenuItem = (MenuItem) event.widget;
- int key = eventMenuItem.getAccelerator();
- // TBD: send key to all listeners
- if (keyTableListener != null)
- keyTableListener.keyPressed(key);
- }
-
- public int[] getKeys() {
- if (keys == null)
- return null;
- else {
- int[] keys = new int[this.keys.length];
- System.arraycopy(this.keys, 0, keys, 0, this.keys.length);
- return keys;
- }
- }
-
- public void setKeys(final int[] keys) {
- if (keys == null)
- this.keys = null;
- else
- System.arraycopy(keys, 0, this.keys = new int[keys.length], 0, keys.length);
-
- if (menu != null) {
- menu.dispose();
- menu = null;
- }
-
- // Arrays.sort(keys);
- if(menuItem == null || menuItem.isDisposed()) {
- initMenu();
- } else {
- menu = new Menu(menuItem);
- menuItem.setMenu(menu);
- }
-
- for (int i = 0; i < keys.length; i++) {
- final int key = keys[i];
- MenuItem keyMenuItem = new MenuItem(menu, SWT.PUSH);
- keyMenuItem.setAccelerator(key);
-
- //keyMenuItem.setText(Action.convertAccelerator(key));
-
- keyMenuItem.addListener(SWT.Selection, new Listener() {
- public void handleEvent(Event event) {
- KeyTable.this.handleEvent(event);
- }
- });
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LabelDecoratorAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LabelDecoratorAction.java
deleted file mode 100644
index 5c368d5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LabelDecoratorAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.internal.DecoratorDefinition;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * The LabelDecoratorAction is an action that toggles the
- * enabled state of a decorator.
- *
- * @since 2.0
- * @deprecated this action is no longer in use
- */
-public class LabelDecoratorAction extends Action {
-
- private DecoratorDefinition decorator;
-
- /**
- * Constructor for LabelDecoratorAction.
- * @param text
- */
- public LabelDecoratorAction(DecoratorDefinition definition) {
- super(definition.getName());
- decorator = definition;
- setChecked(decorator.isEnabled());
- }
-
- /*
- * see @Action.run()
- */
- public void run() {}
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutPart.java
deleted file mode 100644
index d6cf097..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutPart.java
+++ /dev/null
@@ -1,226 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Cagatay Kavukcuoglu <cagatayk@acm.org>
- - Fix for bug 10025 - Resizing views should not use height ratios
-**********************************************************************/
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.*;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.*;
-import org.eclipse.jface.window.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A presentation part is used to build the presentation for the
- * workbench. Common subclasses are pane and folder.
- */
-abstract public class LayoutPart implements IPartDropTarget {
- protected ILayoutContainer container;
- protected String id;
-/**
- * PresentationPart constructor comment.
- */
-public LayoutPart(String id) {
- super();
- this.id = id;
-}
-/**
- * Creates the SWT control
- */
-abstract public void createControl(Composite parent);
-/**
- * Disposes the SWT control
- */
-public void dispose() {
-}
-/**
- * Gets the presentation bounds.
- */
-public Rectangle getBounds() {
- return new Rectangle(0, 0, 0, 0);
-}
-/**
- * Gets root container for this part.
- */
-public RootLayoutContainer getRootContainer() {
- if(container != null)
- return container.getRootContainer();
- return null;
-}
-/**
- * Gets the parent for this part.
- */
-public ILayoutContainer getContainer() {
- return container;
-}
-/**
- * Get the part control. This method may return null.
- */
-abstract public Control getControl();
-
-/**
- * Gets the ID for this part.
- */
-public String getID() {
- return id;
-}
-/**
- * Return the place the preferences used by layout parts reside.
- * @return IPreferenceStore
- */
-/*package*/ IPreferenceStore getPreferenceStore() {
- return WorkbenchPlugin.getDefault().getPreferenceStore();
-}
-/**
- * Return whether the window's shell is activated
- */
-/* package */ boolean getShellActivated() {
- Window window = getWindow();
- if (window instanceof WorkbenchWindow)
- return ((WorkbenchWindow) window).getShellActivated();
- else
- return false;
-}
-/**
- * Gets the presentation size.
- */
-public Point getSize() {
- Rectangle r = getBounds();
- Point ptSize = new Point(r.width, r.height);
- return ptSize;
-}
-
-// getMinimumWidth() added by cagatayk@acm.org
-/**
- * Returns the minimum width a part can have. Subclasses may
- * override as necessary.
- */
-public int getMinimumWidth() {
- return 0;
-}
-
-// getMinimumHeight() added by cagatayk@acm.org
-/**
- * Returns the minimum height a part can have. Subclasses may
- * override as necessary.
- */
-public int getMinimumHeight() {
- return 0;
-}
-
-/**
- * Returns the top level window for a part.
- */
-public Window getWindow() {
- Control ctrl = getControl();
- if (ctrl != null) {
- Object data = ctrl.getShell().getData();
- if (data instanceof Window)
- return (Window)data;
- }
- return null;
-}
-/**
- * Returns the workbench window window for a part.
- */
-public IWorkbenchWindow getWorkbenchWindow() {
- Window parentWindow = getWindow();
- if (parentWindow instanceof IWorkbenchWindow)
- return (IWorkbenchWindow)parentWindow;
- /*
- * Detached window no longer supported - remove when confirmed
- *
- * if (parentWindow instanceof DetachedWindow)
- * return ((DetachedWindow)parentWindow).getWorkbenchPage().getWorkbenchWindow();
- */
-
- return null;
-}
-/**
- * Allow the layout part to determine if they are in
- * an acceptable state to start a drag & drop operation.
- */
-public boolean isDragAllowed(Point p) {
- return true;
-}
-/**
- * Returns true if this part is visible. A part is visible if it has a control.
- */
-public boolean isVisible() {
- return true;
-}
-/**
- * Move the control over another one.
- */
-public void moveAbove(Control refControl) {
-}
-/**
- * Reparent a part.
- */
-public void reparent(Composite newParent) {
- if (!newParent.isReparentable())
- return;
-
- Control control = getControl();
- if ((control == null) || (control.getParent() == newParent))
- return;
-
- // make control small in case it is not resized with other controls
- control.setBounds(0, 0, 0, 0);
- // By setting the control to disabled before moving it,
- // we ensure that the focus goes away from the control and its children
- // and moves somewhere else
- boolean enabled = control.getEnabled();
- control.setEnabled(false);
- control.setParent(newParent);
- control.setEnabled(enabled);
-}
-/**
- * Sets the presentation bounds.
- */
-final public void setBounds(int x, int y, int w, int h) {
- setBounds(new Rectangle(x, y, w, h));
-}
-/**
- * Sets the presentation bounds.
- */
-public void setBounds(Rectangle r) {
- Control ctrl = getControl();
- if (ctrl != null)
- ctrl.setBounds(r);
-}
-/**
- * Sets the parent for this part.
- */
-public void setContainer(ILayoutContainer container) {
- this.container = container;
-}
-/**
- * Sets focus to this part.
- */
-public void setFocus() {
-}
-/**
- * Sets the part ID.
- */
-public void setID(String str) {
- id = str;
-}
-/**
- * @see IPartDropTarget::targetPartFor
- */
-public LayoutPart targetPartFor(LayoutPart dragSource) {
- return null;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutPartSash.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutPartSash.java
deleted file mode 100644
index 0c1b8a7..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutPartSash.java
+++ /dev/null
@@ -1,189 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Cagatay Kavukcuoglu <cagatayk@acm.org>
- - Fix for bug 10025 - Resizing views should not use height ratios
-**********************************************************************/
-
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-
-class LayoutPartSash extends LayoutPart {
-
- private Sash sash;
- private PartSashContainer rootContainer;
- private int style;
-
- private LayoutPartSash preLimit;
- private LayoutPartSash postLimit;
-
- SelectionListener selectionListener;
- private float ratio = 0.5f;
-
- /* Optimize limit checks by calculating minimum
- * and maximum ratios once per drag
- */
- private float minRatio;
- private float maxRatio;
-
-
-
-LayoutPartSash(PartSashContainer rootContainer,int style) {
- super(null);
- this.style = style;
- this.rootContainer = rootContainer;
-
- selectionListener = new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- if (e.detail == SWT.DRAG)
- checkDragLimit(e);
- else
- LayoutPartSash.this.widgetSelected(e.x, e.y, e.width, e.height);
- }
- };
-
- initDragRatios();
-}
-
-// checkDragLimit contains changes by cagatayk@acm.org
-private void checkDragLimit(SelectionEvent event) {
- LayoutTree root = rootContainer.getLayoutTree();
- LayoutTreeNode node = root.findSash(this);
- Rectangle nodeBounds = node.getBounds();
-
- // optimization: compute ratios only once per drag
- if (minRatio < 0)
- minRatio = node.getMinimumRatioFor(nodeBounds);
- if (maxRatio < 0)
- maxRatio = node.getMaximumRatioFor(nodeBounds);
-
- if(style == SWT.VERTICAL) {
- // limit drag to current node's bounds
- if (event.x < nodeBounds.x)
- event.x = nodeBounds.x;
- if ((event.x + event.width) > (nodeBounds.x + nodeBounds.width))
- event.x = nodeBounds.x + nodeBounds.width - event.width;
- // limit drag to current node's ratios
- float width = nodeBounds.width;
- if (event.x - nodeBounds.x < width * minRatio)
- event.x = nodeBounds.x + (int)(width * minRatio);
- if (event.x - nodeBounds.x > width * maxRatio)
- event.x = nodeBounds.x + (int)(width * maxRatio);
- } else {
- // limit drag to current node's bounds
- if (event.y < nodeBounds.y)
- event.y = nodeBounds.y;
- if ((event.y + event.height) > (nodeBounds.y + nodeBounds.height))
- event.y = nodeBounds.y + nodeBounds.height - event.height;
- // limit drag to current node's ratios
- float height = nodeBounds.height;
- if (event.y - nodeBounds.y < height * minRatio)
- event.y = nodeBounds.y + (int)(height * minRatio);
- if (event.y - nodeBounds.y > height * maxRatio)
- event.y = nodeBounds.y + (int)(height * maxRatio);
- }
-}
-
-/**
- * Creates the control
- */
-public void createControl(Composite parent) {
- if (sash == null) {
- sash = new Sash(parent, style);
- sash.addListener(SWT.MouseDown, rootContainer.getMouseDownListener());
- sash.addSelectionListener(selectionListener);
- }
-}
-/**
- * See LayoutPart#dispose
- */
-public void dispose() {
-
- if (sash != null)
- sash.dispose();
- sash = null;
-}
-/**
- * Gets the presentation bounds.
- */
-public Rectangle getBounds() {
- if(sash == null)
- return super.getBounds();
- return sash.getBounds();
-}
-/**
- * Returns the part control.
- */
-public Control getControl() {
- return sash;
-}
-/**
- *
- */
-public String getID() {
- return null;
-}
-LayoutPartSash getPostLimit() {
- return postLimit;
-}
-LayoutPartSash getPreLimit() {
- return preLimit;
-}
-float getRatio() {
- return ratio;
-}
-boolean isHorizontal() {
- return ((style & SWT.HORIZONTAL) == SWT.HORIZONTAL);
-}
-boolean isVertical() {
- return ((style & SWT.VERTICAL) == SWT.VERTICAL);
-}
-void setPostLimit(LayoutPartSash newPostLimit) {
- postLimit = newPostLimit;
-}
-void setPreLimit(LayoutPartSash newPreLimit) {
- preLimit = newPreLimit;
-}
-void setRatio(float newRatio) {
- if (newRatio < 0.0 || newRatio > 1.0) return;
- ratio = newRatio;
-}
-/**
- * @see IPartDropTarget::targetPartFor
- */
-public LayoutPart targetPartFor(LayoutPart dragSource) {
- return null;
-}
-private void widgetSelected(int x, int y, int width, int height) {
- LayoutTree root = rootContainer.getLayoutTree();
- LayoutTreeNode node = root.findSash(this);
- Rectangle nodeBounds = node.getBounds();
- //Recompute ratio
- if(style == SWT.VERTICAL) {
- setRatio((float)(x - nodeBounds.x)/(float)nodeBounds.width);
- } else {
- setRatio((float)(y - nodeBounds.y)/(float)nodeBounds.height);
- }
-
- node.setBounds(nodeBounds);
- initDragRatios();
-}
-
-
-private void initDragRatios() {
- minRatio = maxRatio = -1f;
-}
-
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutTree.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutTree.java
deleted file mode 100644
index 0589a3f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutTree.java
+++ /dev/null
@@ -1,188 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Cagatay Kavukcuoglu <cagatayk@acm.org>
- - Fix for bug 10025 - Resizing views should not use height ratios
-**********************************************************************/
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.util.ArrayList;
-/**
- * Implementation of a tree where the node is allways a sash
- * and it allways has two chidren. If a children is removed
- * the sash, ie the node, is removed as well and its other children
- * placed on its parent.
- */
-public class LayoutTree {
- /* The parent of this tree or null if it is the root */
- LayoutTreeNode parent;
- /* Any LayoutPart if this is a leaf or a LayoutSashPart if it is a node */
- LayoutPart part;
-
-/**
- * Initialize this tree with its part.
- */
-public LayoutTree(LayoutPart part) {
- this.part = part;
-}
-/**
- * Add the relation ship between the children in the list
- * and returns the left children.
- */
-public LayoutPart computeRelation(ArrayList relations) {
- return part;
-}
-/**
- * Dispose all Sashs in this tree
- */
-public void disposeSashes() {
-}
-/**
- * Find a LayoutPart in the tree and return its sub-tree. Returns
- * null if the child is not found.
- */
-public LayoutTree find(LayoutPart child) {
- if(part != child)
- return null;
- return this;
-}
-/**
- * Find the Left,Right,Top and Botton
- * sashes around this tree and set them
- * in <code>sashes</code>
- */
-public void findSashes(PartPane.Sashes sashes) {
- if(getParent() == null)
- return;
- getParent().findSashes(this,sashes);
-}
-/**
- * Find the part that is in the bottom rigth possition.
- */
-public LayoutPart findBottomRight() {
- return part;
-}
-/**
- * Find a sash in the tree and return its sub-tree. Returns
- * null if the sash is not found.
- */
-public LayoutTreeNode findSash(LayoutPartSash sash) {
- return null;
-}
-/**
- * Return the bounds of this tree which is the rectangle that
- * contains all Controls in this tree.
- */
-public Rectangle getBounds() {
- return part.getBounds();
-}
-
-// getMinimumWidth() added by cagatayk@acm.org
-public int getMinimumWidth() {
- return part.getMinimumWidth();
-}
-
-// getMinimumHeight() added by cagatayk@acm.org
-public int getMinimumHeight() {
- return part.getMinimumHeight();
-}
-/**
- * Returns the parent of this tree or null if it is the root.
- */
-public LayoutTreeNode getParent() {
- return parent;
-}
-/**
- * Inserts a new child on the tree. The child will be placed beside
- * the <code>relative</code> child. Returns the new root of the tree.
- */
-public LayoutTree insert(LayoutPart child,boolean left,LayoutPartSash sash,LayoutPart relative) {
- LayoutTree relativeChild = find(relative);
- LayoutTreeNode node = new LayoutTreeNode(sash);
- if(relativeChild == null) {
- //Did not find the relative part. Insert beside the root.
- node.setChild(left,child);
- node.setChild(!left,this);
- return node;
- } else {
- LayoutTreeNode oldParent = relativeChild.getParent();
- node.setChild(left,child);
- node.setChild(!left,relativeChild);
- if(oldParent == null) {
- //It was the root. Return a new root.
- return node;
- }
- oldParent.replaceChild(relativeChild,node);
- return this;
- }
-}
-/**
- * Returns true if this tree has visible parts otherwise returns false.
- */
-public boolean isVisible() {
- return !(part instanceof PartPlaceholder);
-}
-/**
- * Recompute the ratios in this tree.
- */
-public void recomputeRatio() {
-}
-/**
- * Find a child in the tree and remove it and its parent.
- * The other child of its parent is placed on the parent's parent.
- * Returns the new root of the tree.
- */
-public LayoutTree remove(LayoutPart child) {
- LayoutTree tree = find(child);
- if(tree == null)
- return this;
- LayoutTreeNode oldParent = tree.getParent();
- if(oldParent == null) {
- //It was the root and the only child of this tree
- return null;
- }
- if(oldParent.getParent() == null)
- return oldParent.remove(tree);
-
- oldParent.remove(tree);
- return this;
-}
-/**
- * Resize the parts on this tree to fit in <code>bounds</code>.
- */
-public void setBounds(Rectangle bounds) {
- part.setBounds(bounds);
-}
-/**
- * Set the parent of this tree.
- */
-void setParent(LayoutTreeNode parent) {
- this.parent = parent;
-}
-/**
- * Set the part of this leaf
- */
-void setPart(LayoutPart part) {
- this.part = part;
-}
-/**
- * Returns a string representation of this object.
- */
-public String toString() {
- return "(" + part.toString() + ")";//$NON-NLS-2$//$NON-NLS-1$
-}
-/**
- * Create the sashes if the children are visible
- * and dispose it if they are not.
- */
-public void updateSashes(Composite parent) {
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutTreeNode.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutTreeNode.java
deleted file mode 100644
index c2e8155..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LayoutTreeNode.java
+++ /dev/null
@@ -1,510 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Cagatay Kavukcuoglu <cagatayk@acm.org>
- - Fix for bug 10025 - Resizing views should not use height ratios
-**********************************************************************/
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import java.util.ArrayList;
-import org.eclipse.ui.IPageLayout;
-
-/**
- * Implementation of a tree node. The node represents a
- * sash and it allways has two children.
- */
-public class LayoutTreeNode extends LayoutTree {
- /* The node children witch may be another node or a leaf */
- private LayoutTree children[] = new LayoutTree[2];
- /* The sash's width when vertical and hight on horizontal */
- private final static int SASH_WIDTH = 3;
-/**
- * Initialize this tree with its sash.
- */
-public LayoutTreeNode(LayoutPartSash sash) {
- super(sash);
-}
-/**
- * Add the relation ship between the children in the list
- * and returns the left children.
- */
-public LayoutPart computeRelation(ArrayList relations) {
- PartSashContainer.RelationshipInfo r = new PartSashContainer.RelationshipInfo();
- r.relative = children[0].computeRelation(relations);
- r.part = children[1].computeRelation(relations);
- r.ratio = getSash().getRatio();
- r.relationship = getSash().isVertical()?IPageLayout.RIGHT:IPageLayout.BOTTOM;
- relations.add(0,r);
- return r.relative;
-}
-/**
- * Dispose all Sashs in this tree
- */
-public void disposeSashes() {
- children[0].disposeSashes();
- children[1].disposeSashes();
- getSash().dispose();
-}
-/**
- * Find a LayoutPart in the tree and return its sub-tree. Returns
- * null if the child is not found.
- */
-public LayoutTree find(LayoutPart child) {
- LayoutTree node = children[0].find(child);
- if(node != null) return node;
- node = children[1].find(child);
- return node;
-}
-/**
- * Find the part that is in the bottom right position.
- */
-public LayoutPart findBottomRight() {
- if(children[1].isVisible())
- return children[1].findBottomRight();
- return children[0].findBottomRight();
-}
-/**
- * Go up in the tree finding a parent that is common of both children.
- * Return the subtree.
- */
-public LayoutTreeNode findCommonParent(LayoutPart child1, LayoutPart child2) {
- return findCommonParent(child1,child2,false,false);
-}
-/**
- * Go up in the tree finding a parent that is common of both children.
- * Return the subtree.
- */
-LayoutTreeNode findCommonParent(LayoutPart child1, LayoutPart child2,boolean foundChild1,boolean foundChild2) {
- if(!foundChild1)
- foundChild1 = find(child1) != null;
- if(!foundChild2)
- foundChild2 = find(child2) != null;
- if(foundChild1 && foundChild2)
- return this;
- if(parent == null)
- return null;
- return parent.findCommonParent(child1,child2,foundChild1,foundChild2);
-}
-/**
- * Find a sash in the tree and return its sub-tree. Returns
- * null if the sash is not found.
- */
-public LayoutTreeNode findSash(LayoutPartSash sash) {
- if(this.getSash() == sash)
- return this;
- LayoutTreeNode node = children[0].findSash(sash);
- if(node != null) return node;
- node = children[1].findSash(sash);
- if(node != null) return node;
- return null;
-}
-/**
- * Sets the elements in the array of sashes with the
- * Left,Rigth,Top and Botton sashes. The elements
- * may be null depending whether there is a shash
- * beside the <code>part</code>
- */
-void findSashes(LayoutTree child,PartPane.Sashes sashes) {
- Sash sash = (Sash)getSash().getControl();
- boolean leftOrTop = children[0] == child;
- if(sash != null) {
- LayoutPartSash partSash = getSash();
- //If the child is in the left, the sash
- //is in the rigth and so on.
- if(leftOrTop) {
- if(partSash.isVertical()) {
- if(sashes.right == null)
- sashes.right = sash;
- } else {
- if(sashes.bottom == null)
- sashes.bottom = sash;
- }
- } else {
- if(partSash.isVertical()) {
- if(sashes.left == null)
- sashes.left = sash;
- } else {
- if(sashes.top == null)
- sashes.top = sash;
- }
- }
- }
- if(getParent() != null)
- getParent().findSashes(this,sashes);
-}
-/**
- * Return the bounds of this tree which is the rectangle that
- * contains all Controls in this tree.
- */
-public Rectangle getBounds() {
- if(!children[0].isVisible())
- return children[1].getBounds();
-
- if(!children[1].isVisible())
- return children[0].getBounds();
-
-
- Rectangle leftBounds = children[0].getBounds();
- Rectangle rightBounds = children[1].getBounds();
- Rectangle sashBounds = getSash().getBounds();
- Rectangle result = new Rectangle(leftBounds.x,leftBounds.y,leftBounds.width,leftBounds.height);
- if(getSash().isVertical()) {
- result.width = rightBounds.width + leftBounds.width + sashBounds.width;
- } else {
- result.height = rightBounds.height + leftBounds.height + sashBounds.height;
- }
- return result;
-}
-/**
- * Returns the sash of this node.
- */
-public LayoutPartSash getSash() {
- return (LayoutPartSash)part;
-}
-/**
- * Returns true if this tree has visible parts otherwise returns false.
- */
-public boolean isVisible() {
- return children[0].isVisible() || children[1].isVisible();
-}
-/**
- * Recompute the ratios in this tree. The ratio for a node is the width
- * (or height if the sash is horizontal) of the left child's bounds
- * divided by the width or height of node's bounds. Sash width <em>is</em>
- * considered in ratio computation.
- */
-public void recomputeRatio() {
- children[0].recomputeRatio();
- children[1].recomputeRatio();
-
- if(children[0].isVisible() && children[1].isVisible()) {
- if(getSash().isVertical()) {
- float left = children[0].getBounds().width;
- float right = children[1].getBounds().width;
- getSash().setRatio(left/(right+left+SASH_WIDTH));
- } else {
- float left = children[0].getBounds().height;
- float right = children[1].getBounds().height;
- getSash().setRatio(left/(right+left+SASH_WIDTH));
- }
- }
-
-}
-/**
- * Remove the child and this node from the tree
- */
-LayoutTree remove(LayoutTree child) {
- getSash().dispose();
- if(parent == null) {
- //This is the root. Return the other child to be the new root.
- if(children[0] == child) {
- children[1].setParent(null);
- return children[1];
- }
- children[0].setParent(null);
- return children[0];
- }
-
- LayoutTreeNode oldParent = parent;
- if(children[0] == child)
- oldParent.replaceChild(this,children[1]);
- else
- oldParent.replaceChild(this,children[0]);
- return oldParent;
-}
-/**
- * Replace a child with a new child and sets the new child's parent.
- */
-void replaceChild(LayoutTree oldChild,LayoutTree newChild) {
- if(children[0] == oldChild)
- children[0] = newChild;
- else if(children[1] == oldChild)
- children[1] = newChild;
- newChild.setParent(this);
- if(!children[0].isVisible() || ! children[0].isVisible())
- getSash().dispose();
-
-}
-/**
- * Go up from the subtree and return true if all the sash are
- * in the direction specified by <code>isVertical</code>
- */
-public boolean sameDirection(boolean isVertical,LayoutTreeNode subTree) {
- boolean treeVertical = getSash().isVertical();
- if (treeVertical != isVertical)
- return false;
- while(subTree != null) {
- if(this == subTree)
- return true;
- if(subTree.children[0].isVisible() && subTree.children[1].isVisible())
- if(subTree.getSash().isVertical() != isVertical)
- return false;
- subTree = subTree.getParent();
- }
- return true;
-}
-/**
- * Resize the parts on this tree to fit in <code>bounds</code>.
- */
-public void setBounds(Rectangle bounds) {
- if(!children[0].isVisible()) {
- children[1].setBounds(bounds);
- return;
- }
- if(!children[1].isVisible()) {
- children[0].setBounds(bounds);
- return;
- }
-
- Rectangle leftBounds = new Rectangle(bounds.x,bounds.y,bounds.width,bounds.height);
- Rectangle rightBounds = new Rectangle(bounds.x,bounds.y,bounds.width,bounds.height);
- Rectangle sashBounds = new Rectangle(bounds.x,bounds.y,bounds.width,bounds.height);
- if(getSash().isVertical()) {
- //Work on x and width
- leftBounds.width = (int)(getSash().getRatio() * bounds.width);
- sashBounds.x = leftBounds.x + leftBounds.width;
- sashBounds.width = SASH_WIDTH;
- rightBounds.x = sashBounds.x + sashBounds.width;
- rightBounds.width = bounds.width - leftBounds.width - sashBounds.width;
- adjustWidths(bounds, leftBounds, rightBounds, sashBounds);
- } else {
- //Work on y and height
- leftBounds.height = (int)(getSash().getRatio() * bounds.height);
- sashBounds.y = leftBounds.y + leftBounds.height;
- sashBounds.height = SASH_WIDTH;
- rightBounds.y = sashBounds.y + sashBounds.height;
- rightBounds.height = bounds.height - leftBounds.height - sashBounds.height;
- adjustHeights(bounds, leftBounds, rightBounds, sashBounds);
- }
- getSash().setBounds(sashBounds);
- children[0].setBounds(leftBounds);
- children[1].setBounds(rightBounds);
-}
-
-// adjustHeights added by cagatayk@acm.org
-private boolean adjustHeights(Rectangle node, Rectangle left, Rectangle right, Rectangle sash) {
- int leftAdjustment = 0;
- int rightAdjustment = 0;
-
- leftAdjustment = adjustChildHeight(left, node, true);
- if (leftAdjustment > 0) {
- right.height -= leftAdjustment;
- }
-
- rightAdjustment = adjustChildHeight(right, node, false);
- if (rightAdjustment > 0) {
- left.height -= rightAdjustment;
- }
-
- boolean adjusted = leftAdjustment > 0 || rightAdjustment > 0;
- if (adjusted) {
- sash.y = left.y + left.height;
- right.y = sash.y + sash.height;
- }
-
- return adjusted;
-}
-
-// adjustChildHeight added by cagatayk@acm.org
-private int adjustChildHeight(Rectangle childBounds, Rectangle nodeBounds, boolean left) {
- int adjustment = 0;
- int minimum = 0;
-
- minimum = left ?
- Math.round(getMinimumRatioFor(nodeBounds) * nodeBounds.height):
- Math.round((1 - getMaximumRatioFor(nodeBounds)) * nodeBounds.height) - SASH_WIDTH;
-
- if (minimum > childBounds.height) {
- adjustment = minimum - childBounds.height;
- childBounds.height = minimum;
- }
-
- return adjustment;
-}
-
-// adjustWidths added by cagatayk@acm.org
-private boolean adjustWidths(Rectangle node, Rectangle left, Rectangle right, Rectangle sash) {
- int leftAdjustment = 0;
- int rightAdjustment = 0;
-
- leftAdjustment = adjustChildWidth(left, node, true);
- if (leftAdjustment > 0) {
- right.width -= leftAdjustment;
- }
-
- rightAdjustment = adjustChildWidth(right, node, false);
- if (rightAdjustment > 0) {
- left.width -= rightAdjustment;
- }
-
- boolean adjusted = leftAdjustment > 0 || rightAdjustment > 0;
- if (adjusted) {
- sash.x = left.x + left.width;
- right.x = sash.x + sash.width;
- }
-
- return adjusted;
-}
-
-// adjustChildWidth added by cagatayk@acm.org
-private int adjustChildWidth(Rectangle childBounds, Rectangle nodeBounds, boolean left) {
- int adjustment = 0;
- int minimum = 0;
-
- minimum = left ?
- Math.round(getMinimumRatioFor(nodeBounds) * nodeBounds.width) :
- Math.round((1 - getMaximumRatioFor(nodeBounds)) * nodeBounds.width) - SASH_WIDTH;
-
- if (minimum > childBounds.width) {
- adjustment = minimum - childBounds.width;
- childBounds.width = minimum;
- }
-
- return adjustment;
-}
-
-// getMinimumRatioFor added by cagatayk@acm.org
-/**
- * Obtain the minimum ratio required to display the control on the "left"
- * using its minimum dimensions.
- */
-public float getMinimumRatioFor(Rectangle bounds) {
- float part = 0, whole = 0;
-
- if (getSash().isVertical()) {
- part = children[0].getMinimumWidth();
- whole = bounds.width;
- }
- else {
- part = children[0].getMinimumHeight();
- whole = bounds.height;
- }
-
- return (part != 0 ) ? part / whole : IPageLayout.RATIO_MIN;
-}
-
-// getMaximumRatioFor added by cagatayk@acm.org
-/**
- * Obtain the maximum ratio required to display the control on the "right"
- * using its minimum dimensions.
- */
-public float getMaximumRatioFor(Rectangle bounds) {
- float part = 0, whole = 0;
-
- if (getSash().isVertical()) {
- whole = bounds.width;
- part = whole - children[1].getMinimumWidth();
- }
- else {
- whole = bounds.height;
- part = whole - children[1].getMinimumHeight();
- }
-
- return (part != whole) ? (part - SASH_WIDTH) / whole : IPageLayout.RATIO_MAX;
-
-}
-
-// getMinimumHeight added by cagatayk@acm.org
-/**
- * Obtain the minimum height required to display all controls under
- * this node.
- */
-public int getMinimumHeight() {
- int left = children[0].getMinimumHeight();
- int right = children[1].getMinimumHeight();
-
- int minimum = 0;
- if (getSash().isVertical())
- minimum = Math.max(left, right);
- else if (left > 0 || right > 0) {
- minimum = left + right;
- // only consider sash if both children are visible, fix for placeholders
- if (children[0].isVisible() && children[1].isVisible()) {
- minimum += SASH_WIDTH;
- }
- }
-
- return minimum;
-}
-
-// getMinimumWidth added by cagatayk@acm.org
-/**
- * Obtain the minimum width required to display all controls under
- * this node.
- */
-public int getMinimumWidth() {
- int left = children[0].getMinimumWidth();
- int right = children[1].getMinimumWidth();
-
- int minimum = 0;
- if (!getSash().isVertical())
- minimum = Math.max(left, right);
- else if (left > 0 || right > 0) {
- minimum = left + right;
- // only consider sash if both children are visible, fix for placeholders
- if (children[0].isVisible() && children[1].isVisible()) {
- minimum += SASH_WIDTH;
- }
- }
-
- return minimum;
-}
-
-
-/**
- * Sets a child in this node
- */
-void setChild(boolean left,LayoutPart part) {
- LayoutTree child = new LayoutTree(part);
- setChild(left,child);
-}
-/**
- * Sets a child in this node
- */
-void setChild(boolean left,LayoutTree child) {
- int index = left?0:1;
- children[index] = child;
- child.setParent(this);
-}
-/**
- * Returns a string representation of this object.
- */
-public String toString() {
- String s = "<null>\n";//$NON-NLS-1$
- if(part.getControl() != null)
- s = "<@" + part.getControl().hashCode() + ">\n";//$NON-NLS-2$//$NON-NLS-1$
- String result = "["; //$NON-NLS-1$
- if(children[0].getParent() != this)
- result = result + "{" + children[0] + "}" + s;//$NON-NLS-2$//$NON-NLS-1$
- else
- result = result + children[0] + s;
-
- if(children[1].getParent() != this)
- result = result + "{" + children[1] + "}]";//$NON-NLS-2$//$NON-NLS-1$
- else
- result = result + children[1] + "]";//$NON-NLS-1$
- return result;
-}
-/**
- * Create the sashes if the children are visible
- * and dispose it if they are not.
- */
-public void updateSashes(Composite parent) {
- if(parent == null) return;
- children[0].updateSashes(parent);
- children[1].updateSashes(parent);
- if(children[0].isVisible() && children[1].isVisible())
- getSash().createControl(parent);
- else
- getSash().dispose();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LightweightActionDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LightweightActionDescriptor.java
deleted file mode 100644
index 17d32e2..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LightweightActionDescriptor.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.dialogs.DialogUtil;
-import org.eclipse.ui.internal.model.WorkbenchAdapter;
-import org.eclipse.ui.model.*;
-import org.eclipse.jface.resource.*;
-
-/**
- * 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.]
- */
-public class LightweightActionDescriptor extends WorkbenchAdapter
- implements IAdaptable
-{
- private String id;
- private String label;
- private String description;
- private ImageDescriptor image;
-public LightweightActionDescriptor(IConfigurationElement actionElement) {
- super();
-
- this.id = actionElement.getAttribute(ActionDescriptor.ATT_ID);
- this.label = actionElement.getAttribute(ActionDescriptor.ATT_LABEL);
- this.description = actionElement.getAttribute(ActionDescriptor.ATT_DESCRIPTION);
-
- String iconName = actionElement.getAttribute(ActionDescriptor.ATT_ICON);
- if (iconName != null) {
- this.image = WorkbenchImages.getImageDescriptorFromExtension(actionElement.getDeclaringExtension(), 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 Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- return null;
-}
-/**
- * Returns the action's description.
- */
-public String getDescription() {
- return description;
-}
-/**
- * Returns the action's id.
- */
-public String getId() {
- return id;
-}
-/**
- * Returns the action's image descriptor.
- */
-public ImageDescriptor getImageDescriptor() {
- return image;
-}
-/**
- * @see IWorkbenchAdapter#getImageDescriptor
- */
-public ImageDescriptor getImageDescriptor(Object o) {
- if (o == this)
- return getImageDescriptor();
- return super.getImageDescriptor(o);
-}
-/**
- * Returns the action's label.
- */
-public String getLabel() {
- return label;
-}
-/**
- * @see IWorkbenchAdapter#getLabel
- */
-public String getLabel(Object o) {
- if (o == this) {
- String text = getLabel();
- int end = text.lastIndexOf('@');
- if(end >= 0)
- text = text.substring(0, end);
- return DialogUtil.removeAccel(text);
- }
- return super.getLabel(o);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LockToolBarAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LockToolBarAction.java
deleted file mode 100644
index ecfcbe8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/LockToolBarAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * The <code>LockToolBarAction</code> is used to lock the toolbars for the
- * workbench. The toolbar for all perspectives is locked.
- */
-public class LockToolBarAction extends Action {
- private WorkbenchWindow window;
-
- /**
- * Create a new instance of <code>LockToolBarAction</code>
- *
- * @param window the workbench window this action applies to
- */
- public LockToolBarAction(WorkbenchWindow window) {
- super(WorkbenchMessages.getString("LockToolBarAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("LockToolBarAction.toolTip")); //$NON-NLS-1$
- setEnabled(false);
- setChecked(false);
- this.window = window;
- WorkbenchHelp.setHelp(this, IHelpContextIds.LOCK_TOOLBAR_ACTION);
- // add window listener for updating checked state of this action when
- // workbench opened
- window.getWorkbench().addWindowListener(new org.eclipse.ui.IWindowListener() {
- public void windowActivated(IWorkbenchWindow window){
- }
- public void windowDeactivated(IWorkbenchWindow window) {
- }
- public void windowClosed(IWorkbenchWindow window) {
- }
- public void windowOpened(IWorkbenchWindow window) {
- setChecked(((WorkbenchWindow)window).isToolBarLocked());
- }
- });
- }
- /* (non-Javadoc)
- * Method declared on IAction.
- */
- public void run() {
- boolean locked = isChecked();
- window.lockToolBar(locked);
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 71a7c8f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MessageLine.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.internal;
-
-import org.eclipse.core.runtime.IStatus;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * A message line displaying a status.
- */
-public class MessageLine extends CLabel {
-
- private static final RGB ERROR_BACKGROUND_RGB = new RGB(230, 226, 221);
-
- private Color fNormalMsgAreaBackground;
- private Color fErrorMsgAreaBackground;
-
- /**
- * 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);
- fNormalMsgAreaBackground= getBackground();
- fErrorMsgAreaBackground= 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));
- if (fErrorMsgAreaBackground == null) {
- fErrorMsgAreaBackground= new Color(getDisplay(), ERROR_BACKGROUND_RGB);
- }
- setBackground(fErrorMsgAreaBackground);
- return;
- }
- }
- setText(""); //$NON-NLS-1$
- setImage(null);
- setBackground(fNormalMsgAreaBackground);
- }
-
- /*
- * @see Widget#dispose()
- */
- public void dispose() {
- if (fErrorMsgAreaBackground != null) {
- fErrorMsgAreaBackground.dispose();
- fErrorMsgAreaBackground= null;
- }
- super.dispose();
- }
-}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MultiEditorInnerPane.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MultiEditorInnerPane.java
deleted file mode 100644
index 404a1c2..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MultiEditorInnerPane.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.ui.internal;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.part.MultiEditor;
-
-/**
- * Implements a pane of each editor inside a MultiEditor.
- */
-public class MultiEditorInnerPane extends EditorPane {
-
- EditorPane parentPane;
- /**
- * Constructor for MultiEditorInnerPane.
- */
- public MultiEditorInnerPane(EditorPane pane,IEditorReference ref, WorkbenchPage page, EditorWorkbook workbook) {
- super(ref, page, workbook);
- parentPane = pane;
- }
- /**
- * Returns the outer editor.
- */
- public EditorPane getParentPane() {
- return parentPane;
- }
- /**
- * Update the gradient on the inner editor title bar
- */
- private void updateGradient() {
- ((MultiEditor)parentPane.getPartReference().getPart(true)).updateGradient((IEditorPart)this.getEditorReference().getPart(true));
- }
- /**
- * Indicate focus in part.
- */
- public void showFocus(boolean inFocus) {
- super.showFocus(inFocus);
- updateGradient();
- }
- /* (non-Javadoc)
- * Method declared on PartPane.
- */
- /* package */ void shellDeactivated() {
- super.shellDeactivated();
- updateGradient();
- }
- /* (non-Javadoc)
- * Method declared on PartPane.
- */
- /* package */ void shellActivated() {
- super.shellActivated();
- updateGradient();
- }
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MultiEditorOuterPane.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MultiEditorOuterPane.java
deleted file mode 100644
index e9e9789..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/MultiEditorOuterPane.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.ui.internal;
-
-import org.eclipse.ui.*;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-/**
- * Implements a pane for a MultiEditor.
- */
-public class MultiEditorOuterPane extends EditorPane {
- /**
- * Constructor for MultiEditorOuterPane.
- */
- public MultiEditorOuterPane(IEditorReference ref, WorkbenchPage page, EditorWorkbook workbook) {
- super(ref, page, workbook);
- }
- /*
- * @see EditorPane
- */
- protected void requestActivation() {
- //Outer editor is never activated.
- }
-}
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
deleted file mode 100644
index a663257..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistory.java
+++ /dev/null
Binary files differ
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
deleted file mode 100644
index edfd97a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NavigationHistoryAction.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v1.0
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v10.html
-
-Contributors:
- IBM Corporation - Initial implementation
-**********************************************************************/
-
-package org.eclipse.ui.internal;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.*;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * The <code>NavigationHistoryAction</code> moves navigation history
- * back and forward.
- */
-public class NavigationHistoryAction extends PageEventAction {
- private boolean forward;
-
- /**
- * 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
- */
- public NavigationHistoryAction(IWorkbenchWindow window,boolean forward) {
- super("",window); //$NON-NLS-1$
- if(forward) {
- setText(WorkbenchMessages.getString("NavigationHistoryAction.forward.text"));
- setToolTipText(WorkbenchMessages.getString("NavigationHistoryAction.forward.toolTip")); //$NON-NLS-1$
- } else {
- setText(WorkbenchMessages.getString("NavigationHistoryAction.backward.text"));
- setToolTipText(WorkbenchMessages.getString("NavigationHistoryAction.backward.toolTip")); //$NON-NLS-1$
- }
- // WorkbenchHelp.setHelp(this, IHelpContextIds.CLOSE_ALL_PAGES_ACTION);
- setEnabled(false);
- this.forward = forward;
- }
- /* (non-Javadoc)
- * Method declared on PageEventAction.
- */
- public void pageClosed(IWorkbenchPage page) {
- super.pageClosed(page);
- setEnabled(false);
- }
- /* (non-Javadoc)
- * Method declared on PageEventAction.
- */
- public void pageActivated(IWorkbenchPage page) {
- super.pageActivated(page);
- NavigationHistory nh = (NavigationHistory)page.getNavigationHistory();
- if(forward)
- nh.setForwardAction(this);
- else
- nh.setBackwardAction(this);
- }
- /* (non-Javadoc)
- * Method declared on IAction.
- */
- public void run() {
- WorkbenchPage page = (WorkbenchPage)getActivePage();
- if (page != null) {
- NavigationHistory nh = (NavigationHistory)page.getNavigationHistory();
- if(forward)
- nh.forward();
- else
- nh.backward();
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NewConfigurationInfo.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NewConfigurationInfo.java
deleted file mode 100644
index 1662e1c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NewConfigurationInfo.java
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NewWizardDropDownAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NewWizardDropDownAction.java
deleted file mode 100644
index a2441f3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NewWizardDropDownAction.java
+++ /dev/null
@@ -1,101 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.NewWizardAction;
-import org.eclipse.ui.actions.NewWizardMenu;
-
-/**
- * Invoke the resource creation wizard selection Wizard.
- * This action will retarget to the active view.
- */
-public class NewWizardDropDownAction extends Action implements IMenuCreator, IWorkbenchWindowPulldownDelegate2 {
- private IWorkbench workbench;
- private NewWizardAction newWizardAction;
- private MenuManager dropDownMenuMgr;
- private NewWizardMenu newWizardMenu;
-/**
- * Create a new instance of this class
- */
-public NewWizardDropDownAction(IWorkbench aWorkbench, NewWizardAction newWizardAction) {
- super(WorkbenchMessages.getString("NewWizardDropDown.text")); //$NON-NLS-1$
- this.workbench = aWorkbench;
- this.newWizardAction = newWizardAction;
- setToolTipText(newWizardAction.getToolTipText());
- setImageDescriptor(newWizardAction.getImageDescriptor());
- setMenuCreator(this);
-}
-/**
- * create the menu manager for the drop down menu.
- */
-protected void createDropDownMenuMgr() {
- if (dropDownMenuMgr == null) {
- dropDownMenuMgr = new MenuManager();
- newWizardMenu = new NewWizardMenu(dropDownMenuMgr,
- workbench.getActiveWorkbenchWindow(),
- false);
- }
-}
-/**
- * dispose method comment.
- */
-public void dispose() {
- if (dropDownMenuMgr != null) {
- dropDownMenuMgr.dispose();
- dropDownMenuMgr = null;
- }
-}
-/**
- * getMenu method comment.
- */
-public Menu getMenu(Control parent) {
- createDropDownMenuMgr();
- newWizardMenu.updateMenu();
- return dropDownMenuMgr.createContextMenu(parent);
-}
-/**
- * Create the drop down menu as a submenu of parent. Necessary
- * for CoolBar support.
- */
-public Menu getMenu(Menu parent) {
- createDropDownMenuMgr();
- newWizardMenu.updateMenu();
- Menu menu= new Menu(parent);
- IContributionItem[] items = dropDownMenuMgr.getItems();
- for (int i=0; i<items.length; i++) {
- IContributionItem item = items[i];
- IContributionItem newItem = item;
- if (item instanceof ActionContributionItem) {
- newItem = new ActionContributionItem(((ActionContributionItem)item).getAction());
- }
- newItem.fill(menu, -1);
- }
- return menu;
-}
-/**
- * @see IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
- */
-public void init(IWorkbenchWindow window){
-}
-public void run() {
- newWizardAction.run();
-}
-/**
- * @see runWithEvent(IAction, Event)
- * @see IActionDelegate#run(IAction)
- */
-public void run(IAction action) {
-}
-/**
- * @see IActionDelegate#selectionChanged(IAction, ISelection)
- */
-public void selectionChanged(IAction action, ISelection selection){
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NewWizardShortcutAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NewWizardShortcutAction.java
deleted file mode 100644
index b425750..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/NewWizardShortcutAction.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.dialogs.WorkbenchWizardElement;
-
-
-/**
- * Instances can launch arbitrary resource creation wizards
- * that have been marked as being available as workbench shortcut
- * items
- */
-public class NewWizardShortcutAction extends Action {
- private WorkbenchWizardElement wizardElement;
- private IWorkbench workbench;
-/**
- * Create an instance of this class. Use this constructor if you do
- * not wish to pre-specify the selection that should be provided to
- * launched shortcut wizards.
- *
- * @param element WorkbenchWizardElement
- */
-public NewWizardShortcutAction(IWorkbench workbench, WorkbenchWizardElement element) {
- super(element.getLabel(element));
- setToolTipText(element.getDescription());
- setImageDescriptor(element.getImageDescriptor());
- setId(IWorkbenchActionConstants.NEW);
- wizardElement = element;
- this.workbench = workbench;
-}
-/**
- * This action has been invoked by the user
- *
- * @param context Window
- */
-public void run() {
- // create instance of target wizard
-
- INewWizard wizard;
- try {
- wizard = (INewWizard)wizardElement.createExecutableExtension();
- } catch (CoreException e) {
- ErrorDialog.openError(
- workbench.getActiveWorkbenchWindow().getShell(),
- WorkbenchMessages.getString("NewWizardShortcutAction.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("NewWizardShortcutAction.errorMessage"), //$NON-NLS-1$
- e.getStatus());
- return;
- }
-
- ISelection selection = workbench.getActiveWorkbenchWindow().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 = workbench.getActiveWorkbenchWindow().getPartService().getActivePart();
- if (part instanceof IEditorPart) {
- IEditorInput input = ((IEditorPart)part).getEditorInput();
- if (input instanceof IFileEditorInput) {
- selectionToPass = new StructuredSelection(((IFileEditorInput)input).getFile());
- }
- }
- }
-
- wizard.init(workbench, selectionToPass);
-
- Shell parent = workbench.getActiveWorkbenchWindow().getShell();
- WizardDialog dialog = new WizardDialog(parent, wizard);
- dialog.create();
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_WIZARD_SHORTCUT);
- dialog.open();
-}
-}
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
deleted file mode 100644
index c063aca..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributor.java
+++ /dev/null
@@ -1,186 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-
-import java.util.*;
-
-/**
- * This class describes one element within the popup menu action registry.
- */
-public class ObjectActionContributor extends PluginActionBuilder
- implements IObjectActionContributor
-{
- private IConfigurationElement config;
- private boolean configRead=false;
- private boolean adaptable = false;
- static final String ATT_NAME_FILTER="nameFilter";//$NON-NLS-1$
- static final String ATT_ADAPTABLE="adaptable";//$NON-NLS-1$
- static final String P_TRUE="true";//$NON-NLS-1$
- private ObjectFilterTest filterTest;
- private ActionExpression visibilityTest;
-/**
- * The constructor.
- */
-public ObjectActionContributor(IConfigurationElement config) {
- this.config = config;
- this.adaptable = P_TRUE.equalsIgnoreCase(config.getAttribute(ATT_ADAPTABLE));
-}
-/**
- * Contributes actions applicable for the current selection.
- */
-public boolean contributeObjectActions(IWorkbenchPart part, IMenuManager menu,
- ISelectionProvider selProv)
-{
- // Parse config.
- if (!configRead)
- readConfigElement();
- if (cache == null)
- return false;
-
- // Get a structured selection.
- ISelection sel = selProv.getSelection();
- if ((sel == null) || !(sel instanceof IStructuredSelection))
- return false;
- IStructuredSelection selection = (IStructuredSelection) sel;
-
- // Generate menu.
- boolean actualContributions = false;
- for (int i = 0; i < cache.size(); i++) {
- Object obj = cache.get(i);
- if (obj instanceof ActionDescriptor) {
- ActionDescriptor ad = (ActionDescriptor) obj;
- contributeMenuAction(ad, menu, true);
- // Update action for the current selection and part.
- if (ad.getAction() instanceof ObjectPluginAction) {
- ObjectPluginAction action = (ObjectPluginAction)ad.getAction();
- action.setActivePart(part);
- action.selectionChanged(selection);
- }
- actualContributions = true;
- }
- }
- return actualContributions;
-}
-/**
- * Contributes menus applicable for the current selection.
- */
-public boolean contributeObjectMenus(IMenuManager menu, ISelectionProvider selProv) {
- // Parse config element.
- if (!configRead)
- readConfigElement();
- if (cache == null)
- return false;
-
- // Get a structured selection.
- ISelection sel = selProv.getSelection();
- if ((sel == null) || !(sel instanceof IStructuredSelection))
- return false;
-
- // Generate menu.
- boolean actualContributions = false;
- for (int i = 0; i < cache.size(); i++) {
- Object obj = cache.get(i);
- if (obj instanceof IConfigurationElement) {
- IConfigurationElement menuElement = (IConfigurationElement) obj;
- contributeMenu(menuElement, menu, true);
- actualContributions = true;
- }
- }
- return actualContributions;
-}
-/**
- * This factory method returns a new ActionDescriptor for the
- * configuration element.
- */
-protected ActionDescriptor createActionDescriptor(IConfigurationElement element) {
- return new ActionDescriptor(element, ActionDescriptor.T_POPUP);
-}
-/**
- * Returns true if name filter is not specified for the contribution
- * or the current selection matches the filter.
- */
-public boolean isApplicableTo(Object object) {
- // Parse config.
- if (!configRead)
- readConfigElement();
-
- // Test name.
- if (!testName(object))
- return false;
-
- // Test visibility filter.
- if (visibilityTest != null)
- return visibilityTest.isEnabledFor(object);
-
- // Test custom filter.
- if (filterTest != null)
- return filterTest.matches(object, true);
-
- return true;
-}
-/**
- * Reads the configuration element and all the children.
- * This creates an action descriptor for every action in the extension.
- */
-private void readConfigElement() {
- if (!configRead) {
- readElementChildren(config);
- configRead = true;
- }
-}
-/**
- * Implements abstract method to handle the provided XML element
- * in the registry.
- */
-protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
- if (tag.equals(PluginActionBuilder.TAG_VISIBILITY)) {
- visibilityTest = new ActionExpression(element);
- return true;
- } else if (tag.equals(PluginActionBuilder.TAG_FILTER)) {
- if (filterTest == null)
- filterTest = new ObjectFilterTest();
- filterTest.addFilterElement(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(ATT_NAME_FILTER);
- if (nameFilter == null)
- return true;
- String objectName = null;
- if (object instanceof IAdaptable) {
- IAdaptable element = (IAdaptable) object;
- IWorkbenchAdapter de = (IWorkbenchAdapter)element.getAdapter(IWorkbenchAdapter.class);
- if (de != null)
- objectName = de.getLabel(element);
- }
- if (objectName == null) {
- objectName = object.toString();
- }
- return SelectionEnabler.verifyNameMatch(objectName, nameFilter);
-}
-
-/*
- * @see IObjectContributor#canAdapt()
- */
-public boolean canAdapt() {
- return adaptable;
-}
-
-}
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
deleted file mode 100644
index 4ff6580..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorManager.java
+++ /dev/null
@@ -1,211 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.ui.*;
-
-/**
- * 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;
-/**
- * PopupMenuManager constructor.
- */
-public ObjectActionContributorManager() {
- loadContributors();
-}
-/**
- * Returns the class search order starting with <code>extensibleClass</code>.
- * The search order is defined in this class' comment.
- */
-private 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 (int i=0; i<interfaces.length; i++) {
- result.add(interfaces[i]);
- }
- // get the superclass
- clazz = clazz.getSuperclass();
- }
- return result;
-}
-/**
- * Contributes submenus and/or actions applicable to the selection in the
- * provided viewer into the provided popup menu.
- */
-public boolean contributeObjectActions(IWorkbenchPart part, IMenuManager popupMenu,
- ISelectionProvider selProv)
-{
- // 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 = new ArrayList();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ssel = (IStructuredSelection) selection;
- Iterator enum = ssel.iterator();
- while (enum.hasNext()) {
- Object obj = enum.next();
- elements.add(obj);
- }
- } else {
- elements.add(selection);
- }
-
- // Calculate the common class.
- Class commonClass = getCommonClass(elements);
- if (commonClass == null)
- return false;
-
- // 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);
-
- // Get the contributors.
- // If there is a resource class add it in
- List contributors = null;
- if (resourceClass == null)
- contributors = getContributors(commonClass);
- else
- contributors = getContributors(commonClass, resourceClass);
- if (contributors == null)
- return false;
-
- // Do the contributions. Add menus first, then actions
- boolean actualContributions = false;
- for (int i = 0; i < contributors.size(); i++) {
- IObjectActionContributor contributor = (IObjectActionContributor) contributors.get(i);
- if (!isApplicableTo(elements, contributor))
- continue;
- if (contributor.contributeObjectMenus(popupMenu, selProv))
- actualContributions = true;
- }
- for (int i = 0; i < contributors.size(); i++) {
- IObjectActionContributor contributor = (IObjectActionContributor) contributors.get(i);
- if (!isApplicableTo(elements, contributor))
- continue;
- if (contributor.contributeObjectActions(part, popupMenu, selProv))
- actualContributions = true;
- }
- return actualContributions;
-}
-
-/**
- * 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;
-}
-/**
- * Returns the common denominator class for the given
- * collection of objects.
- */
-private Class getCommonClass(List objects) {
- if (objects == null || objects.size()==0)
- return null;
- Class commonClass = objects.get(0).getClass();
- // try easy
- if (objects.size() == 1)
- return commonClass;
- // 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)) continue;
- // compute common class
- commonClass = getCommonClass(commonClass, newClass);
- // give up
- if (commonClass==null) return null;
- }
- return commonClass;
-}
-
-
-/**
- * Returns 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);
-}
-
-
-
-/**
- * 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.size()==0)
- return null;
-
- List testList = new ArrayList();
-
- for (int i = 0; i < objects.size(); i++) {
- Object object = objects.get(i);
-
- if(object instanceof IAdaptable){
- if(object instanceof IResource)
- continue;
-
- IResource resource = getAdaptedResource((IAdaptable) 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);
-}
-
-
-}
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
deleted file mode 100644
index 01a8eda..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectActionContributorReader.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.misc.*;
-import java.util.*;
-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.
- */
-public class ObjectActionContributorReader extends RegistryReader {
-
- public final static String TAG_OBJECT_CONTRIBUTION = "objectContribution";//$NON-NLS-1$
- private final static String ATT_OBJECTCLASS = "objectClass";//$NON-NLS-1$
- private ObjectActionContributorManager manager;
-/**
- * Creates popup menu contributor from this element.
- */
-protected void processObjectContribution(IConfigurationElement element) {
- String objectClassName = element.getAttribute(ATT_OBJECTCLASS);
- if (objectClassName == null) {
- logMissingAttribute(element, ATT_OBJECTCLASS);
- return;
- }
-
- IObjectContributor contributor = new ObjectActionContributor(element);
- manager.registerContributor(contributor, objectClassName);
-}
-/**
- * Implements abstract method to handle configuration elements.
- */
-protected boolean readElement(IConfigurationElement element) {
- String tagName = element.getName();
- if (tagName.equals(TAG_OBJECT_CONTRIBUTION)) {
- processObjectContribution(element);
- return true;
- }
- if (tagName.equals(ViewerActionBuilder.TAG_CONTRIBUTION_TYPE)) {
- return true;
- }
-
- return false;
-}
-/**
- * Reads the registry and registers popup menu contributors
- * found there.
- */
-public void readPopupContributors(ObjectActionContributorManager mng) {
- manager = mng;
- IPluginRegistry registry = Platform.getPluginRegistry();
- readRegistry(registry, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_POPUP_MENU);
-}
-}
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
deleted file mode 100644
index d60452f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectContributorManager.java
+++ /dev/null
@@ -1,336 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IContributorResourceAdapter;
-
-/**
- * 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>
- * </ul>
- *
- * @see IObjectContributor
- * @see IObjectContributorManager
- */
-public abstract class ObjectContributorManager {
- // Empty list that is immutable
- private static final List EMPTY_LIST = Arrays.asList(new Object[0]);
-
- /** Table of contributors. */
- protected Map contributors;
-
- /** 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 adapterLookup;
-
-/**
- * Constructs a new contributor manager.
- */
-public ObjectContributorManager() {
- contributors = new Hashtable(5);
- objectLookup = null;
- adapterLookup = 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.
- */
-private Vector computeClassOrder(Class extensibleClass) {
- Vector result = new Vector(4);
- Class clazz = extensibleClass;
- while (clazz != null) {
- result.addElement(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.
- */
-private List computeInterfaceOrder(List classList) {
- List 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;
- adapterLookup = null;
-}
-/**
- * Cache the resource adapter class contributor search path.
- */
-private void cacheAdapterLookup(Class adapterClass, List results) {
- if (adapterLookup == null)
- adapterLookup = new HashMap();
- adapterLookup.put(adapterClass, results);
-}
-/**
- * Cache the object class contributor search path.
- */
-private void cacheObjectLookup(Class objectClass, List results) {
- if (objectLookup == null)
- objectLookup = new HashMap();
- objectLookup.put(objectClass, results);
-}
-/**
- * Returns all the contributors registered against
- * the given object class.
- */
-protected List getContributors(Class objectClass) {
-
- List objectList = null;
-
- // Lookup the results in the cache first
- if (objectLookup != null) {
- objectList = (List) objectLookup.get(objectClass);
- }
-
- // If not in cache, build it
- if (objectList == null) {
- objectList = addContributorsFor(objectClass);
- if (objectList.size() == 0)
- objectList = EMPTY_LIST;
-
- // Store the contribution list into the cache.
- cacheObjectLookup(objectClass, objectList);
- }
-
- return objectList;
-}
-
-/**
- * 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;
-}
-
-/**
- * Get the contributors for object including those it adapts
- * to.
- *
- * @return The list of contributors, empty if none.
- */
-protected List getContributors(Object object){
-
- Class objectClass = object.getClass();
- IResource adapted = getAdaptedResource(object);
-
- if (adapted == null)
- return getContributors(objectClass);
- else
- return getContributors(objectClass, adapted.getClass());
-}
-
-/**
- * Returns true if contributors exist in the manager for
- * this object.
- */
-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 (int i = 0; i < interfaces.length; i++) {
- Class interfac = interfaces[i];
- if (seen.get(interfac) == null) {
- result.add(interfac);
- seen.put(interfac, interfac);
- newInterfaces.add(interfac);
- }
- }
- for (Iterator newList = newInterfaces.iterator(); newList.hasNext();)
- internalComputeInterfaceOrder(((Class) newList.next()).getInterfaces(), result, seen);
-}
-/**
- *
- */
-public boolean isApplicableTo(IStructuredSelection selection, IObjectContributor contributor) {
- Iterator elements = selection.iterator();
- while (elements.hasNext()) {
- if (contributor.isApplicableTo(elements.next())==false)
- return false;
- }
- return true;
-}
-/**
- *
- */
-public boolean isApplicableTo(List list, IObjectContributor contributor) {
- Iterator elements = list.iterator();
- while (elements.hasNext()) {
- if (contributor.isApplicableTo(elements.next())==false)
- return false;
- }
- return true;
-}
-/**
- * @see IContributorManager#registerContributor
- */
-public void registerContributor(IObjectContributor contributor, String targetType) {
- Vector contributorList = (Vector) contributors.get(targetType);
- if (contributorList == null) {
- contributorList = new Vector(5);
- contributors.put(targetType, contributorList);
- }
- contributorList.addElement(contributor);
- flushLookup();
-}
-/**
- * @see IContributorManager#unregisterAllContributors
- */
-public void unregisterAllContributors() {
- contributors = new Hashtable(5);
- flushLookup();
-}
-/**
- * @see IContributorManager#unregisterContributor
- */
-public void unregisterContributor(IObjectContributor contributor, String targetType) {
- Vector contributorList = (Vector) contributors.get(targetType);
- if (contributorList == null)
- return;
- contributorList.removeElement(contributor);
- flushLookup();
-}
-/**
- * @see IContributorManager#unregisterContributors
- */
-public void unregisterContributors(String targetType) {
- contributors.remove(targetType);
- flushLookup();
-}
-
-/**
- * Returns all the contributors registered against
- * the given object class and the resource class that
- * it has an Adaptable for.
- */
-protected List getContributors(Class objectClass, Class resourceClass) {
-
- List objectList = null;
- List resourceList = null;
-
- // Lookup the results in the cache first
- if (objectLookup != null) {
- objectList = (List) objectLookup.get(objectClass);
- }
- if (adapterLookup != null) {
- resourceList = (List) adapterLookup.get(resourceClass);
- }
-
- if (objectList == null) {
- objectList = addContributorsFor(objectClass);
- if (objectList.size() == 0)
- objectList = EMPTY_LIST;
- cacheObjectLookup(objectClass, objectList);
- }
- if (resourceList == null) {
- List contributors = addContributorsFor(resourceClass);
- resourceList = new ArrayList(contributors.size());
- Iterator enum = contributors.iterator();
- while (enum.hasNext()){
- IObjectContributor contributor = (IObjectContributor)enum.next();
- if (contributor.canAdapt())
- resourceList.add(contributor);
- }
- if (resourceList.size() == 0)
- resourceList = EMPTY_LIST;
- cacheAdapterLookup(resourceClass, resourceList);
- }
-
- // Collect the contribution lists into one result
- ArrayList results = new ArrayList(objectList.size() + resourceList.size());
- results.addAll(objectList);
- results.addAll(resourceList);
- return results;
-}
-
-/**
- * Get the adapted resource for the supplied object. If the
- * object is an instance of IResource or is not an instance
- * of IAdaptable return null. Otherwise see if it adapts
- * to IResource via IContributorResourceAdapter.
- * @return IResource or null
- * @param object Object
- */
-
-protected IResource getAdaptedResource(Object object){
-
- if(object instanceof IResource)
- return null;
-
- if(object instanceof IAdaptable){
- IAdaptable adaptable = (IAdaptable) object;
-
- Object resourceAdapter =
- adaptable.getAdapter(IContributorResourceAdapter.class);
- if(resourceAdapter == null)
- resourceAdapter = DefaultContributorResourceAdapter.getDefault();
-
- return((IContributorResourceAdapter) resourceAdapter).
- getAdaptedResource(adaptable);
- }
- 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
deleted file mode 100644
index 8403061..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectFilterTest.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.IActionFilter;
-
-/**
- * An ObjectFilterTest is used to read an object filter from XML,
- * and evaluate the results for a given object.
- */
-public class ObjectFilterTest {
- private HashMap filterElements;
-
- /**
- * Create a new object filter.
- */
- public ObjectFilterTest() {
- }
-
- /**
- * 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)
- return false;
- if (filterElements==null)
- filterElements = new HashMap();
- 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>rue</code> if the object is a wrapper for a resource, and
- * the resource produces a filter match.
- * </p>
- *
- * @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)
- return true;
-
- // Try out the object.
- if (this.preciselyMatches(object))
- return true;
-
- // If not adaptable, or the object is a resource, just return.
- if (!adaptable)
- return false;
- if (object instanceof IResource)
- return false;
-
- // Try out the underlying resource.
- IResource res = null;
- if (object instanceof IAdaptable)
- res = (IResource)((IAdaptable)object).getAdapter(IResource.class);
- if (res == null)
- return false;
- return this.preciselyMatches(res);
- }
-
- /**
- * Returns whether the object filter correctly matches a given object.
- */
- private boolean preciselyMatches(Object object) {
- // Get the action filter.
- IActionFilter filter = null;
- if (object instanceof IActionFilter)
- filter = (IActionFilter)object;
- else if (object instanceof IAdaptable)
- filter = (IActionFilter)((IAdaptable)object).getAdapter(IActionFilter.class);
- if (filter == null)
- return false;
-
- // Run the action filter.
- Iterator iter = filterElements.keySet().iterator();
- while (iter.hasNext()) {
- String name = (String)iter.next();
- String value = (String)filterElements.get(name);
- if (!filter.testAttribute(object, name, value))
- return false;
- }
- 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
deleted file mode 100644
index e8a8866..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ObjectPluginAction.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.core.runtime.*;
-
-/**
- * An object action extension in a popup menu.
- */
-public class ObjectPluginAction extends PluginAction {
- private IWorkbenchPart activePart;
-/**
- * Constructs a new ObjectPluginAction.
- */
-public ObjectPluginAction(IConfigurationElement actionElement, String runAttribute,String definitionId) {
- super(actionElement, runAttribute,definitionId);
-}
-
-/**
- * Initialize an action delegate.
- * Subclasses may override this.
- */
-protected IActionDelegate initDelegate(Object obj)
- throws WorkbenchException
-{
- IActionDelegate result = super.initDelegate(obj);
- if (obj instanceof IObjectActionDelegate && activePart != null) {
- ((IObjectActionDelegate)obj).setActivePart(this, activePart);
- }
- return result;
-}
-
-/**
- * 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.
- * </p>
- *
- * @param action the action proxy that handles presentation portion of the action
- * @param targetPart the new part target
- */
-public void setActivePart(IWorkbenchPart targetPart) {
- activePart = targetPart;
- IActionDelegate delegate = getDelegate();
- if (delegate != null && delegate instanceof IObjectActionDelegate)
- ((IObjectActionDelegate)delegate).setActivePart(this, activePart);
-}
-}
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
deleted file mode 100644
index 15ae342..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenPreferencesAction.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.jface.preference.*;
-import org.eclipse.ui.internal.dialogs.WorkbenchPreferenceDialog;
-import org.eclipse.ui.help.*;
-
-/**
- * Open the preferences dialog
- */
-public class OpenPreferencesAction extends Action {
- protected IWorkbenchWindow window;
-/**
- * Create a new <code>OpenPreferenceAction</code>
- * This default constructor allows the the action to be called from the welcome page.
- */
-public OpenPreferencesAction() {
- this(((Workbench)PlatformUI.getWorkbench()).getActiveWorkbenchWindow());
-}
-/**
- * Create a new <code>OpenPreferenceAction</code> and initialize it
- * from the given resource bundle.
- */
-public OpenPreferencesAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.getString("OpenPreferences.text")); //$NON-NLS-1$
- this.window = window;
- setToolTipText(WorkbenchMessages.getString("OpenPreferences.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.OPEN_PREFERENCES_ACTION);
-}
-/**
- * Perform the action: open the preference dialog.
- */
-public void run() {
- PreferenceManager pm = WorkbenchPlugin.getDefault().getPreferenceManager();
-
- if (pm != null) {
- PreferenceDialog d = new WorkbenchPreferenceDialog(window.getShell(), pm);
- d.create();
- WorkbenchHelp.setHelp(d.getShell(), IHelpContextIds.PREFERENCE_DIALOG);
- d.open();
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenedPerspectivesMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenedPerspectivesMenu.java
deleted file mode 100644
index ffc6125..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/OpenedPerspectivesMenu.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Iterator;
-
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * A dynamic contribution item which shows all opened perspectives
- * in the window's active page.
- */
-public class OpenedPerspectivesMenu extends ContributionItem {
- private WorkbenchWindow window;
- private boolean showSeparator;
-
- private static final int MAX_TEXT_LENGTH = 40;
-
- /**
- * Create a new instance.
- */
- public OpenedPerspectivesMenu(WorkbenchWindow window, boolean showSeparator) {
- super("Opened perspectives"); //$NON-NLS-1$
- this.window = window;
- this.showSeparator = showSeparator;
- }
-
- /**
- * Returns the text for a perspective. This may be truncated to fit
- * within the MAX_TEXT_LENGTH.
- */
- private String calcText(int number, IPerspectiveDescriptor persp) {
- StringBuffer sb = new StringBuffer();
- if (number < 10)
- sb.append('&');
- sb.append(number);
- sb.append(' ');
- String suffix = persp.getLabel();
- if (suffix.length() <= MAX_TEXT_LENGTH) {
- sb.append(suffix);
- } else {
- sb.append(suffix.substring(0, MAX_TEXT_LENGTH / 2));
- sb.append("..."); //$NON-NLS-1$
- sb.append(suffix.substring(suffix.length() - MAX_TEXT_LENGTH / 2));
- }
- return sb.toString();
- }
-
- /**
- * Fills the given menu with menu items for all opened perspectives.
- */
- public void fill(Menu menu, int index) {
- final WorkbenchPage page = window.getActiveWorkbenchPage();
- if (page == null)
- return;
-
- // Add separator.
- if (showSeparator) {
- new MenuItem(menu, SWT.SEPARATOR, index);
- ++index;
- }
-
- // Add one item for each opened perspective.
- IPerspectiveDescriptor activePersp = page.getPerspective();
- IPerspectiveDescriptor descriptors[] = page.getOpenedPerspectives();
- int count = 1;
- for (int i = 0; i < descriptors.length; i++) {
- final IPerspectiveDescriptor desc = (IPerspectiveDescriptor)descriptors[i];
- MenuItem mi = new MenuItem(menu, SWT.RADIO, index);
- mi.setSelection(desc == activePersp);
- mi.setText(calcText(count, desc));
- // avoid hanging onto page or perspective directly in menu
- mi.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- WorkbenchPage page = window.getActiveWorkbenchPage();
- if (page != null) {
- page.setPerspective(desc);
- }
- }
- });
-
- index++;
- count++;
- }
- }
-
- /**
- * Overridden to always return true and force dynamic menu building.
- */
- public boolean isDynamic() {
- return true;
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 0206e12..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageEventAction.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.*;
-
-/**
- * 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.
- * <p>
- * Subclasses must implement the following <code>IAction</code> method:
- * <ul>
- * <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>
- * </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>
- * </ul>
- * </p>
- */
-public abstract class PageEventAction extends PartEventAction
- implements IPageListener
-{
- /**
- * The active page, or <code>null</code> if none.
- */
- private IWorkbenchPage activePage;
-
- /**
- * 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 these is no text
- * @param window the workbench window this action is
- * registered with.
- */
-protected PageEventAction(String text, IWorkbenchWindow window) {
- super(text);
- Assert.isNotNull(window);
- this.workbenchWindow = window;
- this.activePage = window.getActivePage();
- this.workbenchWindow.addPageListener(this);
-}
-/**
- * Returns the currently active page in the workbench window.
- *
- * @return currently active page in the workbench window, or <code>null</code> if none
- */
-public IWorkbenchPage getActivePage() {
- return activePage;
-}
-/**
- * Returns the workbench window this action applies to.
- *
- * @return the workbench window
- */
-public 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.
- */
-public void pageActivated(IWorkbenchPage 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.
- */
-public void pageClosed(IWorkbenchPage page) {
- 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.
- */
-public void pageOpened(IWorkbenchPage page) {
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageLayout.java
deleted file mode 100644
index dd3ab50..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageLayout.java
+++ /dev/null
@@ -1,495 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Dan Rubel <dan_rubel@instantiations.com>
- - Fix for bug 11490 - define hidden view (placeholder for view) in plugin.xml
-**********************************************************************/
-
-import java.util.*;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * This factory is used to define the initial layout of a part sash container.
- * <p>
- * Design notes: The design of <code>IPageLayout</code> is a reflection of
- * three requirements:
- * <ol>
- * <li>A mechanism is required to define the initial layout for a page. </li>
- * <li>The views and editors within a page will be persisted between
- * sessions.</li>
- * <li>The view and editor lifecycle for (1) and (2) should be identical.</li>
- * </ol>
- * </p>
- * <p>
- * In reflection of these requirements, the following strategy has been
- * implemented for layout definition.
- * <ol>
- * <li>A view extension is added to the workbench registry for the view.
- * This extension defines the extension id and extension class. </li>
- * <li>A view is added to a page by invoking one of the add methods
- * in <code>IPageLayout</code>. The type of view is passed as an
- * extension id, rather than a handle. The page layout will map
- * the extension id to a view class, create an instance of the class,
- * and then add the view to the page.</li>
- * </ol>
- * </p>
- */
-public class PageLayout implements IPageLayout {
- private static final String MISSING_REF_PART = "Referenced part does not exist yet: "; //$NON-NLS-1$
-
- private ViewFactory viewFactory;
- private LayoutPart editorFolder;
- private boolean editorVisible = true;
- private RootLayoutContainer rootLayoutContainer;
- private Map mapIDtoPart = new HashMap(10);
- private Map mapIDtoFolder = new HashMap(10);
- private Map mapFastViewToWidthRatio = new HashMap(10);
- private ArrayList actionSets = new ArrayList(3);
- private ArrayList newWizardActionIds = new ArrayList(3);
- private ArrayList showViewActionIds = new ArrayList(3);
- private ArrayList perspectiveActionIds = new ArrayList(3);
- private ArrayList fastViews = new ArrayList(3);
-
-/**
- * LayoutFactory constructor comment.
- */
-public PageLayout(RootLayoutContainer container, ViewFactory viewFactory, LayoutPart editorFolder) {
- super();
- this.viewFactory = viewFactory;
- this.rootLayoutContainer = container;
- this.editorFolder = editorFolder;
- prefill();
-}
-/**
- * Adds the initial part to a layout.
- */
-private void add(String newID) {
- try {
- // Create the part.
- LayoutPart newPart = createView(newID);
- setRefPart(newID, newPart);
-
- // Add it to the layout.
- rootLayoutContainer.add(newPart);
- } catch (PartInitException e) {
- WorkbenchPlugin.log(e.getMessage());
- }
-}
-/**
- * Adds an action set to the page.
- *
- * @param actionSetID Identifies the action set extension to use.
- * It must exist within the workbench registry.
- */
-public void addActionSet(String actionSetID) {
- if (!actionSets.contains(actionSetID)) {
- actionSets.add(actionSetID);
- }
-}
-/**
- * @see IPageLayout
- */
-public void addFastView(String id) {
- addFastView(id, INVALID_RATIO);
-}
-/**
- * @see IPageLayout
- */
-public void addFastView(String id, float ratio) {
- if (checkPartInLayout(id))
- return;
- if (id != null) {
- try {
- IViewReference ref = viewFactory.createView(id);
- IViewPart view = (IViewPart)ref.getPart(true);
- ViewSite site = (ViewSite)view.getSite();
- ViewPane pane = (ViewPane)site.getPane();
- IViewPart part = (IViewPart)pane.getViewReference().getPart(true);
- fastViews.add(part);
- if(ratio >= IPageLayout.RATIO_MIN && ratio <= IPageLayout.RATIO_MAX)
- mapFastViewToWidthRatio.put(id, new Float(ratio));
- } catch(PartInitException e) {
- WorkbenchPlugin.log(e.getMessage());
- }
- }
-}
-/**
- * Adds a creation wizard to the File New menu.
- * The id must name a new wizard extension contributed to the
- * workbench's extension point (named <code>"org.eclipse.ui.newWizards"</code>).
- *
- * @param id the wizard id
- */
-public void addNewWizardShortcut(String id) {
- if (!newWizardActionIds.contains(id)) {
- newWizardActionIds.add(id);
- }
-}
-/**
- * Add the layout part to the page's layout
- */
-private void addPart(LayoutPart newPart, String partId, int relationship, float ratio, String refId) {
- setRefPart(partId, newPart);
-
- // If the referenced part is inside a folder,
- // then use the folder as the reference part.
- LayoutPart refPart = getFolderPart(refId);
- if (refPart == null)
- refPart = getRefPart(refId);
-
- // Add it to the layout.
- if (refPart != null) {
- ratio = normalizeRatio(ratio);
- rootLayoutContainer.add(newPart, getPartSashConst(relationship), ratio, refPart);
- } else {
- WorkbenchPlugin.log(MISSING_REF_PART + refId);//$NON-NLS-1$
- rootLayoutContainer.add(newPart);
- }
-}
-/**
- * Adds a perspective shortcut to the Perspective menu.
- * The id must name a perspective extension contributed to the
- * workbench's extension point (named <code>"org.eclipse.ui.perspectives"</code>).
- *
- * @param id the perspective id
- */
-public void addPerspectiveShortcut(String id) {
- if (!perspectiveActionIds.contains(id)) {
- perspectiveActionIds.add(id);
- }
-}
-/**
- * @see IPageLayout
- */
-public void addPlaceholder(String viewId, int relationship, float ratio, String refId) {
- if (checkPartInLayout(viewId))
- return;
-
- // Create the placeholder.
- PartPlaceholder newPart = new PartPlaceholder(viewId);
- addPart(newPart, viewId, relationship, ratio, refId);
-}
-/**
- * Adds a view to the Show View menu.
- * The id must name a view extension contributed to the
- * workbench's extension point (named <code>"org.eclipse.ui.views"</code>).
- *
- * @param id the view id
- */
-public void addShowViewShortcut(String id) {
- if (!showViewActionIds.contains(id)) {
- showViewActionIds.add(id);
- }
-}
-/**
- * @see IPageLayout
- */
-public void addView(String viewId, int relationship, float ratio, String refId) {
- if (checkPartInLayout(viewId))
- return;
-
- try {
- // Create the part.
- LayoutPart newPart = createView(viewId);
- addPart(newPart, viewId, relationship, ratio, refId);
- } catch (PartInitException e) {
- WorkbenchPlugin.log(e.getMessage());
- }
-}
-/**
- * Verify that the part is already present in the layout
- * and cannot be added again. Log a warning message.
- */
-/*package*/ boolean checkPartInLayout(String partId) {
- if (getRefPart(partId) != null) {
- WorkbenchPlugin.log("Part already exists in page layout: " + partId);//$NON-NLS-1$
- return true;
- }
- for(int i = 0; i<fastViews.size(); i++) {
- if(((IViewPart)fastViews.get(i)).getSite().getId().equals(partId))
- return true;
- }
-
- return false;
-}
-
-/**
- * @see IPageLayout
- */
-public IFolderLayout createFolder(String folderId, int relationship, float ratio, String refId) {
- if (checkPartInLayout(folderId))
- return new FolderLayout(this, (PartTabFolder) getRefPart(folderId), viewFactory);
-
- // Create the folder.
- PartTabFolder folder = new PartTabFolder();
- folder.setID(folderId);
- addPart(folder, folderId, relationship, ratio, refId);
-
- // Create a wrapper.
- return new FolderLayout(this, folder, viewFactory);
-}
-/**
- * @see IPageLayout
- */
-public IPlaceholderFolderLayout createPlaceholderFolder(String folderId, int relationship, float ratio, String refId) {
- if (checkPartInLayout(folderId))
- return new PlaceholderFolderLayout(this, (ContainerPlaceholder) getRefPart(folderId));
-
- // Create the folder.
- ContainerPlaceholder folder = new ContainerPlaceholder(null);
- folder.setContainer(rootLayoutContainer);
- folder.setRealContainer(new PartTabFolder());
- folder.setID(folderId);
- addPart(folder, folderId, relationship, ratio, refId);
-
- // Create a wrapper.
- return new PlaceholderFolderLayout(this, folder);
-}
-
-/**
- * Create the given view.
- */
-private LayoutPart createView(String partID)
- throws PartInitException
-{
- if (partID.equals(ID_EDITOR_AREA)) {
- return editorFolder;
- } else {
- IViewReference ref = viewFactory.createView(partID);
- IViewPart view = (IViewPart)ref.getPart(true);
- if(view == null) {
- String message = WorkbenchMessages.format("Perspective.exceptionRestoringView",new String[]{ref.getId()}); //$NON-NLS-1$
- throw new PartInitException(message);
- }
- ViewSite site = (ViewSite)view.getSite();
- return site.getPane();
- }
-}
-/**
- * Returns the action set list for the page.
- * This is List of Strings.
- */
-public ArrayList getActionSets() {
- return actionSets;
-}
-/**
- * Returns an identifier for the editor area. The editor area is automatically added to each
- * layout before any other part. It should be used as a reference part for other views.
- */
-public String getEditorArea() {
- return ID_EDITOR_AREA;
-}
-/**
- * Returns the fast views.
- */
-public ArrayList getFastViews() {
- return fastViews;
-}
-/**
- * Returns a map of fast view ids to width ratios.
- */
-/*package*/ Map getFastViewToWidthRatioMap() {
- return mapFastViewToWidthRatio;
-}
-/**
- * Returns the new wizard actions the page.
- * This is List of Strings.
- */
-public ArrayList getNewWizardActionIds() {
- return newWizardActionIds;
-}
-/**
- * Answer the part sash container const for a layout value.
- */
-private int getPartSashConst(int nRelationship) {
- return nRelationship;
-}
-/**
- * Returns the perspective actions.
- * This is List of Strings.
- */
-public ArrayList getPerspectiveActionIds() {
- return perspectiveActionIds;
-}
-/**
- * Answer the part for a given ID.
- */
-/*package*/ LayoutPart getRefPart(String partID) {
- return (LayoutPart)mapIDtoPart.get(partID);
-}
-/**
- * Answer the folder part containing the given view ID
- * or <code>null</code> if none (i.e. part of the
- * page layout instead of a folder layout).
- */
-private PartTabFolder getFolderPart(String viewId) {
- return (PartTabFolder)mapIDtoFolder.get(viewId);
-}
-/**
- * Answer the top level layout container
- */
-public RootLayoutContainer getRootLayoutContainer() {
- return rootLayoutContainer;
-}
-/**
- * Returns the show view actions the page.
- * This is List of Strings.
- */
-public ArrayList getShowViewActionIds() {
- return showViewActionIds;
-}
-/**
- * Answer the label for a view.
- */
-private String getViewLabel(String partID) {
- IViewRegistry reg = WorkbenchPlugin.getDefault().getViewRegistry();
- IViewDescriptor desc = reg.find(partID);
- if (desc != null)
- return desc.getLabel();
- else {
- // cannot safely open the dialog so log the problem
- WorkbenchPlugin.log("Unable to find view label: " + partID);//$NON-NLS-1$
- return partID;
- }
-}
-/**
- * See IPageLayout.
- */
-public boolean isEditorAreaVisible() {
- return editorVisible;
-}
-/**
- * Trim the ratio so that direct manipulation of parts is easy.
- */
-private float normalizeRatio(float in) {
- if (in < RATIO_MIN)
- in = RATIO_MIN;
- if (in > RATIO_MAX)
- in = RATIO_MAX;
- return in;
-}
-/**
- * Prefill the layout with required parts.
- */
-private void prefill() {
- // Editors are king.
- add(ID_EDITOR_AREA);
-
- // Add default action sets.
- ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
- IActionSetDescriptor [] array = reg.getActionSets();
- int count = array.length;
- for (int nX = 0; nX < count; nX ++) {
- IActionSetDescriptor desc = array[nX];
- if (desc.isInitiallyVisible())
- addActionSet(desc.getId());
- }
-}
-/**
- * See IPageLayout.
- */
-public void setEditorAreaVisible(boolean showEditorArea) {
- editorVisible = showEditorArea;
-}
-/**
- * Map an ID to a part.
- */
-/*package*/ void setRefPart(String partID, LayoutPart part) {
- mapIDtoPart.put(partID, part);
-}
-/**
- * Map the folder part containing the given view ID.
- */
-/*package*/ void setFolderPart(String viewId, PartTabFolder folder) {
- mapIDtoFolder.put(viewId, folder);
-}
-/**
- * Map the folder part containing the given view ID.
- */
-/*package*/ void setFolderPart(String viewId, ContainerPlaceholder container) {
- LayoutPart tabFolder = container.getRealContainer();
- mapIDtoFolder.put(viewId, tabFolder);
-}
-// stackPart(Layoutpart, String, String) added by dan_rubel@instantiations.com
-/**
- * Stack a part on top of another.
- */
-private void stackPart(LayoutPart newPart, String viewId, String refId) {
- setRefPart(viewId, newPart);
-
- // If ref part is in a folder than just add the
- // new view to that folder.
- PartTabFolder folder = getFolderPart(refId);
- if (folder != null) {
- folder.add(newPart);
- setFolderPart(viewId, folder);
- return;
- }
-
- // If the ref part is in the page layout then create
- // a new folder and add the new view.
- LayoutPart refPart = getRefPart(refId);
- if (refPart != null) {
- PartTabFolder newFolder = new PartTabFolder();
- rootLayoutContainer.replace(refPart, newFolder);
- newFolder.add(refPart);
- newFolder.add(newPart);
- setFolderPart(refId, newFolder);
- setFolderPart(viewId, newFolder);
- return;
- }
-
- // If ref part is not found then just do add.
- WorkbenchPlugin.log(MISSING_REF_PART + refId);//$NON-NLS-1$
- rootLayoutContainer.add(newPart);
-}
-// stackPlaceholder(String, String) added by dan_rubel@instantiations.com
-/**
- * Stack a placeholder on top of another.
- */
-public void stackPlaceholder(String viewId, String refId) {
- if (checkPartInLayout(viewId))
- return;
-
- // Create the placeholder.
- PartPlaceholder newPart = new PartPlaceholder(viewId);
- stackPart(newPart, viewId, refId);
-}
-// stackView(String, String) modified by dan_rubel@instantiations.com
-/**
- * Stack one view on top of another.
- */
-public void stackView(String viewId, String refId) {
- if (checkPartInLayout(viewId))
- return;
-
- // Create the new part.
- try {
- LayoutPart newPart = createView(viewId);
- stackPart(newPart, viewId, refId);
- } catch (PartInitException e) {
- WorkbenchPlugin.log(e.getMessage());
- }
-}
-/**
- * @see IPageLayout
- */
-public int getEditorReuseThreshold() {
- return -1;
-}
-/**
- * @see IPageLayout
- */
-public void setEditorReuseThreshold(int openEditors) {
-}
-}
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
deleted file mode 100644
index 121c3a8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageListenerList.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.ui.IPageListener;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * Part listener list.
- */
-public class PageListenerList {
- private ListenerList listeners = new ListenerList();
-/**
- * PartNotifier constructor comment.
- */
-public PageListenerList() {
- super();
-}
-/**
- * Adds an IPartListener to the part service.
- */
-public void addPageListener(IPageListener l) {
- listeners.add(l);
-}
-/**
- * Notifies the listener that a part has been activated.
- */
-public void firePageActivated(final IWorkbenchPage page) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IPageListener l = (IPageListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.pageActivated(page);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePageListener(l);
- }
- });
- }
-}
-/**
- * Notifies the listener that a part has been closed
- */
-public void firePageClosed(final IWorkbenchPage page) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IPageListener l = (IPageListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.pageClosed(page);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePageListener(l);
- }
- });
- }
-}
-/**
- * Notifies the listener that a part has been opened.
- */
-public void firePageOpened(final IWorkbenchPage page) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IPageListener l = (IPageListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.pageOpened(page);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePageListener(l);
- }
- });
- }
-}
-/**
- * Removes an IPartListener from the part service.
- */
-public void removePageListener(IPageListener l) {
- listeners.remove(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
deleted file mode 100644
index 4cdff6a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PagePartSelectionTracker.java
+++ /dev/null
@@ -1,207 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Provides debug view selection management/notification for
- * a debug view in a specific workbench page. This selection
- * provider sheilds clients from a debug view openning and closing,
- * and still provides selection notification/information even
- * when the debug view is not the active part.
- */
-public class PagePartSelectionTracker extends AbstractPartSelectionTracker implements IPartListener, ISelectionChangedListener {
-
- /**
- * The workbench page for which this is tracking selection.
- */
- private IWorkbenchPage fPage;
-
- /**
- * The part in this tracker's page, or <code>null</code> if one is not open.
- */
- private IWorkbenchPart fPart;
-
- private ISelectionChangedListener selectionListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- fireSelection(getPart(), event.getSelection());
- }
- };
- private ISelectionChangedListener postSelectionListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- firePostSelection(getPart(), event.getSelection());
- }
- };
- public PagePartSelectionTracker(IWorkbenchPage page, String partId) {
- super(partId);
- setPage(page);
- page.addPartListener(this);
- IViewPart part = page.findView(partId);
- if (part != null) {
- setPart(part, false);
- }
- }
-
- /**
- * Disposes this selection provider - removes all listeners
- * currently registered.
- */
- public void dispose() {
- setPart(null, false);
- setPage(null);
- super.dispose();
- }
-
- /*
- * @see IPartListener#partActivated(IWorkbenchPart)
- */
- public void partActivated(IWorkbenchPart part) {
- }
-
- /*
- * @see IPartListener#partBroughtToTop(IWorkbenchPart)
- */
- public void partBroughtToTop(IWorkbenchPart part) {
- }
-
- /**
- * @see IPartListener#partClosed(IWorkbenchPart)
- */
- public void partClosed(IWorkbenchPart part) {
- if (part.getSite().getId().equals(getPartId())) {
- setPart(null, true);
- }
- }
-
- /*
- * @see IPartListener#partDeactivated(IWorkbenchPart)
- */
- public void partDeactivated(IWorkbenchPart part) {
- }
-
- /**
- * @see IPartListener#partOpened(IWorkbenchPart)
- */
- public void partOpened(IWorkbenchPart part) {
- if (part.getSite().getId().equals(getPartId())) {
- setPart(part, true);
- }
- }
- /**
- * The selection has changed in the part being tracked.
- * Forward it to the listeners.
- *
- * @see ISelectionChangedListener#selectionChanged
- */
- public void selectionChanged(SelectionChangedEvent event) {
- fireSelection(getPart(), event.getSelection());
- }
-
-
- /**
- * Sets the page this selection provider works for
- *
- * @param page workbench page
- */
- private void setPage(IWorkbenchPage page) {
- fPage = page;
- }
-
- /**
- * Returns the page this selection provider works for
- *
- * @return workbench page
- */
- protected IWorkbenchPage getPage() {
- return fPage;
- }
-
- /**
- * Returns the part this is tracking,
- * or <code>null</code> if it is not open
- *
- * @return part., or <code>null</code>
- */
- protected IWorkbenchPart getPart() {
- return fPart;
- }
-
- /*
- * @see AbstractPartSelectionTracker#getSelection()
- */
- public ISelection getSelection() {
- IWorkbenchPart part = getPart();
- if (part != null) {
- ISelectionProvider sp = part.getSite().getSelectionProvider();
- if (sp != null) {
- return sp.getSelection();
- }
- }
- return null;
- }
-
-
- /**
- * @see AbstractDebugSelectionProvider#getSelectionProvider()
- */
- protected ISelectionProvider getSelectionProvider() {
- IWorkbenchPart part = getPart();
- if (part != null) {
- return part.getSite().getSelectionProvider();
- }
- return null;
- }
-
- /**
- * Sets the part for this selection tracker.
- *
- * @param part the part
- * @param notify whether to send notification that the selection has changed.
- */
- private void setPart(IWorkbenchPart part, boolean notify) {
- if (fPart != null) {
- // remove myself as a listener from the existing part
- ISelectionProvider sp = fPart.getSite().getSelectionProvider();
- if (sp != null) {
- sp.removeSelectionChangedListener(selectionListener);
- if(sp instanceof StructuredViewer)
- ((StructuredViewer)sp).removePostSelectionChangedListener(postSelectionListener);
- else
- sp.removeSelectionChangedListener(postSelectionListener);
- }
- }
- fPart = part;
- ISelection sel = null;
- if (part != null) {
- ISelectionProvider sp = part.getSite().getSelectionProvider();
- if (sp != null) {
- sp.addSelectionChangedListener(selectionListener);
- if(sp instanceof StructuredViewer)
- ((StructuredViewer)sp).addPostSelectionChangedListener(postSelectionListener);
- else
- sp.addSelectionChangedListener(postSelectionListener);
- if (notify) {
- // get the selection to send below
- sel = sp.getSelection();
- }
- }
- }
- if (notify) {
- fireSelection(part, sel);
- firePostSelection(part, sel);
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageSelectionService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageSelectionService.java
deleted file mode 100644
index 821e796..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PageSelectionService.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * The selection service for a page.
- */
-/* package */
-class PageSelectionService extends AbstractSelectionService {
-
- private IWorkbenchPage page;
-
- /**
- * Creates a new selection service for a specific workbench page.
- */
- public PageSelectionService(IWorkbenchPage page) {
- setPage(page);
- }
-
- /**
- * Sets the page.
- */
- private void setPage(IWorkbenchPage page) {
- this.page = page;
- }
-
- /**
- * Returns the page.
- */
- protected IWorkbenchPage getPage() {
- return page;
- }
-
- /*
- * @see AbstractSelectionService#createPartTracker(String)
- */
- protected AbstractPartSelectionTracker createPartTracker(String partId) {
- return new PagePartSelectionTracker(getPage(), partId);
- }
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartDragDrop.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartDragDrop.java
deleted file mode 100644
index 3a3f233..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartDragDrop.java
+++ /dev/null
@@ -1,426 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import java.io.*;
-
-/**
- * Controls the drag and drop of an editor or view
- * layout part.
- *
- * @see IPartDropListener
- * @see IPartDropTarget
- * @see PartDropEvent
- * @see LayoutPart
- */
-public class PartDragDrop extends Object
- implements MouseMoveListener, MouseListener
-{
- // Define the relative position
- 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;
-
- // Move this many pixels before dragging starts
- private final static int HYSTERESIS= 10;
-
- // Define width of part's "hot" border
- private final static int MARGIN= 10;
-
- private final static Cursor cursors[]= new Cursor[7];
-
- // Drag source layout part
- private LayoutPart sourcePart;
- // Control which acts as the drag object (could be a titlebar, could be the entire VisualPart)
- private Control dragControl;
-
- private int xAnchor;
- private int yAnchor;
- private boolean mouseDown = false;
-
- private IPartDropListener[] dropListeners;
-/**
- * Constructs a new drag drop.
- */
-public PartDragDrop(LayoutPart dragPart, Control dragHandle) {
- sourcePart = dragPart;
- dragControl = dragHandle;
- dragControl.addMouseListener(this);
- dragControl.addMouseMoveListener(this);
-}
-/**
- * Adds the listener to receive events.
- * <p>
- *
- * @param listener the listener
- * @see PartDropListener
- */
-public void addDropListener(IPartDropListener listener) {
-
- if (listener == null) return;
-
- if (dropListeners == null) {
- dropListeners = new IPartDropListener[1];
- dropListeners[0] = listener;
- } else {
- IPartDropListener[] newDropListeners = new IPartDropListener[dropListeners.length + 1];
- System.arraycopy(dropListeners, 0, newDropListeners, 0, dropListeners.length);
- newDropListeners[dropListeners.length] = listener;
- dropListeners = newDropListeners;
- }
-}
-/**
- * Returns a drag event representing the current state of dragging.
- */
-private PartDropEvent createDropEvent(Tracker tracker) {
-
- Display display= dragControl.getDisplay();
- Control targetControl= display.getCursorControl();
-
- PartDropEvent event = new PartDropEvent();
-
- Rectangle rect= tracker.getRectangles()[0];
- event.x = rect.x;
- event.y = rect.y;
- event.dragSource = sourcePart;
-
- if (targetControl == null) {
- // cursor is outside of the shell
- event.relativePosition = OFFSCREEN;
- return event;
- }
-
- LayoutPart targetPart = getTargetPart(targetControl);
- if (targetPart == null) {
- event.relativePosition = INVALID;
- return event;
- }
-
- event.dropTarget = targetPart;
- Control c = targetPart.getControl();
- if (c == null) {
- event.relativePosition = INVALID;
- return event;
- }
-
- Point p = c.toControl(display.getCursorLocation());
- Point e = c.getSize();
-
- // first determine whether mouse position is in center of part
- int hmargin= Math.min(e.x/3, MARGIN);
- int vmargin= Math.min(e.y/3, MARGIN);
-
- Rectangle inner= new Rectangle(hmargin, vmargin, e.x-(hmargin*2), e.y-(vmargin*2));
- if (inner.contains(p)) {
- event.relativePosition = CENTER;
- } else {
- // normalize to center
- p.x-= e.x/2;
- p.y-= e.y/2;
-
- // now determine quadrant
- double a= Math.atan2(p.y*e.x, p.x*e.y) * (180/Math.PI);
-
- if (a >= -135 && a < -45)
- event.relativePosition = TOP;
- else if (a > -45 && a < 45)
- event.relativePosition = RIGHT;
- else if (a > 45 && a < 135)
- event.relativePosition = BOTTOM;
- else
- event.relativePosition = LEFT;
- }
- return event;
-}
-/**
- * Dispose of the drag drop.
- */
-public void dispose() {
- // Get rid of control.
- if (dragControl != null && !dragControl.isDisposed()){
- dragControl.removeMouseMoveListener(this);
- dragControl.removeMouseListener(this);
- }
- dragControl = null;
-
- // Get rid of cursors.
- for (int i = 0, length = cursors.length; i < length; i++){
- if (cursors[i] != null && !cursors[i].isDisposed())
- cursors[i].dispose();
- cursors[i] = null;
- }
-
- // Deref all else.
- dropListeners = null;
- sourcePart = null;
-}
-/**
- * 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.
- */
-private Cursor getCursor(Display display, int code) {
- if (cursors[code] == null) {
- ImageDescriptor source = null;
- ImageDescriptor mask = null;
- switch (code) {
- case LEFT:
- source = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_LEFT_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_LEFT_MASK);
- cursors[LEFT]= new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- case RIGHT:
- source = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_RIGHT_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_RIGHT_MASK);
- cursors[RIGHT]= new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- case TOP:
- source = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_TOP_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_TOP_MASK);
- cursors[TOP]= new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- case BOTTOM:
- source = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_BOTTOM_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_BOTTOM_MASK);
- cursors[BOTTOM]= new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- case CENTER:
- source = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_STACK_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_STACK_MASK);
- cursors[CENTER]= new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- case OFFSCREEN:
- source = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_OFFSCREEN_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_OFFSCREEN_MASK);
- cursors[OFFSCREEN]= new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- default:
- case INVALID:
- source = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_INVALID_SOURCE);
- mask = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DND_INVALID_MASK);
- cursors[INVALID]= new Cursor(display, source.getImageData(), mask.getImageData(), 16, 16);
- break;
- }
- }
- return cursors[code];
-}
-/**
- * Returns the drag handle.
- */
-protected Control getDragControl() {
- return dragControl;
-}
-/**
- * Returns the source's bounds
- */
-protected Rectangle getSourceBounds() {
- return sourcePart.getControl().getBounds();
-}
-/**
- * Returns the drag source part.
- */
-public LayoutPart getSourcePart() {
- return sourcePart;
-}
-/**
- * Returns the target part containing a particular control. If the
- * target part is not in the same window as the source part return null.
- */
-private LayoutPart getTargetPart(Control target) {
- while (target != null) {
- Object data= target.getData();
- if (data instanceof IPartDropTarget)
- return ((IPartDropTarget)data).targetPartFor(sourcePart);
- target = target.getParent();
- }
- return null;
-}
-/**
- * Returns whether the mouse has moved enough to warrant
- * opening a tracker.
- */
-protected boolean hasMovedEnough(MouseEvent e) {
- int dx= e.x - xAnchor;
- int dy= e.y - yAnchor;
- if (Math.abs(dx) < HYSTERESIS && Math.abs(dy) < HYSTERESIS)
- return false;
- else
- return true;
-}
-/**
- * @see MouseListener::mouseDoubleClick
- */
-public void mouseDoubleClick(MouseEvent e) {
- mouseDown = false;
-}
-/**
- * @see MouseListener::mouseDown
- */
-public void mouseDown(MouseEvent e) {
- // track left button only.
- if (e.button != 1)
- return;
- if (getSourceBounds().width == 0 || getSourceBounds().height == 0)
- return;
- if (!sourcePart.isDragAllowed(new Point(e.x,e.y)))
- return;
- // remember anchor position for hysteresis in mouseMove
- xAnchor = e.x;
- yAnchor = e.y;
-
- mouseDown = true;
-}
-/**
- * @see MouseMoveListener::mouseMove
- */
-public void mouseMove(MouseEvent e) {
-
- // If the mouse is not down or the mouse has moved only a small amount
- // ignore the move.
- // Bug 9004: If a previous MouseDown event caused a dialog to open,
- // the PartDragDrop will not be notified of the MouseUp event and the
- // mouseDown flag will not be reset. The fix is to check and make sure
- // that the mouse button is still pressed.
- // Can not use a focus listener since the dragControl may not actually
- // receive focus on a MouseDown.
- if (!mouseDown || (e.stateMask & SWT.BUTTON1) == 0)
- return;
- if (!hasMovedEnough(e))
- return;
-
- // If the source part is not in a state to allow drag & drop
- // operation to start, ignore the move
- if (!sourcePart.isDragAllowed(new Point(e.x,e.y)))
- return;
-
- openTracker();
-}
-/**
- * Open a tracker (a XOR rect on the screen) change
- * the cursor indicanting where the part will be dropped
- * and notify the drag listeners.
- */
-public void openTracker() {
- // Create a tracker. This is just an XOR rect on the screen.
- // As it moves we notify the drag listeners.
- final Display display= dragControl.getDisplay();
- final Tracker tracker= new Tracker(display, SWT.NULL);
- tracker.addListener(SWT.Move, new Listener() {
- public void handleEvent(Event event) {
- PartDropEvent dropEvent = createDropEvent(tracker);
- // 1GBXIEO: SWT:ALL - DCR: Include cursor pos in Tracker move event
- // Until support is provided, just get the current
- // location (which could be different than when the event occured
- // if the user moves the mouse quickly!)
- Point p = dragControl.toControl(display.getCursorLocation());
- dropEvent.cursorX = p.x;
- dropEvent.cursorY = p.y;
- if (dropListeners != null) {
- for(int i = 0, length = dropListeners.length; i < length; i++) {
- dropListeners[i].dragOver(dropEvent);
- }
- }
- Cursor cursor = getCursor(display, dropEvent.relativePosition);
- tracker.setCursor(cursor);
- }
- });
-
- // Create a drag rect.
- Control sourceControl = sourcePart.getControl();
- Rectangle sourceBounds = getSourceBounds();
- Point sourcePos = new Point(sourceBounds.x, sourceBounds.y);
- if (!(sourceControl instanceof Shell)) {
- sourcePos = sourceControl.getParent().toDisplay(sourcePos);
- }
- if(mouseDown) {
- Point anchorPos = dragControl.toDisplay(new Point(xAnchor, yAnchor));
- Point cursorPos = display.getCursorLocation();
- sourceBounds.x = sourcePos.x - (anchorPos.x - cursorPos.x);
- sourceBounds.y = sourcePos.y - (anchorPos.y - cursorPos.y);
- } else {
- sourceBounds.x = sourcePos.x + HYSTERESIS;
- sourceBounds.y = sourcePos.y + HYSTERESIS;
- }
-
- tracker.setRectangles(new Rectangle[] {sourceBounds});
-
- // Run tracker until mouse up occurs or escape key pressed.
- boolean trackingOk = tracker.open();
- mouseDown = false;
-
- // Generate drop event.
- PartDropEvent event = createDropEvent(tracker);
- // 1GBXIEO: SWT:ALL - DCR: Include cursor pos in Tracker move event
- // Until support is provided, just get the current
- // location (which could be different than when the event occured
- // if the user moves the mouse quickly!)
- Point p1 = dragControl.toControl(display.getCursorLocation());
- event.cursorX = p1.x;
- event.cursorY = p1.y;
- if (!dragControl.isDisposed())
- dragControl.setCursor(null);
- if (dropListeners != null) {
- if (trackingOk) {
- for(int i = 0, length = dropListeners.length; i < length; i++) {
- dropListeners[i].dragOver(event);
- }
- } else {
- event.relativePosition = INVALID;
- }
-
- for(int i = 0, length = dropListeners.length; i < length; i++) {
- dropListeners[i].drop(event);
- }
- }
-
- // Cleanup.
- tracker.dispose();
-}
-/**
- * @see MouseListener::mouseUp
- */
-public void mouseUp(MouseEvent e) {
- mouseDown = false;
-}
-/**
- * Removes the listener.
- * <p>
- *
- * @param listener the listener
- * @see PartDropListener
- */
-public void removeDropListener(IPartDropListener listener) {
- if (listener == null)
- return;
-
- int index = -1;
- for (int i = 0, length = dropListeners.length; i < length; i++){
- if (dropListeners[i].equals(listener)){
- index = i;
- break;
- }
- }
- if (index == -1) return;
-
- if (dropListeners.length == 1) {
- dropListeners = null;
- } else {
- IPartDropListener[] newListeners = new IPartDropListener[dropListeners.length - 1];
- System.arraycopy(dropListeners, 0, newListeners, 0, index);
- System.arraycopy(dropListeners, index+1, newListeners, index, newListeners.length - index);
- dropListeners = newListeners;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartDropEvent.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartDropEvent.java
deleted file mode 100644
index cd475e9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartDropEvent.java
+++ /dev/null
@@ -1,16 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-public class PartDropEvent {
-
- public int x;
- public int y;
- public int cursorX;
- public int cursorY;
- public int relativePosition;
- public LayoutPart dragSource;
- public LayoutPart dropTarget;
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartDropTarget.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartDropTarget.java
deleted file mode 100644
index a3fb318..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartDropTarget.java
+++ /dev/null
@@ -1,12 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-class PartDropTarget {
- LayoutPart part;
-PartDropTarget(LayoutPart part) {
- this.part = part;
-}
-}
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
deleted file mode 100644
index be41d53..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartListenerList.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Part listener list.
- */
-public class PartListenerList {
- private ListenerList listeners = new ListenerList();
-/**
- * PartNotifier constructor comment.
- */
-public PartListenerList() {
- super();
-}
-/**
- * Adds an IPartListener to the part service.
- */
-public void addPartListener(IPartListener l) {
- listeners.add(l);
-}
-/**
- * Notifies the listener that a part has been activated.
- */
-public void firePartActivated(final IWorkbenchPart part) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IPartListener l = (IPartListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.partActivated(part);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePartListener(l);
- }
- });
- }
-}
-/**
- * Notifies the listener that a part has been brought to top.
- */
-public void firePartBroughtToTop(final IWorkbenchPart part) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IPartListener l = (IPartListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.partBroughtToTop(part);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePartListener(l);
- }
- });
- }
-}
-/**
- * Notifies the listener that a part has been closed
- */
-public void firePartClosed(final IWorkbenchPart part) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IPartListener l = (IPartListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.partClosed(part);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePartListener(l);
- }
- });
- }
-}
-/**
- * Notifies the listener that a part has been deactivated.
- */
-public void firePartDeactivated(final IWorkbenchPart part) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IPartListener l = (IPartListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.partDeactivated(part);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePartListener(l);
- }
- });
- }
-}
-/**
- * Notifies the listener that a part has been opened.
- */
-public void firePartOpened(final IWorkbenchPart part) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IPartListener l = (IPartListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.partOpened(part);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePartListener(l);
- }
- });
- }
-}
-/**
- * Removes an IPartListener from the part service.
- */
-public void removePartListener(IPartListener l) {
- listeners.remove(l);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPane.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPane.java
deleted file mode 100644
index a7f3cbd..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPane.java
+++ /dev/null
@@ -1,483 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-**********************************************************************/
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.ViewForm;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.WorkbenchPart;
-
-
-/**
- * Provides the common behavior for both views
- * and editor panes.
- */
-public abstract class PartPane extends LayoutPart
- implements Listener
-{
- private boolean isZoomed = false;
- private MenuManager paneMenuManager;
- protected IWorkbenchPartReference partReference;
- protected WorkbenchPage page;
- protected ViewForm control;
-
- public static class Sashes {
- public Sash left;
- public Sash right;
- public Sash top;
- public Sash bottom;
- }
- private class PaneContribution extends ContributionItem {
- public boolean isDynamic() {
- return true;
- }
- public void fill(Menu menu, int index) {
- MenuItem item;
-
- // Get various view states.
- final boolean isFastView = (page.getActiveFastView() == partReference);
- final boolean isZoomed = page.isZoomed();
- boolean canZoom = (getWindow() instanceof IWorkbenchWindow);
-
- // add restore item
- item = new MenuItem(menu, SWT.NONE);
- item.setText(WorkbenchMessages.getString("PartPane.restore")); //$NON-NLS-1$
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (isZoomed)
- doZoom();
- }
- });
- item.setEnabled(isZoomed);
-
- //Add move menu
- item = new MenuItem(menu, SWT.CASCADE);
- item.setText(WorkbenchMessages.getString("PartPane.move")); //$NON-NLS-1$
- Menu moveMenu = new Menu(menu);
- item.setMenu(moveMenu);
- addMoveItems(moveMenu);
-
- //Add size menu
- item = new MenuItem(menu, SWT.CASCADE);
- item.setText(WorkbenchMessages.getString("PartPane.size")); //$NON-NLS-1$
- Menu sizeMenu = new Menu(menu);
- item.setMenu(sizeMenu);
- addSizeItems(sizeMenu);
-
- addFastViewMenuItem(menu,isFastView);
-
- // add maximize item
- item = new MenuItem(menu, SWT.NONE);
- item.setText(WorkbenchMessages.getString("PartPane.maximize")); //$NON-NLS-1$
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- doZoom();
- }
- });
- item.setEnabled(!isZoomed && canZoom);
-
- addPinEditorItem(menu);
-
- new MenuItem(menu, SWT.SEPARATOR);
-
- // add close item
- item = new MenuItem(menu, SWT.NONE);
- item.setText(WorkbenchMessages.getString("PartPane.close")); //$NON-NLS-1$
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- doHide();
- }
- });
- }
- }
-
-/**
- * Construct a pane for a part.
- */
-public PartPane(IWorkbenchPartReference partReference, WorkbenchPage workbenchPage) {
- super(partReference.getId());
- this.partReference = partReference;
- this.page = workbenchPage;
- ((WorkbenchPartReference)partReference).setPane(this);
-}
-/**
- * Factory method for creating the SWT Control hierarchy for this Pane's child.
- */
-protected void createChildControl() {
- final IWorkbenchPart part[] = new IWorkbenchPart[]{partReference.getPart(false)};
- if(part[0] == null)
- return;
-
- if(control == null || control.getContent() != null)
- return;
-
- final Composite content = new Composite(control, SWT.NONE);
- content.setLayout(new FillLayout());
-
- String error = WorkbenchMessages.format("PartPane.unableToCreate", new Object[] {partReference.getTitle()}); //$NON-NLS-1$
- Platform.run(new SafeRunnable(error) {
- public void run() {
- part[0].createPartControl(content);
- }
- public void handleException(Throwable e) {
- // Log error.
- Workbench wb = (Workbench)WorkbenchPlugin.getDefault().getWorkbench();
- if (!wb.isStarting())
- super.handleException(e);
-
- // Dispose old part.
- Control children[] = content.getChildren();
- for (int i = 0; i < children.length; i++){
- children[i].dispose();
- }
-
- // Create new part.
- IWorkbenchPart newPart = createErrorPart((WorkbenchPart)part[0]);
- part[0].getSite().setSelectionProvider(null);
- newPart.createPartControl(content);
- ((WorkbenchPartReference)partReference).setPart(newPart);
- part[0] = newPart;
- }
- });
- control.setContent(content);
- page.addPart(partReference);
- page.firePartOpened(part[0]);
-}
-/**
- *
- */
-public void createControl(Composite parent) {
- if (getControl() != null)
- return;
-
- // Create view form.
- control = new ViewForm(parent, getStyle());
- control.marginWidth = 0;
- control.marginHeight = 0;
-
- // Create a title bar.
- createTitleBar();
-
- // Create content.
- createChildControl();
-
- // When the pane or any child gains focus, notify the workbench.
- control.addListener(SWT.Activate, this);
-}
-
-protected abstract WorkbenchPart createErrorPart(WorkbenchPart oldPart);
-/**
- * Create a title bar for the pane if required.
- */
-protected abstract void createTitleBar();
-/**
- * @private
- */
-public void dispose() {
- super.dispose();
-
- if ((control != null) && (!control.isDisposed())) {
- control.removeListener(SWT.Activate, this);
- control.dispose();
- control = null;
- }
- if ((paneMenuManager != null)) {
- paneMenuManager.dispose();
- paneMenuManager = null;
- }
-}
-/**
- * User has requested to close the pane.
- * Take appropriate action depending on type.
- */
-abstract public void doHide();
-/**
- * Zooms in on the part contained in this pane.
- */
-protected void doZoom() {
- if (getWindow() instanceof IWorkbenchWindow)
- page.toggleZoom(partReference.getPart(true));
-}
-/**
- * Gets the presentation bounds.
- */
-public Rectangle getBounds() {
- return getControl().getBounds();
-}
-/**
- * Get the control.
- */
-public Control getControl() {
- return control;
-}
-
-/*
- * @see LayoutPart#getMinimumHeight()
- */
-public int getMinimumHeight() {
- if (control == null || control.isDisposed())
- return super.getMinimumHeight();
-
- // don't assume every future part will have top controls
- boolean top = false;
-
- /* compute title bar height; this should be done by computeTrim
- * to correctly handle seperate top center.
- */
- int leftHeight = 0;
- if (control.getTopLeft() != null && !control.getTopLeft().isDisposed()) {
- leftHeight = control.getTopLeft().computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
- top = true;
- }
- int centerHeight = 0;
- if (control.getTopCenter() != null && !control.getTopCenter().isDisposed()) {
- centerHeight = control.getTopCenter().computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
- top=true;
- }
- int rightHeight = 0;
- if (control.getTopRight() != null && !control.getTopRight().isDisposed()) {
- rightHeight = control.getTopRight().computeSize(SWT.DEFAULT, SWT.DEFAULT).y;
- top = true;
- }
-
- int topHeight = Math.max(leftHeight, Math.max(centerHeight, rightHeight));
-
- // account for the borders
- topHeight = control.computeTrim(0, 0, 0, topHeight).height;
-
- /* add +1 for highlight line. ViewForm adds this *inside* client area
- * even though it's arguably an inset; see ViewForm.layout for details.
- */
- if (top) {
- topHeight += 1;
- }
-
- return topHeight;
-}
-
-/**
- * Returns the top level SWT Canvas of this Pane.
- */
-protected ViewForm getPane() {
- return control;
-}
-/**
- * Answer the part child.
- */
-public IWorkbenchPartReference getPartReference() {
- return partReference;
-}
-/**
- * Answer the SWT widget style.
- */
-int getStyle() {
- if (getContainer() != null && !getContainer().allowsBorder())
- return SWT.NONE;
- else
- return SWT.BORDER;
-}
-/**
- * Get the view form.
- */
-protected ViewForm getViewForm() {
- return control;
-}
-/**
- * @see Listener
- */
-public void handleEvent(Event event) {
- if (event.type == SWT.Activate)
- requestActivation();
-}
-/**
- * Returns true if this part is visible. A part is visible if it has a control.
- */
-public boolean isVisible() {
- return (getControl() != null);
-}
-/**
- * Return whether the pane is zoomed or not
- */
-public boolean isZoomed() {
- return isZoomed;
-}
-/**
- * Move the control over another one.
- */
-public void moveAbove(Control refControl) {
- if (getControl() != null)
- getControl().moveAbove(refControl);
-}
-/**
- * Notify the workbook page that the part pane has
- * been activated by the user.
- */
-protected void requestActivation() {
- this.page.requestActivation(partReference.getPart(true));
-}
-/**
- * Sets the parent for this part.
- */
-public void setContainer(ILayoutContainer container) {
- super.setContainer(container);
- if (control != null) {
- if (container != null && !container.allowsBorder())
- control.setBorderVisible(false);
- else
- control.setBorderVisible(true);
- }
-}
-/**
- * Sets focus to this part.
- */
-public void setFocus() {
- requestActivation();
- IWorkbenchPart part = partReference.getPart(true);
- if (part != null) {
- part.setFocus();
- }
-}
-/**
- * Sets the workbench page of the view.
- */
-public void setWorkbenchPage(WorkbenchPage workbenchPage) {
- this.page = workbenchPage;
-}
-/**
- * Set whether the pane is zoomed or not
- */
-public void setZoomed(boolean isZoomed) {
- this.isZoomed = isZoomed;
-}
-/**
- * Informs the pane that it's window shell has
- * been activated.
- */
-/* package */ abstract void shellActivated();
-/**
- * Informs the pane that it's window shell has
- * been deactivated.
- */
-/* package */ abstract void shellDeactivated();
-/**
- * Indicate focus in part.
- */
-public abstract void showFocus(boolean inFocus);
-/**
- * @see IPartDropTarget::targetPartFor
- */
-public LayoutPart targetPartFor(LayoutPart dragSource) {
- return this;
-}
-
-/**
- * Show a title label menu for this pane.
- */
-public abstract void showPaneMenu();
-/**
- * Show the context menu for this part.
- */
-public abstract void showViewMenu();
-/**
- * Show a title label menu for this pane.
- */
-final protected void showPaneMenu(Control parent, Point point) {
- if(paneMenuManager == null) {
- paneMenuManager = new MenuManager();
- paneMenuManager.add(new PaneContribution());
- }
- Menu aMenu = paneMenuManager.createContextMenu(parent);
- // open menu
- point = parent.toDisplay(point);
- aMenu.setLocation(point.x, point.y);
- aMenu.setVisible(true);
-}
-/**
- * Return the sashes around this part.
- */
-protected abstract Sashes findSashes();
-/**
- * Enable the user to resize this part using
- * the keyboard to move the specified sash
- */
-protected void moveSash(final Sash sash) {
- final KeyListener listener = new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- if (e.character == SWT.ESC || e.character == '\r') {
- partReference.getPart(true).setFocus();
- }
- }
- };
- sash.addFocusListener(new FocusAdapter() {
- public void focusGained(FocusEvent e) {
- sash.setBackground(sash.getDisplay().getSystemColor(SWT.COLOR_LIST_SELECTION));
- sash.addKeyListener(listener);
- }
- public void focusLost(FocusEvent e) {
- sash.setBackground(null);
- sash.removeKeyListener(listener);
- }
- });
- sash.setFocus();
-}
-/**
- * Add a menu item to the Size Menu
- */
-protected void addSizeItem(Menu sizeMenu, String labelKey,final Sash sash) {
- MenuItem item = new MenuItem(sizeMenu, SWT.NONE);
- item.setText(WorkbenchMessages.getString(labelKey)); //$NON-NLS-1$
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- moveSash(sash);
- }
- });
- item.setEnabled(!isZoomed() && sash != null);
-}
-/**
- * Returns the workbench page of this pane.
- */
-public WorkbenchPage getPage() {
- return page;
-}
-/**
- * Add the Left,Right,Up,Botton menu items to the Size menu.
- */
-protected void addSizeItems(Menu sizeMenu) {
- Sashes sashes = findSashes();
- addSizeItem(sizeMenu,"PartPane.sizeLeft",sashes.left); //$NON-NLS-1$
- addSizeItem(sizeMenu,"PartPane.sizeRight",sashes.right); //$NON-NLS-1$
- addSizeItem(sizeMenu,"PartPane.sizeTop",sashes.top); //$NON-NLS-1$
- addSizeItem(sizeMenu,"PartPane.sizeBottom",sashes.bottom); //$NON-NLS-1$
-}
-/**
- * Add the pin menu item on the editor system menu
- */
-protected void addPinEditorItem(Menu parent) {}
-/**
- * Add the move items to the Move menu.
- */
-protected void addMoveItems(Menu parent) {}
-/**
- * Add the Fast View menu item to the part title menu.
- */
-protected void addFastViewMenuItem(Menu parent,boolean isFastView) {}
-/**
- * Pin this part.
- */
-protected void doDock() {}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPlaceholder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPlaceholder.java
deleted file mode 100644
index 48afbd6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPlaceholder.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A PlaceHolder is a non-visible stand-in for a IVisualPart.
- */
-public class PartPlaceholder extends LayoutPart {
- public PartPlaceholder(String id) {
- super(id);
- }
-/**
- * Creates the SWT control
- */
-public void createControl(Composite parent) {
-}
-/**
- * Get the part control. This method may return null.
- */
-public Control getControl() {
- return null;
-}
-/**
- * Returns true if this part is visible.
- */
-public boolean isVisible() {
- return false;
-}
-}
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
deleted file mode 100644
index 4350101..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartPluginAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.*;
-import org.eclipse.jface.viewers.*;
-
-/**
- * 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 runAttribute,String definitionId) {
- super(actionElement, runAttribute,definitionId);
-}
-/**
- * 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) {
- ISelectionProvider selectionProvider = aPart.getSite().getSelectionProvider();
- if (selectionProvider != null) {
- selectionProvider.removeSelectionChangedListener(this);
- }
-}
-/**
- * Refresh the selection.
- */
-protected void refreshSelection(IWorkbenchPart aPart) {
- ISelectionProvider selectionProvider = aPart.getSite().getSelectionProvider();
- if (selectionProvider != null)
- selectionChanged(selectionProvider.getSelection());
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSashContainer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSashContainer.java
deleted file mode 100644
index ce362e0..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSashContainer.java
+++ /dev/null
@@ -1,474 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Cagatay Kavukcuoglu <cagatayk@acm.org>
- - Fix for bug 10025 - Resizing views should not use height ratios
-**********************************************************************/
-
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.*;
-import java.util.*;
-import org.eclipse.ui.*;
-
-/**
- * Abstract container that groups various layout
- * parts (possibly other containers) together as
- * a unit. Manages the placement and size of these
- * layout part based on the location of sashes within
- * the container.
- */
-public abstract class PartSashContainer extends LayoutPart implements ILayoutContainer {
-
- protected Composite parent;
- protected ControlListener resizeListener;
- protected Listener mouseDownListener;
- protected LayoutTree root;
- protected LayoutTree unzoomRoot;
- boolean active = false;
-
- /* Array of LayoutPart */
- protected ArrayList children = new ArrayList();
-
- protected static class RelationshipInfo {
- protected LayoutPart part;
- protected LayoutPart relative;
- protected int relationship;
- protected float ratio;
- }
-public PartSashContainer(String id) {
- super(id);
- resizeListener = new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- resizeSashes(parent.getClientArea());
- }
- };
-}
-/**
- * Find the sashs around the specified part.
- */
-public void findSashes(LayoutPart pane,PartPane.Sashes sashes) {
- LayoutTree part = root.find(pane);
- if(part == null)
- return;
- part.findSashes(sashes);
-}
-/**
- * Add a part.
- */
-public void add(LayoutPart child) {
- if (isZoomed())
- zoomOut();
-
- if (child == null)
- return;
-
- RelationshipInfo info = new RelationshipInfo();
- info.part = child;
- if(root != null) {
- findPosition(info);
- }
- addChild(info);
-}
-/**
- * Add on part relative to another
- */
-public void add(LayoutPart child, int relationship, float ratio, LayoutPart relative) {
- if (isZoomed())
- zoomOut();
-
- if (child == null)
- return;
- if (relative != null && !isChild(relative))
- return;
- if (relationship < IPageLayout.LEFT || relationship > IPageLayout.BOTTOM)
- relationship = IPageLayout.LEFT;
-
- // store info about relative positions
- RelationshipInfo info = new RelationshipInfo();
- info.part = child;
- info.relationship = relationship;
- info.ratio = ratio;
- info.relative = relative;
- addChild(info);
-}
-private void addChild(RelationshipInfo info) {
- LayoutPart child = info.part;
- children.add(child);
-
- if(root == null) {
- root = new LayoutTree(child);
- } else {
- //Add the part to the tree.
- int vertical = (info.relationship == IPageLayout.LEFT || info.relationship == IPageLayout.RIGHT)?SWT.VERTICAL:SWT.HORIZONTAL;
- boolean left = info.relationship == IPageLayout.LEFT || info.relationship == IPageLayout.TOP;
- LayoutPartSash sash = new LayoutPartSash(this,vertical);
- sash.setRatio(info.ratio);
- if((parent != null) && !(child instanceof PartPlaceholder))
- sash.createControl(parent);
- root = root.insert(child,left,sash,info.relative);
- }
-
- childAdded(child);
-
- if (active) {
- child.createControl(parent);
- child.setContainer(this);
- resizeSashes(parent.getClientArea());
- }
-
-}
-/**
- * See ILayoutContainer#allowBorder
- */
-public boolean allowsBorder() {
- return true;
-}
-/**
- * Notification that a child layout part has been
- * added to the container. Subclasses may override
- * this method to perform any container specific
- * work.
- */
-protected abstract void childAdded(LayoutPart child);
-/**
- * Notification that a child layout part has been
- * removed from the container. Subclasses may override
- * this method to perform any container specific
- * work.
- */
-protected abstract void childRemoved(LayoutPart child);
-/**
- * Returns an array with all the relation ship between the
- * parts.
- */
-public RelationshipInfo[] computeRelation() {
- LayoutTree treeRoot = root;
- if(isZoomed())
- treeRoot = unzoomRoot;
- ArrayList list = new ArrayList();
- if(treeRoot == null)
- return new RelationshipInfo[0];
- RelationshipInfo r = new RelationshipInfo();
- r.part = treeRoot.computeRelation(list);
- list.add(0,r);
- RelationshipInfo[] result = new RelationshipInfo[list.size()];
- list.toArray(result);
- return result;
-}
-/**
- * @see LayoutPart#getControl
- */
-public void createControl(Composite parentWidget) {
- if (active)
- return;
-
- parent = createParent(parentWidget);
- parent.addControlListener(resizeListener);
-
- for (int i = 0, length = children.size(); i < length; i++) {
- LayoutPart child = (LayoutPart)children.get(i);
- child.setContainer(this);
- child.createControl(parent);
- }
-
- root.updateSashes(parent);
- active = true;
- resizeSashes(parent.getClientArea());
-}
-/**
- * Subclasses override this method to specify
- * the composite to use to parent all children
- * layout parts it contains.
- */
-protected abstract Composite createParent(Composite parentWidget);
-/**
- * @see LayoutPart#dispose
- */
-public void dispose() {
- if (!active)
- return;
-
- // remove all Listeners
- if (resizeListener != null && parent != null){
- parent.removeControlListener(resizeListener);
- }
-
- resizeSashes(new Rectangle(-200, -200, 0, 0));
-
- if (children != null) {
- for (int i = 0, length = children.size(); i < length; i++){
- LayoutPart child = (LayoutPart)children.get(i);
- child.setContainer(null);
- // In PartSashContainer dispose really means deactivate, so we
- // only dispose PartTabFolders.
- if (child instanceof PartTabFolder)
- child.dispose();
- }
- }
-
- disposeParent();
- this.parent = null;
-
- active = false;
-}
-/**
- * Subclasses override this method to dispose
- * of any swt resources created during createParent.
- */
-protected abstract void disposeParent();
-/**
- * Dispose all sashs used in this perspective.
- */
-public void disposeSashes() {
- root.disposeSashes();
-}
-/**
- * Return the most bottom right part or null if none.
- */
-public LayoutPart findBottomRight() {
- if(root == null)
- return null;
- return root.findBottomRight();
-}
-/**
- * Find a initial position for a new part.
- */
-private void findPosition(RelationshipInfo info) {
-
- info.ratio = (float)0.5;
- info.relationship = IPageLayout.RIGHT;
- info.relative = root.findBottomRight();
-
- // If no parent go with default.
- if (parent == null)
- return;
-
- // If the relative part is too small, place the part on the left of everything.
- if (((float)this.getBounds().width / (float)info.relative.getBounds().width > 2) ||
- ((float)this.getBounds().height / (float)info.relative.getBounds().height > 4)) {
- info.relative = null;
- info.ratio = 0.75f;
- }
-}
-/**
- * @see LayoutPart#getBounds
- */
-public Rectangle getBounds() {
- return this.parent.getBounds();
-}
-
-
-// getMinimumHeight() added by cagatayk@acm.org
-/**
- * @see LayoutPart#getMinimumHeight()
- */
-public int getMinimumHeight() {
- return getLayoutTree().getMinimumHeight();
-}
-
-// getMinimumHeight() added by cagatayk@acm.org
-/**
- * @see LayoutPart#getMinimumWidth()
- */
-public int getMinimumWidth() {
- return getLayoutTree().getMinimumWidth();
-}
-
-
-/**
- * @see ILayoutContainer#getChildren
- */
-public LayoutPart[] getChildren() {
- LayoutPart[] result = new LayoutPart[children.size()];
- children.toArray(result);
- return result;
-}
-
-/**
- * @see LayoutPart#getControl
- */
-public Control getControl() {
- return this.parent;
-}
-
-public LayoutTree getLayoutTree() {
- return root;
-}
-/**
- * Return the interested listener of mouse down events.
- */
-protected Listener getMouseDownListener() {
- return mouseDownListener;
-}
-/**
- * Returns the composite used to parent all the
- * layout parts contained within.
- */
-public Composite getParent() {
- return parent;
-}
-private boolean isChild(LayoutPart part) {
- return children.indexOf(part) >= 0;
-}
-private boolean isRelationshipCompatible(int relationship,boolean isVertical) {
- if(isVertical)
- return (relationship == IPageLayout.RIGHT || relationship == IPageLayout.LEFT);
- else
- return (relationship == IPageLayout.TOP || relationship == IPageLayout.BOTTOM);
-}
-/**
- * @see LayoutPart#isVisible
- */
-public boolean isVisible() {
- return (this.parent != null);
-}
-/**
- * Returns whether this container is zoomed.
- */
-public boolean isZoomed() {
- return (unzoomRoot != null);
-}
-/**
- * Move a part to a new position and keep the bounds when possible, ie,
- * when the new relative part has the same higth or width as the part
- * being move.
- */
-public void move(LayoutPart child, int relationship, LayoutPart relative) {
- LayoutTree childTree = root.find(child);
- LayoutTree relativeTree = root.find(relative);
-
- LayoutTreeNode commonParent = relativeTree.getParent().findCommonParent(child,relative);
- boolean isVertical = commonParent.getSash().isVertical();
- boolean recomputeRatio = false;
- recomputeRatio =
- isRelationshipCompatible(relationship,isVertical) &&
- commonParent.sameDirection(isVertical,relativeTree.getParent()) &&
- commonParent.sameDirection(isVertical,childTree.getParent());
-
- root = root.remove(child);
- int vertical = (relationship == IPageLayout.LEFT || relationship == IPageLayout.RIGHT)?SWT.VERTICAL:SWT.HORIZONTAL;
- boolean left = relationship == IPageLayout.LEFT || relationship == IPageLayout.TOP;
- LayoutPartSash sash = new LayoutPartSash(this,vertical);
- sash.setRatio(0.5f);
- if((parent != null) && !(child instanceof PartPlaceholder))
- sash.createControl(parent);
- root = root.insert(child,left,sash,relative);
- root.updateSashes(parent);
- if(recomputeRatio)
- root.recomputeRatio();
-
- resizeSashes(parent.getClientArea());
-}
-/**
- * Remove a part.
- */
-public void remove(LayoutPart child) {
- if (isZoomed())
- zoomOut();
-
- if (!isChild(child))
- return;
-
- children.remove(child);
- root = root.remove(child);
- if(root != null)
- root.updateSashes(parent);
- childRemoved(child);
-
- if (active){
- child.setBounds(0, 0, 0, 0);
- child.setContainer(null);
- resizeSashes(parent.getClientArea());
- }
-}
-/**
- * Replace one part with another.
- */
-public void replace(LayoutPart oldChild, LayoutPart newChild) {
- if (isZoomed())
- zoomOut();
-
- if (!isChild(oldChild))return;
-
- children.remove(oldChild);
- children.add(newChild);
-
- childAdded(newChild);
- LayoutTree leaf = root.find(oldChild);
- leaf.setPart(newChild);
- root.updateSashes(parent);
-
- childRemoved(oldChild);
- if (active){
- oldChild.setBounds(0, 0, 0, 0);
- oldChild.setContainer(null);
- newChild.createControl(parent);
- newChild.setContainer(this);
- resizeSashes(parent.getClientArea());
- }
-}
-private void resizeSashes(Rectangle parentSize) {
- if (!active) return;
- root.setBounds(parentSize);
-}
-/**
- * @see LayoutPart#setBounds
- */
-public void setBounds(Rectangle r) {
- this.parent.setBounds(r);
-}
-/**
- * Zoom in on a particular layout part.
- *
- * The implementation of zoom is quite simple. When zoom occurs we create
- * a zoom root which only contains the zoom part. We store the old
- * root in unzoomRoot and then active the zoom root. When unzoom occurs
- * we restore the unzoomRoot and dispose the zoom root.
- *
- * Note: Method assumes we are active.
- */
-public void zoomIn(LayoutPart part) {
- // Sanity check.
- if (unzoomRoot != null)
- return;
-
- // Hide main root.
- Rectangle oldBounds = root.getBounds();
- root.setBounds(new Rectangle(0,0,0,0));
- unzoomRoot = root;
-
- // Show zoom root.
- root = new LayoutTree(part);
- root.setBounds(oldBounds);
-}
-/**
- * Zoom out.
- *
- * See zoomIn for implementation details.
- *
- * Note: Method assumes we are active.
- */
-public void zoomOut() {
- // Sanity check.
- if (unzoomRoot == null)
- return;
-
- // Dispose zoom root.
- Rectangle oldBounds = root.getBounds();
- root.setBounds(new Rectangle(0,0,0,0));
-
- // Show main root.
- root = unzoomRoot;
- root.setBounds(oldBounds);
- unzoomRoot = null;
-}
-}
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
deleted file mode 100644
index 7ce4297..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartSite.java
+++ /dev/null
@@ -1,218 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.*;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jface.action.*;
-import java.util.*;
-import java.util.List;
-/**
- * <code>PartSite</code> is the general implementation for an
- * <code>IWorkbenchPartSite</code>. A site maintains the context for a part,
- * including the part, its pane, active contributions, selection provider, etc.
- * Together, these components make up the complete behavior for a
- * part as if it was implemented by one person.
- *
- * 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>
- * </ol>
- */
-public class PartSite implements IWorkbenchPartSite {
- private IWorkbenchPart part;
- private IWorkbenchPage page;
- private PartPane pane;
- private IConfigurationElement configElement;
- private String extensionID;
- private String pluginID;
- private String extensionName;
- private ISelectionProvider selectionProvider;
- private SubActionBars actionBars;
- private KeyBindingService keyBindingService;
-/**
- * EditorContainer constructor comment.
- */
-public PartSite(IWorkbenchPart part, IWorkbenchPage page)
-{
- this.part = part;
- this.page = page;
- extensionID = "org.eclipse.ui.UnknownID";//$NON-NLS-1$
- extensionName = "Unknown Name";//$NON-NLS-1$
-}
-/**
- * Dispose the contributions.
- */
-public void dispose() {
- if (keyBindingService != null) {
- keyBindingService.dispose();
- }
-}
-/**
- * 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.
- */
-public IActionBars getActionBars() {
- return actionBars;
-}
-/**
- * Returns the configuration element for a part.
- */
-public IConfigurationElement getConfigurationElement() {
- return configElement;
-}
-
-
-/**
- * Returns the part registry extension ID.
- *
- * @return the registry extension ID
- */
-public String getId() {
- return extensionID;
-}
-/**
- * Returns the page containing this workbench site's part.
- *
- * @return the page containing this part
- */
-public IWorkbenchPage getPage() {
- return page;
-}
-/**
- * Gets the part pane.
- */
-public PartPane getPane() {
- return pane;
-}
-/**
- * Returns the part.
- */
-public IWorkbenchPart getPart() {
- return part;
-}
-/**
- * Returns the part registry plugin ID. It cannot be <code>null</code>.
- *
- * @return the registry plugin ID
- */
-public String getPluginId() {
- return pluginID;
-}
-/**
- * Returns the registered name for this part.
- */
-public String getRegisteredName() {
- return extensionName;
-}
-/**
- * Returns the selection provider for a part.
- */
-public ISelectionProvider getSelectionProvider() {
- return selectionProvider;
-}
-/**
- * Returns the shell containing this part.
- *
- * @return the shell containing this part
- */
-public Shell getShell() {
- return page.getWorkbenchWindow().getShell();
-}
-/**
- * Returns the workbench window containing this part.
- *
- * @return the workbench window containing this part
- */
-public IWorkbenchWindow getWorkbenchWindow() {
- return page.getWorkbenchWindow();
-}
-/**
- * Register a popup menu for extension.
- */
-public void registerContextMenu(String menuID, MenuManager menuMgr, ISelectionProvider selProvider) {
- new PopupMenuExtender(menuID, menuMgr, selProvider, part);
-}
-/**
- * Register a popup menu with the default id for extension.
- */
-public void registerContextMenu(MenuManager menuMgr, ISelectionProvider selProvider) {
- registerContextMenu(getId(), menuMgr, selProvider);
-}
-/**
- * Sets the action bars for the part.
- */
-public void setActionBars(SubActionBars bars) {
- actionBars = bars;
-}
-/**
- * Sets the configuration element for a part.
- */
-public void setConfigurationElement(IConfigurationElement configElement) {
- // Save for external use.
- this.configElement = configElement;
-
- // Get extension ID.
- extensionID = configElement.getAttribute("id");//$NON-NLS-1$
-
- // Get plugin ID.
- IPluginDescriptor pd = configElement.getDeclaringExtension().getDeclaringPluginDescriptor();
- pluginID = pd.getUniqueIdentifier();
-
- // Get extension name.
- String name = configElement.getAttribute("name");//$NON-NLS-1$
- if (name != null)
- extensionName = name;
-}
-/**
- * Sets the part pane.
- */
-public void setPane(PartPane pane) {
- this.pane = pane;
-}
-/**
- * Sets the part.
- */
-public void setPart(IWorkbenchPart newPart) {
- part = newPart;
-}
-/**
- * Set the selection provider for a part.
- */
-public void setSelectionProvider(ISelectionProvider provider) {
- selectionProvider = provider;
-}
-
-/* (non-Javadoc)
- * Method declared on IEditorSite.
- */
-public IKeyBindingService getKeyBindingService() {
- if(keyBindingService == null) {
- keyBindingService = new KeyBindingService(((WorkbenchWindow)getWorkbenchWindow()).getKeyBindingService(),this);
- keyBindingService.setActiveAcceleratorScopeId(getInitialScopeId()); //$NON-NLS-1$
- }
- return keyBindingService;
-}
-protected String getInitialScopeId() {
- return "org.eclipse.ui.globalScope";
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartTabFolder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartTabFolder.java
deleted file mode 100644
index b46738a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PartTabFolder.java
+++ /dev/null
@@ -1,869 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Cagatay Kavukcuoglu <cagatayk@acm.org>
- - Fix for bug 10025 - Resizing views should not use height ratios
-**********************************************************************/
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.registry.IViewDescriptor;
-import org.eclipse.ui.internal.registry.IViewRegistry;
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.window.Window;
-import java.util.*;
-
-public class PartTabFolder extends LayoutPart
- implements ILayoutContainer
-{
- private static int tabLocation = -1; // Initialized in constructor.
-
- private CTabFolder tabFolder;
- private Map mapTabToPart = new HashMap();
- private LayoutPart current;
- private Map mapPartToDragMonitor = new HashMap();
- private boolean assignFocusOnSelection = true;
-
- // inactiveCurrent is only used when restoring the persisted state of
- // perspective on startup.
- private LayoutPart inactiveCurrent;
- private Composite parent;
- private boolean active = false;
-
- // listen for mouse down on tab to set focus.
- private MouseListener mouseListener = new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- // PR#1GDEZ25 - If selection will change in mouse up ignore mouse down.
- // Else, set focus.
- CTabItem newItem = tabFolder.getItem(new Point(e.x, e.y));
- if (newItem != null) {
- CTabItem oldItem = tabFolder.getSelection();
- if (newItem != oldItem)
- return;
- }
- if (PartTabFolder.this.current != null)
- PartTabFolder.this.current.setFocus();
- }
- };
-
- private class TabInfo {
- private String tabText;
- private LayoutPart part;
- }
- TabInfo[] invisibleChildren;
-/**
- * PartTabFolder constructor comment.
- */
-public PartTabFolder() {
- super("PartTabFolder");//$NON-NLS-1$
- setID(this.toString()); // Each folder has a unique ID so relative positioning is unambiguous.
-
- // Get the location of the tabs from the preferences
- if (tabLocation == -1)
- tabLocation = getPreferenceStore().getInt(
- IPreferenceConstants.VIEW_TAB_POSITION);
-
-}
-/**
- * Add a part at an index.
- */
-public void add(String name, int index, LayoutPart part)
-{
- if (active && !(part instanceof PartPlaceholder)) {
- CTabItem tab = createPartTab(part, name, index);
- index = tabFolder.indexOf(tab);
- setSelection(index);
- }
- else {
- TabInfo info = new TabInfo();
- info.tabText = name;
- info.part = part;
- invisibleChildren = arrayAdd(invisibleChildren, info, index);
- if (active)
- part.setContainer(this);
- }
-}
-/**
- * See IVisualContainer#add
- */
-public void add(LayoutPart child) {
- int index = getItemCount();
- String label = "";//$NON-NLS-1$
- if (child instanceof PartPane) {
- WorkbenchPartReference ref = (WorkbenchPartReference)((PartPane)child).getPartReference();
- label = ref.getRegisteredName();
- }
- add(label, index, child);
-}
-/**
- * See ILayoutContainer::allowBorder
- *
- * There is already a border around the tab
- * folder so no need for one from the parts.
- */
-public boolean allowsBorder() {
- return mapTabToPart.size() <= 1;
-}
-private TabInfo[] arrayAdd(TabInfo[] array, TabInfo item, int index) {
-
- if (item == null) return array;
-
- TabInfo[] result = null;
-
- if (array == null) {
- result = new TabInfo[1];
- result[0] = item;
- } else {
- if (index >= array.length) index = array.length;
- result = new TabInfo[array.length + 1];
- System.arraycopy(array, 0, result, 0, index);
- result[index] = item;
- System.arraycopy(array, index, result, index + 1, array.length - index);
- }
-
- return result;
-}
-private TabInfo[] arrayRemove(TabInfo[] array, LayoutPart item) {
-
- if (item == null) return array;
-
- TabInfo[] result = null;
-
- int index = -1;
- for (int i = 0, length = array.length; i < length; i++){
- if (item == array[i].part){
- index = i;
- break;
- }
- }
- if (index == -1) return array;
-
- if (array.length > 1) {
- result = new TabInfo[array.length - 1];
- System.arraycopy(array, 0, result, 0, index);
- System.arraycopy(array, index+1, result, index, result.length - index);
- }
- return result;
-}
-/**
- * Set the default bounds of a page in a CTabFolder.
- */
-protected static Rectangle calculatePageBounds(CTabFolder folder) {
- if (folder == null)
- return new Rectangle(0,0,0,0);
- Rectangle bounds = folder.getBounds();
- Rectangle offset = folder.getClientArea();
- bounds.x += offset.x;
- bounds.y += offset.y;
- bounds.width = offset.width;
- bounds.height = offset.height;
- return bounds;
-}
-public void createControl(Composite parent) {
-
- if (tabFolder != null) return;
-
- // Create control.
- this.parent = parent;
- tabFolder = new CTabFolder(parent, tabLocation | SWT.BORDER);
-
- // listener to switch between visible tabItems
- tabFolder.addListener(SWT.Selection, new Listener(){
- public void handleEvent(Event e){
- LayoutPart item = (LayoutPart)mapTabToPart.get(e.item);
- // Item can be null when tab is just created but not map yet.
- if (item != null) {
- setSelection(item);
- if (assignFocusOnSelection)
- item.setFocus();
- }
- }
- });
-
- // listener to resize visible components
- tabFolder.addListener(SWT.Resize, new Listener(){
- public void handleEvent(Event e){
- setControlSize(current);
- }
- });
-
- // listen for mouse down on tab to set focus.
- tabFolder.addMouseListener(this.mouseListener);
-
- // enable for drag & drop target
- tabFolder.setData((IPartDropTarget)this);
-
- // Create pages.
- if (invisibleChildren != null) {
- TabInfo[] stillInactive = new TabInfo[0];
- int tabCount = 0;
- for (int i = 0, length = invisibleChildren.length; i < length; i++){
- if (invisibleChildren[i].part instanceof PartPlaceholder) {
- invisibleChildren[i].part.setContainer(this);
- TabInfo[] newStillInactive = new TabInfo[stillInactive.length + 1];
- System.arraycopy(stillInactive, 0, newStillInactive, 0, stillInactive.length);
- newStillInactive[stillInactive.length] = invisibleChildren[i];
- stillInactive = newStillInactive;
- }
- else {
- createPartTab(invisibleChildren[i].part, invisibleChildren[i].tabText, tabCount);
- ++ tabCount;
- }
- }
- invisibleChildren = stillInactive;
- }
-
- active = true;
-
- // Set current page.
- if (getItemCount() > 0) {
- int newPage = 0;
- if (current != null)
- newPage = indexOf(current);
- setSelection(newPage);
- }
-}
-private CTabItem createPartTab(LayoutPart part, String tabName, int tabIndex) {
- CTabItem tabItem;
-
- if (tabIndex < 0)
- tabItem = new CTabItem(this.tabFolder, SWT.NONE);
- else
- tabItem = new CTabItem(this.tabFolder, SWT.NONE, tabIndex);
- tabItem.setText(tabName);
-
- mapTabToPart.put(tabItem, part);
-
- part.createControl(this.parent);
- part.setContainer(this);
-
- // Because the container's allow border api
- // is dependent on the number of tabs it has,
- // reset the container so the parts can update.
- if (mapTabToPart.size() == 2) {
- Iterator parts = mapTabToPart.values().iterator();
- ((LayoutPart)parts.next()).setContainer(this);
- ((LayoutPart)parts.next()).setContainer(this);
- }
-
- return tabItem;
-}
-/**
- * Remove the ability to d&d using the tab
- *
- * See PerspectivePresentation
- */
-public void disableDrag(LayoutPart part) {
- PartDragDrop partDragDrop = (PartDragDrop)mapPartToDragMonitor.get(part);
- if (partDragDrop != null) {
- partDragDrop.dispose();
- mapPartToDragMonitor.remove(part);
- }
-
- // remove d&d on folder when no tabs left
- if (mapPartToDragMonitor.size() == 1) {
- partDragDrop = (PartDragDrop)mapPartToDragMonitor.get(this);
- if (partDragDrop != null) {
- partDragDrop.dispose();
- mapPartToDragMonitor.remove(this);
- }
- }
-}
-/**
- * See LayoutPart#dispose
- */
-public void dispose() {
-
- if (!active) return;
-
- // combine active and inactive entries into one
- TabInfo[] newInvisibleChildren = new TabInfo[mapTabToPart.size()];
-
- if (invisibleChildren != null){
- // tack the inactive ones on at the end
- newInvisibleChildren = new TabInfo[newInvisibleChildren.length + invisibleChildren.length];
- System.arraycopy(invisibleChildren, 0, newInvisibleChildren, mapTabToPart.size(), invisibleChildren.length);
- }
-
- Iterator keys = mapTabToPart.keySet().iterator();
- while(keys.hasNext()) {
- CTabItem item = (CTabItem)keys.next();
- LayoutPart part = (LayoutPart)mapTabToPart.get(item);
- TabInfo info = new TabInfo();
- info.tabText = item.getText();
- info.part = part;
- newInvisibleChildren[tabFolder.indexOf(item)] = info;
- disableDrag(part);
- }
-
- invisibleChildren = newInvisibleChildren;
-
- if (invisibleChildren != null) {
- for (int i = 0, length = invisibleChildren.length; i < length; i++){
- invisibleChildren[i].part.setContainer(null);
- }
- }
-
- mapTabToPart.clear();
-
- if (tabFolder != null)
- tabFolder.dispose();
- tabFolder = null;
-
- active = false;
-}
-/**
- * Enable the view pane to be d&d via its tab
- *
- * See PerspectivePresentation::enableDrag
- */
-public void enableDrag(ViewPane pane, IPartDropListener listener) {
- // make sure its not already registered
- if (mapPartToDragMonitor.containsKey(pane))
- return;
-
- CTabItem tab = getTab(pane);
- if (tab == null)
- return;
-
- CTabPartDragDrop dragSource = new CTabPartDragDrop(pane, this.tabFolder, tab);
- mapPartToDragMonitor.put(pane, dragSource);
- dragSource.addDropListener(listener);
-
- // register d&d on empty tab area the first time thru
- if (mapPartToDragMonitor.size() == 1) {
- dragSource = new CTabPartDragDrop(this, this.tabFolder, null);
- mapPartToDragMonitor.put(this, dragSource);
- dragSource.addDropListener(listener);
- }
-}
-/**
- * Open the tracker to allow the user to move
- * the specified part using keyboard.
- */
-public void openTracker(LayoutPart part) {
- CTabPartDragDrop dnd = (CTabPartDragDrop)mapPartToDragMonitor.get(part);
- dnd.openTracker();
-}
-/**
- * Gets the presentation bounds.
- */
-public Rectangle getBounds() {
- return tabFolder.getBounds();
-}
-
-// getMinimumHeight() added by cagatayk@acm.org
-/**
- * @see LayoutPart#getMinimumHeight()
- */
-public int getMinimumHeight() {
- if (current == null || tabFolder == null || tabFolder.isDisposed())
- return super.getMinimumHeight();
-
- if (getItemCount() > 1) {
- Rectangle trim = tabFolder.computeTrim(0, 0, 0, current.getMinimumHeight());
- return trim.height;
- }
- else
- return current.getMinimumHeight();
-}
-
-/**
- * See IVisualContainer#getChildren
- */
-public LayoutPart[] getChildren() {
- LayoutPart [] children = new LayoutPart[0];
-
- if (invisibleChildren != null) {
- children = new LayoutPart[invisibleChildren.length];
- for (int i = 0, length = invisibleChildren.length; i < length; i++){
- children[i] = invisibleChildren[i].part;
- }
- }
-
- int count = mapTabToPart.size();
- if (count > 0) {
- int index = children.length;
- LayoutPart [] newChildren = new LayoutPart[children.length + count];
- System.arraycopy(children, 0, newChildren, 0, children.length);
- children = newChildren;
- for (int nX = 0; nX < count; nX ++) {
- CTabItem tabItem = tabFolder.getItem(nX);
- children[index] = (LayoutPart)mapTabToPart.get(tabItem);
- index++;
- }
- }
-
- return children;
-}
-public Control getControl() {
- return tabFolder;
-}
-/**
- * Answer the number of children.
- */
-public int getItemCount() {
- if (active)
- return tabFolder.getItemCount();
- else if (invisibleChildren != null)
- return invisibleChildren.length;
- else
- return 0;
-
-}
-/**
- * Get the parent control.
- */
-public Composite getParent() {
- return tabFolder.getParent();
-}
-public int getSelection() {
- if (!active) return 0;
- return tabFolder.getSelectionIndex();
-}
-/**
- * Returns the tab for a part.
- */
-private CTabItem getTab(LayoutPart child) {
- Iterator tabs = mapTabToPart.keySet().iterator();
- while (tabs.hasNext()) {
- CTabItem tab = (CTabItem) tabs.next();
- if (mapTabToPart.get(tab) == child)
- return tab;
- }
-
- return null;
-}
-/**
- * Returns the visible child.
- */
-public LayoutPart getVisiblePart() {
- if(current == null)
- return inactiveCurrent;
- return current;
-}
-public int indexOf (LayoutPart item) {
-
- Iterator keys = mapTabToPart.keySet().iterator();
- while (keys.hasNext()) {
- CTabItem tab = (CTabItem)keys.next();
- LayoutPart part = (LayoutPart)mapTabToPart.get(tab);
- if (part.equals(item))
- return tabFolder.indexOf(tab);
- }
-
- return 0;
-}
-/**
- * Returns true if this part is visible. A part is visible if it has a control.
- */
-public boolean isVisible() {
- return (tabFolder != null);
-}
-/**
- * See IVisualContainer#remove
- */
-public void remove(LayoutPart child) {
-
- if (active && !(child instanceof PartPlaceholder)) {
-
- Iterator keys = mapTabToPart.keySet().iterator();
- while (keys.hasNext()) {
- CTabItem key = (CTabItem) keys.next();
- if (mapTabToPart.get(key).equals(child)) {
- removeTab(key);
- break;
- }
- }
- } else if (invisibleChildren != null) {
- invisibleChildren = arrayRemove(invisibleChildren, child);
- }
-
- if (active) {
- child.setBounds(0, 0, 0, 0);
- child.setContainer(null);
- }
-}
-private void removeTab(CTabItem tab) {
- // disable any d&d based on this tab
- LayoutPart part = (LayoutPart)mapTabToPart.get(tab);
- if (part != null)
- disableDrag(part);
-
- // remove the tab now
- // Note, that disposing of the tab causes the
- // tab folder to select the next tab and fires
- // a selection event. In this situation, do
- // not assign focus.
- assignFocusOnSelection = false;
- mapTabToPart.remove(tab);
- tab.dispose();
- assignFocusOnSelection = true;
-
- // Because the container's allow border api
- // is dependent on the number of tabs it has,
- // reset the container so the parts can update.
- if (mapTabToPart.size() == 1) {
- Iterator parts = mapTabToPart.values().iterator();
- ((LayoutPart)parts.next()).setContainer(this);
- }
-}
-/**
- * Reorder the tab representing the specified pane.
- * If a tab exists under the specified x,y location,
- * then move the tab before it, otherwise place it
- * as the last tab.
- */
-public void reorderTab(ViewPane pane, int x, int y) {
- CTabItem sourceTab = getTab(pane);
- if (sourceTab == null)
- return;
-
- // adjust the y coordinate to fall within the tab area
- Point location = new Point(1, 1);
- if ((tabFolder.getStyle() & SWT.BOTTOM) != 0)
- location.y = tabFolder.getSize().y - 4; // account for 3 pixel border
-
- // adjust the x coordinate to be within the tab area
- if (x > location.x)
- location.x = x;
-
- // find the tab under the adjusted location.
- CTabItem targetTab = tabFolder.getItem(location);
-
- // no tab under location so move view's tab to end
- if (targetTab == null) {
- // do nothing if already at the end
- if (tabFolder.indexOf(sourceTab) != tabFolder.getItemCount() - 1)
- reorderTab(pane, sourceTab, -1);
-
- return;
- }
-
- // do nothing if over view's own tab
- if (targetTab == sourceTab)
- return;
-
- // do nothing if already before target tab
- int sourceIndex = tabFolder.indexOf(sourceTab);
- int targetIndex = tabFolder.indexOf(targetTab);
- if (sourceIndex == targetIndex - 1)
- return;
-
- reorderTab(pane, sourceTab, targetIndex);
-}
-/**
- * Reorder the tab representing the specified pane.
- */
-private void reorderTab(ViewPane pane, CTabItem sourceTab, int newIndex) {
- // remember if the source tab was the visible one
- boolean wasVisible = (tabFolder.getSelection() == sourceTab);
-
- // create the new tab at the specified index
- CTabItem newTab;
- if (newIndex < 0)
- newTab = new CTabItem(tabFolder, SWT.NONE);
- else
- newTab = new CTabItem(tabFolder, SWT.NONE, newIndex);
-
- // map it now before events start coming in...
- mapTabToPart.put(newTab, pane);
-
- // update the drag & drop
- CTabPartDragDrop partDragDrop = (CTabPartDragDrop)mapPartToDragMonitor.get(pane);
- partDragDrop.setTab(newTab);
-
- // dispose of the old tab and remove it
- String sourceLabel = sourceTab.getText();
- mapTabToPart.remove(sourceTab);
- assignFocusOnSelection = false;
- sourceTab.dispose();
- assignFocusOnSelection = true;
-
- // update the new tab's title and visibility
- newTab.setText(sourceLabel);
- if (wasVisible) {
- tabFolder.setSelection(newTab);
- setSelection(pane);
- pane.setFocus();
- }
-}
-/**
- * Reparent a part. Also reparent visible children...
- */
-public void reparent(Composite newParent) {
- if (!newParent.isReparentable())
- return;
-
- Control control = getControl();
- if ((control == null) || (control.getParent() == newParent))
- return;
-
- super.reparent(newParent);
-
- // reparent also the visible children.
- Iterator enum = mapTabToPart.values().iterator();
- while (enum.hasNext())
- ((LayoutPart)enum.next()).reparent(newParent);
-}
-/**
- * See IVisualContainer#replace
- */
-public void replace(LayoutPart oldChild, LayoutPart newChild) {
-
- if ((oldChild instanceof PartPlaceholder) && !(newChild instanceof PartPlaceholder)){
- replaceChild((PartPlaceholder)oldChild, newChild);
- return;
- }
-
- if (!(oldChild instanceof PartPlaceholder) && (newChild instanceof PartPlaceholder)){
- replaceChild(oldChild, (PartPlaceholder)newChild);
- return;
- }
-
-}
-private void replaceChild(LayoutPart oldChild, PartPlaceholder newChild) {
-
- // remove old child from display
- if (active) {
- Iterator keys = mapTabToPart.keySet().iterator();
- while (keys.hasNext()) {
- CTabItem key = (CTabItem)keys.next();
- LayoutPart part = (LayoutPart)mapTabToPart.get(key);
- if (part == oldChild) {
- boolean partIsActive = (current == oldChild);
- TabInfo info = new TabInfo();
- info.part = newChild;
- info.tabText = key.getText();
- removeTab(key);
- int index = 0;
- if (invisibleChildren != null)
- index = invisibleChildren.length;
- invisibleChildren = arrayAdd(invisibleChildren, info, index);
- oldChild.setBounds(new Rectangle(0, 0, 0, 0));
- oldChild.setContainer(null);
- newChild.setContainer(this);
- if (tabFolder.getItemCount() > 0 && !partIsActive) {
- setControlSize(current);
- }
- break;
- }
- }
- } else if (invisibleChildren != null) {
- for (int i = 0, length = invisibleChildren.length; i < length; i++){
- if (invisibleChildren[i].part == oldChild) {
- invisibleChildren[i].part = newChild;
- }
- }
- }
-
-}
-private void replaceChild(PartPlaceholder oldChild, LayoutPart newChild) {
- if (invisibleChildren == null) return;
-
- for (int i = 0, length = invisibleChildren.length; i < length; i++) {
- if (invisibleChildren[i].part == oldChild) {
- if (active) {
- TabInfo info = invisibleChildren[i];
- invisibleChildren = arrayRemove(invisibleChildren, oldChild);
- oldChild.setContainer(null);
-
- if (newChild instanceof PartPane) {
- WorkbenchPartReference ref = (WorkbenchPartReference)((PartPane)newChild).getPartReference();
- info.tabText = ref.getRegisteredName();
- }
- CTabItem item = createPartTab(newChild, info.tabText, -1);
- int index = tabFolder.indexOf(item);
- setSelection(index);
- } else {
- invisibleChildren[i].part = newChild;
- // On restore, all views are initially represented by placeholders and then
- // they are replaced with the real views. The following code is used to preserve the active
- // tab when a prespective is restored from its persisted state.
- if (inactiveCurrent != null && inactiveCurrent == oldChild){
- current = newChild;
- inactiveCurrent = null;
- }
- }
- break;
- }
- }
-}
-/**
- * @see IPersistable
- */
-public IStatus restoreState(IMemento memento)
-{
- // Read the active tab.
- String activeTabID = memento.getString(IWorkbenchConstants.TAG_ACTIVE_PAGE_ID);
-
- // Read the page elements.
- IMemento [] children = memento.getChildren(IWorkbenchConstants.TAG_PAGE);
- if(children != null) {
- // Loop through the page elements.
- for (int i = 0; i < children.length; i ++) {
- // Get the info details.
- IMemento childMem = children[i];
- String partID = childMem.getString(IWorkbenchConstants.TAG_CONTENT);
- String tabText = childMem.getString(IWorkbenchConstants.TAG_LABEL);
-
- IViewDescriptor descriptor = (IViewDescriptor)WorkbenchPlugin.getDefault().
- getViewRegistry().find(partID);
- if(descriptor != null)
- tabText = descriptor.getLabel();
-
- // Create the part.
- LayoutPart part = new PartPlaceholder(partID);
- add(tabText, i, part);
- //1FUN70C: ITPUI:WIN - Shouldn't set Container when not active
- part.setContainer(this);
- if (partID.equals(activeTabID)) {
- // Mark this as the active part.
- inactiveCurrent = part;
- }
- }
- }
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
-}
-/**
- * @see IPersistable
- */
-public IStatus saveState(IMemento memento)
-{
-
- // Save the active tab.
- if (current != null)
- memento.putString(IWorkbenchConstants.TAG_ACTIVE_PAGE_ID, current.getID());
-
- if(mapTabToPart.size() == 0) {
- // Loop through the invisible children.
- if(invisibleChildren != null) {
- for (int i = 0; i < invisibleChildren.length; i ++) {
- // Save the info.
- // Fields in TabInfo ..
- // private String tabText;
- // private LayoutPart part;
- TabInfo info = invisibleChildren[i];
- IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_PAGE);
- childMem.putString(IWorkbenchConstants.TAG_LABEL, info.tabText);
- childMem.putString(IWorkbenchConstants.TAG_CONTENT, info.part.getID());
- }
- }
- } else {
- LayoutPart [] children = getChildren();
- CTabItem keys[] = new CTabItem[mapTabToPart.size()];
- mapTabToPart.keySet().toArray(keys);
- if(children != null) {
- for (int i = 0; i < children.length; i ++){
- IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_PAGE);
- childMem.putString(IWorkbenchConstants.TAG_CONTENT,children[i].getID());
- boolean found = false;
- for (int j = 0; j < keys.length; j++){
- if(mapTabToPart.get(keys[j]) == children[i]) {
- childMem.putString(IWorkbenchConstants.TAG_LABEL, keys[j].getText());
- found = true;
- break;
- }
- }
- if(!found) {
- for (int j = 0; j < invisibleChildren.length; j++){
- if(invisibleChildren[j].part == children[i]) {
- childMem.putString(IWorkbenchConstants.TAG_LABEL,invisibleChildren[j].tabText);
- found = true;
- break;
- }
- }
- }
- if(!found) {
- childMem.putString(IWorkbenchConstants.TAG_LABEL,"LabelNotFound");//$NON-NLS-1$
- }
- }
- }
- }
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
-}
-/**
- * Sets the presentation bounds.
- */
-public void setBounds(Rectangle r) {
- if (tabFolder != null)
- tabFolder.setBounds(r);
- setControlSize(current);
-}
-/**
- * Set the size of a page in the folder.
- */
-private void setControlSize(LayoutPart part) {
- if (part == null || tabFolder == null)
- return;
- Rectangle bounds;
- if (mapTabToPart.size() > 1)
- bounds = calculatePageBounds(tabFolder);
- else
- bounds = tabFolder.getBounds();
- part.setBounds(bounds);
- part.moveAbove(tabFolder);
-}
-public void setSelection(int index) {
- if (!active) return;
-
- if (mapTabToPart.size() == 0) {
- setSelection(null);
- return;
- }
-
- // make sure the index is in the right range
- if (index < 0) index = 0;
- if (index > mapTabToPart.size() - 1) index = mapTabToPart.size() - 1;
- tabFolder.setSelection(index);
-
- CTabItem item = tabFolder.getItem(index);
- LayoutPart part = (LayoutPart)mapTabToPart.get(item);
- setSelection(part);
-}
-private void setSelection(LayoutPart part) {
-
- if (!active) return;
- if (part instanceof PartPlaceholder) return;
-
- // Deactivate old / Activate new.
- if (current != null && current != part){
- current.setBounds(0, 0, 0, 0);
- }
- current = part;
- if (current != null) {
- setControlSize(current);
- }
-
- /*
- * Detached window no longer supported - remove when confirmed
- *
- * // set the title of the detached window to reflact the active tab
- * Window window = getWindow();
- * if (window instanceof DetachedWindow) {
- * if (current == null || !(current instanceof PartPane))
- * window.getShell().setText("");//$NON-NLS-1$
- * else
- * window.getShell().setText(((PartPane)current).getPart().getTitle());
- * }
- */
-}
-/**
- * @see IPartDropTarget::targetPartFor
- */
-public LayoutPart targetPartFor(LayoutPart dragSource) {
- return this;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Perspective.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Perspective.java
deleted file mode 100644
index ce05ddd..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Perspective.java
+++ /dev/null
@@ -1,1357 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-**********************************************************************/
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.part.ViewPart;
-
-import java.util.List;
-
-/**
- * The ViewManager is a factory for workbench views.
- */
-public class Perspective
-{
- private PerspectiveDescriptor descriptor;
- protected WorkbenchPage page;
- protected LayoutPart editorArea;
- private PartPlaceholder editorHolder;
- private ViewFactory viewFactory;
- private ArrayList visibleActionSets;
- private ArrayList alwaysOnActionSets;
- private ArrayList alwaysOffActionSets;
- private ArrayList newWizardActionIds;
- private ArrayList showViewActionIds;
- private ArrayList perspectiveActionIds;
- private ArrayList fastViews;
- private IViewReference activeFastView;
- private IViewReference previousActiveFastView;
- private IMemento memento;
- protected PerspectivePresentation presentation;
- final static private String VERSION_STRING = "0.016";//$NON-NLS-1$
-
- // fields used by fast view resizing via a sash
- private static final int SASH_SIZE = 3;
- private static final int FASTVIEW_HIDE_STEPS = 3;
- private static final RGB RGB_COLOR1 = new RGB(132, 130, 132);
- private static final RGB RGB_COLOR2 = new RGB(143, 141, 138);
- private static final RGB RGB_COLOR3 = new RGB(171, 168, 165);
- private Color borderColor1;
- private Color borderColor2;
- private Color borderColor3;
- private Map mapFastViewToWidthRatio = new HashMap();
- private Sash fastViewSash;
- private CoolBarLayout toolBarLayout;
-
- //Number of open editors before reusing. If < 0, use the
- //user preference settings.
- private int reuseEditors = -1;
-
- // resize listener to update fast view height and width when
- // window resized.
- Listener resizeListener = new Listener() {
- public void handleEvent(Event event) {
- if (event.type == SWT.Resize && activeFastView != null) {
- ViewPane pane = getPane(activeFastView);
- if (pane.isZoomed() == false) {
- Rectangle bounds = pane.getBounds();
- bounds.height = Math.max(0, getClientComposite().getSize().y);
- float ratio = getFastViewWidthRatio(pane.getID());
- bounds.width = Math.max(0, (int)((float)(getClientComposite().getSize().x) * ratio));
- pane.setBounds(bounds);
- fastViewSash.setBounds(bounds.width - SASH_SIZE, bounds.y, SASH_SIZE, bounds.height - SASH_SIZE);
- fastViewSash.moveAbove(null);
- }
- }
- }
- };
-
- private PaintListener paintListener = new PaintListener() {
- public void paintControl(PaintEvent event) {
- if (borderColor1 == null) borderColor1 = WorkbenchColors.getColor(RGB_COLOR1);
- if (borderColor2 == null) borderColor2 = WorkbenchColors.getColor(RGB_COLOR2);
- if (borderColor3 == null) borderColor3 = WorkbenchColors.getColor(RGB_COLOR3);
-
- Point size = fastViewSash.getSize();
- Rectangle d = new Rectangle(0, 0, size.x, size.y);
- GC gc = event.gc;
-
- gc.setForeground(borderColor1);
- gc.drawLine(d.x, d.y, d.x, d.y + d.height);
-
- gc.setForeground(borderColor2);
- gc.drawLine(d.x + 1, d.y + 1, d.x + 1, d.y + d.height);
-
- gc.setForeground(borderColor3);
- gc.drawLine(d.x + 2, d.y + 2, d.x + 2, d.y + d.height);
- }
- };
- private SelectionAdapter selectionListener = new SelectionAdapter () {
- public void widgetSelected(SelectionEvent e) {
- if (e.detail == SWT.DRAG && activeFastView != null)
- checkDragLimit(e);
- if (e.detail != SWT.DRAG && activeFastView != null) {
- ViewPane pane = getPane(activeFastView);
- Rectangle bounds = pane.getBounds();
- bounds.width = Math.max(0, e.x - bounds.x);
- pane.setBounds(bounds);
- Float newRatio = new Float((float)bounds.width/(float)getClientComposite().getSize().x);
- mapFastViewToWidthRatio.put(pane.getID(), newRatio);
- fastViewSash.setBounds(bounds.width - SASH_SIZE, bounds.y, SASH_SIZE, bounds.height - SASH_SIZE);
- fastViewSash.moveAbove(null);
- }
- }
- };
-
- private String oldPartID = null;
- private boolean shouldHideEditorsOnActivate = false;
-
-/**
- * ViewManager constructor comment.
- */
-public Perspective(PerspectiveDescriptor desc, WorkbenchPage page)
- throws WorkbenchException
-{
- this(page);
- descriptor = desc;
- if(desc != null)
- createPresentation(desc);
-}
-/**
- * ViewManager constructor comment.
- */
-protected Perspective(WorkbenchPage page) throws WorkbenchException {
- this.page = page;
- this.editorArea = page.getEditorPresentation().getLayoutPart();
- this.viewFactory = page.getViewFactory();
- visibleActionSets = new ArrayList(2);
- alwaysOnActionSets = new ArrayList(2);
- alwaysOffActionSets = new ArrayList(2);
- fastViews = new ArrayList(2);
-}
-/**
- * Sets the fast view attribute.
- * Note: The page is expected to update action bars.
- */
-public void addFastView(IViewReference ref) {
- ViewPane pane = (ViewPane)((WorkbenchPartReference)ref).getPane();
- if (!isFastView(ref)) {
- // Only remove the part from the presentation if it
- // is actually in the presentation.
- if (presentation.hasPlaceholder(pane.getID()) ||
- pane.getContainer() != null)
- presentation.removePart(pane);
- // We are drag-enabling the pane because it has been disabled
- // when it was removed from the perspective presentation.
- presentation.enableDrag(pane);
- fastViews.add(ref);
- pane.setFast(true);
- Control ctrl = pane.getControl();
- if (ctrl != null)
- ctrl.setEnabled(false); // Remove focus support.
- }
-}
-/**
- * Moves a part forward in the Z order of a perspective so it is visible.
- *
- * @param part the part to bring to move forward
- * @return true if the part was brought to top, false if not.
- */
-public boolean bringToTop(IViewReference ref) {
- if (isFastView(ref)) {
- setActiveFastView(ref);
- return true;
- } else {
- return presentation.bringPartToTop(getPane(ref));
- }
-}
-/**
- * Returns true if a view can close.
- */
-public boolean canCloseView(IViewPart view) {
- return true;
-}
-
-/**
- * Prevents the user from making a fast view too narrow or too wide.
- */
-private void checkDragLimit(SelectionEvent event) {
- if (event.x < ((float)getClientComposite().getSize().x * IPageLayout.RATIO_MIN))
- event.x = (int)((float)getClientComposite().getSize().x * IPageLayout.RATIO_MIN);
- if (event.x > ((float)getClientComposite().getSize().x * IPageLayout.RATIO_MAX))
- event.x = (int)((float)getClientComposite().getSize().x * IPageLayout.RATIO_MAX);
-}
-
-/**
- * Returns whether a view exists within the perspective.
- */
-public boolean containsView(IViewPart view) {
- String id = view.getSite().getId();
- IViewReference ref = findView(id);
- if(ref == null)
- return false;
- return (view == ref.getPart(false));
-}
-/**
- * Create the initial list of action sets.
- */
-private void createInitialActionSets(List stringList) {
- ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
- Iterator iter = stringList.iterator();
- while (iter.hasNext()) {
- String id = (String)iter.next();
- IActionSetDescriptor desc = reg.findActionSet(id);
- if (desc != null)
- visibleActionSets.add(desc);
- else
- WorkbenchPlugin.log("Unable to find Action Set: " + id);//$NON-NLS-1$
- }
-}
-/**
- * Create a presentation for a perspective.
- */
-private void createPresentation(PerspectiveDescriptor persp)
- throws WorkbenchException
-{
- if (persp.hasCustomFile()) {
- loadCustomPersp(persp);
- } else {
- loadPredefinedPersp(persp);
- }
-}
-/**
- * Dispose the perspective and all views contained within.
- */
-public void dispose() {
- // Get rid of presentation.
- if(presentation == null)
- return;
-
- presentation.deactivate();
- presentation.disposeSashes();
-
-
- // Release each view.
- IViewReference refs[] = getViewReferences();
- for (int i = 0,length = refs.length; i < length; i ++) {
- getViewFactory().releaseView(refs[i].getId());
- }
-
- // Dispose of the sash too...
- if (fastViewSash != null) {
- fastViewSash.dispose();
- fastViewSash = null;
- }
-
- mapFastViewToWidthRatio.clear();
-}
-/**
- * See IWorkbenchPage@findView.
- */
-public IViewReference findView(String id) {
- IViewReference refs[] = getViewReferences();
- for (int i = 0; i < refs.length; i ++) {
- IViewReference ref = refs[i];
- if (id.equals(ref.getId()))
- return ref;
- }
- return null;
-}
-/**
- * Returns an array of the visible action sets.
- */
-public IActionSetDescriptor[] getActionSets() {
- int size = visibleActionSets.size();
- IActionSetDescriptor [] array = new IActionSetDescriptor[size];
- for (int i = 0; i < size; i ++) {
- array[i] = (IActionSetDescriptor)visibleActionSets.get(i);
- }
- return array;
-}
-/**
- * Returns the window's client composite widget
- * which views and editor area will be parented.
- */
-private Composite getClientComposite() {
- return page.getClientComposite();
-}
-/**
- * Returns the perspective.
- */
-public IPerspectiveDescriptor getDesc() {
- return descriptor;
-}
-/**
- * Returns the bounds of the given fast view.
- */
-/*package*/ Rectangle getFastViewBounds(IViewReference ref) {
- // Copy the bounds of the page composite
- Rectangle bounds = page.getClientComposite().getBounds();
- ViewPane pane = getPane(ref);
- // get the width ratio of the fast view
- float ratio = getFastViewWidthRatio(pane.getID());
- // Compute the actual width of the fast view.
- bounds.width = (int)(ratio*(float)getClientComposite().getSize().x);
- return bounds;
-}
-/**
- * Returns the docked views.
- */
-public IViewReference [] getFastViews() {
- IViewReference array[] = new IViewReference[fastViews.size()];
- fastViews.toArray(array);
- return array;
-}
-/**
- * Returns the new wizard actions the page.
- * This is List of Strings.
- */
-public ArrayList getNewWizardActionIds() {
- return newWizardActionIds;
-}
-/**
- * Returns the pane for a view reference.
- */
-private ViewPane getPane(IViewReference ref) {
- return (ViewPane)((WorkbenchPartReference)ref).getPane();
-}
-/**
- * Returns the perspective actions for this page.
- * This is List of Strings.
- */
-public ArrayList getPerspectiveActionIds() {
- return perspectiveActionIds;
-}
-/**
- * Returns the presentation.
- */
-public PerspectivePresentation getPresentation() {
- return presentation;
-}
-/**
- * Retrieves the ratio for the fast view with the given ID. If
- * the ratio is not known, the default ratio for the view is returned.
- */
-private float getFastViewWidthRatio(String id) {
- Float f = (Float)mapFastViewToWidthRatio.get(id);
- if (f != null) {
- return f.floatValue();
- } else {
- IViewRegistry reg = WorkbenchPlugin.getDefault().getViewRegistry();
- float ratio = reg.find(id).getFastViewWidthRatio();
- mapFastViewToWidthRatio.put(id, new Float(ratio));
- return ratio;
- }
-}
-/**
- * Returns the show view actions the page.
- * This is List of Strings.
- */
-public ArrayList getShowViewActionIds() {
- return showViewActionIds;
-}
-/**
- * Returns the toolbar layout for this perspective.
- */
-public CoolBarLayout getToolBarLayout() {
- return toolBarLayout;
-}
-/**
- * Returns the last active fast view.
- */
-/*package*/ IViewReference getPreviousActiveFastView() {
- return previousActiveFastView;
-}
-/**
- * Returns the view factory.
- */
-private ViewFactory getViewFactory() {
- return viewFactory;
-}
-/**
- * Open the tracker to allow the user to move
- * the specified part using keyboard.
- */
-public void openTracker(ViewPane pane) {
- presentation.openTracker(pane);
-}
-/**
- * See IWorkbenchPage.
- */
-public IViewReference [] getViewReferences() {
- // Get normal views.
- if(presentation == null)
- return new IViewReference[0];
-
- List panes = new ArrayList(5);
- presentation.collectViewPanes(panes);
-
- IViewReference [] resultArray = new IViewReference[panes.size() + fastViews.size()];
-
- // Copy fast views.
- int nView = 0;
- for (int i = 0; i < fastViews.size(); i++) {
- resultArray[nView] = (IViewReference)fastViews.get(i);
- ++ nView;
- }
-
- // Copy normal views.
- for (int i = 0; i < panes.size(); i ++) {
- ViewPane pane = (ViewPane)panes.get(i);
- resultArray[nView] = pane.getViewReference();
- ++ nView;
- }
-
- return resultArray;
-}
-/**
- * @see IWorkbenchPage
- * Note: The page is expected to update action bars.
- */
-public void hideActionSet(String id) {
- ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
- IActionSetDescriptor desc = reg.findActionSet(id);
- if (alwaysOnActionSets.contains(desc))
- return;
- if (desc != null)
- visibleActionSets.remove(desc);
-}
-/**
- * Hide the editor area if visible
- */
-protected void hideEditorArea() {
- if (!isEditorAreaVisible())
- return;
-
- // Replace the editor area with a placeholder so we
- // know where to put it back on show editor area request.
- editorHolder = new PartPlaceholder(editorArea.getID());
- presentation.getLayout().replace(editorArea, editorHolder);
-
- // Disable the entire editor area so if an editor had
- // keyboard focus it will let it go.
- if (editorArea.getControl() != null)
- editorArea.getControl().setEnabled(false);
-}
-/**
- * Hides a fast view. The view shrinks equally <code>steps</code> times
- * before disappearing completely.
- */
-private void hideFastView(IViewReference ref, int steps) {
- setFastViewIconSelection(ref, false);
-
- // Get pane.
- ViewPane pane = getPane(ref);
- // Hide the right side sash first
- if (fastViewSash != null)
- fastViewSash.setBounds(0, 0, 0, 0);
- Control ctrl = pane.getControl();
-
- if(steps != 0) {
- // Slide it off screen.
- Rectangle bounds = pane.getBounds();
- int increment = bounds.width / steps;
- for (int i = 0; i <= bounds.width - 2; i += increment) {
- ctrl.setLocation(-i, bounds.y);
- ctrl.getParent().update();
- }
- }
- // Hide it completely.
- pane.setBounds(0, 0, 0, 0);
- pane.setFastViewSash(null);
- ctrl.setEnabled(false); // Remove focus support.
-}
-/**
- * Hides the fast view sash for zooming in a fast view.
- */
-void hideFastViewSash() {
- if (fastViewSash != null)
- fastViewSash.setBounds(0, 0, 0, 0);
-}
-public boolean hideView(IViewReference ref) {
- // If the view is locked just return.
- ViewPane pane = getPane(ref);
-
- // Remove the view from the current presentation.
- if (isFastView(ref)) {
- fastViews.remove(ref);
- pane.setFast(false); //force an update of the toolbar
- if (activeFastView == ref)
- setActiveFastView(null);
- pane.getControl().setEnabled(true);
- } else {
- presentation.removePart(pane);
- }
-
- // Dispose view if ref count == 0.
- getViewFactory().releaseView(ref.getId());
- return true;
-}
-/*
- * Return whether the editor area is visible or not.
- */
-protected boolean isEditorAreaVisible() {
- return editorHolder == null;
-}
-/**
- * Returns true if a view is fast.
- */
-public boolean isFastView(IViewReference ref) {
- return fastViews.contains(ref);
-}
-/**
- * Creates a new presentation from a persistence file.
- * Note: This method should not modify the current state of the perspective.
- */
-private void loadCustomPersp(PerspectiveDescriptor persp)
-{
- try {
- InputStream stream = new FileInputStream(persp.getCustomFile());
- InputStreamReader reader = new InputStreamReader(stream, "utf-8"); //$NON-NLS-1$
- // Restore the layout state.
- IMemento memento = XMLMemento.createReadRoot(reader);
- MultiStatus status = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.format("Perspective.unableToRestorePerspective",new String[]{persp.getLabel()}),
- null);
- status.merge(restoreState(memento));
- status.merge(restoreState());
- if(status.getSeverity() != IStatus.OK) {
- unableToOpenPerspective(persp,status);
- }
- reader.close();
- } catch (IOException e) {
- unableToOpenPerspective(persp,null);
- } catch (WorkbenchException e) {
- unableToOpenPerspective(persp,e.getStatus());
- }
-}
-private void unableToOpenPerspective(PerspectiveDescriptor persp,IStatus status) {
- persp.deleteCustomFile();
- String title = WorkbenchMessages.getString("Perspective.problemRestoringTitle"); //$NON-NLS-1$
- String msg = WorkbenchMessages.getString("Perspective.errorReadingState"); //$NON-NLS-1$
- if(status == null) {
- MessageDialog.openError((Shell)null,title,msg);
- } else {
- ErrorDialog.openError((Shell)null,title,msg,status);
- }
-}
-
-/**
- * Create a presentation for a perspective.
- * Note: This method should not modify the current state of the perspective.
- */
-private void loadPredefinedPersp(
- PerspectiveDescriptor persp)
- throws WorkbenchException
-{
- // Create layout engine.
- IPerspectiveFactory factory = null;
- try {
- factory = persp.createFactory();
- } catch (CoreException e) {
- throw new WorkbenchException(WorkbenchMessages.format("Perspective.unableToLoad", new Object[] {persp.getId()})); //$NON-NLS-1$
- }
-
- // Create layout factory.
- RootLayoutContainer container = new RootLayoutContainer(page.getMouseDownListener());
- PageLayout layout = new PageLayout(container, getViewFactory(), editorArea);
-
- // Run layout engine.
- factory.createInitialLayout(layout);
- PerspectiveExtensionReader extender = new PerspectiveExtensionReader();
- extender.extendLayout(descriptor.getId(), layout);
-
- // Retrieve fast view width ratios stored in the page layout.
- mapFastViewToWidthRatio.putAll(layout.getFastViewToWidthRatioMap());
-
- // Create action sets.
- createInitialActionSets(layout.getActionSets());
- alwaysOnActionSets.addAll(visibleActionSets);
- newWizardActionIds = layout.getNewWizardActionIds();
- showViewActionIds = layout.getShowViewActionIds();
- perspectiveActionIds = layout.getPerspectiveActionIds();
-
- // Create fast views
- fastViews = layout.getFastViews();
-
- // Create presentation.
- presentation = new PerspectivePresentation(page, container);
-
- // Hide editor area if requested by factory
- if (!layout.isEditorAreaVisible())
- hideEditorArea();
-
-}
-/**
- * activate.
- */
-protected void onActivate() {
- // Update editor area state.
- if (editorArea.getControl() != null) {
- if (isEditorAreaVisible()) {
- // Enable the editor area now that it will be made
- // visible and can accept keyboard focus again.
- editorArea.getControl().setEnabled(true);
- }
- else {
- // Disable the entire editor area so if an editor had
- // keyboard focus it will let it go.
- editorArea.getControl().setEnabled(false);
- }
- }
-
- // Update fast views.
- // Make sure the control for the fastviews are create so they can
- // be activated.
- for (int i = 0; i < fastViews.size(); i++){
- ViewPane pane = getPane((IViewReference)fastViews.get(i));
- Control ctrl = pane.getControl();
- if (ctrl == null) {
- pane.createControl(getClientComposite());
- ctrl = pane.getControl();
- }
- presentation.enableDrag(pane);
- ctrl.setEnabled(false); // Remove focus support.
- }
-
- setAllPinsVisible(true);
- presentation.activate(getClientComposite());
- getClientComposite().addListener(SWT.Resize, resizeListener);
-
- if (shouldHideEditorsOnActivate) {
- // We do this here to ensure that createPartControl is called on the top editor
- // before it is hidden. See bug 20166.
- hideEditorArea();
- shouldHideEditorsOnActivate = false;
- }
-}
-/**
- * deactivate.
- */
-protected void onDeactivate() {
- getClientComposite().removeListener(SWT.Resize, resizeListener);
- presentation.deactivate();
- setActiveFastView(null);
- setAllPinsVisible(false);
-
- // Update fast views.
- for (int i = 0; i < fastViews.size(); i++){
- ViewPane pane = getPane((IViewReference)fastViews.get(i));
- presentation.disableDrag(pane);
- Control ctrl = pane.getControl();
- if (ctrl != null)
- ctrl.setEnabled(true); // Add focus support.
- }
-}
-/**
- * Notifies that a part has been activated.
- */
-public void partActivated(IWorkbenchPart activePart) {
- // If a fastview is open close it.
- if (activeFastView != null && activeFastView.getPart(false) != activePart)
- setActiveFastView(null);
-}
-/**
- * Sets the fast view attribute.
- * Note: The page is expected to update action bars.
- */
-public void removeFastView(IViewReference ref) {
- ViewPane pane = getPane(ref);
- if (isFastView(ref)) {
- if (activeFastView == ref)
- setActiveFastView(null);
- fastViews.remove(ref);
- pane.setFast(false);
- Control ctrl = pane.getControl();
- if (ctrl != null)
- ctrl.setEnabled(true); // Modify focus support.
- // We are disabling the pane because it will be enabled when it
- // is added to the presentation. When a pane is enabled a drop
- // listener is added to it, and we do not want to have multiple
- // listeners for a pane
- presentation.disableDrag(pane);
- presentation.addPart(pane);
- }
-}
-/**
- * Fills a presentation with layout data.
- * Note: This method should not modify the current state of the perspective.
- */
-public IStatus restoreState(IMemento memento) {
- MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.getString("Perspective.problemsRestoringPerspective"),null);
-
- // Create persp descriptor.
- descriptor = new PerspectiveDescriptor(null,null,null);
- result.add(descriptor.restoreState(memento));
- PerspectiveDescriptor desc = (PerspectiveDescriptor)WorkbenchPlugin
- .getDefault().getPerspectiveRegistry().findPerspectiveWithId(descriptor.getId());
- if (desc != null)
- descriptor = desc;
-
- // Create the toolbar layout.
- IMemento layoutMem = memento.getChild(IWorkbenchConstants.TAG_TOOLBAR_LAYOUT);
- if (layoutMem != null) {
- toolBarLayout = new CoolBarLayout();
- boolean success = toolBarLayout.restoreState(layoutMem);
- if (!success) toolBarLayout = null;
- }
- this.memento = memento;
- // Add the visible views.
- IMemento views[] = memento.getChildren(IWorkbenchConstants.TAG_VIEW);
- result.merge(createReferences(views));
-
- memento = memento.getChild(IWorkbenchConstants.TAG_FAST_VIEWS);
- if(memento != null) {
- views = memento.getChildren(IWorkbenchConstants.TAG_VIEW);
- result.merge(createReferences(views));
- }
- return result;
-}
-private IStatus createReferences(IMemento views[]) {
- MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.getString("Perspective.problemsRestoringViews"),null);
-
- for (int x = 0; x < views.length; x ++) {
- // Get the view details.
- IMemento childMem = views[x];
- String viewID = childMem.getString(IWorkbenchConstants.TAG_ID);
-
- // Create and open the view.
- try {
- viewFactory.createView(viewID);
- } catch (PartInitException e) {
- result.add(new Status(IStatus.ERROR,PlatformUI.PLUGIN_ID,0,e.getMessage(),e));
- }
- }
- return result;
-}
-
-/**
- * Fills a presentation with layout data.
- * Note: This method should not modify the current state of the perspective.
- */
-public IStatus restoreState() {
- if(this.memento == null)
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
-
- MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.getString("Perspective.problemsRestoringPerspective"),null);
-
- IMemento memento = this.memento;
- this.memento = null;
-
- IMemento boundsMem = memento.getChild(IWorkbenchConstants.TAG_WINDOW);
- if(boundsMem != null) {
- Rectangle r = new Rectangle(0,0,0,0);
- r.x = boundsMem.getInteger(IWorkbenchConstants.TAG_X).intValue();
- r.y = boundsMem.getInteger(IWorkbenchConstants.TAG_Y).intValue();
- r.height = boundsMem.getInteger(IWorkbenchConstants.TAG_HEIGHT).intValue();
- r.width = boundsMem.getInteger(IWorkbenchConstants.TAG_WIDTH).intValue();
- if(page.getWorkbenchWindow().getPages().length == 0) {
- page.getWorkbenchWindow().getShell().setBounds(r);
- }
- }
-
- // Create an empty presentation..
- RootLayoutContainer mainLayout = new RootLayoutContainer(page.getMouseDownListener());
- PerspectivePresentation pres = new PerspectivePresentation(page, mainLayout);
-
- // Read the layout.
- result.merge(pres.restoreState(memento.getChild(IWorkbenchConstants.TAG_LAYOUT)));
-
- // Add the editor workbook. Do not hide it now.
- pres.replacePlaceholderWithPart(editorArea);
-
- // Add the visible views.
- IMemento [] views = memento.getChildren(IWorkbenchConstants.TAG_VIEW);
-
- for (int x = 0; x < views.length; x ++) {
- // Get the view details.
- IMemento childMem = views[x];
- String viewID = childMem.getString(IWorkbenchConstants.TAG_ID);
-
- // Create and open the view.
- WorkbenchPartReference ref = (WorkbenchPartReference)viewFactory.getView(viewID);
- if(ref == null) {
- WorkbenchPlugin.log("Could not create view: '" + viewID + "'."); //$NON-NLS-1$
- result.add(new Status(
- Status.ERROR,PlatformUI.PLUGIN_ID,0,
- WorkbenchMessages.format("Perspective.couldNotFind", new String[]{viewID}), //$NON-NLS-1$
- null));
- continue;
- }
- if(ref.getPane() == null) {
- ref.setPane(new ViewPane((IViewReference)ref,page));
- }
- page.addPart(ref);
- if(pres.isPartVisible(ref.getId())) {
- IStatus restoreStatus = viewFactory.restoreView((IViewReference)ref);
- result.add(restoreStatus);
- if(restoreStatus.getSeverity() == IStatus.OK) {
- IViewPart view = (IViewPart)ref.getPart(true);
- ViewSite site = (ViewSite)view.getSite();
- ViewPane pane = (ViewPane)site.getPane();
- pres.replacePlaceholderWithPart(pane);
- } else {
- page.removePart(ref);
- }
- } else {
- pres.replacePlaceholderWithPart(ref.getPane());
- }
- }
-
- // Load the fast views
- IMemento fastViewsMem = memento.getChild(IWorkbenchConstants.TAG_FAST_VIEWS);
- if(fastViewsMem != null) {
- views = fastViewsMem.getChildren(IWorkbenchConstants.TAG_VIEW);
- for (int x = 0; x < views.length; x ++) {
- // Get the view details.
- IMemento childMem = views[x];
- String viewID = childMem.getString(IWorkbenchConstants.TAG_ID);
- Float ratio = childMem.getFloat(IWorkbenchConstants.TAG_RATIO);
- if (ratio == null) {
- Integer viewWidth = childMem.getInteger(IWorkbenchConstants.TAG_WIDTH);
- if (viewWidth == null)
- ratio = new Float(IPageLayout.DEFAULT_FASTVIEW_RATIO);
- else
- ratio = new Float((float)viewWidth.intValue() / (float)getClientComposite().getSize().x);
- }
- mapFastViewToWidthRatio.put(viewID, ratio);
-
- IViewReference ref = viewFactory.getView(viewID);
- if(ref == null) {
- WorkbenchPlugin.log("Could not create view: '" + viewID + "'."); //$NON-NLS-1$
- result.add(new Status(
- Status.ERROR,PlatformUI.PLUGIN_ID,0,
- WorkbenchMessages.format("Perspective.couldNotFind", new String[]{viewID}), //$NON-NLS-1$
- null));
- continue;
- }
- page.addPart(ref);
- IStatus restoreStatus = viewFactory.restoreView(ref);
- result.add(restoreStatus);
- if(restoreStatus.getSeverity() == IStatus.OK) {
- fastViews.add(ref);
- } else {
- page.removePart(ref);
- }
- }
- }
-
- // Load the action sets.
- IMemento [] actions = memento.getChildren(IWorkbenchConstants.TAG_ACTION_SET);
- ArrayList actionsArray = new ArrayList(actions.length);
- for (int x = 0; x < actions.length; x ++) {
- String actionSetID = actions[x].getString(IWorkbenchConstants.TAG_ID);
- actionsArray.add(actionSetID);
- }
- createInitialActionSets(actionsArray);
-
- // Load the always on action sets.
- actions = memento.getChildren(IWorkbenchConstants.TAG_ALWAYS_ON_ACTION_SET);
- for (int x = 0; x < actions.length; x ++) {
- String actionSetID = actions[x].getString(IWorkbenchConstants.TAG_ID);
- IActionSetDescriptor d =
- WorkbenchPlugin.getDefault().getActionSetRegistry().findActionSet(actionSetID);
- if (d != null)
- alwaysOnActionSets.add(d);
- }
-
- // Load the always off action sets.
- actions = memento.getChildren(IWorkbenchConstants.TAG_ALWAYS_OFF_ACTION_SET);
- for (int x = 0; x < actions.length; x ++) {
- String actionSetID = actions[x].getString(IWorkbenchConstants.TAG_ID);
- IActionSetDescriptor d =
- WorkbenchPlugin.getDefault().getActionSetRegistry().findActionSet(actionSetID);
- if (d != null)
- alwaysOffActionSets.add(d);
- }
-
- // Load "show view actions".
- actions = memento.getChildren(IWorkbenchConstants.TAG_SHOW_VIEW_ACTION);
- showViewActionIds = new ArrayList(actions.length);
- for (int x = 0; x < actions.length; x ++) {
- String id = actions[x].getString(IWorkbenchConstants.TAG_ID);
- showViewActionIds.add(id);
- }
-
- // Load "new wizard actions".
- actions = memento.getChildren(IWorkbenchConstants.TAG_NEW_WIZARD_ACTION);
- newWizardActionIds = new ArrayList(actions.length);
- for (int x = 0; x < actions.length; x ++) {
- String id = actions[x].getString(IWorkbenchConstants.TAG_ID);
- newWizardActionIds.add(id);
- }
-
- // Load "perspective actions".
- actions = memento.getChildren(IWorkbenchConstants.TAG_PERSPECTIVE_ACTION);
- perspectiveActionIds = new ArrayList(actions.length);
- for (int x = 0; x < actions.length; x ++) {
- String id = actions[x].getString(IWorkbenchConstants.TAG_ID);
- perspectiveActionIds.add(id);
- }
-
- // Save presentation.
- presentation = pres;
-
- // Hide the editor area if needed. Need to wait for the
- // presentation to be fully setup first.
- Integer areaVisible = memento.getInteger(IWorkbenchConstants.TAG_AREA_VISIBLE);
- // Rather than hiding the editors now we must wait until after their controls
- // are created. This ensures that if an editor is instantiated, createPartControl
- // is also called. See bug 20166.
- shouldHideEditorsOnActivate = (areaVisible != null && areaVisible.intValue() == 0);
- return result;
-}
-/**
- * Save the layout.
- */
-public void saveDesc() {
- saveDescAs(descriptor);
-}
-/**
- * Save the layout.
- */
-public void saveDescAs(IPerspectiveDescriptor desc) {
- // Capture the layout state.
- XMLMemento memento = XMLMemento.createWriteRoot("perspective");//$NON-NLS-1$
- IStatus status = saveState(memento, (PerspectiveDescriptor)desc, false);
- if(status.getSeverity() == IStatus.ERROR) {
- ErrorDialog.openError((Shell)null,
- WorkbenchMessages.getString("Perspective.problemSavingTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("Perspective.problemSavingMessage"), //$NON-NLS-1$
- status);
- return;
- }
-
- // Save it to a file.
- PerspectiveDescriptor realDesc = (PerspectiveDescriptor)desc;
- try {
- OutputStream stream = new FileOutputStream(realDesc.getCustomFile());
- Writer writer = new OutputStreamWriter(stream, "utf-8"); //$NON-NLS-1$
- memento.save(writer);
- writer.close();
- descriptor = realDesc;
- } catch (IOException e) {
- realDesc.deleteCustomFile();
- MessageDialog.openError((Shell)null,
- WorkbenchMessages.getString("Perspective.problemSavingTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("Perspective.problemSavingMessage")); //$NON-NLS-1$
- }
-}
-/**
- * Save the layout.
- */
-public IStatus saveState(IMemento memento) {
- MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.getString("Perspective.problemsSavingPerspective"),null);
-
- result.merge(saveState(memento, descriptor, true));
-
- return result;
-}
-/**
- * Save the layout.
- */
-private IStatus saveState(IMemento memento, PerspectiveDescriptor p,
- boolean saveInnerViewState)
-{
- MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.getString("Perspective.problemsSavingPerspective"),null);
-
- if(this.memento != null) {
- memento.putMemento(this.memento);
- return result;
- }
-
- // Save the version number.
- memento.putString(IWorkbenchConstants.TAG_VERSION, VERSION_STRING);
- result.add(p.saveState(memento));
- if(!saveInnerViewState) {
- Rectangle bounds = page.getWorkbenchWindow().getShell().getBounds();
- IMemento boundsMem = memento.createChild(IWorkbenchConstants.TAG_WINDOW);
- boundsMem.putInteger(IWorkbenchConstants.TAG_X,bounds.x);
- boundsMem.putInteger(IWorkbenchConstants.TAG_Y,bounds.y);
- boundsMem.putInteger(IWorkbenchConstants.TAG_HEIGHT,bounds.height);
- boundsMem.putInteger(IWorkbenchConstants.TAG_WIDTH,bounds.width);
- }
-
- // Save the visible action sets.
- Iterator enum = visibleActionSets.iterator();
- while (enum.hasNext()) {
- IActionSetDescriptor desc = (IActionSetDescriptor)enum.next();
- IMemento child = memento.createChild(IWorkbenchConstants.TAG_ACTION_SET);
- child.putString(IWorkbenchConstants.TAG_ID, desc.getId());
- }
-
- // Save the "always on" action sets.
- enum = alwaysOnActionSets.iterator();
- while (enum.hasNext()) {
- IActionSetDescriptor desc = (IActionSetDescriptor)enum.next();
- IMemento child = memento.createChild(IWorkbenchConstants.TAG_ALWAYS_ON_ACTION_SET);
- child.putString(IWorkbenchConstants.TAG_ID, desc.getId());
- }
-
- // Save the "always off" action sets.
- enum = alwaysOffActionSets.iterator();
- while (enum.hasNext()) {
- IActionSetDescriptor desc = (IActionSetDescriptor)enum.next();
- IMemento child = memento.createChild(IWorkbenchConstants.TAG_ALWAYS_OFF_ACTION_SET);
- child.putString(IWorkbenchConstants.TAG_ID, desc.getId());
- }
-
- // Save "show view actions"
- enum = showViewActionIds.iterator();
- while (enum.hasNext()) {
- String str = (String)enum.next();
- IMemento child = memento.createChild(IWorkbenchConstants.TAG_SHOW_VIEW_ACTION);
- child.putString(IWorkbenchConstants.TAG_ID, str);
- }
-
- // Save "new wizard actions".
- enum = newWizardActionIds.iterator();
- while (enum.hasNext()) {
- String str = (String)enum.next();
- IMemento child = memento.createChild(IWorkbenchConstants.TAG_NEW_WIZARD_ACTION);
- child.putString(IWorkbenchConstants.TAG_ID, str);
- }
-
- // Save "perspective actions".
- enum = perspectiveActionIds.iterator();
- while (enum.hasNext()) {
- String str = (String)enum.next();
- IMemento child = memento.createChild(IWorkbenchConstants.TAG_PERSPECTIVE_ACTION);
- child.putString(IWorkbenchConstants.TAG_ID, str);
- }
-
- // Get visible views.
- List viewPanes = new ArrayList(5);
- presentation.collectViewPanes(viewPanes);
-
- // Save the views.
- enum = viewPanes.iterator();
- int errors = 0;
- while (enum.hasNext()) {
- ViewPane pane = (ViewPane)enum.next();
- IViewReference ref = pane.getViewReference();
- IMemento viewMemento = memento.createChild(IWorkbenchConstants.TAG_VIEW);
- viewMemento.putString(IWorkbenchConstants.TAG_ID, ref.getId());
- }
-
- if(fastViews.size() > 0) {
- IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_FAST_VIEWS);
- enum = fastViews.iterator();
- while (enum.hasNext()) {
- IViewReference ref = (IViewReference)enum.next();
- IMemento viewMemento = childMem.createChild(IWorkbenchConstants.TAG_VIEW);
- String id = ref.getId();
- viewMemento.putString(IWorkbenchConstants.TAG_ID, id);
- float ratio = getFastViewWidthRatio(id);
- viewMemento.putFloat(IWorkbenchConstants.TAG_RATIO, ratio);
- }
- }
- if(errors > 0) {
- String message = WorkbenchMessages.getString("Perspective.multipleErrors"); //$NON-NLS-1$
- if(errors == 1)
- message = WorkbenchMessages.getString("Perspective.oneError"); //$NON-NLS-1$
- MessageDialog.openError(null, WorkbenchMessages.getString("Error"), message); //$NON-NLS-1$
- }
-
- // Save the layout.
- IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_LAYOUT);
- result.add(presentation.saveState(childMem));
-
- // Save the toolbar layout.
- if (toolBarLayout != null) {
- childMem = memento.createChild(IWorkbenchConstants.TAG_TOOLBAR_LAYOUT);
- result.add(toolBarLayout.saveState(childMem));
- }
-
- // Save the editor visibility state
- if (isEditorAreaVisible())
- memento.putInteger(IWorkbenchConstants.TAG_AREA_VISIBLE, 1);
- else
- memento.putInteger(IWorkbenchConstants.TAG_AREA_VISIBLE, 0);
- return result;
-}
-/**
- * Sets the visible action sets.
- * Note: The page is expected to update action bars.
- */
-public void setActionSets(IActionSetDescriptor[] newArray) {
- // We assume that changes to action set visibilty should be remembered
- // and not reversed as parts are activated.
- ArrayList turnedOff = (ArrayList)visibleActionSets.clone();
- for (int i = 0; i < newArray.length; i++) {
- IActionSetDescriptor desc = newArray[i];
- turnedOff.remove(desc);
- if (!visibleActionSets.contains(desc)) {
- // make sure this always stays visible
- alwaysOnActionSets.add(desc);
- alwaysOffActionSets.remove(desc);
- }
- }
- for (int i = 0; i < turnedOff.size(); i++) {
- IActionSetDescriptor desc = (IActionSetDescriptor)turnedOff.get(i);
- // make sure this always stays hidden
- alwaysOnActionSets.remove(desc);
- alwaysOffActionSets.add(desc);
- }
-
- visibleActionSets.clear();
- int newSize = newArray.length;
- for (int i = 0; i < newSize; i ++) {
- visibleActionSets.add(newArray[i]);
- }
-}
-/**
- * Return the active fast view or null if there are no
- * fast views or if there are all minimized.
- */
-public IViewReference getActiveFastView() {
- return activeFastView;
-}
-/**
- * Sets the active fast view. If a different fast view is already open,
- * it shrinks equally <code>steps</code> times before disappearing
- * completely. Then, <code>view</code> becomes active and is shown.
- */
-/*package*/ void setActiveFastView(IViewReference ref, int steps) {
- if (activeFastView == ref)
- return;
-
- if (activeFastView != null)
- previousActiveFastView = activeFastView;
-
- if (activeFastView != null) {
- ViewPane pane = getPane(activeFastView);
- if (pane.isZoomed()) {
- presentation.zoomOut();
- }
- hideFastView(activeFastView, steps);
- }
- activeFastView = ref;
- if (activeFastView != null) {
- showFastView(activeFastView);
- }
-}
-/**
- * Sets the active fast view.
- */
-/*package*/ void setActiveFastView(IViewReference ref) {
- setActiveFastView(ref, FASTVIEW_HIDE_STEPS);
-}
-/**
- * Sets the visibility of all fast view pins.
- */
-private void setAllPinsVisible(boolean visible) {
- Iterator iter = fastViews.iterator();
- while (iter.hasNext()) {
- ViewPane pane = getPane((IViewReference)iter.next());
- pane.setFast(visible);
- }
-}
-/**
- * Sets the selection for the shortcut bar icon representing the givevn fast view.
- */
-private void setFastViewIconSelection(IViewReference ref, boolean selected) {
- WorkbenchWindow window = (WorkbenchWindow)page.getWorkbenchWindow();
- ToolBar bar = window.getShortcutBar().getControl();
- ToolItem[] items = bar.getItems();
- for(int i=0; i<items.length; i++) {
- if (items[i].getData(ShowFastViewContribution.FAST_VIEW) == ref) {
- items[i].setSelection(selected);
- }
- }
-}
-/**
- * Sets the new wizard actions for the page.
- * This is List of Strings.
- */
-public void setNewWizardActionIds(ArrayList newList ) {
- newWizardActionIds = newList;
-}
-/**
- * Sets the perspective actions for this page.
- * This is List of Strings.
- */
-public void setPerspectiveActionIds(ArrayList list) {
- perspectiveActionIds = list;
-}
-/**
- * Sets the show view actions for the page.
- * This is List of Strings.
- */
-public void setShowViewActionIds(ArrayList list) {
- showViewActionIds = list;
-}
-/**
- * Sets the toolbar layout for this perspective.
- */
-public void setToolBarLayout(CoolBarLayout layout) {
- toolBarLayout = layout;
-}
-/**
- * @see IWorkbenchPage
- * Note: The page is expected to update action bars.
- */
-public void showActionSet(String id) {
- ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
- IActionSetDescriptor desc = reg.findActionSet(id);
- if (alwaysOffActionSets.contains(desc))
- return;
- if (desc != null && !visibleActionSets.contains(desc))
- visibleActionSets.add(desc);
-}
-/**
- * Show the editor area if not visible
- */
-protected void showEditorArea() {
- if (isEditorAreaVisible())
- return;
-
- // Enable the editor area now that it will be made
- // visible and can accept keyboard focus again.
- if (editorArea.getControl() != null)
- editorArea.getControl().setEnabled(true);
-
- // Replace the part holder with the editor area.
- presentation.getLayout().replace(editorHolder, editorArea);
- editorHolder = null;
-}
-/**
- * Shows a fast view.
- */
-void showFastView(IViewReference ref) {
- // Get pane.
- ViewPane pane = getPane(ref);
-
- // Create the control first
- Control ctrl = pane.getControl();
- if(ctrl == null) {
- pane.createControl(getClientComposite());
- ctrl = pane.getControl();
- }
-
- // Show pane fast.
- ctrl.setEnabled(true); // Add focus support.
- Composite parent = ctrl.getParent();
- Rectangle bounds = getFastViewBounds(ref);
-
- pane.setBounds(bounds);
- pane.moveAbove(null);
- pane.setFocus();
-
- // Show the Sash to enable right side resize
- if (fastViewSash == null) {
- fastViewSash = new Sash(parent, SWT.VERTICAL);
- fastViewSash.addPaintListener(paintListener);
- fastViewSash.addFocusListener(new FocusListener() {
- public void focusGained(FocusEvent e) {
- fastViewSash.removePaintListener(paintListener);
- }
- public void focusLost(FocusEvent e) {
- fastViewSash.addPaintListener(paintListener);
- }
- });
- fastViewSash.addSelectionListener(selectionListener);
- }
- pane.setFastViewSash(fastViewSash);
- fastViewSash.setBounds(bounds.width - SASH_SIZE, bounds.y, SASH_SIZE, bounds.height - SASH_SIZE);
- fastViewSash.moveAbove(null);
-
- setFastViewIconSelection(ref, true);
-}
-/**
- * See IWorkbenchPage.
- */
-public IViewPart showView(String viewID)
- throws PartInitException
-{
- ViewFactory factory = getViewFactory();
- IViewReference ref = factory.createView(viewID);
- IViewPart part = (IViewPart)ref.getPart(false);
- if(part == null) {
- IStatus status = factory.restoreView(ref);
- if(status.getSeverity() == IStatus.ERROR) {
- if(status.getException() instanceof PartInitException)
- throw (PartInitException)status.getException();
- else
- throw new PartInitException(status);
- }
- else //No error so the part has been created
- part = (IViewPart)ref.getPart(false);
- }
- ViewSite site = (ViewSite)part.getSite();
- ViewPane pane = (ViewPane)site.getPane();
-
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- int openViewMode = store.getInt(IPreferenceConstants.OPEN_VIEW_MODE);
- if (presentation.hasPlaceholder(viewID)) {
- presentation.addPart(pane);
- } else if (openViewMode == IPreferenceConstants.OVM_EMBED) {
- presentation.addPart(pane);
- /*
- * Detached window no longer supported - remove when confirmed
- *
- * } else if (openViewMode == IPreferenceConstants.OVM_FLOAT && presentation.canDetach()) {
- * presentation.addDetachedPart(pane);
- */
- } else {
- showFastView(ref);
- addFastView(ref);
- //Refresh the part as there might have been an error when showing
- }
- return part;
-}
-/**
- * Toggles the visibility of a fast view. If the view is active it
- * is deactivated. Otherwise, it is activated.
- */
-public void toggleFastView(IViewReference ref) {
- if (ref == activeFastView) {
- setActiveFastView(null);
- } else {
- setActiveFastView(ref);
- }
-}
-/**
- * Returns the oldPartID.
- * @return String
- */
-public String getOldPartID() {
- return oldPartID;
-}
-
-/**
- * Sets the oldPartID.
- * @param oldPartID The oldPartID to set
- */
-public void setOldPartID(String oldPartID) {
- this.oldPartID = oldPartID;
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveContributionItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveContributionItem.java
deleted file mode 100644
index 77528a8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveContributionItem.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * This contribution item creates a menu to open perspectives within
- * a workbench window.
- */
-public class PerspectiveContributionItem extends ContributionItem {
- private static final Image image = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_PAGE).createImage();
- private static final Image hotImage = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_PAGE_HOVER).createImage();
-
- private ToolItem widget = null;
- private ToolBar parentWidget = null;
- private MenuManager menuMgr = null;
-
- /**
- * Creates a new contribution item from the given action.
- * The id of the action is used as the id of the item.
- */
- public PerspectiveContributionItem(IWorkbenchWindow window) {
- super();
- menuMgr = new MenuManager();
- menuMgr.add(new ChangeToPerspectiveMenu(window));
- }
-
- /* (non-Javadoc)
- * Method declared on IContributionItem.
- */
- public void fill(ToolBar parent, int index) {
- if (widget == null && parent != null) {
- parentWidget = parent;
- if (index >= 0)
- widget = new ToolItem(parent, SWT.PUSH, index);
- else
- widget = new ToolItem(parent, SWT.PUSH);
- widget.setToolTipText(WorkbenchMessages.getString("PerspectiveContributionItem.toolTip")); //$NON-NLS-1$
- widget.setImage(image);
- widget.setHotImage(hotImage);
- widget.setData(this);
- widget.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- menuMgr.update(true);
- popUpMenu(event, menuMgr.createContextMenu(parentWidget));
- }
- });
- }
- }
-
- /**
- * Pop up the supplied menu at the point where the event occured.
- */
- private void popUpMenu(SelectionEvent event, Menu menu) {
- Point pt = new Point(event.x, event.y);
- pt = parentWidget.toDisplay(pt);
- menu.setLocation(pt.x, pt.y);
- menu.setVisible(true);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveHistory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveHistory.java
deleted file mode 100644
index b773f5a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveHistory.java
+++ /dev/null
@@ -1,127 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.ui.*;
-
-/**
- * This is used to store the most recently used (MRU) list
- * of perspectives for the entire workbench.
- */
-public class PerspectiveHistory {
-
- private static final int DEFAULT_DEPTH = 50;
-
- private ArrayList shortcuts;
- private IPerspectiveRegistry reg;
- private ListenerList listeners = new ListenerList();
-
- public PerspectiveHistory(IPerspectiveRegistry reg) {
- this.shortcuts = new ArrayList(DEFAULT_DEPTH);
- this.reg = reg;
- }
-
- public void addListener(IPropertyListener l) {
- listeners.add(l);
- }
-
- public void removeListener(IPropertyListener l) {
- listeners.remove(l);
- }
-
- private void fireChange() {
- Object[] array = listeners.getListeners();
- for (int i = 0; i < array.length; i++) {
- IPropertyListener element = (IPropertyListener)array[i];
- element.propertyChanged(this, 0);
- }
- }
-
- public IStatus restoreState(IMemento memento) {
- IMemento [] children = memento.getChildren("desc"); //$NON-NLS-1$
- for (int i = 0; i < children.length && i < DEFAULT_DEPTH; i++) {
- IPerspectiveDescriptor desc =
- reg.findPerspectiveWithId(children[i].getID());
- if (desc != null)
- shortcuts.add(desc);
- }
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
- }
-
- public IStatus saveState(IMemento memento) {
- Iterator iter = shortcuts.iterator();
- while (iter.hasNext()) {
- IPerspectiveDescriptor desc = (IPerspectiveDescriptor)iter.next();
- memento.createChild("desc", desc.getId()); //$NON-NLS-1$
- }
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
- }
-
- public void add(String id) {
- IPerspectiveDescriptor desc = reg.findPerspectiveWithId(id);
- if (desc != null)
- add(desc);
- }
-
- public void add(IPerspectiveDescriptor desc) {
- // Avoid duplicates
- if (shortcuts.contains(desc))
- return;
-
- // If the shortcut list will be too long, remove oldest ones
- int size = shortcuts.size();
- int preferredSize = DEFAULT_DEPTH;
- while (size >= preferredSize) {
- size--;
- shortcuts.remove(size);
- }
-
- // Insert at top as most recent
- shortcuts.add(0, desc);
- fireChange();
- }
-
- public void refreshFromRegistry() {
- boolean change = false;
-
- Iterator iter = shortcuts.iterator();
- while (iter.hasNext()) {
- IPerspectiveDescriptor desc = (IPerspectiveDescriptor)iter.next();
- if (reg.findPerspectiveWithId(desc.getId()) == null) {
- iter.remove();
- change = true;
- }
- }
-
- if (change)
- fireChange();
- }
-
- /**
- * Copy the requested number of items from the history into
- * the destination list at the given index.
- *
- * @param dest destination list to contain the items
- * @param destStart index in destination list to start copying items at
- * @param count number of items to copy from history
- * @return the number of items actually copied
- */
- public int copyItems(List dest, int destStart, int count) {
- int itemCount = count;
- if (itemCount > shortcuts.size())
- itemCount = shortcuts.size();
-
- for (int i = 0; i < itemCount; i++)
- dest.add(destStart + i, shortcuts.get(i));
-
- return itemCount;
- }
-}
-
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
deleted file mode 100644
index 28b361f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveListenerList.java
+++ /dev/null
@@ -1,116 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * Perspective listener list.
- */
-public class PerspectiveListenerList {
- private ListenerList listeners = new ListenerList();
-/**
- * PerspectiveListenerList constructor comment.
- */
-public PerspectiveListenerList() {
- super();
-}
-/**
- * Adds an IInternalPerspectiveListener to the perspective service.
- */
-public void addPerspectiveListener(IInternalPerspectiveListener l) {
- listeners.add(l);
-}
-/**
- * Notifies the listener that a perspective has been activated.
- */
-public void firePerspectiveActivated(final IWorkbenchPage page, final IPerspectiveDescriptor perspective) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IInternalPerspectiveListener l = (IInternalPerspectiveListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.perspectiveActivated(page, perspective);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePerspectiveListener(l);
- }
- });
- }
-}
-/**
- * Notifies the listener that a perspective has been changed.
- */
-public void firePerspectiveChanged(final IWorkbenchPage page, final IPerspectiveDescriptor perspective, final String changeId) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IInternalPerspectiveListener l = (IInternalPerspectiveListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.perspectiveChanged(page, perspective, changeId);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePerspectiveListener(l);
- }
- });
- }
-}
-/**
- * Notifies the listener that a perspective has been closed.
- */
-public void firePerspectiveClosed(final IWorkbenchPage page, final IPerspectiveDescriptor perspective) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IInternalPerspectiveListener l = (IInternalPerspectiveListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.perspectiveClosed(page, perspective);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePerspectiveListener(l);
- }
- });
- }
-}
-/**
- * Notifies the listener that a perspective has been opened.
- */
-public void firePerspectiveOpened(final IWorkbenchPage page, final IPerspectiveDescriptor perspective) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IInternalPerspectiveListener l = (IInternalPerspectiveListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.perspectiveOpened(page, perspective);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePerspectiveListener(l);
- }
- });
- }
-}
-/**
- * Removes an IInternalPerspectiveListener from the perspective service.
- */
-public void removePerspectiveListener(IInternalPerspectiveListener l) {
- listeners.remove(l);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveListenerListOld.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveListenerListOld.java
deleted file mode 100644
index 96ecd28..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectiveListenerListOld.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.ui.*;
-
-/**
- * Perspective listener list.
- */
-public class PerspectiveListenerListOld {
- private ListenerList listeners = new ListenerList();
-/**
- * PerspectiveListenerList constructor comment.
- */
-public PerspectiveListenerListOld() {
- super();
-}
-/**
- * Adds an IPerspectiveListener to the perspective service.
- */
-public void addPerspectiveListener(IPerspectiveListener l) {
- listeners.add(l);
-}
-/**
- * Notifies the listener that a perspective has been activated.
- */
-public void firePerspectiveActivated(final IWorkbenchPage page, final IPerspectiveDescriptor perspective) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IPerspectiveListener l = (IPerspectiveListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.perspectiveActivated(page, perspective);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePerspectiveListener(l);
- }
- });
- }
-}
-/**
- * Notifies the listener that a perspective has been changed.
- */
-public void firePerspectiveChanged(final IWorkbenchPage page, final IPerspectiveDescriptor perspective, final String changeId) {
- Object [] array = listeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IPerspectiveListener l = (IPerspectiveListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.perspectiveChanged(page, perspective, changeId);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePerspectiveListener(l);
- }
- });
- }
-}
-/**
- * Removes an IPerspectiveListener from the perspective service.
- */
-public void removePerspectiveListener(IPerspectiveListener l) {
- listeners.remove(l);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectivePresentation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectivePresentation.java
deleted file mode 100644
index e25830d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PerspectivePresentation.java
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PinEditorAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PinEditorAction.java
deleted file mode 100644
index d2098ca..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PinEditorAction.java
+++ /dev/null
@@ -1,74 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.ui.*;
-
-public class PinEditorAction extends ActiveEditorAction {
-
- private IWorkbenchWindow window;
- private boolean visible = false;
-
-/**
- * Creates a PinEditorAction.
- */
-protected PinEditorAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.getString("PinEditorAction.text"), window); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("PinEditorAction.toolTip")); //$NON-NLS-1$
- setId("org.eclipse.ui.internal.PinEditorAction"); //$NON-NLS-1$
- this.window = window;
-// WorkbenchHelp.setHelp(this, new Object[] {IHelpContextIds.SAVE_ACTION});
-}
-/**
- * Returns true if the action should be visible in the toolbar or menu.
- */
-public boolean getVisible() {
- return visible;
-}
-/**
- * Sets if the action should be visible or not.
- */
-public void setVisible(boolean visible) {
- this.visible = visible;
-}
-/**
- * @see Action#run()
- */
-public void run() {
- IEditorPart editor = getActiveEditor();
- ((EditorSite)editor.getEditorSite()).setReuseEditor(!isChecked());
-}
-/**
- * @see ActiveEdirorAction#updateState()
- */
-protected void updateState() {
- if(window == null) {
- setChecked(false);
- setEnabled(false);
- return;
- }
- IWorkbenchPage page = window.getActivePage();
- if(page == null) {
- setChecked(false);
- setEnabled(false);
- return;
- }
- IEditorPart editor = getActiveEditor();
- boolean enabled = editor != null;
- setEnabled(enabled);
- if(enabled) {
- EditorSite site = (EditorSite)editor.getEditorSite();
- EditorPane pane = (EditorPane)site.getPane();
- pane.setPinEditorAction(this);
- setChecked(!(site).getReuseEditor());
- } else {
- setChecked(false);
- }
-}
-}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlaceholderFolderLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlaceholderFolderLayout.java
deleted file mode 100644
index 2839acb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlaceholderFolderLayout.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import org.eclipse.ui.IPlaceholderFolderLayout;
-import org.eclipse.ui.internal.registry.*;
-
-/**
- * This layout is used to define the initial set of placeholders
- * in a placeholder.
- * <p>
- * Views are added to the placeholder by ID. This id is used to identify
- * a view descriptor in the view registry, and this descriptor is used to
- * instantiate the IViewPart.
- * </p>
- */
-public class PlaceholderFolderLayout implements IPlaceholderFolderLayout{
- private PageLayout pageLayout;
- private ContainerPlaceholder placeholder;
-
- public PlaceholderFolderLayout(PageLayout pageLayout, ContainerPlaceholder folder) {
- super();
- this.placeholder = folder;
- this.pageLayout = pageLayout;
- }
- /**
- * @see IPlaceholderFolderLayout
- */
- public void addPlaceholder(String viewId) {
- if (pageLayout.checkPartInLayout(viewId))
- return;
-
- // Get the view's label.
- IViewRegistry reg = WorkbenchPlugin.getDefault().getViewRegistry();
- IViewDescriptor desc = reg.find(viewId);
- if (desc == null) {
- // cannot safely open the dialog so log the problem
- WorkbenchPlugin.log("Unable to find view label: " + viewId);//$NON-NLS-1$
- return;
- }
-
- // Create the placeholder.
- LayoutPart newPart = new PartPlaceholder(viewId);
-
- linkPartToPageLayout(viewId, newPart);
-
- // Add it to the placeholder layout.
- placeholder.add(newPart);
- }
- /**
- * Inform the page layout of the new part created
- * and the placeholder the part belongs to.
- */
- private void linkPartToPageLayout(String viewId, LayoutPart newPart) {
- pageLayout.setRefPart(viewId, newPart);
- pageLayout.setFolderPart(viewId, placeholder);
- newPart.setContainer(placeholder);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlatformInfo.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlatformInfo.java
deleted file mode 100644
index 80a7b98..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlatformInfo.java
+++ /dev/null
@@ -1,196 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.boot.*;
-import org.eclipse.ui.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import java.io.*;
-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.*;
-
-/**
- * The platform info class;
- * <p>
- * The information within this object is obtained from the platform "ini" file".
- * This file resides within an install configurations directory and must be a
- * standard java property file. Here are the properties as read from the file:
- * </p>
- * <p>
- * <ul>
- * <li>brief platform name - <code>"name"</code> entry</li>
- * <li>full platform name - <code>"detailedName"</code> entry</li>
- * <li>app name - <code>"appName"</code> entry sets the application name
- * (on Motif, for example, this can be used to set the name used for resource lookup)</li>
- * <li>version number - <code>"version"</code> entry</li>
- * <li>platform build id - <code>"buildID"</code> entry</li>
- * <li>copyright notice - <code>"copyright"</code> entry</li>
- * <li>platform URL - <code>"platformURL"</code> entry</li>
- * <li>splash image - <code>"splashImage"</code> entry contains file name</li>
- * <li>about image - <code>"aboutImage"</code> entry contains file name</li>
- * <li>welcome image - <code>"welcomeImage"</code> entry contains file name</li>
- * <li>welcome page - <code>"welcomePageURL"</code> entry contains URL</li>
- * <li>platform image - <code>"image"</code> entry contains file name</li>
- * <li>default perspective id - <code>"defaultPerspectiveId"</code> entry</li>
- * <li>perspective shortcuts - <code>"perspectiveShortcut.[x]"</code> entry</li>
- * </ul>
- * </p>
- */
-public class PlatformInfo extends ConfigurationInfo {
-
- // -- variables
- private String copyright;
- private String buildID;
- private String version;
- private String name;
- private String appName;
- private String platformURL;
- private String detailedName;
-
-/**
- * Create a new instance of the platform info
- */
-public PlatformInfo() {
- super("platform.ini", "platform.properties"); //$NON-NLS-1$ //$NON-NLS-2$
-}
-
-/**
- * Returns the build id for this platform.
- * <p>
- * The build id represents any builds or updates made in support of a major
- * release. Development teams typically may produce many builds only a subset
- * of which get shipped to customers.
- * </p>
- *
- * @return the build id
- */
-public String getBuildID() {
- return (buildID == null ? "" : buildID); //$NON-NLS-1$
-}
-/**
- * Returns the copyright notice for this platform.
- * <p>
- * The copyright notice is typically shown in the platform's "about" dialog.
- * </p>
- *
- * @return the copyright notice
- */
-public String getCopyright() {
- return (copyright == null ? "" : copyright); //$NON-NLS-1$
-}
-/**
- * Returns the full name of this platform.
- * <p>
- * The full name also includes additional information about the particular
- * variant of the platform.
- * </p>
- *
- * @return the full name of this platform
- */
-public String getDetailedName() {
- return (detailedName == null ? "" : detailedName); //$NON-NLS-1$
-}
-/**
- * Returns the name of this platform.
- *
- * @return the name of this platform
- */
-public String getName() {
- return (name == null ? "" : name); //$NON-NLS-1$
-}
-/**
- * Returns the URL for this platform's main page on the world wide web.
- *
- * @return the platform URL
- */
-public String getplatformURL() {
- return (platformURL == null ? "" : platformURL); //$NON-NLS-1$
-}
-/**
- * Returns the version number of this platform.
- * <p>
- * The recommended format is <it>X</it>.<it>Y</it> where <it>X</it> and
- * <it>Y</it> are the major and minor version numbers, respectively; for
- * example: 5.02. However, arbitrary strings are allowed.
- * </p>
- *
- * @return the platform version number
- */
-public String getVersion() {
- return (version == null ? "" : version); //$NON-NLS-1$
-}
-
-
-/**
- * Read the ini file.
- */
-protected void readINIFile(URL iniURL, URL propertiesURL) throws CoreException {
-
- Properties ini = new Properties();
- InputStream is = null;
- try {
- is = iniURL.openStream();
- ini.load(is);
- }
- catch (IOException e) {
- reportINIFailure(e, "Cannot read platform info file " + iniURL);//$NON-NLS-1$
- return;
- }
- finally {
- try {
- if (is != null)
- is.close();
- } catch (IOException e) {}
- }
-
- PropertyResourceBundle bundle = null;
-
- if (propertiesURL != null) {
- InputStream bundleStream = null;
- try {
- bundleStream = propertiesURL.openStream();
- bundle = new PropertyResourceBundle(bundleStream);
- }
- catch (IOException e) {
- reportINIFailure(e, "Cannot read platform properties file " + propertiesURL);//$NON-NLS-1$
- bundle = null;
- }
- finally {
- try {
- if (bundleStream != null)
- bundleStream.close();
- } catch (IOException e) {}
- }
- }
-
- if ((copyright = (String) ini.get("copyright") ) == null)//$NON-NLS-1$
- reportINIFailure(null, "Platform info file "+iniURL+" missing 'copyright'");//$NON-NLS-2$//$NON-NLS-1$
- copyright = getResourceString(copyright, bundle);
-
- if ((name = (String) ini.get("name") ) == null)//$NON-NLS-1$
- reportINIFailure(null, "Platform info file "+iniURL+" missing 'name'");//$NON-NLS-2$//$NON-NLS-1$
- name = getResourceString(name, bundle);
-
- if ((detailedName = (String) ini.get("detailedName") ) == null)//$NON-NLS-1$
- reportINIFailure(null, "Platform info file "+iniURL+" missing 'detailedName'");//$NON-NLS-2$//$NON-NLS-1$
- detailedName = getResourceString(detailedName, bundle);
-
- if ((version = (String) ini.get("version") ) == null)//$NON-NLS-1$
- reportINIFailure(null, "Platform info file "+iniURL+" missing 'version'");//$NON-NLS-2$//$NON-NLS-1$
-
- if ((buildID = (String) ini.get("buildID") ) == null)//$NON-NLS-1$
- reportINIFailure(null, "Platform info file "+iniURL+" missing 'buildID'");//$NON-NLS-2$//$NON-NLS-1$
-
- if ((platformURL = (String) ini.get("platformURL") ) == null)//$NON-NLS-1$
- reportINIFailure(null, "Platform info file "+iniURL+" missing 'platformURL'");//$NON-NLS-2$//$NON-NLS-1$
- platformURL = getResourceString(platformURL, bundle);
-
-}
-
-}
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
deleted file mode 100644
index ea04351..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PlatformUIPreferenceListener.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.ui.*;
-
-/**
- * The PlatformUIPreferenceListener is a class that listens to
- * changes in the preference store and propogates the change
- * for any special cases that require updating of other
- * values within the workbench.
- */
-public class PlatformUIPreferenceListener implements IPropertyChangeListener {
-
- /**
- * @see org.eclipse.core.runtime.Preferences.IPropertyChangeListener#propertyChange(PropertyChangeEvent)
- */
- public void propertyChange(PropertyChangeEvent event) {
- if (IPreferenceConstants
- .ENABLED_DECORATORS
- .equals(event.getProperty()))
- WorkbenchPlugin
- .getDefault()
- .getDecoratorManager()
- .restoreListeners();
-
- if (IWorkbenchPreferenceConstants
- .DEFAULT_PERSPECTIVE_ID
- .equals(event.getProperty())) {
- IWorkbench workbench = WorkbenchPlugin.getDefault().getWorkbench();
-
- String newValue =
- workbench.getPreferenceStore().getString(
- IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID);
-
- workbench.getPerspectiveRegistry().setDefaultPerspective(newValue);
- }
- }
-
-}
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
deleted file mode 100644
index 8801af0..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginAction.java
+++ /dev/null
@@ -1,285 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.core.internal.plugins.ConfigurationElement;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.*;
-
-/**
- * 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.
- *
- * 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
-{
- private IActionDelegate delegate;
- private SelectionEnabler enabler;
- private ISelection selection;
- private IConfigurationElement configElement;
- private String runAttribute;
- private static int actionCount = 0;
-
- //a boolean that returns whether or not this action
- //is Adaptable - i.e. is defined on a resource type
- boolean isAdaptableAction = false;
- boolean adaptableNotChecked = true;
-
- /**
- * PluginAction constructor.
- */
- public PluginAction(IConfigurationElement actionElement, String runAttribute,String definitionId) {
- super();
-
- // Create unique action id.
- setId("PluginAction." + Integer.toString(actionCount)); //$NON-NLS-1$
- ++actionCount;
- setActionDefinitionId(definitionId);
-
- // Store arguments.
- this.configElement = actionElement;
- this.runAttribute = runAttribute;
-
- // Read enablement declaration.
- if (configElement.getAttribute(PluginActionBuilder.ATT_ENABLES_FOR) != null)
- this.enabler = new SelectionEnabler(configElement);
- else {
- IConfigurationElement [] kids = configElement.getChildren(PluginActionBuilder.TAG_ENABLEMENT);
- if (kids.length > 0)
- this.enabler = new SelectionEnabler(configElement);
- }
-
- // Give enabler or delegate a chance to adjust enable state
- selectionChanged(new StructuredSelection());
- }
-
- /**
- * Creates the delegate and refreshes its enablement.
- */
- protected final void createDelegate() {
- if (delegate == null) {
- Object obj = null;
- try {
- obj = WorkbenchPlugin.createExtension(configElement, runAttribute);
- delegate = initDelegate(obj);
- refreshEnablement();
- } catch (CoreException e) {
- WorkbenchPlugin.log("Could not create action.", e.getStatus()); //$NON-NLS-1$
- return;
- }
- }
- }
-
- /**
- * Initialize an action delegate.
- * Subclasses may override this.
- */
- protected IActionDelegate initDelegate(Object obj)
- throws WorkbenchException
- {
- if (obj instanceof IActionDelegate)
- return (IActionDelegate)obj;
- else
- throw new WorkbenchException("Action must implement IActionDelegate"); //$NON-NLS-1$
- }
-
- /**
- * Return the delegate action or null if not created yet
- */
- 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
- IPluginDescriptor plugin =
- configElement.getDeclaringExtension().getDeclaringPluginDescriptor();
- return plugin.isPluginActivated();
- }
-
- /**
- * Return whether or not this action could have been registered
- * due to an adaptable - i.e. it is a resource type.
- */
- private boolean hasAdaptableType() {
- if (adaptableNotChecked) {
- Object parentConfig = ((ConfigurationElement) configElement).getParent();
- String typeName = null;
- if(parentConfig != null && parentConfig instanceof IConfigurationElement)
- typeName = ((IConfigurationElement) parentConfig).getAttribute("objectClass"); //$NON-NLS-1$
-
- //See if this is typed at all first
- if(typeName == null){
- adaptableNotChecked = false;
- return false;
- }
- Class resourceClass = IResource.class;
-
- if (typeName.equals(resourceClass.getName())) {
- isAdaptableAction = true;
- adaptableNotChecked = false;
- return isAdaptableAction;
- }
- Class[] children = resourceClass.getDeclaredClasses();
- for (int i = 0; i < children.length; i++) {
- if (children[i].getName().equals(typeName)) {
- isAdaptableAction = true;
- adaptableNotChecked = false;
- return isAdaptableAction;
- }
- }
- adaptableNotChecked = false;
- }
- return isAdaptableAction;
- }
-
- /**
- * Refresh the action enablement.
- */
- protected void refreshEnablement() {
- if (enabler != null) {
- setEnabled(enabler.isEnabledForSelection(selection));
- }
- if (delegate != null) {
- delegate.selectionChanged(this, selection);
- }
- }
-
- /**
- * Runs the action.
- */
- public void run() {
- runWithEvent(null);
- }
-
- /* (non-Javadoc)
- * Method declared on IActionDelegate2.
- */
- public void runWithEvent(Event event) {
- // this message dialog is problematic.
- if (delegate == null) {
- // High noon to load the delegate.
- createDelegate();
- if (delegate == null) {
- MessageDialog
- .openInformation(
- Display.getDefault().getActiveShell(),
- WorkbenchMessages.getString("Information"), //$NON-NLS-1$
- WorkbenchMessages.getString("PluginAction.operationNotAvailableMessage")); //$NON-NLS-1$
- return;
- }
- if (!isEnabled()) {
- MessageDialog
- .openInformation(
- Display.getDefault().getActiveShell(),
- WorkbenchMessages.getString("Information"), //$NON-NLS-1$
- WorkbenchMessages.getString("PluginAction.disabledMessage")); //$NON-NLS-1$
- return;
- }
- }
- if (event != null && delegate instanceof IActionDelegateWithEvent) {
- ((IActionDelegateWithEvent) delegate).runWithEvent(this, event);
- }
- else {
- 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.
- */
- public void selectionChanged(ISelection newSelection) {
- // Update selection.
- selection = newSelection;
- if (selection == null)
- selection = StructuredSelection.EMPTY;
- if (hasAdaptableType())
- selection = getResourceAdapters(selection);
-
- // 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.
- */
- 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.
- */
- public void selectionChanged(IWorkbenchPart part, ISelection sel) {
- selectionChanged(sel);
- }
-
- /**
- * Set the delegate action or null if not created yet
- */
- protected void setDelegate(IActionDelegate actionDelegate) {
- this.delegate = actionDelegate;
- }
-
- /**
- * Get a new selection with the resource adaptable version
- * of this selection
- */
- private ISelection getResourceAdapters(ISelection sel) {
- if (sel instanceof IStructuredSelection) {
- List adaptables = new ArrayList();
- Object[] elements = ((IStructuredSelection)sel).toArray();
- for (int i = 0; i < elements.length; i++) {
- Object originalValue = elements[i];
- if (originalValue instanceof IAdaptable) {
- Object adaptedValue = ((IAdaptable)originalValue).getAdapter(IResource.class);
- if (adaptedValue != null)
- adaptables.add(adaptedValue);
- }
- }
- return new StructuredSelection(adaptables);
- } else {
- return sel;
- }
- }
-
-}
\ No newline at end of file
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
deleted file mode 100644
index 4e6c1cb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionBuilder.java
+++ /dev/null
@@ -1,322 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.*;
-import java.util.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.internal.registry.RegistryReader;
-
-/**
- * This class contains shared functionality for reading
- * action contributions from plugins into workbench parts (both editors and views).
- */
-public abstract class PluginActionBuilder extends RegistryReader {
- protected String targetID;
- protected String targetContributionTag;
- protected List cache;
-
- public static final String TAG_MENU="menu";//$NON-NLS-1$
- public static final String TAG_ACTION="action";//$NON-NLS-1$
- public static final String TAG_SEPARATOR="separator";//$NON-NLS-1$
- public static final String TAG_GROUP_MARKER="groupMarker";//$NON-NLS-1$
- public static final String TAG_FILTER="filter";//$NON-NLS-1$
- public static final String TAG_VISIBILITY="visibility";//$NON-NLS-1$
- public static final String TAG_ENABLEMENT="enablement";//$NON-NLS-1$
- public static final String TAG_SELECTION="selection";//$NON-NLS-1$
-
- public static final String ATT_TARGET_ID = "targetID";//$NON-NLS-1$
- public static final String ATT_ID="id";//$NON-NLS-1$
- public static final String ATT_LABEL="label";//$NON-NLS-1$
- public static final String ATT_ENABLES_FOR="enablesFor";//$NON-NLS-1$
- public static final String ATT_NAME="name";//$NON-NLS-1$
- public static final String ATT_PATH="path";//$NON-NLS-1$
-/**
- * The default constructor.
- */
-public PluginActionBuilder() {
-}
-/**
- * Adds a group to a contribution manager.
- * Subclasses may override.
- */
-protected void addGroup(IContributionManager mgr, String name) {
- mgr.add(new Separator(name));
-}
-/**
- * Contributes submenus and/or actions into the provided menu and tool bar managers.
- */
-public void contribute(IMenuManager menu, IToolBarManager toolbar, boolean appendIfMissing) {
- if (cache == null)
- return;
- for (int i = 0; i < cache.size(); i++) {
- Object obj = cache.get(i);
- if (obj instanceof IConfigurationElement) {
- if (menu != null) {
- IConfigurationElement menuElement = (IConfigurationElement) obj;
- contributeMenu(menuElement, menu, appendIfMissing);
- }
- } else if (obj instanceof ActionDescriptor) {
- ActionDescriptor ad = (ActionDescriptor) obj;
- if (menu != null)
- contributeMenuAction(ad, menu, appendIfMissing);
- if (toolbar != null)
- contributeToolbarAction(ad, toolbar, appendIfMissing);
- }
- }
-}
-/**
- * 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(ATT_ID);
- String label = menuElement.getAttribute(ATT_LABEL);
- String path = menuElement.getAttribute(ATT_PATH);
- if (label == null) {
- WorkbenchPlugin.log("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) {
- WorkbenchPlugin.log("Invalid Menu Extension (Path is invalid): " + id);//$NON-NLS-1$
- return;
- }
- }
-
- // Find reference group.
- if (group == null)
- group = IWorkbenchActionConstants.MB_ADDITIONS;
- IContributionItem sep = parent.find(group);
- if (sep==null) {
- if (appendIfMissing)
- addGroup(parent, group);
- else {
- WorkbenchPlugin.log("Invalid Menu Extension (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, id);
-
- // Create separators.
- IConfigurationElement[] children = menuElement.getChildren();
- for (int i = 0; i < children.length; i++) {
- String childName = children[i].getName();
- if(childName.equals(TAG_SEPARATOR)) {
- contributeSeparator(newMenu, children[i]);
- } else if(childName.equals(TAG_GROUP_MARKER)) {
- contributeGroupMarker(newMenu, children[i]);
- }
- }
-
- // Add new menu
- try {
- insertAfter(parent, group, newMenu);
- } catch (IllegalArgumentException e) {
- WorkbenchPlugin.log("Invalid Menu Extension (Group is missing): " + id);//$NON-NLS-1$
- }
-}
-/**
- * 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) {
- WorkbenchPlugin.log("Invalid Menu Extension (Path 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)
- addGroup(parent, mgroup);
- else {
- WorkbenchPlugin.log("Invalid Menu Extension (Group is invalid): " + ad.getId());//$NON-NLS-1$
- return;
- }
- }
-
- // Add action.
- try {
- insertAfter(parent, mgroup, ad.getAction());
- } catch (IllegalArgumentException e) {
- WorkbenchPlugin.log("Invalid Menu Extension (Group 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(ATT_NAME);
- if (id == null || id.length() <= 0)
- return;
- IContributionItem sep = menu.find(id);
- if (sep != null)
- return;
- menu.add(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(ATT_NAME);
- if (id == null || id.length() <= 0)
- return;
- IContributionItem marker = menu.find(id);
- if (marker != null)
- return;
- menu.add(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 tpath = ad.getToolbarPath();
- String tgroup = ad.getToolbarGroup();
- if (tpath == null && tgroup == null)
- return;
-
- // 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("Invalid Toolbar Extension (Group is invalid): " + ad.getId());//$NON-NLS-1$
- return;
- }
- }
- // Add action to tool bar.
- try {
- insertAfter(toolbar, tgroup, ad.getAction());
- } catch (IllegalArgumentException e) {
- WorkbenchPlugin.log("Invalid Toolbar Extension (Group is missing): " + ad.getId());//$NON-NLS-1$
- }
-}
-/**
- * This factory method returns a new ActionDescriptor for the
- * configuration element. It should be implemented by subclasses.
- */
-protected abstract ActionDescriptor createActionDescriptor(IConfigurationElement element);
-/**
- * Returns the name of the part ID attribute that is expected
- * in the target extension.
- */
-protected String getTargetID(IConfigurationElement element) {
- String value=element.getAttribute(ATT_TARGET_ID);
- return value!=null? value : "???";//$NON-NLS-1$
-}
-/**
- * Inserts an action after another named contribution item.
- * Subclasses may override.
- */
-protected void insertAfter(IContributionManager mgr, String refId,
- IAction action)
-{
- insertAfter(mgr, refId, new ActionContributionItem(action));
-}
-/**
- * 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);
-}
-/**
- * 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;
- targetID = id;
- targetContributionTag = tag;
- IPluginRegistry registry = Platform.getPluginRegistry();
- readRegistry(registry, PlatformUI.PLUGIN_ID, extensionPoint);
-}
-/**
- * Implements abstract method to handle the provided XML element
- * in the registry.
- */
-protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
- if (tag.equals(ObjectActionContributorReader.TAG_OBJECT_CONTRIBUTION)) {
- // This builder is sometimes used to read the popup menu
- // extension point. Ignore all object contributions.
- return true;
- }
- if (tag.equals(targetContributionTag)) {
- String id = getTargetID(element);
- if (id == null || !id.equals(targetID)) {
- // This is not of interest to us - don't go deeper
- return true;
- }
- } else if (tag.equals(TAG_MENU)) {
- if (cache == null)
- cache = new ArrayList();
- cache.add(element);
- return true; // just cache the element - don't go into it
- } else if (tag.equals(TAG_ACTION)) {
- if (cache == null)
- cache = new ArrayList();
- cache.add(createActionDescriptor(element));
- return true; // just cache the action - don't go into
- } else {
- return false;
- }
-
- readElementChildren(element);
- return true;
-}
-}
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
deleted file mode 100644
index 095ab72..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSet.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.ui.internal.registry.*;
-import java.util.*;
-
-/**
- * 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 ArrayList pluginActions = new ArrayList(4);
-/**
- * PluginActionSet constructor comment.
- */
-public PluginActionSet(ActionSetDescriptor desc) {
- super();
- this.desc = desc;
-}
-/**
- * Adds one plugin action ref to the list.
- */
-public void addPluginAction(WWinPluginAction action) {
- pluginActions.add(action);
-}
-/**
- * Returns the list of plugin actions for the set.
- */
-public IAction[] getPluginActions() {
- IAction result[] = new IAction[pluginActions.size()];
- pluginActions.toArray(result);
- return result;
-}
-/**
- * Disposes of this action set.
- */
-public void dispose() {
- Iterator iter = pluginActions.iterator();
- while (iter.hasNext()) {
- WWinPluginAction action = (WWinPluginAction)iter.next();
- action.dispose();
- }
-}
-/**
- * Returns the config element.
- */
-public IConfigurationElement getConfigElement() {
- return desc.getConfigElement();
-}
-/**
- * Returns the underlying 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
- */
-public void init(IWorkbenchWindow window, IActionBars bars) {
- PluginActionSetBuilder builder = new PluginActionSetBuilder();
- builder.readActionExtensions(this, window, bars);
-}
-}
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
deleted file mode 100644
index 0921e8c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSetBuilder.java
+++ /dev/null
@@ -1,230 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.*;
-import java.util.*;
-
-/**
- * This builder reads the actions for an action set from the registry.
- */
-public class PluginActionSetBuilder extends PluginActionBuilder {
- public static final String TAG_ACTION_SET="actionSet";//$NON-NLS-1$
- public static final String ATT_PULLDOWN="pulldown";//$NON-NLS-1$
-
- private PluginActionSet actionSet;
- private IWorkbenchWindow window;
-/**
- * Constructs a new builder.
- */
-public PluginActionSetBuilder() {}
-/* (non-Javadoc)
- * Method defined in PluginActionBuilder.
- */
-/*
- * This implementation inserts the group into the action set additions group.
- */
-protected void addGroup(IContributionManager mgr, String name) {
- // Find the insertion point for this group.
- String actionSetId = actionSet.getDesc().getId();
-
- if (mgr instanceof CoolItemToolBarManager) {
- // In the coolbar case we need to create a CoolBarContributionItem
- // for the group if one does not already exist.
- CoolItemToolBarManager tBarMgr = (CoolItemToolBarManager)mgr;
- CoolBarManager cBarMgr = tBarMgr.getParentManager();
- IContributionItem cbItem = cBarMgr.find(actionSetId);
- if (cbItem == null) {
- IContributionItem refItem = findSubInsertionPoint(
- IWorkbenchActionConstants.MB_ADDITIONS, actionSetId, cBarMgr, true);
- // Add the CoolBarContributionItem to the CoolBarManager for this group.
- if (refItem == null) {
- cBarMgr.add(tBarMgr.getCoolBarItem());
- } else {
- cBarMgr.insertAfter(refItem.getId(), tBarMgr.getCoolBarItem());
- }
- }
- // Insert the group marker into the group, not the CoolBarmanager.
- ActionSetSeparator group = new ActionSetSeparator(name, actionSetId);
- tBarMgr.add(group);
- } else {
- 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);
- }
- }
-}
-/**
- * This factory method returns a new ActionDescriptor for the
- * configuration element.
- */
-protected ActionDescriptor createActionDescriptor(IConfigurationElement element) {
- String pulldown = element.getAttribute(ATT_PULLDOWN);
- ActionDescriptor desc = null;
- if (pulldown != null && pulldown.equals("true"))//$NON-NLS-1$
- 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;
-}
-/**
- * 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)
- return null;
-
- // 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.
- for (int nX = insertIndex + 1; nX < items.length; nX ++) {
- IContributionItem item = items[nX];
- 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];
-}
-public static IContributionItem findSubInsertionPoint(String startId, String sortId, CoolBarManager 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;
- }
- // look at each the items in each of the CoolBarContribution items
- if (insertIndex >= items.length) {
- insertIndex = 0;
- while (insertIndex < items.length) {
- CoolBarContributionItem item = (CoolBarContributionItem)items[insertIndex];
- IContributionItem foundItem = item.getToolBarManager().find(startId);
- if (foundItem != null)
- break;
- ++ insertIndex;
- }
- }
- if (insertIndex >= items.length)
- return null;
-
- // 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. This code
- // assumes action set contributions are done in alphabetical order.
- for (int nX = insertIndex + 1; nX < items.length; nX ++) {
- CoolBarContributionItem item = (CoolBarContributionItem)items[nX];
- if (item.getItems().length == 0) break;
- IContributionItem subItem = item.getItems()[0];
- if (subItem instanceof IActionSetContributionItem) {
- if (sortId != null) {
- String testId = ((IActionSetContributionItem)subItem).getActionSetId();
- if (sortId.compareTo(testId) < compareMetric)
- break;
- }
- insertIndex = nX;
- } else {
- break;
- }
- }
- // Return item.
- return items[insertIndex];
-}
-/*
- * Inserts one action after another. If there are any other extensions
- * for the same action the new action will be inserted into the group in
- * order of action set id.
- */
-protected void insertAfter(IContributionManager mgr, String refId,
- IContributionItem item)
-{
- String actionSetId = actionSet.getDesc().getId();
- 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$
- }
-}
-/**
- * Read the actions within a config element.
- */
-public void readActionExtensions(PluginActionSet set, IWorkbenchWindow window,
- IActionBars bars)
-{
- this.actionSet = set;
- this.window = window;
- readElements(new IConfigurationElement[] {set.getConfigElement()});
- if (cache != null) {
- contribute(bars.getMenuManager(), bars.getToolBarManager(), true);
- } else {
- WorkbenchPlugin.log("Action Set is empty: " + set.getDesc().getId());//$NON-NLS-1$
- }
-}
-/**
- * Implements abstract method to handle the provided XML element
- * in the registry.
- */
-protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
- if (tag.equals(TAG_ACTION_SET)) {
- readElementChildren(element);
- return true;
- }
- return super.readElement(element);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSetReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSetReader.java
deleted file mode 100644
index 37e800d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PluginActionSetReader.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.registry.*;
-import java.util.*;
-
-/**
- * Read the actions for an plugin action set.
- *
- * [Issue: There is some overlap with the class
- * PluginActionSetBuilder which should be reviewed
- * at a later time and maybe merged together]
- */
-public class PluginActionSetReader extends RegistryReader {
- private List cache = new ArrayList();
-/**
- * PluginActionSetReader constructor comment.
- */
-public PluginActionSetReader() {
- super();
-}
-/**
- * This factory method returns a new ActionDescriptor for the
- * configuration element.
- */
-protected LightweightActionDescriptor createActionDescriptor(IConfigurationElement element) {
- return new LightweightActionDescriptor(element);
-}
-/**
- * Return all the action descriptor within the set.
- */
-public LightweightActionDescriptor[] readActionDescriptors(ActionSetDescriptor actionSet) {
- readElements(new IConfigurationElement[] {actionSet.getConfigElement()});
- LightweightActionDescriptor[] actions = new LightweightActionDescriptor[cache.size()];
- cache.toArray(actions);
- return actions;
-}
-/**
- * @see RegistryReader
- */
-protected boolean readElement(IConfigurationElement element) {
- String tag = element.getName();
- if (tag.equals(PluginActionSetBuilder.TAG_ACTION_SET)) {
- readElementChildren(element);
- return true;
- }
- if (tag.equals(ObjectActionContributorReader.TAG_OBJECT_CONTRIBUTION)) {
- // This builder is sometimes used to read the popup menu
- // extension point. Ignore all object contributions.
- return true;
- }
- if (tag.equals(PluginActionSetBuilder.TAG_MENU)) {
- return true; // just cache the element - don't go into it
- }
- if (tag.equals(PluginActionSetBuilder.TAG_ACTION)) {
- cache.add(createActionDescriptor(element));
- return true; // just cache the action - don't go into
- }
-
- return false;
-}
-}
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
deleted file mode 100644
index 3b89e2b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/PopupMenuExtender.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import java.util.*;
-
-/**
- * This class extends a single popup menu
- */
-public class PopupMenuExtender implements IMenuListener
-{
- private String menuID;
- private MenuManager menu;
- private SubMenuManager menuWrapper;
- private ISelectionProvider selProvider;
- private IWorkbenchPart part;
- private List staticItems;
- private ViewerActionBuilder staticActionBuilder;
-/**
- * Construct a new menu extender.
- */
-public PopupMenuExtender(String id, MenuManager menu, ISelectionProvider prov, IWorkbenchPart part) {
- this.menuID = id;
- this.menu = menu;
- this.selProvider = prov;
- this.part = part;
- menu.addMenuListener(this);
- if (!menu.getRemoveAllWhenShown()) {
- menuWrapper = new SubMenuManager(menu);
- menuWrapper.setVisible(true);
- }
- readStaticActions();
-}
-/**
- * Contributes items registered for the object type(s) in
- * the current selection.
- */
-private void addObjectActions(IMenuManager mgr) {
- if (selProvider != null) {
- if (ObjectActionContributorManager.getManager()
- .contributeObjectActions(part, mgr, selProvider))
- mgr.add(new Separator());
- }
-}
-/**
- * Adds static items to the context menu.
- */
-private void addStaticActions(IMenuManager mgr) {
- if (staticActionBuilder != null)
- staticActionBuilder.contribute(mgr, null, true);
-}
-/**
- * Notifies the listener that the menu is about to be shown.
- */
-public void menuAboutToShow(IMenuManager mgr) {
- testForAdditions();
- if (menuWrapper != null) {
- mgr = menuWrapper;
- menuWrapper.removeAll();
- }
- addObjectActions(mgr);
- addStaticActions(mgr);
-}
-/**
- * Read static items for the context menu.
- */
-private void readStaticActions() {
- staticActionBuilder = new ViewerActionBuilder();
- if (!staticActionBuilder.readViewerContributions(menuID, selProvider, part))
- staticActionBuilder = null;
-}
-/**
- * Checks for the existance of an MB_ADDITIONS group.
- */
-private void testForAdditions() {
- IContributionItem item = menu.find(IWorkbenchActionConstants.MB_ADDITIONS);
- if (item == null) {
- WorkbenchPlugin.log("Context menu does not contain standard group for "//$NON-NLS-1$
- + "additions ("//$NON-NLS-1$
- + IWorkbenchActionConstants.MB_ADDITIONS
- + ")");//$NON-NLS-1$
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProblemImageProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProblemImageProvider.java
deleted file mode 100644
index 717ec90..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ProblemImageProvider.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.swt.widgets.Display;
-/**
- * Implementation of IMarkerImageProvider to provide the image
- * path names for problem markers.
- */
-public class ProblemImageProvider implements IMarkerImageProvider {
-/**
- * TaskImageProvider constructor comment.
- */
-public ProblemImageProvider() {
- super();
-}
-/**
- * Returns the relative path for the image
- * to be used for displaying an marker in the workbench.
- * This path is relative to the plugin location
- *
- * Returns <code>null</code> if there is no appropriate image.
- *
- * @param marker The marker to get an image path for.
- *
- * @see org.eclipse.jface.resource.FileImageDescriptor
- */
-public String getImagePath(IMarker marker) {
- String iconPath = "icons/full/";//$NON-NLS-1$
- if (isMarkerType(marker, IMarker.PROBLEM)) {
- switch (marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_WARNING)) {
- case IMarker.SEVERITY_ERROR:
- return iconPath + "obj16/error_tsk.gif";//$NON-NLS-1$
- case IMarker.SEVERITY_WARNING:
- return iconPath + "obj16/warn_tsk.gif";//$NON-NLS-1$
- case IMarker.SEVERITY_INFO:
- return iconPath + "obj16/info_tsk.gif";//$NON-NLS-1$
- }
- }
- return null;
-}
-/**
- * Returns whether the given marker is of the given type (either directly or indirectly).
- */
-private boolean isMarkerType(IMarker marker, String type) {
- try {
- return marker.isSubtypeOf(type);
- } catch (CoreException e) {
- return false;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/QuickStartAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/QuickStartAction.java
deleted file mode 100644
index 4c5daa5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/QuickStartAction.java
+++ /dev/null
@@ -1,164 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.text.Collator;
-import java.util.*;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.PartEventAction;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.dialogs.WelcomeEditorInput;
-
-/**
- * Launch the quick start action.
- */
-public class QuickStartAction extends PartEventAction {
- private static final String EDITOR_ID = "org.eclipse.ui.internal.dialogs.WelcomeEditor"; //$NON-NLS-1$
-
- private IWorkbench workbench;
-
-/**
- * Create an instance of this class.
- * <p>
- * This consructor added to support calling the action from the welcome page
- * </p>
- */
-public QuickStartAction() {
- this(PlatformUI.getWorkbench());
-}
-/**
- * Create an instance of this class
- */
-public QuickStartAction(IWorkbench aWorkbench) {
- super(WorkbenchMessages.getString("QuickStart.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("QuickStart.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.QUICK_START_ACTION);
- this.workbench = aWorkbench;
-}
-/**
- * The user has invoked this action
- */
-public void run() {
- // Ask the user to select a feature
- AboutInfo[] features = ((Workbench)workbench).getFeaturesInfo();
- ArrayList welcomeFeatures = new ArrayList();
- for (int i = 0; i < features.length; i++) {
- if (features[i].getWelcomePageURL() != null)
- welcomeFeatures.add(features[i]);
- }
-
- IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
- if (window == null)
- return;
-
- Shell shell = window.getShell();
-
- if (welcomeFeatures.size() == 0) {
- MessageDialog.openInformation(
- shell,
- WorkbenchMessages.getString("QuickStartMessageDialog.title"),
- WorkbenchMessages.getString("QuickStartMessageDialog.message"));
- return;
- }
-
- features = new AboutInfo[welcomeFeatures.size()];
- welcomeFeatures.toArray(features);
-
- // Sort ascending
- Arrays.sort(features, new Comparator() {
- Collator coll = Collator.getInstance(Locale.getDefault());
- public int compare(Object a, Object b) {
- AboutInfo i1, i2;
- String name1, name2;
- i1 = (AboutInfo)a;
- name1 = i1.getFeatureLabel();
- i2 = (AboutInfo)b;
- name2 = i2.getFeatureLabel();
- if (name1 == null)
- name1 = "";
- if (name2 == null)
- name2 = "";
- return coll.compare(name1, name2);
- }
- });
-
- // Find primary feature
- AboutInfo primaryFeature = ((Workbench)workbench).getAboutInfo();
- int index = -1;
- if (primaryFeature != null) {
- for (int i = 0; i < features.length; i++) {
- if (features[i].getFeatureId().equals(primaryFeature.getFeatureId())) {
- index = i;
- break;
- }
- }
- }
-
- WelcomePageSelectionDialog d =
- new WelcomePageSelectionDialog(
- shell,
- features,
- index);
- if(d.open() != Dialog.OK || d.getResult().length != 1)
- return;
-
- AboutInfo feature = (AboutInfo)d.getResult()[0];
-
- IWorkbenchPage page = null;
-
- // See if the feature wants a specific perspective
- String perspectiveId = feature.getWelcomePerspective();
-
- if (perspectiveId == null) {
- // Just use the current perspective unless one is not open
- // in which case use the default
- page = window.getActivePage();
-
- if (page == null || page.getPerspective() == null) {
- perspectiveId = WorkbenchPlugin.getDefault().getPerspectiveRegistry().getDefaultPerspective();
- }
- }
-
- if (perspectiveId != null) {
- try {
- page =
- (WorkbenchPage) workbench.showPerspective(
- perspectiveId,
- window);
- } catch (WorkbenchException e) {
- return;
- }
- }
-
- page.setEditorAreaVisible(true);
-
- // create input
- WelcomeEditorInput input = new WelcomeEditorInput(feature);
-
- // see if we already have a welcome editor
- IEditorPart editor = page.findEditor(input);
- if(editor != null) {
- page.activate(editor);
- return;
- }
-
- try {
- page.openEditor(input, EDITOR_ID);
- } catch (PartInitException e) {
- IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 1, WorkbenchMessages.getString("QuickStartAction.openEditorException"), e); //$NON-NLS-1$
- ErrorDialog.openError(
- workbench.getActiveWorkbenchWindow().getShell(),
- WorkbenchMessages.getString("QuickStartAction.errorDialogTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("QuickStartAction.errorDialogMessage"), //$NON-NLS-1$
- status);
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/QuitAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/QuitAction.java
deleted file mode 100644
index b777df6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/QuitAction.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.jface.action.*;
-
-/**
- * Try to quit the application.
- */
-public class QuitAction extends Action {
- private IWorkbench workbench;
-/**
- * Creates a new <code>QuitAction</code>. The action is
- * initialized from the <code>JFaceResources</code> bundle.
- */
-public QuitAction(IWorkbench workbench) {
- setText(WorkbenchMessages.getString("Exit.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("Exit.toolTip")); //$NON-NLS-1$
- setId(IWorkbenchActionConstants.QUIT);
- WorkbenchHelp.setHelp(this, IHelpContextIds.QUIT_ACTION);
- this.workbench = workbench;
-}
-/**
- * Perform the action: quit the application.
- */
-public void run() {
- workbench.close();
-}
-}
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
deleted file mode 100644
index bb3eed2..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReferenceCounter.java
+++ /dev/null
@@ -1,138 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.internal.ViewPane;
-import java.util.*;
-
-/**
- * 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 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 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);
-}
-/**
- * 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
deleted file mode 100644
index fdd0b3c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ReopenEditorMenu.java
+++ /dev/null
@@ -1,216 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.*;
-
-/**
- * A dynamic menu item which supports to switch to other Windows.
- */
-public class ReopenEditorMenu extends ContributionItem {
- private WorkbenchWindow fWindow;
- 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.
- */
- public ReopenEditorMenu(WorkbenchWindow window, EditorHistory history, boolean showSeparator) {
- super("Reopen Editor"); //$NON-NLS-1$
- fWindow = window;
- this.history = history;
- this.showSeparator = showSeparator;
- }
- /**
- * 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) {
- StringBuffer sb = new StringBuffer();
-
- int mnemonic = index + 1;
- sb.append(mnemonic);
- if (mnemonic <= MAX_MNEMONIC_SIZE) {
- sb.insert(sb.length() - (mnemonic + "").length(), '&'); //$NON-NLS-1$
- }
- sb.append(" "); //$NON-NLS-1$
-
- // If the input text is a path, get the filename from the
- // path's last segment; otherwise, use the input name.
- String fileName;
- String pathName = item.getInput().getToolTipText();
- IPath path = new Path(pathName);
- if (path.segmentCount() > 1) {
- fileName = path.lastSegment();
- path = path.removeLastSegments(1);
- pathName = path.toString();
- } else {
- fileName = item.getInput().getName();
- }
-
- if ((fileName.length() + pathName.length()) <= (MAX_TEXT_LENGTH - 4)) {
- // entire item name fits within maximum length
- sb.append(fileName);
- if (path.segmentCount() != 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$
- }
- }
- }
- return sb.toString();
- }
- /**
- * Fills the given menu with
- * menu items for all windows.
- */
- public void fill(final Menu menu, int index) {
- if (fWindow.getActivePage() == null
- || fWindow.getActivePage().getPerspective() == null)
- return;
-
- // Get items.
- EditorHistoryItem[] array = history.getItems();
-
- // If no items return.
- if (array.length <= 0) {
- return;
- }
-
- // Add separator.
- if (showSeparator) {
- new MenuItem(menu, SWT.SEPARATOR, index);
- ++index;
- }
-
- final int menuIndex[] = new int[]{index};
- // Add one item for each item.
- for (int i = 0; i < array.length; i++) {
- final EditorHistoryItem item = array[i];
- final int historyIndex = i;
- Platform.run(new SafeRunnable() {
- 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(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- open(item);
- }
- });
- }
- 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("Error in ReopenEditorMenu.fill: " + e); // $NON-NLS-1
- }
- });
- }
- }
- /**
- * Overridden to always return true and force dynamic menu building.
- */
- public boolean isDynamic() {
- return true;
- }
- /**
- * Reopens the editor for the given history item.
- */
- void open(EditorHistoryItem item) {
- IWorkbenchPage page = fWindow.getActivePage();
- if (page != null) {
- try {
- // Fix for 1GF6HQ1: ITPUI:WIN2000 - NullPointerException: opening a .ppt file
- // Descriptor is null if opened on OLE editor. .
- IEditorInput input = item.getInput();
- IEditorDescriptor desc = item.getDescriptor();
- if (desc == null) {
- // There's no openEditor(IEditorInput) call, and openEditor(IEditorInput, String)
- // doesn't allow null id.
- // However, if id is null, the editor input must be an IFileEditorInput,
- // so we can use openEditor(IFile).
- // Do nothing if for some reason input was not an IFileEditorInput.
- if (input instanceof IFileEditorInput) {
- page.openEditor(((IFileEditorInput) input).getFile());
- }
- } else {
- page.openEditor(input, desc.getId());
- }
- } catch (PartInitException e2) {
- String title = WorkbenchMessages.getString("OpenRecent.errorTitle"); //$NON-NLS-1$
- MessageDialog.openWarning(fWindow.getShell(), title, e2.getMessage());
- history.remove(item.getInput());
- }
- }
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index be4b57a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ResetPerspectiveAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.*;
-
-/**
- * Reset the layout within the active perspective.
- */
-public class ResetPerspectiveAction extends Action {
- private IWorkbenchWindow window;
-/**
- * This default constructor allows the the action to be called from the welcome page.
- */
-public ResetPerspectiveAction() {
- this(((Workbench)PlatformUI.getWorkbench()).getActiveWorkbenchWindow());
-}
-/**
- * Create an instance of this class
- */
-public ResetPerspectiveAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.getString("ResetPerspective.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("ResetPerspective.toolTip")); //$NON-NLS-1$
- setEnabled(false);
- WorkbenchHelp.setHelp(this, IHelpContextIds.RESET_PERSPECTIVE_ACTION);
- this.window = window;
-}
-/**
- * The user has invoked this action
- */
-public void run() {
- IWorkbenchPage page = this.window.getActivePage();
- if (page != null && page.getPerspective() != null) {
- String message = WorkbenchMessages.format("ResetPerspective.message", new Object[] { page.getPerspective().getLabel() }); //$NON-NLS-1$
- String [] buttons= new String[] {
- IDialogConstants.OK_LABEL,
- IDialogConstants.CANCEL_LABEL
- };
- MessageDialog d= new MessageDialog(
- this.window.getShell(),
- WorkbenchMessages.getString("ResetPerspective.title"), //$NON-NLS-1$
- null,
- message,
- MessageDialog.QUESTION,
- buttons,
- 0
- );
- if (d.open() == 0)
- page.resetPerspective();
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ResourcePerspective.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ResourcePerspective.java
deleted file mode 100644
index 9fe8012..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ResourcePerspective.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.swt.SWT;
-
-/**
- */
-public class ResourcePerspective implements IPerspectiveFactory {
-/**
- * Constructs a new Default layout engine.
- */
-public ResourcePerspective() {
- super();
-}
-/**
- * Defines the initial layout for a perspective.
- *
- * Implementors of this method may add additional views to a
- * perspective. The perspective already contains an editor folder
- * with <code>ID = ILayoutFactory.ID_EDITORS</code>. Add additional views
- * to the perspective in reference to the editor folder.
- *
- * This method is only called when a new perspective is created. If
- * an old perspective is restored from a persistence file then
- * this method is not called.
- *
- * @param factory the factory used to add views to the perspective
- */
-public void createInitialLayout(IPageLayout layout) {
- defineActions(layout);
- defineLayout(layout);
-}
-/**
- * Defines the initial actions for a page.
- */
-public void defineActions(IPageLayout layout) {
- // Add "new wizards".
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
-
- // Add "show views".
- layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
- layout.addShowViewShortcut(IPageLayout.ID_BOOKMARKS);
- layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
- layout.addShowViewShortcut(IPageLayout.ID_PROP_SHEET);
- layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
-}
-/**
- * Defines the initial layout for a page.
- */
-public void defineLayout(IPageLayout layout) {
- // Editors are placed for free.
- String editorArea = layout.getEditorArea();
-
- // Top left.
- IFolderLayout topLeft = layout.createFolder("topLeft", IPageLayout.LEFT, (float)0.26, editorArea);//$NON-NLS-1$
- topLeft.addView(IPageLayout.ID_RES_NAV);
- topLeft.addPlaceholder(IPageLayout.ID_BOOKMARKS);
-
- // Bottom left.
- IFolderLayout bottomLeft = layout.createFolder("bottomLeft", IPageLayout.BOTTOM, (float)0.50,//$NON-NLS-1$
- "topLeft");//$NON-NLS-1$
- bottomLeft.addView(IPageLayout.ID_OUTLINE);
-
- // Bottom right.
- layout.addView(IPageLayout.ID_TASK_LIST, IPageLayout.BOTTOM, (float)0.66, editorArea);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RootLayoutContainer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RootLayoutContainer.java
deleted file mode 100644
index 65dde4b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/RootLayoutContainer.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import java.util.*;
-
-/**
- * Represents the top level container.
- */
-public class RootLayoutContainer extends PartSashContainer {
-public RootLayoutContainer(Listener mouseDownListener) {
- super("root layout container");//$NON-NLS-1$
- this.mouseDownListener = mouseDownListener;
-}
-/**
- * Notification that a child layout part has been
- * added to the container. Subclasses may override
- * this method to perform any container specific
- * work.
- */
-protected void childAdded(LayoutPart child) {
- // do nothing
-}
-/**
- * Gets root container for this part.
- */
-public RootLayoutContainer getRootContainer() {
- return this;
-}
-/**
- * Notification that a child layout part has been
- * removed from the container. Subclasses may override
- * this method to perform any container specific
- * work.
- */
-protected void childRemoved(LayoutPart child) {
- // do nothing
-}
-/**
- * Subclasses override this method to specify
- * the composite to use to parent all children
- * layout parts it contains.
- */
-protected Composite createParent(Composite parentWidget) {
- return parentWidget;
-}
-/**
- * Subclasses override this method to dispose
- * of any swt resources created during createParent.
- */
-protected void disposeParent() {
- // do nothing
-}
-/**
- * Get the part control. This method may return null.
- */
-public Control getControl() {
- return this.parent;
-}
-/**
- * @see IPersistablePart
- */
-public IStatus restoreState(IMemento memento)
-{
- MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.getString("RootLayoutContainer.problemsRestoringPerspective"),null);
-
- // Read the info elements.
- IMemento [] children = memento.getChildren(IWorkbenchConstants.TAG_INFO);
-
- // Create a part ID to part hashtable.
- Map mapIDtoPart = new HashMap(children.length);
-
- // Loop through the info elements.
- for (int i = 0; i < children.length; i ++)
- {
- // Get the info details.
- IMemento childMem = children[i];
- String partID = childMem.getString(IWorkbenchConstants.TAG_PART);
- String relativeID = childMem.getString(IWorkbenchConstants.TAG_RELATIVE);
- int relationship = 0;
- float ratio = 0.0f;
- if (relativeID != null) {
- relationship = childMem.getInteger(IWorkbenchConstants.TAG_RELATIONSHIP).intValue();
- ratio = childMem.getFloat(IWorkbenchConstants.TAG_RATIO).floatValue();
- }
- String strFolder = childMem.getString(IWorkbenchConstants.TAG_FOLDER);
-
- // Create the part.
- LayoutPart part = null;
- if (strFolder == null)
- part = new PartPlaceholder(partID);
- else {
- PartTabFolder folder = new PartTabFolder();
- folder.setID(partID);
- result.add(folder.restoreState(childMem.getChild(IWorkbenchConstants.TAG_FOLDER)));
- ContainerPlaceholder placeholder = new ContainerPlaceholder(partID);
- placeholder.setRealContainer(folder);
- part = placeholder;
- }
- // 1FUN70C: ITPUI:WIN - Shouldn't set Container when not active
- part.setContainer(this);
-
- // Add the part to the layout
- if (relativeID == null) {
- add(part);
- } else {
- LayoutPart refPart = (LayoutPart)mapIDtoPart.get(relativeID);
- if (refPart != null) {
- add(part, relationship, ratio, refPart);
- } else {
- WorkbenchPlugin.log("Unable to find part for ID: " + relativeID);//$NON-NLS-1$
- }
- }
- mapIDtoPart.put(partID, part);
- }
- return result;
-}
-/**
- * @see IPersistablePart
- */
-public IStatus saveState(IMemento memento) {
- RelationshipInfo[] relationships = computeRelation();
-
- MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.getString("RootLayoutContainer.problemsSavingPerspective"),null);
-
- // Loop through the relationship array.
- for (int i = 0; i < relationships.length; i ++) {
- // Save the relationship info ..
- // private LayoutPart part;
- // private int relationship;
- // private float ratio;
- // private LayoutPart relative;
- RelationshipInfo info = relationships[i];
- IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_INFO);
- childMem.putString(IWorkbenchConstants.TAG_PART, info.part.getID());
- if (info.relative != null) {
- childMem.putString(IWorkbenchConstants.TAG_RELATIVE, info.relative.getID());
- childMem.putInteger(IWorkbenchConstants.TAG_RELATIONSHIP, info.relationship);
- childMem.putFloat(IWorkbenchConstants.TAG_RATIO, info.ratio);
- }
-
- // Is this part a folder or a placeholder for one?
- PartTabFolder folder = null;
- if (info.part instanceof PartTabFolder) {
- folder = (PartTabFolder)info.part;
- } else if (info.part instanceof ContainerPlaceholder) {
- LayoutPart part = ((ContainerPlaceholder)info.part).getRealContainer();
- if (part instanceof PartTabFolder)
- folder = (PartTabFolder)part;
- }
-
- // If this is a folder save the contents.
- if (folder != null) {
- childMem.putString(IWorkbenchConstants.TAG_FOLDER, "true");//$NON-NLS-1$
- IMemento folderMem = childMem.createChild(IWorkbenchConstants.TAG_FOLDER);
- result.add(folder.saveState(folderMem));
- }
- }
- return result;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveAction.java
deleted file mode 100644
index f4942b0..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.jface.dialogs.*;
-
-/**
- */
-public class SaveAction extends BaseSaveAction {
-/**
- * Create an instance of this class
- */
-public SaveAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.getString("SaveAction.text"), window); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("SaveAction.toolTip")); //$NON-NLS-1$
- setId(IWorkbenchActionConstants.SAVE);
- WorkbenchHelp.setHelp(this, IHelpContextIds.SAVE_ACTION);
- setAccelerator(SWT.CTRL |'s');
-}
-/**
- * Performs the save.
- */
-public void run() {
- IEditorPart part = getActiveEditor();
- IWorkbenchPage page = part.getSite().getPage();
- page.saveEditor(part, false);
-}
-/* (non-Javadoc)
- * Method declared on ActiveEditorAction.
- */
-protected void updateState() {
- IEditorPart editor = getActiveEditor();
- if (editor != null) {
- String title = editor.getTitle();
- String label = WorkbenchMessages.format("SaveAction.textOneArg", new Object[] {title}); //$NON-NLS-1$
- setText(label);
- setEnabled(editor.isDirty());
- } else {
- setText(WorkbenchMessages.getString("SaveAction.text")); //$NON-NLS-1$
- setEnabled(false);
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveAllAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveAllAction.java
deleted file mode 100644
index 497107e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveAllAction.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.PartEventAction;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Global action that saves all targets in the
- * workbench that implement ISaveTarget interface.
- * The action keeps track of opened save targets
- * and their 'save' state. If none of the currently
- * opened targets needs saving, it will disable.
- * This action is somewhat different from all
- * other global actions in that it works on
- * multiple targets at the same time i.e. it
- * does not disconnect from the target when it
- * becomes deactivated.
- */
-public class SaveAllAction extends PartEventAction
- implements IPageListener, IPropertyListener
-{
- private WorkbenchWindow window;
-/**
- * The default constructor.
- */
-public SaveAllAction(WorkbenchWindow window) {
- super(WorkbenchMessages.getString("SaveAll.text"));//$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("SaveAll.toolTip")); //$NON-NLS-1$
- setId(IWorkbenchActionConstants.SAVE_ALL);
- setAccelerator(SWT.CTRL | SWT.SHIFT |'s');
- setEnabled(false);
- this.window = window;
- window.addPageListener(this);
- WorkbenchHelp.setHelp(this, IHelpContextIds.SAVE_ALL_ACTION);
-}
-/**
- * Notifies the listener that a page has been activated.
- */
-public void pageActivated(IWorkbenchPage page) {
- updateState();
-}
-/**
- * Notifies the listener that a page has been closed
- */
-public void pageClosed(IWorkbenchPage page) {
- updateState();
-}
-/**
- * Notifies the listener that a page has been opened.
- */
-public void pageOpened(IWorkbenchPage page) {
-}
-/**
- * Implements part listener.
- */
-public void partClosed(IWorkbenchPart part) {
- if (part instanceof IEditorPart) {
- part.removePropertyListener(this);
- updateState();
- }
-}
-/**
- * Implements part listener.
- */
-public void partOpened(IWorkbenchPart part) {
- if (part instanceof IEditorPart) {
- part.addPropertyListener(this);
- updateState();
- }
-}
-/**
- * Indicates that a property has changed.
- *
- * @param source the object whose property has changed
- * @param propID the property which has changed. In most cases this property ID
- * should be defined as a constant on the source class.
- */
-public void propertyChanged(Object source, int propID) {
- if (source instanceof IEditorPart) {
- if (propID == IEditorPart.PROP_DIRTY) {
- updateState();
- }
- }
-}
-/**
- * Cycles through the list of active save targets
- * and saves those that need it.
- */
-public void run() {
- IWorkbenchPage page = window.getActivePage();
- if (page != null)
- page.saveAllEditors(false);
-}
-/**
- * Updates availability depending on number of
- * targets that need saving.
- */
-protected void updateState() {
- IWorkbenchPage page = window.getActivePage();
- setEnabled(page != null && page.getDirtyEditors().length > 0);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveAsAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveAsAction.java
deleted file mode 100644
index f042d33..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveAsAction.java
+++ /dev/null
@@ -1,45 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-
-/**
- * Workbench common Save As dialog
- */
-public class SaveAsAction extends BaseSaveAction {
-/**
- * Create an instance of this class
- */
-public SaveAsAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.getString("SaveAs.text"), window); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("SaveAs.toolTip")); //$NON-NLS-1$
- setId(IWorkbenchActionConstants.SAVE_AS);
- WorkbenchHelp.setHelp(this, IHelpContextIds.SAVE_AS_ACTION);
-}
-/**
- * Performs a save as action.
- */
-public void run() {
- getActiveEditor().doSaveAs();
-}
-/* (non-Javadoc)
- * Method declared on ActiveEditorAction.
- */
-protected void updateState() {
- IEditorPart editor = getActiveEditor();
- if (editor != null) {
- String title = editor.getTitle();
- String label = WorkbenchMessages.format("SaveAs.textOneArg", new Object[] {title}); //$NON-NLS-1$
- setText(label);
- setEnabled(editor.isSaveAsAllowed());
- } else {
- setText(WorkbenchMessages.getString("SaveAs.text")); //$NON-NLS-1$
- setEnabled(false);
- }
-}
-}
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
deleted file mode 100644
index 5c1cdb0..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SavePerspectiveAction.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.dialogs.SavePerspectiveDialog;
-import org.eclipse.ui.internal.registry.*;
-
-/**
- * Reset the layout within the active perspective.
- */
-public class SavePerspectiveAction extends Action {
- private IWorkbenchWindow window;
-/**
- * Create an instance of this class
- */
-public SavePerspectiveAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.getString("SavePerspective.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("SavePerspective.toolTip")); //$NON-NLS-1$
- setEnabled(false);
- this.window = window;
- WorkbenchHelp.setHelp(this, IHelpContextIds.SAVE_PERSPECTIVE_ACTION);
-}
-/**
- * The user has invoked this action
- */
-public void run() {
- IWorkbenchPage page = window.getActivePage();
- if (page == null)
- return;
- PerspectiveDescriptor desc = (PerspectiveDescriptor)page.getPerspective();
- if (desc != null) {
- if (desc.isSingleton())
- saveSingleton();
- else
- saveNonSingleton();
- }
-}
-/**
- * Save a singleton over itself.
- */
-public void saveSingleton() {
- String [] buttons= new String[] {
- IDialogConstants.OK_LABEL,
- IDialogConstants.CANCEL_LABEL
- };
- MessageDialog d= new MessageDialog(
- window.getShell(),
- WorkbenchMessages.getString("SavePerspective.overwriteTitle"), //$NON-NLS-1$
- null,
- WorkbenchMessages.getString("SavePerspective.singletonQuestion"), //$NON-NLS-1$
- MessageDialog.QUESTION,
- buttons,
- 0
- );
- if (d.open() == 0)
- window.getActivePage().savePerspective();
-}
-
-/**
- * Save a singleton over the user selection.
- */
-public void saveNonSingleton() {
- // Get reg.
- PerspectiveRegistry reg = (PerspectiveRegistry)WorkbenchPlugin.getDefault()
- .getPerspectiveRegistry();
-
- // Get persp name.
- SavePerspectiveDialog dlg = new SavePerspectiveDialog(window.getShell(), reg);
- IPerspectiveDescriptor description = reg.findPerspectiveWithId(window.getActivePage().getPerspective().getId());
- dlg.setInitialSelection(description);
- if (dlg.open() != IDialogConstants.OK_ID)
- return;
-
- // Create descriptor.
- PerspectiveDescriptor desc = (PerspectiveDescriptor)dlg.getPersp();
- if (desc == null) {
- String name = dlg.getPerspName();
- desc = reg.createPerspective(name,(PerspectiveDescriptor)description);
- if (desc == null) {
- MessageDialog.openError(dlg.getShell(), WorkbenchMessages.getString("SavePerspective.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("SavePerspective.errorMessage")); //$NON-NLS-1$
- return;
- }
- }
-
- // Save state.
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- page.savePerspectiveAs(desc);
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionEnabler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionEnabler.java
deleted file mode 100644
index 06cd178..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SelectionEnabler.java
+++ /dev/null
@@ -1,285 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.actions.SimpleWildcardTester;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.jface.viewers.*;
-
-import java.util.*;
-
-/**
- * This is a helper class that works with PluginAction
- * to quickly test if the action should be enabled
- * without loading the contributing plugin. An object
- * of this class is created in PluginAction if attribute
- * "enablesFor" is seen in the configuration.
- *
- */
-public class SelectionEnabler {
- public static final int ONE_OR_MORE = -1;
- private static final String ATT_NAME = "name";//$NON-NLS-1$
- private static final String ATT_CLASS = "class";//$NON-NLS-1$
- public static final int UNKNOWN = 0;
- public static final int MULTIPLE = -5;
- public static final int ANY_NUMBER = -2;
- public static final int NONE_OR_ONE = -3;
- public static final int NONE = -4;
- private List classes = new ArrayList();;
- private ActionExpression enablementExpression;
- private int mode=UNKNOWN;
-
- public static class SelectionClass {
- public String className;
- public boolean recursive;
- public String nameFilter;
- }
-/**
- * ActionEnabler constructor.
- */
-public SelectionEnabler(IConfigurationElement configElement) {
- parseClasses(configElement);
-
-}
-/**
- * Returns true if given selection matches the
- * conditions specified in the registry for
- * this action.
- */
-public boolean isEnabledForSelection(ISelection selection) {
- // Optimize it.
- if (mode == UNKNOWN) return false;
-
- // Handle undefined selections.
- if (selection == null)
- selection = StructuredSelection.EMPTY;
-
- // 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.
- if (selection instanceof IStructuredSelection)
- return isEnabledFor((IStructuredSelection)selection);
- else if (selection instanceof ITextSelection)
- return isEnabledFor((ITextSelection)selection);
- else
- return isEnabledFor(selection);
-}
-/**
- * Compare selection count with requirements.
- */
-private boolean verifySelectionCount(int count) {
- if (count > 0 && mode == NONE) return false;
- if (count == 0 && mode == ONE_OR_MORE) return false;
- if (count > 1 && mode == NONE_OR_ONE) return false;
- if (count < 2 && mode == MULTIPLE) return false;
- if (mode > 0 && count != mode) return false;
- return true;
-}
-
-/**
- * Returns true if given structured selection matches the
- * conditions specified in the registry for
- * this action.
- */
-private boolean isEnabledFor(ISelection sel) {
- Object obj = sel;
- int count = sel.isEmpty() ? 0: 1;
-
- if(verifySelectionCount(count) == false)
- return false;
-
- // Compare selection to enablement expression.
- if (enablementExpression != null)
- return enablementExpression.isEnabledFor(obj);
-
- // Compare selection to class requirements.
- if (classes.isEmpty()) return true;
- if (obj instanceof IAdaptable) {
- IAdaptable element = (IAdaptable)obj;
- if (verifyElement(element)==false) return false;
- } else {
- return false;
- }
-
- return true;
-}
-/**
- * Returns true if given text selection matches the
- * conditions specified in the registry for this action.
- */
-private boolean isEnabledFor(ITextSelection sel) {
- int count = sel.getLength();
-
- if(verifySelectionCount(count) == false)
- return false;
-
- // Compare selection to enablement expression.
- if (enablementExpression != null)
- return enablementExpression.isEnabledFor(sel);
-
- // Compare selection to class requirements.
- return verifyElement(sel);
-}
-
-/**
- * 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();
-
- if(verifySelectionCount(count) == false)
- return false;
-
- // Compare selection to enablement expression.
- if (enablementExpression != null)
- return enablementExpression.isEnabledFor(ssel);
-
- // Compare selection to class requirements.
- if (classes.isEmpty()) return true;
- for (Iterator elements=ssel.iterator(); elements.hasNext();) {
- Object obj = elements.next();
- if (obj instanceof IAdaptable) {
- IAdaptable element = (IAdaptable)obj;
- if (verifyElement(element)==false) return false;
- } else {
- return false;
- }
- }
-
- return true;
-}
-/**
- * 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(PluginActionBuilder.ATT_ENABLES_FOR);
- if (enablesFor == null)
- enablesFor = "*"; //$NON-NLS-1$
- if (enablesFor.equals("*")) //$NON-NLS-1$
- mode = ANY_NUMBER;
- else if (enablesFor.equals("?")) //$NON-NLS-1$
- mode = NONE_OR_ONE;
- else if (enablesFor.equals("!")) //$NON-NLS-1$
- mode = NONE;
- else if (enablesFor.equals("+")) //$NON-NLS-1$
- mode = ONE_OR_MORE;
- else if (
- enablesFor.equals("multiple") //$NON-NLS-1$
- || enablesFor.equals("2+")) //$NON-NLS-1$
- mode = MULTIPLE;
- else {
- try {
- mode = Integer.parseInt(enablesFor);
- } catch (NumberFormatException e) {
- mode = UNKNOWN;
- }
- }
-
- // Get enablement block.
- IConfigurationElement[] children = config.getChildren(PluginActionBuilder.TAG_ENABLEMENT);
- if (children.length > 0) {
- enablementExpression = new ActionExpression(children[0]);
- return;
- }
-
- // Get selection block.
- children = config.getChildren(PluginActionBuilder.TAG_SELECTION);
- if (children.length > 0) {
- classes = new ArrayList();
- for (int i = 0; i < children.length; i++) {
- IConfigurationElement sel = children[i];
- String cname = sel.getAttribute(ATT_CLASS);
- String name = sel.getAttribute(ATT_NAME);
- SelectionClass sclass = new SelectionClass();
- sclass.className = cname;
- sclass.nameFilter = name;
- classes.add(sclass);
- }
- }
-}
-/**
- * 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();
- Class clazz = eclass;
- boolean match = false;
- while (clazz != null) {
- // test the class itself
- if (clazz.getName().equals(className)) {
- match = true;
- break;
- }
- // test all the interfaces it implements
- Class[] interfaces = clazz.getInterfaces();
- for (int i = 0; i < interfaces.length; i++) {
- if (interfaces[i].getName().equals(className)) {
- match = true;
- break;
- }
- }
- if (match == true)
- break;
- // get the superclass
- clazz = clazz.getSuperclass();
- }
- return match;
-}
-/**
- * Verifies if the given element matches one of the
- * selection requirements. Element must at pass the
- * type test. Filters are ignored in case of
- * ITextSelection.
- */
-private boolean verifyElement(ITextSelection element) {
- if (classes.isEmpty()) return true;
- for (int i = 0; i < classes.size(); i++) {
- SelectionClass sc = (SelectionClass) classes.get(i);
- if (verifyClass(element, sc.className))
- return true;
- }
- return false;
-}
-/**
- * Verifies if the given element matches one of the
- * selection requirements. Element must at least pass
- * the type test, and optionally wildcard name match.
- */
-private boolean verifyElement(IAdaptable element) {
- if (classes.isEmpty()) return true;
- for (int i = 0; i < classes.size(); i++) {
- SelectionClass sc = (SelectionClass) classes.get(i);
- if (verifyClass(element, sc.className) == false)
- continue;
- if (sc.nameFilter == null)
- return true;
- IWorkbenchAdapter de = (IWorkbenchAdapter)element.getAdapter(IWorkbenchAdapter.class);
- if ((de != null) && verifyNameMatch(de.getLabel(element),
- sc.nameFilter))
- return true;
- }
- return false;
-}
-/**
- * Verifies that the given name matches the given
- * wildcard filter. Returns true if it does.
- */
-public static boolean verifyNameMatch(String name, String filter) {
- return SimpleWildcardTester.testWildcardIgnoreCase(filter, name);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Semaphore.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Semaphore.java
deleted file mode 100644
index a0121e1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Semaphore.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-public class Semaphore {
- protected long notifications;
- protected Runnable runnable;
- protected Thread operation;
-public Semaphore(Runnable runnable) {
- this.runnable = runnable;
- notifications = 0;
- operation = null;
-}
-public synchronized void acquire() throws InterruptedException {
- if (Thread.interrupted())
- throw new InterruptedException();
- while (notifications <= 0)
- wait();
- notifications--;
-}
-public boolean equals(Object obj) {
- return (runnable == ((Semaphore) obj).runnable);
-}
-public Runnable getRunnable() {
- return runnable;
-}
-public int hashCode() {
- return runnable.hashCode();
-}
-public synchronized void release() {
- notifications++;
- notifyAll();
-}
-// for debug only
-public String toString() {
- return runnable.toString();
-}
-public void setOperationThread(Thread operation) {
- this.operation = operation;
-}
-public Thread getOperationThread() {
- return operation;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SetPagePerspectiveAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SetPagePerspectiveAction.java
deleted file mode 100644
index e026e77..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SetPagePerspectiveAction.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.*;
-
-/**
- * Sets the current perspective of the workbench
- * page.
- */
-public class SetPagePerspectiveAction extends Action {
- private WorkbenchPage page;
- private IPerspectiveDescriptor persp;
-
- /**
- * Create an instance of this class
- */
- public SetPagePerspectiveAction(IPerspectiveDescriptor perspective, WorkbenchPage workbenchPage) {
- super(WorkbenchMessages.getString("SetPagePerspectiveAction.text")); //$NON-NLS-1$
- setChecked(false);
- persp = perspective;
- page = workbenchPage;
- update(persp);
- WorkbenchHelp.setHelp(this, IHelpContextIds.SWITCH_TO_PERSPECTIVE_ACTION);
- }
-
- /**
- * Returns the page this action applies to
- */
- /* package */ WorkbenchPage getPage() {
- return page;
- }
-
- /**
- * Returns the perspective this action applies to
- */
- /* package */ IPerspectiveDescriptor getPerspective() {
- return persp;
- }
-
- /**
- * Returns whether this action handles the specified
- * workbench page and perspective.
- */
- public boolean handles(IPerspectiveDescriptor perspective, WorkbenchPage workbenchPage) {
- return persp == perspective && page == workbenchPage;
- }
-
- /**
- * Replaces the perspective used
- */
- public void setPerspective(IPerspectiveDescriptor newPerspective) {
- persp = newPerspective;
- }
-
- /**
- * The user has invoked this action
- */
- public void run() {
- page.setPerspective(persp);
- // Force the button into proper checked state
- setChecked(page.getPerspective() == persp);
- }
-
- /**
- * Update the action.
- */
- public void update(IPerspectiveDescriptor newDesc) {
- persp = newDesc;
- setToolTipText(WorkbenchMessages.format("SetPagePerspectiveAction.toolTip", new Object[] {persp.getLabel()}));
- ImageDescriptor image = persp.getImageDescriptor();
- if (image != null) {
- setImageDescriptor(image);
- setHoverImageDescriptor(null);
- } else {
- setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_DEF_PERSPECTIVE));
- setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_DEF_PERSPECTIVE_HOVER));
- }
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index d863f3c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SharedImages.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * 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
- */
-public Image getImage(String symbolicName) {
- 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;
-}
-/**
- * Retrieves the specified image descriptor from the workbench plugin's image registry.
- *
- * @see ISharedImages
- */
-public ImageDescriptor getImageDescriptor(String symbolicName) {
- return WorkbenchImages.getImageDescriptor(symbolicName);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShortcutBarPart.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShortcutBarPart.java
deleted file mode 100644
index de49ecc..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShortcutBarPart.java
+++ /dev/null
@@ -1,190 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * A ShortcutBarPart acts as a target for drag and drop events in
- * a PerspectivePresentation. It is not intended to act as a real part.
- */
-public class ShortcutBarPart extends LayoutPart {
- private ToolBarManager tbm;
- private ToolBar toolbar;
-
- /**
- * Implements drop behavior for drag and drop operations on the
- * fast view buttons of the shortcut bar.
- */
- class ShortcutBarDropAdapter extends DropTargetAdapter {
- private static final long hoverThreshold = 250;
-
- private ToolBar toolBar;
- private ToolItem currentDropTarget;
- private int lastValidOperation;
- private IViewPart lastFastView = null;
- private IWorkbenchPart deactivatedPart = null;
- private long hoverStart;
-
- /**
- * Creates a new instance of the receiver using the given drop
- * target.
- * @param dropTarget drop target the receiver gets drag&drop
- * events from
- */
- public ShortcutBarDropAdapter(ToolBar dropTarget) {
- toolBar = dropTarget;
- }
- /**
- * Returns the <code>ToolItem</code> at the given position.
- * @param position x,y position of the desired <code>ToolItem</code>
- * @return <code>ToolItem</code> at the given position.or null
- * if there is no item at the position.
- */
- private ToolItem getDropTarget(Point position) {
- return toolBar.getItem(toolBar.toControl(position));
- }
- /**
- * Check whether the drop operation can be accepted and set the
- * drop event feedback accordingly.
- * @param event drop event
- */
- private void doDropValidation(DropTargetEvent event) {
- if (event.detail != DND.DROP_NONE) {
- lastValidOperation = event.detail;
- }
- if (validateTarget()) {
- event.detail = lastValidOperation;
- } else {
- event.detail = DND.DROP_NONE;
- }
- }
- /**
- * The mouse entered the drop target. Perform drop validation
- * to give drag and drop feedback to the user.
- * @param event drop event
- */
- public void dragEnter(DropTargetEvent event) {
- currentDropTarget = getDropTarget(new Point(event.x, event.y));
- doDropValidation(event);
- }
- /**
- * The mouse is hovering over the drop target.
- * If it has been hovering over a fast view button for the
- * defined hover time, open the fast view. If a fast view has
- * been previously opened by a hovering mouse and the mouse has
- * not been on any fast view button within the defined hover
- * time, close the fast view.
- * @param event drop event
- */
- public void dragOver(DropTargetEvent event) {
- Object oldTarget = currentDropTarget;
-
- currentDropTarget = getDropTarget(new Point(event.x, event.y));
- if (currentDropTarget == null) {
- event.detail = DND.DROP_NONE;
- if (oldTarget != null) {
- // mouse moved from contribution item to somewhere else
- hoverStart = System.currentTimeMillis();
- } else if (lastFastView != null && (System.currentTimeMillis() - hoverStart) > hoverThreshold) {
- hideView();
- }
- } else {
- long currentTime = System.currentTimeMillis();
- doDropValidation(event);
- if (oldTarget != currentDropTarget) {
- hoverStart = currentTime;
- } else if (validateTarget() && (currentTime - hoverStart) > hoverThreshold) {
- showView();
- }
- }
- }
- /**
- * Shows the fast view that the mouse has been hovering on.
- */
- private void showView() {
- Object itemData = currentDropTarget.getData(ShowFastViewContribution.FAST_VIEW);
-
- if (itemData != null) {
- IViewReference ref = (IViewReference) itemData;
- WorkbenchPage page = (WorkbenchPage) getWorkbenchWindow().getActivePage();
-
- if (deactivatedPart == null) {
- deactivatedPart = page.getActivePart();
- }
- lastFastView = (IViewPart)ref.getPart(true);
- page.activate(lastFastView);
- }
- }
- /**
- * Hides the fast view by activating the view that was active before
- * the fast view.
- */
- private void hideView() {
- if (deactivatedPart != null) {
- WorkbenchPage activePage = (WorkbenchPage) getWorkbenchWindow().getActivePage();
- WorkbenchPage partPage = (WorkbenchPage) deactivatedPart.getSite().getPage();
-
- // activate the part that was active prior to the fast view.
- // hides the fast view.
- if (activePage == partPage) {
- partPage.activate(deactivatedPart);
- }
- deactivatedPart = null;
- }
- lastFastView = null;
- }
- /**
- * Returns whether the current drop target is valid.
- * @return true=the current target is a valid drop target,
- * false otherwise
- */
- private boolean validateTarget() {
- return (currentDropTarget != null && currentDropTarget.getData() instanceof ShowFastViewContribution);
- }
- }
- /**
- * ShortcutBarPart constructor comment.
- * @param id java.lang.String
- */
- public ShortcutBarPart(ToolBarManager tbm) {
- super("ShortcutBarPart"); //$NON-NLS-1$
- this.tbm = tbm;
- this.toolbar = tbm.getControl();
- toolbar.setData((IPartDropTarget) this);
- initDragAndDrop();
- }
- /**
- * Creates the SWT control
- */
- final public void createControl(Composite parent) {
- // Nothing to do.
- }
- /**
- * Get the part control. This method may return null.
- */
- final public Control getControl() {
- return toolbar;
- }
- /**
- * Adds drag and drop support to the shortcut bar.
- */
- private void initDragAndDrop() {
- DropTarget dropTarget = new DropTarget(toolbar, DND.DROP_COPY | DND.DROP_MOVE);
- dropTarget.addDropListener(new ShortcutBarDropAdapter(toolbar));
- }
- /**
- * @see IPartDropTarget::targetPartFor
- */
- public LayoutPart targetPartFor(LayoutPart dragSource) {
- return this;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShortcutBarPartDragDrop.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShortcutBarPartDragDrop.java
deleted file mode 100644
index a0c310b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShortcutBarPartDragDrop.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-**********************************************************************/
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.IViewPart;
-
-public class ShortcutBarPartDragDrop extends PartDragDrop implements MouseListener, MouseMoveListener{
- // The item that is being dragged by this PartDragDrop.
- private ToolItem draggedItem;
-
- public ShortcutBarPartDragDrop(LayoutPart itemPart, Control shortcutBar) {
- super(itemPart, shortcutBar);
- }
-
- public void mouseDown(MouseEvent e) {
- if (e.button != 1) return;
- ToolBar toolBar = getToolBar();
- draggedItem = toolBar.getItem(new Point(e.x, e.y));
- if (draggedItem == null) {
- // Avoid drag from the borders.
- return;
- }
- if (draggedItem.getData(ShowFastViewContribution.FAST_VIEW) == null) {
- // Avoid drag from non-fast view icons.
- return;
- }
- super.mouseDown(e);
- }
-
- // Returns the shortcut bar.
- private ToolBar getToolBar() {
- return (ToolBar) getDragControl();
- }
- /*package*/ ToolItem getDraggedItem() {
- return draggedItem;
- }
-
- /*
- * Returns the bounds of the fast view of the view
- * represented by the icon being dragged.
- */
- protected Rectangle getSourceBounds() {
- IViewReference ref = (IViewReference) draggedItem.getData(ShowFastViewContribution.FAST_VIEW);
- WorkbenchPage page = (WorkbenchPage)ref.getPage();
- Perspective persp = page.getActivePerspective();
- Rectangle rect = persp.getFastViewBounds(ref);
- return rect;
- }
- /*
- * The cursor has moved enough to open a tracker only if it is
- * NOT still over the icon being dragged. A tracker consumes
- * events from the queue. If a tracker is opened while we are still
- * over the pushed ToolItem, it will never be "unpushed", since the
- * event that unpushes it will be consumed by the tracker.
- */
- protected boolean hasMovedEnough(MouseEvent e) {
- ToolItem currentItem = getToolBar().getItem(new Point(e.x, e.y));
- if (super.hasMovedEnough(e) && currentItem != draggedItem)
- return true;
- return false;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShortcutMenu.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShortcutMenu.java
deleted file mode 100644
index 21584c3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShortcutMenu.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.jface.action.*;
-
-/**
- * A <code>ShortcutMenu</code> is used to populate a menu manager with
- * actions. The visible actions are determined by the active perspective
- * within the workbench window.
- */
-public abstract class ShortcutMenu implements IInternalPerspectiveListener, IPageListener {
- private IWorkbenchWindow window;
- private IMenuManager innerMgr;
-
-/**
- * Create a shortcut menu.
- * This menu does not listen to changes in perspective in the window.
- *
- * @param innerMgr the location for the shortcut menu contents
- * @param window the window containing the menu
- */
-public ShortcutMenu(IMenuManager innerMgr, IWorkbenchWindow window) {
- this(innerMgr, window, false);
-}
-/**
- * Create a shortcut menu.
- * <p>
- * If the menu will appear on a semi-permanent basis, for instance within
- * a toolbar or menubar, the value passed for <code>register</code> should be true.
- * If set, the menu will listen to perspective activation and update itself
- * to suit. In this case clients are expected to call <code>deregister</code>
- * when the menu is no longer needed. This will unhook any perspective
- * listeners.
- * </p>
- *
- * @param innerMgr the location for the shortcut menu contents
- * @param window the window containing the menu
- * @param register if <code>true</code> the menu listens to perspective changes in
- * the window
- */
-public ShortcutMenu(IMenuManager innerMgr, IWorkbenchWindow window, boolean register) {
- this.innerMgr = innerMgr;
- this.window = window;
- if (register) {
- window.addPageListener(this);
- ((WorkbenchWindow)window).getPerspectiveService().addPerspectiveListener(this);
- }
-}
-/**
- * Removes all listeners from the containing workbench window.
- * <p>
- * This method should only be called if the shortcut menu is created
- * with <code>register = true</code>.
- * </p>
- */
-public void deregisterListeners() {
- window.removePageListener(this);
- ((WorkbenchWindow)window).getPerspectiveService().removePerspectiveListener(this);
-}
-/**
- * Fills the menu. This method is typically called when the active perspective
- * or page within the target window changes.
- * <p>
- * Subclasses must implement.
- * </p>
- */
-protected abstract void fillMenu();
-/**
- * Returns the current perspective descriptor.
- *
- * @return the current perspective or <code>null if none
- */
-protected IPerspectiveDescriptor getCurrentPerspective() {
- IWorkbenchPage page = window.getActivePage();
- if (page == null)
- return null;
- return page.getPerspective();
-}
-/**
- * Returns the menu manager.
- *
- * @return the menu manager
- */
-protected IMenuManager getMenuManager() {
- return innerMgr;
-}
-/**
- * Returns the window.
- *
- * @return the window
- */
-protected IWorkbenchWindow getWindow() {
- return window;
-}
-/**
- * Updates the menu. This method will only be called
- * to initialize the menu, or if the active perspective within the
- * window has changed.
- */
-protected void updateMenu() {
- // contribute the sub menu items
- fillMenu();
-
- // call this update so the actual swt
- // menu in the manager is updated with
- // the new items from the fillMenu() call.
- innerMgr.update(false);
-}
-
-public void pageActivated(IWorkbenchPage page) {
- updateMenu();
-}
-public void pageClosed(IWorkbenchPage page) {
- updateMenu();
-}
-public void pageOpened(IWorkbenchPage page) {
- // wait for activation.
-}
-public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- updateMenu();
-}
-public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String id){
- updateMenu();
-}
-public void perspectiveClosed(IWorkbenchPage page, IPerspectiveDescriptor perspective){
- updateMenu();
-}
-public void perspectiveOpened(IWorkbenchPage page, IPerspectiveDescriptor perspective){
- updateMenu();
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowFastViewContribution.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowFastViewContribution.java
deleted file mode 100644
index 48ebae6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowFastViewContribution.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.ContributionItem;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.ui.*;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * A dynamic contribution item which supports to switch to other Contexts.
- */
-public class ShowFastViewContribution extends ContributionItem {
- public static final String FAST_VIEW = "FastView"; //$NON-NLS-1$
- private IWorkbenchWindow window;
- /**
- * Create a new menu item.
- */
- public ShowFastViewContribution(IWorkbenchWindow window) {
- super("showFastViewContr"); //$NON-NLS-1$
- this.window = window;
- }
- /**
- * The default implementation of this <code>IContributionItem</code>
- * method does nothing. Subclasses may override.
- */
- public void fill(ToolBar parent, int index) {
- // Get page.
- WorkbenchPage page = (WorkbenchPage) window.getActivePage();
- if (page == null)
- return;
-
- // Get views.
- IViewReference[] refs = page.getFastViews();
-
- // Create tool item for each view.
- int size = refs.length;
- for (int nX = 0; nX < size; nX++) {
- final IViewReference ref = refs[nX];
- final ToolItem item = new ToolItem(parent, SWT.CHECK, index);
- item.setImage(ref.getTitleImage());
- item.setToolTipText(ref.getTitle());
- item.setData(FAST_VIEW, ref);
-
- // Select the active fast view's icon.
- if (ref == ((WorkbenchPage)window.getActivePage()).getActiveFastView()) {
- item.setSelection(true);
- } else {
- item.setSelection(false);
- }
-
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- showView(ref);
- }
- });
- index++;
- }
- }
- /**
- * Returns whether the contribution is dynamic.
- */
- public boolean isDynamic() {
- return true;
- }
- /**
- * Open a view.
- */
- private void showView(IViewReference ref) {
- WorkbenchPage page = (WorkbenchPage)ref.getPage();
- page.toggleFastView(ref);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowPartPaneMenuAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowPartPaneMenuAction.java
deleted file mode 100644
index fb86a3a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowPartPaneMenuAction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.eclipse.ui.internal;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.WorkbenchPart;
-import org.eclipse.ui.actions.*;
-
-/**
- * Show the menu on top of the icon in the
- * view or editor label.
- */
-public class ShowPartPaneMenuAction extends PartEventAction {
-
-/**
- * Constructor for ShowPartPaneMenuAction.
- * @param text
- */
-public ShowPartPaneMenuAction(WorkbenchWindow window) {
- super(""); //$NON-NLS-1$
- initText();
- window.getPartService().addPartListener(this);
- WorkbenchHelp.setHelp(this, IHelpContextIds.SHOW_PART_PANE_MENU_ACTION);
-}
-/**
- * Initialize the menu text and tooltip.
- */
-protected void initText() {
- setText(WorkbenchMessages.getString("ShowPartPaneMenuAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("ShowPartPaneMenuAction.toolTip")); //$NON-NLS-1$
-}
-/**
- * Show the pane title menu.
- */
-protected void showMenu(PartPane pane) {
- pane.showPaneMenu();
-}
-/**
- * Updates the enabled state.
- */
-protected void updateState() {
- setEnabled(getActivePart() != null);
-}
-/**
- * See Action
- */
-public void run() {
- IWorkbenchPart part = getActivePart();
- if(part != null)
- showMenu(((PartSite)part.getSite()).getPane());
-}
-/**
- * See IPartListener
- */
-public void partOpened(IWorkbenchPart part) {
- super.partOpened(part);
- updateState();
-}
-/**
- * See IPartListener
- */
-public void partClosed(IWorkbenchPart part) {
- super.partClosed(part);
- updateState();
-}
-/**
- * See IPartListener
- */
-public void partActivated(IWorkbenchPart part) {
- super.partActivated(part);
- updateState();
-}
-/**
- * See IPartListener
- */
-public void partDeactivated(IWorkbenchPart part) {
- super.partDeactivated(part);
- updateState();
-}
-}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewAction.java
deleted file mode 100644
index 802c29c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewAction.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-
-/**
- * Show a View.
- */
-public class ShowViewAction extends Action {
- private IWorkbenchWindow window;
- private IViewDescriptor desc;
-/**
- * ShowViewAction constructor comment.
- */
-protected ShowViewAction(IWorkbenchWindow window, IViewDescriptor desc) {
- super(""); //$NON-NLS-1$
- String accel = desc.getAccelerator();
- String label = desc.getLabel();
- setText(accel == null ? label : label + "@" + accel); //$NON-NLS-1$
- setImageDescriptor(desc.getImageDescriptor());
- setToolTipText(label);
- WorkbenchHelp.setHelp(this, IHelpContextIds.SHOW_VIEW_ACTION);
- this.window = window;
- this.desc = desc;
-}
-/**
- * Implementation of method defined on <code>IAction</code>.
- */
-public void run() {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- try {
- page.showView(desc.getID());
- } catch (PartInitException e) {
- ErrorDialog.openError(window.getShell(), WorkbenchMessages.getString("ShowView.errorTitle"), //$NON-NLS-1$
- e.getMessage(),e.getStatus());
- }
- }
-}
-}
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
deleted file mode 100644
index 96022d6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenu.java
+++ /dev/null
@@ -1,206 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.Collator;
-import java.util.*;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.window.Window;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.dialogs.ShowViewDialog;
-import org.eclipse.ui.internal.registry.IViewDescriptor;
-import org.eclipse.ui.internal.registry.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 Perspective Customize dialog.
- */
-public class ShowViewMenu extends ShortcutMenu implements IPartListener {
-
- private Comparator actionComparator = new Comparator() {
- Collator collator = Collator.getInstance();
- public int compare(Object o1, Object o2) {
- IAction a1 = (IAction) o1;
- IAction a2 = (IAction) o2;
- return collator.compare(a1.getText(), a2.getText());
- }
- };
-
- private Action showDlgAction =
- new Action(WorkbenchMessages.getString("ShowView.title")) {//$NON-NLS-1$
- public void run() {
- showOther();
- }
- };
-
- private Map actions = new HashMap(21);
-
- //Maps pages to a list of opened views
- private Map openedViews = new HashMap();
-
- /**
- * Create a show view menu.
- * <p>
- * If the menu will appear on a semi-permanent basis, for instance within
- * a toolbar or menubar, the value passed for <code>register</code> should be true.
- * If set, the menu will listen to perspective activation and update itself
- * to suit. In this case clients are expected to call <code>deregister</code>
- * when the menu is no longer needed. This will unhook any perspective
- * listeners.
- * </p>
- *
- * @param innerMgr the location for the shortcut menu contents
- * @param window the window containing the menu
- * @param register if <code>true</code> the menu listens to perspective changes in
- * the window
- */
- public ShowViewMenu(
- IMenuManager innerMgr,
- IWorkbenchWindow window,
- boolean register) {
- super(innerMgr, window, register);
- fillMenu(); // Must be done after constructor to ensure field initialization.
- }
-
- /* (non-Javadoc)
- * Fills the menu with views.
- */
- protected void fillMenu() {
- // Remove all.
- IMenuManager innerMgr = getMenuManager();
- innerMgr.removeAll();
-
- // If no page disable all.
- IWorkbenchPage page = getWindow().getActivePage();
- if (page == null)
- return;
-
- // If no active perspective disable all
- if (page.getPerspective() == null)
- return;
-
- // Get visible actions.
- List viewIds = ((WorkbenchPage) page).getShowViewActionIds();
- List actions = new ArrayList(viewIds.size());
- for (Iterator i = viewIds.iterator(); i.hasNext();) {
- String id = (String) i.next();
- IAction action = getAction(id);
- if (action != null) {
- actions.add(action);
- }
- }
- Collections.sort(actions, actionComparator);
- for (Iterator i = actions.iterator(); i.hasNext();) {
- innerMgr.add((IAction) i.next());
- }
-
- // Add Other ..
- innerMgr.add(new Separator());
- innerMgr.add(showDlgAction);
- }
-
-
- /**
- * Returns the action for the given view 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) {
- IViewRegistry reg = WorkbenchPlugin.getDefault().getViewRegistry();
- IViewDescriptor desc = reg.find(id);
- if (desc != null) {
- action = new ShowViewAction(getWindow(), desc);
- actions.put(id, action);
- }
- }
- return action;
- }
-
- /**
- * Opens the view selection dialog.
- */
- private void showOther() {
- IWorkbenchWindow window = getWindow();
- IWorkbenchPage page = window.getActivePage();
- if (page == null)
- return;
- ShowViewDialog dlg =
- new ShowViewDialog(
- window.getShell(),
- WorkbenchPlugin.getDefault().getViewRegistry());
- dlg.open();
- if (dlg.getReturnCode() == Window.CANCEL)
- return;
- IViewDescriptor[] descs = dlg.getSelection();
- for (int i = 0; i < descs.length; ++i) {
- try {
- page.showView(descs[i].getID());
- } catch (PartInitException e) {
- ErrorDialog
- .openError(
- window.getShell(),
- WorkbenchMessages.getString("ShowView.errorTitle"), //$NON-NLS-1$
- e.getMessage(),
- e.getStatus());
- }
- }
- }
-
- private ArrayList getParts(IWorkbenchPage page) {
- ArrayList parts = (ArrayList) openedViews.get(page);
- if (parts == null) {
- parts = new ArrayList();
- openedViews.put(page, parts);
- }
- return parts;
- }
-
- public void partActivated(IWorkbenchPart part) {
- }
-
- public void partBroughtToTop(IWorkbenchPart part) {
- }
-
- public void partClosed(IWorkbenchPart part) {
- }
-
- public void partDeactivated(IWorkbenchPart part) {
- }
-
- public void partOpened(IWorkbenchPart part) {
- if (part instanceof IViewPart) {
- String id = ((IViewPart) part).getSite().getId();
- ArrayList parts = getParts(part.getSite().getPage());
- if (parts.indexOf(id) < 0) {
- parts.add(id);
- updateMenu();
- }
- }
- }
- public void pageClosed(IWorkbenchPage page) {
- openedViews.remove(page);
- super.pageClosed(page);
- }
-
- public void pageOpened(IWorkbenchPage page) {
- ArrayList parts = getParts(page); // adds an entry to openedViews
- IViewReference[] views = page.getViewReferences();
- for (int i = 0; i < views.length; i++) {
- String id = views[i].getId();
- if (parts.indexOf(id) < 0)
- parts.add(id);
- }
- page.addPartListener(this);
- super.pageOpened(page);
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenuAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenuAction.java
deleted file mode 100644
index 633aa9a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ShowViewMenuAction.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-public class ShowViewMenuAction extends ShowPartPaneMenuAction {
-
-/**
- * Constructor for ShowViewMenuAction.
- * @param window
- */
-public ShowViewMenuAction(WorkbenchWindow window) {
- super(window);
- WorkbenchHelp.setHelp(this, IHelpContextIds.SHOW_VIEW_MENU_ACTION);
-}
-
-/**
- * Initialize the menu text and tooltip.
- */
-protected void initText() {
- setText(WorkbenchMessages.getString("ShowViewMenuAction.text")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("ShowViewMenuAction.toolTip")); //$NON-NLS-1$
- setAccelerator(SWT.CTRL | SWT.F10);
-}
-/**
- * Show the pane title menu.
- */
-protected void showMenu(PartPane pane) {
- pane.showViewMenu();
-}
-
-/**
- * Updates the enabled state.
- */
-protected void updateState() {
- super.updateState();
-
- //All of the conditions in the super class passed
- //now check for the menu.
- if (isEnabled()) {
- PartPane pane = (((PartSite) getActivePart().getSite()).getPane());
- setEnabled(
- (pane instanceof ViewPane)
- && ((ViewPane) pane).hasViewMenu());
- }
-}
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SubActionBars.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SubActionBars.java
deleted file mode 100644
index f9f67c9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SubActionBars.java
+++ /dev/null
@@ -1,264 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-
-/**
- * <code>PartActionBars</code> is the general implementation for an
- * <code>IActionBars</code>.
- */
-public class SubActionBars implements IActionBars
-{
- protected IActionBars parent;
- protected boolean active = false;
- private Map actionHandlers;
- protected SubMenuManager menuMgr;
- protected SubStatusLineManager statusLineMgr;
- protected SubToolBarManager toolBarMgr;
- private ListenerList propertyChangeListeners = new ListenerList();
- private boolean actionHandlersChanged;
-
- /** Property constant for changes to action handlers. */
- public static final String P_ACTION_HANDLERS = "org.eclipse.ui.internal.actionHandlers";//$NON-NLS-1$
-/**
- * Construct a new PartActionBars object.
- */
-public SubActionBars(IActionBars parent) {
- this.parent = parent;
-}
-/**
- * Activate the contributions.
- */
-public void activate() {
- activate(true);
-}
-/**
- * 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.</p>
- */
-public void activate(boolean forceVisibility) {
- setActive(true);
-}
-/**
- * Adds a property change listener.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a property change listener
- */
-public void addPropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.add(listener);
-}
-/**
- * Clear the global action handlers.
- */
-public void clearGlobalActionHandlers() {
- if (actionHandlers != null) {
- actionHandlers.clear();
- actionHandlersChanged = true;
- }
-}
-/**
- * Returns a new sub menu manager.
- *
- * @param parent the parent menu manager
- * @return the menu manager
- */
-protected SubMenuManager createSubMenuManager(IMenuManager parent) {
- return new SubMenuManager(parent);
-}
-/**
- * Returns a new sub tool bar manager.
- *
- * @param parent the parent tool bar manager
- * @return the tool bar manager
- */
-protected SubToolBarManager createSubToolBarManager(IToolBarManager parent) {
- return new SubToolBarManager(parent);
-}
-/**
- * Deactivate the contributions.
- */
-public void deactivate() {
- deactivate(true);
-}
-/**
- * Deactivate the contributions.
- * <p>
- * Workaround for menubar/toolbar layout flashing when editors have
- * many contributions. In this case we want to force the contributions
- * to be visible/hidden only when required, otherwise just change
- * the enablement state.</p>
- */
-public void deactivate(boolean forceHide) {
- setActive(false);
-}
-/**
- * Dispose the contributions.
- */
-public void dispose() {
- if (actionHandlers != null)
- actionHandlers.clear();
- if (menuMgr != null)
- menuMgr.removeAll();
- if (statusLineMgr != null)
- statusLineMgr.removeAll();
- if (toolBarMgr != null)
- toolBarMgr.removeAll();
-}
-/**
- * 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
- *
- * @see IPropertyChangeListener#propertyChange
- */
-protected void firePropertyChange(PropertyChangeEvent event) {
- Object[] listeners = propertyChangeListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- ((IPropertyChangeListener) listeners[i]).propertyChange(event);
- }
-}
-/**
- * Notifies any property change listeners if the
- * global action handlers have changed
- */
-protected void fireActionHandlersChanged() {
- if (actionHandlersChanged) {
- // Doesn't actually pass the old and new values
- firePropertyChange(new PropertyChangeEvent(this, P_ACTION_HANDLERS, null, null));
- actionHandlersChanged = false;
- }
-}
-/**
- * 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.
- */
-public IAction getGlobalActionHandler(String actionID) {
- if (actionHandlers == null)
- return null;
- return (IAction) actionHandlers.get(actionID);
-}
-/**
- * Returns the complete list of active global action handlers.
- * If there are no global action handlers registered return null.
- */
-public Map getGlobalActionHandlers() {
- return actionHandlers;
-}
-/**
- * Returns the abstract menu manager. If items are added or
- * removed from the manager be sure to call <code>updateActionBars</code>.
- *
- * @return the menu manager
- */
-public IMenuManager getMenuManager() {
- if (menuMgr == null) {
- menuMgr = createSubMenuManager(parent.getMenuManager());
- menuMgr.setVisible(active);
- }
- return menuMgr;
-}
-/**
- * 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
- */
-public IStatusLineManager getStatusLineManager() {
- if (statusLineMgr == null) {
- 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>.
- *
- * @return the tool bar manager
- */
-public IToolBarManager getToolBarManager() {
- if (toolBarMgr == null) {
- toolBarMgr = createSubToolBarManager(parent.getToolBarManager());
- toolBarMgr.setVisible(active);
- }
- return toolBarMgr;
-}
-/**
- * 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 all the action vector is shared by editors of the same type.
- */
-public void partChanged(IWorkbenchPart part) {
-}
-/**
- * Removes the given property change listener.
- * Has no effect if an identical listener is not registered.
- *
- * @param listener a property change listener
- */
-public void removePropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.remove(listener);
-}
-/**
- * Activate / Deactivate the contributions.
- */
-protected void setActive(boolean set) {
- active = set;
- if (menuMgr != null)
- menuMgr.setVisible(set);
-
- if (statusLineMgr != null)
- statusLineMgr.setVisible(set);
-
- if (toolBarMgr != null)
- toolBarMgr.setVisible(set);
-}
-/**
- * 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.
- */
-public void setGlobalActionHandler(String actionID, IAction handler) {
- if (handler != null) {
- if (actionHandlers == null)
- actionHandlers = new HashMap(11);
- actionHandlers.put(actionID, handler);
- } else {
- if (actionHandlers != null)
- actionHandlers.remove(actionID);
- }
- actionHandlersChanged = true;
-}
-/**
- * Commits all UI changes. This should be called
- * after additions or subtractions have been made to a
- * menu, status line, or toolbar.
- */
-public void updateActionBars() {
- parent.updateActionBars();
- fireActionHandlersChanged();
-}
-}
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
deleted file mode 100644
index 75abeee..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SwitchToWindowMenu.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.window.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-
-/**
- * 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 WorkbenchWindow workbenchWindow;
- 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(WorkbenchWindow window, boolean showSeparator) {
- super("Switch To Window"); //$NON-NLS-1$
- 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)
- return null;
-
- StringBuffer sb = new StringBuffer();
- 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();
- }
-
- /**
- * Fills the given menu with menu items for all
- * opened workbench windows.
- */
- 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)
- return;
-
- // Add separator.
- if (showSeparator) {
- new MenuItem(menu, SWT.SEPARATOR, index);
- ++index;
- }
-
- // Add one item for each window.
- int count = 1;
- for (int i = 0; i < array.length; i++) {
- final IWorkbenchWindow window = array[i];
- // 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(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- Shell windowShell = window.getShell();
- if (windowShell.getMinimized())
- windowShell.setMinimized(false);
- windowShell.forceFocus();
- windowShell.moveAbove(null);
- }
- });
- mi.setSelection(window == workbenchWindow);
- }
- }
- }
- }
-
- /**
- * Overridden to always return true and force dynamic menu building.
- */
- public boolean isDynamic() {
- return true;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SystemSummaryEditorInput.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SystemSummaryEditorInput.java
deleted file mode 100644
index 083ccbd..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SystemSummaryEditorInput.java
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SystemSummaryEditorInputFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SystemSummaryEditorInputFactory.java
deleted file mode 100644
index 066f079..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SystemSummaryEditorInputFactory.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.IElementFactory;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.internal.*;
-
-/**
- * The <code>SystemSummaryEditorInputFactory</code> creates
- * <code>SystemSummaryEditorInput</code> objects.
- */
-public class SystemSummaryEditorInputFactory implements IElementFactory {
- /*
- * The ID of the factory that creates this input.
- */
- static final String FACTORY_ID = WorkbenchPlugin.getDefault().getDescriptor().getUniqueIdentifier() + ".SystemSummaryEditorInputFactory"; //$NON-NLS-1$
-
- /**
- * Creates the factory, should not be called
- */
- public SystemSummaryEditorInputFactory() {
- super();
- }
-
- /**
- * @see org.eclipse.ui.IElementFactory#createElement(IMemento)
- */
- public IAdaptable createElement(IMemento memento) {
- return new SystemSummaryEditorInput();
- }
-}
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
deleted file mode 100644
index 29a8f97..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ToggleEditorsVisibilityAction.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.help.*;
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.*;
-
-/**
- * Hides or shows the editor area within the current
- * perspective of the workbench page.
- */
-public class ToggleEditorsVisibilityAction extends Action {
- private IWorkbenchWindow workbenchWindow;
-/**
- * Creates a new <code>ToggleEditorsVisibilityAction</code>
- */
-public ToggleEditorsVisibilityAction(IWorkbenchWindow window) {
- super(WorkbenchMessages.getString("ToggleEditor.hideEditors")); //$NON-NLS-1$
- setToolTipText(WorkbenchMessages.getString("ToggleEditor.toolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.TOGGLE_EDITORS_VISIBILITY_ACTION);
- setEnabled(false);
- this.workbenchWindow = window;
-
- // Once the API on IWorkbenchPage to hide/show
- // the editor area is removed, then switch
- // to using the internal perspective service
- window.addPerspectiveListener(new org.eclipse.ui.IPerspectiveListener() {
- public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- if (page.isEditorAreaVisible())
- setText(WorkbenchMessages.getString("ToggleEditor.hideEditors")); //$NON-NLS-1$
- else
- setText(WorkbenchMessages.getString("ToggleEditor.showEditors")); //$NON-NLS-1$
- }
- 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.getString("ToggleEditor.hideEditors")); //$NON-NLS-1$
- else
- setText(WorkbenchMessages.getString("ToggleEditor.showEditors")); //$NON-NLS-1$
- }
- }
- });
-}
-/**
- * Implementation of method defined on <code>IAction</code>.
- */
-public void run() {
- boolean visible = workbenchWindow.getActivePage().isEditorAreaVisible();
- if (visible) {
- workbenchWindow.getActivePage().setEditorAreaVisible(false);
- setText(WorkbenchMessages.getString("ToggleEditor.showEditors")); //$NON-NLS-1$
- }
- else {
- workbenchWindow.getActivePage().setEditorAreaVisible(true);
- setText(WorkbenchMessages.getString("ToggleEditor.hideEditors")); //$NON-NLS-1$
- }
-}
-}
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
deleted file mode 100644
index 06c1062..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UISynchronizer.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Synchronizer;
-
-public class UISynchronizer extends Synchronizer {
- protected UIWorkspaceLock uiLock;
-public UISynchronizer(Display display, UIWorkspaceLock lock) {
- super(display);
- this.uiLock = lock;
-}
-public void syncExec(Runnable runnable) {
- if ((runnable == null) || uiLock.isUI() || !uiLock.isCurrentOperation()) {
- super.syncExec(runnable);
- return;
- }
- Runnable runOnce = new Runnable() {
- public void run() {
- uiLock.doPendingWork();
- }
- };
- Semaphore work = new Semaphore(runnable);
- work.setOperationThread(Thread.currentThread());
- uiLock.addPendingWork(work);
- if (!uiLock.isUIWaiting())
- asyncExec(runOnce);
- else
- uiLock.interruptUI();
- try {
- work.acquire();
- } catch (InterruptedException e) {
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UIWorkspaceLock.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UIWorkspaceLock.java
deleted file mode 100644
index b8ce9f4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/UIWorkspaceLock.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.WorkspaceLock;
-import org.eclipse.swt.widgets.Display;
-
-public class UIWorkspaceLock extends WorkspaceLock {
- protected Display display;
- protected Thread ui;
- protected Semaphore pendingWork;
- protected boolean pendingWorkStarted;
-public UIWorkspaceLock(IWorkspace workspace, Display display) throws CoreException {
- super(workspace);
- this.display = display;
- pendingWorkStarted = false;
-}
-public boolean acquire() throws InterruptedException {
- if (isUI()) {
- Thread currentOperation = getCurrentOperationThread();
- if (currentOperation != null) {
- if (display.getSyncThread() == currentOperation && isTreeLocked())
- throw new RuntimeException(WorkbenchMessages.getString("UIWorkspaceLock.errorModDuringNotification")); //$NON-NLS-1$
- // If a syncExec was executed from the current operation, it
- // has already acquired the lock. So, just return true.
- if (pendingWork != null && pendingWorkStarted && pendingWork.getOperationThread() == currentOperation) {
- if (isTreeLocked())
- throw new RuntimeException(WorkbenchMessages.getString("UIWorkspaceLock.errorModDuringNotification")); //$NON-NLS-1$
- else
- return true; // we are a nested operation
- }
- }
- ui = Thread.currentThread();
- doPendingWork();
- }
- return super.acquire();
-}
-void addPendingWork(Semaphore work) {
- pendingWork = work;
-}
-/**
- * Should always be called from the UI thread.
- */
-void doPendingWork() {
- if (pendingWork == null)
- return;
- try {
- pendingWorkStarted = true;
- pendingWork.getRunnable().run();
- } finally {
- // only null it after running
- Semaphore temp = pendingWork;
- // the following lines have to be done in
- // that order to avoid concurrency problems
- pendingWork = null;
- pendingWorkStarted = false;
- temp.release();
- }
-}
-void interruptUI() {
- display.getThread().interrupt();
-}
-boolean isCurrentOperation() {
- return getCurrentOperationThread() == Thread.currentThread();
-}
-boolean isUI() {
- return (!display.isDisposed()) && (display.getThread() == Thread.currentThread());
-}
-boolean isUIWaiting() {
- return (ui != null) && (Thread.currentThread() != ui);
-}
-public void release() {
- if (isUI())
- ui = null;
- super.release();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewActionBars.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewActionBars.java
deleted file mode 100644
index c18dd62..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewActionBars.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.internal.PartPane;
-
-/**
- * An editor container manages the services for an editor.
- */
-public class ViewActionBars extends SubActionBars
-{
- private ViewPane pane;
-/**
- * ViewActionBars constructor comment.
- */
-public ViewActionBars(IActionBars parent, ViewPane pane) {
- super(parent);
- this.pane = pane;
-}
-/**
- * Returns the menu manager. If items are added or
- * removed from the manager be sure to call <code>updateActionBars</code>.
- *
- * @return the menu manager
- */
-public IMenuManager getMenuManager() {
- return pane.getMenuManager();
-}
-/**
- * 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
- */
-public IToolBarManager getToolBarManager() {
- return pane.getToolBarManager();
-}
-/**
- * Commits all UI changes. This should be called
- * after additions or subtractions have been made to a
- * menu, status line, or toolbar.
- */
-public void updateActionBars() {
- pane.updateActionBars();
- getStatusLineManager().update(false);
- fireActionHandlersChanged();
-}
-}
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
deleted file mode 100644
index 44579b9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewActionBuilder.java
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewFactory.java
deleted file mode 100644
index efa237f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewFactory.java
+++ /dev/null
@@ -1,336 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.internal.registry.IViewDescriptor;
-import org.eclipse.ui.internal.registry.IViewRegistry;
-
-/**
- * The ViewFactory is used to control the creation and disposal of views.
- * It implements a reference counting strategy so that one view can be shared
- * by more than one client.
- */
-public class ViewFactory
-{
- static boolean DEBUG = false;
- private WorkbenchPage page;
- private IViewRegistry viewReg;
- private ReferenceCounter counter;
- private HashMap mementoTable = new HashMap();
-
-/**
- * ViewManager constructor comment.
- */
-public ViewFactory(WorkbenchPage page, IViewRegistry reg) {
- super();
- this.page = page;
- this.viewReg = reg;
- counter = new ReferenceCounter();
-}
-/**
- * Creates an instance of a view defined by id.
- *
- * This factory implements reference counting. The first call to this
- * method will return a new view. Subsequent calls will return the
- * first view with an additional reference count. The view is
- * disposed when releaseView is called an equal number of times
- * to getView.
- */
-public IViewReference createView(final String id) throws PartInitException {
- IViewDescriptor desc = viewReg.find(id);
- if(desc == null)
- throw new PartInitException(WorkbenchMessages.format("ViewFactory.couldNotCreate", new Object[] {id})); //$NON-NLS-1$
- IViewReference ref = (IViewReference)counter.get(desc);
- if (ref == null) {
- ref = new ViewReference(id);
- counter.put(desc,ref);
- } else {
- counter.addRef(desc);
- }
- return ref;
-}
-/**
- * Creates an instance of a view defined by id.
- *
- * This factory implements reference counting. The first call to this
- * method will return a new view. Subsequent calls will return the
- * first view with an additional reference count. The view is
- * disposed when releaseView is called an equal number of times
- * to getView.
- */
-public IStatus restoreView(final IViewReference ref) {
- final IStatus result[] = new IStatus[1];
- BusyIndicator.showWhile(
- page.getWorkbenchWindow().getShell().getDisplay(),
- new Runnable() {
- public void run() {
- result[0] = busyRestoreView(ref);
- }
- }
- );
- return result[0];
-}
-public IStatus busyRestoreView(final IViewReference ref) {
- if(ref.getPart(false) != null)
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
-
- final String viewID = ref.getId();
- final IMemento stateMem = (IMemento)mementoTable.get(viewID);
- mementoTable.remove(viewID);
-
- final IStatus result[] = new IStatus[]{new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null)};
- Platform.run(new SafeRunnable() {
- public void run() {
- IViewDescriptor desc = viewReg.find(viewID);
- if(desc == null) {
- result[0] = new Status(
- IStatus.ERROR,PlatformUI.PLUGIN_ID,0,
- WorkbenchMessages.format("ViewFactory.couldNotCreate", new Object[] {viewID}), //$NON-NLS-1$
- null);
- return;
- }
-
- // Debugging
- if (DEBUG)
- System.out.println("Create " + desc.getLabel());//$NON-NLS-1$
-
- // Create the view.
- IViewPart view = null;
- try {
- view = desc.createView();
- ((ViewReference)ref).setPart(view);
- } catch (CoreException e) {
- result[0] = new Status(
- IStatus.ERROR,PlatformUI.PLUGIN_ID,0,
- WorkbenchMessages.format("ViewFactory.initException", new Object[] {desc.getID()}), //$NON-NLS-1$
- e);
- return;
- }
-
- // Create site
- ViewSite site = new ViewSite(view, page, desc);
- try {
- view.init(site,stateMem);
- } catch (PartInitException e) {
- releaseView(viewID);
- result[0] = new Status(
- IStatus.ERROR,PlatformUI.PLUGIN_ID,0,
- WorkbenchMessages.format("Perspective.exceptionRestoringView",new String[]{viewID}), //$NON-NLS-1$
- e);
- return;
- }
- if (view.getSite() != site) {
- releaseView(viewID);
- result[0] = new Status(
- IStatus.ERROR,PlatformUI.PLUGIN_ID,0,
- WorkbenchMessages.format("ViewFactory.siteException", new Object[] {desc.getID()}), //$NON-NLS-1$
- null);
- return;
- }
-
- PartPane pane = ((ViewReference)ref).getPane();
- if(pane == null) {
- pane = new ViewPane(ref,page);
- ((ViewReference)ref).setPane(pane);
- }
- site.setPane(pane);
- site.setActionBars(new ViewActionBars(page.getActionBars(), (ViewPane)pane));
- site.getPane().createChildControl();
- result[0] = new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
- }
- public void handleException(Throwable e) {
- //Execption is already logged.
- result[0] = new Status(
- IStatus.ERROR,PlatformUI.PLUGIN_ID,0,
- WorkbenchMessages.format("Perspective.exceptionRestoringView",new String[]{viewID}), //$NON-NLS-1$
- e);
-
- }
- });
- return result[0];
-}
-
-public IStatus saveState(IMemento memento) {
- final MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.getString("ViewFactory.problemsSavingViews"),null);
-
- final IViewReference refs[] = getViews();
- for (int i = 0; i < refs.length; i++) {
- final IMemento viewMemento = memento.createChild(IWorkbenchConstants.TAG_VIEW);
- viewMemento.putString(IWorkbenchConstants.TAG_ID, refs[i].getId());
- final IViewPart view = (IViewPart)refs[i].getPart(false);
- if(view != null) {
- final int index = i;
- Platform.run(new SafeRunnable() {
- public void run() {
- view.saveState(viewMemento.createChild(IWorkbenchConstants.TAG_VIEW_STATE));
- }
- public void handleException(Throwable e) {
- result.add(new Status(
- IStatus.ERROR,PlatformUI.PLUGIN_ID,0,
- WorkbenchMessages.format("ViewFactory.couldNotSave",new String[]{refs[index].getTitle()}),
- e));
- }
- });
- } else {
- IMemento mem = (IMemento)mementoTable.get(refs[i].getId());
- if(mem != null) {
- IMemento child = viewMemento.createChild(IWorkbenchConstants.TAG_VIEW_STATE);
- child.putMemento(mem);
- }
- }
- }
- return result;
-}
-public IStatus restoreState(IMemento memento) {
- IMemento mem[] = memento.getChildren(IWorkbenchConstants.TAG_VIEW);
- for (int i = 0; i < mem.length; i++) {
- String id = mem[i].getString(IWorkbenchConstants.TAG_ID);
- mementoTable.put(id,mem[i].getChild(IWorkbenchConstants.TAG_VIEW_STATE));
- }
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
-}
-/**
- * Remove a view rec from the manager.
- *
- * The IViewPart.dispose method must be called at a higher level.
- */
-private void destroyView(IViewDescriptor desc, IViewPart view)
-{
- // Debugging
- if (DEBUG)
- System.out.println("Dispose " + desc.getLabel());//$NON-NLS-1$
-
- // Free action bars, pane, etc.
- PartSite site = (PartSite)view.getSite();
- ViewActionBars actionBars = (ViewActionBars)site.getActionBars();
- actionBars.dispose();
- PartPane pane = site.getPane();
- pane.dispose();
-
- // Free the site.
- site.dispose();
-}
-/**
- * Returns the view with the given id, or <code>null</code> if not found.
- */
-public IViewReference getView(String id) {
- IViewDescriptor desc = viewReg.find(id);
- return (IViewReference) counter.get(desc);
-}
-/**
- * Returns a list of views which are open.
- */
-public IViewReference[] getViews() {
- List list = counter.values();
- IViewReference [] array = new IViewReference[list.size()];
- for (int i = 0; i < array.length; i++) {
- array[i] = (IViewReference)list.get(i);
- }
- return array;
-}
-/**
- * Returns whether a view with the given id exists.
- */
-public boolean hasView(String id) {
- IViewDescriptor desc = viewReg.find(id);
- Object view = counter.get(desc);
- return (view != null);
-}
-/**
- * Releases an instance of a view defined by id.
- *
- * This factory does reference counting. For more info see
- * getView.
- */
-public void releaseView(String id) {
- IViewDescriptor desc = viewReg.find(id);
- IViewReference ref = (IViewReference)counter.get(desc);
- if (ref == null)
- return;
- int count = counter.removeRef(desc);
- if (count <= 0) {
- IViewPart view = (IViewPart)ref.getPart(false);
- if(view != null)
- destroyView(desc, view);
- }
-}
-
-private class ViewReference extends WorkbenchPartReference implements IViewReference {
-
- public ViewReference(String id) {
- ViewDescriptor desc = (ViewDescriptor)viewReg.find(id);
- ImageDescriptor iDesc = null;
- String title = null;
- if(desc != null) {
- iDesc = desc.getImageDescriptor();
- title = desc.getLabel();
- }
- init(id,title,null,iDesc);
- }
-
- /**
- * @see IViewReference#isFastView()
- */
- public boolean isFastView() {
- return page.isFastView(this);
- }
- public IViewPart getView(boolean restore) {
- return (IViewPart)getPart(restore);
- }
- public String getRegisteredName() {
- if(part != null)
- return part.getSite().getRegisteredName();
-
- IViewRegistry reg = WorkbenchPlugin.getDefault().getViewRegistry();
- IViewDescriptor desc = reg.find(getId());
- if(desc != null)
- return desc.getLabel();
- return getTitle();
- }
- /**
- * @see IWorkbenchPartReference#getPart(boolean)
- */
- public IWorkbenchPart getPart(boolean restore) {
- if(part != null)
- return part;
- if(restore) {
- IStatus status = restoreView(this);
- if(status.getSeverity() == IStatus.ERROR) {
- Workbench workbench = (Workbench)PlatformUI.getWorkbench();
- if(!workbench.isStarting()) {
- ErrorDialog.openError(
- page.getWorkbenchWindow().getShell(),
- WorkbenchMessages.getString("ViewFactory.unableToRestoreViewTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("ViewFactory.unableToRestoreViewMessage",new String[]{getTitle()}), //$NON-NLS-1$
- status,
- IStatus.WARNING | IStatus.ERROR);
- }
- } else {
- releaseReferences();
- }
- }
- return part;
- }
- public IWorkbenchPage getPage() {
- return page;
- }
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewPane.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewPane.java
deleted file mode 100644
index 50a447d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewPane.java
+++ /dev/null
@@ -1,666 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2001, 2002, International Business Machines Corp and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Cagatay Kavukcuoglu <cagatayk@acm.org>
- - Fix for bug 10025 - Resizing views should not use height ratios
-**********************************************************************/
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.PartPane.Sashes;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.part.WorkbenchPart;
-
-
-/**
- * Provides support for a title bar where the
- * title and icon of the view can be displayed.
- * Along with an X icon to close the view, and
- * a pin icon to attach the view back to the
- * main layout.
- *
- * Also provides support to add tool icons and menu
- * icon on the system bar if required by the view
- * part.
- */
-public class ViewPane extends PartPane
- implements IPropertyListener
-{
- private CLabel titleLabel;
-
- private boolean fast = false;
- private boolean showFocus = false;
- private ToolBar viewToolBar;
- private ToolBarManager viewToolBarMgr;
- private ToolBar isvToolBar;
- private ToolBarManager isvToolBarMgr;
- private MenuManager isvMenuMgr;
- private ToolItem pullDownButton;
- private ActionDescriptor[] extendedActions;
-
- /**
- * Indicates whether a toolbar button is shown for the view local menu.
- */
- private boolean showMenuButton = false;
-
- //Created in o.e.ui.Perspective, disposed there.
- private Sash fastViewSash;
-
-
- /**
- * Toolbar manager for the ISV toolbar.
- */
- class PaneToolBarManager extends ToolBarManager {
- public PaneToolBarManager(ToolBar paneToolBar) {
- super(paneToolBar);
- }
-
- protected void relayout(ToolBar toolBar, int oldCount, int newCount) {
- toolBar.layout();
- Composite parent = toolBar.getParent();
- parent.layout();
- if (parent.getParent() != null)
- parent.getParent().layout();
- }
- }
-
- /**
- * Menu manager for view local menu.
- */
- class PaneMenuManager extends MenuManager {
- public PaneMenuManager() {
- super("View Local Menu");//$NON-NLS-1$
- }
- protected void update(boolean force, boolean recursive) {
- // Changes to the menu can affect whether the toolbar has a menu button.
- // Update it if necessary.
- if (showMenuButton != !isEmpty()) {
- viewToolBarMgr.update(true);
- }
- super.update(force, recursive);
- }
- }
-
- /**
- * Contributes system actions to toolbar.
- */
- class SystemContribution extends ContributionItem {
- public boolean isDynamic() {
- return true;
- }
-
- public void fill(ToolBar toolbar, int index) {
- showMenuButton = (isvMenuMgr != null && !isvMenuMgr.isEmpty());
- if (showMenuButton) {
- pullDownButton = new ToolItem(toolbar, SWT.PUSH, index++);
- Image img = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU);
- pullDownButton.setDisabledImage(img); // PR#1GE56QT - Avoid creation of unnecessary image.
- pullDownButton.setImage(img);
- pullDownButton.setToolTipText(WorkbenchMessages.getString("Menu")); //$NON-NLS-1$
- pullDownButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- showViewMenu();
- }
- });
- }
- else {
- // clear out the button if we don't need it anymore
- pullDownButton = null;
- }
-
- // check the current internal fast view state
- if (fast) {
- ToolItem dockButton = new ToolItem(toolbar, SWT.CHECK, index++);
- dockButton.setSelection(true);
- Image img = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_PIN_VIEW);
- dockButton.setDisabledImage(img); // PR#1GE56QT - Avoid creation of unnecessary image.
- dockButton.setImage(img);
- dockButton.setToolTipText(WorkbenchMessages.getString("ViewPane.pin")); //$NON-NLS-1$
- dockButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- doDock();
- }
- });
-
- ToolItem minimizeButton = new ToolItem(toolbar, SWT.PUSH, index++);
- img = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_MIN_VIEW);
- minimizeButton.setDisabledImage(img); // PR#1GE56QT - Avoid creation of unnecessary image.
- minimizeButton.setImage(img);
- minimizeButton.setToolTipText(WorkbenchMessages.getString("ViewPane.minimize")); //$NON-NLS-1$
- minimizeButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- doMinimize();
- }
- });
- }
-
- ToolItem closeButton= new ToolItem(toolbar, SWT.PUSH, index++);
- Image img = WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_LCL_CLOSE_VIEW);
- closeButton.setDisabledImage(img); // PR#1GE56QT - Avoid creation of unnecessary image.
- closeButton.setImage(img);
- closeButton.setToolTipText(WorkbenchMessages.getString("Close")); //$NON-NLS-1$
- closeButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- doHide();
- }
- });
- }
- }
-
- private SystemContribution systemContribution = new SystemContribution();
-
-/**
- * Constructs a view pane for a view part.
- */
-public ViewPane(IViewReference ref, WorkbenchPage page) {
- super(ref, page);
-}
-/**
- * Create control. Add the title bar.
- */
-public void createControl(Composite parent) {
- // Only do this once.
- if (getControl() != null && !getControl().isDisposed())
- return;
-
- super.createControl(parent);
-
- // Only include the ISV toolbar and the content in the tab list.
- // All actions on the System toolbar should be accessible on the pane menu.
- if (control.getContent() == null) {
- // content can be null if view creation failed
- control.setTabList(new Control[] { isvToolBar, viewToolBar });
- }
- else {
- control.setTabList(new Control[] { isvToolBar, viewToolBar, control.getContent() });
- }
-}
-public ActionDescriptor[] getExtendedActions() {
- if(extendedActions == null)
- return new ActionDescriptor[0];
- return extendedActions;
-}
-
-protected void createChildControl() {
- final IWorkbenchPart part[] = new IWorkbenchPart[]{partReference.getPart(false)};
- if(part[0] == null)
- return;
-
- if(control == null || control.getContent() != null)
- return;
-
- super.createChildControl();
-
- Platform.run(new SafeRunnable() {
- public void run() {
- // Install the part's tools and menu
- ViewActionBuilder builder = new ViewActionBuilder();
- builder.readActionExtensions((IViewPart)getViewReference().getPart(true));
- extendedActions = builder.getExtendedActions();
- updateActionBars();
- }
- public void handleException(Throwable e) {
- //Just have it logged.
- }
- });
-}
-protected WorkbenchPart createErrorPart(WorkbenchPart oldPart) {
- class ErrorViewPart extends ViewPart {
- private Text text;
- public void createPartControl(Composite parent) {
- 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.getString("ViewPane.errorMessage")); //$NON-NLS-1$
- }
- public void setFocus() {
- if (text != null) text.setFocus();
- }
- public void setSite(IWorkbenchPartSite site) {
- super.setSite(site);
- }
- public void setTitle(String title) {
- super.setTitle(title);
- }
- }
- ErrorViewPart newPart = new ErrorViewPart();
- PartSite site = (PartSite)oldPart.getSite();
- newPart.setSite(site);
- newPart.setTitle(site.getRegisteredName());
- site.setPart(newPart);
- return newPart;
-}
-
-/**
- * See LayoutPart
- */
-public boolean isDragAllowed(Point p) {
- // See also similar restrictions in addMoveItems method
- // No need to worry about fast views as they do not
- // register for D&D operations
- return !overImage(p.x) && !isZoomed();
-}
-/*
- * Return true if <code>x</code> is over the label image.
- */
-private boolean overImage(int x) {
- return x < titleLabel.getImage().getBounds().width;
-}
-/**
- * Create a title bar for the pane.
- * - the view icon and title to the far left
- * - the view toolbar appears in the middle.
- * - the view pulldown menu, pin button, and close button to the far right.
- */
-protected void createTitleBar() {
- // Only do this once.
- if (titleLabel != null)
- return;
-
- // Title.
- titleLabel = new CLabel(control, SWT.SHADOW_NONE);
- titleLabel.setAlignment(SWT.LEFT);
- titleLabel.setBackground(null, null);
- titleLabel.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- if (e.button == 3)
- showPaneMenu(titleLabel,new Point(e.x, e.y));
- else if ((e.button == 1) && overImage(e.x))
- showPaneMenu();
- }
- public void mouseDoubleClick(MouseEvent event){
- doZoom();
- }
- });
- updateTitles();
- control.setTopLeft(titleLabel);
-
- // Listen to title changes.
- getPartReference().addPropertyListener(this);
-
- // View toolbar
- viewToolBar = new ToolBar(control, SWT.FLAT | SWT.WRAP);
- control.setTopRight(viewToolBar);
- viewToolBar.addMouseListener(new MouseAdapter(){
- public void mouseDoubleClick(MouseEvent event) {
- // 1GD0ISU: ITPUI:ALL - Dbl click on view tool cause zoom
- if (viewToolBar.getItem(new Point(event.x, event.y)) == null)
- doZoom();
- }
- });
- viewToolBarMgr = new PaneToolBarManager(viewToolBar);
- viewToolBarMgr.add(systemContribution);
-
- // ISV toolbar.
- isvToolBar = new ToolBar(control, SWT.FLAT | SWT.WRAP);
- control.setTopCenter(isvToolBar);
- isvToolBar.addMouseListener(new MouseAdapter(){
- public void mouseDoubleClick(MouseEvent event) {
- // 1GD0ISU: ITPUI:ALL - Dbl click on view tool cause zoom
- if (isvToolBar.getItem(new Point(event.x, event.y)) == null)
- doZoom();
- }
- });
- isvToolBarMgr = new PaneToolBarManager(isvToolBar);
-}
-/**
- * @see PartPane#doHide
- */
-public void doHide() {
- getPage().hideView(getViewReference());
-}
-/**
- * Make this view pane a fast view
- */
-protected void doMakeFast() {
- getPage().addFastView(getViewReference());
-}
-/**
- * Hide the fast view
- */
-protected void doMinimize() {
- getPage().toggleFastView(getViewReference());
-}
-/**
- * Pin the view.
- */
-protected void doDock() {
- getPage().removeFastView(getViewReference());
-}
-
-/**
- * Draws the applicable gradient on the view's title area
- */
-/* package */ void drawGradient() {
- if (titleLabel == null || viewToolBar == null || isvToolBar == null)
- return;
- if (showFocus) {
- if (getShellActivated()) {
- titleLabel.setBackground(WorkbenchColors.getActiveViewGradient(), WorkbenchColors.getActiveViewGradientPercents());
- titleLabel.setForeground(WorkbenchColors.getSystemColor(SWT.COLOR_TITLE_FOREGROUND));
- titleLabel.update();
- viewToolBar.setBackground(WorkbenchColors.getActiveViewGradientEnd());
- isvToolBar.setBackground(WorkbenchColors.getActiveViewGradientEnd());
- }
- else {
- titleLabel.setBackground(WorkbenchColors.getDeactivatedViewGradient(), WorkbenchColors.getDeactivatedViewGradientPercents());
- titleLabel.setForeground(WorkbenchColors.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND));
- titleLabel.update();
- viewToolBar.setBackground(WorkbenchColors.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- isvToolBar.setBackground(WorkbenchColors.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- }
- }
- else {
- titleLabel.setBackground(null, null);
- titleLabel.setForeground(null);
- titleLabel.update();
- viewToolBar.setBackground(WorkbenchColors.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- isvToolBar.setBackground(WorkbenchColors.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- }
-}
-
-/**
- * Returns the drag control.
- */
-public Control getDragHandle() {
- return titleLabel;
-}
-/**
- * @see ViewActionBars
- */
-public MenuManager getMenuManager() {
- if (isvMenuMgr == null)
- isvMenuMgr = new PaneMenuManager();
- return isvMenuMgr;
-}
-
-/**
- * Returns the tab list to use when this part is active.
- * Includes the view and its tab (if applicable), in the appropriate order.
- */
-public Control[] getTabList() {
- Control c = getControl();
- if (getContainer() instanceof PartTabFolder) {
- PartTabFolder tf = (PartTabFolder) getContainer();
- CTabFolder f = (CTabFolder) tf.getControl();
- if (f.getItemCount() > 1) {
- if ((f.getStyle() & SWT.TOP) != 0) {
- return new Control[] { f, c };
- }
- else {
- return new Control[] { c, f };
- }
- }
- }
- return new Control[] { c };
-}
-
-/**
- * @see ViewActionBars
- */
-public ToolBarManager getToolBarManager() {
- return isvToolBarMgr;
-}
-/**
- * Answer the view part child.
- */
-public IViewReference getViewReference() {
- return (IViewReference)getPartReference();
-}
-/**
- * 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
- */
-public void propertyChanged(Object source, int propId) {
- if (propId == IWorkbenchPart.PROP_TITLE)
- updateTitles();
-}
-/**
- * Sets the fast view state. If this view is a fast view then
- * various controls like pin and minimize are added to the
- * system bar.
- */
-public void setFast(boolean b) {
- fast = b;
- if (viewToolBarMgr != null) {
- viewToolBarMgr.update(true);
- }
-}
-public void setFastViewSash(Sash s) {
- fastViewSash = s;
-}
-
-/* (non-Javadoc)
- * Method declared on PartPane.
- */
-/* package */ void shellActivated() {
- drawGradient();
-}
-
-/* (non-Javadoc)
- * Method declared on PartPane.
- */
-/* package */ void shellDeactivated() {
- drawGradient();
-}
-
-/**
- * Indicate focus in part.
- */
-public void showFocus(boolean inFocus) {
- if (titleLabel == null)
- return;
-
- showFocus = inFocus;
- drawGradient();
-}
-
-/**
- * Shows the pane menu (system menu) for this pane.
- */
-public void showPaneMenu() {
- // If this is a fast view, it may have been minimized. Do nothing in this case.
- if(isFastView() && (page.getActiveFastView() != getViewReference()))
- return;
- Rectangle bounds = titleLabel.getBounds();
- showPaneMenu(titleLabel,new Point(0,bounds.height));
-}
-/**
- * Return true if this view is a fast view.
- */
-private boolean isFastView() {
- return page.isFastView(getViewReference());
-}
-/**
- * Finds and return the sashes around this part.
- */
-protected Sashes findSashes() {
- Sashes result = new Sashes();
- if(isFastView()) {
- result.right = fastViewSash;
- return result;
- }
- RootLayoutContainer container = getRootContainer();
- if(container == null)
- return result;
-
- if (this.getContainer() instanceof PartTabFolder)
- container.findSashes((PartTabFolder)this.getContainer(),result);
- else
- container.findSashes(this,result);
- return result;
-}
-/**
- * Add the Fast View menu item to the view title menu.
- */
-protected void addFastViewMenuItem(Menu parent,boolean isFastView) {
- // add fast view item
- MenuItem item = new MenuItem(parent, SWT.CHECK);
- item.setText(WorkbenchMessages.getString("ViewPane.fastView")); //$NON-NLS-1$
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (isFastView())
- doDock();
- else
- doMakeFast();
- }
- });
- item.setSelection(isFastView);
-
- if(isFastView) {
- item = new MenuItem(parent, SWT.NONE);
- item.setText(WorkbenchMessages.getString("ViewPane.minimizeView")); //$NON-NLS-1$
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- doMinimize();
- }
- });
- item.setEnabled(true);
- }
-}
-/**
- * Add the View and Tab Group items to the Move menu.
- */
-protected void addMoveItems(Menu moveMenu) {
- // See also similar restrictions in isDragAllowed method.
- // No need to worry about mouse cursor over image, just
- // fast views.
- boolean moveAllowed = !isZoomed() && !isFastView();
-
- // Add move view only menu item
- MenuItem item = new MenuItem(moveMenu, SWT.NONE);
- item.setText(WorkbenchMessages.getString("ViewPane.moveView")); //$NON-NLS-1$
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- page.openTracker(ViewPane.this);
- }
- });
- item.setEnabled(moveAllowed);
-
- // Add move view's tab folder menu item
- item = new MenuItem(moveMenu, SWT.NONE);
- item.setText(WorkbenchMessages.getString("ViewPane.moveFolder")); //$NON-NLS-1$
- item.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ILayoutContainer container = getContainer();
- if (container instanceof PartTabFolder)
- ((PartTabFolder)container).openTracker((PartTabFolder)container);
- }
- });
- item.setEnabled(moveAllowed && (getContainer() instanceof PartTabFolder));
-}
-
-/**
- * Return if there should be a view menu at all.
- * There is no view menu if there is no menu manager,
- * no pull down button or if the receiver is an
- * inactive fast view.
- */
-public boolean hasViewMenu(){
- if (isvMenuMgr == null)
- return false;
-
- //If there is no pull down button there is no associated menu
- if(pullDownButton == null || pullDownButton.isDisposed())
- return false;
-
- return true;
-}
-
-/**
- * Show the view menu for this window.
- */
-public void showViewMenu() {
-
- if(!hasViewMenu())
- return;
-
- // If this is a fast view, it may have been minimized. Do nothing in this case.
- if(isFastView() && (page.getActiveFastView() != getViewReference()))
- return;
-
- Menu aMenu = isvMenuMgr.createContextMenu(getControl());
- Rectangle bounds = pullDownButton.getBounds();
- Point topLeft = new Point(bounds.x, bounds.y + bounds.height);
- topLeft = viewToolBar.toDisplay(topLeft);
- aMenu.setLocation(topLeft.x, topLeft.y);
- aMenu.setVisible(true);
-}
-/**
- * @see IPartDropTarget::targetPartFor
- */
-public LayoutPart targetPartFor(LayoutPart dragSource) {
- // When zoomed, its like we are not part of the
- // tab folder so return the view.
- if (isZoomed())
- return this;
-
- // Make use of the container if a tab folder
- ILayoutContainer container = getContainer();
- if (container instanceof PartTabFolder)
- return (PartTabFolder) container;
- else
- return this;
-}
-public String toString() {
- String label = "disposed";//$NON-NLS-1$
- if((titleLabel != null) && (!titleLabel.isDisposed()))
- label = titleLabel.getText();
-
- return getClass().getName() + "@" + Integer.toHexString(hashCode()) + //$NON-NLS-1$
- "(" + label + ")";//$NON-NLS-2$//$NON-NLS-1$
-}
-/**
- * @see ViewActionBars
- */
-public void updateActionBars() {
- if (isvMenuMgr != null)
- isvMenuMgr.updateAll(false);
- if (viewToolBarMgr != null)
- viewToolBarMgr.update(false);
- if (isvToolBarMgr != null)
- isvToolBarMgr.update(false);
-}
-/**
- * Update the title attributes.
- */
-public void updateTitles() {
- IViewReference ref = getViewReference();
- String text = ref.getTitle();
- if (text == null)
- text = "";//$NON-NLS-1$
- Image image = ref.getTitleImage();
- // only update and relayout if text or image has changed
- if (!text.equals(titleLabel.getText()) || image != titleLabel.getImage()) {
- titleLabel.setText(text);
- titleLabel.setImage(image);
- ((Composite) getControl()).layout();
- }
- titleLabel.setToolTipText(ref.getTitleToolTip());
- // XXX: Workaround for 1GCGA89: SWT:ALL - CLabel tool tip does not always update properly
- titleLabel.update();
-
- // notify the page that this view's title has changed
- // in case it needs to update its fast view button
- page.updateTitle(ref);
-}
-}
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
deleted file mode 100644
index b42e364..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewPluginAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.*;
-/**
- * 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;
-/**
- * This class adds the requirement that action delegates
- * loaded on demand implement IViewActionDelegate
- */
-public ViewPluginAction(IConfigurationElement actionElement, String runAttribute, IViewPart viewPart,String definitionId) {
- super(actionElement, runAttribute,definitionId);
- this.viewPart = viewPart;
- registerSelectionListener(viewPart);
-}
-
-/**
- * Initialize an action delegate.
- * Subclasses may override this.
- */
-protected IActionDelegate initDelegate(Object obj)
- throws WorkbenchException
-{
- if (obj instanceof IViewActionDelegate) {
- IViewActionDelegate vad = (IViewActionDelegate)obj;
- vad.init(viewPart);
- return vad;
- } else
- throw new WorkbenchException("Action must implement IViewActionDelegate"); //$NON-NLS-1$
-}
-
-/**
- * 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.
- */
-public boolean isOkToCreateDelegate() {
- return super.isOkToCreateDelegate() && viewPart != null;
-}
-}
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
deleted file mode 100644
index 3bd9050..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewSite.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.internal.registry.IViewDescriptor;
-
-/**
- * A view container manages the services for a view.
- */
-public class ViewSite extends PartSite
- implements IViewSite
-{
-/**
- * Creates a new ViewSite.
- */
-public ViewSite(IViewPart view, WorkbenchPage page, IViewDescriptor desc) {
- super(view, page);
- setConfigurationElement(desc.getConfigurationElement());
-}
-/**
- * Returns the view.
- */
-public IViewPart getViewPart() {
- return (IViewPart)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
deleted file mode 100644
index 5c96573..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewerActionBuilder.java
+++ /dev/null
@@ -1,56 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.*;
-import java.util.*;
-
-/**
- *
- */
-public class ViewerActionBuilder extends PluginActionBuilder {
- private ISelectionProvider provider;
- private IWorkbenchPart part;
- public static final String TAG_CONTRIBUTION_TYPE = "viewerContribution";//$NON-NLS-1$
-/**
- *
- */
-public ViewerActionBuilder() {}
-/**
- * This factory method returns a new ActionDescriptor for the
- * configuration element. It should be implemented by subclasses.
- */
-protected ActionDescriptor createActionDescriptor(IConfigurationElement element) {
- ActionDescriptor desc = null;
- if (part instanceof IViewPart)
- desc = new ActionDescriptor(element, ActionDescriptor.T_VIEW, part);
- else
- desc = new ActionDescriptor(element, ActionDescriptor.T_EDITOR, part);
- if (provider != null) {
- PluginAction action = desc.getAction();
- provider.addSelectionChangedListener(action);
- }
- return desc;
-}
-/**
- * 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) {
- provider = prov;
- this.part = part;
- readContributions(id, TAG_CONTRIBUTION_TYPE, IWorkbenchConstants.PL_POPUP_MENU);
- return (cache != null);
-}
-}
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
deleted file mode 100644
index f30415b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinActionBars.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.IActionBars;
-
-public class WWinActionBars implements IActionBars {
- private WorkbenchWindow window;
-/**
- * PerspActionBars constructor comment.
- */
-public WWinActionBars(WorkbenchWindow window) {
- super();
- this.window = window;
-}
-/**
- * Clears the global action handler list.
- */
-public void clearGlobalActionHandlers() {
-}
-/**
- * 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.
- */
-public IAction getGlobalActionHandler(String actionID) {
- 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
- */
-public IMenuManager getMenuManager() {
- return window.getMenuManager();
-}
-/**
- * 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
- */
-public IStatusLineManager getStatusLineManager() {
- return window.getStatusLineManager();
-}
-/**
- * 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
- */
-public IToolBarManager getToolBarManager() {
- return window.getToolsManager();
-}
-/**
- * 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.
- */
-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.
- */
-public void updateActionBars() {
- window.updateActionBars();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinKeyBindingService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinKeyBindingService.java
deleted file mode 100644
index 8ce7aee..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinKeyBindingService.java
+++ /dev/null
@@ -1,337 +0,0 @@
-package org.eclipse.ui.internal;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.SortedSet;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.ui.IPageListener;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.internal.keybindings.Util;
-import org.eclipse.ui.internal.keybindings.KeyBindingManager;
-import org.eclipse.ui.internal.keybindings.KeySequence;
-import org.eclipse.ui.internal.keybindings.KeyStroke;
-import org.eclipse.ui.internal.keybindings.Scope;
-import org.eclipse.ui.internal.registry.AcceleratorRegistry;
-import org.eclipse.ui.internal.registry.IActionSet;
-
-/**
- * @version 2.0
- * @author
- */
-public class WWinKeyBindingService {
- /* A number increased whenever the action mapping changes so
- * its children can keep their mapping in sync with the ones in
- * the parent.
- */
- private long updateNumber = 0;
- /* Maps all global actions definition ids to the action */
- private HashMap globalActionDefIdToAction = new HashMap();
- /* Maps all action sets definition ids to the action */
- private HashMap actionSetDefIdToAction = new HashMap();
- /* A listener to property changes so the mappings can
- * be updated whenever the active configuration changes.
- */
- private IPropertyChangeListener propertyListener;
- /* The current KeyBindindService */
- private KeyBindingService activeService;
- /* The window this service is managing the accelerators for.*/
- private WorkbenchWindow window;
-
- private AcceleratorMenu accMenu;
-
- private VerifyListener verifyListener = new VerifyListener() {
- public void verifyText(VerifyEvent event) {
- event.doit = false;
- clear();
- }
- };
-
- private void setStatusLineMessage(KeySequence keySequence) {
- StringBuffer stringBuffer = new StringBuffer();
-
- if (keySequence != null) {
- Iterator iterator = keySequence.getKeyStrokes().iterator();
- int i = 0;
-
- while (iterator.hasNext()) {
- if (i != 0)
- stringBuffer.append(' ');
-
- KeyStroke keyStroke = (KeyStroke) iterator.next();
- int accelerator = keyStroke.getAccelerator();
- stringBuffer.append(
- org.eclipse.jface.action.Action.convertAccelerator(
- accelerator));
- i++;
- }
- }
-
- window.getActionBars().getStatusLineManager().setMessage(stringBuffer.toString());
- }
-
- public void clear() {
- KeyBindingManager.getInstance().setMode(KeySequence.create());
- setStatusLineMessage(null);
- updateAccelerators();
- }
-
- public void pressed(KeyStroke stroke) {
- //System.out.println("pressed(" + stroke.getAccelerator() + ")");
- KeySequence mode = KeyBindingManager.getInstance().getMode();
- SortedMap sequenceActionMapForMode =
- KeyBindingManager.getInstance().getKeySequenceActionMapForMode();
- KeySequence sequence = KeySequence.create(stroke);
-
- if (sequenceActionMapForMode.containsKey(sequence)) {
- invoke(((org.eclipse.ui.internal.keybindings.Action)
- sequenceActionMapForMode.get(sequence)).getValue());
- clear();
- } else {
- List strokes = new ArrayList(mode.getKeyStrokes());
- strokes.add(stroke);
- mode = KeySequence.create(strokes);
- KeyBindingManager keyBindingManager =
- KeyBindingManager.getInstance();
-
- keyBindingManager.setMode(mode);
- setStatusLineMessage(mode);
-
- if (keyBindingManager.getKeySequenceActionMapForMode().size() == 0)
- clear();
- else
- updateAccelerators();
- }
- }
-
- public void invoke(String action) {
- //System.out.println("invoke(" + action + ")");
- if (activeService != null) {
- IAction a = activeService.getAction(action);
-
- if (a != null && a.isEnabled())
- a.run();
- }
- }
-
- /**
- * Create an instance of WWinKeyBindingService and initializes it.
- */
- public WWinKeyBindingService(final WorkbenchWindow window) {
- this.window = window;
- IWorkbenchPage[] pages = window.getPages();
- final IPartListener partListener = new IPartListener() {
- public void partActivated(IWorkbenchPart part) {
- update(part,false);
- }
- public void partBroughtToTop(IWorkbenchPart part) {}
- public void partClosed(IWorkbenchPart part) {}
- public void partDeactivated(IWorkbenchPart part) {}
- public void partOpened(IWorkbenchPart part) {}
- };
- for(int i=0; i<pages.length;i++) {
- pages[i].addPartListener(partListener);
- }
- window.addPageListener(new IPageListener() {
- public void pageActivated(IWorkbenchPage page){}
- public void pageClosed(IWorkbenchPage page){}
- public void pageOpened(IWorkbenchPage page){
- page.addPartListener(partListener);
- partListener.partActivated(page.getActivePart());
- }
- });
- propertyListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(IWorkbenchConstants.ACCELERATOR_CONFIGURATION_ID)) {
- IWorkbenchPage page = window.getActivePage();
- if(page != null) {
- IWorkbenchPart part = page.getActivePart();
- if(part != null) {
- update(part,true);
- return;
- }
- }
- MenuManager menuManager = window.getMenuManager();
- menuManager.updateAll(true);
- }
- }
- };
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- store.addPropertyChangeListener(propertyListener);
- }
- /**
- * Remove the propety change listener when the windows is disposed.
- */
- public void dispose() {
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- store.removePropertyChangeListener(propertyListener);
- }
- /**
- * Register a global action in this service
- */
- public void registerGlobalAction(IAction action) {
- updateNumber++;
- globalActionDefIdToAction.put(action.getActionDefinitionId(),action);
- }
- /**
- * Register all action from the specifed action set.
- */
- public void registerActionSets(IActionSet sets[]) {
- updateNumber++;
- actionSetDefIdToAction.clear();
- AcceleratorRegistry registry = WorkbenchPlugin.getDefault().getAcceleratorRegistry();
- registry.clearFakeAccelerators();
-
- for (int i=0; i<sets.length; i++) {
- if (sets[i] instanceof PluginActionSet) {
- PluginActionSet set = (PluginActionSet)sets[i];
- IAction actions[] = set.getPluginActions();
-
- for (int j = 0; j < actions.length; j++) {
- Action action = (Action)actions[j];
- String defId = action.getActionDefinitionId();
-
- if (defId != null) {
- actionSetDefIdToAction.put(action.getActionDefinitionId(),action);
- }
- }
- }
- }
- }
-
- /**
- * Return the update number used to keep children and parent in sync.
- */
- public long getUpdateNumber() {
- return updateNumber;
- }
- /**
- * Returns a Map with all action registered in this service.
- */
- public HashMap getMapping() {
- HashMap result = (HashMap)globalActionDefIdToAction.clone();
- result.putAll(actionSetDefIdToAction);
- return result;
- }
- /**
- * Returns the workbench window.
- */
- public IWorkbenchWindow getWindow() {
- return window;
- }
- /**
- * Remove or restore the accelerators in the menus.
- */
- public void update(IWorkbenchPart part, boolean force) {
- if (part == null)
- return;
-
- String[] oldScopeIds = new String[0];
-
- if (activeService != null)
- oldScopeIds = activeService.getScopeIds();
-
- activeService = (KeyBindingService) part.getSite().getKeyBindingService();
- clear();
-
- String[] newScopeIds = new String[0];
-
- if (activeService != null)
- newScopeIds = activeService.getScopeIds();
-
- if (force || Util.compare(oldScopeIds, newScopeIds) == 0) {
- Scope[] scopes = new Scope[newScopeIds.length];
-
- for (int i = 0; i < newScopeIds.length; i++)
- scopes[i] = KeyBindingManager.getInstance().getScopeForId(newScopeIds[i]);
-
- KeyBindingManager.getInstance().setScopes(scopes);
- WorkbenchWindow w = (WorkbenchWindow) getWindow();
- MenuManager menuManager = w.getMenuManager();
- menuManager.update(IAction.TEXT);
- }
- }
- /**
- * Returns the definition id for <code>accelerator</code>
- */
- public String getDefinitionId(int[] accelerators) {
- if (accelerators == null || activeService == null)
- return null;
-
- KeyStroke[] keyStrokes = KeyStroke.create(accelerators);
- KeySequence keySequence = KeySequence.create(keyStrokes);
- Map sequenceActionMapForMode =
- KeyBindingManager.getInstance().getKeySequenceActionMapForMode();
-
- Object object = sequenceActionMapForMode.get(keySequence);
-
- if (object == null)
- return null;
-
- return ((org.eclipse.ui.internal.keybindings.Action) object).getValue();
- }
-
- /**
- * Update the KeyBindingMenu with the current set of accelerators.
- */
- public void updateAccelerators() {
- SortedSet sortedSet =
- (SortedSet) KeyBindingManager.getInstance().getStrokeSetForMode();
- Iterator iterator = sortedSet.iterator();
- int[] accelerators = new int[sortedSet.size()];
- int i = 0;
-
- while (iterator.hasNext()) {
- KeyStroke keyStroke = (KeyStroke) iterator.next();
- accelerators[i++] = keyStroke.getAccelerator();
- }
-
- if (accMenu == null || accMenu.isDisposed()) {
- Menu parent = window.getShell().getMenuBar();
- if (parent == null || parent.getItemCount() < 1)
- return;
- MenuItem parentItem = parent.getItem(parent.getItemCount() - 1);
- parent = parentItem.getMenu();
- accMenu = new AcceleratorMenu(parent);
- }
-
- if (accMenu == null)
- return;
-
- accMenu.setAccelerators(accelerators);
- accMenu.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- pressed(KeyStroke.create(e.detail));
- }
- });
-
- KeySequence keySequence = KeyBindingManager.getInstance().getMode();
-
- if (keySequence.getKeyStrokes().size() == 0)
- accMenu.removeVerifyListener(verifyListener);
- else
- accMenu.addVerifyListener(verifyListener);
- }
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPartService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPartService.java
deleted file mode 100644
index 35da9de..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPartService.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001, 2002.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-
-/**
- * A part service for a workbench window.
- */
-public class WWinPartService implements IPartService, IPageListener, IPartListener
-{
- private IWorkbenchWindow window;
- private PartListenerList listeners = new PartListenerList();
- private WindowSelectionService selectionService;
- private IWorkbenchPage activePage;
-
-/**
- * Creates a new part service for a workbench window.
- */
-public WWinPartService(IWorkbenchWindow window) {
- setWindow(window);
- selectionService = new WindowSelectionService(window);
-}
-
-/**
- * Sets the window.
- */
-private void setWindow(IWorkbenchWindow window) {
- this.window = window;
-}
-
-/**
- * Returns the window.
- */
-protected IWorkbenchWindow getWindow() {
- return window;
-}
-
-/*
- * Adds an IPartListener to the part service.
- */
-public void addPartListener(IPartListener l) {
- listeners.addPartListener(l);
-}
-/*
- * Returns the active part.
- */
-public IWorkbenchPart getActivePart() {
- if (activePage != null)
- return activePage.getActivePart();
- else
- return null;
-}
-/*
- * Returns the selection service.
- */
-public ISelectionService getSelectionService() {
- return selectionService;
-}
-/**
- * Notifies that a page has been activated.
- */
-public void pageActivated(IWorkbenchPage newPage) {
- // Optimize.
- if (newPage == activePage)
- return;
-
- // Unhook listener from the old page.
- reset();
-
- // Update active page.
- activePage = newPage;
-
- // Hook listener on the new page.
- if (activePage != null) {
- activePage.addPartListener(this);
- if (getActivePart() != null)
- partActivated(getActivePart());
- }
-}
-/**
- * Notifies that a page has been closed
- */
-public void pageClosed(IWorkbenchPage page) {
- // Unhook listener from the old page.
- if (page == activePage) {
- reset();
- }
-}
-/**
- * Notifies that a page has been opened.
- */
-public void pageOpened(IWorkbenchPage page) {
- pageActivated(page);
-}
-/**
- * Notifes that a part has been activated.
- */
-public void partActivated(IWorkbenchPart part) {
- listeners.firePartActivated(part);
- selectionService.partActivated(part);
-}
-/**
- * Notifes that a part has been brought to top.
- */
-public void partBroughtToTop(IWorkbenchPart part) {
- listeners.firePartBroughtToTop(part);
- selectionService.partBroughtToTop(part);
-}
-/**
- * Notifes that a part has been closed.
- */
-public void partClosed(IWorkbenchPart part) {
- listeners.firePartClosed(part);
- selectionService.partClosed(part);
-}
-/**
- * Notifes that a part has been deactivated.
- */
-public void partDeactivated(IWorkbenchPart part) {
- listeners.firePartDeactivated(part);
- selectionService.partDeactivated(part);
-}
-/**
- * Notifes that a part has been opened.
- */
-public void partOpened(IWorkbenchPart part) {
- listeners.firePartOpened(part);
- selectionService.partOpened(part);
-}
-/*
- * Removes an IPartListener from the part service.
- */
-public void removePartListener(IPartListener l) {
- listeners.removePartListener(l);
-}
-/*
- * Resets the part service. The active page, part and selection are
- * dereferenced.
- */
-public void reset() {
- if (activePage != null) {
- activePage.removePartListener(this);
- activePage = null;
- }
- selectionService.reset();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPerspectiveService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPerspectiveService.java
deleted file mode 100644
index cfd7f213..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPerspectiveService.java
+++ /dev/null
@@ -1,76 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-
-/**
- * A perspective service for the workbench window.
- */
-public class WWinPerspectiveService implements IPerspectiveService {
- private WorkbenchWindow workbenchWindow;
- private PerspectiveListenerList perspectiveListeners = new PerspectiveListenerList();
-/**
- * WWinPerspectiveService constructor comment.
- */
-public WWinPerspectiveService(WorkbenchWindow window) {
- super();
- this.workbenchWindow = window;
-}
-/**
- * Adds the given listener for a page's perspective lifecycle events.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a perspective listener
- */
-public void addPerspectiveListener(IInternalPerspectiveListener listener) {
- perspectiveListeners.addPerspectiveListener(listener);
-}
-/**
- * Fires perspective activated
- */
-protected void firePerspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- perspectiveListeners.firePerspectiveActivated(page, perspective);
-}
-/**
- * Fires perspective changed
- */
-protected void firePerspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
- perspectiveListeners.firePerspectiveChanged(page, perspective, changeId);
-}
-/**
- * Fires perspective reset
- */
-protected void firePerspectiveClosed(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- perspectiveListeners.firePerspectiveClosed(page, perspective);
-}
-/**
- * Fires perspective reset
- */
-protected void firePerspectiveOpened(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- perspectiveListeners.firePerspectiveOpened(page, perspective);
-}
-/**
- * Returns the active perspective descriptor in the active workbench page.
- *
- * @return the active perspective descriptor, or <code>null</code> if no perspective is currently active
- */
-public IPerspectiveDescriptor getActivePerspective() {
- IWorkbenchPage page = workbenchWindow.getActivePage();
- if (page == null)
- return null;
- else
- return page.getPerspective();
-}
-/**
- * Removes the given page's perspective listener.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a perspective listener
- */
-public void removePerspectiveListener(IInternalPerspectiveListener listener) {
- perspectiveListeners.removePerspectiveListener(listener);
-}
-}
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
deleted file mode 100644
index 197bae3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginAction.java
+++ /dev/null
@@ -1,229 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.swt.events.HelpListener;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.LabelRetargetAction;
-import org.eclipse.ui.actions.RetargetAction;
-
-/**
- * This class extends regular plugin action with the
- * additional requirement that the delegate has
- * to implement interface IWorkbenchWindowActionDeelgate.
- * 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;
-
- private IWorkbenchWindow window;
- private String actionSetId;
- private RetargetAction retargetAction;
- private static String TRUE_VALUE = "true"; //$NON-NLS-1$
-
- private static ArrayList staticActionList = new ArrayList(50);
-
- /**
- * Constructs a new WWinPluginAction object..
- */
- public WWinPluginAction(IConfigurationElement actionElement,
- String runAttribute, IWorkbenchWindow window,String definitionId)
- {
- super(actionElement, runAttribute,definitionId);
- this.window = window;
-
- // If config specifies a retarget action, create it now
- String retarget = actionElement.getAttribute(ActionDescriptor.ATT_RETARGET);
- if (retarget != null && retarget.equals(TRUE_VALUE)) {
- // create a retarget action
- String allowLabelUpdate = actionElement.getAttribute(ActionDescriptor.ATT_ALLOW_LABEL_UPDATE);
- String id = actionElement.getAttribute(ActionDescriptor.ATT_ID);
- String label = actionElement.getAttribute(ActionDescriptor.ATT_LABEL);
-
- if (allowLabelUpdate != null && allowLabelUpdate.equals(TRUE_VALUE))
- retargetAction = new LabelRetargetAction(id, label);
- else
- retargetAction = new RetargetAction(id, label);
- retargetAction.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(Action.ENABLED)) {
- Object val = event.getNewValue();
- if (val instanceof Boolean) {
- setEnabled(((Boolean) val).booleanValue());
- }
- } else if (event.getProperty().equals(Action.TEXT)) {
- Object val = event.getNewValue();
- if (val instanceof String) {
- setText((String) val);
- }
- } else if (event.getProperty().equals(Action.TOOL_TIP_TEXT)) {
- Object val = event.getNewValue();
- if (val instanceof String) {
- setToolTipText((String) val);
- }
- }
- }
- });
- 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);
-
- super.setHelpListener(new HelpListener() {
- public void helpRequested(HelpEvent e) {
- HelpListener listener = null;
- if (retargetAction != null)
- listener = retargetAction.getHelpListener();
- if (listener == null)
- // use our own help listener
- listener = localHelpListener;
- if (listener != null)
- // pass on the event
- listener.helpRequested(e);
- }
- });
- }
-
- /**
- * Adds an item to the action list.
- */
- private static void addToActionList(WWinPluginAction action) {
- staticActionList.add(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
- }
- }
- }
-
- /**
- * Initialize an action delegate.
- * Subclasses may override this.
- */
- protected IActionDelegate initDelegate(Object obj)
- throws WorkbenchException
- {
- if (obj instanceof IWorkbenchWindowActionDelegate) {
- IWorkbenchWindowActionDelegate winDelegate =
- (IWorkbenchWindowActionDelegate) obj;
- winDelegate.init(window);
- return winDelegate;
- } else
- throw new WorkbenchException("Action must implement IWorkbenchWindowActionDelegate"); //$NON-NLS-1$
- }
-
- /**
- * Disposes of the action and any resources held.
- */
- public void dispose() {
- removeFromActionList(this);
- if (retargetAction != null) {
- window.getPartService().removePartListener(retargetAction);
- retargetAction.dispose();
- retargetAction = null;
- }
- window.getSelectionService().removeSelectionListener(this);
- if (getDelegate() instanceof IWorkbenchWindowActionDelegate) {
- IWorkbenchWindowActionDelegate winDelegate =
- (IWorkbenchWindowActionDelegate) getDelegate();
- winDelegate.dispose();
- }
- }
- /**
- * Returns the action set id.
- */
- public String getActionSetId() {
- 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.
- */
- public boolean isOkToCreateDelegate() {
- return super.isOkToCreateDelegate() && window != null && retargetAction == null;
- }
-
- /* (non-Javadoc)
- * Method declared on IActionDelegate2.
- */
- public void runWithEvent(Event event) {
- if (retargetAction == null) {
- super.runWithEvent(event);
- return;
- }
-
- if (event != null)
- retargetAction.runWithEvent(event);
- else
- retargetAction.run();
- }
-
- /**
- * Sets the action set id.
- */
- public void setActionSetId(String 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.
- */
- public void setHelpListener(HelpListener listener) {
- localHelpListener = listener;
- }
-
- /**
- * Refresh the selection for the action.
- */
- protected void refreshSelection() {
- ISelection selection = window.getSelectionService().getSelection();
- selectionChanged(selection);
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index bd763b3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WWinPluginPulldown.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.jface.action.IMenuCreator;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.*;
-
-/**
- * A workbench window pulldown action.
- */
-public class WWinPluginPulldown extends WWinPluginAction {
- private IMenuCreator menuProxy;
- private class MenuProxy implements IMenuCreator {
- private Menu menu;
- public Menu getMenu(Control parent) {
- IWorkbenchWindowPulldownDelegate delegate = getPulldownDelegate();
- if (delegate != null) {
- return delegate.getMenu(parent);
- } else {
- return null;
- }
- }
- public Menu getMenu(Menu parent) {
- IWorkbenchWindowPulldownDelegate delegate = getPulldownDelegate();
- if (delegate instanceof IWorkbenchWindowPulldownDelegate2) {
- IWorkbenchWindowPulldownDelegate2 delegate2 = (IWorkbenchWindowPulldownDelegate2)delegate;
- return delegate2.getMenu(parent);
- }
- return null;
- }
- public void dispose() {
- }
- };
-/**
- * WWinPluginPulldown constructor comment.
- * @param actionElement org.eclipse.core.runtime.IConfigurationElement
- * @param runAttribute java.lang.String
- * @param window org.eclipse.ui.IWorkbenchWindow
- */
-public WWinPluginPulldown(IConfigurationElement actionElement, String runAttribute, IWorkbenchWindow window, String definitionId)
-{
- super(actionElement, runAttribute, window,definitionId);
- menuProxy = new MenuProxy();
- setMenuCreator(menuProxy);
-}
-
-/**
- * Initialize an action delegate.
- * Subclasses may override this.
- */
-protected IActionDelegate initDelegate(Object obj)
- throws WorkbenchException
-{
- IActionDelegate del = super.initDelegate(obj);
- if (obj instanceof IWorkbenchWindowPulldownDelegate) {
- return del;
- } else
- throw new WorkbenchException("Action must implement IWorkbenchWindowPulldownDelegate"); //$NON-NLS-1$
-}
-
-/**
- * Returns the pulldown delegate. If it does not exist it is created.
- */
-protected IWorkbenchWindowPulldownDelegate getPulldownDelegate() {
- IActionDelegate delegate = getDelegate();
- if (delegate == null) {
- createDelegate();
- delegate = getDelegate();
- }
- return (IWorkbenchWindowPulldownDelegate)delegate;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WelcomePageSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WelcomePageSelectionDialog.java
deleted file mode 100644
index fc3b047..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WelcomePageSelectionDialog.java
+++ /dev/null
@@ -1,136 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IMarkerResolution;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.dialogs.SimpleListContentProvider;
-import org.eclipse.ui.internal.misc.Assert;
-
-/**
- * Dialog to allow the user to select a feature from a list.
- */
-public class WelcomePageSelectionDialog extends SelectionDialog {
- /**
- * List width in characters.
- */
- private final static int LIST_WIDTH = 60;
- /**
- * List height in characters.
- */
- private final static int LIST_HEIGHT = 10;
- /**
- * The feature about infos.
- */
- private AboutInfo[] features;
- /**
- * List to display the resolutions.
- */
- private ListViewer listViewer;
-
- /**
- * Creates an instance of this dialog to display
- * the given features.
- * <p>
- * There must be at least one feature.
- * </p>
- *
- * @param shell the parent shell
- * @param markerResolutions the resolutions to display
- * @param initialSelection the index of the initial selection
- */
- public WelcomePageSelectionDialog(Shell shell, AboutInfo[] features, int initialSelection) {
- super(shell);
- Assert.isTrue(features != null && features.length > 0);
- this.features = features;
- setTitle(WorkbenchMessages.getString("WelcomePageSelectionDialog.title")); //$NON-NLS-1$
- setMessage(WorkbenchMessages.getString("WelcomePageSelectionDialog.message")); //$NON-NLS-1$
- if (initialSelection >= 0 && initialSelection < features.length)
- setInitialSelections(new Object[]{features[initialSelection]});
- else
- setInitialSelections(new Object[0]);
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- WorkbenchHelp.setHelp(newShell, IHelpContextIds.WELCOME_PAGE_SELECTION_DIALOG);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite)super.createDialogArea(parent);
-
- // Create label
- createMessageArea(composite);
- // Create list viewer
- listViewer = new ListViewer(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = convertHeightInCharsToPixels(LIST_HEIGHT);
- data.widthHint = convertWidthInCharsToPixels(LIST_WIDTH);
- listViewer.getList().setLayoutData(data);
- // Set the label provider
- listViewer.setLabelProvider(new LabelProvider() {
- public String getText(Object element) {
- // Return the features's label.
- return element == null ? "" : ((AboutInfo)element).getFeatureLabel(); //$NON-NLS-1$
- }
- });
-
- // Set the content provider
- SimpleListContentProvider cp = new SimpleListContentProvider();
- cp.setElements(features);
- listViewer.setContentProvider(cp);
- listViewer.setInput(new Object()); // it is ignored but must be non-null
-
- // Set the initial selection
- listViewer.setSelection(new StructuredSelection(getInitialElementSelections()), true);
-
- // Add a selection change listener
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- // Update OK button enablement
- getOkButton().setEnabled(!event.getSelection().isEmpty());
- }
- });
-
- // Add double-click listener
- listViewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- okPressed();
- }
- });
- return composite;
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void okPressed() {
- IStructuredSelection selection = (IStructuredSelection)listViewer.getSelection();
- setResult(selection.toList());
- super.okPressed();
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WindowPartSelectionTracker.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WindowPartSelectionTracker.java
deleted file mode 100644
index 641f3f2..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WindowPartSelectionTracker.java
+++ /dev/null
@@ -1,117 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IPageListener;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * Provides part selection tracking for a part with a specific id in all pages of a specific workbench
- * window. This tracker shields clients from a part opening and closing, and still provides selection
- * notification/information even when the part is not active..
- */
-public class WindowPartSelectionTracker extends AbstractPartSelectionTracker implements IPageListener, ISelectionListener {
-
- /**
- * The window this selection tracker is working in
- */
- private IWorkbenchWindow fWindow;
-
- /**
- * Constructs a new selection tracker for the given window and part id.
- *
- * @param window workbench window
- * @param partId part identifier
- */
- public WindowPartSelectionTracker(IWorkbenchWindow window, String partId) {
- super(partId);
- setWindow(window);
- window.addPageListener(this);
- IWorkbenchPage[] pages = window.getPages();
- for (int i = 0; i < pages.length; i++) {
- pageOpened(pages[i]);
- }
- }
-
- /*
- * @see IPageListener#pageActivated(IWorkbenchPage)
- */
- public void pageActivated(IWorkbenchPage page) {
- }
-
- /*
- * @see IPageListener#pageClosed(IWorkbenchPage)
- */
- public void pageClosed(IWorkbenchPage page) {
- }
-
- /*
- * @see IPageListener#pageOpened(IWorkbenchPage)
- */
- public void pageOpened(IWorkbenchPage page) {
- page.addSelectionListener(getPartId(), new ISelectionListener() {
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- fireSelection(part, selection);
- }
- });
- page.addPostSelectionListener(getPartId(), new ISelectionListener() {
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- firePostSelection(part, selection);
- }
- });
- }
-
- /**
- * Sets the window this tracker is working in.
- *
- * @param window workbench window
- */
- private void setWindow(IWorkbenchWindow window) {
- fWindow = window;
- }
-
- /**
- * Returns the window this tracker is working in.
- *
- * @return workbench window
- */
- protected IWorkbenchWindow getWindow() {
- return fWindow;
- }
-
- /**
- * @see AbstractPartSelectionTracker#dispose()
- */
- public void dispose() {
- super.dispose();
- fWindow = null;
- }
-
- /*
- * @see AbstractPartSelectionTracker#getSelection()
- */
- public ISelection getSelection() {
- IWorkbenchPage page = getWindow().getActivePage();
- if (page != null) {
- return page.getSelection(getPartId());
- }
- return null;
- }
-
- /*
- * @see ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- fireSelection(part, selection);
- }
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WindowSelectionService.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WindowSelectionService.java
deleted file mode 100644
index 7f0ab91..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WindowSelectionService.java
+++ /dev/null
@@ -1,49 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001, 2002.
- * All Rights Reserved.
- */
-
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * The selection service for a window.
- */
-/* package */
-class WindowSelectionService extends AbstractSelectionService {
-
- /**
- * The window.
- */
- private IWorkbenchWindow window;
-
- /**
- * Creates a new selection service for the given window.
- */
- public WindowSelectionService(IWorkbenchWindow window) {
- setWindow(window);
- }
-
- /**
- * Sets the window.
- */
- private void setWindow(IWorkbenchWindow window) {
- this.window = window;
- }
-
- /**
- * Returns the window.
- */
- protected IWorkbenchWindow getWindow() {
- return window;
- }
-
- /*
- * @see AbstractSelectionService#createPartTracker(String)
- */
- protected AbstractPartSelectionTracker createPartTracker(String partId) {
- return new WindowPartSelectionTracker(getWindow(), partId);
- }
-
-}
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
deleted file mode 100644
index 05b515b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/Workbench.java
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchActionBuilder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchActionBuilder.java
deleted file mode 100644
index 055f00b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchActionBuilder.java
+++ /dev/null
@@ -1,1136 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.dialogs.WorkInProgressPreferencePage;
-
-/**
- * This is used to add actions to the workbench.
- */
-public class WorkbenchActionBuilder implements IPropertyChangeListener {
-
- private static final String saveActionDefId = "org.eclipse.ui.file.save"; //$NON-NLS-1$
- private static final String saveAllActionDefId = "org.eclipse.ui.file.saveAll"; //$NON-NLS-1$
- private static final String printActionDefId = "org.eclipse.ui.file.print"; //$NON-NLS-1$
- private static final String closeActionDefId = "org.eclipse.ui.file.close"; //$NON-NLS-1$
- private static final String closeAllActionDefId = "org.eclipse.ui.file.closeAll"; //$NON-NLS-1$
- private static final String closeAllSavedActionDefId = "org.eclipse.ui.file.closeAllSaved"; //$NON-NLS-1$
- private static final String undoActionDefId = "org.eclipse.ui.edit.undo"; //$NON-NLS-1$
- private static final String redoActionDefId = "org.eclipse.ui.edit.redo"; //$NON-NLS-1$
- private static final String cutActionDefId = "org.eclipse.ui.edit.cut"; //$NON-NLS-1$
- private static final String copyActionDefId = "org.eclipse.ui.edit.copy"; //$NON-NLS-1$
- private static final String pasteActionDefId = "org.eclipse.ui.edit.paste"; //$NON-NLS-1$
- private static final String deleteActionDefId = "org.eclipse.ui.edit.delete"; //$NON-NLS-1$
- private static final String selectAllActionDefId = "org.eclipse.ui.edit.selectAll"; //$NON-NLS-1$
- private static final String findActionDefId = "org.eclipse.ui.edit.findReplace"; //$NON-NLS-1$
- private static final String addBookmarkActionDefId = "org.eclipse.ui.edit.addBookmark"; //$NON-NLS-1$
- private static final String showViewMenuActionDefId = "org.eclipse.ui.window.showViewMenu"; //$NON-NLS-1$
- private static final String showPartPaneMenuActionDefId = "org.eclipse.ui.window.showSystemMenu"; //$NON-NLS-1$
- private static final String nextEditorActionDefId = "org.eclipse.ui.window.nextEditor"; //$NON-NLS-1$
- private static final String prevEditorActionDefId = "org.eclipse.ui.window.previousEditor"; //$NON-NLS-1$
- private static final String nextPartActionDefId = "org.eclipse.ui.window.nextView"; //$NON-NLS-1$
- private static final String prevPartActionDefId = "org.eclipse.ui.window.previousView"; //$NON-NLS-1$
- private static final String nextPerspectiveActionDefId = "org.eclipse.ui.window.nextPerspective"; //$NON-NLS-1$
- private static final String prevPerspectiveActionDefId = "org.eclipse.ui.window.previousPerspective"; //$NON-NLS-1$
- private static final String activateEditorActionDefId = "org.eclipse.ui.window.activateEditor"; //$NON-NLS-1$
- private static final String workbenchEditorsActionDefId = "org.eclipse.ui.window.switchToEditor"; //$NON-NLS-1$
- private static final String buildActionDefId = "org.eclipse.ui.project.buildProject"; //$NON-NLS-1$
- private static final String backwardHistoryActionDefId = "org.eclipse.ui.navigate.backwardHistory"; //$NON-NLS-1$
- private static final String forwardHistoryActionDefId = "org.eclipse.ui.navigate.forwardHistory"; //$NON-NLS-1$
-
- private static final String workbenchToolGroupId = "org.eclipse.ui.internal";
-
- //pin editor group in the toolbar
- private static final String pinEditorGroup = "pinEditorGroup"; //$NON-NLS-1$
-
- //history group in the toolbar
- private static final String historyGroup = "historyGroup"; //$NON-NLS-1$
-
- // target
- private WorkbenchWindow window;
-
- // actions
- private NewWizardAction newWizardAction;
- private NewWizardDropDownAction newWizardDropDownAction;
- private NewWizardMenu newWizardMenu;
- private CloseEditorAction closeAction;
- private CloseAllAction closeAllAction;
- private CloseAllSavedAction closeAllSavedAction;
- private ImportResourcesAction importResourcesAction;
- private ExportResourcesAction exportResourcesAction;
- private GlobalBuildAction rebuildAllAction; // Full build
- private GlobalBuildAction buildAction; // Incremental build
- private SaveAction saveAction;
- private SaveAllAction saveAllAction;
- private AboutAction aboutAction;
- private OpenPreferencesAction openPreferencesAction;
- private QuickStartAction quickStartAction;
- private SaveAsAction saveAsAction;
- private ToggleEditorsVisibilityAction hideShowEditorAction;
- private SavePerspectiveAction savePerspectiveAction;
- private ResetPerspectiveAction resetPerspectiveAction;
- private EditActionSetsAction editActionSetAction;
- private ClosePerspectiveAction closePerspAction;
- private LockToolBarAction lockToolBarAction;
- private CloseAllPerspectivesAction closeAllPerspsAction;
- private PinEditorAction pinEditorAction;
- private ShowViewMenuAction showViewMenuAction;
- private ShowPartPaneMenuAction showPartPaneMenuAction;
- private CyclePartAction nextPartAction;
- private CyclePartAction prevPartAction;
- private CycleEditorAction nextEditorAction;
- private CycleEditorAction prevEditorAction;
- private CyclePerspectiveAction nextPerspectiveAction;
- private CyclePerspectiveAction prevPerspectiveAction;
- private ActivateEditorAction activateEditorAction;
- private WorkbenchEditorsAction workbenchEditorsAction;
-
- // retarget actions.
- private RetargetAction undoAction;
- private RetargetAction redoAction;
- private RetargetAction cutAction;
- private RetargetAction copyAction;
- private RetargetAction pasteAction;
- private RetargetAction deleteAction;
- private RetargetAction selectAllAction;
- private RetargetAction findAction;
- private RetargetAction addBookmarkAction;
- private RetargetAction addTaskAction;
- private RetargetAction printAction;
-
-// menu reorg
- private boolean usingMenuReorg = true;
-// WorkbenchPlugin.getDefault().getPreferenceStore().getBoolean("ENABLE_NEW_MENUS");
-
- private RetargetAction revertAction;
- private RetargetAction refreshAction;
- private RetargetAction propertiesAction;
- private RetargetAction moveAction;
- private RetargetAction renameAction;
- private RetargetAction goIntoAction;
- private RetargetAction backAction;
- private RetargetAction forwardAction;
- private RetargetAction upAction;
- private RetargetAction nextAction;
- private RetargetAction previousAction;
-
- private RetargetAction buildProjectAction;
- private RetargetAction rebuildProjectAction;
- private RetargetAction openProjectAction;
- private RetargetAction closeProjectAction;
-
- private NavigationHistoryAction backwardHistoryAction;
- private NavigationHistoryAction forwardHistoryAction;
-// end menu reorg
-
- /**
- * WorkbenchActionBuilder constructor comment.
- */
- public WorkbenchActionBuilder() {
- }
-
- /**
- * Add the manual incremental build action
- * to both the menu bar and the tool bar.
- */
- protected void addManualIncrementalBuildAction() {
- MenuManager menubar = window.getMenuBarManager();
- if (usingMenuReorg) {
- IMenuManager manager = menubar.findMenuUsingPath(IWorkbenchActionConstants.M_PROJECT);
- if (manager != null) {
- try {
- manager.insertBefore(IWorkbenchActionConstants.REBUILD_PROJECT, buildProjectAction);
- manager.insertBefore(IWorkbenchActionConstants.REBUILD_ALL, buildAction);
- } catch (IllegalArgumentException e) {
- // action not found!
- }
- }
- }
- else {
- IMenuManager manager = menubar.findMenuUsingPath(IWorkbenchActionConstants.M_WORKBENCH);
- if (manager != null) {
- try {
- manager.insertBefore(IWorkbenchActionConstants.REBUILD_ALL, buildAction);
- } catch (IllegalArgumentException e) {
- // action not found!
- }
- }
- }
- IContributionManager toolsManager = window.getToolsManager();
- IContributionManager tBarMgr = toolsManager;
- if (toolsManager instanceof CoolBarManager) {
- CoolBarContributionItem groupItem = (CoolBarContributionItem)toolsManager.find(workbenchToolGroupId);
- tBarMgr = groupItem.getToolBarManager();
- }
- tBarMgr.appendToGroup(IWorkbenchActionConstants.BUILD_EXT, buildAction);
- tBarMgr.update(true);
- }
-
- /**
- * Build the workbench actions.
- */
- public void buildActions(WorkbenchWindow win) {
- window = win;
- makeActions();
- createMenuBar();
- createToolBar();
- createShortcutBar();
-
- // Listen for preference property changes to
- // update the menubar and toolbar
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- store.addPropertyChangeListener(this);
-
- // Listen to workbench page lifecycle methods to enable
- // and disable the perspective menu items as needed.
- window.addPageListener(new IPageListener() {
- public void pageActivated(IWorkbenchPage page) {
- enableActions(page.getPerspective() != null);
- }
- public void pageClosed(IWorkbenchPage page) {
- IWorkbenchPage pg = window.getActivePage();
- enableActions(pg != null && pg.getPerspective() != null);
- }
- public void pageOpened(IWorkbenchPage page) {
- }
- });
-
- // Listen to workbench perspective lifecycle methods to enable
- // and disable the perspective menu items as needed.
- window.getPerspectiveService().addPerspectiveListener(new IInternalPerspectiveListener() {
- public void perspectiveClosed(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- enableActions(page.getPerspective() != null);
- }
- public void perspectiveOpened(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- }
- public void perspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- enableActions(true);
- }
- public void perspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
- }
- });
-
- //Listen for the selection changing and update the
- //actions that are interested
- window.getSelectionService().addSelectionListener(new ISelectionListener(){
- /*
- * @see ISelectionListener.selectionChanges
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection){
- if(selection instanceof IStructuredSelection){
- IStructuredSelection structured = (IStructuredSelection) selection;
- importResourcesAction.selectionChanged(structured);
- exportResourcesAction.selectionChanged(structured);
- }
- }
- });
- }
-
- /**
- * Enables the menu items dependent on an active
- * page and perspective.
- * Note, the show view action already does its own
- * listening so no need to do it here.
- */
- private void enableActions(boolean value) {
- hideShowEditorAction.setEnabled(value);
- savePerspectiveAction.setEnabled(value);
- lockToolBarAction.setEnabled(value);
- resetPerspectiveAction.setEnabled(value);
- editActionSetAction.setEnabled(value);
- closePerspAction.setEnabled(value);
- closeAllPerspsAction.setEnabled(value);
- newWizardMenu.setEnabled(value);
- newWizardDropDownAction.setEnabled(value);
- importResourcesAction.setEnabled(value);
- exportResourcesAction.setEnabled(value);
- }
-
- /**
- * Creates the menu bar.
- */
- private void createMenuBar() {
- // Get main menu.
- MenuManager menubar = window.getMenuBarManager();
- if (usingMenuReorg) {
- menubar.add(createFileMenu());
- menubar.add(createEditMenu());
- menubar.add(createNavigateMenu());
- menubar.add(createProjectMenu());
- menubar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- menubar.add(createWindowMenu());
- menubar.add(createHelpMenu());
- }
- else {
- menubar.add(createFileMenu());
- menubar.add(createEditMenu());
- menubar.add(createPerspectiveMenu());
- menubar.add(createWorkbenchMenu());
- menubar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- menubar.add(createWindowMenu());
- menubar.add(createHelpMenu());
- }
- }
-
- /**
- * Creates and returns the File menu.
- */
- private MenuManager createFileMenu() {
- MenuManager menu = new MenuManager(WorkbenchMessages.getString("Workbench.file"), IWorkbenchActionConstants.M_FILE); //$NON-NLS-1$
- menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
- {
- MenuManager newMenu = new MenuManager(WorkbenchMessages.getString("Workbench.new")); //$NON-NLS-1$
- menu.add(newMenu);
- this.newWizardMenu = new NewWizardMenu(newMenu, window, true);
- }
- menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
- menu.add(new Separator());
-
- menu.add(closeAction);
- menu.add(closeAllAction);
-// menu.add(closeAllSavedAction);
- menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT));
- menu.add(new Separator());
- menu.add(saveAction);
- menu.add(saveAsAction);
- menu.add(saveAllAction);
-
- if (usingMenuReorg) {
- menu.add(revertAction);
- menu.add(new Separator());
- menu.add(moveAction);
- menu.add(renameAction);
- menu.add(new Separator());
- menu.add(refreshAction);
- }
-
- menu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
- menu.add(new Separator());
- menu.add(printAction);
- menu.add(new Separator());
- menu.add(importResourcesAction);
- menu.add(exportResourcesAction);
- menu.add(new GroupMarker(IWorkbenchActionConstants.IMPORT_EXT));
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-
- if (usingMenuReorg) {
- menu.add(new Separator());
- menu.add(propertiesAction);
- }
-
- menu.add(new ReopenEditorMenu(window, ((Workbench) window.getWorkbench()).getEditorHistory(), true));
- menu.add(new GroupMarker(IWorkbenchActionConstants.MRU));
- menu.add(new Separator());
- menu.add(new QuitAction(window.getWorkbench()));
- menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
- return menu;
- }
-
- /**
- * Creates and returns the Edit menu.
- */
- private MenuManager createEditMenu() {
- MenuManager menu = new MenuManager(WorkbenchMessages.getString("Workbench.edit"), IWorkbenchActionConstants.M_EDIT); //$NON-NLS-1$
- menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_START));
-
- menu.add(undoAction);
- menu.add(redoAction);
- menu.add(new GroupMarker(IWorkbenchActionConstants.UNDO_EXT));
- menu.add(new Separator());
-
- menu.add(cutAction);
- menu.add(copyAction);
- menu.add(pasteAction);
- menu.add(new GroupMarker(IWorkbenchActionConstants.CUT_EXT));
- menu.add(new Separator());
-
- menu.add(deleteAction);
- menu.add(selectAllAction);
- menu.add(new Separator());
-
- menu.add(findAction);
- menu.add(new GroupMarker(IWorkbenchActionConstants.FIND_EXT));
- menu.add(new Separator());
-
- menu.add(addBookmarkAction);
- menu.add(addTaskAction);
- menu.add(new GroupMarker(IWorkbenchActionConstants.ADD_EXT));
-
- menu.add(new GroupMarker(IWorkbenchActionConstants.EDIT_END));
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- return menu;
- }
-
-// menu reorg
-
- /**
- * Creates and returns the Navigate menu.
- */
- private MenuManager createNavigateMenu() {
- MenuManager menu = new MenuManager(WorkbenchMessages.getString("Workbench.navigate"), IWorkbenchActionConstants.M_NAVIGATE); //$NON-NLS-1$
- menu.add(new GroupMarker(IWorkbenchActionConstants.NAV_START));
- menu.add(goIntoAction);
-
- MenuManager goToSubMenu = new MenuManager(WorkbenchMessages.getString("Workbench.goTo"), IWorkbenchActionConstants.GO_TO); //$NON-NLS-1$
- menu.add(goToSubMenu);
- goToSubMenu.add(backAction);
- goToSubMenu.add(forwardAction);
- goToSubMenu.add(upAction);
- goToSubMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
-
- menu.add(new Separator(IWorkbenchActionConstants.OPEN_EXT));
- for (int i = 2; i < 5; ++i) {
- menu.add(new Separator(IWorkbenchActionConstants.OPEN_EXT + i));
- }
- menu.add(new Separator(IWorkbenchActionConstants.SHOW_EXT));
- for (int i = 2; i < 5; ++i) {
- menu.add(new Separator(IWorkbenchActionConstants.SHOW_EXT + i));
- }
- menu.add(new Separator());
- menu.add(nextAction);
- menu.add(previousAction);
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.add(new GroupMarker(IWorkbenchActionConstants.NAV_END));
-
- //TBD: Location of this actions
- if(WorkInProgressPreferencePage.useNavigationHistory()) {
- menu.add(new Separator());
- menu.add(backwardHistoryAction);
- menu.add(forwardHistoryAction);
- }
- return menu;
- }
-
- /**
- * Creates and returns the Project menu.
- */
- private MenuManager createProjectMenu() {
- boolean autoBuild = ResourcesPlugin.getWorkspace().isAutoBuilding();
- MenuManager menu = new MenuManager(WorkbenchMessages.getString("Workbench.project"), IWorkbenchActionConstants.M_PROJECT); //$NON-NLS-1$
- menu.add(new Separator(IWorkbenchActionConstants.PROJ_START));
-
- menu.add(openProjectAction);
- menu.add(closeProjectAction);
- menu.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT));
- menu.add(new Separator());
-
- // Only add the manual incremental build if auto build off
- if (!autoBuild)
- menu.add(buildProjectAction);
- menu.add(rebuildProjectAction);
- if (!autoBuild) {
- menu.add(buildAction);
- }
- menu.add(rebuildAllAction);
- menu.add(new GroupMarker(IWorkbenchActionConstants.BUILD_EXT));
- menu.add(new Separator());
-
- menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.add(new GroupMarker(IWorkbenchActionConstants.PROJ_END));
- return menu;
- }
-
-// end menu reorg
-
-
- /**
- * Adds the perspective actions to the specified menu.
- */
- private void addPerspectiveActions(MenuManager menu) {
- {
- String openText =
- usingMenuReorg
- ? WorkbenchMessages.getString("Workbench.openPerspective") //$NON-NLS-1$
- : WorkbenchMessages.getString("Workbench.open"); //$NON-NLS-1$
- MenuManager changePerspMenuMgr = new MenuManager(openText); //$NON-NLS-1$
- ChangeToPerspectiveMenu changePerspMenuItem = new ChangeToPerspectiveMenu(window);
- changePerspMenuMgr.add(changePerspMenuItem);
- menu.add(changePerspMenuMgr);
- }
- {
- MenuManager subMenu = new MenuManager(WorkbenchMessages.getString("Workbench.showView")); //$NON-NLS-1$
- menu.add(subMenu);
- new ShowViewMenu(subMenu, window, true);
- }
- IContributionManager manager = window.getToolsManager();
- if (usingMenuReorg) {
- menu.add(hideShowEditorAction);
- if (manager instanceof CoolBarManager) {
- menu.add(lockToolBarAction);
- }
- menu.add(new Separator());
- menu.add(editActionSetAction);
- menu.add(savePerspectiveAction);
- menu.add(resetPerspectiveAction);
- menu.add(closePerspAction);
- menu.add(closeAllPerspsAction);
- }
- else {
- menu.add(hideShowEditorAction);
- menu.add(new Separator());
- menu.add(savePerspectiveAction);
- menu.add(editActionSetAction);
- if (manager instanceof CoolBarManager) {
- menu.add(lockToolBarAction);
- }
- menu.add(resetPerspectiveAction);
- menu.add(new Separator());
- menu.add(closePerspAction);
- menu.add(closeAllPerspsAction);
- }
- }
-
- /**
- * Creates and returns the Perspective menu.
- */
- private MenuManager createPerspectiveMenu() {
- MenuManager menu = new MenuManager(WorkbenchMessages.getString("Workbench.perspective"), IWorkbenchActionConstants.M_VIEW); //$NON-NLS-1$
- addPerspectiveActions(menu);
- return menu;
- }
-
- /**
- * Creates and returns the Workbench menu.
- */
- private MenuManager createWorkbenchMenu() {
- MenuManager menu = new MenuManager(WorkbenchMessages.getString("Workbench.workbench"), IWorkbenchActionConstants.M_WORKBENCH); //$NON-NLS-1$
- menu.add(new GroupMarker(IWorkbenchActionConstants.WB_START));
- // Only add the manual incremental build if auto build off
- if (!ResourcesPlugin.getWorkspace().isAutoBuilding())
- menu.add(buildAction);
- menu.add(rebuildAllAction);
- menu.add(new GroupMarker(IWorkbenchActionConstants.WB_END));
- menu.add(new Separator());
- menu.add(openPreferencesAction);
- menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- return menu;
- }
-
- /**
- * Adds the keyboard navigation submenu to the specified menu.
- */
- private void addKeyboardShortcuts(MenuManager menu) {
- MenuManager subMenu = new MenuManager(WorkbenchMessages.getString("Workbench.shortcuts")); //$NON-NLS-1$
- menu.add(subMenu);
- subMenu.add(showPartPaneMenuAction);
- subMenu.add(showViewMenuAction);
- subMenu.add(new Separator());
- subMenu.add(activateEditorAction);
- subMenu.add(nextEditorAction);
- subMenu.add(prevEditorAction);
- subMenu.add(new Separator());
- subMenu.add(nextPartAction);
- subMenu.add(prevPartAction);
- subMenu.add(new Separator());
- subMenu.add(nextPerspectiveAction);
- subMenu.add(prevPerspectiveAction);
- }
-
- /**
- * Creates and returns the Window menu.
- */
- private MenuManager createWindowMenu() {
- MenuManager menu = new MenuManager(WorkbenchMessages.getString("Workbench.window"), IWorkbenchActionConstants.M_WINDOW); //$NON-NLS-1$
-
- if (usingMenuReorg) {
- OpenInNewWindowAction action = new OpenInNewWindowAction(window);
- action.setText(WorkbenchMessages.getString("Workbench.openNewWindow")); //$NON-NLS-1$
- menu.add(action);
- menu.add(new Separator());
- addPerspectiveActions(menu);
- menu.add(new Separator());
- addKeyboardShortcuts(menu);
- menu.add(new Separator());
- menu.add(workbenchEditorsAction);
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "end")); //$NON-NLS-1$
- menu.add(openPreferencesAction);
- menu.add(new SwitchToWindowMenu(window, true));
- }
- else {
- OpenInNewWindowAction action = new OpenInNewWindowAction(window);
- action.setText(WorkbenchMessages.getString("Workbench.openNewWindow")); //$NON-NLS-1$
- menu.add(action);
- MenuManager launchWindowMenu = new MenuManager(WorkbenchMessages.getString("Workbench.launch"), IWorkbenchActionConstants.M_LAUNCH); //$NON-NLS-1$
- launchWindowMenu.add(new GroupMarker(IWorkbenchActionConstants.LAUNCH_EXT));
- menu.add(launchWindowMenu);
- addKeyboardShortcuts(menu);
- menu.add(new Separator());
- menu.add(workbenchEditorsAction);
- menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.add(new SwitchToWindowMenu(window, true));
- }
- return menu;
- }
-
- /**
- * Creates and returns the Help menu.
- */
- private MenuManager createHelpMenu() {
- MenuManager menu = new MenuManager(WorkbenchMessages.getString("Workbench.help"), IWorkbenchActionConstants.M_HELP); //$NON-NLS-1$
- // See if a welcome page is specified
- if (quickStartAction != null)
- menu.add(quickStartAction);
- menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
- menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
- menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
- // about should always be at the bottom
- menu.add(new Separator());
- menu.add(aboutAction);
- return menu;
- }
-
- /**
- * Fills the shortcut bar
- */
- private void createShortcutBar() {
- ToolBarManager shortcutBar = window.getShortcutBar();
- shortcutBar.add(new PerspectiveContributionItem(window));
- shortcutBar.add(new Separator(window.GRP_PAGES));
- shortcutBar.add(new Separator(window.GRP_PERSPECTIVES));
- shortcutBar.add(new Separator(window.GRP_FAST_VIEWS));
- shortcutBar.add(new ShowFastViewContribution(window));
- }
- /**
- * Fills the menu bar by merging all the individual viewers' contributions
- * and invariant (static) menus and menu items, as defined in MenuConstants interface.
- */
- private void createToolBar() {
- IContributionManager manager = window.getToolsManager();
- IContributionManager toolsManager;
- if (manager instanceof ToolBarManager) {
- toolsManager = manager;
- } else if (manager instanceof CoolBarManager) {
- // Create a CoolBar item for the workbench
- CoolBarManager cBarMgr = (CoolBarManager)manager;
- CoolBarContributionItem coolBarItem = new CoolBarContributionItem(cBarMgr, workbenchToolGroupId); //$NON-NLS-1$
- cBarMgr.add(coolBarItem);
- coolBarItem.setVisible(true);
- toolsManager = (IContributionManager)coolBarItem.getToolBarManager();
- cBarMgr.addToMenu(new ActionContributionItem(lockToolBarAction));
- cBarMgr.addToMenu(new ActionContributionItem(editActionSetAction));
- } else {
- toolsManager = manager;
- }
- toolsManager.add(newWizardDropDownAction);
- toolsManager.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
- toolsManager.add(new Separator());
- toolsManager.add(saveAction);
- toolsManager.add(saveAsAction);
- toolsManager.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
- toolsManager.add(printAction);
- toolsManager.add(new GroupMarker(IWorkbenchActionConstants.BUILD_EXT));
- toolsManager.prependToGroup(IWorkbenchActionConstants.BUILD_EXT, new Separator());
- toolsManager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- // Only add the manual incremental build if auto build off
- if (!ResourcesPlugin.getWorkspace().isAutoBuilding()) {
- toolsManager.appendToGroup(IWorkbenchActionConstants.BUILD_EXT, buildAction);
- }
- if(WorkInProgressPreferencePage.useNavigationHistory())
- addHistoryActions();
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- if(store.getBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN)) {
- addPinEditorAction();
- }
- }
- /**
- * Remove the property change listener
- */
- public void dispose() {
- // Listen for preference property changes to
- // update the menubar and toolbar
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- store.removePropertyChangeListener(this);
- }
- /**
- * Returns true if the menu with the given ID should
- * be considered OLE container menu. Container menus
- * are preserved in OLE menu merging.
- */
- public static boolean isContainerMenu(String menuId) {
- if (menuId.equals(IWorkbenchActionConstants.M_FILE))
- return true;
- if (menuId.equals(IWorkbenchActionConstants.M_VIEW))
- return true;
- if (menuId.equals(IWorkbenchActionConstants.M_WORKBENCH))
- return true;
- if (menuId.equals(IWorkbenchActionConstants.M_WINDOW))
- return true;
- return false;
- }
- /**
- * Create actions for the menu bar and toolbar
- */
- private void makeActions() {
-
- // The actions in jface do not have menu vs. enable, vs. disable vs. color
- // There are actions in here being passed the workbench - problem
-
- // Get services for notification.
- IPartService partService = window.getPartService();
- WWinKeyBindingService keyBindingService = window.getKeyBindingService();
-
- // Many actions need the workbench.
- IWorkbench workbench = window.getWorkbench();
-
- newWizardAction = new NewWizardAction();
- // images for this action are set in its constructor
-
- newWizardDropDownAction = new NewWizardDropDownAction(workbench, newWizardAction);
- newWizardDropDownAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ));
- newWizardDropDownAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ_HOVER));
- newWizardDropDownAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ_DISABLED));
-
- importResourcesAction = new ImportResourcesAction(workbench);
- importResourcesAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_IMPORT_WIZ));
- importResourcesAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_IMPORT_WIZ_HOVER));
- importResourcesAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_IMPORT_WIZ_DISABLED));
-
- exportResourcesAction = new ExportResourcesAction(workbench,WorkbenchMessages.getString("ExportResourcesAction.fileMenuText"));
- exportResourcesAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_EXPORT_WIZ));
- exportResourcesAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_EXPORT_WIZ_HOVER));
- exportResourcesAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_EXPORT_WIZ_DISABLED));
-
- rebuildAllAction = new GlobalBuildAction(window, IncrementalProjectBuilder.FULL_BUILD);
- // 1G82IWC - a new icon is needed for Rebuild All or Build
- // rebuildAllAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_BUILD_EXEC));
- // rebuildAllAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_BUILD_EXEC_HOVER));
- // rebuildAllAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_BUILD_EXEC_DISABLED));
-
- buildAction = new GlobalBuildAction(window, IncrementalProjectBuilder.INCREMENTAL_BUILD);
- buildAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_BUILD_EXEC));
- buildAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_BUILD_EXEC_HOVER));
- buildAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_BUILD_EXEC_DISABLED));
- buildAction.setActionDefinitionId(buildActionDefId);
-
- saveAction = new SaveAction(window);
- saveAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SAVE_EDIT));
- saveAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SAVE_EDIT_HOVER));
- saveAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SAVE_EDIT_DISABLED));
- partService.addPartListener(saveAction);
- saveAction.setActionDefinitionId(saveActionDefId);
- keyBindingService.registerGlobalAction(saveAction);
-
- saveAsAction = new SaveAsAction(window);
- saveAsAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SAVEAS_EDIT));
- saveAsAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SAVEAS_EDIT_HOVER));
- saveAsAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SAVEAS_EDIT_DISABLED));
- partService.addPartListener(saveAsAction);
-
- saveAllAction = new SaveAllAction(window);
- saveAllAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SAVEALL_EDIT));
- saveAllAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SAVEALL_EDIT_HOVER));
- saveAllAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SAVEALL_EDIT_DISABLED));
- partService.addPartListener(saveAllAction);
- saveAllAction.setActionDefinitionId(saveAllActionDefId);
- keyBindingService.registerGlobalAction(saveAllAction);
-
- undoAction = new LabelRetargetAction(IWorkbenchActionConstants.UNDO, WorkbenchMessages.getString("Workbench.undo")); //$NON-NLS-1$
- undoAction.setToolTipText(WorkbenchMessages.getString("Workbench.undoToolTip")); //$NON-NLS-1$
- undoAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_UNDO_EDIT));
- undoAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_UNDO_EDIT_HOVER));
- undoAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_UNDO_EDIT_DISABLED));
- undoAction.setAccelerator(SWT.CTRL | 'z');
- partService.addPartListener(undoAction);
- undoAction.setActionDefinitionId(undoActionDefId);
- keyBindingService.registerGlobalAction(undoAction);
-
- redoAction = new LabelRetargetAction(IWorkbenchActionConstants.REDO, WorkbenchMessages.getString("Workbench.redo")); //$NON-NLS-1$
- redoAction.setToolTipText(WorkbenchMessages.getString("Workbench.redoToolTip")); //$NON-NLS-1$
- redoAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_REDO_EDIT));
- redoAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_REDO_EDIT_HOVER));
- redoAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_REDO_EDIT_DISABLED));
- redoAction.setAccelerator(SWT.CTRL | 'y');
- partService.addPartListener(redoAction);
- redoAction.setActionDefinitionId(redoActionDefId);
- keyBindingService.registerGlobalAction(redoAction);
-
- cutAction = new RetargetAction(IWorkbenchActionConstants.CUT, WorkbenchMessages.getString("Workbench.cut")); //$NON-NLS-1$
- cutAction.setToolTipText(WorkbenchMessages.getString("Workbench.cutToolTip")); //$NON-NLS-1$
- cutAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_CUT_EDIT));
- cutAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_CUT_EDIT_HOVER));
- cutAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_CUT_EDIT_DISABLED));
- cutAction.setAccelerator(SWT.CTRL | 'x');
- partService.addPartListener(cutAction);
- cutAction.setActionDefinitionId(cutActionDefId);
- keyBindingService.registerGlobalAction(cutAction);
-
- copyAction = new RetargetAction(IWorkbenchActionConstants.COPY, WorkbenchMessages.getString("Workbench.copy")); //$NON-NLS-1$
- copyAction.setToolTipText(WorkbenchMessages.getString("Workbench.copyToolTip")); //$NON-NLS-1$
- copyAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_COPY_EDIT));
- copyAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_COPY_EDIT_HOVER));
- copyAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_COPY_EDIT_DISABLED));
- copyAction.setAccelerator(SWT.CTRL | 'c');
- partService.addPartListener(copyAction);
- copyAction.setActionDefinitionId(copyActionDefId);
- keyBindingService.registerGlobalAction(copyAction);
-
- pasteAction = new RetargetAction(IWorkbenchActionConstants.PASTE, WorkbenchMessages.getString("Workbench.paste")); //$NON-NLS-1$
- pasteAction.setToolTipText(WorkbenchMessages.getString("Workbench.pasteToolTip")); //$NON-NLS-1$
- pasteAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_PASTE_EDIT));
- pasteAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_PASTE_EDIT_HOVER));
- pasteAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_PASTE_EDIT_DISABLED));
- pasteAction.setAccelerator(SWT.CTRL | 'v');
- partService.addPartListener(pasteAction);
- pasteAction.setActionDefinitionId(pasteActionDefId);
- keyBindingService.registerGlobalAction(pasteAction);
-
- printAction = new RetargetAction(IWorkbenchActionConstants.PRINT, WorkbenchMessages.getString("Workbench.print")); //$NON-NLS-1$
- printAction.setToolTipText(WorkbenchMessages.getString("Workbench.printToolTip")); //$NON-NLS-1$
- printAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_PRINT_EDIT));
- printAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_PRINT_EDIT_HOVER));
- printAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_PRINT_EDIT_DISABLED));
- printAction.setAccelerator(SWT.CTRL | 'p');
- partService.addPartListener(printAction);
- printAction.setActionDefinitionId(printActionDefId);
- keyBindingService.registerGlobalAction(printAction);
-
- selectAllAction = new RetargetAction(IWorkbenchActionConstants.SELECT_ALL, WorkbenchMessages.getString("Workbench.selectAll")); //$NON-NLS-1$
- selectAllAction.setToolTipText(WorkbenchMessages.getString("Workbench.selectAllToolTip")); //$NON-NLS-1$
- selectAllAction.setAccelerator(SWT.CTRL | 'a');
- partService.addPartListener(selectAllAction);
- selectAllAction.setActionDefinitionId(selectAllActionDefId);
- keyBindingService.registerGlobalAction(selectAllAction);
-
- findAction = new RetargetAction(IWorkbenchActionConstants.FIND, WorkbenchMessages.getString("Workbench.findReplace")); //$NON-NLS-1$
- findAction.setToolTipText(WorkbenchMessages.getString("Workbench.findReplaceToolTip")); //$NON-NLS-1$
-// Find's images commented out due to conflict with Search.
-// See bug 16412.
-// findAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SEARCH_SRC));
-// findAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SEARCH_SRC_HOVER));
-// findAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_SEARCH_SRC_DISABLED));
-
- findAction.setAccelerator(SWT.CONTROL | 'f');
- partService.addPartListener(findAction);
- findAction.setActionDefinitionId(findActionDefId);
- keyBindingService.registerGlobalAction(findAction);
-
- closeAction = new CloseEditorAction(window);
- partService.addPartListener(closeAction);
- closeAction.setActionDefinitionId(closeActionDefId);
- keyBindingService.registerGlobalAction(closeAction);
-
- closeAllAction = new CloseAllAction(window);
- partService.addPartListener(closeAllAction);
- closeAllAction.setActionDefinitionId(closeAllActionDefId);
- keyBindingService.registerGlobalAction(closeAllAction);
-
- closeAllSavedAction = new CloseAllSavedAction(window);
- partService.addPartListener(closeAllSavedAction);
- closeAllSavedAction.setActionDefinitionId(closeAllSavedActionDefId);
- keyBindingService.registerGlobalAction(closeAllSavedAction);
-
- pinEditorAction = new PinEditorAction(window);
- partService.addPartListener(pinEditorAction);
- pinEditorAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_PIN_EDITOR));
- pinEditorAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_PIN_EDITOR_HOVER));
- pinEditorAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_PIN_EDITOR_DISABLED));
-
- aboutAction = new AboutAction(window);
- aboutAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_OBJS_DEFAULT_PROD));
-
- openPreferencesAction = new OpenPreferencesAction(window);
-
- addBookmarkAction = new RetargetAction(IWorkbenchActionConstants.BOOKMARK, WorkbenchMessages.getString("Workbench.addBookMark")); //$NON-NLS-1$
- partService.addPartListener(addBookmarkAction);
- addBookmarkAction.setToolTipText(WorkbenchMessages.getString("Workbench.addBookMarkToolTip")); //$NON-NLS-1$
- addBookmarkAction.setActionDefinitionId(addBookmarkActionDefId);
- keyBindingService.registerGlobalAction(addBookmarkAction);
-
- addTaskAction = createGlobalAction(IWorkbenchActionConstants.ADD_TASK, "edit", false); //$NON-NLS-1$
-
- deleteAction = new RetargetAction(IWorkbenchActionConstants.DELETE, WorkbenchMessages.getString("Workbench.delete")); //$NON-NLS-1$
- deleteAction.setToolTipText(WorkbenchMessages.getString("Workbench.deleteToolTip")); //$NON-NLS-1$
- deleteAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_DELETE_EDIT));
- deleteAction.setHoverImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_DELETE_EDIT_HOVER));
- deleteAction.setDisabledImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_DELETE_EDIT_DISABLED));
- deleteAction.enableAccelerator(false);
- WorkbenchHelp.setHelp(deleteAction, IHelpContextIds.DELETE_RETARGET_ACTION);
- partService.addPartListener(deleteAction);
- deleteAction.setActionDefinitionId(deleteActionDefId);
- // keyBindingService.registerGlobalAction(deleteAction);
-
- // See if a welcome page is specified
- AboutInfo[] infos = ((Workbench)workbench).getFeaturesInfo();
- for (int i = 0; i < infos.length; i++) {
- if (infos[i].getWelcomePageURL() != null) {
- quickStartAction = new QuickStartAction(workbench);
- break;
- }
- }
-
- // Actions for invisible accelerators
- showViewMenuAction = new ShowViewMenuAction(window);
- showViewMenuAction.setActionDefinitionId(showViewMenuActionDefId);
- keyBindingService.registerGlobalAction(showViewMenuAction);
-
- showPartPaneMenuAction = new ShowPartPaneMenuAction(window);
- showPartPaneMenuAction.setActionDefinitionId(showPartPaneMenuActionDefId);
- keyBindingService.registerGlobalAction(showPartPaneMenuAction);
-
- nextEditorAction = new CycleEditorAction(window, true);
- nextEditorAction.setActionDefinitionId(nextEditorActionDefId);
- keyBindingService.registerGlobalAction(nextEditorAction);
-
- prevEditorAction = new CycleEditorAction(window, false);
- prevEditorAction.setActionDefinitionId(prevEditorActionDefId);
- keyBindingService.registerGlobalAction(prevEditorAction);
-
- nextPartAction = new CyclePartAction(window, true);
- nextPartAction.setActionDefinitionId(nextPartActionDefId);
- keyBindingService.registerGlobalAction(nextPartAction);
-
- prevPartAction = new CyclePartAction(window, false);
- prevPartAction.setActionDefinitionId(prevPartActionDefId);
- keyBindingService.registerGlobalAction(prevPartAction);
-
- nextPerspectiveAction = new CyclePerspectiveAction(window, true);
- nextPerspectiveAction.setActionDefinitionId(nextPerspectiveActionDefId);
- keyBindingService.registerGlobalAction(nextPerspectiveAction);
-
- prevPerspectiveAction = new CyclePerspectiveAction(window, false);
- prevPerspectiveAction.setActionDefinitionId(prevPerspectiveActionDefId);
- keyBindingService.registerGlobalAction(prevPerspectiveAction);
-
- activateEditorAction = new ActivateEditorAction(window);
- activateEditorAction.setActionDefinitionId(activateEditorActionDefId);
- keyBindingService.registerGlobalAction(activateEditorAction);
-
- workbenchEditorsAction = new WorkbenchEditorsAction(window);
- workbenchEditorsAction.setActionDefinitionId(workbenchEditorsActionDefId);
- keyBindingService.registerGlobalAction(workbenchEditorsAction);
-
- hideShowEditorAction = new ToggleEditorsVisibilityAction(window);
- savePerspectiveAction = new SavePerspectiveAction(window);
- editActionSetAction = new EditActionSetsAction(window);
- lockToolBarAction = new LockToolBarAction(window);
- resetPerspectiveAction = new ResetPerspectiveAction(window);
- closePerspAction = new ClosePerspectiveAction(window);
- closeAllPerspsAction = new CloseAllPerspectivesAction(window);
-
- //Must change/copy the image. It is using a local toolbar image and colored.
- backwardHistoryAction = new NavigationHistoryAction(window, false);
- backwardHistoryAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_BACKWARD_NAV));
- backwardHistoryAction.setActionDefinitionId(backwardHistoryActionDefId);
- keyBindingService.registerGlobalAction(backwardHistoryAction);
-
- forwardHistoryAction = new NavigationHistoryAction(window, true);
- forwardHistoryAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_FORWARD_NAV));
- forwardHistoryAction.setActionDefinitionId(forwardHistoryActionDefId);
- keyBindingService.registerGlobalAction(forwardHistoryAction);
-
- // menu reorg
- if (usingMenuReorg) {
- // create the new actions needed for the reorg
- revertAction = createGlobalAction(IWorkbenchActionConstants.REVERT, "file", false); //$NON-NLS-1$
- refreshAction = createGlobalAction(IWorkbenchActionConstants.REFRESH, "file", false); //$NON-NLS-1$
- propertiesAction = createGlobalAction(IWorkbenchActionConstants.PROPERTIES, "file", false); //$NON-NLS-1$
- propertiesAction.setAccelerator(SWT.ALT | SWT.CR);
- moveAction = createGlobalAction(IWorkbenchActionConstants.MOVE, "edit", false); //$NON-NLS-1$
- renameAction = createGlobalAction(IWorkbenchActionConstants.RENAME, "edit", false); //$NON-NLS-1$
- goIntoAction = createGlobalAction(IWorkbenchActionConstants.GO_INTO, "navigate", false); //$NON-NLS-1$
- backAction = createGlobalAction(IWorkbenchActionConstants.BACK, "navigate", true); //$NON-NLS-1$
- forwardAction = createGlobalAction(IWorkbenchActionConstants.FORWARD, "navigate", true); //$NON-NLS-1$
- upAction = createGlobalAction(IWorkbenchActionConstants.UP, "navigate", true); //$NON-NLS-1$
- nextAction = createGlobalAction(IWorkbenchActionConstants.NEXT, "navigate", true); //$NON-NLS-1$
- nextAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_NEXT_NAV));
- previousAction = createGlobalAction(IWorkbenchActionConstants.PREVIOUS, "navigate", true); //$NON-NLS-1$
- previousAction.setImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_PREVIOUS_NAV));
- buildProjectAction = createGlobalAction(IWorkbenchActionConstants.BUILD_PROJECT, "project", false); //$NON-NLS-1$
- rebuildProjectAction = createGlobalAction(IWorkbenchActionConstants.REBUILD_PROJECT, "project", false); //$NON-NLS-1$
- openProjectAction = createGlobalAction(IWorkbenchActionConstants.OPEN_PROJECT, "project", false); //$NON-NLS-1$
- closeProjectAction = createGlobalAction(IWorkbenchActionConstants.CLOSE_PROJECT, "project", false); //$NON-NLS-1$
-
- // override the text and tooltip for certain actions,
- // either to get the new text or a different mnemonic
- savePerspectiveAction.setText(WorkbenchMessages.getString("Workbench.savePerspectiveAs")); //$NON-NLS-1$
- editActionSetAction.setText(WorkbenchMessages.getString("Workbench.customizePerspective")); //$NON-NLS-1$
- lockToolBarAction.setText(WorkbenchMessages.getString("Workbench.lockPerspectiveToolBar")); //$NON-NLS-1$
- resetPerspectiveAction.setText(WorkbenchMessages.getString("Workbench.resetPerspective")); //$NON-NLS-1$
- closePerspAction.setText(WorkbenchMessages.getString("Workbench.closePerspective")); //$NON-NLS-1$
- closeAllPerspsAction.setText(WorkbenchMessages.getString("Workbench.closeAllPerspectives")); //$NON-NLS-1$
- buildAction.setText(WorkbenchMessages.getString("Workbench.buildAll")); //$NON-NLS-1$
- buildAction.setToolTipText(WorkbenchMessages.getString("Workbench.buildAllToolTip")); //$NON-NLS-1$
- buildAction.setAccelerator(SWT.CTRL | 'B');
- keyBindingService.registerGlobalAction(buildAction);
- rebuildAllAction.setText(WorkbenchMessages.getString("Workbench.rebuildAll")); //$NON-NLS-1$
- rebuildAllAction.setToolTipText(WorkbenchMessages.getString("Workbench.rebuildAllToolTip")); //$NON-NLS-1$
- }
- // end menu reorg
- }
-
-// menu reorg
- private RetargetAction createGlobalAction(String id, String actionDefPrefix, boolean labelRetarget) {
- RetargetAction action;
- if (labelRetarget) {
- action = new LabelRetargetAction(id, WorkbenchMessages.getString("Workbench." + id)); //$NON-NLS-1$
- }
- else {
- action = new RetargetAction(id, WorkbenchMessages.getString("Workbench." + id)); //$NON-NLS-1$
- }
- action.setToolTipText(WorkbenchMessages.getString("Workbench." + id + "ToolTip")); //$NON-NLS-1$ //$NON-NLS-2$
- window.getPartService().addPartListener(action);
- action.setActionDefinitionId(PlatformUI.PLUGIN_ID + "." + actionDefPrefix + "." + id); //$NON-NLS-1$ //$NON-NLS-2$
- window.getKeyBindingService().registerGlobalAction(action);
- return action;
- }
-// end menu reorg
-
- /**
- * Update the menubar and toolbar when
- * changes to the preferences are done.
- */
- public void propertyChange(PropertyChangeEvent event) {
- // Allow manual incremental build only if the
- // auto build setting is off.
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- if (event.getProperty().equals(IPreferenceConstants.AUTO_BUILD)) {
- // Auto build is stored in core. It is not in the preference store.
- boolean autoBuildOn = ResourcesPlugin.getWorkspace().getDescription().isAutoBuilding();
- if (autoBuildOn)
- removeManualIncrementalBuildAction();
- else
- addManualIncrementalBuildAction();
- } else if (event.getProperty().equals(IPreferenceConstants.REUSE_EDITORS_BOOLEAN)) {
- if(store.getBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN))
- addPinEditorAction();
- else
- removePinEditorAction();
- } else if (event.getProperty().equals(IPreferenceConstants.REUSE_EDITORS)) {
- pinEditorAction.updateState();
- } else if (event.getProperty().equals(IPreferenceConstants.RECENT_FILES)) {
- Workbench wb = (Workbench) (Workbench) window.getWorkbench();
- int newValue = store.getInt(IPreferenceConstants.RECENT_FILES);
- wb.getEditorHistory().reset(newValue);
- if (newValue == 0) {
- // the open recent menu item can go from enabled to disabled
- window.updateActionBars();
- }
- }
- }
- /*
- * Adds the pin action to the toolbar.
- */
- private void addHistoryActions() {
- IToolBarManager toolsMgr = window.getToolsManager();
- if (toolsMgr instanceof CoolBarManager) {
- CoolBarManager cBarMgr = (CoolBarManager)toolsMgr;
- CoolBarContributionItem coolBarItem = new CoolBarContributionItem(cBarMgr, historyGroup); //$NON-NLS-1$
- // we want to add the history cool item before the editor cool item (if it exists)
- IContributionItem refItem = cBarMgr.findSubId(IWorkbenchActionConstants.GROUP_EDITOR);
- if (refItem == null) {
- cBarMgr.add(coolBarItem);
- } else {
- cBarMgr.insertBefore(refItem.getId(), coolBarItem);
- }
- coolBarItem.setVisible(true);
- IToolBarManager tBarMgr = (IToolBarManager)coolBarItem.getToolBarManager();
- tBarMgr.add(new GroupMarker(historyGroup));
- tBarMgr.insertAfter(historyGroup,forwardHistoryAction);
- tBarMgr.insertAfter(historyGroup,backwardHistoryAction);
- } else {
- toolsMgr.add(new GroupMarker(historyGroup));
- toolsMgr.insertAfter(historyGroup,forwardHistoryAction);
- toolsMgr.insertAfter(historyGroup,backwardHistoryAction);
- }
- toolsMgr.update(true);
- }
- /*
- * Adds the pin action to the toolbar.
- */
- private void addPinEditorAction() {
- IToolBarManager toolsMgr = window.getToolsManager();
- if (toolsMgr instanceof CoolBarManager) {
- CoolBarManager cBarMgr = (CoolBarManager)toolsMgr;
- CoolBarContributionItem coolBarItem = new CoolBarContributionItem(cBarMgr, pinEditorGroup); //$NON-NLS-1$
- // we want to add the pin editor cool item before the editor cool item (if
- // it exists)
- IContributionItem refItem = cBarMgr.findSubId(IWorkbenchActionConstants.GROUP_EDITOR);
- if (refItem == null) {
- cBarMgr.add(coolBarItem);
- } else {
- cBarMgr.insertBefore(refItem.getId(), coolBarItem);
- }
- coolBarItem.setVisible(true);
- IToolBarManager tBarMgr = (IToolBarManager)coolBarItem.getToolBarManager();
- tBarMgr.add(new GroupMarker(pinEditorGroup));
- pinEditorAction.setVisible(true);
- tBarMgr.insertAfter(pinEditorGroup,pinEditorAction);
- } else {
- toolsMgr.add(new GroupMarker(pinEditorGroup));
- pinEditorAction.setVisible(true);
- toolsMgr.insertAfter(pinEditorGroup,pinEditorAction);
- }
- toolsMgr.update(true);
- }
- /*
- * Removes the pin action from the toolbar.
- */
- private void removePinEditorAction() {
- IToolBarManager toolsMgr = window.getToolsManager();
- if (toolsMgr instanceof CoolBarManager) {
- CoolBarManager cBarMgr = (CoolBarManager)toolsMgr;
- CoolBarContributionItem coolBarItem = (CoolBarContributionItem)cBarMgr.find(pinEditorGroup); //$NON-NLS-1$
- if (coolBarItem != null)
- coolBarItem.dispose();
- } else {
-
- pinEditorAction.setVisible(false);
- toolsMgr.remove(pinEditorAction.getId());
- }
- toolsMgr.update(true);
- }
- /**
- * Remove the manual incremental build action
- * from both the menu bar and the tool bar.
- */
- protected void removeManualIncrementalBuildAction() {
- MenuManager menubar = window.getMenuBarManager();
- if (usingMenuReorg) {
- IMenuManager manager = menubar.findMenuUsingPath(IWorkbenchActionConstants.M_PROJECT);
- if (manager != null) {
- try {
- manager.remove(IWorkbenchActionConstants.BUILD);
- manager.remove(IWorkbenchActionConstants.BUILD_PROJECT);
- } catch (IllegalArgumentException e) {
- // action was not in menu
- }
- }
- }
- else {
- IMenuManager manager = menubar.findMenuUsingPath(IWorkbenchActionConstants.M_WORKBENCH);
- if (manager != null) {
- try {
- manager.remove(IWorkbenchActionConstants.BUILD);
- } catch (IllegalArgumentException e) {
- // action was not in menu
- }
- }
- }
- IContributionManager toolsManager = window.getToolsManager();
- IContributionManager tBarMgr = toolsManager;
- if (toolsManager instanceof CoolBarManager) {
- CoolBarContributionItem groupItem = (CoolBarContributionItem)toolsManager.find(workbenchToolGroupId);
- tBarMgr = groupItem.getToolBarManager();
- }
- tBarMgr.remove(IWorkbenchActionConstants.BUILD);
- tBarMgr.update(true);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchColors.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchColors.java
deleted file mode 100644
index 1fb59ec..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchColors.java
+++ /dev/null
@@ -1,297 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-import java.util.*;
-
-/**
- * This class manages the common workbench colors.
- */
-public class WorkbenchColors {
- static private boolean init = false;
- static private HashMap colorMap;
- static private HashMap systemColorMap;
- static private Color workbenchColors[];
- static private Color [] activeViewGradient;
- static private Color [] deactivatedViewGradient;
- static private Color [] activeEditorGradient;
- static private Color [] activeNoFocusEditorGradient;
- static private Color [] deactivatedEditorGradient;
- static private int [] activeViewPercentages;
- static private int [] deactivatedViewPercentages;
- static private int [] activeEditorPercentages;
- static private int [] activeNoFocusEditorPercentages;
- static private int [] deactivatedEditorPercentages;
- static private final String CLR_VIEW_GRAD_START = "clrViewGradStart";//$NON-NLS-1$
- static private final String CLR_VIEW_GRAD_END = "clrViewGradEnd";//$NON-NLS-1$
- static private final String CLR_EDITOR_GRAD_START = "clrEditorGradStart";//$NON-NLS-1$
- static private final String CLR_EDITOR_GRAD_END = "clrEditorGradEnd";//$NON-NLS-1$
-/**
- * Dispose all color pre-allocated by the workbench.
- */
-private static void disposeWorkbenchColors() {
- for (int i = 0; i < workbenchColors.length; i++){
- workbenchColors[i].dispose();
- }
-}
-/**
- * Returns the active editor gradient.
- */
-static public Color [] getActiveEditorGradient() {
- return activeEditorGradient;
-}
-/**
- * Returns the active editor gradient end color.
- */
-static public Color getActiveEditorGradientEnd() {
- Color clr = (Color)systemColorMap.get(CLR_EDITOR_GRAD_END);
- Assert.isNotNull(clr);
- return clr;
-}
-/**
- * Returns the active editor gradient percents.
- */
-static public int [] getActiveEditorGradientPercents() {
- return activeEditorPercentages;
-}
-/**
- * Returns the active editor gradient start color.
- */
-static public Color getActiveEditorGradientStart() {
- Color clr = (Color)systemColorMap.get(CLR_EDITOR_GRAD_START);
- Assert.isNotNull(clr);
- return clr;
-}
-/**
- * Returns the active no focus editor gradient.
- */
-static public Color [] getActiveNoFocusEditorGradient() {
- return activeNoFocusEditorGradient;
-}
-/**
- * Returns the active no focus editor gradient percents.
- */
-static public int [] getActiveNoFocusEditorGradientPercents() {
- return activeNoFocusEditorPercentages;
-}
-/**
- * Returns the active gradient for views.
- */
-static public Color [] getActiveViewGradient() {
- return activeViewGradient;
-}
-/**
- * Returns the active view gradient end color.
- */
-static public Color getActiveViewGradientEnd() {
- Color clr = (Color)systemColorMap.get(CLR_VIEW_GRAD_END);
- Assert.isNotNull(clr);
- return clr;
-}
-/**
- * Returns the active view gradient percents.
- */
-static public int [] getActiveViewGradientPercents() {
- return activeViewPercentages;
-}
-/**
- * Returns the active view gradient start color.
- */
-static public Color getActiveViewGradientStart() {
- Color clr = (Color)systemColorMap.get(CLR_VIEW_GRAD_START);
- Assert.isNotNull(clr);
- return clr;
-}
-/**
- * Returns the gradient for editors when the window
- * is deactivated.
- */
-static public Color [] getDeactivatedEditorGradient() {
- return deactivatedEditorGradient;
-}
-/**
- * Returns the editor gradient percents when the window
- * is deactivated.
- */
-static public int [] getDeactivatedEditorGradientPercents() {
- return deactivatedEditorPercentages;
-}
-/**
- * Returns the gradient for views when the window
- * is deactivated.
- */
-static public Color [] getDeactivatedViewGradient() {
- return deactivatedViewGradient;
-}
-/**
- * Returns the view gradient percents when the window
- * is deactivated.
- */
-static public int [] getDeactivatedViewGradientPercents() {
- return deactivatedViewPercentages;
-}
-/**
- * Returns a color identified by an RGB value.
- */
-static public Color getColor(RGB rgbValue) {
- Color clr = (Color)colorMap.get(rgbValue);
- if (clr == null) {
- Display disp = Display.getDefault();
- clr = new Color(disp, rgbValue);
- colorMap.put(rgbValue, clr);
- }
- return clr;
-}
-/**
- * Returns a system color identified by a SWT constant.
- */
-static public Color getSystemColor(int swtId) {
- Integer bigInt = new Integer(swtId);
- Color clr = (Color)systemColorMap.get(bigInt);
- if (clr == null) {
- Display disp = Display.getDefault();
- clr = disp.getSystemColor(swtId);
- systemColorMap.put(bigInt, clr);
- }
- return clr;
-}
-/**
- * Initialize all colors used in the workbench in case the OS is using
- * a 256 color palette making sure the workbench colors are allocated.
- *
- * This list comes from the designers.
- */
-private static void initWorkbenchColors(Display d) {
- if(workbenchColors != null) return;
-
- workbenchColors = new Color[]{
- //Product pallet
- new Color(d,255,255,255),
- new Color(d,255,251,240),
- new Color(d,223,223,191),
- new Color(d,223,191,191),
- new Color(d,192,220,192),
- new Color(d,192,192,192),
- new Color(d,191,191,191),
- new Color(d,191,191,159),
- new Color(d,191,159,191),
- new Color(d,160,160,164),
- new Color(d,159,159,191),
- new Color(d,159,159,159),
- new Color(d,159,159,127),
- new Color(d,159,127,159),
- new Color(d,159,127,127),
- new Color(d,128,128,128),
- new Color(d,127,159,159),
- new Color(d,127,159,127),
- new Color(d,127,127,159),
- new Color(d,127,127,127),
- new Color(d,127,127,95),
- new Color(d,127,95,127),
- new Color(d,127,95,95),
- new Color(d,95,127,127),
- new Color(d,95,127,95),
- new Color(d,95,95,127),
- new Color(d,95,95,95),
- new Color(d,95,95,63),
- new Color(d,95,63,95),
- new Color(d,95,63,63),
- new Color(d,63,95,95),
- new Color(d,63,95,63),
- new Color(d,63,63,95),
- new Color(d,0,0,0),
- //wizban pallet
- new Color(d,195,204,224),
- new Color(d,214,221,235),
- new Color(d,149,168,199),
- new Color(d,128,148,178),
- new Color(d,106,128,158),
- new Color(d,255,255,255),
- new Color(d,0,0,0),
- new Color(d,0,0,0),
- //Perspective
- new Color(d,132, 130, 132),
- new Color(d,143, 141, 138),
- new Color(d,171, 168, 165),
- //PreferenceDialog and TitleAreaDialog
- new Color(d,230, 226, 221)
- };
-}
-/**
- * Disposes of the colors. Ignore all
- * system colors as they do not need
- * to be disposed.
- */
-static public void shutdown() {
- if (!init)
- return;
-
- disposeWorkbenchColors();
-
- Iterator iter = colorMap.values().iterator();
- while (iter.hasNext()) {
- Color clr = (Color)iter.next();
- if (clr != null) {
- clr.dispose();
- }
- }
-
- colorMap.clear();
- systemColorMap.clear();
- init = false;
-}
-/**
- * Initializes the colors.
- */
-static public void startup() {
- if (init)
- return;
-
- // Initialize the caches first.
- init = true;
- colorMap = new HashMap(10);
- systemColorMap = new HashMap(10);
-
- initWorkbenchColors(Display.getDefault());
- // Define active view gradient using same OS title gradient colors.
- Color clr1 = getSystemColor(SWT.COLOR_TITLE_BACKGROUND);
- Color clr2 = getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT);
- Color clr3 = getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
- systemColorMap.put(CLR_VIEW_GRAD_START, clr1);
- systemColorMap.put(CLR_VIEW_GRAD_END, clr3);
- activeViewGradient = new Color[] {clr1, clr2, clr3};
- activeViewPercentages = new int[] {50, 100};
-
- // Define active editor gradient using same OS title gradient colors.
- systemColorMap.put(CLR_EDITOR_GRAD_START, clr1);
- systemColorMap.put(CLR_EDITOR_GRAD_END, null); // use widget default background
- activeEditorGradient = new Color[] {clr1, clr2, null, null};
- activeEditorPercentages = new int[] {50, 90, 100};
-
- // Define active no focus editor gradient
- activeNoFocusEditorGradient = new Color[] {getSystemColor(SWT.COLOR_LIST_BACKGROUND)};
- activeNoFocusEditorPercentages = new int[0];
-
- // Define view gradient for deactivated window using same OS title gradient colors.
- clr1 = getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND);
- clr2 = getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT);
- clr3 = getSystemColor(SWT.COLOR_WIDGET_BACKGROUND);
- deactivatedViewGradient = new Color[] {clr1, clr2, clr3};
- deactivatedViewPercentages = new int[] {70, 100};
-
- // Define editor gradient for deactivated window using same OS title gradient colors.
- deactivatedEditorGradient = new Color[] {clr1, clr2, null, null};
- deactivatedEditorPercentages = new int[] {70, 95, 100};
-
- // Preload.
- getSystemColor(SWT.COLOR_WIDGET_FOREGROUND);
- getSystemColor(SWT.COLOR_BLACK);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchEditorsAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchEditorsAction.java
deleted file mode 100644
index d5bdacb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchEditorsAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.dialogs.WorkbenchEditorsDialog;
-
-/**
- * Implements a action to open a dialog showing all open editors
- * and the recent closed editors.
- */
-public class WorkbenchEditorsAction extends Action {
-
- WorkbenchWindow window;
-
- /**
- * Constructor for NavigateWorkbenchAction.
- * @param text
- */
- public WorkbenchEditorsAction(WorkbenchWindow window) {
- super(WorkbenchMessages.getString("WorkbenchEditorsAction.label")); //$NON-NLS-1$
- setAccelerator(SWT.CTRL | SWT.SHIFT | 'W');
- this.window = window;
- WorkbenchHelp.setHelp(this, IHelpContextIds.WORKBENCH_EDITORS_ACTION);
- }
- public void run() {
- new WorkbenchEditorsDialog(window).open();
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 84ac48c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchImages.java
+++ /dev/null
@@ -1,519 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.misc.*;
-import org.eclipse.jface.resource.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.*;
-import java.net.*;
-import java.util.*;
-
-/**
- * This class provides convenience access to many of the resources required
- * by the workbench. The class stores some images as descriptors, and
- * some are stored as real Images in the registry. This is a pure
- * speed-space tradeoff. The trick for users of this class is that
- * images obtained from the registry (using getImage()), don't require
- * disposal since they are shared, while images obtained using
- * getImageDescriptor() will require disposal. Consult the declareImages
- * method to see if a given image is declared as a registry image or
- * just as a descriptor. If you change an image from being stored
- * as a descriptor to a registry image, or vice-versa, make sure to
- * check all users of the image to ensure they are calling
- * the correct getImage... method and handling disposal correctly.
- *
- * Images:
- * - use getImage(key) to access cached images from the registry.
- * - Less common images are found by calling getImageDescriptor(key)
- * where key can be found in IWorkbenchGraphicConstants
- *
- * This class initializes the image registry by declaring all of the required
- * graphics. This involves creating image descriptors describing
- * how to create/find the image should it be needed.
- * The image is not actually allocated until requested.
- *
- * Some Images are also made available to other plugins by being
- * placed in the descriptor table of the SharedImages class.
- *
- * Where are the images?
- * The images (typically gifs) are found the plugins install directory
- *
- * How to add a new image
- * Place the gif file into the appropriate directories.
- * Add a constant to IWorkbenchGraphicConstants following the conventions
- * Add the declaration to this file
- */
-public /*final*/ class WorkbenchImages {
- private static Map descriptors = new HashMap();
- private static ImageRegistry imageRegistry;
-
- //Key: ImageDescriptor
- //Value: Image
- private static ReferenceCounter imageCache = new ReferenceCounter();
-
- /* Declare Common paths */
-
- // Subdirectory (under the package containing this class) where 16 color images are
- private static final URL URL_BASIC = WorkbenchPlugin.getDefault().getDescriptor().getInstallURL();
-
- public final static String ICONS_PATH = "icons/full/";//$NON-NLS-1$
-
- private final static String PATH_CTOOL = ICONS_PATH+"ctool16/"; //Colored toolbar icons - hover.//$NON-NLS-1$
- private final static String PATH_ETOOL = ICONS_PATH+"etool16/"; //Enabled toolbar icons.//$NON-NLS-1$
- private final static String PATH_DTOOL = ICONS_PATH+"dtool16/"; //Disabled toolbar icons.//$NON-NLS-1$
-
- private final static String PATH_CLOCALTOOL = ICONS_PATH+"clcl16/"; //Colored local toolbar icons - hover.//$NON-NLS-1$
- private final static String PATH_ELOCALTOOL = ICONS_PATH+"elcl16/"; //Enabled local toolbar icons.//$NON-NLS-1$
- private final static String PATH_DLOCALTOOL = ICONS_PATH+"dlcl16/"; //Disabled local toolbar icons.//$NON-NLS-1$
-
- private final static String PATH_CVIEW = ICONS_PATH+"cview16/"; //Colored view icons.//$NON-NLS-1$
- private final static String PATH_EVIEW = ICONS_PATH+"eview16/"; //View icons//$NON-NLS-1$
-
-
- //private final static String PATH_PROD = ICONS_PATH+"prod/"; //Product images
- private final static String PATH_OBJECT = ICONS_PATH+"obj16/"; //Model object icons//$NON-NLS-1$
- private final static String PATH_DND = ICONS_PATH+"dnd/"; //DND icons//$NON-NLS-1$
- private final static String PATH_WIZBAN = ICONS_PATH+"wizban/"; //Wizard icons//$NON-NLS-1$
-
- //private final static String PATH_STAT = ICONS_PATH+"stat/";
- //private final static String PATH_MISC = ICONS_PATH+"misc/";
- //private final static String PATH_OVERLAY = ICONS_PATH+"ovr16/";
-
-/**
- * Returns the image cache used internally by the workbench.
- */
-public static ReferenceCounter getImageCache() {
- return imageCache;
-}
-/**
- * Declare an ImageDescriptor in the descriptor table.
- * @param key The key to use when registering the image
- * @param path The path where the image can be found. This path is relative to where
- * this plugin class is found (i.e. typically the packages directory)
- */
-private final static void declareImage(String key,String path) {
- URL url = null;
- try {
- url = new URL(URL_BASIC, path);
- } catch (MalformedURLException e) {
- }
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- descriptors.put(key, desc);
-}
-private final static void declareImages() {
-
-
- // toolbar buttons for wizards
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ, PATH_ETOOL+"new_wiz.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ_HOVER, PATH_CTOOL+"new_wiz.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WIZ_DISABLED, PATH_DTOOL+"new_wiz.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_PIN_EDITOR, PATH_ETOOL+"pin_editor.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_PIN_EDITOR_HOVER, PATH_CTOOL+"pin_editor.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_PIN_EDITOR_DISABLED, PATH_DTOOL+"pin_editor.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_IMPORT_WIZ, PATH_CTOOL+"import_wiz.gif");//$NON-NLS-1$
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_IMPORT_WIZ_HOVER, PATH_CTOOL+"import_wiz.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_IMPORT_WIZ_DISABLED, PATH_DTOOL+"import_wiz.gif");
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_EXPORT_WIZ, PATH_CTOOL+"export_wiz.gif");//$NON-NLS-1$
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_EXPORT_WIZ_HOVER, PATH_CTOOL+"export_wiz.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_EXPORT_WIZ_DISABLED, PATH_DTOOL+"export_wiz.gif");
-
- // other toolbar buttons
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_BUILD_EXEC, PATH_ETOOL+"build_exec.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_BUILD_EXEC_HOVER, PATH_CTOOL+"build_exec.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_BUILD_EXEC_DISABLED, PATH_DTOOL+"build_exec.gif");//$NON-NLS-1$
-
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_CLOSE_EDIT, PATH_CTOOL+"close_edit.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_CLOSE_EDIT_HOVER, PATH_CTOOL+"close_edit.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_CLOSE_EDIT_DISABLED, PATH_DTOOL+"close_edit.gif");
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SAVE_EDIT, PATH_ETOOL+"save_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SAVE_EDIT_HOVER, PATH_CTOOL+"save_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SAVE_EDIT_DISABLED, PATH_DTOOL+"save_edit.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SAVEAS_EDIT, PATH_ETOOL+"saveas_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SAVEAS_EDIT_HOVER, PATH_CTOOL+"saveas_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SAVEAS_EDIT_DISABLED, PATH_DTOOL+"saveas_edit.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SAVEALL_EDIT, PATH_ETOOL+"saveall_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SAVEALL_EDIT_HOVER, PATH_CTOOL+"saveall_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SAVEALL_EDIT_DISABLED, PATH_DTOOL+"saveall_edit.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_UNDO_EDIT, PATH_ETOOL+"undo_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_UNDO_EDIT_HOVER, PATH_CTOOL+"undo_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_UNDO_EDIT_DISABLED, PATH_DTOOL+"undo_edit.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_REDO_EDIT, PATH_ETOOL+"redo_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_REDO_EDIT_HOVER, PATH_CTOOL+"redo_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_REDO_EDIT_DISABLED, PATH_DTOOL+"redo_edit.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_CUT_EDIT, PATH_ETOOL+"cut_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_CUT_EDIT_HOVER, PATH_CTOOL+"cut_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_CUT_EDIT_DISABLED, PATH_DTOOL+"cut_edit.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_COPY_EDIT, PATH_ETOOL+"copy_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_COPY_EDIT_HOVER, PATH_CTOOL+"copy_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_COPY_EDIT_DISABLED, PATH_DTOOL+"copy_edit.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_PASTE_EDIT, PATH_ETOOL+"paste_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_PASTE_EDIT_HOVER, PATH_CTOOL+"paste_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_PASTE_EDIT_DISABLED, PATH_DTOOL+"paste_edit.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_DELETE_EDIT, PATH_ETOOL+"delete_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_DELETE_EDIT_HOVER, PATH_CTOOL+"delete_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_DELETE_EDIT_DISABLED, PATH_DTOOL+"delete_edit.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_PRINT_EDIT, PATH_ETOOL+"print_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_PRINT_EDIT_HOVER, PATH_CTOOL+"print_edit.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_PRINT_EDIT_DISABLED, PATH_DTOOL+"print_edit.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SEARCH_SRC, PATH_ETOOL+"search_src.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SEARCH_SRC_HOVER, PATH_CTOOL+"search_src.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SEARCH_SRC_DISABLED, PATH_DTOOL+"search_src.gif");//$NON-NLS-1$
-
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_REFRESH_NAV, PATH_CTOOL+"refresh_nav.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_REFRESH_NAV_HOVER, PATH_CTOOL+"refresh_nav.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_REFRESH_NAV_DISABLED, PATH_DTOOL+"refresh_nav.gif");
-
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_STOP_NAV, PATH_CTOOL+"stop_nav.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_STOP_NAV_HOVER, PATH_CTOOL+"stop_nav.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_STOP_NAV_DISABLED, PATH_DTOOL+"stop_nav.gif");
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_FORWARD_NAV, PATH_CLOCALTOOL+"forward_nav.gif");//$NON-NLS-1$
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_FORWARD_NAV_HOVER, PATH_CTOOL+"forward_nav.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_FORWARD_NAV_DISABLED, PATH_DTOOL+"forward_nav.gif");
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_BACKWARD_NAV, PATH_CLOCALTOOL+"backward_nav.gif");//$NON-NLS-1$
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_BACKWARD_NAV_HOVER, PATH_CTOOL+"backward_nav.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_BACKWARD_NAV_DISABLED, PATH_DTOOL+"backward_nav.gif");
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_HOME_NAV, PATH_CLOCALTOOL+"home_nav.gif");//$NON-NLS-1$
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_HOME_NAV_HOVER, PATH_CLOCALTOOL+"home_nav.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_HOME_NAV_DISABLED, PATH_DLOCALTOOL+"home_nav.gif");
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_NEXT_NAV, PATH_CTOOL+"next_nav.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_PREVIOUS_NAV, PATH_CTOOL+"prev_nav.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_PAGE, PATH_EVIEW+"new_persp.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_PAGE_HOVER, PATH_CVIEW+"new_persp.gif");//$NON-NLS-1$
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_PAGE_DISABLED, PATH_DTOOL+"new_page.gif");
-
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SET_PAGE, PATH_CTOOL+"set_page.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SET_PAGE_HOVER, PATH_CTOOL+"set_page.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_SET_PAGE_DISABLED, PATH_DTOOL+"set_page.gif");
-
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WND,PATH_CTOOL+"new_wnd.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WND_HOVER, PATH_CTOOL+"new_wnd.gif");
-// declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_NEW_WND_DISABLED, PATH_DTOOL+"new_wnd.gif");
-
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_DEF_PERSPECTIVE,PATH_EVIEW+"default_persp.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_CTOOL_DEF_PERSPECTIVE_HOVER,PATH_CVIEW+"default_persp.gif");//$NON-NLS-1$
-
- // *TASKLIST* View icons are in the view code now.
- //declareImage(IWorkbenchGraphicConstants.IMG_LCL_GOTOOBJ_TSK, PATH_LOCALTOOL+"gotoobj_tsk.gif");
- //declareImage(IWorkbenchGraphicConstants.IMG_LCL_ADDTSK_TSK, PATH_LOCALTOOL+"addtsk_tsk.gif");
- //declareImage(IWorkbenchGraphicConstants.IMG_LCL_REMTSK_TSK, PATH_LOCALTOOL+"remtsk_tsk.gif");
- //declareImage(IWorkbenchGraphicConstants.IMG_LCL_SHOWCOMPLETE_TSK, PATH_LOCALTOOL+"showcomplete_tsk.gif");
- //declareImage(IWorkbenchGraphicConstants.IMG_LCL_SELECTED_MODE, PATH_LOCALTOOL+"selected_mode.gif");
- //declareImage(IWorkbenchGraphicConstants.IMG_LCL_SHOWCHILD_MODE, PATH_LOCALTOOL+"showchild_mode.gif");
-
- // *PROPERTY* View icons are in the view code now.
- //declareImage(IWorkbenchGraphicConstants.IMG_LCL_DEFAULTS_PS, PATH_LOCALTOOL+"defaults_ps.gif");
- //declareImage(IWorkbenchGraphicConstants.IMG_LCL_TREE_MODE, PATH_LOCALTOOL+"tree_mode.gif");
- //declareImage(IWorkbenchGraphicConstants.IMG_LCL_FILTER_PS, PATH_LOCALTOOL+"filter_ps.gif");
- //declareImage(IWorkbenchGraphicConstants.IMG_LCL_REMBKMRK_TSK, PATH_LOCALTOOL+"rembkmrk_tsk.gif");
-
- //declareImage(IWorkbenchGraphicConstants.IMG_LCL_SHOWSYNC_RN, PATH_LOCALTOOL+"showsync_rn.gif");
-
- // view images
- declareImage(IWorkbenchGraphicConstants.IMG_VIEW_DEFAULTVIEW_MISC, PATH_CVIEW+"defaultview_misc.gif");//$NON-NLS-1$
-
- // wizard images
- declareImage(IWorkbenchGraphicConstants.IMG_WIZBAN_NEW_WIZ, PATH_WIZBAN+"new_wiz.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_WIZBAN_NEWPRJ_WIZ, PATH_WIZBAN+"newprj_wiz.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_WIZBAN_NEWFOLDER_WIZ, PATH_WIZBAN+"newfolder_wiz.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_WIZBAN_NEWFILE_WIZ, PATH_WIZBAN+"newfile_wiz.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORT_WIZ, PATH_WIZBAN+"import_wiz.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORTDIR_WIZ, PATH_WIZBAN+"importdir_wiz.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORTZIP_WIZ, PATH_WIZBAN+"importzip_wiz.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_WIZBAN_EXPORT_WIZ, PATH_WIZBAN+"export_wiz.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_WIZBAN_EXPORTDIR_WIZ, PATH_WIZBAN+"exportdir_wiz.gif");//$NON-NLS-1$
- declareImage(IWorkbenchGraphicConstants.IMG_WIZBAN_EXPORTZIP_WIZ, PATH_WIZBAN+"exportzip_wiz.gif");//$NON-NLS-1$
-
- declareImage(IWorkbenchGraphicConstants.IMG_WIZBAN_RESOURCEWORKINGSET_WIZ, PATH_WIZBAN+"workset_wiz.gif");//$NON-NLS-1$
-
- // dialog images
- declareImage(IWorkbenchGraphicConstants.IMG_DLGBAN_SAVEAS_DLG, PATH_WIZBAN+"saveas_dlg.gif");//$NON-NLS-1$
-
- /* Cache the commonly used ones */
-
- // object images -- these are also shared images.
- declareRegistryImage(ISharedImages.IMG_OBJ_FILE, PATH_OBJECT+"file_obj.gif");//$NON-NLS-1$
- declareRegistryImage(ISharedImages.IMG_OBJ_FOLDER, PATH_OBJECT+"fldr_obj.gif");//$NON-NLS-1$
- declareRegistryImage(ISharedImages.IMG_OBJ_PROJECT, PATH_OBJECT+"prj_obj.gif");//$NON-NLS-1$
- declareRegistryImage(ISharedImages.IMG_OBJ_PROJECT_CLOSED, PATH_OBJECT+"cprj_obj.gif");//$NON-NLS-1$
- declareRegistryImage(ISharedImages.IMG_OBJ_ELEMENT, PATH_OBJECT+"elements_obj.gif");//$NON-NLS-1$
- declareRegistryImage(ISharedImages.IMG_OPEN_MARKER, PATH_CLOCALTOOL+"gotoobj_tsk.gif");//$NON-NLS-1$
- declareRegistryImage(ISharedImages.IMG_DEF_VIEW, PATH_CVIEW+"defaultview_misc.gif");//$NON-NLS-1$
-
- // view toolbar images
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_LCL_CLOSE_VIEW, PATH_CLOCALTOOL+"close_view.gif");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_LCL_PIN_VIEW, PATH_CLOCALTOOL+"pin_view.gif");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_LCL_MIN_VIEW, PATH_CLOCALTOOL+"min_view.gif");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_LCL_VIEW_MENU, PATH_CLOCALTOOL+"view_menu.gif");//$NON-NLS-1$
-
- // task objects
- //declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_HPRIO_TSK, PATH_OBJECT+"hprio_tsk.gif");
- //declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_MPRIO_TSK, PATH_OBJECT+"mprio_tsk.gif");
- //declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_LPRIO_TSK, PATH_OBJECT+"lprio_tsk.gif");
-
- declareRegistryImage(ISharedImages.IMG_OBJS_ERROR_TSK, PATH_OBJECT+"error_tsk.gif");//$NON-NLS-1$
- declareRegistryImage(ISharedImages.IMG_OBJS_WARN_TSK, PATH_OBJECT+"warn_tsk.gif");//$NON-NLS-1$
- declareRegistryImage(ISharedImages.IMG_OBJS_INFO_TSK, PATH_OBJECT+"info_tsk.gif");//$NON-NLS-1$
- declareRegistryImage(ISharedImages.IMG_OBJS_TASK_TSK, PATH_OBJECT+"taskmrk_tsk.gif");//$NON-NLS-1$
- //declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_BRKPT_TSK, PATH_OBJECT+"brkptmrk_tsk.gif");
- declareRegistryImage(ISharedImages.IMG_OBJS_BKMRK_TSK, PATH_OBJECT+"bkmrk_tsk.gif");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_COMPLETE_TSK, PATH_OBJECT+"complete_tsk.gif"); //$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_INCOMPLETE_TSK, PATH_OBJECT+"incomplete_tsk.gif");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_WELCOME_ITEM, PATH_OBJECT+"welcome_item.gif");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_WELCOME_BANNER, PATH_OBJECT+"welcome_banner.gif");//$NON-NLS-1$
-
- // synchronization indicator objects
- //declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_WBET_STAT, PATH_OVERLAY+"wbet_stat.gif");
- //declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_SBET_STAT, PATH_OVERLAY+"sbet_stat.gif");
- //declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_CONFLICT_STAT, PATH_OVERLAY+"conflict_stat.gif");
-
- // content locality indicator objects
- //declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_NOTLOCAL_STAT, PATH_STAT+"notlocal_stat.gif");
- //declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_LOCAL_STAT, PATH_STAT+"local_stat.gif");
- //declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_FILLLOCAL_STAT, PATH_STAT+"filllocal_stat.gif");
-
- // cursor icons for direct manipulation in PartPresentation
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_LEFT_SOURCE, PATH_DND+"left_source.bmp");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_LEFT_MASK, PATH_DND+"left_mask.bmp");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_RIGHT_SOURCE, PATH_DND+"right_source.bmp");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_RIGHT_MASK, PATH_DND+"right_mask.bmp");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_TOP_SOURCE, PATH_DND+"top_source.bmp");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_TOP_MASK, PATH_DND+"top_mask.bmp");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_BOTTOM_SOURCE, PATH_DND+"bottom_source.bmp");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_BOTTOM_MASK, PATH_DND+"bottom_mask.bmp");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_INVALID_SOURCE, PATH_DND+"invalid_source.bmp");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_INVALID_MASK, PATH_DND+"invalid_mask.bmp");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_STACK_SOURCE, PATH_DND+"stack_source.bmp");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_STACK_MASK, PATH_DND+"stack_mask.bmp");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_OFFSCREEN_SOURCE, PATH_DND+"offscreen_source.bmp");//$NON-NLS-1$
- declareRegistryImage(IWorkbenchGraphicConstants.IMG_OBJS_DND_OFFSCREEN_MASK, PATH_DND+"offscreen_mask.bmp");//$NON-NLS-1$
-}
-/**
- * Declare an Image in the registry table.
- * @param key The key to use when registering the image
- * @param path The path where the image can be found. This path is relative to where
- * this plugin class is found (i.e. typically the packages directory)
- */
-private final static void declareRegistryImage(String key,String path) {
- URL url = null;
- try {
- url = new URL(URL_BASIC, path);
- } catch (MalformedURLException e) {
- }
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- descriptors.put(key, desc);
- imageRegistry.put(key, desc);
-}
-/**
- * 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).
- */
-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.
- */
-public static ImageDescriptor getImageDescriptor(String symbolicName) {
- return (ImageDescriptor)descriptors.get(symbolicName);
-}
-/**
- * Convenience Method.
- * Returns an ImageDescriptor whose path, relative to the plugin containing
- * the <code>extension</code> is <code>subdirectoryAndFilename</code>.
- * If there isn't any value associated with the name 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:
- * subdirectoryAndFilename must not have any leading "." or path separators / or \
- * ISV's should use icons/mysample.gif and not ./icons/mysample.gif
- *
- * 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.
- */
-public static ImageDescriptor getImageDescriptorFromExtension(IExtension extension, String subdirectoryAndFilename) {
- Assert.isNotNull(extension);
- Assert.isNotNull(subdirectoryAndFilename);
- return getImageDescriptorFromPlugin(extension.getDeclaringPluginDescriptor(),subdirectoryAndFilename);
-}
-/**
- * Convenience Method.
- * Return an ImageDescriptor whose path relative to the plugin described
- * by <code>pluginDescriptor</code> or one of its fragments is
- * <code>subdirectoryAndFilename</code>.
- * Returns <code>null</code>if no image could be found.
- *
- * 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:
- * subdirectoryAndFilename must not have any leading "." or path separators / or \
- * ISV's should use icons/mysample.gif and not ./icons/mysample.gif
- *
- * 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 or one of its fragments.
- */
-public static ImageDescriptor getImageDescriptorFromPlugin(IPluginDescriptor pluginDescriptor, String subdirectoryAndFilename) {
- Assert.isNotNull(pluginDescriptor);
- Assert.isNotNull(subdirectoryAndFilename);
- URL fullPathString = pluginDescriptor.find(new Path(subdirectoryAndFilename));
- if (fullPathString != null) {
- return ImageDescriptor.createFromURL(fullPathString);
- }
- URL path = pluginDescriptor.getInstallURL();
- try {
- fullPathString = new URL(path,subdirectoryAndFilename);
- return ImageDescriptor.createFromURL(fullPathString);
- } catch (MalformedURLException e) {
- }
- return null;
-}
-/**
- * Convenience Method.
- * Returns an ImageDescriptor whose path, relative to the plugin (within given id)
- * is <code>subdirectoryAndFilename</code>.
- * If there isn't any value associated with the name 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:
- * subdirectoryAndFilename must not have any leading "." or path separators / or \
- * ISV's should use icons/mysample.gif and not ./icons/mysample.gif
- *
- * 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.
- */
-public static ImageDescriptor getImageDescriptorFromPluginID(String pluginId, String subdirectoryAndFilename) {
- Assert.isNotNull(pluginId);
- Assert.isNotNull(subdirectoryAndFilename);
- return getImageDescriptorFromPlugin(
- Platform.getPluginRegistry().getPluginDescriptor(pluginId),
- subdirectoryAndFilename);
-}
-/**
- * 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.
- */
-
-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);
- descriptors.put(key,desc);
- }
- return desc;
-}
-/**
- * Returns the ImageRegistry.
- */
-
-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_
- * Color toolbar CTOOL_
- * 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 gifs) 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 JFace's ImageRegistry
- */
-public static ImageRegistry initializeImageRegistry() {
- imageRegistry = new ImageRegistry();
- declareImages();
- return imageRegistry;
-}
-}
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
deleted file mode 100644
index bcf5346..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchMessages.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps managing messages
- */
-public class WorkbenchMessages {
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.internal.messages";//$NON-NLS-1$
- private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
-private WorkbenchMessages(){
- // prevent instantiation of class
-}
-/**
- * Returns the formatted message for the given key in
- * the resource bundle.
- *
- * @param key the resource name
- * @param args the message arguments
- * @return the string
- */
-public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key),args);
-}
-/**
- * Returns the resource object with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the key is returned.
- *
- * @param key the resource name
- * @return the string
- */
-public static String getString(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- }
-}
-/**
- * Returns the resource object with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the default value is returned.
- *
- * @param key the resource name
- * @param def the default value
- * @return the string
- */
-public static String getString(String key, String def) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return def;
- }
-}
-}
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
deleted file mode 100644
index d7b9eff..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
+++ /dev/null
@@ -1,2897 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-import java.util.List; // otherwise ambiguous with org.eclipse.swt.widgets.List
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.*;
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.model.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.ui.part.MultiEditor;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-/**
- * A collection of views and editors in a workbench.
- */
-public class WorkbenchPage implements IWorkbenchPage {
- private WorkbenchWindow window;
- private IAdaptable input;
- private IWorkingSet workingSet;
- private Composite composite;
- private ControlListener resizeListener;
- private IWorkbenchPart activePart; //Could be delete. This information is in the active part list;
- private ActivationList activationList = new ActivationList();
- private IEditorPart lastActiveEditor;
- private EditorManager editorMgr;
- private EditorPresentation editorPresentation;
- private PartListenerList partListeners = new PartListenerList();
- private ListenerList propertyChangeListeners = new ListenerList();
- private PageSelectionService selectionService = new PageSelectionService(this);
- private IActionBars actionBars;
- private ViewFactory viewFactory;
- private PerspectiveList perspList = new PerspectiveList();
- private Listener mouseDownListener;
- private PerspectiveDescriptor deferredActivePersp;
- private NavigationHistory navigationHistory = new NavigationHistory(this);
- private IPropertyChangeListener propertyChangeListener= new IPropertyChangeListener() {
- /*
- * Remove the working set from the page if the working set is deleted.
- */
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- if (IWorkingSetManager.CHANGE_WORKING_SET_REMOVE.equals(property) &&
- event.getOldValue().equals(workingSet)) {
- setWorkingSet(null);
- }
- }
- };
- private ActionSwitcher actionSwitcher = new ActionSwitcher();
- /**
- * Manages editor contributions and action set part associations.
- */
- private class ActionSwitcher {
- private IWorkbenchPart activePart;
- private IEditorPart topEditor;
- private ArrayList actionSets = new ArrayList();
-
- /**
- * Updates the contributions given the new part as the active part.
- *
- * @param newPart the new active part, may be <code>null</code>
- */
- public void updateActivePart(IWorkbenchPart newPart) {
- if (activePart == newPart)
- return;
-
- boolean isNewPartAnEditor = newPart instanceof IEditorPart;
- if (isNewPartAnEditor) {
- String oldId = null;
- if (topEditor != null)
- oldId = topEditor.getSite().getId();
- String newId = newPart.getSite().getId();
-
- // if the active part is an editor and the new editor
- // is the same kind of editor, then we don't have to do anything
- if (activePart == topEditor && newId.equals(oldId))
- return;
-
- // remove the contributions of the old editor
- // if it is a different kind of editor
- if (oldId != null && !oldId.equals(newId))
- deactivateContributions(topEditor, true);
-
- // if a view was the active part, disable its contributions
- if (activePart != null && activePart != topEditor)
- deactivateContributions(activePart, true);
-
- // show (and enable) the contributions of the new editor
- // if it is a different kind of editor or if the
- // old active part was a view
- if (!newId.equals(oldId) || activePart != topEditor)
- activateContributions(newPart, true);
-
- } else if (newPart == null) {
- if (activePart != null)
- // remove all contributions
- deactivateContributions(activePart, true);
- } else {
- // new part is a view
-
- // if old active part is a view, remove all contributions,
- // but if old part is an editor only disable
- if (activePart != null)
- deactivateContributions(activePart, activePart instanceof IViewPart);
-
- activateContributions(newPart, true);
- }
-
- ArrayList newActionSets = null;
- if (isNewPartAnEditor || (activePart == topEditor && newPart == null))
- newActionSets = calculateActionSets(newPart, null);
- else
- newActionSets = calculateActionSets(newPart, topEditor);
-
- if (!updateActionSets(newActionSets))
- updateActionBars();
-
- if (isNewPartAnEditor) {
- topEditor = (IEditorPart)newPart;
- } else if (activePart == topEditor && newPart == null) {
- // since we removed all the contributions, we clear the top editor
- topEditor = null;
- }
-
- activePart = newPart;
- }
-
- /**
- * Updates the contributions given the new part as the topEditor.
- *
- * @param newEditor the new top editor, may be <code>null</code>
- */
- public void updateTopEditor(IEditorPart newEditor) {
- if (topEditor == newEditor)
- return;
-
- String oldId = null;
- if (topEditor != null)
- oldId = topEditor.getSite().getId();
- String newId = null;
- if (newEditor != null)
- newId = newEditor.getSite().getId();
- if (oldId == null ? newId == null : oldId.equals(newId)) {
- // we don't have to change anything
- topEditor = newEditor;
- return;
- }
-
- // Remove the contributions of the old editor
- if (topEditor != null)
- deactivateContributions(topEditor, true);
-
- // Show (disabled) the contributions of the new editor
- if (newEditor != null)
- activateContributions(newEditor, false);
-
- ArrayList newActionSets = calculateActionSets(activePart, newEditor);
- if (!updateActionSets(newActionSets))
- updateActionBars();
-
- topEditor = newEditor;
- }
-
- /**
- * 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.
- */
- private void activateContributions(IWorkbenchPart part, boolean enable) {
- PartSite site = (PartSite) part.getSite();
- SubActionBars actionBars = (SubActionBars) site.getActionBars();
- actionBars.activate(enable);
- }
-
- /**
- * 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.
- */
- private void deactivateContributions(IWorkbenchPart part, boolean remove) {
- PartSite site = (PartSite) part.getSite();
- SubActionBars actionBars = (SubActionBars) site.getActionBars();
- actionBars.deactivate(remove);
- }
-
- /**
- * 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
- * @return the new action sets
- */
- private ArrayList calculateActionSets(IWorkbenchPart part, IEditorPart editor) {
- ArrayList newActionSets = new ArrayList();
- if (part != null) {
- IActionSetDescriptor[] partActionSets =
- WorkbenchPlugin.getDefault().getActionSetRegistry().getActionSetsFor(
- part.getSite().getId());
- for (int i = 0; i < partActionSets.length; i++) {
- newActionSets.add(partActionSets[i]);
- }
- }
- if (editor != null && editor != part) {
- IActionSetDescriptor[] editorActionSets =
- WorkbenchPlugin.getDefault().getActionSetRegistry().getActionSetsFor(
- editor.getSite().getId());
- for (int i = 0; i < editorActionSets.length; i++) {
- newActionSets.add(editorActionSets[i]);
- }
- }
- return newActionSets;
- }
-
-
- /**
- * Updates the actions we are showing for the active part and current editor.
- *
- * @param newActionSets the action sets to show
- * @return <code>true</code> if the action sets changed
- */
- private boolean updateActionSets(ArrayList newActionSets) {
- if(actionSets.equals(newActionSets))
- return false;
-
- Perspective persp = getActivePerspective();
- if (persp == null) {
- actionSets = newActionSets;
- return false;
- }
-
- // hide the old
- for (int i = 0; i < actionSets.size(); i++) {
- persp.hideActionSet(((IActionSetDescriptor)actionSets.get(i)).getId());
- }
-
- // show the new
- for (int i = 0; i < newActionSets.size(); i++) {
- persp.showActionSet(((IActionSetDescriptor)newActionSets.get(i)).getId());
- }
-
- actionSets = newActionSets;
-
- window.updateActionSets(); // this calls updateActionBars
- window.firePerspectiveChanged(WorkbenchPage.this, getPerspective(), CHANGE_ACTION_SET_SHOW);
- return true;
- }
-
- }
-
-/**
- * Constructs a new page with a given perspective and input.
- *
- * @param w the parent window
- * @param layoutID must not be <code>null</code>
- * @param input the page input
- */
-public WorkbenchPage(WorkbenchWindow w, String layoutID, IAdaptable input)
- throws WorkbenchException
-{
- super();
- if (layoutID == null)
- throw new WorkbenchException(WorkbenchMessages.getString("WorkbenchPage.UndefinedPerspective")); //$NON-NLS-1$
- init(w, layoutID, input);
-}
-/**
- * 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
- */
-public WorkbenchPage(WorkbenchWindow w, IAdaptable input)
- throws WorkbenchException
-{
- super();
- init(w, null, input);
-}
-/**
- * Activates a part. The part will be brought to the front and given focus.
- *
- * @param part the part to activate
- */
-public void activate(IWorkbenchPart part) {
- // Sanity check.
- if (!certifyPart(part))
- return;
-
- // If zoomed, unzoom.
- if (isZoomed() && partChangeAffectsZoom(getReference(part)))
- zoomOut();
-
- if(part instanceof MultiEditor) {
- part = ((MultiEditor)part).getActiveEditor();
- }
- // Activate part.
- if(window.getActivePage() == this) {
- bringToTop(part);
- setActivePart(part);
- } else {
- activationList.setActive(part);
- activePart = part;
- }
-}
-
-/**
- * Activates a part. The part is given focus, the pane is hilighted.
- */
-private void activatePart(final IWorkbenchPart part) {
- Platform.run(new SafeRunnable(WorkbenchMessages.getString("WorkbenchPage.ErrorActivatingView")) { //$NON-NLS-1$
- public void run() {
- if (part != null) {
- part.setFocus();
- PartSite site = (PartSite)part.getSite();
- site.getPane().showFocus(true);
- updateTabList(part);
- SubActionBars bars = (SubActionBars)site.getActionBars();
- bars.partChanged(part);
- }
- }
- });
-}
-/**
- * Add a fast view.
- */
-public void addFastView(IViewReference ref) {
- Perspective persp = getActivePerspective();
- if (persp == null)
- return;
-
- // If view is zoomed unzoom.
- if (isZoomed() && partChangeAffectsZoom(ref))
- zoomOut();
-
- // Do real work.
- persp.addFastView(ref);
-
- // The view is now invisible.
- // If it is active then deactivate it.
- if (ref.getPart(false) == activePart) {
- activate(activationList.getActive());
- }
-
- // Notify listeners.
- window.getShortcutBar().update(true);
- window.firePerspectiveChanged(this, getPerspective(), CHANGE_FAST_VIEW_ADD);
-}
-/**
- * Adds an IPartListener to the part service.
- */
-public void addPartListener(IPartListener l) {
- partListeners.addPartListener(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.
- */
-public void addPropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.add(listener);
-}
-/*
- * (non-Javadoc)
- * Method declared on ISelectionListener.
- */
-public void addSelectionListener(ISelectionListener listener) {
- selectionService.addSelectionListener(listener);
-}
-
-/*
- * (non-Javadoc)
- * Method declared on ISelectionListener.
- */
-public void addSelectionListener(String partId, ISelectionListener listener) {
- selectionService.addSelectionListener(partId, listener);
-}
-/*
- * (non-Javadoc)
- * Method declared on ISelectionListener.
- */
-public void addPostSelectionListener(ISelectionListener listener) {
- selectionService.addPostSelectionListener(listener);
-}
-
-/*
- * (non-Javadoc)
- * Method declared on ISelectionListener.
- */
-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.
- *
- * @param part the part to bring to move forward
- */
-public void bringToTop(IWorkbenchPart part) {
- // Sanity check.
- Perspective persp = getActivePerspective();
- if (persp == null || !certifyPart(part))
- return;
-
- // If zoomed then ignore.
- if (isZoomed() && partChangeAffectsZoom(getReference(part)))
- return;
-
- // Move part.
- boolean broughtToTop = false;
- if (part instanceof IEditorPart) {
- IEditorReference ref = (IEditorReference)getReference(part);
- broughtToTop = getEditorManager().setVisibleEditor(ref, false);
- actionSwitcher.updateTopEditor((IEditorPart)part);
- if (broughtToTop) {
- lastActiveEditor = null;
- }
- } else if (part instanceof IViewPart) {
- IViewReference ref = (IViewReference)getReference(part);
- broughtToTop = persp.bringToTop(ref);
- }
- if (broughtToTop) {
- firePartBroughtToTop(part);
- }
-}
-/**
- * Resets the layout for the perspective. The active part in the old layout is activated
- * in the new layout for consistent user context.
- *
- * Assumes the busy cursor is active.
- */
-private void busyResetPerspective() {
- // Always unzoom
- if (isZoomed())
- zoomOut();
-
- // Get the current perspective.
- // This describes the working layout of the page and differs from
- // the original template.
- Perspective oldPersp = getActivePerspective();
-
- // Map the current perspective to the original template.
- // If the original template cannot be found then it has been deleted. In
- // that case just return. (PR#1GDSABU).
- IPerspectiveRegistry reg = WorkbenchPlugin.getDefault().getPerspectiveRegistry();
- PerspectiveDescriptor desc = (PerspectiveDescriptor)reg.findPerspectiveWithId(oldPersp.getDesc().getId());
- if (desc == null)
- desc = (PerspectiveDescriptor)reg.findPerspectiveWithId(((PerspectiveDescriptor)oldPersp.getDesc()).getOriginalId());
- if (desc == null)
- return;
-
- IContributionItem item = window.findPerspectiveShortcut(oldPersp.getDesc(), this);
- if(item == null)
- return;
-
- // Create new persp from original template.
- Perspective newPersp = createPerspective(desc);
- if (newPersp == null)
- return;
-
- // Update the perspective list and shortcut
- perspList.swap(oldPersp, newPersp);
-
- SetPagePerspectiveAction action = (SetPagePerspectiveAction) ((ActionContributionItem)item).getAction();
- action.setPerspective(newPersp.getDesc());
-
- // Install new persp.
- setPerspective(newPersp);
-
- // Notify listeners.
- window.firePerspectiveChanged(this, desc, CHANGE_RESET);
-
- // Destroy old persp.
- disposePerspective(oldPersp);
-}
-/**
- * Implements <code>setPerspective</code>.
- *
- * Assumes that busy cursor is active.
- *
- * @param persp identifies the new perspective.
- */
-private void busySetPerspective(IPerspectiveDescriptor desc) {
- // Create new layout.
- PerspectiveDescriptor realDesc = (PerspectiveDescriptor)desc;
- Perspective newPersp = findPerspective(realDesc);
- if (newPersp == null) {
- newPersp = createPerspective(realDesc);
- window.addPerspectiveShortcut(realDesc, this);
- if (newPersp == null)
- return;
- }
-
- // Change layout.
- setPerspective(newPersp);
-}
-/**
- * Opens a view.
- *
- * Assumes that a busy cursor is active.
- */
-private IViewPart busyShowView(String viewID, boolean activate)
- throws PartInitException
-{
- Perspective persp = getActivePerspective();
- if (persp == null)
- return null;
-
- // If this view is already visible just return.
- IViewReference ref = persp.findView(viewID);
- IViewPart view = null;
- if(ref != null)
- view = ref.getView(true);
- if (view != null) {
- if (activate)
- activate(view);
- else
- bringToTop(view);
- return view;
- }
-
- // Show the view.
- view = persp.showView(viewID);
- if (view != null) {
- zoomOutIfNecessary(view);
- if (activate)
- activate(view);
- else
- bringToTop(view);
- window.firePerspectiveChanged(this, getPerspective(), CHANGE_VIEW_SHOW);
- // Just in case view was fast.
- window.getShortcutBar().update(true);
- }
- return view;
-}
-/**
- * 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;
-
- if (part instanceof IEditorPart) {
- IEditorReference ref = (IEditorReference)getReference(part);
- return getEditorManager().containsEditor(ref);
- }
- if (part instanceof IViewPart) {
- Perspective persp = getActivePerspective();
- return persp != null && persp.containsView((IViewPart)part);
- }
- return false;
-}
-/**
- * Closes the perspective.
- */
-public boolean close() {
- final boolean [] ret = new boolean[1];;
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- ret[0] = window.closePage(WorkbenchPage.this, true);
- }
- });
- return ret[0];
-}
-/**
- * See IWorkbenchPage
- */
-public boolean closeAllSavedEditors() {
- // If part is added / removed always unzoom.
- if (isZoomed())
- zoomOut();
-
- boolean deactivated = false;
-
- // Close all editors.
- IEditorReference editors[] = getEditorReferences();
- for (int i = 0; i < editors.length; i ++) {
- IEditorReference editor = editors[i];
- IWorkbenchPart part = editor.getPart(false);
- if(!editor.isDirty()) {
- if (part == activePart) {
- deactivated = true;
- setActivePart(null);
- } else if (lastActiveEditor == part) {
- lastActiveEditor = null;
- actionSwitcher.updateTopEditor(null);
- }
- getEditorManager().closeEditor(editor);
- activationList.remove(editor);
- if(part != null) {
- firePartClosed(part);
- disposePart(part);
- }
- }
- }
- if (deactivated)
- activate(activationList.getActive());
-
- // Notify interested listeners
- window.firePerspectiveChanged(this, getPerspective(), CHANGE_EDITOR_CLOSE);
-
- //if it was the last part, close the perspective
- lastPartClosePerspective();
-
- // Return true on success.
- return true;
-}
-/**
- * See IWorkbenchPage
- */
-public boolean closeAllEditors(boolean save) {
- // If part is added / removed always unzoom.
- if (isZoomed())
- zoomOut();
-
- // Save part.
- if (save && !getEditorManager().saveAll(true, true))
- return false;
-
- // Deactivate part.
- boolean deactivate = activePart instanceof IEditorPart;
- if (deactivate)
- setActivePart(null);
- lastActiveEditor = null;
- actionSwitcher.updateTopEditor(null);
-
- // Close all editors.
- IEditorReference[] editors = getEditorManager().getEditors();
- getEditorManager().closeAll();
- for (int i = 0; i < editors.length; i ++) {
- IEditorPart editor = (IEditorPart)editors[i].getPart(false);
- if(editor != null) {
- firePartClosed(editor);
- disposePart(editor);
- }
- }
- activationList.removeEditors();
- if (deactivate)
- activate(activationList.getActive());
-
- // Notify interested listeners
- window.firePerspectiveChanged(this, getPerspective(), CHANGE_EDITOR_CLOSE);
-
- //if it was the last part, close the perspective
- lastPartClosePerspective();
-
- // Return true on success.
- return true;
-}
-/**
- * See IWorkbenchPage#closeEditor
- */
-public boolean closeEditor(IEditorReference editorRef,boolean save) {
- IEditorPart editor = editorRef.getEditor(false);
- if(editor != null)
- return closeEditor(editor,save);
- getEditorManager().closeEditor(editorRef);
- activationList.remove(editorRef);
- return true;
-}
-/**
- * See IWorkbenchPage#closeEditor
- */
-public boolean closeEditor(IEditorPart editor, boolean save) {
- // Sanity check.
- if (!certifyPart(editor))
- return false;
-
- // Save part.
- if (save && !getEditorManager().saveEditor(editor, true))
- return false;
-
- boolean partWasVisible = (editor == getActiveEditor());
- IEditorReference ref = (IEditorReference)getReference(editor);
- activationList.remove(ref);
- boolean partWasActive = (editor == activePart);
-
- // Deactivate part.
- if (partWasActive)
- setActivePart(null);
- if (lastActiveEditor == editor) {
- actionSwitcher.updateTopEditor(null);
- lastActiveEditor = null;
- }
-
- // Close the part.
- getEditorManager().closeEditor(ref);
- firePartClosed(editor);
- disposePart(editor);
- // Notify interested listeners
- window.firePerspectiveChanged(this, getPerspective(), CHANGE_EDITOR_CLOSE);
-
- // Activate new part.
- if (partWasActive) {
- IWorkbenchPart top = activationList.getTopEditor();
- zoomOutIfNecessary(top);
- if (top == null)
- top = activationList.getActive();
- if (top != null)
- activate(top);
- else
- setActivePart(null);
- } else if(partWasVisible) {
- IEditorPart top = activationList.getTopEditor();
- zoomOutIfNecessary(top);
-
- // The editor we are bringing to top may already the visible
- // editor (due to editor manager behavior when it closes and editor).
- // If this is the case, bringToTop will not call firePartBroughtToTop.
- // We must fire it from here.
- if (top != null) {
- boolean isTop = editorMgr.getVisibleEditor() == top;
- bringToTop(top);
- if (isTop)
- firePartBroughtToTop(top);
- }
- else
- actionSwitcher.updateTopEditor(top);
- }
-
- //if it was the last part, close the perspective
- lastPartClosePerspective();
-
- // Return true on success.
- return true;
-}
-/**
- * Closes all perspectives in the page. The page is kept so as
- * not to lose the input.
- *
- * @param save whether the page's editors should be saved
- */
-/* package */ void closeAllPerspectives(boolean save) {
-
- if (perspList.isEmpty())
- return;
-
- // Always unzoom
- if (isZoomed())
- zoomOut();
-
- // Close all editors
- if (!closeAllEditors(save))
- return;
-
- // Deactivate the active perspective and part
- setPerspective((Perspective)null);
-
- // Close each perspective in turn
- PerspectiveList oldList = perspList;
- perspList = new PerspectiveList();
- Iterator enum = oldList.iterator();
- while (enum.hasNext())
- closePerspective((Perspective)enum.next(), false);
-}
-/**
- * Closes the specified perspective. If last perspective, then
- * entire page is closed.
- *
- * @param desc the descriptor of the perspective to be closed
- * @param save whether the page's editors should be save if last perspective
- */
-/* package */ void closePerspective(IPerspectiveDescriptor desc, boolean save) {
- Perspective persp = findPerspective(desc);
- if(persp != null)
- closePerspective(persp,save);
-}
-
-/**
- * Closes the specified perspective. If last perspective, then
- * entire page is closed.
- *
- * @param persp the perspective to be closed
- * @param save whether the page's editors should be save if last perspective
- */
-/* package */ void closePerspective(Perspective persp, boolean save) {
-
- // Always unzoom
- if (isZoomed())
- zoomOut();
-
- // Close all editors on last perspective close
- if (perspList.size() == 1 && getEditorManager().getEditorCount() > 0) {
- // Close all editors
- if (!closeAllEditors(save))
- return;
- }
-
- // Dispose of the perspective
- boolean isActive = (perspList.getActive() == persp);
- window.removePerspectiveShortcut(persp.getDesc(), this);
- if (isActive)
- setPerspective(perspList.getNextActive());
- disposePerspective(persp);
- if (perspList.size() == 0)
- close();
-}
-/**
- * Creates the client composite.
- */
-private void createClientComposite() {
- final Composite parent = window.getClientComposite();
- composite = new Composite(parent, SWT.NONE);
- composite.setVisible(false); // Make visible on activate.
- composite.setBounds(parent.getClientArea());
- resizeListener = new ControlAdapter() {
- public void controlResized(ControlEvent e) {
- composite.setBounds(parent.getClientArea());
- }
- };
- parent.addControlListener(resizeListener);
-}
-/**
- * Creates a new view set. Return null on failure.
- */
-private Perspective createPerspective(PerspectiveDescriptor desc) {
- try {
- Perspective persp = new Perspective(desc, this);
- perspList.add(persp);
- window.firePerspectiveOpened(this, desc);
- IViewReference refs[] = persp.getViewReferences();
- for (int i = 0; i < refs.length; i++) {
- IViewReference ref = refs[i];
- if(ref != null)
- addPart(ref);
- }
- return persp;
- } catch (WorkbenchException e) {
- return null;
- }
-}
-/**
- * Open the tracker to allow the user to move
- * the specified part using keyboard.
- */
-public void openTracker(ViewPane pane) {
- Perspective persp = getActivePerspective();
- if (persp != null)
- persp.openTracker(pane);
-}
-/**
- * Add a part to the activation list.
- */
-protected void addPart(IWorkbenchPartReference ref) {
- activationList.add(ref);
-}
-/**
- * Remove a part from the activation list.
- */
-protected void removePart(IWorkbenchPartReference ref) {
- activationList.remove(ref);
-}
-/**
- * Deactivate the last known active editor to force its
- * action items to be removed, not just disabled.
- */
-private void deactivateLastEditor() {
- if (lastActiveEditor == null)
- return;
- PartSite site = (PartSite) lastActiveEditor.getSite();
- SubActionBars actionBars = (SubActionBars) site.getActionBars();
- actionBars.deactivate(true);
-}
-/**
- * Deactivates a part. The pane is unhilighted.
- */
-private void deactivatePart(IWorkbenchPart part) {
- if (part != null) {
- PartSite site = (PartSite)part.getSite();
- site.getPane().showFocus(false);
- }
-}
-private void disposePart(final IWorkbenchPart part) {
- Platform.run(new SafeRunnable() {
- public void run() {
- part.dispose();
- }
- public void handleException(Throwable e) {
- //Exception has already being logged by Core. Do nothing.
- }
- });
-}
-/**
- * Cleanup.
- */
-public void dispose() {
-
- // Always unzoom
- if (isZoomed())
- zoomOut();
-
- // Close and dispose the editors.
- closeAllEditors(false);
-
- // Capture views.
- IViewReference refs[] = viewFactory.getViews();
-
- // Get rid of perspectives. This will close the views.
- Iterator enum = perspList.iterator();
- while (enum.hasNext()) {
- Perspective perspective = (Perspective) enum.next();
- window.removePerspectiveShortcut(perspective.getDesc(), this);
- window.firePerspectiveClosed(this, perspective.getDesc());
- perspective.dispose();
- }
- perspList = new PerspectiveList();
-
- // Dispose views.
- final int errors[] = {0};
- for (int i = 0; i < refs.length; i ++) {
- final IViewPart view = (IViewPart)refs[i].getPart(false);
- if(view != null) {
- firePartClosed(view);
- Platform.run(new SafeRunnable() {
- public void run() {
- view.dispose();
- }
- public void handleException(Throwable e) {
- errors[0]++;
- }
- });
- }
- }
- if (errors[0] > 0) {
- String message;
- if (errors[0] == 1)
- message = WorkbenchMessages.getString("WorkbenchPage.oneErrorClosingPage"); //$NON-NLS-1$
- else
- message = WorkbenchMessages.getString("WorkbenchPage.multipleErrorsRestoring"); //$NON-NLS-1$
- MessageDialog.openError(null, WorkbenchMessages.getString("Error"), message); //$NON-NLS-1$
- }
- activePart = null;
- activationList = new ActivationList();;
-
- // Get rid of editor presentation.
- editorPresentation.dispose();
-
- // Get rid of composite.
- window.getClientComposite().removeControlListener(resizeListener);
- composite.dispose();
-
- navigationHistory.dispose();
-}
-/**
- * Dispose a perspective.
- */
-private void disposePerspective(Perspective persp) {
- // Get views.
- IViewReference refs[] = persp.getViewReferences();
-
- // Get rid of perspective.
- perspList.remove(persp);
- window.firePerspectiveClosed(this, persp.getDesc());
- persp.dispose();
-
- // Loop through the views.
- for (int i = 0; i < refs.length; i ++) {
- IViewReference ref = refs[i];
-
- //If the part is no longer reference then dispose it.
- boolean exists = viewFactory.hasView(ref.getId());
- IViewPart view = (IViewPart)ref.getPart(false);
- if (!exists && view != null) {
- firePartClosed(view);
- activationList.remove(view);
- disposePart(view);
- }
- }
-}
-/**
- *
- * @return NavigationHistory
- */
-public INavigationHistory getNavigationHistory() {
- return navigationHistory;
-}
-
-/**
- * Edits the action sets.
- */
-public boolean editActionSets() {
- Perspective persp = getActivePerspective();
- if (persp == null)
- return false;
-
- // Create list dialog.
- ActionSetSelectionDialog dlg =
- new ActionSetSelectionDialog(
- window.getShell(),
- persp);
-
- // Open.
- boolean ret = (dlg.open() == Window.OK);
- if (ret) {
- window.updateActionSets();
- window.firePerspectiveChanged(this, getPerspective(), CHANGE_RESET);
- }
- return ret;
-}
-/**
- * Returns the first view manager with given ID.
- */
-public Perspective findPerspective(IPerspectiveDescriptor desc) {
- Iterator enum = perspList.iterator();
- while (enum.hasNext()) {
- Perspective mgr = (Perspective)enum.next();
- if (desc.getId().equals(mgr.getDesc().getId()))
- return mgr;
- }
- return null;
-}
-/**
- * See IWorkbenchPage@findView.
- */
-public IViewPart findView(String id) {
- Perspective persp = getActivePerspective();
- if (persp == null)
- return null;
- IViewReference ref = persp.findView(id);
- if(ref != null)
- return ref.getView(true);
- else
- return null;
-}
-/**
- * Fire part activation out.
- */
-private void firePartActivated(IWorkbenchPart part) {
- partListeners.firePartActivated(part);
- selectionService.partActivated(part);
-}
-/**
- * Fire part brought to top out.
- */
-private void firePartBroughtToTop(IWorkbenchPart part) {
- partListeners.firePartBroughtToTop(part);
- selectionService.partBroughtToTop(part);
-}
-/**
- * Fire part close out.
- */
-private void firePartClosed(IWorkbenchPart part) {
- partListeners.firePartClosed(part);
- selectionService.partClosed(part);
-}
-/**
- * Fire part deactivation out.
- */
-private void firePartDeactivated(IWorkbenchPart part) {
- partListeners.firePartDeactivated(part);
- selectionService.partDeactivated(part);
-}
-/**
- * Fire part open out.
- */
-public void firePartOpened(IWorkbenchPart part) {
- partListeners.firePartOpened(part);
- selectionService.partOpened(part);
-}
-/**
- * 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) {
- Object[] listeners = propertyChangeListeners.getListeners();
- PropertyChangeEvent event = new PropertyChangeEvent(this, changeId, oldValue, newValue);
-
- for (int i = 0; i < listeners.length; i++) {
- ((IPropertyChangeListener) listeners[i]).propertyChange(event);
- }
-}
-/*
- * Returns the action bars.
- */
-public IActionBars getActionBars() {
- if (actionBars == null)
- actionBars = new WWinActionBars(window);
- return actionBars;
-}
-/**
- * Returns an array of the visible action sets.
- */
-public IActionSetDescriptor[] getActionSets() {
- Perspective persp = getActivePerspective();
- if (persp != null)
- return persp.getActionSets();
- else
- return new IActionSetDescriptor[0];
-}
-/**
- * @see IWorkbenchPage
- */
-public IEditorPart getActiveEditor() {
- return getEditorManager().getVisibleEditor();
-}
-/*
- * Returns the active part within the <code>IWorkbenchPage</code>
- */
-public IWorkbenchPart getActivePart() {
- return activePart;
-}
-/**
- * Returns the active perspective for the page, <code>null</code>
- * if none.
- */
-/* package */ Perspective getActivePerspective() {
- return perspList.getActive();
-}
-/**
- * Returns the client composite.
- */
-public Composite getClientComposite() {
- return composite;
-}
-/**
- * Answer the editor manager for this window.
- */
-private EditorManager getEditorManager() {
- return editorMgr;
-}
-/**
- * Answer the editor presentation.
- */
-public EditorPresentation getEditorPresentation() {
- return editorPresentation;
-}
-/**
- * See IWorkbenchPage.
- */
-public IEditorPart [] getEditors() {
- final IEditorReference refs[] = getEditorReferences();
- final IEditorPart result[] = new IEditorPart[refs.length];
- Display d = getWorkbenchWindow().getShell().getDisplay();
- //Must be backward compatible.
- d.syncExec(new Runnable() {
- public void run() {
- for (int i = 0; i < refs.length; i++) {
- result[i] = (IEditorPart)refs[i].getPart(true);
- }
- }
- });
- return result;
-}
-
-public IEditorPart[] getDirtyEditors() {
- return getEditorManager().getDirtyEditors();
-}
-public IEditorPart findEditor(IEditorInput input) {
- return getEditorManager().findEditor(input);
-}
-/**
- * See IWorkbenchPage.
- */
-public IEditorReference[] getEditorReferences() {
- return getEditorManager().getEditors();
-}
-/**
- * Returns the docked views.
- */
-public IViewReference [] getFastViews() {
- Perspective persp = getActivePerspective();
- if (persp != null)
- return persp.getFastViews();
- else
- return new IViewReference[0];
-}
-/**
- * @see IWorkbenchPage
- */
-public IAdaptable getInput() {
- return input;
-}
-/**
- * Returns the page label. This is a combination of the page input
- * and active perspective.
- */
-public String getLabel() {
- String label = WorkbenchMessages.getString("WorkbenchPage.UnknownLabel"); //$NON-NLS-1$
- if (input != null) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter)input.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null)
- label = adapter.getLabel(input);
- }
- Perspective persp = getActivePerspective();
- if (persp != null)
- label = WorkbenchMessages.format("WorkbenchPage.PerspectiveFormat", new Object[] { label, persp.getDesc().getLabel() }); //$NON-NLS-1$
- else if (deferredActivePersp != null)
- label = WorkbenchMessages.format("WorkbenchPage.PerspectiveFormat", new Object[] { label, deferredActivePersp.getLabel() }); //$NON-NLS-1$
- return label;
-}
-/**
- * Mouse down listener to hide fast view when
- * user clicks on empty editor area or sashes.
- */
-protected Listener getMouseDownListener() {
- return mouseDownListener;
-}
-/**
- * Returns the new wizard actions the page.
- * This is List of Strings.
- */
-public ArrayList getNewWizardActionIds() {
- Perspective persp = getActivePerspective();
- if (persp != null)
- return persp.getNewWizardActionIds();
- else
- return new ArrayList();
-}
-/**
- * Returns the perspective.
- */
-public IPerspectiveDescriptor getPerspective() {
- if (deferredActivePersp != null)
- return deferredActivePersp;
- Perspective persp = getActivePerspective();
- if (persp != null)
- return persp.getDesc();
- else
- return null;
-}
-/**
- * Returns the perspective actions for this page.
- * This is List of Strings.
- */
-public ArrayList getPerspectiveActionIds() {
- Perspective persp = getActivePerspective();
- if (persp != null)
- return persp.getPerspectiveActionIds();
- else
- return new ArrayList();
-}
-/*
- * (non-Javadoc)
- * Method declared on ISelectionService
- */
-public ISelection getSelection() {
- return selectionService.getSelection();
-}
-
-/*
- * (non-Javadoc)
- * Method declared on ISelectionService
- */
-public ISelection getSelection(String partId) {
- return selectionService.getSelection(partId);
-}
-
-
-/**
- * Returns the show view actions the page.
- * This is List of Strings.
- */
-public ArrayList getShowViewActionIds() {
- Perspective persp = getActivePerspective();
- if (persp != null)
- return persp.getShowViewActionIds();
- else
- return new ArrayList();
-}
-/*
- * Returns the toolbar layout for the active perspective.
- */
-public CoolBarLayout getToolBarLayout() {
- Perspective persp = getActivePerspective();
- if (persp != null) return persp.getToolBarLayout();
- return null;
-}
-/**
- * Returns the unprotected window.
- */
-protected WorkbenchWindow getUnprotectedWindow() {
- return window;
-}
-/*
- * Returns the view factory.
- */
-public ViewFactory getViewFactory() {
- if (viewFactory == null) {
- viewFactory = new ViewFactory(this,
- WorkbenchPlugin.getDefault().getViewRegistry());
- }
- return viewFactory;
-}
-
-/**
- * See IWorkbenchPage.
- */
-public IViewReference[] getViewReferences() {
- Perspective persp = getActivePerspective();
- if (persp != null)
- return persp.getViewReferences();
- else
- return new IViewReference[0];
-}
-/**
- * See IWorkbenchPage.
- */
-public IViewPart [] getViews() {
- Perspective persp = getActivePerspective();
- if (persp != null) {
- IViewReference refs[] = persp.getViewReferences();
- IViewPart parts[] = new IViewPart[refs.length];
- for (int i = 0; i < refs.length; i++)
- parts[i] = refs[i].getView(true);
- return parts;
- }
- return new IViewPart[0];
-}
-/**
- * See IWorkbenchPage.
- */
-public IWorkbenchWindow getWorkbenchWindow() {
- return window;
-}
-/**
- * Implements IWorkbenchPage
- *
- * @see org.eclipse.ui.IWorkbenchPage#getWorkingSet()
- * @since 2.0
- * @deprecated individual views should store a working set if needed
- */
-public IWorkingSet getWorkingSet() {
- return workingSet;
-}
-
-/**
- * @see IWorkbenchPage
- */
-public void hideActionSet(String actionSetID) {
- Perspective persp = getActivePerspective();
- if (persp != null) {
- persp.hideActionSet(actionSetID);
- window.updateActionSets();
- window.firePerspectiveChanged(this, getPerspective(), CHANGE_ACTION_SET_HIDE);
- }
-}
-
-public void hideView(IViewReference ref) {
- if(ref.getPart(false) == null)
- return;
- hideView((IViewPart)ref.getPart(false));
-}
-/**
- * See IPerspective
- */
-public void hideView(IViewPart view) {
- // Sanity check.
- Perspective persp = getActivePerspective();
- if (persp == null || !certifyPart(view))
- return;
-
- // If part is added / removed always unzoom.
- IViewReference ref = (IViewReference)getReference(view);
- if (isZoomed() && !isFastView(ref))
- zoomOut();
-
- // Confirm.
- if (!persp.canCloseView(view))
- return;
-
- // Activate new part.
- if (view == activePart) {
- IWorkbenchPart prevActive = activationList.getPreviouslyActive();
- if (prevActive != null)
- activate(prevActive);
- else
- setActivePart(null);
- }
-
- // Hide the part.
- persp.hideView(ref);
-
-
- // If the part is no longer reference then dispose it.
- boolean exists = viewFactory.hasView(view.getSite().getId());
- if (!exists) {
- firePartClosed(view);
- disposePart(view);
- activationList.remove(view);
- }
-
- // Notify interested listeners
- window.firePerspectiveChanged(this, getPerspective(), CHANGE_VIEW_HIDE);
-
- // Just in case view was fast.
- window.getShortcutBar().update(true);
-
- //if it was the last part, close the perspective
- lastPartClosePerspective();
-
-}
-
-/*
- * Closes the perspective when there are no fast views
- * or active parts. Bug 7743.
- */
-private void lastPartClosePerspective() {
- Perspective persp = getActivePerspective();
- if (persp != null && getActivePart() == null)
- if(persp.getViewReferences().length == 0 && getEditorReferences().length == 0)
- closePerspective(persp, false);
-}
-
-/**
- * Initialize the page.
- *
- * @param w the parent window
- * @param layoutID may be <code>null</code> if restoring from file
- * @param input the page input
- */
-private void init(WorkbenchWindow w, String layoutID, IAdaptable input)
- throws WorkbenchException
-{
- // Save args.
- this.window = w;
- this.input = input;
-
- // Mouse down listener to hide fast view when
- // user clicks on empty editor area or sashes.
- mouseDownListener = new Listener() {
- public void handleEvent(Event event) {
- if (event.type == SWT.MouseDown)
- toggleFastView(null);
- }
- };
-
- // Create presentation.
- createClientComposite();
- editorPresentation = new EditorPresentation(this, mouseDownListener) ;
- editorMgr = new EditorManager(window, this, editorPresentation);
-
- // Get perspective descriptor.
- if(layoutID != null) {
- PerspectiveDescriptor desc = (PerspectiveDescriptor)WorkbenchPlugin
- .getDefault().getPerspectiveRegistry().findPerspectiveWithId(layoutID);
- if (desc == null)
- throw new WorkbenchException(WorkbenchMessages.getString("WorkbenchPage.ErrorRecreatingPerspective")); //$NON-NLS-1$
- Perspective persp = createPerspective(desc);
- perspList.setActive(persp);
- window.firePerspectiveActivated(this, desc);
-
- // Update MRU list.
- Workbench wb = (Workbench)window.getWorkbench();
- wb.getPerspectiveHistory().add(desc);
- }
-}
-/**
- * See IWorkbenchPage.
- */
-public boolean isEditorAreaVisible() {
- Perspective persp = getActivePerspective();
- if (persp == null)
- return false;
- return persp.isEditorAreaVisible();
-}
-/**
- * Returns whether the view is fast.
- */
-public boolean isFastView(IViewReference ref) {
- Perspective persp = getActivePerspective();
- if (persp != null)
- return persp.isFastView(ref);
- else
- return false;
-}
-/**
- * Return the active fast view or null if there are no
- * fast views or if there are all minimized.
- */
-public IViewReference getActiveFastView() {
- Perspective persp = getActivePerspective();
- if (persp != null)
- return persp.getActiveFastView();
- else
- return null;
-}
-/**
- * Return true if the perspective has a dirty editor.
- */
-protected boolean isSaveNeeded() {
- return getEditorManager().isSaveAllNeeded();
-}
-/**
- * Returns whether the page is zoomed.
- */
-public boolean isZoomed() {
- Perspective persp = getActivePerspective();
- if (persp == null)
- return false;
- return persp.getPresentation().isZoomed();
-}
-/**
- * Returns <code>true</code> if the window needs to unzoom for the given
- * IWorkbenchPart to be seen by the user. Returns false otherwise.
- *
- * @param part the part whose visibility is to be determined
- * @return <code>true</code> if the window needs to unzoom for the given
- * IWorkbenchPart to be seen by the user, <code>false</code> otherwise.
- */
-private boolean needToZoomOut(IWorkbenchPart part) {
- // part is an editor
- if (part instanceof IEditorPart) {
- if(getActivePart() instanceof IViewPart) {
- return true;
- }
- EditorSite site = (EditorSite)part.getSite();
- EditorPane pane = (EditorPane)site.getPane();
- EditorWorkbook book = pane.getWorkbook();
- return !book.equals(book.getEditorArea().getActiveWorkbook());
- }
- // part is a view
- if(part instanceof IViewPart) {
- if(isFastView((IViewReference)getReference(part)) || part.equals(getActivePart()))
- return false;
- else
- return true;
- }
-
- return true;
-}
-/**
- * This method is called when the page is activated.
- */
-protected void onActivate() {
- Iterator enum = perspList.iterator();
- while (enum.hasNext()) {
- Perspective perspective = (Perspective) enum.next();
- window.addPerspectiveShortcut(perspective.getDesc(), this);
- }
- composite.setVisible(true);
- Perspective persp = getActivePerspective();
- if (persp != null) {
- window.selectPerspectiveShortcut(persp.getDesc(), this, true);
- persp.onActivate();
- }
- if (activePart != null) {
- activationList.setActive(activePart);
-
- activatePart(activePart);
- actionSwitcher.updateActivePart(activePart);
- if (activePart instanceof IEditorPart) {
- lastActiveEditor = (IEditorPart) activePart;
- actionSwitcher.updateTopEditor((IEditorPart) activePart);
- } else {
- IEditorPart editor = editorMgr.getVisibleEditor();
- if (editor != null) {
- actionSwitcher.updateTopEditor(editor);
-
- // inform the site's action bars of the current editor
- // (important that this occur during page opening).
- PartSite site = (PartSite)editor.getSite();
- SubActionBars bars = (SubActionBars)site.getActionBars();
- bars.partChanged(editor);
- }
- }
- firePartActivated(activePart);
- } else {
- composite.setFocus();
- }
-}
-/**
- * This method is called when the page is deactivated.
- */
-protected void onDeactivate() {
- if (activePart != null) {
- deactivatePart(activePart);
- actionSwitcher.updateActivePart(null);
- firePartDeactivated(activePart);
- }
- actionSwitcher.updateTopEditor(null);
- lastActiveEditor = null;
- if (getActivePerspective() != null)
- getActivePerspective().onDeactivate();
- composite.setVisible(false);
- Iterator enum = perspList.iterator();
- while (enum.hasNext()) {
- Perspective perspective = (Perspective) enum.next();
- window.removePerspectiveShortcut(perspective.getDesc(), this);
- }
-}
-/**
- * See IWorkbenchPage.
- */
-public IEditorPart openEditor(IFile file)
- throws PartInitException
-{
- return openEditor(new FileEditorInput(file),null,true,false,null);
-}
-/**
- * See IWorkbenchPage.
- */
-public IEditorPart openEditor(IFile file, String editorID)
- throws PartInitException
-{
- return openEditor(new FileEditorInput(file),editorID,true,true,file);
-}
-/**
- * See IWorkbenchPage.
- */
-public IEditorPart openEditor(IFile file, String editorID,boolean activate)
- throws PartInitException
-{
- return openEditor(new FileEditorInput(file),editorID,activate,editorID != null,file);
-}
-/**
- * See IWorkbenchPage.
- */
-public IEditorPart openEditor(IMarker marker)
- throws PartInitException
-{
- return openEditor(marker, true);
-}
-/**
- * @see IWorkbenchPage
- */
-public IEditorPart openEditor(IMarker marker, boolean activate)
- throws PartInitException
-{
- // Get the resource.
- IFile file = (IFile)marker.getResource();
-
- // Get the preferred editor id.
- String editorID = null;
- try {
- editorID = (String)marker.getAttribute(EDITOR_ID_ATTR);
- }
- catch (CoreException e) {
- WorkbenchPlugin.log(WorkbenchMessages.getString("WorkbenchPage.ErrorExtractingEditorIDFromMarker"), e.getStatus()); //$NON-NLS-1$
- return null;
- }
-
- // Create a new editor.
- IEditorPart editor = null;
- if (editorID == null)
- editor = openEditor(new FileEditorInput(file),null,activate,false,null);
- else
- editor = openEditor(new FileEditorInput(file),editorID,activate,true,file);
-
- // Goto the bookmark.
- if (editor != null)
- editor.gotoMarker(marker);
- return editor;
-}
-/**
- * See IWorkbenchPage.
- */
-public IEditorPart openEditor(IEditorInput input, String editorID)
- throws PartInitException
-{
- return openEditor(input, editorID, true);
-}
-/**
- * See IWorkbenchPage.
- */
-public IEditorPart openEditor(IEditorInput input, String editorID, boolean activate)
- throws PartInitException
-{
- return openEditor(input,editorID,activate,true,null);
-}
-/**
- * See IWorkbenchPage.
- */
-private IEditorPart openEditor(IEditorInput input, String editorID, boolean activate,boolean useEditorID,IFile file)
- throws PartInitException
-{
- // If an editor already exists for the input use it.
- IEditorPart editor = getEditorManager().findEditor(input);
- if (editor != null) {
- if(IWorkbenchConstants.SYSTEM_EDITOR_ID.equals(editorID)) {
- if(editor.isDirty()) {
- MessageDialog dialog = new MessageDialog(
- getWorkbenchWindow().getShell(),
- WorkbenchMessages.getString("Save"),
- null, // accept the default window icon
- WorkbenchMessages.format("WorkbenchPage.editorAlreadyOpenedMsg",new String[]{input.getName()}),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
- int saveFile = dialog.open();
- if(saveFile == 0) {
- try {
- final IEditorPart editorToSave = editor;
- getWorkbenchWindow().run(false,false,new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- editorToSave.doSave(monitor);
- }
- });
- } catch (InvocationTargetException e) {
- throw (RuntimeException)e.getTargetException();
- } catch (InterruptedException e) {
- return null;
- }
- } else if(saveFile == 2) {
- return null;
- }
- }
- } else {
- showEditor(activate, editor);
- return editor;
- }
- }
-
-// Disabled turning redraw off, because it causes setFocus
-// in activate(editor) to fail.
-// getClientComposite().setRedraw(false);
-
- // Remember the old visible editor
- IEditorPart oldVisibleEditor = getEditorManager().getVisibleEditor();
-
- // Otherwise, create a new one. This may cause the new editor to
- // become the visible (i.e top) editor.
- IEditorReference ref = null;
-
- if(useEditorID)
- ref = getEditorManager().openEditor(editorID, input,true);
- else
- ref = getEditorManager().openEditor(null,input,true);
-
- if(ref != null) {
- editor = ref.getEditor(true);
- addPart(ref);
- }
-
- if (editor != null) {
- //firePartOpened(editor);
- zoomOutIfNecessary(editor);
- setEditorAreaVisible(true);
- if (activate) {
- if(editor instanceof MultiEditor)
- activate(((MultiEditor)editor).getActiveEditor());
- else
- activate(editor);
- } else {
- activationList.setActive(editor);
- if (activePart != null)
- // ensure the activation list is in a valid state
- activationList.setActive(activePart);
- // The previous openEditor call may create a new editor
- // and make it visible, so send the notification.
- IEditorPart visibleEditor = getEditorManager().getVisibleEditor();
- if ((visibleEditor == editor) && (oldVisibleEditor != editor)) {
- actionSwitcher.updateTopEditor(editor);
- firePartBroughtToTop(editor);
- } else
- bringToTop(editor);
- }
- window.firePerspectiveChanged(this, getPerspective(), CHANGE_EDITOR_OPEN);
- }
-
-// getClientComposite().setRedraw(true);
-
- return editor;
-}
-private void showEditor(boolean activate, IEditorPart editor) {
- zoomOutIfNecessary(editor);
- setEditorAreaVisible(true);
- if (activate)
- activate(editor);
- else
- bringToTop(editor);
-}
-/**
- * See IWorkbenchPage.
- */
-public boolean isEditorPinned(IEditorPart editor) {
- return !((EditorSite)editor.getEditorSite()).getReuseEditor();
-}
-/**
- * See IWorkbenchPage.
- */
-public void openSystemEditor(IFile input)
- throws PartInitException
-{
- getEditorManager().openSystemEditor(input);
-}
-/**
- * Returns whether changes to a part will affect zoom.
- * There are a few conditions for this ..
- * - we are zoomed.
- * - the part is contained in the main window.
- * - the part is not the zoom part
- * - the part is not a fast view
- * - the part and the zoom part are not in the same editor workbook
- */
-private boolean partChangeAffectsZoom(IWorkbenchPartReference ref) {
- PartPane pane = ((WorkbenchPartReference)ref).getPane();
- if (pane instanceof MultiEditorInnerPane)
- pane = ((MultiEditorInnerPane)pane).getParentPane();
- return getActivePerspective().getPresentation().partChangeAffectsZoom(pane);
-}
-/**
- * Removes a fast view.
- */
-public void removeFastView(IViewReference ref) {
- Perspective persp = getActivePerspective();
- if (persp == null)
- return;
-
- // If parts change always update zoom.
- if (isZoomed())
- zoomOut();
-
- // Do real work.
- persp.removeFastView(ref);
-
- // Notify listeners.
- window.getShortcutBar().update(true);
- window.firePerspectiveChanged(this, getPerspective(), CHANGE_FAST_VIEW_REMOVE);
-}
-/**
- * Removes an IPartListener from the part service.
- */
-public void removePartListener(IPartListener l) {
- partListeners.removePartListener(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.
- */
-public void removePropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.remove(listener);
-}
-
-/*
- * (non-Javadoc)
- * Method declared on ISelectionListener.
- */
-public void removeSelectionListener(ISelectionListener listener) {
- selectionService.removeSelectionListener(listener);
-}
-
-/*
- * (non-Javadoc)
- * Method declared on ISelectionListener.
- */
-public void removeSelectionListener(String partId, ISelectionListener listener) {
- selectionService.removeSelectionListener(partId, listener);
-}
-/*
- * (non-Javadoc)
- * Method declared on ISelectionListener.
- */
-public void removePostSelectionListener(ISelectionListener listener) {
- selectionService.removePostSelectionListener(listener);
-}
-
-/*
- * (non-Javadoc)
- * Method declared on ISelectionListener.
- */
-public void removePostSelectionListener(String partId, ISelectionListener listener) {
- selectionService.removePostSelectionListener(partId, listener);
-}
-/**
- * This method is called when a part is activated by clicking within it.
- * In response, the part, the pane, and all of its actions will be activated.
- *
- * In the current design this method is invoked by the part pane
- * when the pane, the part, or any children gain focus.
- */
-public void requestActivation(IWorkbenchPart part) {
- // Sanity check.
- if (!certifyPart(part))
- return;
-
- // Real work.
- setActivePart(part);
-}
-/**
- * Resets the layout for the perspective. The active part in the old layout is activated
- * in the new layout for consistent user context.
- */
-public void resetPerspective() {
- // Run op in busy cursor.
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- busyResetPerspective();
- }
- });
-}
-/**
- * Restore this page from the memento and ensure that
- * the active perspective is equals the active descriptor otherwise
- * create a new perspective for that descriptor.
- * If activeDescriptor is null active the old perspective.
- */
-public IStatus restoreState(IMemento memento,IPerspectiveDescriptor activeDescritor) {
- // Restore working set
- String pageName = memento.getString(IWorkbenchConstants.TAG_LABEL);
- if(pageName == null) pageName = "";
- MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.format("WorkbenchPage.unableToRestorePerspective",new String[]{pageName}),
- null);
-
- String workingSetName = memento.getString(IWorkbenchConstants.TAG_WORKING_SET);
- if (workingSetName != null) {
- WorkingSetManager workingSetManager = (WorkingSetManager) getWorkbenchWindow().getWorkbench().getWorkingSetManager();
- setWorkingSet(workingSetManager.getWorkingSet(workingSetName));
- }
-
- // Restore editor manager.
- IMemento childMem = memento.getChild(IWorkbenchConstants.TAG_EDITORS);
- result.merge(getEditorManager().restoreState(childMem));
-
- childMem = memento.getChild(IWorkbenchConstants.TAG_VIEWS);
- if(childMem != null)
- result.merge(getViewFactory().restoreState(childMem));
-
- // Get persp block.
- childMem = memento.getChild(IWorkbenchConstants.TAG_PERSPECTIVES);
- String activePartID = childMem.getString(IWorkbenchConstants.TAG_ACTIVE_PART);
- String activePerspectiveID = childMem.getString(IWorkbenchConstants.TAG_ACTIVE_PERSPECTIVE);
-
- // Restore perspectives.
- IMemento perspMems[] = childMem.getChildren(IWorkbenchConstants.TAG_PERSPECTIVE);
- Perspective activePerspective = null;
- for (int i = 0; i < perspMems.length; i++) {
- try {
- Perspective persp = new Perspective(null, this);
- result.merge(persp.restoreState(perspMems[i]));
- IPerspectiveDescriptor desc = persp.getDesc();
- if (desc.equals(activeDescritor))
- activePerspective = persp;
- else if((activePerspective == null) && desc.getId().equals(activePerspectiveID))
- activePerspective = persp;
- perspList.add(persp);
- } catch (WorkbenchException e) {
- }
- }
- boolean restoreActivePerspective = false;
- if(activeDescritor == null)
- restoreActivePerspective = true;
- else if (activePerspective != null && activePerspective.getDesc().equals(activeDescritor)) {
- restoreActivePerspective = true;
- } else {
- restoreActivePerspective = false;
- activePerspective = createPerspective((PerspectiveDescriptor)activeDescritor);
- if(activePerspective == null) {
- result.merge(new Status(IStatus.ERROR,PlatformUI.PLUGIN_ID,0,
- WorkbenchMessages.format("Workbench.showPerspectiveError",new String[]{activeDescritor.getId()}),
- null));
- }
- }
-
- perspList.setActive(activePerspective);
-
- // Make sure we have a valid perspective to work with,
- // otherwise return.
- activePerspective = perspList.getActive();
- if (activePerspective == null) {
- activePerspective = perspList.getNextActive();
- perspList.setActive(activePerspective);
- result.merge(activePerspective.restoreState());
- }
- if (activePerspective != null && restoreActivePerspective)
- result.merge(activePerspective.restoreState());
-
- if (activePerspective != null) {
- window.firePerspectiveActivated(this, activePerspective.getDesc());
-
- // Restore active part.
- if (activePartID != null) {
- IViewReference ref = activePerspective.findView(activePartID);
- IViewPart view = null;
- if(ref != null)
- view = ref.getView(true);
- if (view != null)
- activePart = view;
- }
- }
-
- childMem = memento.getChild(IWorkbenchConstants.TAG_NAVIGATION_HISTORY);
- if(childMem != null)
- navigationHistory.restoreState(childMem);
- else if(getActiveEditor() != null)
- navigationHistory.markEditor(getActiveEditor());
- return result;
-}
-/**
- * See IWorkbenchPage
- */
-public boolean saveAllEditors(boolean confirm) {
- return getEditorManager().saveAll(confirm, false);
-}
-/**
- * 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
- */
-public boolean saveEditor(org.eclipse.ui.IEditorPart editor, boolean confirm) {
- // Sanity check.
- if (!certifyPart(editor))
- return false;
-
- // Real work.
- return getEditorManager().saveEditor(editor, confirm);
-}
-/**
- * Saves the current perspective.
- */
-public void savePerspective() {
- Perspective persp = getActivePerspective();
- if (persp == null)
- return;
-
- // Always unzoom.
- if (isZoomed())
- zoomOut();
-
- persp.saveDesc();
-}
-/**
- * Saves the perspective.
- */
-public void savePerspectiveAs(IPerspectiveDescriptor newDesc) {
- Perspective persp = getActivePerspective();
- if (persp == null)
- return;
- IPerspectiveDescriptor oldDesc = persp.getDesc();
-
- // Always unzoom.
- if (isZoomed())
- zoomOut();
-
- saveToolBarLayout();
- persp.saveDescAs(newDesc);
- window.updatePerspectiveShortcut(oldDesc, newDesc, this);
-
- // Update MRU list.
- Workbench wb = (Workbench)window.getWorkbench();
- wb.getPerspectiveHistory().add(newDesc);
-}
-/**
- * Save the toolbar layout for the given perspective.
- */
-protected void saveToolBarLayout() {
- Perspective persp = getActivePerspective();
- if (persp == null) return;
- IToolBarManager toolsMgr = window.getToolsManager();
- if (toolsMgr instanceof CoolBarManager) {
- CoolBarManager coolBarMgr = (CoolBarManager)toolsMgr;
- coolBarMgr.saveLayoutFor(persp);
- }
-}
-/**
- * Save the state of the page.
- */
-public IStatus saveState(IMemento memento) {
- // We must unzoom to get correct layout.
- if (isZoomed())
- zoomOut();
-
- MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.format("WorkbenchPage.unableToSavePerspective",new String[]{getLabel()}),
- null);
-
- // Save editor manager.
- IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_EDITORS);
- result.merge(editorMgr.saveState(childMem));
-
- childMem = memento.createChild(IWorkbenchConstants.TAG_VIEWS);
- result.merge(getViewFactory().saveState(childMem));
-
- // Create persp block.
- childMem = memento.createChild(IWorkbenchConstants.TAG_PERSPECTIVES);
- if (getPerspective() != null)
- childMem.putString(IWorkbenchConstants.TAG_ACTIVE_PERSPECTIVE, getPerspective().getId());
- if (getActivePart() != null)
- childMem.putString(IWorkbenchConstants.TAG_ACTIVE_PART,getActivePart().getSite().getId());
-
- // Save the toolbar layout for the current perspective.
- saveToolBarLayout();
-
- // Save each perspective in opened order
- Iterator enum = perspList.iterator();
- while (enum.hasNext()) {
- Perspective persp = (Perspective)enum.next();
- IMemento gChildMem = childMem.createChild(IWorkbenchConstants.TAG_PERSPECTIVE);
- result.merge(persp.saveState(gChildMem));
- }
- // Save working set if set
- if (workingSet != null) {
- memento.putString(IWorkbenchConstants.TAG_WORKING_SET, workingSet.getName());
- }
-
- navigationHistory.saveState(memento.createChild(IWorkbenchConstants.TAG_NAVIGATION_HISTORY));
- return result;
-}
-/**
- * Sets the active part.
- */
-private void setActivePart(IWorkbenchPart newPart) {
- // Optimize it.
- if (activePart == newPart)
- return;
-
- //No need to change the history if the active editor is becoming the active part
- boolean markLocation = newPart != lastActiveEditor;
-
- // Notify perspective. It may deactivate fast view.
- Perspective persp = getActivePerspective();
- if (persp != null)
- persp.partActivated(newPart);
-
- // Deactivate old part
- IWorkbenchPart oldPart = activePart;
- if (oldPart != null) {
- deactivatePart(oldPart);
- }
-
-
- // Set active part.
- activePart = newPart;
- if (newPart != null) {
- activationList.setActive(newPart);
- if (newPart instanceof IEditorPart) {
- lastActiveEditor = (IEditorPart)newPart;
- IEditorReference ref = (IEditorReference)getReference(lastActiveEditor);
- editorMgr.setVisibleEditor(ref,true);
- }
- }
- activatePart(activePart);
-
- if(markLocation && activePart != null && activePart instanceof IEditorPart)
- navigationHistory.markEditor(getActiveEditor());
-
- // Fire notifications
- if (oldPart != null)
- firePartDeactivated(oldPart);
-
- // Update actions now so old actions have heard part deactivated and
- // new actions can hear part activated.
- actionSwitcher.updateActivePart(newPart);
-
- if (newPart != null)
- firePartActivated(newPart);
-}
-/**
- * See IWorkbenchPage.
- */
-public void setEditorAreaVisible(boolean showEditorArea) {
- Perspective persp = getActivePerspective();
- if (persp == null)
- return;
- if(showEditorArea == persp.isEditorAreaVisible())
- return;
- // If parts change always update zoom.
- if (isZoomed())
- zoomOut();
- // Update editor area visibility.
- if (showEditorArea) {
- persp.showEditorArea();
- window.firePerspectiveChanged(this, getPerspective(), CHANGE_EDITOR_AREA_SHOW);
- } else {
- persp.hideEditorArea();
- if (activePart instanceof IEditorPart) {
- IEditorPart e = (IEditorPart)activePart;
- setActivePart(null);
- // preserve editor contributions
- actionSwitcher.updateTopEditor(e);
- }
- window.firePerspectiveChanged(this, getPerspective(), CHANGE_EDITOR_AREA_HIDE);
- }
-}
-/**
- * Sets the layout of the page. Assumes the new perspective
- * is not null. Keeps the active part if possible. Updates
- * the window menubar and toolbar if necessary.
- */
-private void setPerspective(Perspective newPersp) {
- // Don't do anything if already active layout
- Perspective oldPersp = getActivePerspective();
- if (oldPersp == newPersp)
- return;
-
- // Save the toolbar layout for the perspective before the
- // active part is closed, so that any editor-related tool
- // items are saved as part of the layout.
- saveToolBarLayout();
-
- if(newPersp != null) {
- IStatus status = newPersp.restoreState();
- if(status.getSeverity() != IStatus.OK) {
- String title = WorkbenchMessages.getString("WorkbenchPage.problemRestoringTitle"); //$NON-NLS-1$
- String msg = WorkbenchMessages.getString("WorkbenchPage.errorReadingState"); //$NON-NLS-1$
- ErrorDialog.openError(getWorkbenchWindow().getShell(),title,msg,status);
- }
- }
-
- // Deactivate active part.
-
- // ensure the switcher is not showing any action sets
- // so it will reshow them in the new perspective
- actionSwitcher.updateTopEditor(null);
-
- IWorkbenchPart oldActivePart = activePart;
- setActivePart(null);
-
- // Deactivate the old layout
- if (oldPersp != null) {
- oldPersp.onDeactivate();
- window.selectPerspectiveShortcut(oldPersp.getDesc(), this, false);
- }
-
- // Activate the new layout
- perspList.setActive(newPersp);
- if (newPersp != null) {
- newPersp.onActivate();
-
- // Notify listeners of activation
- window.firePerspectiveActivated(this, newPersp.getDesc());
-
- // Update MRU list.
- Workbench wb = (Workbench)window.getWorkbench();
- wb.getPerspectiveHistory().add(newPersp.getDesc());
-
- // Update the shortcut
- window.selectPerspectiveShortcut(newPersp.getDesc(), this, true);
- } else {
- // No need to remember old active part since there
- // is no new active perspective to activate it in.
- oldActivePart = null;
- }
-
- // Update the window
- window.updateActionSets();
- window.updateTitle();
- window.getShortcutBar().update(true);
-
- // Reactivate active part.
- if (oldActivePart != null) {
- if (oldActivePart instanceof IEditorPart && isEditorAreaVisible()) {
- activate(oldActivePart);
- } else if (oldActivePart instanceof IViewPart) {
- IEditorPart ed = editorMgr.getVisibleEditor();
- if (ed != null)
- actionSwitcher.updateTopEditor(ed);
- String id = oldActivePart.getSite().getId();
- oldPersp.setOldPartID(id);
-
- if (findView(id) != null) {
- activate(oldActivePart);
- } else { //part not found in new perspective
- String oldID = newPersp.getOldPartID();
- if (oldID != null) {
- IWorkbenchPart prevOldPart = findView(oldID);
- if (prevOldPart != null) {
- activate(prevOldPart);
- } else { //previously active part not found
- IWorkbenchPartReference[] refs = getSortedParts();
- if (refs.length != 0)
- activate(refs[0].getPart(false));
- }
- } else { //no previously active part defined
- IWorkbenchPartReference[] refs = getSortedParts();
- if (refs.length != 0)
- activate(refs[0].getPart(false));
- }
- }
- }
- } else { //no active part
- IEditorPart ed = editorMgr.getVisibleEditor();
- if (ed != null) {
- actionSwitcher.updateTopEditor(ed);
- } else {
- IWorkbenchPartReference[] refs = getSortedParts();
- if (refs.length != 0)
- activate(refs[0].getPart(false));
- }
-
- }
-
- // Update the Coolbar layout. Do this after the part is activated,
- // since the layout may contain items associated to the part.
- setToolBarLayout();
-}
-/**
- * Sets the perspective.
- *
- * @param persp identifies the new perspective.
- */
-public void setPerspective(final IPerspectiveDescriptor desc) {
- // Going from multiple to single rows can make the coolbar
- // and its adjacent views appear jumpy as perspectives are
- // switched. Turn off redraw to help with this.
- boolean useRedraw = false;
- IToolBarManager mgr = window.getToolsManager();
- if (mgr instanceof CoolBarManager) {
- useRedraw = true;
- ((CoolBarManager)mgr).getControl().setRedraw(false);
- }
- // Run op in busy cursor.
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- busySetPerspective(desc);
- }
- });
- if (useRedraw) {
- ((CoolBarManager)mgr).getControl().setRedraw(true);
- }
-}
-/**
- * Restore the toolbar layout for the active perspective.
- */
-protected void setToolBarLayout() {
- Perspective persp = getActivePerspective();
- if (persp == null) return;
- IToolBarManager mgr = window.getToolsManager();
- if (mgr instanceof CoolBarManager) {
- CoolBarManager coolBarMgr = (CoolBarManager)mgr;
- coolBarMgr.setLayoutFor(persp);
- }
-}
-/**
- * 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
- */
-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(propertyChangeListener);
- }
- else {
- WorkbenchPlugin.getDefault().getWorkingSetManager().removePropertyChangeListener(propertyChangeListener);
- }
-}
-/**
- * @see IWorkbenchPage
- */
-public void showActionSet(String actionSetID) {
- Perspective persp = getActivePerspective();
- if (persp != null) {
- persp.showActionSet(actionSetID);
- window.updateActionSets();
- window.firePerspectiveChanged(this, getPerspective(), CHANGE_ACTION_SET_SHOW);
- }
-}
-/**
- * See IWorkbenchPage.
- */
-public IViewPart showView(final String viewID)
- throws PartInitException
-{
- return showView(viewID, true);
-}
-/**
- * See IWorkbenchPage.
- */
-private IViewPart showView(final String viewID, final boolean activate)
- throws PartInitException
-{
- // Run op in busy cursor.
- final Object [] result = new Object[1];
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- try {
- result[0] = busyShowView(viewID, activate);
- } catch (PartInitException e) {
- result[0] = e;
- }
- }
- });
- if (result[0] instanceof IViewPart)
- return (IViewPart)result[0];
- else if (result[0] instanceof PartInitException)
- throw (PartInitException)result[0];
- else
- throw new PartInitException(WorkbenchMessages.getString("WorkbenchPage.AbnormalWorkbenchCondition")); //$NON-NLS-1$
-}
-/**
- * Toggles the visibility of a fast view. If the view is active it
- * is deactivated. Otherwise, it is activated.
- */
-public void toggleFastView(IViewReference ref) {
- Perspective persp = getActivePerspective();
- if (persp != null) {
- persp.toggleFastView(ref);
- // if the fast view has been deactivated
- if (ref != persp.getActiveFastView()) {
- setActivePart(activationList.getPreviouslyActive());
- }
- }
-}
-/**
- * Zoom in on a part.
- * If the part is already in zoom then zoom out.
- */
-public void toggleZoom(IWorkbenchPart part) {
- Perspective persp = getActivePerspective();
- if (persp == null)
- return;
-
- /*
- * Detached window no longer supported - remove when confirmed
- *
- * PartPane pane = ((PartSite)(part.getSite())).getPane();
- * // If target part is detached ignore.
- * if (pane.getWindow() instanceof DetachedWindow)
- * return;
- */
-
- // Update zoom status.
- if (isZoomed()) {
- zoomOut();
- return;
- } else {
- persp.getPresentation().zoomIn(getReference(part));
- activate(part);
- }
-}
-/**
- * updateActionBars method comment.
- */
-public void updateActionBars() {
- window.updateActionBars();
-}
-
-/**
- * Sets the tab list of this page's composite appropriately
- * when a part is activated.
- */
-private void updateTabList(IWorkbenchPart part) {
- PartSite site = (PartSite)part.getSite();
- PartPane pane = site.getPane();
- if (pane instanceof ViewPane) {
- ViewPane viewPane = (ViewPane) pane;
- Control[] tabList = viewPane.getTabList();
- /*
- * Detached window no longer supported - remove when confirmed
- *
- * if (pane.getWindow() instanceof DetachedWindow) {
- * viewPane.getControl().getShell().setTabList(tabList);
- * }
- * else {
- */
- getClientComposite().setTabList(tabList);
- /*}*/
- }
- else if (pane instanceof EditorPane) {
- EditorArea ea = ((EditorPane) pane).getWorkbook().getEditorArea();
- ea.updateTabList();
- getClientComposite().setTabList(new Control[] { ea.getParent() });
- }
-}
-
-/**
- * The title of the given part has changed.
- * For views, updates the fast view button if necessary.
- */
-public void updateTitle(IViewReference ref) {
- if (isFastView(ref)) {
- // Would be more efficient to just update label of single tool item
- // but we don't have access to it from here.
- window.getShortcutBar().update(true);
- }
-}
-/**
- * Zooms out a zoomed in part.
- */
-/*package*/ void zoomOut() {
- Perspective persp = getActivePerspective();
- if (persp != null)
- persp.getPresentation().zoomOut();
-}
-/**
- * Zooms out a zoomed in part if it is necessary to do so for the user
- * to view the IWorkbenchPart that is the argument. Otherwise, does nothing.
- *
- * @param part the part to be made viewable
- */
-private void zoomOutIfNecessary(IWorkbenchPart part) {
- if (isZoomed() && needToZoomOut(part))
- zoomOut();
-}
-/**
- * @see IPageLayout.
- */
-public int getEditorReuseThreshold() {
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- return store.getInt(IPreferenceConstants.REUSE_EDITORS);
-}
-/**
- * @see IPageLayout.
- */
-public void setEditorReuseThreshold(int openEditors) {
-}
-/*
- * Returns the editors in activation order (oldest first).
- */
-public IEditorReference[] getSortedEditors() {
- return activationList.getEditors();
-}
-/**
- * Returns an iterator over the opened perspectives
- */
-protected IPerspectiveDescriptor[] getOpenedPerspectives() {
- Perspective opened[] = perspList.getSortedPerspectives();
- IPerspectiveDescriptor[] result = new IPerspectiveDescriptor[opened.length];
- for (int i = 0; i < result.length; i++) {
- result[i] = opened[i].getDesc();
- }
- return result;
-}
-/*
- * Returns the perspectives in activation order (oldest first).
- */
-protected IPerspectiveDescriptor[] getSortedPerspectives() {
- Perspective sortedArray[] = perspList.getSortedPerspectives();
- IPerspectiveDescriptor[] result = new IPerspectiveDescriptor[sortedArray.length];
- for (int i = 0; i < result.length; i++) {
- result[i] = sortedArray[i].getDesc();
- }
- return result;
-}
-/*
- * Returns the parts in activation order (oldest first).
- */
-public IWorkbenchPartReference[] getSortedParts() {
- return activationList.getParts();
-}
-
-public IWorkbenchPartReference getReference(IWorkbenchPart part) {
- PartPane pane = ((PartSite)part.getSite()).getPane();
- if(pane instanceof MultiEditorInnerPane) {
- MultiEditorInnerPane innerPane = (MultiEditorInnerPane)pane;
- return innerPane.getParentPane().getPartReference();
- }
- return pane.getPartReference();
-}
-
-private class ActivationList {
- //List of parts in the activation order (oldest first)
- List parts = new ArrayList();
-
- /*
- * Add/Move the active part to end of the list;
- */
- void setActive(IWorkbenchPart part) {
- if(parts.size() <= 0)
- return;
- PartPane pane = ((PartSite)part.getSite()).getPane();
- if(pane instanceof MultiEditorInnerPane) {
- MultiEditorInnerPane innerPane = (MultiEditorInnerPane)pane;
- setActive(innerPane.getParentPane().getPartReference().getPart(true));
- } else {
- IWorkbenchPartReference ref = getReference(part);
- if(ref == parts.get(parts.size() - 1))
- return;
- parts.remove(ref);
- parts.add(ref);
- }
- }
- /*
- * Add/Move the active part to end of the list;
- */
- void setActive(IWorkbenchPartReference ref) {
- setActive(ref.getPart(true));
- }
- /*
- * Add the active part to the beginning of the list.
- */
- void add(IWorkbenchPartReference ref) {
- if(parts.indexOf(ref) >= 0)
- return;
-
- IWorkbenchPart part = ref.getPart(false);
- if(part != null) {
- PartPane pane = ((PartSite)part.getSite()).getPane();
- if(pane instanceof MultiEditorInnerPane) {
- MultiEditorInnerPane innerPane = (MultiEditorInnerPane)pane;
- add(innerPane.getParentPane().getPartReference());
- return;
- }
- }
- parts.add(0,ref);
- }
- /*
- * Return the active part. Filter fast views.
- */
- IWorkbenchPart getActive() {
- if(parts.isEmpty())
- return null;
- return getActive(parts.size() - 1);
- }
- /*
- * Return the previously active part. Filter fast views.
- */
- IWorkbenchPart getPreviouslyActive() {
- if(parts.size() < 2)
- return null;
- return getActive(parts.size() - 2);
- }
- /*
- * Find a part in the list starting from the end and
- * filter fast views and views from other perspectives.
- */
- private IWorkbenchPart getActive(int start) {
- IWorkbenchPartReference[] views = getViewReferences();
- for (int i = start; i >= 0; i--) {
- IWorkbenchPartReference ref = (IWorkbenchPartReference)parts.get(i);
- if(ref instanceof IViewReference) {
- if(!((IViewReference)ref).isFastView()) {
- for (int j = 0; j < views.length; j++) {
- if(views[j] == ref) {
- return ref.getPart(true);
- }
- }
- }
- } else {
- return ref.getPart(true);
- }
- }
- return null;
- }
- /*
- * Retuns the index of the part within the activation
- * list. The higher the index, the more recent it
- * was used.
- */
- int indexOf(IWorkbenchPart part) {
- return parts.indexOf(getReference(part));
- }
- /*
- * Remove a part from the list
- */
- boolean remove(IWorkbenchPart part) {
- return parts.remove(getReference(part));
- }
- /*
- * Remove a part from the list
- */
- boolean remove(IWorkbenchPartReference ref) {
- return parts.remove(ref);
- }
-
- /*
- * Remove the editors from the activation list.
- */
- private void removeEditors() {
- for (Iterator i = parts.iterator(); i.hasNext();) {
- IWorkbenchPartReference part = (IWorkbenchPartReference)i.next();
- if (part instanceof IEditorReference)
- i.remove();
- }
- }
- /*
- * Returns the editors in activation order (oldest first).
- */
- private IEditorReference[] getEditors() {
- ArrayList editors = new ArrayList(parts.size());
- for (Iterator i = parts.iterator(); i.hasNext();) {
- IWorkbenchPartReference part = (IWorkbenchPartReference) i.next();
- if (part instanceof IEditorReference) {
- editors.add(part);
- }
- }
- return (IEditorReference[])editors.toArray(new IEditorReference[editors.size()]);
- }
- /*
- * Return a list with all parts (editors and views).
- */
- private IWorkbenchPartReference[] getParts() {
- IWorkbenchPartReference[] views = getViewReferences();
- ArrayList resultList = new ArrayList(parts.size());
- for (Iterator iterator = parts.iterator(); iterator.hasNext();) {
- IWorkbenchPartReference ref = (IWorkbenchPartReference)iterator.next();
- if(ref instanceof IViewReference) {
- //Filter views from other perspectives
- for (int i = 0; i < views.length; i++) {
- if(views[i] == ref) {
- resultList.add(ref);
- break;
- }
- }
- } else {
- resultList.add(ref);
- }
- }
- IWorkbenchPartReference[] result = new IWorkbenchPartReference[resultList.size()];
- return (IWorkbenchPartReference[])resultList.toArray(result);
- }
- /*
- * Returns the topmost editor on the stack, or null if none.
- */
- IEditorPart getTopEditor() {
- IEditorReference editors[] = getEditors();
- if (editors.length > 0) {
- return editors[editors.length - 1].getEditor(true);
- }
- return null;
- }
-}
-
- /**
- * Helper class to keep track of all opened perspective.
- * Both the opened and used order is kept.
- */
- private class PerspectiveList {
- /**
- * List of perspectives in the order they were opened;
- */
- private List openedList;
-
- /**
- * List of perspectives in the order they were used.
- * Last element is the most recently used, and first element
- * is the least recently used.
- */
- private List usedList;
-
- /**
- * The perspective explicitly set as being the active one
- */
- private Perspective active;
-
- /**
- * Creates an empty instance of the perspective list
- */
- public PerspectiveList() {
- openedList = new ArrayList(15);
- usedList = new ArrayList(15);
- }
- /**
- * Return all perspectives in the order they were activated.
- */
- public Perspective[] getSortedPerspectives() {
- Perspective[] result = new Perspective[usedList.size()];
- return (Perspective[])usedList.toArray(result);
- }
- /**
- * Adds a perspective to the list. No check is done
- * for a duplicate when adding.
- */
- public boolean add(Perspective perspective) {
- openedList.add(perspective);
- usedList.add(0, perspective); //It will be moved to top only when activated.
- return true;
- }
-
- /**
- * Returns an iterator on the perspective list
- * in the order they were opened.
- */
- public Iterator iterator() {
- return openedList.iterator();
- }
- /**
- * Returns an array with all opened perspectives
- */
- public Perspective[] getOpenedPerspectives() {
- Perspective[] result = new Perspective[openedList.size()];
- return (Perspective[])openedList.toArray(result);
- }
- /**
- * Removes a perspective from the list.
- */
- public boolean remove(Perspective perspective) {
- if (active == perspective)
- active = null;
- usedList.remove(perspective);
- return openedList.remove(perspective);
- }
-
- /**
- * Swap the opened order of old perspective with the
- * new perspective.
- */
- public void swap(Perspective oldPerspective, Perspective newPerspective) {
- int oldIndex = openedList.indexOf(oldPerspective);
- int newIndex = openedList.indexOf(newPerspective);
-
- if (oldIndex < 0 || newIndex < 0)
- return;
-
- openedList.set(oldIndex, newPerspective);
- openedList.set(newIndex, oldPerspective);
- }
-
- /**
- * Returns whether the list contains any perspectives
- */
- public boolean isEmpty() {
- return openedList.isEmpty();
- }
-
- /**
- * Returns the most recently used perspective in
- * the list.
- */
- public Perspective getActive() {
- return active;
- }
-
- /**
- * Returns the next most recently used perspective in
- * the list.
- */
- public Perspective getNextActive() {
- if (active == null) {
- if (usedList.isEmpty())
- return null;
- else
- return (Perspective)usedList.get(usedList.size() - 1);
- } else {
- if (usedList.size() < 2)
- return null;
- else
- return (Perspective)usedList.get(usedList.size() - 2);
- }
- }
-
- /**
- * Returns the number of perspectives opened
- */
- public int size() {
- return openedList.size();
- }
-
- /**
- * Marks the specified perspective as the most
- * recently used one in the list.
- */
- public void setActive(Perspective perspective) {
- if (perspective == active)
- return;
-
- active = perspective;
-
- if (perspective != null) {
- usedList.remove(perspective);
- usedList.add(perspective);
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartLabelProvider.java
deleted file mode 100644
index 39d039d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartLabelProvider.java
+++ /dev/null
@@ -1,37 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.graphics.Image;
-
-public class WorkbenchPartLabelProvider extends LabelProvider implements ITableLabelProvider {
-/**
- * @see ITableLabelProvider#getColumnImage
- */
-public Image getColumnImage(Object element, int columnIndex) {
- if (element instanceof IWorkbenchPart) {
- return ((IWorkbenchPart)element).getTitleImage();
- }
- return null;
-}
-/**
- * @see ITableLabelProvider#getColumnText
- */
-public String getColumnText(Object element, int columnIndex) {
- if (element instanceof IWorkbenchPart) {
- IWorkbenchPart part = (IWorkbenchPart)element;
- String path = part.getTitleToolTip();
- if (path.length() == 0) {
- return part.getTitle();
- } else {
- return part.getTitle() + " [" + part.getTitleToolTip() + "]"; //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
- return null;
-}
-}
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
deleted file mode 100644
index 7748999..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPartReference.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.eclipse.ui.internal;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.*;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- *
- */
-public abstract class WorkbenchPartReference implements IWorkbenchPartReference {
-
- protected IWorkbenchPart part;
-
- private String id;
- protected PartPane pane;
- private String title;
- private String tooltip;
- private Image image;
- private ImageDescriptor imageDescritor;
- private ListenerList propChangeListeners = new ListenerList(2);
-
- public WorkbenchPartReference() {
- }
- public void init(String id,String title,String tooltip,ImageDescriptor desc) {
- this.id = id;
- this.title = title;
- this.tooltip = tooltip;
- this.imageDescritor = desc;
- }
- public void releaseReferences() {
- id = null;
- tooltip = null;
- title = null;
- //make sure part has inc. the reference count.
- part.getTitleImage();
- ReferenceCounter imageCache = WorkbenchImages.getImageCache();
- Image image = (Image)imageCache.get(imageDescritor);
- if(image != null) {
- imageCache.removeRef(imageDescritor);
- }
- image = null;
- imageDescritor = null;
- }
- /**
- * @see IWorkbenchPart
- */
- public void addPropertyListener(IPropertyListener listener) {
- IWorkbenchPart part = getPart(false);
- if(part != null)
- part.addPropertyListener(listener);
- else
- propChangeListeners.add(listener);
- }
- /**
- * @see IWorkbenchPart
- */
- public void removePropertyListener(IPropertyListener listener) {
- IWorkbenchPart part = getPart(false);
- if(part != null)
- part.removePropertyListener(listener);
- else
- propChangeListeners.remove(listener);
- }
- public String getId() {
- if(part != null)
- return part.getSite().getId();
- return id;
- }
-
- public String getTitleToolTip() {
- if(part != null)
- return part.getTitleToolTip();
- else
- return tooltip;
- }
- public String getTitle() {
- String result = title;
- if(part != null)
- result = part.getTitle();
- if(result == null)
- result = new String();
- return result;
- }
- public Image getTitleImage() {
- if(part != null)
- return part.getTitleImage();
- if(image != null)
- return image;
- ReferenceCounter imageCache = WorkbenchImages.getImageCache();
- image = (Image)imageCache.get(imageDescritor);
- if(image != null) {
- imageCache.addRef(imageDescritor);
- return image;
- }
- image = imageDescritor.createImage();
- imageCache.put(imageDescritor,image);
- return image;
- }
- public void setPart(IWorkbenchPart part) {
- this.part = part;
- Object listeners[] = propChangeListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- part.addPropertyListener((IPropertyListener)listeners[i]);
- }
- PartSite site = (PartSite)part.getSite();
- if(site != null) {
- site.setPane(this.pane);
- this.pane = null;
- }
- }
- public void setPane(PartPane pane) {
- if(pane == null)
- return;
- if(part != null) {
- PartSite site = (PartSite)part.getSite();
- site.setPane(pane);
- } else {
- this.pane = pane;
- }
- }
- public PartPane getPane() {
- PartPane result = null;
- if(part != null)
- result = ((PartSite)part.getSite()).getPane();
- if(result == null)
- result = pane;
- return result;
- }
- public void dispose() {
- if(image != null && imageDescritor != null) {
- ReferenceCounter imageCache = WorkbenchImages.getImageCache();
- if(image != null) {
- int count = imageCache.removeRef(imageDescritor);
- if(count <= 0)
- image.dispose();
- }
- imageDescritor = null;
- image = null;
- }
- }
- public abstract String getRegisteredName();
-}
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
deleted file mode 100644
index 1a14be8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPlugin.java
+++ /dev/null
@@ -1,600 +0,0 @@
-package org.eclipse.ui.internal;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.*;
-import java.io.File;
-import java.util.*;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.resource.*;
-import org.eclipse.jface.util.OpenStrategy;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.misc.StatusUtil;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * 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 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.
- */
-public class WorkbenchPlugin extends AbstractUIPlugin {
- // 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 project nature ids to images
- private ProjectImageRegistry projectImageRegistry;
- // Manager for the DecoratorManager
- private DecoratorManager decoratorManager;
- // Manager that maps markers to help context ids and resolutions
- private MarkerHelpRegistry markerHelpRegistry;
- // Manager for working sets (IWorkingSet)
- private WorkingSetManager workingSetManager;
- // Working set registry, stores working set dialogs
- private WorkingSetRegistry workingSetRegistry;
-
- // 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.
- */
- public static String PI_WORKBENCH = PlatformUI.PLUGIN_ID;
-
- /**
- * The character used to separate preference page category ids
- */
- private static char PREFERENCE_PAGE_CATEGORY_SEPARATOR = '/';
-
- // Other data.
- private IWorkbench workbench;
- private PreferenceManager preferenceManager;
- private ViewRegistry viewRegistry;
- private PerspectiveRegistry perspRegistry;
- private ActionDefinitionRegistry actionDefinitionRegistry;
- private AcceleratorRegistry acceleratorRegistry;
- private CapabilityRegistry capabilityRegistry;
- private ActionSetRegistry actionSetRegistry;
- private SharedImages sharedImages;
- private MarkerImageProviderRegistry markerImageProviderRegistry;
- /**
- * 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(IPluginDescriptor descriptor) {
- super(descriptor);
- inst = this;
- }
- /**
- * 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
- * @returns the extension object
- */
- public static Object createExtension(final IConfigurationElement element, final String classAttribute) throws CoreException {
- // If plugin has been loaded create extension.
- // Otherwise, show busy cursor then create extension.
- IPluginDescriptor plugin = element.getDeclaringExtension().getDeclaringPluginDescriptor();
- if (plugin.isPluginActivated()) {
- return element.createExecutableExtension(classAttribute);
- } else {
- final Object[] ret = new Object[1];
- final CoreException[] exc = new CoreException[1];
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- try {
- ret[0] = element.createExecutableExtension(classAttribute);
- } catch (CoreException e) {
- exc[0] = e;
- }
- }
- });
- if (exc[0] != null)
- throw exc[0];
- else
- return ret[0];
- }
- }
- /**
- * Returns the image registry for this plugin.
- *
- * Where are the images? The images (typically gifs) are found in the
- * same plugins directory.
- *
- * @see JFace's 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.
- */
- protected ImageRegistry createImageRegistry() {
- return WorkbenchImages.getImageRegistry();
- }
- /**
- *Returns the action definition registry.
- *
- * @return the action definition registry
- */
- public ActionDefinitionRegistry getActionDefinitionRegistry() {
- if (actionDefinitionRegistry == null) {
- actionDefinitionRegistry = new ActionDefinitionRegistry();
- actionDefinitionRegistry.load();
- }
- return actionDefinitionRegistry;
- }
- /**
- *Returns the accelerator registry.
- *
- * @return the accelerator registry
- */
- public AcceleratorRegistry getAcceleratorRegistry() {
- if (acceleratorRegistry == null) {
- acceleratorRegistry = new AcceleratorRegistry();
- acceleratorRegistry.load();
- }
- return acceleratorRegistry;
- }
- /**
- * Returns the action set registry for the workbench.
- *
- * @return the workbench action set registry
- */
- public ActionSetRegistry getActionSetRegistry() {
- if (actionSetRegistry == null) {
- actionSetRegistry = new ActionSetRegistry();
- }
- return actionSetRegistry;
- }
- /**
- * Returns the capability registry for the workbench.
- *
- * @return the capability registry
- */
- public CapabilityRegistry getCapabilityRegistry() {
- if (capabilityRegistry == null) {
- capabilityRegistry = new CapabilityRegistry();
- capabilityRegistry.load();
- }
- return capabilityRegistry;
- }
- /**
- * Returns the marker help registry for the workbench.
- *
- * @return the marker help registry
- */
- public MarkerHelpRegistry getMarkerHelpRegistry() {
- if (markerHelpRegistry == null) {
- markerHelpRegistry = new MarkerHelpRegistry();
- new MarkerHelpRegistryReader().addHelp(markerHelpRegistry);
- }
- return markerHelpRegistry;
- }
- /* Return the default instance of the receiver. This represents the runtime plugin.
- *
- * @see AbstractPlugin 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
- */
-
- public IEditorRegistry getEditorRegistry() {
- if (editorRegistry == null) {
- editorRegistry = new EditorRegistry();
- }
- return editorRegistry;
- }
- /**
- * Answer the element factory for an id.
- */
- public IElementFactory getElementFactory(String targetID) {
-
- // Get the extension point registry.
- IExtensionPoint extensionPoint;
- extensionPoint = Platform.getPluginRegistry().getExtensionPoint(PI_WORKBENCH, IWorkbenchConstants.PL_ELEMENT_FACTORY);
-
- if (extensionPoint == null) {
- WorkbenchPlugin.log("Unable to find element factory. Extension point: " + IWorkbenchConstants.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 (int j = 0; j < configElements.length; j++) {
- String strID = configElements[j].getAttribute("id"); //$NON-NLS-1$
- if (strID.equals(targetID)) {
- targetElement = configElements[j];
- 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;
- }
- /**
- * Returns the marker image provider registry for the workbench.
- *
- * @return the marker image provider registry
- */
- public MarkerImageProviderRegistry getMarkerImageProviderRegistry() {
- if (markerImageProviderRegistry == null)
- markerImageProviderRegistry = new MarkerImageProviderRegistry();
- return markerImageProviderRegistry;
- }
- /**
- * Return the perspective registry.
- */
- public IPerspectiveRegistry getPerspectiveRegistry() {
- if (perspRegistry == null) {
- IPath path = WorkbenchPlugin.getDefault().getStateLocation();
- File folder = path.toFile();
- perspRegistry = new PerspectiveRegistry(folder);
- perspRegistry.load();
- }
- return perspRegistry;
- }
- /**
- * Return the workspace used by the workbench
- *
- * This method is internal to the workbench and must not be called
- * by any plugins.
- */
- public static IWorkspace getPluginWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
- /**
- * Returns the working set manager
- *
- * @return the working set manager
- * @since 2.0
- */
- public IWorkingSetManager getWorkingSetManager() {
- if (workingSetManager == null) {
- workingSetManager = new WorkingSetManager();
- workingSetManager.restoreState();
- }
- return workingSetManager;
- }
- /**
- * Returns the working set registry
- *
- * @return the working set registry
- * @since 2.0
- */
- public WorkingSetRegistry getWorkingSetRegistry() {
- if (workingSetRegistry == null) {
- workingSetRegistry = new WorkingSetRegistry();
- workingSetRegistry.load();
- }
- return workingSetRegistry;
- }
- /*
- * Get the preference manager.
- */
- public PreferenceManager getPreferenceManager() {
- if (preferenceManager == null) {
- preferenceManager = new PreferenceManager(PREFERENCE_PAGE_CATEGORY_SEPARATOR);
-
- //Get the pages from the registry
- PreferencePageRegistryReader registryReader = new PreferencePageRegistryReader(getWorkbench());
- List pageContributions = registryReader.getPreferenceContributions(Platform.getPluginRegistry());
-
- //Add the contributions to the manager
- Iterator enum = pageContributions.iterator();
- while (enum.hasNext()) {
- preferenceManager.addToRoot((IPreferenceNode) enum.next());
- }
- }
- return preferenceManager;
- }
- /**
- *Answers the manager that maps project nature ids to images
- */
-
- public ProjectImageRegistry getProjectImageRegistry() {
- if (projectImageRegistry == null) {
- projectImageRegistry = new ProjectImageRegistry();
- projectImageRegistry.load();
- }
- return projectImageRegistry;
- }
- /**
- * Returns the shared images for the workbench.
- *
- * @return the shared image manager
- */
- public ISharedImages getSharedImages() {
- if (sharedImages == null)
- sharedImages = new SharedImages();
- return sharedImages;
- }
- /**
- * Answer the view registry.
- */
- public IViewRegistry getViewRegistry() {
- if (viewRegistry == null) {
- viewRegistry = new ViewRegistry();
- try {
- ViewRegistryReader reader = new ViewRegistryReader();
- reader.readViews(Platform.getPluginRegistry(), viewRegistry);
- } catch (CoreException e) {
- // cannot safely show a dialog so log it
- WorkbenchPlugin.log("Unable to read view registry.", e.getStatus()); //$NON-NLS-1$
- }
- }
- return viewRegistry;
- }
- /*
- * Answer the workbench.
- */
- public IWorkbench getWorkbench() {
- return workbench;
- }
- /**
- * 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.
- */
- protected void initializeDefaultPreferences(IPreferenceStore store) {
-
- JFacePreferences.setPreferenceStore(store);
- store.setDefault(IPreferenceConstants.AUTO_BUILD, true);
- store.setDefault(IPreferenceConstants.SAVE_ALL_BEFORE_BUILD, false);
- store.setDefault(IPreferenceConstants.SAVE_INTERVAL, 5); //5 minutes
- store.setDefault(IPreferenceConstants.WELCOME_DIALOG, true);
- store.setDefault(IWorkbenchPreferenceConstants.LINK_NAVIGATOR_TO_EDITOR, true);
- store.setDefault(IPreferenceConstants.REFRESH_WORKSPACE_ON_STARTUP, false);
- store.setDefault(IPreferenceConstants.REUSE_EDITORS_BOOLEAN, false);
- store.setDefault(IPreferenceConstants.REUSE_DIRTY_EDITORS, true);
- store.setDefault(IPreferenceConstants.REUSE_EDITORS, 8);
- store.setDefault(IPreferenceConstants.OPEN_ON_SINGLE_CLICK, false);
- store.setDefault(IPreferenceConstants.SELECT_ON_HOVER, false);
- store.setDefault(IPreferenceConstants.OPEN_AFTER_DELAY, false);
- store.setDefault(IPreferenceConstants.RECENT_FILES, 4);
- store.setDefault(IPreferenceConstants.VIEW_TAB_POSITION, SWT.BOTTOM);
- store.setDefault(IPreferenceConstants.EDITOR_TAB_POSITION, SWT.TOP);
- store.setDefault(IPreferenceConstants.OPEN_VIEW_MODE, IPreferenceConstants.OVM_EMBED);
- store.setDefault(IPreferenceConstants.OPEN_PERSP_MODE, IPreferenceConstants.OPM_ACTIVE_PAGE);
- store.setDefault(IPreferenceConstants.ENABLED_DECORATORS, ""); //$NON-NLS-1$
- store.setDefault(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID, IWorkbenchConstants.DEFAULT_LAYOUT_ID);
-
- //Set the default error colour to red
- PreferenceConverter.setDefault(store,JFacePreferences.ERROR_COLOR, new RGB(255, 0, 0));
- //Set the default hyperlink line colour to dark blue
- PreferenceConverter.setDefault(store,JFacePreferences.HYPERLINK_COLOR, new RGB(0, 0, 153));
- //Set the default active hyperlink line colour to blue
- PreferenceConverter.setDefault(store,JFacePreferences.ACTIVE_HYPERLINK_COLOR, new RGB(0, 0, 255));
-
-
- // Temporary option to enable wizard for project capability
- store.setDefault("ENABLE_CONFIGURABLE_PROJECT_WIZARD", false); //$NON-NLS-1$
- // Temporary option to enable single click
- store.setDefault("SINGLE_CLICK_METHOD", OpenStrategy.DOUBLE_CLICK); //$NON-NLS-1$
- // Temporary option to enable cool bars
- store.setDefault("ENABLE_COOL_BARS", true); //$NON-NLS-1$
- // Temporary option to enable new menu organization
- store.setDefault("ENABLE_NEW_MENUS", true); //$NON-NLS-1$
-
-
- FontRegistry registry = JFaceResources.getFontRegistry();
- initializeFont(JFaceResources.DIALOG_FONT, registry, store);
- initializeFont(JFaceResources.BANNER_FONT, registry, store);
- initializeFont(JFaceResources.HEADER_FONT, registry, store);
- initializeFont(JFaceResources.TEXT_FONT, registry, store);
-
- // deprecated constants - keep to be backward compatible
- store.setDefault(IWorkbenchPreferenceConstants.OPEN_NEW_PERSPECTIVE, IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE);
- store.setDefault(IWorkbenchPreferenceConstants.SHIFT_OPEN_NEW_PERSPECTIVE, IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE);
- store.setDefault(IWorkbenchPreferenceConstants.ALTERNATE_OPEN_NEW_PERSPECTIVE, IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE);
- store.setDefault(IWorkbenchPreferenceConstants.PROJECT_OPEN_NEW_PERSPECTIVE, IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE);
- store.setDefault(IWorkbenchConstants.ACCELERATOR_CONFIGURATION_ID, IWorkbenchConstants.DEFAULT_ACCELERATOR_CONFIGURATION_ID);
-
- store.addPropertyChangeListener(new PlatformUIPreferenceListener());
- }
-
- private void initializeFont(String fontKey, FontRegistry registry, IPreferenceStore store) {
-
- FontData[] fontData = registry.getFontData(fontKey);
- PreferenceConverter.setDefault(store, fontKey, fontData);
- }
- /**
- * Log the given status to the ISV log.
- *
- * When to use this:
- *
- * This should be used when a PluginException or a
- * ExtensionException occur but for which an error
- * dialog cannot be safely shown.
- *
- * If you can show an ErrorDialog then do so, and do
- * not call this method.
- *
- * If you have a plugin exception or core exception in hand
- * call log(String, IStatus)
- *
- * This convenience method is for internal use by the Workbench only
- * and must not be called outside the workbench.
- *
- * This method is supported in the event the log allows plugin related
- * information to be logged (1FTTJKV). This would be done by this method.
- *
- * This method is internal to the workbench and must not be called
- * by any plugins, or examples.
- *
- * @param message A high level UI message describing when the problem happened.
- *
- */
-
- public static void log(String message) {
- getDefault().getLog().log(StatusUtil.newStatus(Status.ERROR, message, null));
- System.err.println(message);
- //1FTTJKV: ITPCORE:ALL - log(status) does not allow plugin information to be recorded
- }
- /**
- * Log the given status to the ISV log.
- *
- * When to use this:
- *
- * This should be used when a PluginException or a
- * ExtensionException occur but for which an error
- * dialog cannot be safely shown.
- *
- * If you can show an ErrorDialog then do so, and do
- * not call this method.
- *
- * This convenience method is for internal use by the workbench only
- * and must not be called outside the workbench.
- *
- * This method is supported in the event the log allows plugin related
- * information to be logged (1FTTJKV). This would be done by this method.
- *
- * This method is internal to the workbench and must not be called
- * by any plugins, or examples.
- *
- * @param message A high level UI message describing when the problem happened.
- * May be null.
- * @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
-
- if (message != null) {
- getDefault().getLog().log(StatusUtil.newStatus(IStatus.ERROR, message, null));
- System.err.println(message + "\nReason:"); //$NON-NLS-1$
- }
-
- getDefault().getLog().log(status);
- System.err.println(status.getMessage());
-
- //1FTTJKV: ITPCORE:ALL - log(status) does not allow plugin information to be recorded
- }
- public void setWorkbench(IWorkbench aWorkbench) {
- this.workbench = aWorkbench;
- }
-
- /**
- * Get the decorator manager for the receiver
- */
-
- public DecoratorManager getDecoratorManager() {
- if (this.decoratorManager == null) {
- this.decoratorManager = new DecoratorManager();
- this.decoratorManager.restoreListeners();
- }
- return decoratorManager;
- }
-
- public void startup() throws CoreException {
- /* The plugin org.eclipse.ui has being separed in
- several plugins. Copy the state files from
- org.eclipse.ui to org.eclipse.ui.workbench */
-
- IPath locationPath = getStateLocation();
- File newLocation = locationPath.toFile();
- File oldLocation = new File(newLocation,"..//org.eclipse.ui");
- try {
- oldLocation = oldLocation.getCanonicalFile();
- } catch (IOException e) {}
- String markerFileName = ".copiedStateFiles_Marker";
- File markerFile = new File(oldLocation,markerFileName);
- if(markerFile.exists())
- return;
-
- try {
- String list[] = newLocation.list();
- if(list != null && list.length != 0)
- return;
-
- String oldList[] = oldLocation.list();
- if(oldList == null || oldList.length == 0)
- return;
-
- byte b[] = new byte[1024];
- for (int i = 0; i < oldList.length; i++) {
- String string = oldList[i];
- try {
- File oldFile = new File(oldLocation,string);
- FileInputStream in = new FileInputStream(oldFile);
- FileOutputStream out = new FileOutputStream(new File(newLocation,string));
- int read = in.read(b);
- while(read >= 0) {
- out.write(b,0,read);
- read = in.read(b);
- }
- in.close();
- out.close();
- oldFile.delete();
- } catch (IOException e) {
- new File(newLocation,string).delete();
- }
- }
- } finally {
- try {
- new FileOutputStream(markerFile).close();
- } catch (IOException e) {}
- }
- }
-
- /*
- * @see Plugin#shutdown()
- */
- public void shutdown() throws CoreException {
- super.shutdown();
- if (this.decoratorManager != null) {
- this.decoratorManager.shutdown();
- }
- }
-
-}
\ No newline at end of file
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
deleted file mode 100644
index 2155ee4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchWindow.java
+++ /dev/null
@@ -1,1635 +0,0 @@
-package org.eclipse.ui.internal;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-**********************************************************************/
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IContributionManager;
-import org.eclipse.jface.action.IContributionManagerOverrides;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.StatusLineManager;
-import org.eclipse.jface.action.SubMenuManager;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.window.ApplicationWindow;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.ShellAdapter;
-import org.eclipse.swt.events.ShellEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.CoolBar;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Widget;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IElementFactory;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPageListener;
-import org.eclipse.ui.IPartService;
-import org.eclipse.ui.IPersistableElement;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.keybindings.Action;
-import org.eclipse.ui.internal.keybindings.KeyBindingManager;
-import org.eclipse.ui.internal.keybindings.KeySequence;
-import org.eclipse.ui.internal.keybindings.KeyStroke;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.internal.registry.IActionSet;
-
-/**
- * A window within the workbench.
- */
-public class WorkbenchWindow extends ApplicationWindow
- implements IWorkbenchWindow
-{
- private int number;
- private Workbench workbench;
- private PageList pageList = new PageList();
- private PageListenerList pageListeners = new PageListenerList();
- private PerspectiveListenerListOld perspectiveListeners = new PerspectiveListenerListOld();
- private IPartDropListener partDropListener;
- private WWinPerspectiveService perspectiveService = new WWinPerspectiveService(this);
- private WWinKeyBindingService keyBindingService;
- private WWinPartService partService = new WWinPartService(this);
- private IMemento deferredRestoreState;
- private ActionPresentation actionPresentation;
- private WWinActionBars actionBars;
- private Label separator2;
- private Label separator3;
- private ToolBarManager shortcutBar;
- private ShortcutBarPart shortcutBarPart;
- private ShortcutBarPartDragDrop shortcutDND;
- private WorkbenchActionBuilder builder;
- private boolean updateDisabled = true;
- private boolean closing = false;
- private boolean shellActivated = false;
- private String workspaceLocation;
- private Menu perspectiveBarMenu;
- private Menu fastViewBarMenu;
- private MenuItem restoreItem;
- // temporary, work in progress for CoolBars
- private CoolBarManager coolBarManager;
-
- final private String TAG_INPUT = "input";//$NON-NLS-1$
- final private String TAG_LAYOUT = "layout";//$NON-NLS-1$
- final private String TAG_FOCUS = "focus";//$NON-NLS-1$
- final private String TAG_FACTORY_ID = "factoryID";//$NON-NLS-1$
- final protected String GRP_PAGES = "pages";//$NON-NLS-1$
- final protected String GRP_PERSPECTIVES = "perspectives";//$NON-NLS-1$
- final protected String GRP_FAST_VIEWS = "fastViews";//$NON-NLS-1$
-
- // static fields for inner classes.
- static final int VGAP= 0;
- static final int CLIENT_INSET = 3;
- static final int BAR_SIZE = 23;
-
- /**
- * The window toolbar must relayout whenever an update occurs, as items are
- * added and removed dynamically.
- */
- class WindowToolBarManager extends ToolBarManager {
- public WindowToolBarManager(int style) {
- super(style);
- }
- protected void relayout(ToolBar toolBar, int oldCount, int newCount) {
- Composite parent= toolBar.getParent();
- parent.layout();
- }
- }
- /**
- * This vertical layout supports a fixed size Toolbar area, a separator line,
- * the variable size content area,
- * and a fixed size status line.
- */
- class WorkbenchWindowLayout extends Layout {
-
- 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= new Point(0, 0);
- Control[] ws= composite.getChildren();
- for (int i= 0; i < ws.length; i++) {
- Control w= ws[i];
- boolean skip = false;
- if (w == getToolBarControl()) {
- skip = true;
- result.y+= BAR_SIZE;
- } else if (w == shortcutBar.getControl()) {
- skip = true;
- }
- if (!skip) {
- Point e= w.computeSize(wHint, hHint, flushCache);
- result.x= Math.max(result.x, e.x);
- result.y+= e.y + VGAP;
- }
- }
-
- result.x += BAR_SIZE; // For shortcut bar.
- if (wHint != SWT.DEFAULT)
- result.x= wHint;
- if (hHint != SWT.DEFAULT)
- result.y= hHint;
- return result;
- }
-
- protected void layout(Composite composite, boolean flushCache)
- {
- Rectangle clientArea= composite.getClientArea();
- // Loop through the children.
- // Expected order == sep1, toolbar, status, sep2, shortcuts, sep3, client
- Control[] ws= composite.getChildren();
- for (int i= 0; i < ws.length; i++) {
- Control w= ws[i];
- if (i == 0 || w == separator2) { // Separators
- Point e= w.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
- w.setBounds(clientArea.x, clientArea.y, clientArea.width, e.y);
- clientArea.y+= e.y;
- clientArea.height-= e.y;
- } else if (w == getToolBarControl()) {
- int height = BAR_SIZE;
- if (toolBarChildrenExist()) {
- Point e = w.computeSize(clientArea.width, SWT.DEFAULT, flushCache);
- height = e.y;
- }
- w.setBounds(clientArea.x, clientArea.y, clientArea.width, height);
- clientArea.y+= height;
- clientArea.height-= height;
- } else if (getStatusLineManager() != null && w == getStatusLineManager().getControl()) {
- int width = BAR_SIZE;
- if (shortcutBar != null) {
- Widget widget = shortcutBar.getControl();
- if (widget != null) {
- if (widget instanceof ToolBar) {
- ToolBar bar = (ToolBar) widget;
- if (bar.getItemCount() > 0) {
- ToolItem item = bar.getItem(0);
- width = item.getWidth();
- Rectangle trim = bar.computeTrim(0,0,width,width);
- width = trim.width;
- }
- }
- }
- }
- Point e= w.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
- w.setBounds(clientArea.x + width, clientArea.y+clientArea.height-e.y, clientArea.width - width, e.y);
- clientArea.height-= e.y + VGAP;
- } else if (w == shortcutBar.getControl()) {
- int width = BAR_SIZE;
- if (w instanceof ToolBar) {
- ToolBar bar = (ToolBar) w;
- if (bar.getItemCount() > 0) {
- ToolItem item = bar.getItem(0);
- width = item.getWidth();
- Rectangle trim = bar.computeTrim(0,0,width,width);
- width = trim.width;
- }
- }
- w.setBounds(clientArea.x, clientArea.y, width, clientArea.height);
- clientArea.x+= width + VGAP;
- clientArea.width-= width + VGAP;
- } else if (w == separator3) {
- Point e= w.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
- w.setBounds(clientArea.x, clientArea.y, e.x, clientArea.height);
- clientArea.x+= e.x;
- } else {
- // Must be client.
- // Inset client area by 3 pixels
- w.setBounds(clientArea.x + CLIENT_INSET, clientArea.y + CLIENT_INSET + VGAP, clientArea.width - ( 2 * CLIENT_INSET), clientArea.height - VGAP - (2 * CLIENT_INSET));
- }
- }
- }
- }
-
-/**
- * WorkbenchWindow constructor comment.
- * @param workbench Workbench
- */
-public WorkbenchWindow(Workbench workbench, int number) {
- super(null);
- this.workbench = workbench;
- this.number = number;
-
- // Setup window.
- addMenuBar();
-
- //IPreferenceStore store = workbench.getPreferenceStore();
-// if(store.getBoolean("ENABLE_COOL_BARS")) //$NON-NLS-1$
- addCoolBar(SWT.FLAT);
-// else
-// addToolBar(SWT.FLAT | SWT.WRAP);
-
- addStatusLine();
- addShortcutBar(SWT.FLAT | SWT.WRAP | SWT.VERTICAL);
-
- // Add actions.
- actionPresentation = new ActionPresentation(this);
- builder = new WorkbenchActionBuilder();
- builder.buildActions(this);
-
- // include the workspace location in the title
- // if the command line option -showlocation is specified
- String[] args = Platform.getCommandLineArgs();
- for (int i = 0; i < args.length; i++) {
- if ("-showlocation".equals(args[i])) { //$NON-NLS-1$
- workspaceLocation = Platform.getLocation().toOSString();
- break;
- }
- }
-
- this.partDropListener = new IPartDropListener() {
- public void dragOver(PartDropEvent e) {
- WorkbenchPage page = getActiveWorkbenchPage();
- Perspective persp = page.getActivePerspective();
- PerspectivePresentation presentation = persp.getPresentation();
- presentation.onPartDragOver(e);
- };
- public void drop(PartDropEvent e) {
- WorkbenchPage page = getActiveWorkbenchPage();
- Perspective persp = page.getActivePerspective();
- PerspectivePresentation presentation = persp.getPresentation();
- presentation.onPartDrop(e);
- };
- };
-}
-/**
- * Configures this window to have a cool bar.
- * Does nothing if it already has one.
- * This method must be called before this window's shell is created.
- */
-protected void addCoolBar(int style) {
- if ((getShell() == null) && (coolBarManager == null)) {
- coolBarManager = createCoolBarManager(style);
- }
-}
-/*
- * Adds an listener to the part service.
- */
-public void addPageListener(IPageListener l) {
- pageListeners.addPageListener(l);
-}
-/*
- * Adds an listener to the perspective service.
- *
- * NOTE: Internally, please use getPerspectiveService instead.
- */
-public void addPerspectiveListener(org.eclipse.ui.IPerspectiveListener l) {
- perspectiveListeners.addPerspectiveListener(l);
-}
-/**
- * add a shortcut for the page.
- */
-/* package */ void addPerspectiveShortcut(IPerspectiveDescriptor perspective, WorkbenchPage page) {
- SetPagePerspectiveAction action = new SetPagePerspectiveAction(perspective, page);
- shortcutBar.appendToGroup(GRP_PERSPECTIVES, action);
- shortcutBar.update(false);
-}
-/**
- * Configures this window to have a shortcut bar.
- * Does nothing if it already has one.
- * This method must be called before this window's shell is created.
- */
-protected void addShortcutBar(int style) {
- if ((getShell() == null) && (shortcutBar == null)) {
- shortcutBar = new ToolBarManager(style);
- }
-}
-/**
- * Close the window.
- *
- * Assumes that busy cursor is active.
- */
-private boolean busyClose() {
- // Only do the check if it is OK to close if we are not closing via the
- // workbench as the workbench will call this itself
- closing = true;
- updateDisabled = true;
- int count = workbench.getWorkbenchWindowCount();
- if (count <= 1 && !workbench.isClosing())
- return workbench.close();
- else {
- if (!okToClose())
- return false;
- return hardClose();
- }
-}
-/**
- * Opens a new page. Assumes that busy cursor is 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.openPerspective</code> APIs to
- * programmatically show a perspective.
- * </p>
- */
-protected IWorkbenchPage busyOpenPage(String perspID, IAdaptable input)
- throws WorkbenchException
-{
- IWorkbenchPage newPage = null;
-
- if (pageList.isEmpty()) {
- newPage = new WorkbenchPage(this, perspID, input);
- pageList.add(newPage);
- firePageOpened(newPage);
- setActivePage(newPage);
- } else {
- IWorkbenchWindow window = getWorkbench().openWorkbenchWindow(perspID, input);
- newPage = window.getActivePage();
- }
-
- return newPage;
-}
-/**
- * @see Window
- */
-public int open() {
- int r = super.open();
- workbench.fireWindowOpened(this);
- return r;
-}
-/**
- * @see IWorkbenchWindow
- */
-public boolean close() {
- final boolean [] ret = new boolean[1];
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- ret[0] = busyClose();
- }
- });
- return ret[0];
-}
-
-private boolean isClosing() {
- return closing || workbench.isClosing();
-}
-/**
- * Return whether or not the toolbar layout is locked.
- */
-protected boolean isToolBarLocked() {
- IToolBarManager toolsMgr = getToolsManager();
- if (toolsMgr instanceof CoolBarManager) {
- CoolBarManager coolBarMgr = (CoolBarManager)toolsMgr;
- return coolBarMgr.isLayoutLocked();
- }
- return false;
-}
-
-/**
- * Close all of the pages.
- */
-private void closeAllPages()
-{
- // Deactivate active page.
- setActivePage(null);
-
- // Clone and deref all so that calls to getPages() returns
- // empty list (if call by pageClosed event handlers)
- PageList oldList = pageList;
- pageList = new PageList();
-
- // Close all.
- Iterator enum = oldList.iterator();
- while (enum.hasNext()) {
- WorkbenchPage page = (WorkbenchPage)enum.next();
- firePageClosed(page);
- page.dispose();
- }
-}
-/**
- * Save and close all of the pages.
- */
-public void closeAllPages(boolean save) {
- if (save) {
- boolean ret = saveAllPages(true);
- if (!ret) return;
- }
- closeAllPages();
-}
-/**
- * closePerspective method comment.
- */
-protected boolean closePage(IWorkbenchPage in, boolean save) {
- // Validate the input.
- if (!pageList.contains(in))
- return false;
- WorkbenchPage oldPage = (WorkbenchPage)in;
-
- // Save old perspective.
- if (save && oldPage.isSaveNeeded()) {
- if (!oldPage.saveAllEditors(true))
- return false;
- }
-
- // If old page is activate deactivate.
- boolean oldIsActive = (oldPage == getActiveWorkbenchPage());
- if (oldIsActive)
- setActivePage(null);
-
- // Close old page.
- pageList.remove(oldPage);
- firePageClosed(oldPage);
- oldPage.dispose();
-
- // Activate new page.
- if (oldIsActive) {
- IWorkbenchPage newPage = pageList.getNextActive();
- if (newPage != null)
- setActivePage(newPage);
- }
-
- return true;
-}
-/**
- * Sets the ApplicationWindows's content layout.
- * This vertical layout supports a fixed size Toolbar area, a separator line,
- * the variable size content area,
- * and a fixed size status line.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setLayout(new WorkbenchWindowLayout());
- shell.setSize(800, 600);
- separator2 = new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
- createShortcutBar(shell);
- separator3 = new Label(shell, SWT.SEPARATOR | SWT.VERTICAL);
-
- WorkbenchHelp.setHelp(shell, IHelpContextIds.WORKBENCH_WINDOW);
-
- trackShellActivation(shell);
-
- // If the user clicks on toolbar, status bar, or shortcut bar
- // hide the fast view.
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- WorkbenchPage currentPage = getActiveWorkbenchPage();
- if (currentPage != null) {
- if (event.type == SWT.MouseDown) {
- if (event.widget instanceof ToolBar) {
- // Ignore mouse down on actual tool bar buttons
- Point pt = new Point(event.x, event.y);
- ToolBar toolBar = (ToolBar)event.widget;
- if (toolBar.getItem(pt) != null)
- return;
- }
- currentPage.toggleFastView(null);
- }
- }
- }
- };
- getToolBarControl().addListener(SWT.MouseDown, listener);
- Control[] children = ((Composite)getStatusLineManager().getControl()).getChildren();
- for (int i = 0; i < children.length; i++) {
- if (children[i] != null)
- children[i].addListener(SWT.MouseDown, listener);
- }
- getShortcutBar().getControl().addListener(SWT.MouseDown, listener);
-}
-/**
- * Create the shortcut toolbar control
- */
-private void createShortcutBar(Shell shell) {
- // Create control.
- if (shortcutBar == null)
- return;
- shortcutBar.createControl(shell);
-
- // Define shortcut part. This is for drag and drop.
- shortcutBarPart = new ShortcutBarPart(shortcutBar);
-
- // Enable drag and drop.
- enableDragShortcutBarPart();
-
- // Add right mouse button support.
- ToolBar tb = shortcutBar.getControl();
- tb.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- if (e.button == 3)
- showShortcutBarPopup(e);
- }
- });
-}
-/* (non-Javadoc)
- * Method declared on ApplicationWindow.
- */
-protected MenuManager createMenuManager() {
- final MenuManager result = super.createMenuManager();
- result.setOverrides(new IContributionManagerOverrides() {
-
- public Integer getAccelerator(IContributionItem item) {
- if (!(item instanceof ActionContributionItem))
- return null;
-
- ActionContributionItem aci = (ActionContributionItem)item;
- String defId = aci.getAction().getActionDefinitionId();
-
- if (defId == null) {
- int accelerator = aci.getAction().getAccelerator();
-
- if (accelerator != 0) {
- KeySequence keySequence = KeySequence.create(
- KeyStroke.create(accelerator));
- Map sequenceActionMap = KeyBindingManager.getInstance().getKeySequenceActionMapForMode();
- Action action = (Action) sequenceActionMap.get(keySequence);
-
- if (action == null || action.getValue() == null)
- return null;
- }
-
- return new Integer(0);
- }
-
- return new Integer(0);
- //TBD: later we can move the accelerator from the hidden menu to here:
- //String acceleratorText = KeyBindingManager.getInstance().getAcceleratorTextForAction(defId);
- //return (acceleratorText != null ? acceleratorText : new Integer(0));
- }
-
- public String getAcceleratorText(IContributionItem item) {
- if (!(item instanceof ActionContributionItem))
- return null;
-
- ActionContributionItem aci = (ActionContributionItem)item;
- String defId = aci.getAction().getActionDefinitionId();
-
- if (defId == null) {
- int accelerator = aci.getAction().getAccelerator();
-
- if (accelerator != 0) {
- KeySequence keySequence = KeySequence.create(
- KeyStroke.create(accelerator));
- Map sequenceActionMap = KeyBindingManager.getInstance().getKeySequenceActionMapForMode();
- Action action = (Action) sequenceActionMap.get(keySequence);
-
- if (action == null || action.getValue() == null)
- return null;
- }
-
- return "";
- }
-
- String acceleratorText = KeyBindingManager.getInstance().getAcceleratorTextForAction(defId);
- return (acceleratorText != null ? acceleratorText : "");
- }
-
- public String getText(IContributionItem item) {
- if(!(item instanceof MenuManager))
- return null;
- MenuManager itemManager = (MenuManager)item;
- IContributionManager parent = itemManager.getParent();
- if(parent != result) {
- if(parent instanceof SubMenuManager) {
- parent = ((SubMenuManager)parent).getParent();
- if (parent != result)
- return null;
- } else {
- return null;
- }
- }
-
- String text = itemManager.getMenuText();
- int index = text.indexOf('&');
- if (index < 0 || index == (text.length() -1))
- return text;
-
- char altChar = Character.toUpperCase(text.charAt(index + 1));
- String defId = keyBindingService.getDefinitionId(new int[]{SWT.ALT | altChar});
- if(defId == null)
- return text;
-
- if (index == 0)
- return text.substring(1);
- return text.substring(0, index) + text.substring(index + 1);
- }
-
- public Boolean getEnabled(IContributionItem item) {
- return null;
- }
- });
- return result;
-}
-/* (non-Javadoc)
- * Method declared on ApplicationWindow.
- */
-protected ToolBarManager createToolBarManager(int style) {
- return new WindowToolBarManager(style);
-}
-/**
- * Creates the cool bar manager.
- * </p>
- * @return a CoolBarManager
- */
-protected CoolBarManager createCoolBarManager(int style) {
- return new CoolBarManager(style);
-}
-/**
- * Creates the control for the tool bar manager. Overridden
- * to support CoolBars.
- * </p>
- * @return a Control
- */
-protected Control createToolBarControl(Shell shell) {
- IToolBarManager manager = getToolsManager();
- if (manager instanceof ToolBarManager) {
- return ((ToolBarManager)manager).createControl(shell);
- } else if (manager instanceof CoolBarManager) {
- return ((CoolBarManager)manager).createControl(shell);
- }
- return null;
-}
-/**
- * Enables fast view icons to be dragged and dropped using the given IPartDropListener.
- */
-/*package*/ void enableDragShortcutBarPart() {
- Control control = shortcutBarPart.getControl();
- if (control != null && shortcutDND == null) {
- // Only one ShortcutBarPartDragDrop per WorkbenchWindow.
- shortcutDND = new ShortcutBarPartDragDrop(shortcutBarPart, control);
- // Add the listener only once.
- shortcutDND.addDropListener(partDropListener);
- }
-}
-/**
- * Returns the shortcut for a page.
- */
-/* protected */ IContributionItem findPerspectiveShortcut(IPerspectiveDescriptor perspective, WorkbenchPage page) {
- IContributionItem[] array = shortcutBar.getItems();
- int length = array.length;
- for (int i = 0; i < length; i++) {
- IContributionItem item = array[i];
- if (item instanceof ActionContributionItem) {
- IAction action = ((ActionContributionItem)item).getAction();
- if (action instanceof SetPagePerspectiveAction) {
- SetPagePerspectiveAction sp = (SetPagePerspectiveAction)action;
- if (sp.handles(perspective, page))
- return item;
- }
- }
- }
- return null;
-}
-/**
- * Fires page activated
- */
-private void firePageActivated(IWorkbenchPage page) {
- pageListeners.firePageActivated(page);
- partService.pageActivated(page);
-}
-/**
- * Fires page closed
- */
-private void firePageClosed(IWorkbenchPage page) {
- pageListeners.firePageClosed(page);
- partService.pageClosed(page);
-}
-/**
- * Fires page opened
- */
-private void firePageOpened(IWorkbenchPage page) {
- pageListeners.firePageOpened(page);
- partService.pageOpened(page);
-}
-/**
- * Fires perspective activated
- */
-void firePerspectiveActivated(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- perspectiveListeners.firePerspectiveActivated(page, perspective);
- perspectiveService.firePerspectiveActivated(page, perspective);
-}
-/**
- * Fires perspective changed
- */
-void firePerspectiveChanged(IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId) {
- perspectiveListeners.firePerspectiveChanged(page, perspective, changeId);
- perspectiveService.firePerspectiveChanged(page, perspective, changeId);
-}
-/**
- * Fires perspective closed
- */
-void firePerspectiveClosed(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- perspectiveService.firePerspectiveClosed(page, perspective);
-}
-/**
- * Fires perspective opened
- */
-void firePerspectiveOpened(IWorkbenchPage page, IPerspectiveDescriptor perspective) {
- perspectiveService.firePerspectiveOpened(page, perspective);
-}
-/**
- * Returns the action bars for this window.
- */
-public IActionBars getActionBars() {
- if (actionBars == null) {
- actionBars = new WWinActionBars(this);
- }
- return actionBars;
-}
-/**
- * Returns the active page.
- *
- * @return the active page
- */
-public IWorkbenchPage getActivePage() {
- return pageList.getActive();
-}
-/**
- * Returns the active workbench page.
- *
- * @return the active workbench page
- */
-/* package */ WorkbenchPage getActiveWorkbenchPage() {
- return pageList.getActive();
-}
-/**
- * Get the workbench client area.
- */
-protected Composite getClientComposite() {
- return (Composite)getContents();
-}
-/**
- * Answer the menu manager for this window.
- */
-public MenuManager getMenuManager() {
- return getMenuBarManager();
-}
-/**
- * Returns the number. This corresponds to a page number in a window or a
- * window number in the workbench.
- */
-public int getNumber() {
- return number;
-}
-/**
- * Returns an array of the pages in the workbench window.
- *
- * @return an array of pages
- */
-public IWorkbenchPage[] getPages() {
- return pageList.getPages();
-}
-/**
- * @see IWorkbenchWindow
- */
-public IPartService getPartService() {
- return partService;
-}
-/**
- * Returns the key binding service in use.
- *
- * @return the key binding service in use.
- * @since 2.0
- */
-public WWinKeyBindingService getKeyBindingService() {
- if (keyBindingService == null) {
- keyBindingService = new WWinKeyBindingService(this);
- updateActiveActions();
- }
- return keyBindingService;
-}
-/**
- * Re-register the action sets actions in the keybinding service.
- */
-private void updateActiveActions() {
- if(keyBindingService == null) {
- getKeyBindingService();
- } else {
- IActionSet sets[] = actionPresentation.getActionSets();
- keyBindingService.registerActionSets(sets);
- }
-}
-
-/**
- * @see IWorkbenchWindow
- */
-public IPerspectiveService getPerspectiveService() {
- return perspectiveService;
-}
-/**
- * @see IWorkbenchWindow
- */
-public ISelectionService getSelectionService() {
- return partService.getSelectionService();
-}
-/**
- * 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
- */
-public boolean getShellActivated() {
- return shellActivated;
-}
-/**
- * Returns the shortcut bar.
- */
-public ToolBarManager getShortcutBar() {
- return shortcutBar;
-}
-/**
- * Returns the PartDragDrop for the shortcut bar part.
- */
-/*package*/ShortcutBarPartDragDrop getShortcutDND() {
- return shortcutDND;
-}
-/**
- * Returns the status line manager for this window (if it has one).
- *
- *
- * @return the status line manager, or <code>null</code> if
- * this window does not have a status line
- * @see #addStatusLine
- */
-protected StatusLineManager getStatusLineManager() {
- return super.getStatusLineManager();
-}
-/**
- * Returns tool bar control for the window. Overridden
- * to support CoolBars.
- * </p>
- * @return a Control
- */
-protected Control getToolBarControl() {
- IToolBarManager manager = getToolsManager();
- if (manager instanceof ToolBarManager) {
- return ((ToolBarManager)manager).getControl();
- }
- if (manager instanceof CoolBarManager) {
- return ((CoolBarManager)manager).getControl();
- }
- return null;
-}
-/**
- * Returns the tool bar manager for this window (if it has one).
- * Introduced to support different types of IToolBarManagers.
- *
- * @return the IToolBarManager, or <code>null</code> if
- * this window does not have a ToolBar or CoolBar.
- * @see #addToolBar, #addCoolBar
- */
-public IToolBarManager getToolsManager() {
- if (coolBarManager != null) return coolBarManager;
- return getToolBarManager();
-}
-/**
- * @see IWorkbenchWindow
- */
-public IWorkbench getWorkbench() {
- return workbench;
-}
-/**
- * Unconditionally close this window.
- */
-private boolean hardClose() {
- try {
- closing = true;
- updateDisabled = true;
- closeAllPages();
- builder.dispose();
- if(keyBindingService != null)
- keyBindingService.dispose();
- workbench.fireWindowClosed(this);
- } finally {
- return super.close();
- }
-}
-/**
- * @see IWorkbenchWindow
- */
-public boolean isApplicationMenu(String menuID) {
- return WorkbenchActionBuilder.isContainerMenu(menuID);
-}
-/**
- * Locks/unlocks the CoolBar for the workbench.
- *
- * @param lock whether the CoolBar should be locked or unlocked
- */
-/* package */ void lockToolBar(boolean lock) {
- IToolBarManager toolsMgr = getToolsManager();
- if (toolsMgr instanceof CoolBarManager) {
- CoolBarManager coolBarMgr = (CoolBarManager)toolsMgr;
- coolBarMgr.lockLayout(lock);
- }
-}
-/**
- * Called when this window is about to be closed.
- *
- * Subclasses may overide to add code that returns <code>false</code>
- * to prevent closing under certain conditions.
- */
-public boolean okToClose() {
- // Save all of the editors.
- if(!workbench.isClosing())
- if (!saveAllPages(true))
- return false;
- return true;
-}
-/**
- * Opens a new page.
- * <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.openPerspective</code> APIs to
- * programmatically show a perspective.
- * </p>
- */
-public IWorkbenchPage openPage(final String perspId, final IAdaptable input)
- throws WorkbenchException
-{
- Assert.isNotNull(perspId);
-
- // Run op in busy cursor.
- final Object [] result = new Object[1];
- BusyIndicator.showWhile(null, new Runnable() {
- public void run() {
- try {
- result[0] = busyOpenPage(perspId, input);
- } catch (WorkbenchException e) {
- result[0] = e;
- }
- }
- });
-
- if (result[0] instanceof IWorkbenchPage)
- return (IWorkbenchPage)result[0];
- else if (result[0] instanceof WorkbenchException)
- throw (WorkbenchException)result[0];
- else
- throw new WorkbenchException(WorkbenchMessages.getString("WorkbenchWindow.exceptionMessage")); //$NON-NLS-1$
-}
-/**
- * Opens a new page.
- * <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.openPerspective</code> APIs to
- * programmatically show a perspective.
- * </p>
- */
-public IWorkbenchPage openPage(IAdaptable input)
- throws WorkbenchException
-{
- String perspId = workbench.getPerspectiveRegistry().getDefaultPerspective();
- return openPage(perspId, input);
-}
-
-/*
- * Removes an listener from the part service.
- */
-public void removePageListener(IPageListener l) {
- pageListeners.removePageListener(l);
-}
-/*
- * Removes an listener from the perspective service.
- *
- * NOTE: Internally, please use getPerspectiveService instead.
- */
-public void removePerspectiveListener(org.eclipse.ui.IPerspectiveListener l) {
- perspectiveListeners.removePerspectiveListener(l);
-}
-/**
- * Remove the shortcut for a page.
- */
-/* package */ void removePerspectiveShortcut(IPerspectiveDescriptor perspective, WorkbenchPage page) {
- IContributionItem item = findPerspectiveShortcut(perspective, page);
- if (item != null) {
- shortcutBar.remove(item);
- shortcutBar.update(false);
- }
-}
-/**
- * Relayout the CoolBar for the workbench so that all items
- * are visible, wrapping items when necessary.
- */
-protected void resetToolBar() {
- IToolBarManager toolsMgr = getToolsManager();
- if (toolsMgr instanceof CoolBarManager) {
- CoolBarManager coolBarMgr = (CoolBarManager)toolsMgr;
- coolBarMgr.redoLayout();
- }
-}
-private IStatus unableToRestorePage(IMemento pageMem) {
- String pageName = pageMem.getString(IWorkbenchConstants.TAG_LABEL);
- if(pageName == null)
- pageName = "";
- return new Status(
- IStatus.ERROR,PlatformUI.PLUGIN_ID,0,
- WorkbenchMessages.format("WorkbenchWindow.unableToRestorePerspective",new String[]{pageName}),
- null);
-}
-/**
- * @see IPersistable.
- */
-public IStatus restoreState(IMemento memento, IPerspectiveDescriptor activeDescriptor) {
- Assert.isNotNull(getShell());
-
- MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.getString("WorkbenchWindow.problemsRestoringWindow"),null);
-
- // Read the bounds.
- if("true".equals(memento.getString("maximized"))) {//$NON-NLS-2$//$NON-NLS-1$
- getShell().setMaximized(true);
- } else {
- Integer bigInt;
- bigInt = memento.getInteger(IWorkbenchConstants.TAG_X);
- int x = bigInt.intValue();
- bigInt = memento.getInteger(IWorkbenchConstants.TAG_Y);
- int y = bigInt.intValue();
- bigInt = memento.getInteger(IWorkbenchConstants.TAG_WIDTH);
- int width = bigInt.intValue();
- bigInt = memento.getInteger(IWorkbenchConstants.TAG_HEIGHT);
- int height = bigInt.intValue();
- // Set the bounds.
- getShell().setBounds(x, y, width, height);
- }
-
- // Recreate toolbar layout locked state.
- Integer locked = memento.getInteger(IWorkbenchConstants.TAG_TOOLBAR_LAYOUT);
- boolean state = (locked != null) && (locked.intValue() == 1);
- lockToolBar(state);
-
- // Recreate each page in the window.
- IWorkbenchPage newActivePage = null;
- IMemento [] pageArray = memento.getChildren(IWorkbenchConstants.TAG_PAGE);
- for (int i = 0; i < pageArray.length; i ++) {
- IMemento pageMem = pageArray[i];
-
- // Get the input factory.
- IMemento inputMem = pageMem.getChild(IWorkbenchConstants.TAG_INPUT);
- String factoryID = inputMem.getString(IWorkbenchConstants.TAG_FACTORY_ID);
- if (factoryID == null) {
- WorkbenchPlugin.log("Unable to restore page - no input factory ID.");//$NON-NLS-1$
- result.add(unableToRestorePage(pageMem));
- continue;
- }
- IElementFactory factory = WorkbenchPlugin.getDefault().getElementFactory(factoryID);
- if (factory == null) {
- WorkbenchPlugin.log("Unable to restore pagee - cannot instantiate input factory: " + factoryID);//$NON-NLS-1$
- result.add(unableToRestorePage(pageMem));
- continue;
- }
-
- // Get the input element.
- IAdaptable input = factory.createElement(inputMem);
- if (input == null) {
- WorkbenchPlugin.log("Unable to restore page - cannot instantiate input element: " + factoryID);//$NON-NLS-1$
- result.add(unableToRestorePage(pageMem));
- continue;
- }
-
- // Open the perspective.
- WorkbenchPage newPage = null;
- try {
- newPage = new WorkbenchPage(this, input);
- result.add(newPage.restoreState(pageMem,activeDescriptor));
- pageList.add(newPage);
- firePageOpened(newPage);
- } catch (WorkbenchException e) {
- WorkbenchPlugin.log("Unable to restore perspective - constructor failed.");//$NON-NLS-1$
- result.add(e.getStatus());
- continue;
- }
-
- // Check for focus.
- String strFocus = pageMem.getString(IWorkbenchConstants.TAG_FOCUS);
- if (strFocus != null && strFocus.length() > 0)
- newActivePage = newPage;
- }
-
- // If there are no pages create a default.
- if (pageList.isEmpty()) {
- try {
- IContainer root = WorkbenchPlugin.getPluginWorkspace().getRoot();
- String defPerspID = workbench.getPerspectiveRegistry().getDefaultPerspective();
- WorkbenchPage newPage = new WorkbenchPage(this, defPerspID, root);
- pageList.add(newPage);
- firePageOpened(newPage);
- } catch (WorkbenchException e) {
- WorkbenchPlugin.log("Unable to create default perspective - constructor failed.");//$NON-NLS-1$
- result.add(e.getStatus());
- String productName = workbench.getAboutInfo().getProductName();
- if (productName == null) {
- productName = ""; //$NON-NLS-1$
- }
- getShell().setText(productName);
- }
- }
-
- // Set active page.
- if (newActivePage == null)
- newActivePage = (IWorkbenchPage)pageList.getNextActive();
-
- setActivePage(newActivePage);
- IWorkbenchPart part = newActivePage.getActivePart();
- if(part != null)
- getKeyBindingService().update(part,true);
-
- return result;
-}
-/* (non-Javadoc)
- * Method declared on IRunnableContext.
- */
-public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- ToolBarManager shortcutBar = getShortcutBar();
- Control shortcutBarControl = null;
- if (shortcutBar != null)
- shortcutBarControl = shortcutBar.getControl();
- boolean shortcutbarWasEnabled = false;
- if (shortcutBarControl != null)
- shortcutbarWasEnabled = shortcutBarControl.isEnabled();
- try {
- if (shortcutBarControl != null && !shortcutBarControl.isDisposed())
- shortcutBarControl.setEnabled(false);
- super.run(fork, cancelable, runnable);
- } finally {
- if (shortcutBarControl != null && !shortcutBarControl.isDisposed())
- shortcutBarControl.setEnabled(shortcutbarWasEnabled);
- }
-}
-/**
- * Save all of the pages. Returns true if the operation succeeded.
- */
-private boolean saveAllPages(boolean bConfirm)
-{
- boolean bRet = true;
- Iterator enum = pageList.iterator();
- while (bRet && enum.hasNext()) {
- WorkbenchPage page = (WorkbenchPage)enum.next();
- bRet = page.saveAllEditors(bConfirm);
- }
- return bRet;
-}
-/**
- * @see IPersistable
- */
-public IStatus saveState(IMemento memento) {
-
- MultiStatus result = new MultiStatus(
- PlatformUI.PLUGIN_ID,IStatus.OK,
- WorkbenchMessages.getString("WorkbenchWindow.problemsSavingWindow"),null);
-
- // Save the bounds.
- if(getShell().getMaximized()) {
- memento.putString("maximized","true");//$NON-NLS-2$//$NON-NLS-1$
- } else {
- Rectangle bounds = getShell().getBounds();
- memento.putInteger(IWorkbenchConstants.TAG_X, bounds.x);
- memento.putInteger(IWorkbenchConstants.TAG_Y, bounds.y);
- memento.putInteger(IWorkbenchConstants.TAG_WIDTH, bounds.width);
- memento.putInteger(IWorkbenchConstants.TAG_HEIGHT, bounds.height);
- }
-
- // Save toolbar lock state.
- int state = isToolBarLocked() ? 1 : 0;
- memento.putInteger(IWorkbenchConstants.TAG_TOOLBAR_LAYOUT, state);
-
- // Save each page.
- Iterator enum = pageList.iterator();
- while (enum.hasNext()) {
- WorkbenchPage page = (WorkbenchPage)enum.next();
-
- // Get the input.
- IAdaptable input = page.getInput();
- if (input == null) {
- WorkbenchPlugin.log("Unable to save page input: " + page);//$NON-NLS-1$
- continue;
- }
- IPersistableElement persistable = (IPersistableElement)input.getAdapter(IPersistableElement.class);
- if (persistable == null) {
- WorkbenchPlugin.log("Unable to save page input: " + input);//$NON-NLS-1$
- continue;
- }
-
- // Save perspective.
- IMemento pageMem = memento.createChild(IWorkbenchConstants.TAG_PAGE);
- pageMem.putString(IWorkbenchConstants.TAG_LABEL,page.getLabel());
- result.add(page.saveState(pageMem));
-
- if (page == getActiveWorkbenchPage()) {
- pageMem.putString(IWorkbenchConstants.TAG_FOCUS, "true");//$NON-NLS-1$
- }
-
- // Save input.
- IMemento inputMem = pageMem.createChild(IWorkbenchConstants.TAG_INPUT);
- inputMem.putString(TAG_FACTORY_ID, persistable.getFactoryId());
- persistable.saveState(inputMem);
- }
- return result;
-}
-/**
- * Select the shortcut for a perspective.
- */
-/* package */ void selectPerspectiveShortcut(IPerspectiveDescriptor perspective, WorkbenchPage page, boolean selected) {
- IContributionItem item = findPerspectiveShortcut(perspective, page);
- if (item != null) {
- IAction action = ((ActionContributionItem)item).getAction();
- action.setChecked(selected);
- }
-}
-/**
- * Sets the active page within the window.
- *
- * @param page identifies the new active page.
- */
-public void setActivePage(final IWorkbenchPage in) {
- if (getActiveWorkbenchPage() == in)
- return;
-
- // 1FVGTNR: ITPUI:WINNT - busy cursor for switching perspectives
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- // Deactivate old persp.
- WorkbenchPage currentPage = getActiveWorkbenchPage();
- if (currentPage != null) {
- currentPage.onDeactivate();
- }
-
- // Activate new persp.
- if (in == null || pageList.contains(in))
- pageList.setActive(in);
- WorkbenchPage newPage = pageList.getActive();
- if (newPage != null) {
- newPage.onActivate();
- firePageActivated(newPage);
- if (newPage.getPerspective() != null)
- firePerspectiveActivated(newPage, newPage.getPerspective());
- }
-
- if(isClosing())
- return;
-
- updateDisabled = false;
-
- // Update action bars ( implicitly calls updateActionBars() )
- updateTitle();
- updateActionSets();
- shortcutBar.update(false);
- if (newPage != null && newPage.getPerspective() != null)
- newPage.setToolBarLayout();
- getMenuManager().update(IAction.TEXT);
- }
- });
-}
-/**
- * Shows the popup menu for a page item in the shortcut bar.
- */
-private void showShortcutBarPopup(MouseEvent e) {
- // Get the tool item under the mouse.
- Point pt = new Point(e.x, e.y);
- ToolBar toolBar = shortcutBar.getControl();
- ToolItem toolItem = toolBar.getItem(pt);
- if (toolItem == null)
- return;
-
- // Get the action for the tool item.
- Object data = toolItem.getData();
-
- // If the tool item is an icon for a fast view
- if (data instanceof ShowFastViewContribution) {
- // The fast view bar menu is created lazily here.
- if (fastViewBarMenu == null) {
- Menu menu = new Menu(toolBar);
- MenuItem closeItem = new MenuItem(menu, SWT.NONE);
- closeItem.setText(WorkbenchMessages.getString("WorkbenchWindow.close")); //$NON-NLS-1$
- closeItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ToolItem toolItem = (ToolItem) fastViewBarMenu.getData();
- if (toolItem != null && !toolItem.isDisposed()) {
- IViewReference ref = (IViewReference)toolItem.getData(ShowFastViewContribution.FAST_VIEW);
- getActiveWorkbenchPage().hideView(ref);
- }
- }
- });
- restoreItem = new MenuItem(menu, SWT.CHECK);
- restoreItem.setText(WorkbenchMessages.getString("WorkbenchWindow.restore")); //$NON-NLS-1$
- restoreItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ToolItem toolItem = (ToolItem) fastViewBarMenu.getData();
- if (toolItem != null && !toolItem.isDisposed()) {
- IViewReference ref = (IViewReference)toolItem.getData(ShowFastViewContribution.FAST_VIEW);
- getActiveWorkbenchPage().removeFastView(ref);
- }
- }
- });
- fastViewBarMenu = menu;
- }
- restoreItem.setSelection(true);
- fastViewBarMenu.setData(toolItem);
-
- // Show popup menu.
- if (fastViewBarMenu != null) {
- pt = toolBar.toDisplay(pt);
- fastViewBarMenu.setLocation(pt.x, pt.y);
- fastViewBarMenu.setVisible(true);
- }
- }
-
- if (!(data instanceof ActionContributionItem))
- return;
- IAction action = ((ActionContributionItem) data).getAction();
-
- // The tool item is an icon for a perspective.
- if (action instanceof SetPagePerspectiveAction) {
- // The perspective bar menu is created lazily here.
- // Its data is set (each time) to the tool item, which refers to the SetPagePerspectiveAction
- // which in turn refers to the page and perspective.
- // It is important not to refer to the action, the page or the perspective directly
- // since otherwise the menu hangs on to them after they are closed.
- // By hanging onto the tool item instead, these references are cleared when the
- // corresponding page or perspective is closed.
- // See bug 11282 for more details on why it is done this way.
- if (perspectiveBarMenu == null) {
- Menu menu = new Menu(toolBar);
- MenuItem menuItem = new MenuItem(menu, SWT.NONE);
- menuItem.setText(WorkbenchMessages.getString("WorkbenchWindow.close")); //$NON-NLS-1$
- menuItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ToolItem toolItem = (ToolItem) perspectiveBarMenu.getData();
- if (toolItem != null && !toolItem.isDisposed()) {
- ActionContributionItem item = (ActionContributionItem) toolItem.getData();
- SetPagePerspectiveAction action = (SetPagePerspectiveAction) item.getAction();
- action.getPage().closePerspective(action.getPerspective(), true);
- }
- }
- });
- menuItem = new MenuItem(menu, SWT.NONE);
- menuItem.setText(WorkbenchMessages.getString("WorkbenchWindow.closeAll")); //$NON-NLS-1$
- menuItem.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- ToolItem toolItem = (ToolItem) perspectiveBarMenu.getData();
- if (toolItem != null && !toolItem.isDisposed()) {
- ActionContributionItem item = (ActionContributionItem) toolItem.getData();
- SetPagePerspectiveAction action = (SetPagePerspectiveAction) item.getAction();
- action.getPage().closeAllPerspectives(true);
- }
- }
- });
- perspectiveBarMenu = menu;
- }
- perspectiveBarMenu.setData(toolItem);
-
- // Show popup menu.
- if (perspectiveBarMenu != null) {
- pt = toolBar.toDisplay(pt);
- perspectiveBarMenu.setLocation(pt.x, pt.y);
- perspectiveBarMenu.setVisible(true);
- }
- }
-}
-/**
- * Answer whether or not children exist for the Application WIndow's
- * toolbar control. Overridden to support CoolBars.
- * <p>
- * @return boolean true if children exist, false otherwise
- */
-protected boolean toolBarChildrenExist() {
- Control toolControl = getToolBarControl();
- if (toolControl instanceof ToolBar) {
- return ((ToolBar)toolControl).getItemCount() > 0;
- }
- if (toolControl instanceof CoolBar) {
- return ((CoolBar)toolControl).getItemCount() > 0;
- }
- return false;
-}
-/**
- * Hooks a listener to track the activation and
- * deactivation of the window's shell. Notifies
- * the active part and editor of the change
- */
-private void trackShellActivation(Shell shell) {
- shell.addShellListener(new ShellAdapter() {
- public void shellActivated(ShellEvent event) {
- shellActivated = true;
- WorkbenchPage currentPage = getActiveWorkbenchPage();
- if (currentPage != null) {
- IWorkbenchPart part = currentPage.getActivePart();
- if (part != null) {
- PartSite site = (PartSite) part.getSite();
- site.getPane().shellActivated();
- }
- IEditorPart editor = currentPage.getActiveEditor();
- if (editor != null) {
- PartSite site = (PartSite) editor.getSite();
- site.getPane().shellActivated();
- }
- workbench.fireWindowActivated(WorkbenchWindow.this);
- }
- }
- public void shellDeactivated(ShellEvent event) {
- shellActivated = false;
- WorkbenchPage currentPage = getActiveWorkbenchPage();
- if (currentPage != null) {
- IWorkbenchPart part = currentPage.getActivePart();
- if (part != null) {
- PartSite site = (PartSite) part.getSite();
- site.getPane().shellDeactivated();
- }
- IEditorPart editor = currentPage.getActiveEditor();
- if (editor != null) {
- PartSite site = (PartSite) editor.getSite();
- site.getPane().shellDeactivated();
- }
- workbench.fireWindowDeactivated(WorkbenchWindow.this);
- }
- }
- });
-}
-/**
- * update the action bars.
- */
-public void updateActionBars() {
- if (updateDisabled)
- return;
- // updateAll required in order to enable accelerators on pull-down menus
- getMenuBarManager().updateAll(false);
- getToolsManager().update(false);
- getStatusLineManager().update(false);
-}
-/**
- * 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)
- return;
-
- WorkbenchPage currentPage = getActiveWorkbenchPage();
- if (currentPage == null)
- actionPresentation.clearActionSets();
- else
- actionPresentation.setActionSets(currentPage.getActionSets());
- updateActionBars();
-
- // hide the launch menu if it is empty
- String path = IWorkbenchActionConstants.M_WINDOW + IWorkbenchActionConstants.SEP + IWorkbenchActionConstants.M_LAUNCH;
- IMenuManager manager = getMenuBarManager().findMenuUsingPath(path);
- IContributionItem item = getMenuBarManager().findUsingPath(path);
- updateActiveActions();
- if (manager == null || item == null)
- return;
- item.setVisible(manager.getItems().length >= 2); // there is a separator for the additions group thus >= 2
-}
-/**
- * Updates the shorcut item
- */
-/* package */ void updatePerspectiveShortcut(IPerspectiveDescriptor oldDesc, IPerspectiveDescriptor newDesc, WorkbenchPage page) {
- if(updateDisabled)
- return;
-
- IContributionItem item = findPerspectiveShortcut(oldDesc, page);
- if (item != null) {
- SetPagePerspectiveAction action = (SetPagePerspectiveAction)((ActionContributionItem)item).getAction();
- action.update(newDesc);
- if (page == getActiveWorkbenchPage())
- updateTitle();
- }
-}
-/**
- * Updates the window title.
- */
-public void updateTitle() {
- if(updateDisabled)
- return;
-
- String title = workbench.getAboutInfo().getProductName();
- if (title == null) {
- title = ""; //$NON-NLS-1$
- }
- if (workspaceLocation != null)
- title = WorkbenchMessages.format("WorkbenchWindow.shellTitle", new Object[] {title, workspaceLocation}); //$NON-NLS-1$
-
- WorkbenchPage currentPage = getActiveWorkbenchPage();
- if (currentPage != null) {
- IPerspectiveDescriptor persp = currentPage.getPerspective();
- String label = ""; //$NON-NLS-1$
- if (persp != null)
- label = persp.getLabel();
- IAdaptable input = currentPage.getInput();
- if((input != null) && (!input.equals(ResourcesPlugin.getWorkspace().getRoot())))
- label = currentPage.getLabel();
- if (label != null && !label.equals("")) //$NON-NLS-1$
- title = WorkbenchMessages.format("WorkbenchWindow.shellTitle", new Object[] {label, title}); //$NON-NLS-1$
- }
- getShell().setText(title);
-}
-
-class PageList {
- //List of pages in the order they were created;
- private List pageList;
- //List of pages where the top is the last activated.
- private List pageStack;
- // The page explicitly activated
- private Object active;
-
- public PageList() {
- pageList = new ArrayList(4);
- pageStack = new ArrayList(4);
- }
- public boolean add(Object object) {
- pageList.add(object);
- pageStack.add(0,object); //It will be moved to top only when activated.
- return true;
- }
- public Iterator iterator() {
- return pageList.iterator();
- }
- public boolean contains(Object object) {
- return pageList.contains(object);
- }
- public boolean remove(Object object) {
- if (active == object)
- active = null;
- pageStack.remove(object);
- return pageList.remove(object);
- }
- public boolean isEmpty() {
- return pageList.isEmpty();
- }
- public IWorkbenchPage[] getPages() {
- int nSize = pageList.size();
- IWorkbenchPage [] retArray = new IWorkbenchPage[nSize];
- pageList.toArray(retArray);
- return retArray;
- }
- public void setActive(Object page) {
- if (active == page)
- return;
-
- active = page;
-
- if (page != null) {
- pageStack.remove(page);
- pageStack.add(page);
- }
- }
- public WorkbenchPage getActive() {
- return (WorkbenchPage) active;
- }
- public WorkbenchPage getNextActive() {
- if (active == null) {
- if (pageStack.isEmpty())
- return null;
- else
- return (WorkbenchPage)pageStack.get(pageStack.size() - 1);
- } else {
- if (pageStack.size() < 2)
- return null;
- else
- return (WorkbenchPage)pageStack.get(pageStack.size() - 2);
- }
- }
-}
-}
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
deleted file mode 100644
index 97a55e6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSet.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.eclipse.ui.internal;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.*;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * 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.
- *
- * @see org.eclipse.ui.IWorkingSet
- * @since 2.0
- */
-public class WorkingSet implements IAdaptable, IPersistableElement, IWorkingSet {
- private static final String FACTORY_ID = "org.eclipse.ui.internal.WorkingSetFactory";//$NON-NLS-1$
-
- private String name;
- private ArrayList elements;
- private String editPageId;
-
- /**
- * Creates a new working set
- *
- * @param name the name of the new working set. Should not have
- * leading or trailing whitespace.
- * @param element the content of the new working set.
- * May be empty but not null.
- */
- public WorkingSet(String name, IAdaptable[] elements) {
- Assert.isNotNull(name, "name must not be null"); //$NON-NLS-1$
- this.name = name;
- internalSetElements(elements);
- }
- /**
- * Tests the receiver and the object for equality
- *
- * @param object object to compare the receiver to
- * @return true=the object equals the receiver, the name is the same.
- * false otherwise
- */
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof WorkingSet) {
- WorkingSet workingSet = (WorkingSet) object;
- String objectPageId = workingSet.getEditPageId();
- String pageId = getEditPageId();
- boolean pageIdEqual = (objectPageId == null && pageId == null) || (objectPageId != null && objectPageId.equals(pageId));
- return workingSet.getName().equals(getName()) && workingSet.elements.equals(elements) && pageIdEqual;
- }
- return false;
- }
- /**
- * 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.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkingSet.class || adapter == IPersistableElement.class) {
- return this;
- }
- return null;
- }
- /**
- * Implements IWorkingSet
- *
- * @see org.eclipse.ui.IWorkingSet#getName()
- */
- public String getName() {
- return name;
- }
- /**
- * Returns the id of the working set page that was used to
- * create the receiver.
- *
- * @return the id of the working set page.
- * @see org.eclipse.ui.dialogs.IWorkingSetPage
- */
- public String getEditPageId() {
- return editPageId;
- }
- /**
- * Implements IWorkingSet
- *
- * @see org.eclipse.ui.IWorkingSet#getElements()
- */
- public IAdaptable[] getElements() {
- return (IAdaptable[]) elements.toArray(new IAdaptable[elements.size()]);
- }
- /**
- * Implements IPersistableElement
- *
- * @see org.eclipse.ui.IPersistableElement#getFactoryId()
- */
- public String getFactoryId() {
- return FACTORY_ID;
- }
- /**
- * Returns the hash code.
- *
- * @return the hash code.
- */
- public int hashCode() {
- int hashCode = name.hashCode() & elements.hashCode();
-
- if (editPageId != null) {
- hashCode &= editPageId.hashCode();
- }
- return hashCode;
- }
- /**
- * 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 persistet.
- *
- * @see org.eclipse.ui.IPersistableElement#saveState(IMemento)
- */
- public void saveState(IMemento memento) {
- memento.putString(IWorkbenchConstants.TAG_NAME, name);
- memento.putString(IWorkbenchConstants.TAG_EDIT_PAGE_ID, editPageId);
- Iterator iterator = elements.iterator();
- while (iterator.hasNext()) {
- IAdaptable adaptable = (IAdaptable) iterator.next();
- IPersistableElement persistable = (IPersistableElement) adaptable.getAdapter(IPersistableElement.class);
- if (persistable != null) {
- IMemento itemMemento = memento.createChild(IWorkbenchConstants.TAG_ITEM);
-
- itemMemento.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable.getFactoryId());
- persistable.saveState(itemMemento);
- }
- }
- }
- /**
- * Implements IWorkingSet
- *
- * @see org.eclipse.ui.IWorkingSet#setElements(IAdaptable[])
- */
- public void setElements(IAdaptable[] newElements) {
-
- internalSetElements(newElements);
- WorkingSetManager workingSetManager = (WorkingSetManager) WorkbenchPlugin.getDefault().getWorkingSetManager();
- workingSetManager.workingSetChanged(this, IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE);
- }
- /**
- * Create a copy of the elements to store in the receiver.
- *
- * @param elements the elements to store a copy of in the
- * receiver.
- */
- private void internalSetElements(IAdaptable[] newElements) {
- Assert.isNotNull(newElements, "Working set elements array must not be null"); //$NON-NLS-1$
-
- elements = new ArrayList(newElements.length);
- for (int i = 0; i < newElements.length; i++) {
- elements.add(newElements[i]);
- }
- }
- /**
- * Sets the id of the working set page that was used to
- * create the receiver.
- *
- * @param pageId the id of the working set page.
- * @see org.eclipse.ui.dialogs.IWorkingSetPage
- */
- public void setEditPageId(String pageId) {
- editPageId = pageId;
- }
- /**
- * Implements IWorkingSet
- *
- * @see org.eclipse.ui.IWorkingSet#setName(String)
- */
- public void setName(String newName) {
-
- Assert.isNotNull(newName, "Working set name must not be null"); //$NON-NLS-1$
- name = newName;
- WorkingSetManager workingSetManager = (WorkingSetManager) WorkbenchPlugin.getDefault().getWorkingSetManager();
- workingSetManager.workingSetChanged(this, IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE);
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 073eadb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetComparator.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.ui.internal;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.text.Collator;
-import java.util.Comparator;
-
-import org.eclipse.ui.IWorkingSet;
-
-/**
- * Compares two working sets by name.
- */
-public class WorkingSetComparator implements Comparator {
- private Collator fCollator = Collator.getInstance();
-
- /**
- * Implements Comparator.
- *
- * @see Comparator#compare(Object, Object)
- */
- public int compare(Object o1, Object o2) {
- String name1 = null;
- String name2 = null;
-
- if (o1 instanceof IWorkingSet)
- name1 = ((IWorkingSet) o1).getName();
-
- if (o2 instanceof IWorkingSet)
- name2 = ((IWorkingSet) o2).getName();
-
- return fCollator.compare(name1, name2);
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 7d61348..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetFactory.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.ui.internal;
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.IElementFactory;
-import org.eclipse.ui.IMemento;
-
-/**
- * A WorkingSetFactory is used to recreate a persisted WorkingSet
- * object.
- *
- * @see IElementFactory
- */
-public class WorkingSetFactory implements IElementFactory {
-
- /**
- * Implements IElementFactory.
- *
- * @see IElementFactory#createElement(IMemento)
- */
- public IAdaptable createElement(IMemento memento) {
- String workingSetName = memento.getString(IWorkbenchConstants.TAG_NAME);
- String workingSetEditPageId = memento.getString(IWorkbenchConstants.TAG_EDIT_PAGE_ID);
-
- if (workingSetName == null)
- return null;
-
- IMemento[] itemMementos = memento.getChildren(IWorkbenchConstants.TAG_ITEM);
- Set items = new HashSet();
- for (int i = 0; i < itemMementos.length; i++) {
- IMemento itemMemento = itemMementos[i];
- 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$
- continue;
- }
- IElementFactory factory = WorkbenchPlugin.getDefault().getElementFactory(factoryID);
- if (factory == null) {
- WorkbenchPlugin.log("Unable to restore working set item - cannot instantiate factory: " + factoryID); //$NON-NLS-1$
- continue;
- }
- IAdaptable item = factory.createElement(itemMemento);
- if (item == null) {
- WorkbenchPlugin.log("Unable to restore working set item - cannot instantiate item: " + factoryID); //$NON-NLS-1$
- continue;
- }
- items.add(item);
- }
- WorkingSet workingSet = new WorkingSet(workingSetName, (IAdaptable[]) items.toArray(new IAdaptable[items.size()]));
- if (workingSetEditPageId != null) {
- workingSet.setEditPageId(workingSetEditPageId);
- }
- else {
- // working sets created with builds 20020418 and 20020419 will not
- // have an edit page id. fix this automatically.
- workingSet.setEditPageId("org.eclipse.ui.resourceWorkingSetPage");
- }
- return workingSet;
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 22f7f2e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkingSetManager.java
+++ /dev/null
@@ -1,401 +0,0 @@
-package org.eclipse.ui.internal;
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.ui.internal.dialogs.WorkingSetEditWizard;
-import org.eclipse.ui.internal.dialogs.WorkingSetSelectionDialog;
-import org.eclipse.ui.internal.registry.WorkingSetRegistry;
-
-/**
- * A working set manager stores working sets and provides property
- * change notification when a working set is added or removed.
- * Working sets are persisted whenever one is added or removed.
- *
- * @see IWorkingSetManager
- * @since 2.0
- */
-public class WorkingSetManager implements IWorkingSetManager {
- // Working set persistence
- private static final String WORKING_SET_STATE_FILENAME = "workingsets.xml"; //$NON-NLS-1$
- /**
- * Size of the list of most recently used working sets.
- */
- private static final int MRU_SIZE = 5;
-
- private SortedSet workingSets = new TreeSet(new WorkingSetComparator());
- private List recentWorkingSets = new ArrayList();
- private ListenerList propertyChangeListeners = new ListenerList();
-
- /**
- * Implements IWorkingSetManager.
- *
- * @see org.eclipse.ui.IWorkingSetManager#addRecentWorkingSet(IWorkingSet)
- */
- public void addRecentWorkingSet(IWorkingSet workingSet) {
- recentWorkingSets.remove(workingSet);
- recentWorkingSets.add(0, workingSet);
- if (recentWorkingSets.size() > MRU_SIZE) {
- recentWorkingSets.remove(MRU_SIZE);
- }
- saveState();
- }
- /**
- * Implements IWorkingSetManager.
- *
- * @see org.eclipse.ui.IWorkingSetManager#addWorkingSet(IWorkingSet)
- */
- public void addWorkingSet(IWorkingSet workingSet) {
- Assert.isTrue(!workingSets.contains(workingSet), "working set already registered"); //$NON-NLS-1$
- workingSets.add(workingSet);
- saveState();
- firePropertyChange(CHANGE_WORKING_SET_ADD, null, workingSet);
- }
- /**
- * Implements IWorkingSetManager.
- *
- * @see org.eclipse.ui.IWorkingSetManager#addPropertyChangeListener(IPropertyChangeListener)
- */
- public void addPropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.add(listener);
- }
- /**
- * Implements IWorkingSetManager.
- *
- * @see org.eclipse.ui.IWorkingSetManager#createWorkingSet(String, IAdaptable[])
- */
- public IWorkingSet createWorkingSet(String name, IAdaptable[] elements) {
- return new WorkingSet(name, elements);
- }
- /**
- * @see org.eclipse.ui.IWorkingSetManager#createWorkingSetEditWizard(org.eclipse.ui.IWorkingSet)
- * @since 2.1
- */
- public IWorkingSetEditWizard createWorkingSetEditWizard(IWorkingSet workingSet) {
- String editPageId = ((WorkingSet) workingSet).getEditPageId();
- WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
- IWorkingSetPage editPage = null;
-
- if (editPageId != null) {
- editPage = registry.getWorkingSetPage(editPageId);
- }
- if (editPage == null) {
- editPage = registry.getDefaultWorkingSetPage();
- if (editPage == null) {
- return null;
- }
- }
- WorkingSetEditWizard editWizard = new WorkingSetEditWizard(editPage);
- editWizard.setSelection(workingSet);
- return editWizard;
- }
- /**
- * @deprecated use createWorkingSetSelectionDialog(parent, true) instead
- */
- public IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parent) {
- return createWorkingSetSelectionDialog(parent, true);
- }
- /**
- * Implements IWorkingSetManager.
- *
- * @see org.eclipse.ui.IWorkingSetManager#createWorkingSetSelectionDialog(Shell, boolean)
- */
- public IWorkingSetSelectionDialog createWorkingSetSelectionDialog(Shell parent, boolean multi) {
- return new WorkingSetSelectionDialog(parent, multi);
- }
- /**
- * Tests the receiver and the object for equality
- *
- * @param object object to compare the receiver to
- * @return true=the object equals the receiver, it has the same
- * working sets. false otherwise
- */
- public boolean equals(Object object) {
- if (this == object) {
- return true;
- }
- if (object instanceof WorkingSetManager) {
- WorkingSetManager workingSetManager = (WorkingSetManager) object;
- return workingSetManager.workingSets.equals(workingSets);
- }
- return false;
- }
- /**
- * 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.
- */
- private void firePropertyChange(String changeId, Object oldValue, Object newValue) {
- final PropertyChangeEvent event = new PropertyChangeEvent(this, changeId, oldValue, newValue);
-
- Display.getDefault().syncExec(new Runnable() {
- public void run() {
- Object[] listeners = propertyChangeListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ((IPropertyChangeListener) listeners[i]).propertyChange(event);
- }
- }
- });
- }
- /**
- * Implements IWorkingSetManager.
- *
- * @see org.eclipse.ui.IWorkingSetManager#getRecentWorkingSets()
- */
- public IWorkingSet[] getRecentWorkingSets() {
- return (IWorkingSet[]) recentWorkingSets.toArray(new IWorkingSet[recentWorkingSets.size()]);
- }
- /**
- * Implements IWorkingSetManager.
- *
- * @see org.eclipse.ui.IWorkingSetManager#getWorkingSet(String)
- */
- public IWorkingSet getWorkingSet(String name) {
- if (name == null || workingSets == null)
- return null;
-
- Iterator iter = workingSets.iterator();
- while (iter.hasNext()) {
- IWorkingSet workingSet = (IWorkingSet) iter.next();
- if (name.equals(workingSet.getName()))
- return workingSet;
- }
- return null;
- }
- /**
- * Returns the hash code.
- *
- * @return the hash code.
- */
- public int hashCode() {
- return workingSets.hashCode();
- }
- /**
- * Implements IWorkingSetManager.
- *
- * @see org.eclipse.ui.IWorkingSetManager#getWorkingSets()
- */
- public IWorkingSet[] getWorkingSets() {
- return (IWorkingSet[]) workingSets.toArray(new IWorkingSet[workingSets.size()]);
- }
- /**
- * Returns the file used as the persistence store
- *
- * @return the file used as the persistence store
- */
- private File getWorkingSetStateFile() {
- IPath path = WorkbenchPlugin.getDefault().getStateLocation();
- path = path.append(WORKING_SET_STATE_FILENAME);
- return path.toFile();
- }
- /**
- * Implements IWorkingSetManager.
- *
- * @see org.eclipse.ui.IWorkingSetManager#removePropertyChangeListener(IPropertyChangeListener)
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- propertyChangeListeners.remove(listener);
- }
- /**
- * Implements IWorkingSetManager.
- *
- * @see org.eclipse.ui.IWorkingSetManager#removeWorkingSet(IWorkingSet)
- */
- public void removeWorkingSet(IWorkingSet workingSet) {
- workingSets.remove(workingSet);
- recentWorkingSets.remove(workingSet);
- saveState();
- firePropertyChange(CHANGE_WORKING_SET_REMOVE, workingSet, null);
- }
- /**
- * Restores the list of most recently used working sets from the
- * persistence store.
- *
- * @param memento the persistence store
- */
- private 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) {
- addRecentWorkingSet(workingSet);
- }
- }
- }
- }
- /**
- * Reads the persistence store and creates the working sets
- * stored in it.
- */
- public void restoreState() {
- File stateFile = getWorkingSetStateFile();
-
- if (stateFile.exists()) {
- try {
- FileInputStream input = new FileInputStream(stateFile);
- InputStreamReader reader = new InputStreamReader(input, "utf-8"); //$NON-NLS-1$
-
- IMemento memento = XMLMemento.createReadRoot(reader);
- restoreWorkingSetState(memento);
- restoreMruList(memento);
- reader.close();
- } catch (IOException e) {
- MessageDialog.openError(
- (Shell) null,
- WorkbenchMessages.getString("ProblemRestoringWorkingSetState.title"), //$NON-NLS-1$
- WorkbenchMessages.getString("ProblemRestoringWorkingSetState.message")); //$NON-NLS-1$
- } catch (WorkbenchException e) {
- ErrorDialog.openError(
- (Shell) null,
- WorkbenchMessages.getString("ProblemRestoringWorkingSetState.title"),//$NON-NLS-1$
- WorkbenchMessages.getString("ProblemRestoringWorkingSetState.message"), //$NON-NLS-1$
- e.getStatus());
- }
- }
- }
- /**
- * 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.
- */
- private IWorkingSet restoreWorkingSet(IMemento memento) {
- String factoryID = memento.getString(IWorkbenchConstants.TAG_FACTORY_ID);
-
- if (factoryID == null) {
- WorkbenchPlugin.log("Unable to restore working set - no factory ID."); //$NON-NLS-1$
- return null;
- }
- IElementFactory factory = WorkbenchPlugin.getDefault().getElementFactory(factoryID);
- if (factory == null) {
- WorkbenchPlugin.log("Unable to restore working set - cannot instantiate factory: " + factoryID); //$NON-NLS-1$
- return null;
- }
- IAdaptable adaptable = factory.createElement(memento);
- if (adaptable == null) {
- WorkbenchPlugin.log("Unable to restore working set - cannot instantiate working set: " + factoryID); //$NON-NLS-1$
- return null;
- }
- if ((adaptable instanceof IWorkingSet) == false) {
- WorkbenchPlugin.log("Unable to restore working set - element is not an IWorkingSet: " + factoryID); //$NON-NLS-1$
- return null;
- }
- return (IWorkingSet) adaptable;
- }
- /**
- * Recreates all working sets from the persistence store
- * and adds them to the receiver.
- *
- * @param memento the persistence store
- */
- private void restoreWorkingSetState(IMemento memento) {
- IMemento[] workingSets = memento.getChildren(IWorkbenchConstants.TAG_WORKING_SET);
-
- for (int i = 0; i < workingSets.length; i++) {
- IWorkingSet workingSet = restoreWorkingSet(workingSets[i]);
- if (workingSet != null) {
- addWorkingSet(workingSet);
- }
- }
- }
- /**
- * Saves the working sets in the persistence store
- */
- private void saveState() {
- XMLMemento memento = XMLMemento.createWriteRoot(IWorkbenchConstants.TAG_WORKING_SET_MANAGER);
- File stateFile = getWorkingSetStateFile();
-
- saveWorkingSetState(memento);
- saveMruList(memento);
- try {
- FileOutputStream stream = new FileOutputStream(stateFile);
- OutputStreamWriter writer = new OutputStreamWriter(stream, "utf-8"); //$NON-NLS-1$
- memento.save(writer);
- writer.close();
- } catch (IOException e) {
- stateFile.delete();
- MessageDialog.openError((Shell) null, WorkbenchMessages.getString("ProblemSavingWorkingSetState.title"), //$NON-NLS-1$
- WorkbenchMessages.getString("ProblemSavingWorkingSetState.message")); //$NON-NLS-1$
- }
- }
- /**
- * Saves the list of most recently used working sets in the persistence
- * store.
- *
- * @param memento the persistence store
- */
- private 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());
- }
- }
- /**
- * Saves all persistable working sets in the persistence store.
- *
- * @param memento the persistence store
- * @see IPersistableElement
- */
- private void saveWorkingSetState(IMemento memento) {
- Iterator iterator = workingSets.iterator();
-
- while (iterator.hasNext()) {
- IWorkingSet workingSet = (IWorkingSet) iterator.next();
- IPersistableElement persistable = null;
-
- if (workingSet instanceof IPersistableElement) {
- persistable = (IPersistableElement) workingSet;
- } else if (workingSet instanceof IAdaptable) {
- persistable = (IPersistableElement) ((IAdaptable) workingSet).getAdapter(IPersistableElement.class);
- }
- if (persistable != null) {
- IMemento workingSetMemento = memento.createChild(IWorkbenchConstants.TAG_WORKING_SET);
- workingSetMemento.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable.getFactoryId());
- persistable.saveState(workingSetMemento);
- }
- }
- }
- /**
- * 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
- */
- public void workingSetChanged(IWorkingSet changedWorkingSet, String propertyChangeId) {
- saveState();
- firePropertyChange(propertyChangeId, null, changedWorkingSet);
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index e5ca928..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutDialog.java
+++ /dev/null
@@ -1,323 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.IOException;
-import java.util.ArrayList;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.layout.RowLayout;
-import org.eclipse.swt.program.Program;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.AboutInfo;
-import org.eclipse.ui.internal.AboutItem;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.Workbench;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Displays information about the product.
- *
- * @private
- * This class is internal to the workbench and must not be called outside the workbench
- */
-public class AboutDialog extends ProductInfoDialog {
- private Image image; //image to display on dialog
- private AboutInfo aboutInfo;
- private ArrayList images = new ArrayList();
- private StyledText text;
- private final static int MAX_IMAGE_WIDTH_FOR_TEXT = 250;
- private final static int FEATURES_ID = IDialogConstants.CLIENT_ID + 1;
- private final static int PLUGINS_ID = IDialogConstants.CLIENT_ID + 2;
- private final static int INFO_ID = IDialogConstants.CLIENT_ID + 3;
-
-/**
- * Create an instance of the AboutDialog
- */
-public AboutDialog(Shell parentShell) {
- super(parentShell);
- Workbench workbench = (Workbench)PlatformUI.getWorkbench();
- aboutInfo = workbench.getAboutInfo();
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void buttonPressed(int buttonId) {
- switch (buttonId) {
- case FEATURES_ID : {
- new AboutFeaturesDialog(getShell()).open();
- return;
- }
- case PLUGINS_ID : {
- new AboutPluginsDialog(getShell()).open();
- return;
- }
- case INFO_ID : {
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- ((Workbench)PlatformUI.getWorkbench()).openSystemSummaryEditor();
- }
- });
- close();
- return;
- }
- }
- super.buttonPressed(buttonId);
-}
-
-public boolean close() {
- //get rid of the image that was displayed on the left-hand side of the Welcome dialog
- if (image != null)
- image.dispose();
- for (int i = 0; i < images.size(); i++) {
- ((Image)images.get(i)).dispose();
- }
- return super.close();
-}
-/* (non-Javadoc)
- * Method declared on Window.
- */
-protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- String name = aboutInfo.getProductName();
- if (name != null)
- newShell.setText(WorkbenchMessages.format("AboutDialog.shellTitle", new Object[] {name})); //$NON-NLS-1$
- WorkbenchHelp.setHelp(newShell, IHelpContextIds.ABOUT_DIALOG);
-}
-/**
- * Add buttons to the dialog's button bar.
- *
- * Subclasses should override.
- *
- * @param parent the button bar composite
- */
-protected void createButtonsForButtonBar(Composite parent) {
- parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- createButton(parent, FEATURES_ID, WorkbenchMessages.getString("AboutDialog.featureInfo"), false);
- createButton(parent, PLUGINS_ID, WorkbenchMessages.getString("AboutDialog.pluginInfo"), false);
- createButton(parent, INFO_ID, WorkbenchMessages.getString("AboutDialog.systemInfo"), 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.OK_LABEL, true);
- b.setFocus();
-}
-/**
- * Creates and returns the contents of the upper part
- * of the dialog (above the button bar).
- *
- * Subclasses should overide.
- *
- * @param the parent composite to contain the dialog area
- * @return the dialog area control
- */
-protected Control createDialogArea(Composite parent) {
- setHandCursor(new Cursor(parent.getDisplay(), SWT.CURSOR_HAND));
- setBusyCursor(new Cursor(parent.getDisplay(), SWT.CURSOR_WAIT));
- getShell().addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (getHandCursor() != null)
- getHandCursor().dispose();
- if (getBusyCursor() != null)
- getBusyCursor().dispose();
- }
- });
-
- ImageDescriptor imageDescriptor = aboutInfo.getAboutImage(); // may be null
- if (imageDescriptor != null)
- image = imageDescriptor.createImage();
- if (image == null || image.getBounds().width <= MAX_IMAGE_WIDTH_FOR_TEXT) {
- // show text
- String aboutText = aboutInfo.getAboutText();
- if (aboutText != null) {
- // get an about item
- setItem(scan(aboutText));
- }
- }
-
- // page group
- Composite outer = (Composite)super.createDialogArea(parent);
- outer.setSize(outer.computeSize(SWT.DEFAULT, SWT.DEFAULT));
- GridLayout layout = new GridLayout();
- outer.setLayout(layout);
- outer.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // the image & text
- Composite topContainer = new Composite(outer, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = (image == null || getItem() == null ? 1 : 2);
- layout.marginWidth = 0;
- topContainer.setLayout(layout);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- topContainer.setLayoutData(data);
-
- //image on left side of dialog
- if (image != null) {
- Label imageLabel = new Label(topContainer, SWT.NONE);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.BEGINNING;
- data.grabExcessHorizontalSpace = false;
- imageLabel.setLayoutData(data);
- imageLabel.setImage(image);
- }
-
- if (getItem() != null) {
- // text on the right
- text = new StyledText(topContainer, SWT.MULTI | SWT.READ_ONLY);
- text.setCaret(null);
- text.setFont(parent.getFont());
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.BEGINNING;
- data.grabExcessHorizontalSpace = true;
- text.setText(getItem().getText());
- text.setLayoutData(data);
- text.setCursor(null);
- text.setBackground(topContainer.getBackground());
- setLinkRanges(text, getItem().getLinkRanges());
- addListeners(text);
- }
-
- // horizontal bar
- Label bar = new Label(outer, SWT.HORIZONTAL | SWT.SEPARATOR);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- bar.setLayoutData(data);
-
- // feature images
- Composite featureContainer = new Composite(outer, SWT.NONE);
- RowLayout rowLayout = new RowLayout();
- rowLayout.wrap = true;
- featureContainer.setLayout(rowLayout);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- featureContainer.setLayoutData(data);
-
- final AboutInfo[] infoArray = getFeaturesInfo();
- for (int i = 0; i < infoArray.length; i++) {
- ImageDescriptor desc = infoArray[i].getFeatureImage();
- Image image = null;
- if (desc != null) {
- Button button = new Button(featureContainer, SWT.FLAT | SWT.PUSH);
- button.setData(infoArray[i]);
- image = desc.createImage();
- images.add(image);
- button.setImage(image);
- String name = infoArray[i].getProviderName();
- if (name == null)
- name = "";
- button.setToolTipText(name);
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- AboutFeaturesDialog d = new AboutFeaturesDialog(getShell());
- d.setInitialSelection((AboutInfo)event.widget.getData());
- d.open();
- }
- });
- }
- }
-
- // spacer
- bar = new Label(outer, SWT.NONE);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- bar.setLayoutData(data);
-
- return outer;
-}
-
-
-/**
- * Returns the feature infos.
- * They are grouped by provider and image.
- */
-private AboutInfo[] getFeaturesInfo() {
- AboutInfo[] rawArray = ((Workbench)PlatformUI.getWorkbench()).getFeaturesInfo();
- // quickly exclude any that do not have a provider name and image
- ArrayList infoList = new ArrayList();
- for (int i = 0; i < rawArray.length; i++) {
- if (rawArray[i].getProviderName() != null &&
- rawArray[i].getFeatureImageName() != null)
- infoList.add(rawArray[i]);
- }
- AboutInfo[] infoArray = (AboutInfo[])infoList.toArray(new AboutInfo[infoList.size()]);
-
- // now exclude those with duplicate images
- infoList = new ArrayList();
- for (int i = 0; i < infoArray.length; i++) {
- // check for identical provider
- boolean add = true;
- for (int j = 0; j < infoList.size(); j++) {
- AboutInfo current = (AboutInfo)infoList.get(j);
- if (current.getProviderName().equals(infoArray[i].getProviderName())) {
- // check for identical image
- if (current.getFeatureImageName().equals(infoArray[i].getFeatureImageName())) {
- // same name
- // we have to check if the CRC's are identical
- Long crc1 = current.getFeatureImageCRC();
- Long crc2 = infoArray[i].getFeatureImageCRC();
- if (crc1 == null ? false : crc1.equals(crc2)) {
- // duplicate
- add = false;
- break;
- }
- }
- }
- }
- if (add)
- infoList.add(infoArray[i]);
- }
- infoList.remove(aboutInfo);
- return (AboutInfo[])infoList.toArray(new AboutInfo[infoList.size()]);
-}
-
-
-/**
- * Answer the product text to show on the right side of the dialog.
- */
-private String getAboutText() {
- return aboutInfo.getAboutText();
-}
-
-}
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
deleted file mode 100644
index 9a2383a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutFeaturesDialog.java
+++ /dev/null
@@ -1,727 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.IOException;
-import java.net.URL;
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Locale;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.program.Program;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.AboutInfo;
-import org.eclipse.ui.internal.AboutItem;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.Workbench;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.update.configuration.IConfiguredSite;
-import org.eclipse.update.configuration.IInstallConfiguration;
-import org.eclipse.update.configuration.ILocalSite;
-import org.eclipse.update.core.IFeature;
-import org.eclipse.update.core.IFeatureReference;
-import org.eclipse.update.core.IPluginEntry;
-import org.eclipse.update.core.IURLEntry;
-import org.eclipse.update.core.SiteManager;
-import org.eclipse.update.core.VersionedIdentifier;
-
-/**
- * Displays information about the product plugins.
- *
- * @private
- * This class is internal to the workbench and must not be called outside the workbench
- */
-public class AboutFeaturesDialog extends ProductInfoDialog {
-
- /**
- * Table height in dialog units (value 150).
- */
- private static final int TABLE_HEIGHT = 150;
- private static final int INFO_HEIGHT = 100;
-
- private final static int MORE_ID = IDialogConstants.CLIENT_ID + 1;
- private final static int PLUGINS_ID = IDialogConstants.CLIENT_ID + 2;
-
- private Table table;
- private Label imageLabel;
- private StyledText text;
- private Composite infoArea;
-
- private Map cachedImages = new HashMap();
-
- private String columnTitles[] =
- { WorkbenchMessages.getString("AboutFeaturesDialog.provider"), //$NON-NLS-1$
- WorkbenchMessages.getString("AboutFeaturesDialog.featureName"), //$NON-NLS-1$
- WorkbenchMessages.getString("AboutFeaturesDialog.version"), //$NON-NLS-1$
- };
-
- private AboutInfo[] featuresInfo;
- private AboutInfo aboutInfo;
-
- private int lastColumnChosen = 0; // initially sort by provider
- private boolean reverseSort = false; // initially sort ascending
- private AboutInfo lastSelection = null;
- private Button moreButton;
- private Button pluginsButton;
-
- private static Map featuresMap;
-
- /**
- * Constructor for AboutFeaturesDialog
- */
- public AboutFeaturesDialog(Shell parentShell) {
- super(parentShell);
- Workbench workbench = (Workbench)PlatformUI.getWorkbench();
- aboutInfo = workbench.getAboutInfo();
- featuresInfo = workbench.getFeaturesInfo();
- sortByProvider();
- }
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void buttonPressed(int buttonId) {
- switch (buttonId) {
- case MORE_ID : {
- TableItem[] items = table.getSelection();
- if (items.length > 0) {
- AboutInfo info = (AboutInfo)items[0].getData();
- IFeature feature = getFeatureFor(info);
- if (feature != null) {
- IURLEntry entry = feature.getLicense();
- if (entry != null) {
- openLink(entry.getURL().toString());
- return;
- }
- }
- MessageDialog.openInformation(
- getShell(),
- WorkbenchMessages.getString("AboutFeaturesDialog.noInfoTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("AboutFeaturesDialog.noInformation")); //$NON-NLS-1$
- }
- return;
- }
- case PLUGINS_ID : {
- TableItem[] items = table.getSelection();
- if (items.length > 0) {
- AboutInfo info = (AboutInfo)items[0].getData();
- IFeature feature = getFeatureFor(info);
- IPluginDescriptor[] descriptors;
- if (feature == null)
- descriptors = new IPluginDescriptor[0];
- else
- descriptors = getPluginsFor(feature);
- AboutPluginsDialog d =
- new AboutPluginsDialog(
- getShell(),
- descriptors,
- WorkbenchMessages.getString("AboutFeaturesDialog.pluginInfoTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("AboutFeaturesDialog.pluginInfoMessage", new Object[] {info.getFeatureLabel()})); //$NON-NLS-1$
- d.open();
- }
- return;
- }
- }
- super.buttonPressed(buttonId);
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- String title = aboutInfo.getProductName();
- if (title != null) {
- newShell.setText(
- WorkbenchMessages.format(
- "AboutFeaturesDialog.shellTitle", //$NON-NLS-1$
- new Object[] {title}));
- }
- WorkbenchHelp.setHelp(
- newShell,
- IHelpContextIds.ABOUT_FEATURES_DIALOG);
- }
- /**
- * Add buttons to the dialog's button bar.
- *
- * Subclasses should override.
- *
- * @param parent the button bar composite
- */
- protected void createButtonsForButtonBar(Composite parent) {
- parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- moreButton = createButton(parent, MORE_ID, WorkbenchMessages.getString("AboutFeaturesDialog.moreInfo"), false);
- pluginsButton = createButton(parent, PLUGINS_ID, WorkbenchMessages.getString("AboutFeaturesDialog.pluginsInfo"), 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.OK_LABEL, true);
- b.setFocus();
-
- TableItem[] items = table.getSelection();
- if (items.length > 0)
- updateButtons((AboutInfo)items[0].getData());
- }
-
- /**
- * Create the contents of the dialog (above the button bar).
- *
- * Subclasses should overide.
- *
- * @param the parent composite to contain the dialog area
- * @return the dialog area control
- */
- protected Control createDialogArea(Composite parent) {
- setHandCursor(new Cursor(parent.getDisplay(), SWT.CURSOR_HAND));
- setBusyCursor(new Cursor(parent.getDisplay(), SWT.CURSOR_WAIT));
- getShell().addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (getHandCursor() != null)
- getHandCursor().dispose();
- if (getBusyCursor() != null)
- getBusyCursor().dispose();
- }
- });
-
- Composite outer = (Composite) super.createDialogArea(parent);
-
- createTable(outer);
- createColumns();
- createInfoArea(outer);
-
- GridData gridData =
- new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- gridData.grabExcessVerticalSpace = true;
- gridData.grabExcessHorizontalSpace = true;
-
- // suggest a height for the table
- gridData.heightHint = convertVerticalDLUsToPixels(TABLE_HEIGHT);
- table.setLayoutData(gridData);
-
- return outer;
- }
- /**
- * Create the info area containing the image and text
- */
- protected void createInfoArea(Composite parent) {
- infoArea = new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.numColumns = 2;
- infoArea.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.heightHint = convertVerticalDLUsToPixels(INFO_HEIGHT);
- infoArea.setLayoutData(data);
-
- imageLabel = new Label(infoArea, SWT.NONE);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.BEGINNING;
- data.heightHint = 32;
- data.widthHint = 32;
- imageLabel.setLayoutData(data);
-
- // text on the right
- text = new StyledText(infoArea, SWT.MULTI | SWT.READ_ONLY);
- text.setCaret(null);
- text.setFont(parent.getFont());
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.BEGINNING;
- data.grabExcessHorizontalSpace = true;
- text.setLayoutData(data);
- text.setCursor(null);
- text.setBackground(infoArea.getBackground());
- addListeners(text);
-
- TableItem[] items = table.getSelection();
- if (items.length > 0)
- updateInfoArea((AboutInfo)items[0].getData());
- }
-
- /**
- * Create the table part of the dialog.
- *
- * @param the parent composite to contain the dialog area
- */
- protected void createTable(Composite parent) {
- table =
- new Table(
- parent,
- SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
- table.setHeaderVisible(true);
- table.setLinesVisible(true);
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- AboutInfo info = (AboutInfo)e.item.getData();
- updateInfoArea(info);
- updateButtons(info);
- }
- };
- table.addSelectionListener(listener);
- }
- /**
- * @see Window#close()
- */
- public boolean close() {
- Collection values = cachedImages.values();
- for (Iterator iter = values.iterator(); iter.hasNext();) {
- Image image = (Image) iter.next();
- image.dispose();
- }
- return super.close();
- }
- /**
- * Returns a mapping from feature id to feature
- */
- private Map getFeaturesMap() {
- if (featuresMap != null)
- return featuresMap;
-
- featuresMap = new HashMap();
-
- IPluginRegistry reg = Platform.getPluginRegistry();
- if (reg == null) {
- MessageDialog.openError(
- getShell(),
- WorkbenchMessages.getString("AboutFeaturesDialog.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("AboutFeaturesDialog.unableToObtainFeatureInfo")); //$NON-NLS-1$
- return featuresMap;
- }
-
- final ILocalSite[] localSiteArray = new ILocalSite[1];
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- // this may take a few seconds
- try {
- localSiteArray[0] = SiteManager.getLocalSite();
- } catch (CoreException e) {
- MessageDialog.openError(
- getShell(),
- WorkbenchMessages.getString("AboutFeaturesDialog.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("AboutFeaturesDialog.unableToObtainFeatureInfo")); //$NON-NLS-1$
- }
- }
- });
- if (localSiteArray[0] == null)
- return featuresMap;
-
- IInstallConfiguration installConfiguration = localSiteArray[0].getCurrentConfiguration();
- IConfiguredSite[] configuredSites = installConfiguration.getConfiguredSites();
-
- for (int i = 0; i < configuredSites.length; i++) {
- IFeatureReference[] featureReferences = configuredSites[i].getConfiguredFeatures();
- for (int j = 0; j < featureReferences.length; j++) {
- IFeature feature;
- try {
- feature = featureReferences[j].getFeature();
- } catch (CoreException e) {
- // just skip it
- break;
- }
- String key = feature.getVersionedIdentifier().toString();
- featuresMap.put(key, feature);
- }
- }
- return featuresMap;
- }
-
- /**
- * Return the feature for the given info
- */
- private IFeature getFeatureFor(AboutInfo info) {
- Map map = getFeaturesMap();
- if (map == null)
- return null;
- String key = info.getFeatureId() + "_" + info.getVersion();
- return (IFeature)map.get(key);
- }
-
-
- /**
- * Return the plugins for the given feature
- */
- private IPluginDescriptor[] getPluginsFor(IFeature feature) {
- IPluginRegistry reg = Platform.getPluginRegistry();
- if (reg == null)
- return new IPluginDescriptor[0];
- IPluginEntry[] pluginEntries = feature.getPluginEntries();
- ArrayList plugins = new ArrayList();
- for (int k = 0; k < pluginEntries.length; k++) {
- VersionedIdentifier id = pluginEntries[k].getVersionedIdentifier();
-
- IPluginDescriptor desc = reg.getPluginDescriptor(id.getIdentifier(), id.getVersion());
- if (desc != null)
- plugins.add(desc);
- }
- return (IPluginDescriptor[])plugins.toArray(new IPluginDescriptor[plugins.size()]);
- }
-
-
-
- /**
- * Update the button enablement
- */
- private void updateButtons(AboutInfo info) {
- if (info == null) {
- moreButton.setEnabled(false);
- pluginsButton.setEnabled(false);
- return;
- }
- boolean shouldEnable = true; // by default enable
- // Avoid creating the map just to determine enablement
- if (featuresMap != null) {
- IFeature feature = getFeatureFor(info);
- shouldEnable = feature != null && feature.getLicense() != null;
- }
- moreButton.setEnabled(shouldEnable);
-
- // Assume there is at least one plugin
- shouldEnable = true; // by default enable
- if (featuresMap != null) {
- IFeature feature = getFeatureFor(info);
- shouldEnable = feature != null;
- }
- pluginsButton.setEnabled(shouldEnable);
- }
-
- /**
- * Update the info area
- */
- private void updateInfoArea(AboutInfo info) {
- if (info == null) {
- imageLabel.setImage(null);
- text.setText(""); //$NON-NLS-1$
- return;
- }
- ImageDescriptor desc = info.getFeatureImage();
- Image image = (Image)cachedImages.get(desc);
- if (image == null && desc != null) {
- image = desc.createImage();
- cachedImages.put(desc, image);
- }
- imageLabel.setImage(image);
- String aboutText = info.getAboutText();
- setItem(null);
- if (aboutText != null) {
- // get an about item
- setItem(scan(aboutText));
- }
- if (getItem() == null)
- text.setText(WorkbenchMessages.getString("AboutFeaturesDialog.noInformation"));
- else {
- text.setText(getItem().getText());
- text.setCursor(null);
- setLinkRanges(text, getItem().getLinkRanges());
- }
- }
-
- /**
- * Select the initial selection
- *
- */
- public void setInitialSelection(AboutInfo info) {
- lastSelection = info;
- }
-
- /**
- * Populate the table with plugin info obtained from the registry.
- *
- * @param the parent composite to contain the dialog area
- */
- protected void createColumns() {
- /* create table headers */
- int[] columnWidths =
- {
- convertHorizontalDLUsToPixels(125),
- convertHorizontalDLUsToPixels(190),
- convertHorizontalDLUsToPixels(110)};
- for (int i = 0; i < columnTitles.length; i++) {
- TableColumn tableColumn = new TableColumn(table, SWT.NULL);
- tableColumn.setWidth(columnWidths[i]);
- tableColumn.setText(columnTitles[i]);
- final int columnIndex = i;
- tableColumn.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- sort(columnIndex);
- }
- });
-
- }
-
- int initialSelectionIndex = 0;
- /* fill each row of the table with feature info */
- for (int i = 0; i < featuresInfo.length; i++) {
- if (featuresInfo[i] == lastSelection)
- initialSelectionIndex = i;
- String provider = featuresInfo[i].getProviderName();
- String featureName = featuresInfo[i].getFeatureLabel();
- String version = featuresInfo[i].getVersion();
- if (provider == null)
- provider = "";
- if (featureName == null)
- featureName = "";
- if (version == null)
- version = "";
- String[] row = { provider, featureName, version };
- TableItem item = new TableItem(table, SWT.NULL);
- item.setText(row);
- item.setData(featuresInfo[i]);
- }
-
- // set initial selection
- if (featuresInfo.length > 0) {
- table.setSelection(initialSelectionIndex);
- }
- }
-
-
- /**
- * Sort the rows of the table based on the selected column.
- *
- * @param column index of table column selected as sort criteria
- */
- private void sort(int column) {
- // Choose new sort algorithm
- if (lastColumnChosen == column){
- reverseSort = !reverseSort;
- }
- else{
- reverseSort = false;
- lastColumnChosen = column;
- }
-
- if(table.getItemCount() <= 1) return;
-
- // Remember the last selection
- int idx = table.getSelectionIndex();
- if (idx != -1)
- lastSelection = featuresInfo[idx];
-
- switch (column){
- case 0:
- sortByProvider();
- break;
- case 1:
- sortByName();
- break;
- case 2:
- sortByVersion();
- break;
- }
-
- refreshTable(column);
- }
-
- /**
- * Refresh the rows of the table based on the selected column.
- * Maintain selection from before sort action request.
- *
- * @param items the old state table items
- */
- private void refreshTable(int col){
- TableItem[] items = table.getItems();
- int idx = -1; // the new index of the selection
- // Create new order of table items
- for(int i = 0; i < items.length; i++) {
- String provider = featuresInfo[i].getProviderName();
- String featureName = featuresInfo[i].getFeatureLabel();
- String version = featuresInfo[i].getVersion();
- if (provider == null)
- provider = "";
- if (featureName == null)
- featureName = "";
- if (version == null)
- version = "";
- String[] row = { provider, featureName, version };
- items[i].setText(row);
- items[i].setData(featuresInfo[i]);
- }
- // Maintain the original selection
- if (lastSelection != null){
- for (int k = 0; k < featuresInfo.length; k++){
- if (lastSelection == featuresInfo[k])
- idx = k;
- }
- table.setSelection(idx);
- table.showSelection();
- }
-
- updateInfoArea(lastSelection);
- }
- /**
- * Sort the rows of the table based on the plugin provider.
- * Secondary criteria is unique plugin id.
- */
- private void sortByProvider(){
- /* If sorting in reverse, info array is already sorted forward by
- * key so the info array simply needs to be reversed.
- */
- if (reverseSort){
- java.util.List infoList = Arrays.asList(featuresInfo);
- Collections.reverse(infoList);
- for (int i=0; i< featuresInfo.length; i++){
- featuresInfo[i] = (AboutInfo)infoList.get(i);
- }
- }
- else {
- // Sort ascending
- Arrays.sort(featuresInfo, new Comparator() {
- Collator coll = Collator.getInstance(Locale.getDefault());
- public int compare(Object a, Object b) {
- AboutInfo i1, i2;
- String provider1, provider2, name1, name2;
- i1 = (AboutInfo)a;
- provider1 = i1.getProviderName();
- name1 = i1.getFeatureLabel();
- if (provider1 == null)
- provider1 = "";
- if (name1 == null)
- name1 = "";
- i2 = (AboutInfo)b;
- provider2 = i2.getProviderName();
- name2 = i2.getFeatureLabel();
- if (provider2 == null)
- provider2 = "";
- if (name2 == null)
- name2 = "";
- if (provider1.equals(provider2))
- return coll.compare(name1, name2);
- else
- return coll.compare(provider1, provider2);
- }
- });
- }
- }
- /**
- * Sort the rows of the table based on unique plugin id.
- */
- private void sortByName(){
- /* If sorting in reverse, info array is already sorted forward by
- * key so the info array simply needs to be reversed.
- */
- if (reverseSort){
- java.util.List infoList = Arrays.asList(featuresInfo);
- Collections.reverse(infoList);
- for (int i=0; i< featuresInfo.length; i++){
- featuresInfo[i] = (AboutInfo)infoList.get(i);
- }
- }
- else {
- // Sort ascending
- Arrays.sort(featuresInfo, new Comparator() {
- Collator coll = Collator.getInstance(Locale.getDefault());
- public int compare(Object a, Object b) {
- AboutInfo i1, i2;
- String name1, name2;
- i1 = (AboutInfo)a;
- name1 = i1.getFeatureLabel();
- i2 = (AboutInfo)b;
- name2 = i2.getFeatureLabel();
- if (name1 == null)
- name1 = "";
- if (name2 == null)
- name2 = "";
- return coll.compare(name1, name2);
- }
- });
- }
-
- }
- /**
- * Sort the rows of the table based on the plugin version.
- * Secondary criteria is unique plugin id.
- */
- private void sortByVersion(){
- /* If sorting in reverse, info array is already sorted forward by
- * key so the info array simply needs to be reversed.
- */
- if (reverseSort){
- java.util.List infoList = Arrays.asList(featuresInfo);
- Collections.reverse(infoList);
- for (int i=0; i< featuresInfo.length; i++){
- featuresInfo[i] = (AboutInfo)infoList.get(i);
- }
- }
- else {
- // Sort ascending
- Arrays.sort(featuresInfo, new Comparator() {
- Collator coll = Collator.getInstance(Locale.getDefault());
- public int compare(Object a, Object b) {
- AboutInfo i1, i2;
- String version1, version2, name1, name2;
- i1 = (AboutInfo)a;
- version1 = i1.getVersion();
- name1 = i1.getFeatureLabel();
- if (version1 == null)
- version1 = "";
- if (name1 == null)
- name1 = "";
- i2 = (AboutInfo)b;
- version2 = i2.getVersion();
- name2 = i2.getFeatureLabel();
- if (version2 == null)
- version2 = "";
- if (name2 == null)
- name2 = "";
- if (version1.equals(version2))
- return coll.compare(name1, name2);
- else
- return coll.compare(version1, version2);
- }
- });
- }
- }
-
- }
\ No newline at end of file
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
deleted file mode 100644
index f7ae894..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/AboutPluginsDialog.java
+++ /dev/null
@@ -1,479 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.IOException;
-import java.net.URL;
-import java.text.Collator;
-import java.util.*;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.program.Program;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-
-/**
- * Displays information about the product plugins.
- *
- * @private
- * This class is internal to the workbench and must not be called outside the workbench
- */
-public class AboutPluginsDialog extends ProductInfoDialog {
-
- /**
- * Table height in dialog units (value 200).
- */
- private static final int TABLE_HEIGHT = 200;
-
- private static final String PLUGININFO = "about.html"; //$NON-NLS-1$
-
- private final static int MORE_ID = IDialogConstants.CLIENT_ID + 1;
-
- private boolean webBrowserOpened = false;
-
- private Table vendorInfo;
- private Button moreInfo;
-
- private String title;
- private String message;
-
- private String columnTitles[] =
- { WorkbenchMessages.getString("AboutPluginsDialog.provider"), //$NON-NLS-1$
- WorkbenchMessages.getString("AboutPluginsDialog.pluginName"), //$NON-NLS-1$
- WorkbenchMessages.getString("AboutPluginsDialog.version"), //$NON-NLS-1$
- };
-
- private IPluginDescriptor[] info;
-
- private AboutInfo aboutInfo;
-
- private int lastColumnChosen = 0; // initially sort by provider
- private boolean reverseSort = false; // initially sort ascending
- private IPluginDescriptor lastSelection = null;
-
- /**
- * Constructor for AboutPluginsDialog
- */
- public AboutPluginsDialog(Shell parentShell) {
- this(
- parentShell,
- Platform.getPluginRegistry().getPluginDescriptors(),
- null,
- null);
- }
-
- /**
- * Constructor for AboutPluginsDialog
- */
- public AboutPluginsDialog(Shell parentShell, IPluginDescriptor[] descriptors, String title, String msg) {
- super(parentShell);
- info = descriptors;
- this.title = title;
- message = msg;
- sortByProvider();
- aboutInfo = ((Workbench) PlatformUI.getWorkbench()).getAboutInfo();
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void buttonPressed(int buttonId) {
- switch (buttonId) {
- case MORE_ID : {
- handleMoreInfoPressed();
- return;
- }
- }
- super.buttonPressed(buttonId);
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- if (title == null) {
- title = aboutInfo.getProductName();
- if (title != null) {
- title = WorkbenchMessages.format(
- "AboutPluginsDialog.shellTitle", //$NON-NLS-1$
- new Object[] {title});
- }
- }
- if (title != null)
- newShell.setText(title);
-
- WorkbenchHelp.setHelp(
- newShell,
- IHelpContextIds.ABOUT_PLUGINS_DIALOG);
- }
- /**
- * Add buttons to the dialog's button bar.
- *
- * Subclasses should override.
- *
- * @param parent the button bar composite
- */
- protected void createButtonsForButtonBar(Composite parent) {
- parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- moreInfo = createButton(parent, MORE_ID, WorkbenchMessages.getString("AboutPluginsDialog.moreInfo"), false); //$NON-NLS-1$
-
- // set initial enablement
- moreInfo.setEnabled(tableHasSelection() & selectionHasInfo());
-
- Label l = new Label(parent, SWT.NONE);
- l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout layout = (GridLayout)parent.getLayout();
- layout.numColumns++;
- layout.makeColumnsEqualWidth = false;
-
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- }
-
-
- /**
- * Create the contents of the dialog (above the button bar).
- *
- * Subclasses should overide.
- *
- * @param the parent composite to contain the dialog area
- * @return the dialog area control
- */
- protected Control createDialogArea(Composite parent) {
-
- Composite outer = (Composite) super.createDialogArea(parent);
-
- if (message != null) {
- Label label = new Label(outer, SWT.NONE);
- label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- label.setText(message);
- }
-
- createTable(outer);
- createColumns();
-
- GridData gridData =
- new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL);
- gridData.grabExcessVerticalSpace = true;
- gridData.grabExcessHorizontalSpace = true;
-
- // suggest a height for the table
- gridData.heightHint = convertVerticalDLUsToPixels(TABLE_HEIGHT);
- vendorInfo.setLayoutData(gridData);
-
- return outer;
- }
- /**
- * Create the table part of the dialog.
- *
- * @param the parent composite to contain the dialog area
- */
- protected void createTable(Composite parent) {
- vendorInfo =
- new Table(
- parent,
- SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER);
- vendorInfo.setHeaderVisible(true);
- vendorInfo.setLinesVisible(true);
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setMoreButtonEnablement(e.item != null);
- }
- };
- vendorInfo.addSelectionListener(listener);
- }
- /**
- * Populate the table with plugin info obtained from the registry.
- *
- * @param the parent composite to contain the dialog area
- */
- protected void createColumns() {
- /* create table headers */
- int[] columnWidths =
- {
- convertHorizontalDLUsToPixels(120),
- convertHorizontalDLUsToPixels(180),
- convertHorizontalDLUsToPixels(105)};
- for (int i = 0; i < columnTitles.length; i++) {
- TableColumn tableColumn = new TableColumn(vendorInfo, SWT.NULL);
- tableColumn.setWidth(columnWidths[i]);
- tableColumn.setText(columnTitles[i]);
- final int columnIndex = i;
- tableColumn.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- sort(columnIndex);
- }
- });
-
- }
-
- /* fill each row of the table with plugin registry info */
- for (int i = 0; i < info.length; i++) {
- String provider = info[i].getProviderName();
- String pluginName = info[i].getLabel();
- String version = info[i].getVersionIdentifier().toString();
- String[] row = { provider, pluginName, version };
- TableItem item = new TableItem(vendorInfo, SWT.NULL);
- item.setText(row);
- }
- }
- /**
- * Set enablement of moreInfo button based on whether or not
- * there is a selection in the table and if there is any additional
- * info to show for that plugin.
- *
- * @param isSelected whether there is a selection in the table
- */
- protected void setMoreButtonEnablement(boolean isSelected) {
- moreInfo.setEnabled(isSelected && selectionHasInfo());
- }
-
- /**
- * Check if the currently selected plugin has additional
- * information to show.
- *
- * @return true if the selected plugin has additional info available to display
- */
- private boolean selectionHasInfo(){
- TableItem[] items = vendorInfo.getSelection();
- if (items.length == 0)
- return false;
- int i = vendorInfo.getSelectionIndex();
- IPluginDescriptor desc = info[i];
- URL infoURL = desc.find(new Path(PLUGININFO));
- if (infoURL == null && WorkbenchPlugin.DEBUG) {
- // only report ini problems if the -debug command line argument is used
- WorkbenchPlugin.log("Problem reading plugin info for: " + desc.getLabel()); //$NON-NLS-1$
- }
- return infoURL != null;
- }
-
- /**
- * Create the button to provide more info on the selected plugin.
- *
- * @return true if there is an item selected in the table, false otherwise
- */
- private boolean tableHasSelection() {
- if (vendorInfo == null)
- return false;
- return (vendorInfo.getSelectionCount() > 0);
-
- }
-
- /**
- * Respond to moreInfo button pressed.
- *
- */
- protected void handleMoreInfoPressed() {
- TableItem[] items = vendorInfo.getSelection();
- if (items.length == 0)
- return;
- int i = vendorInfo.getSelectionIndex();
- IPluginDescriptor desc = info[i];
- openMoreInfo(desc);
- }
- /**
- * Open html file containing additional info about the selected
- * plugin.
- *
- */
- private void openMoreInfo(IPluginDescriptor desc) {
- URL infoURL = desc.find(new Path(PLUGININFO));
- if (infoURL == null) {
- MessageDialog.openError(
- getShell(),
- WorkbenchMessages.getString("AboutPluginsDialog.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("AboutPluginsDialog.unableToOpenFile", new Object[] {PLUGININFO, desc.getUniqueIdentifier()})); //$NON-NLS-1$
- return;
- }
-
- openLink(infoURL.toString());
- }
-
- /**
- * Sort the rows of the table based on the selected column.
- *
- * @param column index of table column selected as sort criteria
- */
- private void sort(int column) {
- // Choose new sort algorithm
- if (lastColumnChosen == column){
- reverseSort = !reverseSort;
- }
- else{
- reverseSort = false;
- lastColumnChosen = column;
- }
-
- if(vendorInfo.getItemCount() <= 1) return;
-
- // Remember the last selection
- int idx = vendorInfo.getSelectionIndex();
- if (idx != -1)
- lastSelection = info[idx];
-
- switch (column){
- case 0:
- sortByProvider();
- break;
- case 1:
- sortById();
- break;
- case 2:
- sortByVersion();
- break;
- }
-
- refreshTable(column);
- }
-
- /**
- * Refresh the rows of the table based on the selected column.
- * Maintain selection from before sort action request.
- *
- * @param items the old state table items
- */
- private void refreshTable(int col){
- TableItem[] items = vendorInfo.getItems();
- int idx = -1; // the new index of the selection
- // Create new order of table items
- for(int i = 0; i < items.length; i++) {
- String provider = info[i].getProviderName();
- String pluginName = info[i].getLabel();
- String version = info[i].getVersionIdentifier().toString();
- String [] row = { provider, pluginName, version };
- items[i].setText(row);
- }
- // Maintain the original selection
- if (lastSelection != null){
- String oldId = lastSelection.getUniqueIdentifier();
- for (int k = 0; k < info.length; k++){
- if (oldId.equalsIgnoreCase(info[k].getUniqueIdentifier()))
- idx = k;
- }
- vendorInfo.setSelection(idx);
- vendorInfo.showSelection();
- }
-
- moreInfo.setEnabled(tableHasSelection() && selectionHasInfo());
- }
- /**
- * Sort the rows of the table based on the plugin provider.
- * Secondary criteria is unique plugin id.
- */
- private void sortByProvider(){
- /* If sorting in reverse, info array is already sorted forward by
- * key so the info array simply needs to be reversed.
- */
- if (reverseSort){
- java.util.List infoList = Arrays.asList(info);
- Collections.reverse(infoList);
- for (int i=0; i< info.length; i++){
- info[i] = (IPluginDescriptor)infoList.get(i);
- }
- }
- else {
- // Sort ascending
- Arrays.sort(info, new Comparator() {
- Collator coll = Collator.getInstance(Locale.getDefault());
- public int compare(Object a, Object b) {
- IPluginDescriptor d1, d2;
- String provider1, provider2, pluginId1, pluginId2;
- d1 = (IPluginDescriptor) a;
- provider1 = d1.getProviderName();
- pluginId1 = d1.getLabel();
- d2 = (IPluginDescriptor) b;
- provider2 = d2.getProviderName();
- pluginId2 = d2.getLabel();
- if (provider1.equals(provider2))
- return coll.compare(pluginId1, pluginId2);
- else
- return coll.compare(provider1, provider2);
- }
- });
- }
- }
- /**
- * Sort the rows of the table based on unique plugin id.
- */
- private void sortById(){
- /* If sorting in reverse, info array is already sorted forward by
- * key so the info array simply needs to be reversed.
- */
- if (reverseSort){
- java.util.List infoList = Arrays.asList(info);
- Collections.reverse(infoList);
- for (int i=0; i< info.length; i++){
- info[i] = (IPluginDescriptor)infoList.get(i);
- }
- }
- else {
- // Sort ascending
- Arrays.sort(info, new Comparator() {
- Collator coll = Collator.getInstance(Locale.getDefault());
- public int compare(Object a, Object b) {
- IPluginDescriptor d1, d2;
- String pluginId1, pluginId2;
- d1 = (IPluginDescriptor) a;
- pluginId1 = d1.getLabel();
- d2 = (IPluginDescriptor) b;
- pluginId2 = d2.getLabel();
- return coll.compare(pluginId1, pluginId2);
- }
- });
- }
-
- }
- /**
- * Sort the rows of the table based on the plugin version.
- * Secondary criteria is unique plugin id.
- */
- private void sortByVersion(){
- /* If sorting in reverse, info array is already sorted forward by
- * key so the info array simply needs to be reversed.
- */
- if (reverseSort){
- java.util.List infoList = Arrays.asList(info);
- Collections.reverse(infoList);
- for (int i=0; i< info.length; i++){
- info[i] = (IPluginDescriptor)infoList.get(i);
- }
- }
- else {
- // Sort ascending
- Arrays.sort(info, new Comparator() {
- Collator coll = Collator.getInstance(Locale.getDefault());
- public int compare(Object a, Object b) {
- IPluginDescriptor d1, d2;
- String version1, version2, pluginId1, pluginId2;
- d1 = (IPluginDescriptor) a;
- version1 = d1.getVersionIdentifier().toString();
- pluginId1 = d1.getLabel();
- d2 = (IPluginDescriptor) b;
- version2 = d2.getVersionIdentifier().toString();
- pluginId2 = d2.getLabel();
- if (version1.equals(version2))
- return coll.compare(pluginId1, pluginId2);
- else
- return coll.compare(version1, version2);
- }
- });
- }
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetContentProvider.java
deleted file mode 100644
index 296f471..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetContentProvider.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.jface.viewers.*;
-import java.util.*;
-
-public class ActionSetContentProvider implements ITreeContentProvider {
- private ActionSetDialogInput input;
-/**
- * ActionSetRegistryContentProvider constructor comment.
- */
-public ActionSetContentProvider() {
- super();
-}
-public void dispose() {
- input = null;
-}
-/**
- * Returns the child elements of the given parent element.
- */
-public Object[] getChildren(Object element) {
- if (element instanceof ActionSetDialogInput) {
- return ((ActionSetDialogInput)element).getCategories();
- }
- if (element instanceof ActionSetCategory) {
- ActionSetCategory cat = (ActionSetCategory)element;
- ArrayList list = cat.getActionSets();
- if (list == null)
- return new Object[0];
- else
- return list.toArray();
- }
- return new Object[0];
-}
-/**
- * Return the children of an element.
- */
-public Object[] getElements(Object element) {
- return getChildren(element);
-}
-/**
- * Returns the parent for the given element, or <code>null</code>
- * indicating that the parent can't be computed.
- */
-public Object getParent(Object element) {
- if (element instanceof ActionSetCategory)
- return input;
- if (element instanceof IActionSetDescriptor) {
- IActionSetDescriptor desc = (IActionSetDescriptor)element;
- if (input != null) {
- return input.findCategory(desc.getCategory());
- }
- }
- return null;
-}
-/**
- * Returns whether the given element has children.
- */
-public boolean hasChildren(Object element) {
- if (element instanceof ActionSetDialogInput)
- return true;
- if (element instanceof ActionSetCategory)
- return true;
- return false;
-}
-/**
- * Sets the input.
- */
-public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof ActionSetDialogInput) {
- input = (ActionSetDialogInput)newInput;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetDialogInput.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetDialogInput.java
deleted file mode 100644
index 0014066..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetDialogInput.java
+++ /dev/null
@@ -1,157 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.model.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.internal.model.AdaptableList;
-import java.util.*;
-
-/**
- * This class collates the input for an action set dialog. There
- * are a number of sources:
- * - the action sets
- * - the views
- * - the perspectives
- * - the new wizards
- */
-public class ActionSetDialogInput {
- private ArrayList categories = new ArrayList(10);
- private final static String ID_VIEW = "org.eclipse.ui.views"; //$NON-NLS-1$
- private final static String ID_WIZARD = "org.eclipse.ui.wizards"; //$NON-NLS-1$
- private final static String ID_PERSP = "org.eclipse.ui.perspectives"; //$NON-NLS-1$
- private FakeActionSetCategory viewCat;
- private FakeActionSetCategory perspCat;
- private FakeActionSetCategory wizardCat;
-/**
- * ActionSetContent constructor comment.
- */
-public ActionSetDialogInput() {
- super();
- initActionSets();
- initViews();
- initNewWizards();
- initPerspectives();
-}
-
-/**
- * Add the action sets for the given categories
- */
-private void addActionSets(Object[] cats) {
- for (int nX = 0; nX < cats.length; nX ++) {
- WizardCollectionElement cat = (WizardCollectionElement)cats[nX];
- Object [] wizards = cat.getWizards();
- for (int nY = 0; nY < wizards.length; nY ++) {
- WorkbenchWizardElement wiz = (WorkbenchWizardElement)wizards[nY];
- FakeWizardActionSet actionSet = new FakeWizardActionSet(wiz);
- wizardCat.addActionSet(actionSet);
- }
- Object[] subCats = cat.getChildren();
- addActionSets(subCats);
- }
-}
-
-
-/**
- * Returns the category with a given id.
- */
-public ActionSetCategory findCategory(String id) {
- if (id == null)
- return null;
- Iterator iter = categories.iterator();
- while (iter.hasNext()) {
- ActionSetCategory cat = (ActionSetCategory)iter.next();
- if (cat.getId().equals(id))
- return cat;
- }
- return null;
-}
-/**
- * Returns the categories.
- */
-public Object [] getCategories() {
- return categories.toArray();
-}
-/**
- * Returns the fake persp action for a particular id.
- */
-public FakePerspectiveActionSet getPerspectiveActionSet(String id) {
- return (FakePerspectiveActionSet)perspCat.findActionSet(id);
-}
-/**
- * Returns the fake view action for a particular id.
- */
-public FakeViewActionSet getViewActionSet(String id) {
- return (FakeViewActionSet)viewCat.findActionSet(id);
-}
-/**
- * Returns the fake wizard action for a particular id.
- */
-public FakeWizardActionSet getWizardActionSet(String id) {
- return (FakeWizardActionSet)wizardCat.findActionSet(id);
-}
-/**
- * Initialize the registered action sets.
- */
-private void initActionSets() {
- ActionSetRegistry reg = WorkbenchPlugin.getDefault().getActionSetRegistry();
- ActionSetCategory [] cats = reg.getCategories();
- for (int nX = 0; nX < cats.length; nX ++) {
- categories.add(cats[nX]);
- }
-}
-/**
- * Initialize the new wizard action sets.
- */
-private void initNewWizards() {
- // Create fake category.
- wizardCat = new FakeActionSetCategory(ID_WIZARD,
- WorkbenchMessages.getString("ActionSetDialogInput.wizardCategory")); //$NON-NLS-1$
- categories.add(wizardCat);
- // Get wizards categories.
- NewWizardsRegistryReader rdr = new NewWizardsRegistryReader();
- WizardCollectionElement wizardCollection = (WizardCollectionElement)rdr.getWizards();
- Object [] cats = wizardCollection.getChildren();
- addActionSets(cats);
-}
-/**
- * Initialize the perspective action sets.
- */
-private void initPerspectives() {
- // Create fake category.
- perspCat = new FakeActionSetCategory(ID_PERSP,
- WorkbenchMessages.getString("ActionSetDialogInput.perspectiveCategory")); //$NON-NLS-1$
- categories.add(perspCat);
-
- // Add elements.
- IPerspectiveRegistry perspReg = WorkbenchPlugin.getDefault().getPerspectiveRegistry();
- IPerspectiveDescriptor [] persps = perspReg.getPerspectives();
- for (int nX = 0; nX < persps.length; nX ++) {
- FakePerspectiveActionSet actionSet = new FakePerspectiveActionSet(persps[nX]);
- perspCat.addActionSet(actionSet);
- }
-}
-/**
- * Initialize the view action sets.
- */
-private void initViews() {
- // Create fake category.
- viewCat = new FakeActionSetCategory(ID_VIEW,
- WorkbenchMessages.getString("ActionSetDialogInput.viewCategory")); //$NON-NLS-1$
- categories.add(viewCat);
-
- // Add views.
- IViewRegistry viewReg = WorkbenchPlugin.getDefault().getViewRegistry();
- IViewDescriptor [] views = viewReg.getViews();
- for (int nX = 0; nX < views.length; nX ++) {
- FakeViewActionSet actionSet = new FakeViewActionSet(views[nX]);
- viewCat.addActionSet(actionSet);
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetLabelProvider.java
deleted file mode 100644
index 4813e72..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetLabelProvider.java
+++ /dev/null
@@ -1,33 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.LabelProvider;
-
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.dialogs.DialogUtil;
-import org.eclipse.ui.internal.registry.ActionSetCategory;
-import org.eclipse.ui.internal.registry.IActionSetDescriptor;
-
-/**
- * Label provider for action sets in the ActionSetSelectionDialog.
- */
-public class ActionSetLabelProvider extends LabelProvider {
-
- private String UNKNOWN = WorkbenchMessages.getString("ActionSetLabelProvider.Unknown"); //$NON-NLS-1$
-
- public ActionSetLabelProvider() {
- super();
- }
-
- public String getText(Object element) {
- String label = UNKNOWN;
- if (element instanceof ActionSetCategory)
- label = ((ActionSetCategory) element).getLabel();
- else if (element instanceof IActionSetDescriptor)
- label = ((IActionSetDescriptor) element).getLabel();
- return DialogUtil.removeAccel(label);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetSelectionDialog.java
deleted file mode 100644
index 173bfa5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetSelectionDialog.java
+++ /dev/null
@@ -1,301 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.model.*;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-/**
- * Dialog to display the available action sets, and
- * solicits a list of selections from the user.
- */
-public class ActionSetSelectionDialog extends Dialog {
- // input data.
- private Perspective perspective;
- private ActionSetDialogInput input;
-
- // widgets.
- private CheckboxTreeViewer actionSetViewer;
- private Label actionLabel;
- private TableViewer actionViewer;
-
- // sizing constants
- private final static int SIZING_SELECTION_WIDGET_HEIGHT = 300;
- private final static int SIZING_SELECTION_WIDGET_WIDTH = 300;
-/**
- * Creates an action set selection dialog.
- */
-public ActionSetSelectionDialog(
- Shell parentShell,
- Perspective persp)
-{
- super(parentShell);
- perspective = persp;
- input = new ActionSetDialogInput();
-}
-/**
- * Visually checks the previously-specified elements.
- */
-private void checkInitialSelections() {
- IActionSetDescriptor [] actionSets = perspective.getActionSets();
- if (actionSets != null) {
- for (int i = 0; i < actionSets.length; i++)
- actionSetViewer.setChecked(actionSets[i],true);
- }
-
- ArrayList actions = perspective.getShowViewActionIds();
- if (actions != null) {
- for (int nX = 0; nX < actions.size(); nX ++) {
- String id = (String)actions.get(nX);
- actionSetViewer.setChecked(input.getViewActionSet(id), true);
- }
- }
-
- actions = perspective.getPerspectiveActionIds();
- if (actions != null) {
- for (int nX = 0; nX < actions.size(); nX ++) {
- String id = (String)actions.get(nX);
- actionSetViewer.setChecked(input.getPerspectiveActionSet(id), true);
- }
- }
-
- actions = perspective.getNewWizardActionIds();
- if (actions != null) {
- for (int nX = 0; nX < actions.size(); nX ++) {
- String id = (String)actions.get(nX);
- actionSetViewer.setChecked(input.getWizardActionSet(id), true);
- }
- }
-
- Object[] categories = input.getCategories();
- for (int i = 0; i < categories.length; i++) {
- ActionSetCategory cat = (ActionSetCategory)categories[i];
- ArrayList sets = cat.getActionSets();
- if (sets != null && sets.size() > 0) {
- boolean baseChildState = actionSetViewer.getChecked(sets.get(0));
- updateCategoryState(cat, baseChildState);
- }
- }
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(WorkbenchMessages.getString("ActionSetSelection.customize")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(shell, IHelpContextIds.ACTION_SET_SELECTION_DIALOG);
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite)super.createDialogArea(parent);
- GridLayout layout = (GridLayout)composite.getLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = true;
-
- GridData data;
-
- // description
- Label descLabel = new Label(composite, SWT.WRAP);
- descLabel.setText(WorkbenchMessages.format("ActionSetSelection.selectLabel", new Object[] {perspective.getDesc().getLabel()})); //$NON-NLS-1$
- descLabel.setFont(parent.getFont());
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- descLabel.setLayoutData(data);
-
- // Setup the action set list selection...
- // ...first a composite group
- Composite actionSetGroup = new Composite(composite, SWT.NONE);
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- actionSetGroup.setLayout(layout);
- data = new GridData(GridData.FILL_BOTH);
- actionSetGroup.setLayoutData(data);
-
- // ...second the label
- Label selectionLabel = new Label(actionSetGroup,SWT.NONE);
- selectionLabel.setText(WorkbenchMessages.getString("ActionSetSelection.available")); //$NON-NLS-1$
- selectionLabel.setFont(parent.getFont());
-
- // ...third the checkbox list
- actionSetViewer = new CheckboxTreeViewer(actionSetGroup, SWT.BORDER);
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
- actionSetViewer.getTree().setLayoutData(data);
- actionSetViewer.setLabelProvider(new ActionSetLabelProvider());
- actionSetViewer.setContentProvider(new ActionSetContentProvider());
- actionSetViewer.setInput(input);
- actionSetViewer.setSorter(new ActionSetSorter());
- actionSetViewer.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection sel = (IStructuredSelection)event.getSelection();
- IActionSetDescriptor actionSet = null;
- if (sel.getFirstElement() instanceof IActionSetDescriptor)
- actionSet = (IActionSetDescriptor)sel.getFirstElement();
- if (actionSet != actionViewer.getInput()) {
- actionViewer.setInput(actionSet);
- }
- }
- });
- actionSetViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- handleActionSetChecked(event);
- }
- });
-
- // Setup the action list for the action set selected...
- // ...first a composite group
- Composite actionGroup = new Composite(composite, SWT.NONE);
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- actionGroup.setLayout(layout);
- data = new GridData(GridData.FILL_BOTH);
- actionGroup.setLayoutData(data);
-
- // ...second the label
- actionLabel = new Label(actionGroup, SWT.NONE);
- actionLabel.setText(WorkbenchMessages.getString("ActionSetSelection.details")); //$NON-NLS-1$
-
- // ...third the list of actions
- Table actionTable = new Table(actionGroup, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- actionTable.setBackground(WorkbenchColors.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
- actionTable.setLayoutData(data);
-
- actionViewer = new TableViewer(actionTable);
- actionViewer.setLabelProvider(new WorkbenchLabelProvider());
- actionViewer.setContentProvider(new WorkbenchContentProvider());
- actionViewer.setSorter(new WorkbenchViewerSorter());
-
- // initialize page
- checkInitialSelections();
-
- return composite;
-}
-/**
- * Checked event handler for the action set tree.
- */
-private void handleActionSetChecked(CheckStateChangedEvent event) {
- // On action set category check/uncheck. Category can be
- // in three states:
- // 1) all children unchecked -> category unchecked
- // 2) some children checked -> category checked & grayed
- // 3) all children checked -> category checked
- if (event.getElement() instanceof ActionSetCategory) {
- // On check, check all its children also
- if (event.getChecked()) {
- actionSetViewer.setSubtreeChecked(event.getElement(), true);
- return;
- }
- // On uncheck & gray, remain check but ungray
- // and check all its children
- if (actionSetViewer.getGrayed(event.getElement())) {
- actionSetViewer.setChecked(event.getElement(), true);
- actionSetViewer.setGrayed(event.getElement(), false);
- actionSetViewer.setSubtreeChecked(event.getElement(), true);
- return;
- }
- // On uncheck & not gray, uncheck all its children
- actionSetViewer.setSubtreeChecked(event.getElement(), false);
- return;
- }
-
- // On action set check/uncheck
- if (event.getElement() instanceof IActionSetDescriptor) {
- IActionSetDescriptor desc = (IActionSetDescriptor)event.getElement();
- ActionSetCategory cat = input.findCategory(desc.getCategory());
- updateCategoryState(cat, event.getChecked());
- return;
- }
-}
-/**
- * The <code>ActionSetSelectionDialog</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.
- */
-protected void okPressed() {
- // Prepare result arrays.
- ArrayList actionSets = new ArrayList();
- ArrayList viewActions = new ArrayList();
- ArrayList perspActions = new ArrayList();
- ArrayList wizardActions = new ArrayList();
-
- // Fill result arrays.
- Object[] selected = actionSetViewer.getCheckedElements();
- for (int nX = 0; nX < selected.length; nX ++) {
- Object obj = selected[nX];
- if (obj instanceof FakeViewActionSet) {
- viewActions.add(((FakeViewActionSet)obj).getView().getID());
- } else if (obj instanceof FakePerspectiveActionSet) {
- perspActions.add(((FakePerspectiveActionSet)obj).getPerspective().getId());
- } else if (obj instanceof FakeWizardActionSet) {
- wizardActions.add(((FakeWizardActionSet)obj).getWizard().getID());
- } else if (obj instanceof ActionSetDescriptor) {
- actionSets.add(obj);
- }
- }
-
- perspective.setShowViewActionIds(viewActions);
- perspective.setPerspectiveActionIds(perspActions);
- perspective.setNewWizardActionIds(wizardActions);
-
- IActionSetDescriptor [] actionSetArray = new IActionSetDescriptor[actionSets.size()];
- actionSetArray = (IActionSetDescriptor [])actionSets.toArray(actionSetArray);
- perspective.setActionSets(actionSetArray);
-
- super.okPressed();
-}
-/**
- * Update the check and gray state of a category
- * Category can be in three states:
- * 1) all children uncheck -> category uncheck
- * 2) some children check -> category check & gray
- * 3) all children check -> category check
- */
-private void updateCategoryState(ActionSetCategory cat, boolean baseChildState) {
- // Check if all the action sets of the category are all
- // in the same state at the action set of the event
- boolean allSameState = true;
- Iterator enum = cat.getActionSets().iterator();
- while (enum.hasNext()) {
- if (actionSetViewer.getChecked(enum.next()) != baseChildState) {
- allSameState = false;
- break;
- }
- }
-
- // On all the same state, ungray the category and
- // set the category's state to be the same
- if (allSameState) {
- actionSetViewer.setGrayed(cat, false);
- actionSetViewer.setChecked(cat, baseChildState);
- return;
- }
-
- // On all different state, gray the category and
- // check the category
- actionSetViewer.setGrayed(cat, true);
- actionSetViewer.setChecked(cat, true);
- return;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetSorter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetSorter.java
deleted file mode 100644
index 368c3de..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ActionSetSorter.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.jface.viewers.*;
-
-/**
- * This is used to sort action sets in the perspective customization dialog.
- */
-public class ActionSetSorter extends ViewerSorter {
-
-/**
- * Creates a new sorter.
- */
-public ActionSetSorter() {
-}
-
-/**
- * Returns a negative, zero, or positive number depending on whether
- * the first element is less than, equal to, or greater than
- * the second element.
- */
-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 collator.compare(str1, str2);
- } else if (e1 instanceof ActionSetCategory) {
- ActionSetCategory cat1 = (ActionSetCategory)e1;
- ActionSetCategory cat2 = (ActionSetCategory)e2;
- if (cat1.getId().equals(ActionSetRegistry.OTHER_CATEGORY))
- return 1;
- if (cat2.getId().equals(ActionSetRegistry.OTHER_CATEGORY))
- return -1;
- String str1 = cat1.getLabel();
- String str2 = cat2.getLabel();
- return collator.compare(str1, str2);
- }
- return 0;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/BuildOrderPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/BuildOrderPreferencePage.java
deleted file mode 100644
index c25e01b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/BuildOrderPreferencePage.java
+++ /dev/null
@@ -1,524 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-
-import java.util.TreeSet;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.actions.GlobalBuildAction;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * The BuildOrderPage is the page that is used to determine what order projects
- * will be built in by the workspace.
- */
-public class BuildOrderPreferencePage
- extends PreferencePage
- implements IWorkbenchPreferencePage {
-
- private IWorkbench workbench;
-
- private Button defaultOrderButton;
- private Label buildLabel;
- private List buildList;
- private Composite buttonComposite;
- private Label noteLabel;
-
- private String[] defaultBuildOrder;
- private String[] customBuildOrder;
-
- private static String UP_LABEL = WorkbenchMessages.getString("BuildOrderPreference.up"); //$NON-NLS-1$
- private static String DOWN_LABEL = WorkbenchMessages.getString("BuildOrderPreference.down"); //$NON-NLS-1$
- private static String ADD_LABEL = WorkbenchMessages.getString("BuildOrderPreference.add"); //$NON-NLS-1$
- private static String REMOVE_LABEL = WorkbenchMessages.getString("BuildOrderPreference.remove"); //$NON-NLS-1$
- private static String UNSELECTED_PROJECTS = WorkbenchMessages.getString("BuildOrderPreference.selectProject"); //$NON-NLS-1$
- private static String PROJECT_SELECTION_MESSAGE = WorkbenchMessages.getString("BuildOrderPreference.selectOtherProjects"); //$NON-NLS-1$
- private static String DEFAULTS_LABEL = WorkbenchMessages.getString("BuildOrderPreference.useDefaults"); //$NON-NLS-1$
- private static String LIST_LABEL = WorkbenchMessages.getString("BuildOrderPreference.projectBuildOrder"); //$NON-NLS-1$
- private static String NOTE_LABEL = WorkbenchMessages.getString("BuildOrderPreference.note"); //$NON-NLS-1$
-
- // marks projects with unspecified build orders
- private static final String MARKER = "*"; //$NON-NLS-1$
-
- // the index of the first project with an unspecified build order
- // the rest of the list consists of projects with unspecified build orders
- private int markedItemsStartIndex = 0;
-
- // whether or not the use defaults option was selected when Apply (or OK) was last pressed
- // (or when the preference page was opened). This represents the most recent applied state.
- private boolean defaultOrderInitiallySelected;
-
-/**
- * Add another project to the list at the end.
- */
-private void addProject() {
-
- String[] currentItems = this.buildList.getItems();
-
- IProject[] allProjects = getWorkspace().getRoot().getProjects();
-
- ILabelProvider labelProvider = new LabelProvider() {
- public String getText(Object element) {
- return (String) element;
- }
- };
-
- SimpleListContentProvider contentsProvider = new SimpleListContentProvider();
- contentsProvider.setElements(sortedDifference(allProjects, currentItems));
-
- ListSelectionDialog dialog =
- new ListSelectionDialog(
- this.getShell(),
- this,
- contentsProvider,
- labelProvider,
- PROJECT_SELECTION_MESSAGE);
-
- if (dialog.open() != Dialog.OK)
- return;
-
- Object[] result = dialog.getResult();
-
- int currentItemsLength = currentItems.length;
- int resultLength = result.length;
- String[] newItems = new String[currentItemsLength + resultLength];
-
- System.arraycopy(currentItems, 0, newItems, 0, currentItemsLength);
- System.arraycopy(
- result,
- 0,
- newItems,
- currentItemsLength,
- result.length);
- this.buildList.setItems(newItems);
-}
-/**
- * Create the list of build paths. If the current build order is empty make the list empty
- * and disable it.
- * @param composite - the parent to create the list in
- * @param - enabled - the boolean that indcates if the list will be sensitive initially or not
- */
-private void createBuildOrderList(Composite composite, boolean enabled) {
-
- Font font = composite.getFont();
-
- this.buildLabel = new Label(composite, SWT.NONE);
- this.buildLabel.setText(LIST_LABEL);
- this.buildLabel.setEnabled(enabled);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.horizontalSpan = 2;
- this.buildLabel.setLayoutData(gridData);
- this.buildLabel.setFont(font);
-
- this.buildList = new List(composite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- this.buildList.setEnabled(enabled);
- GridData data = new GridData();
- //Set heightHint with a small value so the list size will be defined by
- //the space available in the dialog instead of resizing the dialog to
- //fit all the items in the list.
- data.heightHint = buildList.getItemHeight();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.grabExcessVerticalSpace = true;
- this.buildList.setLayoutData(data);
- this.buildList.setFont(font);
-}
-/**
- * Create the widgets that are used to determine the build order.
- *
- * @param parent the parent composite
- * @return the new control
- */
-protected Control createContents(Composite parent) {
-
- WorkbenchHelp.setHelp(parent, IHelpContextIds.BUILD_ORDER_PREFERENCE_PAGE);
-
- Font font = parent.getFont();
-
- //The main composite
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
- composite.setFont(font);
-
- String[] buildOrder = getCurrentBuildOrder();
- boolean useDefault = (buildOrder.length < 1);
-
- createDefaultPathButton(composite, useDefault);
- // List always enabled so user can scroll list.
- // Only the button need to be disabled.
- createBuildOrderList(composite, true);
- createListButtons(composite, !useDefault);
-
- // a note about projects with unspecified build orders
- noteLabel = new Label(composite, SWT.NONE);
- noteLabel.setText(NOTE_LABEL);
- noteLabel.setFont(font);
-
-
- if (useDefault) {
- this.buildList.setItems(getDefaultProjectOrder());
- // if there are no marked items, do not show the note
- if(markedItemsStartIndex >= buildList.getItemCount())
- noteLabel.setVisible(false);
- } else {
- this.buildList.setItems(buildOrder);
- // when not using default build order, do not show the note
- noteLabel.setVisible(false);
- }
-
- return composite;
-
-}
-/**
- * Create the default path button. Set it to selected based on the current workspace
- * build path.
- * @param composite org.eclipse.swt.widgets.Composite
- * @param selected - the boolean that indicates the buttons initial state
- */
-private void createDefaultPathButton(Composite composite, boolean selected) {
-
- defaultOrderInitiallySelected = selected;
-
- this.defaultOrderButton = new Button(composite, SWT.LEFT | SWT.CHECK);
- this.defaultOrderButton.setSelection(selected);
- this.defaultOrderButton.setText(DEFAULTS_LABEL);
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- defaultsButtonSelected(defaultOrderButton.getSelection());
- }
- };
- this.defaultOrderButton.addSelectionListener(listener);
-
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.horizontalSpan = 2;
- this.defaultOrderButton.setLayoutData(gridData);
- this.defaultOrderButton.setFont(composite.getFont());
-}
-/**
- * Create the buttons used to manipulate the list. These Add, Remove and Move Up or Down
- * the list items.
- * @param composite the parent of the buttons
- * @param enableComposite - boolean that indicates if a composite should be enabled
- */
-private void createListButtons(Composite composite, boolean enableComposite) {
-
- Font font = composite.getFont();
-
- //Create an intermeditate composite to keep the buttons in the same column
- this.buttonComposite = new Composite(composite, SWT.RIGHT);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- this.buttonComposite.setLayout(layout);
- GridData gridData = new GridData();
- gridData.verticalAlignment = GridData.FILL;
- gridData.horizontalAlignment = GridData.FILL;
- this.buttonComposite.setLayoutData(gridData);
- this.buttonComposite.setFont(font);
-
- Button upButton = new Button(this.buttonComposite, SWT.CENTER | SWT.PUSH);
- upButton.setText(UP_LABEL);
- upButton.setEnabled(enableComposite);
- upButton.setFont(font);
- setButtonLayoutData(upButton);
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- moveSelectionUp();
- }
- };
- upButton.addSelectionListener(listener);
-
- Button downButton = new Button(this.buttonComposite, SWT.CENTER | SWT.PUSH);
- downButton.setText(DOWN_LABEL);
- downButton.setEnabled(enableComposite);
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- moveSelectionDown();
- }
- };
- downButton.addSelectionListener(listener);
- downButton.setFont(font);
- setButtonLayoutData(downButton);
-
- Button addButton = new Button(this.buttonComposite, SWT.CENTER | SWT.PUSH);
- addButton.setText(ADD_LABEL);
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- addProject();
- }
- };
- addButton.addSelectionListener(listener);
- addButton.setEnabled(enableComposite);
- addButton.setFont(font);
- setButtonLayoutData(addButton);
-
- Button removeButton = new Button(this.buttonComposite, SWT.CENTER | SWT.PUSH);
- removeButton.setText(REMOVE_LABEL);
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- removeSelection();
- }
- };
- removeButton.addSelectionListener(listener);
- removeButton.setEnabled(enableComposite);
- removeButton.setFont(font);
- setButtonLayoutData(removeButton);
-
-}
-/**
- * The defaults button has been selected - update the other widgets as required.
- * @param selected - whether or not the defaults button got selected
- */
-private void defaultsButtonSelected(boolean selected) {
- if (selected) {
- setBuildOrderWidgetsEnablement(false);
- buildList.setItems(getDefaultProjectOrder());
- // if there are marked items, make the note visible
- if(markedItemsStartIndex < buildList.getItemCount())
- noteLabel.setVisible(true);
- }
- else {
- setBuildOrderWidgetsEnablement(true);
- String[] buildOrder = getCurrentBuildOrder();
- if (buildOrder.length < 1) {
- // Get a copy of the default order and remove markers
- String[] names = getDefaultProjectOrder();
- String[] copy = new String[names.length];
- System.arraycopy(names, 0, copy, 0, names.length);
- for (int i = markedItemsStartIndex; i < copy.length; i++)
- copy[i] = names[i].substring(1);
- buildList.setItems(copy);
- } else {
- buildList.setItems(buildOrder);
- }
- // make the note invisible
- noteLabel.setVisible(false);
- }
-}
-/**
- * Get the project names for the current custom build
- * order stored in the workspace description.
- *
- * @return java.lang.String[]
- */
-private String[] getCurrentBuildOrder() {
- if (customBuildOrder == null) {
- customBuildOrder = getWorkspace().getDescription().getBuildOrder();
- if (customBuildOrder == null)
- customBuildOrder = new String[0];
- }
-
- return customBuildOrder;
-}
-/**
- * Get the project names in the default build order
- * based on the current Workspace settings.
- *
- * @return java.lang.String[]
- */
-private String[] getDefaultProjectOrder() {
- if (defaultBuildOrder == null) {
- IWorkspace workspace = getWorkspace();
- IProject[][] projectOrder =
- getWorkspace().computePrerequisiteOrder(workspace.getRoot().getProjects());
-
- IProject[] foundProjects = projectOrder[0];
- IProject[] ambiguousProjects = projectOrder[1];
-
- defaultBuildOrder =
- new String[foundProjects.length + ambiguousProjects.length];
- int foundSize = foundProjects.length;
- for (int i = 0; i < foundSize; i++)
- defaultBuildOrder[i] = foundProjects[i].getName();
- markedItemsStartIndex = foundSize;
- for (int i = 0; i < ambiguousProjects.length; i++)
- defaultBuildOrder[i + foundSize] = MARKER + ambiguousProjects[i].getName();
- }
-
- return defaultBuildOrder;
-}
-/**
- * Return the Workspace the build order is from.
- * @return org.eclipse.core.resources.IWorkspace
- */
-private IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
-}
-/**
- * Return whether or not searchElement is in testArray.
- */
-private boolean includes(String[] testArray, String searchElement) {
-
- for (int i = 0; i < testArray.length; i++) {
- if (searchElement.equals(testArray[i]))
- return true;
- }
- return false;
-
-}
-/**
- * See IWorkbenchPreferencePage. This class does nothing with he Workbench.
- */
-public void init(IWorkbench workbench) {
- this.workbench = workbench;
-}
-/**
- * Move the current selection in the build list down.
- */
-private void moveSelectionDown() {
-
- //Only do this operation on a single selection
- if (this.buildList.getSelectionCount() == 1) {
- int currentIndex = this.buildList.getSelectionIndex();
- if (currentIndex < this.buildList.getItemCount() - 1) {
- String elementToMove = this.buildList.getItem(currentIndex);
- this.buildList.remove(currentIndex);
- this.buildList.add(elementToMove, currentIndex + 1);
- this.buildList.select(currentIndex + 1);
- }
- }
-}
-/**
- * Move the current selection in the build list up.
- */
-private void moveSelectionUp() {
-
- int currentIndex = this.buildList.getSelectionIndex();
-
- //Only do this operation on a single selection
- if (currentIndex > 0 && this.buildList.getSelectionCount() == 1) {
- String elementToMove = this.buildList.getItem(currentIndex);
- this.buildList.remove(currentIndex);
- this.buildList.add(elementToMove, currentIndex - 1);
- this.buildList.select(currentIndex - 1);
- }
-}
-/**
- * Performs special processing when this page's Defaults button has been pressed.
- * In this case change the defaultOrderButton to have it's selection set to true.
- */
-protected void performDefaults() {
- this.defaultOrderButton.setSelection(true);
- defaultsButtonSelected(true);
- super.performDefaults();
-}
-/**
- * OK has been pressed. If the defualt button is pressed then reset the build order to false;
- * otherwise set it to the contents of the list.
- */
-public boolean performOk() {
-
- String[] buildOrder = null;
- boolean useDefault = defaultOrderButton.getSelection();
-
- // if use defaults is turned off
- if (!useDefault)
- buildOrder = buildList.getItems();
-
- //Get a copy of the description from the workspace, set the build order and then
- //apply it to the workspace.
- IWorkspaceDescription description = getWorkspace().getDescription();
- description.setBuildOrder(buildOrder);
- try {
- getWorkspace().setDescription(description);
- } catch (CoreException exception) {
- //failed - return false
- return false;
- }
-
- // Perform auto-build if use default is off (because
- // order could have changed) or if use default setting
- // was changed.
- if (!useDefault || (useDefault != defaultOrderInitiallySelected)) {
- defaultOrderInitiallySelected = useDefault;
- // If auto build is turned on, then do a global incremental
- // build on all the projects.
- if (ResourcesPlugin.getWorkspace().isAutoBuilding()) {
- GlobalBuildAction action = new GlobalBuildAction(workbench, getShell(), IncrementalProjectBuilder.INCREMENTAL_BUILD);
- action.doBuild();
- }
- }
-
- // Clear the custom build order cache
- customBuildOrder = null;
-
- return true;
-}
-/**
- * Remove the current selection in the build list.
- */
-private void removeSelection() {
-
- this.buildList.remove(this.buildList.getSelectionIndices());
-}
-/**
- * Set the widgets that select build order to be enabled or diabled.
- * @param value boolean
- */
-private void setBuildOrderWidgetsEnablement(boolean value) {
-
- // Only change enablement of buttons. Leave list alone
- // because you can't scroll it when disabled.
- Control[] children = this.buttonComposite.getChildren();
- for (int i = 0; i < children.length; i++) {
- children[i].setEnabled(value);
- }
-}
-
-/**
- * Return a sorted array of the names of the projects that are already in the currently
- * displayed names.
- * @return String[]
- * @param allProjects - all of the projects in the workspace
- * @param currentlyDisplayed - the names of the projects already being displayed
- */
-private String[] sortedDifference(IProject[] allProjects, String[] currentlyDisplayed) {
-
- TreeSet difference = new TreeSet();
-
- for(int i = 0; i < allProjects.length; i ++){
- if(!includes(currentlyDisplayed,allProjects[i].getName()))
- difference.add(allProjects[i].getName());
- }
-
- String [] returnValue = new String[difference.size()];
- difference.toArray(returnValue);
- return returnValue;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CheckboxSingleListGroup.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CheckboxSingleListGroup.java
deleted file mode 100644
index 9e37e98..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CheckboxSingleListGroup.java
+++ /dev/null
@@ -1,314 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List;
-/**
- * This class implements the identical API to CheckboxDoubleListGroup, but
- * only displays a single checkbox list.
- */
-class CheckboxSingleListGroup extends Composite implements ICheckStateListener, ISelectionChangedListener {
- private Object root;
- private Object currentList1Selection;
- private Map checkedStateStore = new HashMap(9);
- private List listeners = new ArrayList();
- private boolean singleList1Check = false;
- private boolean singleList2Check = false;
-
- private IStructuredContentProvider list1ContentProvider;
- private IStructuredContentProvider list2ContentProvider;
- private ILabelProvider list1LabelProvider;
- private ILabelProvider list2LabelProvider;
-
- // widgets
- private CheckboxTableViewer list1Viewer;
-/**
- * Create an instance of this class. Use this constructor if you want
- * the combined widget to act like others w.r.t. sizing and set its
- * size according to whatever is required to fill its context.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param style int
- * @param rootObject java.lang.Object
- * @param childPropertyName java.lang.String
- * @param parentPropertyName java.lang.String
- * @param listPropertyName java.lang.String
- */
-public CheckboxSingleListGroup(
- Composite parent,Object rootObject,
- IStructuredContentProvider list1ContentProvider,ILabelProvider list1LabelProvider,
- IStructuredContentProvider list2ContentProvider,ILabelProvider list2LabelProvider,
- int style) {
-
- this(
- parent,rootObject,
- list1ContentProvider,list1LabelProvider,
- list2ContentProvider,list2LabelProvider,
- style,-1,-1);
-}
-/**
- * Create an instance of this class. Use this constructor if you wish to specify
- * the width and/or height of the combined widget (to only hardcode one of the
- * sizing dimensions, specify the other dimension's value as -1)
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param style int
- * @param rootObject java.lang.Object
- * @param childPropertyName java.lang.String
- * @param parentPropertyName java.lang.String
- * @param listPropertyName java.lang.String
- * @param width int
- * @param height int
- */
-public CheckboxSingleListGroup(
- Composite parent,Object rootObject,
- IStructuredContentProvider list1ContentProvider,ILabelProvider list1LabelProvider,
- IStructuredContentProvider list2ContentProvider,ILabelProvider list2LabelProvider,
- int style,int width,int height) {
-
- super(parent,style);
- root = rootObject;
- this.list1ContentProvider = list1ContentProvider;
- this.list2ContentProvider = list2ContentProvider;
- this.list1LabelProvider = list1LabelProvider;
- this.list2LabelProvider = list2LabelProvider;
- createContents(parent,width,height);
-}
-/**
- * Add the passed listener to self's collection of clients
- * that listen for changes to element checked states
- *
- * @param listener ICheckStateListener
- */
-public void addCheckStateListener(ICheckStateListener listener) {
- listeners.add(listener);
-}
-/**
- * An item was checked in one of self's two views. Determine which
- * view this occurred in and delegate appropriately
- *
- * @param event CheckStateChangedEvent
- */
-public void checkStateChanged(CheckStateChangedEvent event) {
- list1ItemChecked(event.getElement(),event.getChecked());
- notifyCheckStateChangeListeners(event);
-}
-/**
- * Compute the preferred size.
- *
- * @return org.eclipse.swt.graphics.Point
- * @param wHint int
- * @param hHint int
- * @param changed boolean
- */
-public Point computeSize(int wHint,int hHint,boolean changed) {
- return new Point(-1,-1);
-}
-/**
- * Lay out and initialize self's visual components.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param width int
- * @param height int
- */
-protected void createContents(Composite parent,int width,int height) {
- // group pane
- Composite composite = new Composite(parent,SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- GridData spec = new GridData();
- spec.grabExcessHorizontalSpace = true;
- spec.grabExcessVerticalSpace = true;
- spec.horizontalAlignment = GridData.FILL;
- spec.verticalAlignment = GridData.FILL;
- composite.setLayout(layout);
- composite.setLayoutData(spec);
-
- // list 1 view pane. Add a border to the pane.
- Composite pane = createViewPane(composite, width/2, height/2);
-
- // list 1 viewer
- list1Viewer = CheckboxTableViewer.newCheckList(pane, SWT.NONE);
- list1Viewer.setContentProvider(list1ContentProvider);
- list1Viewer.setLabelProvider(list1LabelProvider);
- list1Viewer.addCheckStateListener(this);
- list1Viewer.addSelectionChangedListener(this);
-
- // this has to be done after the viewers have been laid out
- list1Viewer.setInput(root);
-}
-/**
- * Create a viewer pane in this group for the passed viewer.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param width int
- * @param height int
- */
-protected Composite createViewPane(Composite parent, int width, int height) {
- Composite pane = new Composite(parent, SWT.BORDER);
- GridData spec = new GridData(GridData.FILL_BOTH);
- spec.widthHint = width;
- spec.heightHint = height;
- pane.setLayoutData(spec);
- pane.setLayout(new FillLayout());
- return pane;
-}
-/**
- * Answer a collection of all of the checked elements in the list 1
- * portion of self
- *
- * @return java.util.Vector
- */
-public Set getAllCheckedList1Items() {
- return checkedStateStore.keySet();
-}
-/**
- * Answer a flat collection of all of the checked elements in the
- * list 2 portion of self
- *
- * @return java.util.List
- */
-public List getAllCheckedList2Items() {
- List result = new ArrayList();
- Iterator listCollectionsEnum = checkedStateStore.values().iterator();
-
- while (listCollectionsEnum.hasNext()) {
- Iterator currentCollection = ((List)listCollectionsEnum.next()).iterator();
- while (currentCollection.hasNext())
- result.add(currentCollection.next());
- }
-
- return result;
-}
-/**
- * Answer the number of elements that have been checked by the
- * user.
- *
- * @return int
- */
-public int getCheckedElementCount() {
- return checkedStateStore.size();
-}
-/**
- * Set the checked state of the passed list 1 element, as well
- * as its associated list 2 elements
- */
-public void initialCheckList1Item(Object element) {
- checkedStateStore.put(element,new Vector());
- list1Viewer.setChecked(element,true);
-}
-/**
- * Handle the checking of a list 1 item
- */
-protected void list1ItemChecked(Object listElement,boolean state) {
-
- if (state) {
- // if only one list 1 item can be checked at a time then clear the
- // previous checked list 1 item, if any
- if (singleList1Check) {
- checkedStateStore = new Hashtable(9);
- list1Viewer.setAllChecked(false);
- }
-
- checkedStateStore.put(listElement,new Vector());
-
- } else
- checkedStateStore.remove(listElement);
-
- // the following may seem redundant, but it allows other methods to invoke
- // this method in order to fully simulate the user clicking a list 1 item
- list1Viewer.setChecked(listElement,state);
-}
-/**
- * Notify all checked state listeners that the passed element has had
- * its checked state changed to the passed state
- */
-protected void notifyCheckStateChangeListeners(CheckStateChangedEvent event) {
- Iterator listenersEnum = listeners.iterator();
- while (listenersEnum.hasNext())
- ((ICheckStateListener)listenersEnum.next()).checkStateChanged(event);
-}
-/**
- * Remove the passed listener from self's collection of clients
- * that listen for changes to element checked states
- *
- * @param listener ICheckStateListener
- */
-public void removeCheckStateListener(ICheckStateListener listener) {
- listeners.remove(listener);
-}
-/**
- * Handle the selection of a list 1 item
- *
- * @param selection ISelection
- */
-public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- currentList1Selection = selection.getFirstElement();
-}
-/**
- * Change the list 1 viewer's providers to those passed
- *
- * @param contentProvider ITreeContentProvider
- * @param labelProvider ILabelProvider
- */
-public void setList1Providers(IStructuredContentProvider contentProvider, ILabelProvider labelProvider) {
- list1Viewer.setContentProvider(contentProvider);
- list1Viewer.setLabelProvider(labelProvider);
-}
-/**
- * Set the sorter that is to be applied to self's list 1 viewer
- */
-public void setList1Sorter(ViewerSorter sorter) {
- list1Viewer.setSorter(sorter);
-}
-/**
- * Change the list 2 viewer's providers to those passed
- *
- * @param contentProvider ITreeContentProvider
- * @param labelProvider ILabelProvider
- */
-public void setList2Providers(IStructuredContentProvider contentProvider, ILabelProvider labelProvider) {
-}
-/**
- * Set the sorter that is to be applied to self's list 2 viewer
- *
- * @param sorter ViewerSorter
- */
-public void setList2Sorter(ViewerSorter sorter) {
-}
-/**
- * Set the root element that determines the content of list viewer 1
- */
-public void setRoot(Object rootElement) {
- root = rootElement;
- checkedStateStore = new Hashtable(9);
- list1Viewer.setInput(rootElement);
-}
-/**
- * If this is set to true then only one list 1 item can be
- * checked at a time. The default value for this is false.
- *
- * @param value boolean
- */
-public void setSingleList1Check(boolean value) {
- singleList1Check = value;
-}
-/**
- * If this is set to true then only one list 2 item can be
- * checked at a time. The default value for this is false.
- *
- * @param value boolean
- */
-public void setSingleList2Check(boolean value) {
- singleList2Check = value;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContainerCheckedTreeViewer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContainerCheckedTreeViewer.java
deleted file mode 100644
index f330288..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ContainerCheckedTreeViewer.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001, 2002.
- * All Rights Reserved.
- */
-package org.eclipse.ui.internal.dialogs;
-
-
-import java.util.ArrayList;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ITreeViewerListener;
-import org.eclipse.jface.viewers.TreeExpansionEvent;
-
-
-/**
- * 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-gary if all contained leafs are checked. The
- * container is grayed if some but not all leafs are checked.
- */
-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,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();
- }
-
- private void initViewer() {
- setUseHashlookup(true);
- addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- doCheckStateChanged(event.getElement());
- }
- });
- addTreeListener(new ITreeViewerListener() {
- public void treeCollapsed(TreeExpansionEvent event) {
- }
- public void treeExpanded(TreeExpansionEvent event) {
- Widget item= findItem(event.getElement());
- if (item instanceof TreeItem) {
- initializeItem((TreeItem) item);
- }
- }
- });
- }
-
- 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());
- }
- }
-
- /**
- * The item has expanded. Updates the checked state of its children.
- */
- private void initializeItem(TreeItem item) {
- if (item.getChecked() && !item.getGrayed()) {
- updateChildrenItems((TreeItem) item);
- }
- }
-
- /**
- * Updates the check state of all created children
- */
- private void updateChildrenItems(TreeItem parent) {
- Item[] children= getChildren(parent);
- boolean state= parent.getChecked();
- for (int i= 0; i < children.length; i++) {
- TreeItem curr= (TreeItem) children[i];
- 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 (int i= 0; i < children.length; i++) {
- TreeItem curr= (TreeItem) children[i];
- containsChecked |= curr.getChecked();
- containsUnchecked |= (!curr.getChecked() || curr.getGrayed());
- }
- item.setChecked(containsChecked);
- item.setGrayed(containsChecked && containsUnchecked);
- updateParentItems(item.getParentItem());
- }
- }
-
- /*
- * @see ICheckable#setChecked(Object, boolean)
- */
- public boolean setChecked(Object element, boolean state) {
- if (super.setChecked(element, state)) {
- doCheckStateChanged(element);
- return true;
- }
- return false;
- }
-
- /*
- * @see CheckboxTreeViewer#setCheckedElements(Object[])
- */
- public void setCheckedElements(Object[] elements) {
- super.setCheckedElements(elements);
- for (int i= 0; i < elements.length; i++) {
- doCheckStateChanged(elements[i]);
- }
- }
-
- /*
- * @see AbstractTreeViewer#setExpanded(Item, boolean)
- */
- protected void setExpanded(Item item, boolean expand) {
- super.setExpanded(item, expand);
- if (expand && item instanceof TreeItem) {
- initializeItem((TreeItem) item);
- }
- }
-
- /*
- * @see CheckboxTreeViewer#getCheckedElements()
- */
- 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 (int i= 0; i < checked.length; i++) {
- Object curr= checked[i];
- 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();
- }
-
- private void collectChildren(Object element, ArrayList result) {
- Object[] filteredChildren= getFilteredChildren(element);
- for (int i= 0; i < filteredChildren.length; i++) {
- Object curr= filteredChildren[i];
- result.add(curr);
- collectChildren(curr, result);
- }
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CreateProjectStep.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CreateProjectStep.java
deleted file mode 100644
index adbd9fb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CreateProjectStep.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Represents the create project step in a multi-step
- * wizard.
- */
-public class CreateProjectStep extends WizardStep {
- private CreateProjectWizard stepWizard;
-
- /**
- * Creates the project creation step
- *
- * @param number the step order number
- * @param page the wizard page containing the new project name and location
- * @param wizard the multi-step wizard for collecting new project information
- */
- public CreateProjectStep(int number, WizardNewProjectNameAndLocationPage page, NewProjectWizard wizard) {
- super(number);
- stepWizard = new CreateProjectWizard(page, wizard);
- }
-
- /* (non-Javadoc)
- * Method declared on WizardStep.
- */
- public String getLabel() {
- return WorkbenchMessages.getString("CreateProjectStep.label"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on WizardStep.
- */
- public String getDetails() {
- return WorkbenchMessages.format("CreateProjectStep.details", new Object[] {stepWizard.getProjectName()}); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on WizardStep.
- */
- public IWizard getWizard() {
- return stepWizard;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CreateProjectWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CreateProjectWizard.java
deleted file mode 100644
index 766b017..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/CreateProjectWizard.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResourceStatus;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Internal workbench wizard to create a project
- * resource in the workspace. This project will have
- * no capabilities when created. This wizard is intended
- * to be used by the CreateProjectStep class only.
- */
-public class CreateProjectWizard extends Wizard {
- private NewProjectWizard wizard;
- private WizardNewProjectNameAndLocationPage page;
-
- /**
- * Creates an empty wizard for creating a new project
- * in the workspace.
- */
- /* package */ CreateProjectWizard(WizardNewProjectNameAndLocationPage page, NewProjectWizard wizard) {
- super();
- this.page = page;
- this.wizard = wizard;
- }
-
- /**
- * Creates a new project resource with the entered name.
- *
- * @return the created project resource, or <code>null</code> if the project
- * was not created
- */
- private IProject createNewProject() {
- // get a project handle
- final IProject newProjectHandle = page.getProjectHandle();
-
- // get a project descriptor
- IPath defaultPath = Platform.getLocation();
- IPath newPath = page.getLocationPath();
- if (defaultPath.equals(newPath))
- newPath = null;
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- final IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
- description.setLocation(newPath);
-
- // define the operation to create a new project
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- createProject(description, newProjectHandle, monitor);
- }
- };
-
- // run the operation to create a new project
- try {
- getContainer().run(true, true, op);
- }
- catch (InterruptedException e) {
- return null;
- }
- catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof CoreException) {
- if (((CoreException)t).getStatus().getCode() == IResourceStatus.CASE_VARIANT_EXISTS) {
- MessageDialog.openError(
- getShell(),
- WorkbenchMessages.getString("CreateProjectWizard.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("CreateProjectWizard.caseVariantExistsError") //$NON-NLS-1$,
- );
- } else {
- ErrorDialog.openError(
- getShell(),
- WorkbenchMessages.getString("CreateProjectWizard.errorTitle"), //$NON-NLS-1$
- null, // no special message
- ((CoreException) t).getStatus());
- }
- } else {
- // Unexpected runtime exceptions and errors may still occur.
- Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog().log(
- new Status(
- Status.ERROR,
- PlatformUI.PLUGIN_ID,
- 0,
- t.toString(),
- t));
- MessageDialog.openError(
- getShell(),
- WorkbenchMessages.getString("CreateProjectWizard.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("CreateProjectWizard.internalError", new Object[] {t.getMessage()})); //$NON-NLS-1$
- }
- return null;
- }
-
- return newProjectHandle;
- }
-
- /**
- * Creates a project resource given the project handle and description.
- *
- * @param description the project description to create a project resource for
- * @param projectHandle the project handle to create a project resource for
- * @param monitor the progress monitor to show visual progress with
- *
- * @exception CoreException if the operation fails
- * @exception OperationCanceledException if the operation is canceled
- */
- private void createProject(IProjectDescription description, IProject projectHandle, IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- try {
- monitor.beginTask("", 2000); //$NON-NLS-1$
-
- projectHandle.create(description, new SubProgressMonitor(monitor,1000));
-
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- projectHandle.open(new SubProgressMonitor(monitor,1000));
-
- } finally {
- monitor.done();
- }
- }
-
- /**
- * Returns the current project name.
- *
- * @return the project name or <code>null</code>
- * if no project name is known
- */
- /* package */ String getProjectName() {
- return page.getProjectName();
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean performFinish() {
- if (wizard.getNewProject() != null)
- return true;
-
- IProject project = createNewProject();
- if (project != null) {
- wizard.setNewProject(project);
- return true;
- } else {
- return false;
- }
- }
-}
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
deleted file mode 100644
index 43b848c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DecoratorsPreferencePage.java
+++ /dev/null
@@ -1,247 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-
-/**
- * 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 {
-
- private Text descriptionText;
- private CheckboxTableViewer checkboxViewer;
-
- /**
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
-
- Font font = parent.getFont();
-
- WorkbenchHelp.setHelp(parent, IHelpContextIds.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);
-
- Label topLabel = new Label(mainComposite, SWT.NONE);
- topLabel.setText(
- WorkbenchMessages.getString("DecoratorsPreferencePage.explanation")); //$NON-NLS-1$
- topLabel.setFont(font);
-
- 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.getString("DecoratorsPreferencePage.decoratorsLabel")); //$NON-NLS-1$
- decoratorsLabel.setFont(mainFont);
-
- // Checkbox table viewer of decorators
- checkboxViewer =
- CheckboxTableViewer.newCheckList(
- decoratorsComposite,
- SWT.SINGLE | SWT.TOP | SWT.BORDER);
- checkboxViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
- checkboxViewer.getTable().setFont(decoratorsComposite.getFont());
- checkboxViewer.setLabelProvider(new LabelProvider() {
- public String getText(Object element) {
- return ((DecoratorDefinition) element).getName();
- }
- });
- checkboxViewer.getTable().setFont(mainFont);
-
- checkboxViewer.setContentProvider(new IStructuredContentProvider() {
- public void dispose() {
- //Nothing to do on dispose
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- public Object[] getElements(Object inputElement) {
- //Make an entry for each decorator definition
- return (DecoratorDefinition[]) inputElement;
- }
-
- });
-
- checkboxViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- if (event.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- DecoratorDefinition definition =
- (DecoratorDefinition) sel.getFirstElement();
- if (definition == null)
- clearDescription();
- else
- showDescription(definition);
- }
- }
- });
-
- checkboxViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent 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.getString("DecoratorsPreferencePage.description")); //$NON-NLS-1$
- descriptionLabel.setFont(mainFont);
-
- descriptionText =
- new Text(textComposite, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER | SWT.H_SCROLL);
- descriptionText.setLayoutData(new GridData(GridData.FILL_BOTH));
- descriptionText.setFont(mainFont);
- }
-
- /**
- * Populates the list of decorators.
- */
- private void populateDecorators() {
- DecoratorDefinition[] definitions = getDefinitions();
- checkboxViewer.setInput(definitions);
- for (int i = 0; i < definitions.length; i++) {
- checkboxViewer.setChecked(definitions[i], definitions[i].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.getString(
- "DecoratorsPreferencePage.noDescription")); //$NON-NLS-1$
- 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()
- */
- protected void performDefaults() {
- super.performDefaults();
- DecoratorManager manager = (DecoratorManager) WorkbenchPlugin.getDefault().getDecoratorManager();
- DecoratorDefinition[] definitions = manager.getDecoratorDefinitions();
- for (int i = 0; i < definitions.length; i++) {
- checkboxViewer.setChecked(definitions[i],definitions[i].getDefaultValue());
- }
- }
-
- /**
- * @see IPreferencePage#performOk()
- */
- public boolean performOk() {
- if (super.performOk()) {
- DecoratorManager manager = getDecoratorManager();
- DecoratorDefinition[] definitions = manager.getDecoratorDefinitions();
- for (int i = 0; i < definitions.length; i++) {
- boolean checked = checkboxViewer.getChecked(definitions[i]);
- definitions[i].setEnabledWithErrorHandling(checked);
-
- }
- manager.reset();
- return true;
- }
- return false;
- }
-
- /**
- * @see IWorkbenchPreferencePage#init(IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
- /**
- * Get the decorator definitions for the workbench.
- */
- private DecoratorDefinition[] getDefinitions() {
- return getDecoratorManager().getDecoratorDefinitions();
- }
-
- /**
- * Get the DecoratorManager being used for this
- */
-
- private DecoratorManager getDecoratorManager(){
- return (DecoratorManager) WorkbenchPlugin
- .getDefault()
- .getDecoratorManager();
- }
-
-}
\ No newline at end of file
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
deleted file mode 100644
index 5e1f160..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/DialogUtil.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * Utility class to help with dialogs.
- */
-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)
- nestedException = (CoreException)status.getException();
-
- if (nestedException != null) {
- // Open an error dialog and include the extra
- // status information from the nested CoreException
- ErrorDialog.openError(
- parent,
- title,
- message,
- nestedException.getStatus());
- }
- else {
- // Open a regular error dialog since there is no
- // extra information to display
- MessageDialog.openError(
- parent,
- title,
- message);
- }
-}
-
-/**
- * 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) {
-
- int startBracket = label.indexOf("(&");
- //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);
- }
-
- int i = label.indexOf('&');
- if (i >= 0)
- label = label.substring(0, i) + label.substring(i+1);
-
- return label;
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EditorSelectionDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EditorSelectionDialog.java
deleted file mode 100644
index 43bf96b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EditorSelectionDialog.java
+++ /dev/null
@@ -1,420 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.program.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.ProgramImageDescriptor;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.io.File;
-
-
-/**
- * This class is used to allow the user to select a dialog from the set of
- * internal and external editors.
- *
- * @private
- * This class is internal to the workbench and must not be called outside the workbench
-*/
-
-public class EditorSelectionDialog extends Dialog implements Listener {
- private EditorDescriptor selectedEditor;
- private Button externalButton;
- private Table editorTable;
- private Button browseExternalEditorsButton;
- private Button internalButton;
- private Button okButton;
- private Button cancelButton;
- private static final String EditorSelectionDialog = "FileSystemExportPage1.CreateDirectoriesForSelectedContainers";//$NON-NLS-1$
- private static final String STORE_ID_INTERNAL_EXTERNAL = "EditorSelectionDialog.STORE_ID_INTERNAL_EXTERNAL";//$NON-NLS-1$
- private String message = WorkbenchMessages.getString("EditorSelection.chooseAnEditor"); //$NON-NLS-1$
- // collection of IEditorDescriptor
- private IEditorDescriptor[] externalEditors;
- private IEditorDescriptor[] internalEditors;
- private Image[] externalEditorImages;
- private Image[] internalEditorImages;
- private IEditorDescriptor[] editorsToFilter;
- private static final String [] Executable_Filters;
- private static final int TABLE_WIDTH = 200;
- static {
- if(SWT.getPlatform().equals("win32")) {//$NON-NLS-1$
- Executable_Filters = new String[] { "*.exe", "*.bat", "*.*"};//$NON-NLS-1$
- } else {
- Executable_Filters = new String[] {"*"}; //$NON-NLS-1$
- }
- }
-public EditorSelectionDialog(Shell parentShell) {
- super(parentShell);
-}
-
-/**
- * This method is called if a button has been pressed.
- */
-protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID)
- saveWidgetValues();
- super.buttonPressed(buttonId);
-}
-/**
- * Close the window.
- */
-public boolean close() {
- if (internalEditorImages != null) {
- for (int i = 0; i < internalEditorImages.length; i++) {
- internalEditorImages[i].dispose();
- }
- internalEditorImages = null;
- }
- if (externalEditorImages != null) {
- for (int i = 0; i < externalEditorImages.length; i++) {
- externalEditorImages[i].dispose();
- }
- externalEditorImages = null;
- }
- return super.close();
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(WorkbenchMessages.getString("EditorSelection.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(shell, IHelpContextIds.EDITOR_SELECTION_DIALOG);
-}
-/**
- * Creates and returns the contents of the upper part
- * of the dialog (above the button bar).
- *
- * Subclasses should overide.
- *
- * @param the parent composite to contain the dialog area
- * @return the dialog area control
- */
-protected Control createDialogArea(Composite parent) {
- // create main group
- Composite contents = (Composite)super.createDialogArea(parent);
- ((GridLayout)contents.getLayout()).numColumns = 2;
-
- // begin the layout
- Label textLabel = new Label(contents,SWT.NONE);
- textLabel.setText(message);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- textLabel.setLayoutData(data);
- textLabel.setFont(parent.getFont());
-
- internalButton = new Button(contents, SWT.RADIO | SWT.LEFT);
- internalButton.setText(WorkbenchMessages.getString("EditorSelection.internal")); //$NON-NLS-1$
- internalButton.addListener(SWT.Selection, this);
- data = new GridData();
- data.horizontalSpan = 1;
- internalButton.setLayoutData(data);
- internalButton.setFont(parent.getFont());
-
- externalButton = new Button(contents, SWT.RADIO | SWT.LEFT);
- externalButton.setText(WorkbenchMessages.getString("EditorSelection.external")); //$NON-NLS-1$
- externalButton.addListener(SWT.Selection, this);
- data = new GridData();
- data.horizontalSpan = 1;
- externalButton.setLayoutData(data);
- externalButton.setFont(parent.getFont());
-
- editorTable = new Table(contents, SWT.SINGLE | SWT.BORDER);
- editorTable.addListener(SWT.Selection, this);
- editorTable.addListener(SWT.DefaultSelection, this);
- editorTable.addListener(SWT.MouseDoubleClick, this);
- data = new GridData();
- data.widthHint = convertHorizontalDLUsToPixels(TABLE_WIDTH);
- data.horizontalAlignment= GridData.FILL;
- data.grabExcessHorizontalSpace= true;
- data.verticalAlignment= GridData.FILL;
- data.grabExcessVerticalSpace= true;
- data.horizontalSpan = 2;
- editorTable.setLayoutData(data);
- data.heightHint = editorTable.getItemHeight()*12;
-
- browseExternalEditorsButton = new Button(contents, SWT.PUSH);
- browseExternalEditorsButton.setText(WorkbenchMessages.getString("EditorSelection.browse")); //$NON-NLS-1$
- browseExternalEditorsButton.addListener(SWT.Selection, this);
- data = new GridData();
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, browseExternalEditorsButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- browseExternalEditorsButton.setLayoutData(data);
- browseExternalEditorsButton.setFont(parent.getFont());
-
- restoreWidgetValues(); // Place buttons to the appropriate state
-
- fillEditorTable();
-
- updateEnableState();
-
- return contents;
-}
-protected void fillEditorTable() {
- editorTable.removeAll();
- editorTable.update();
- IEditorDescriptor[] editors;
- Image[] images;
- if (internalButton.getSelection()) {
- editors = getInternalEditors();
- images = internalEditorImages;
- } else {
- editors = getExternalEditors();
- images = externalEditorImages;
- }
-
- // 1FWHIEX: ITPUI:WINNT - Need to call setRedraw
- editorTable.setRedraw(false);
- for (int i = 0; i < editors.length; i++) {
- TableItem item = new TableItem(editorTable, SWT.NULL);
- item.setData(editors[i]);
- item.setText(editors[i].getLabel());
- item.setImage(images[i]);
- }
- editorTable.setRedraw(true);
-}
-/**
- * Return the dialog store to cache values into
- */
-
-protected IDialogSettings getDialogSettings() {
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("EditorSelectionDialog");//$NON-NLS-1$
- if(section == null)
- section = workbenchSettings.addNewSection("EditorSelectionDialog");//$NON-NLS-1$
- return section;
-}
-/**
- * Get a list of registered programs from the OS
- */
-protected IEditorDescriptor[] getExternalEditors() {
- if (externalEditors == null) {
- // Since this can take a while, show the busy
- // cursor. If the dialog is not yet visible,
- // then use the parent shell.
- Control shell = getShell();
- if (!shell.isVisible()) {
- Control topShell = shell.getParent();
- if (topShell != null)
- shell = topShell;
- }
- Cursor busy = new Cursor(shell.getDisplay(), SWT.CURSOR_WAIT);
- shell.setCursor(busy);
- // Get the external editors available
- EditorRegistry reg = (EditorRegistry)WorkbenchPlugin.getDefault().getEditorRegistry();
- externalEditors = reg.getSortedEditorsFromOS();
- externalEditors = filterEditors(externalEditors);
- externalEditorImages = getImages(externalEditors);
- // Clean up
- shell.setCursor(null);
- busy.dispose();
- }
- return externalEditors;
-}
-/**
- * Returns an array of editors which have been filtered according to
- * the array of editors in the editorsToFilter instance variable.
- *
- * @param editorsToFilter an array of editors to filter
- * @return a filtered array of editors
- */
-protected IEditorDescriptor[] filterEditors(IEditorDescriptor[] editors){
- if ((editors == null) || (editors.length < 1))
- return editors;
-
- if ((editorsToFilter == null) || (editorsToFilter.length < 1))
- return editors;
-
- ArrayList filteredList = new ArrayList();
- for (int i = 0; i < editors.length; i++) {
- boolean add = true;
- for (int j = 0; j < editorsToFilter.length; j++) {
- if (editors[i].getId().equals(editorsToFilter[j].getId())) {
- add = false;
- }
- }
- if (add)
- filteredList.add(editors[i]);
- }
-
- return (IEditorDescriptor[]) filteredList.toArray(new IEditorDescriptor[filteredList.size()]);
-}
-
-/**
- * Returns an array of images for the given array of editors
- */
-protected Image[] getImages(IEditorDescriptor[] editors) {
- Image[] images = new Image[editors.length];
- for (int i = 0; i < editors.length; i++) {
- images[i] = editors[i].getImageDescriptor().createImage();
- }
- return images;
-}
-/**
- * Returns the internal editors
- */
-protected IEditorDescriptor[] getInternalEditors() {
- if (internalEditors == null) {
- EditorRegistry reg = (EditorRegistry)WorkbenchPlugin.getDefault().getEditorRegistry();
- internalEditors = reg.getSortedEditorsFromPlugins();
- internalEditors = filterEditors(internalEditors);
- internalEditorImages = getImages(internalEditors);
- }
- return internalEditors;
-}
-/**
- * Return the editor the user selected
- */
-public IEditorDescriptor getSelectedEditor() {
- return selectedEditor;
-}
-public void handleEvent(Event event) {
- if (event.type == SWT.MouseDoubleClick){
- handleDoubleClickEvent();
- return;
- }
- if (event.widget == externalButton) {
- fillEditorTable();
- } else if (event.widget == browseExternalEditorsButton) {
- promptForExternalEditor();
- } else if (event.widget == editorTable) {
- if (editorTable.getSelectionIndex() != -1){
- selectedEditor = (EditorDescriptor)editorTable.getSelection()[0].getData();
- } else {
- selectedEditor = null;
- okButton.setEnabled(false);
- }
- }
- updateEnableState();
-}
-protected void promptForExternalEditor() {
- FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.PRIMARY_MODAL);
- dialog.setFilterExtensions(Executable_Filters);
- String result = dialog.open();
- if (result != null) {
- EditorDescriptor editor = new EditorDescriptor();
- editor.setFileName(result);
- editor.setID(result);
- //Isolate the program name (no directory or extension)
- int start = result.lastIndexOf(File.separator);
- String name;
- if (start != -1) {
- name = result.substring(start + 1);
- } else {
- name = result;
- }
- 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(result, 0);
- editor.setImageDescriptor(imageDescriptor);
- // pretend we had obtained it from the list of os registered editors
- TableItem ti = new TableItem(editorTable, SWT.NULL);
- ti.setData(editor);
- ti.setText(editor.getLabel());
- Image image = editor.getImageDescriptor().createImage();
- ti.setImage(image);
-
- // need to pass an array to setSelection -- 1FSKYVO: SWT:ALL - inconsistent setSelection api on Table
- editorTable.setSelection(new TableItem[] {ti});
- editorTable.showSelection();
- editorTable.setFocus();
- selectedEditor = editor;
-
- /* 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);
- newEditors[newEditors.length-1] = editor;
- externalEditors = newEditors;
-
- Image[] newImages = new Image[externalEditorImages.length+1];
- System.arraycopy(externalEditorImages, 0, newImages, 0, externalEditorImages.length);
- newImages[newImages.length-1] = image;
- externalEditorImages = newImages;
- }
-}
-/**
- * Handle a double click event on the list
- */
-protected void handleDoubleClickEvent() {
- buttonPressed(IDialogConstants.OK_ID);
-}
-/**
- * Use the dialog store to restore widget values to the values that they held
- * last time this wizard was used to completion
- */
-protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- boolean wasExternal = settings.getBoolean(STORE_ID_INTERNAL_EXTERNAL);
- internalButton.setSelection(!wasExternal);
- externalButton.setSelection(wasExternal);
-}
-/**
- * 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() {
- IDialogSettings settings = getDialogSettings();
- // record whether use was viewing internal or external editors
- settings.put(STORE_ID_INTERNAL_EXTERNAL,!internalButton.getSelection());
-}
-/**
- * Set the message displayed by this message dialog
- */
-public void setMessage(String aMessage) {
- message = aMessage;
-}
-/**
- * Set the editors which will not appear in the dialog.
- *
- * @param editors an array of editors
- */
-public void setEditorsToFilter(IEditorDescriptor[] editors) {
- editorsToFilter = editors;
-}
-
-public void updateEnableState() {
- boolean enableExternal = externalButton.getSelection();
- browseExternalEditorsButton.setEnabled(enableExternal);
- updateOkButton();
-}
-protected void createButtonsForButtonBar(Composite parent) {
- okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- //initially there is no selection so OK button should not be enabled
- okButton.setEnabled(false);
-
-}
-/**
- * Update the button enablement state.
- */
-protected void updateOkButton() {
- // Buttons are null during dialog creation
- if (okButton == null)
- return;
- // If there is no selection, do not enable OK button
- if (editorTable.getSelectionCount() == 0){
- okButton.setEnabled(false);
- return;
- }
- // At this point, there is a selection
- okButton.setEnabled(selectedEditor != null);
-}
-}
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
deleted file mode 100644
index 9fa52e6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EditorsPreferencePage.java
+++ /dev/null
@@ -1,452 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import java.io.UnsupportedEncodingException;
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Hashtable;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.preference.FieldEditor;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.IntegerFieldEditor;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.preference.StringFieldEditor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.IPreferenceConstants;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-import org.eclipse.ui.internal.Workbench;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.registry.AcceleratorConfiguration;
-import org.eclipse.ui.internal.registry.AcceleratorRegistry;
-
-public class EditorsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- private IWorkbench workbench;
-
- // State for encoding group
- private String defaultEnc;
- private Button defaultEncodingButton;
- private Button otherEncodingButton;
- private Combo encodingCombo;
-
- private Combo accelConfigCombo;
-
- private Button reuseEditors;
- private Group reuseDirtyEditorGroup;
- private Button openNewEditor;
- private Button promptToReuseEditor;
- private IntegerFieldEditor reuseEditorsThreshold;
- private Composite editorReuseGroup;
-
- private IntegerFieldEditor recentFilesEditor;
-
- // hashtable mapping accelerator configuration names to accelerator configuration
- private Hashtable namesToConfiguration;
- // the name of the active accelerator configuration
- private String activeAcceleratorConfigurationName;
-
- protected Control createContents(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(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
- composite.setFont(parent.getFont());
-
- createEditorHistoryGroup(composite);
-
- WorkbenchPreferencePage.createSpace(composite);
- createEditorReuseGroup(composite);
-
- WorkbenchPreferencePage.createSpace(composite);
- createAcceleratorConfigurationGroup(composite, WorkbenchMessages.getString("WorkbenchPreference.acceleratorConfiguration"));
-
- WorkbenchPreferencePage.createSpace(composite);
- createEncodingGroup(composite);
- validCheck();
-
- WorkbenchHelp.setHelp(parent, IHelpContextIds.WORKBENCH_EDITOR_PREFERENCE_PAGE);
-
- return composite;
- }
-
- public void init(IWorkbench aWorkbench) {
- workbench = aWorkbench;
- acceleratorInit(workbench);
- }
-
- protected void performDefaults() {
- IPreferenceStore store = getPreferenceStore();
- updateEncodingState(true);
- acceleratorPerformDefaults(store);
- reuseEditors.setSelection(store.getDefaultBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN));
- reuseDirtyEditorGroup.setEnabled(reuseEditors.getSelection());
- openNewEditor.setSelection(!store.getDefaultBoolean(IPreferenceConstants.REUSE_DIRTY_EDITORS));
- openNewEditor.setEnabled(reuseEditors.getSelection());
- promptToReuseEditor.setSelection(store.getDefaultBoolean(IPreferenceConstants.REUSE_DIRTY_EDITORS));
- promptToReuseEditor.setEnabled(reuseEditors.getSelection());
- reuseEditorsThreshold.loadDefault();
- reuseEditorsThreshold.getLabelControl(editorReuseGroup).setEnabled(reuseEditors.getSelection());
- reuseEditorsThreshold.getTextControl(editorReuseGroup).setEnabled(reuseEditors.getSelection());
- recentFilesEditor.loadDefault();
- }
-
- public boolean performOk() {
- IPreferenceStore store = getPreferenceStore();
- Preferences resourcePrefs = ResourcesPlugin.getPlugin().getPluginPreferences();
- if (defaultEncodingButton.getSelection()) {
- resourcePrefs.setToDefault(ResourcesPlugin.PREF_ENCODING);
- }
- else {
- String enc = encodingCombo.getText();
- resourcePrefs.setValue(ResourcesPlugin.PREF_ENCODING, enc);
- }
-
- ResourcesPlugin.getPlugin().savePluginPreferences();
-
- acceleratorPerformOk(store);
-
- // store the reuse editors setting
- store.setValue(IPreferenceConstants.REUSE_EDITORS_BOOLEAN,reuseEditors.getSelection());
- store.setValue(IPreferenceConstants.REUSE_DIRTY_EDITORS,promptToReuseEditor.getSelection());
- reuseEditorsThreshold.store();
-
- // store the recent files setting
- recentFilesEditor.store();
-
- return super.performOk();
- }
- /**
- * Returns preference store that belongs to the our plugin.
- *
- * @return the preference store for this plugin
- */
- protected IPreferenceStore doGetPreferenceStore() {
- return WorkbenchPlugin.getDefault().getPreferenceStore();
- }
-
- private void createEncodingGroup(Composite parent) {
-
- Font font = parent.getFont();
- Group group = new Group(parent, SWT.NONE);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- group.setLayoutData(data);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- group.setLayout(layout);
- group.setText(WorkbenchMessages.getString("WorkbenchPreference.encoding")); //$NON-NLS-1$
- group.setFont(font);
-
- SelectionAdapter buttonListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEncodingState(defaultEncodingButton.getSelection());
- validCheck();
- }
- };
-
- defaultEncodingButton = new Button(group, SWT.RADIO);
- defaultEnc = System.getProperty("file.encoding", "UTF-8"); //$NON-NLS-1$ //$NON-NLS-2$
- defaultEncodingButton.setText(WorkbenchMessages.format("WorkbenchPreference.defaultEncoding", new String[] { defaultEnc })); //$NON-NLS-1$
- data = new GridData();
- data.horizontalSpan = 2;
- defaultEncodingButton.setLayoutData(data);
- defaultEncodingButton.addSelectionListener(buttonListener);
- defaultEncodingButton.setFont(font);
-
- otherEncodingButton = new Button(group, SWT.RADIO);
- otherEncodingButton.setText(WorkbenchMessages.getString("WorkbenchPreference.otherEncoding")); //$NON-NLS-1$
- otherEncodingButton.addSelectionListener(buttonListener);
- otherEncodingButton.setFont(font);
-
- encodingCombo = new Combo(group, SWT.NONE);
- data = new GridData();
- data.widthHint = convertWidthInCharsToPixels(15);
- encodingCombo.setFont(font);
- encodingCombo.setLayoutData(data);
- encodingCombo.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validCheck();
- }
- });
-
- ArrayList encodings = new ArrayList();
- int n = 0;
- try {
- n = Integer.parseInt(WorkbenchMessages.getString("WorkbenchPreference.numDefaultEncodings")); //$NON-NLS-1$
- }
- catch (NumberFormatException e) {
- // Ignore;
- }
- for (int i = 0; i < n; ++i) {
- String enc = WorkbenchMessages.getString("WorkbenchPreference.defaultEncoding" + (i+1), null); //$NON-NLS-1$
- if (enc != null) {
- encodings.add(enc);
- }
- }
-
- if (!encodings.contains(defaultEnc)) {
- encodings.add(defaultEnc);
- }
-
- String enc = ResourcesPlugin.getPlugin().getPluginPreferences().getString(ResourcesPlugin.PREF_ENCODING);
- boolean isDefault = enc == null || enc.length() == 0;
-
- if (!isDefault && !encodings.contains(enc)) {
- encodings.add(enc);
- }
- Collections.sort(encodings);
- for (int i = 0; i < encodings.size(); ++i) {
- encodingCombo.add((String) encodings.get(i));
- }
-
- encodingCombo.setText(isDefault ? defaultEnc : enc);
-
- updateEncodingState(isDefault);
- }
- private void validCheck() {
- if (!isEncodingValid()) {
- setErrorMessage(WorkbenchMessages.getString("WorkbenchPreference.unsupportedEncoding")); //$NON-NLS-1$
- setValid(false);
- }
- else {
- setErrorMessage(null);
- setValid(true);
- }
- }
-
- private boolean isEncodingValid() {
- return defaultEncodingButton.getSelection() ||
- isValidEncoding(encodingCombo.getText());
- }
-
- private boolean isValidEncoding(String enc) {
- try {
- new String(new byte[0], enc);
- return true;
- } catch (UnsupportedEncodingException e) {
- return false;
- }
- }
-
- private void updateEncodingState(boolean useDefault) {
- defaultEncodingButton.setSelection(useDefault);
- otherEncodingButton.setSelection(!useDefault);
- encodingCombo.setEnabled(!useDefault);
- setErrorMessage(null);
- setValid(true);
- }
-
- /**
- * Creates a composite that contains a label and combo box specifying the active
- * accelerator configuration.
- */
- protected void createAcceleratorConfigurationGroup(Composite composite, String label) {
-
- Font font = composite.getFont();
-
- Composite groupComposite = new Composite(composite, SWT.LEFT);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- groupComposite.setLayout(layout);
- GridData gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- groupComposite.setLayoutData(gd);
- groupComposite.setFont(font);
-
- WorkbenchPreferencePage.createLabel(groupComposite, label);
- accelConfigCombo = WorkbenchPreferencePage.createCombo(groupComposite);
-
- if(namesToConfiguration.size() > 0) {
- String[] comboItems = new String[namesToConfiguration.size()];
- namesToConfiguration.keySet().toArray(comboItems);
- Arrays.sort(comboItems,Collator.getInstance());
- accelConfigCombo.setItems(comboItems);
-
- if(activeAcceleratorConfigurationName != null)
- accelConfigCombo.select(accelConfigCombo.indexOf(activeAcceleratorConfigurationName));
- } else {
- accelConfigCombo.setEnabled(false);
- }
- }
- protected void acceleratorInit(IWorkbench aWorkbench) {
- namesToConfiguration = new Hashtable();
- WorkbenchPlugin plugin = WorkbenchPlugin.getDefault();
- AcceleratorRegistry registry = plugin.getAcceleratorRegistry();
- AcceleratorConfiguration configs[] = registry.getConfigsWithSets();
- for (int i = 0; i < configs.length; i++)
- namesToConfiguration.put(configs[i].getName(), configs[i]);
-
- AcceleratorConfiguration config = ((Workbench)aWorkbench).getActiveAcceleratorConfiguration();
- if(config != null)
- activeAcceleratorConfigurationName = config.getName();
- }
- protected void acceleratorPerformDefaults(IPreferenceStore store) {
- // Sets the accelerator configuration selection to the default configuration
- String id = store.getDefaultString(IWorkbenchConstants.ACCELERATOR_CONFIGURATION_ID);
- AcceleratorRegistry registry = WorkbenchPlugin.getDefault().getAcceleratorRegistry();
- AcceleratorConfiguration config = registry.getConfiguration(id);
- String name = null;
- if(config != null)
- name = config.getName();
- if((name != null) && (accelConfigCombo != null))
- accelConfigCombo.select(accelConfigCombo.indexOf(name));
- }
- protected void acceleratorPerformOk(IPreferenceStore store) {
- // store the active accelerator configuration id
- if(accelConfigCombo != null) {
- String configName = accelConfigCombo.getText();
- AcceleratorConfiguration config = (AcceleratorConfiguration)namesToConfiguration.get(configName);
- if(config != null) {
- Workbench workbench = (Workbench)PlatformUI.getWorkbench();
- workbench.setActiveAcceleratorConfiguration(config);
- store.setValue(IWorkbenchConstants.ACCELERATOR_CONFIGURATION_ID, config.getId());
- }
- }
- }
- /**
- * Create a composite that contains entry fields specifying editor reuse preferences.
- */
- private void createEditorReuseGroup(Composite composite) {
-
- Font font = composite.getFont();
-
- editorReuseGroup = new Composite(composite, SWT.LEFT);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- editorReuseGroup.setLayout(layout);
- GridData gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- editorReuseGroup.setLayoutData(gd);
- editorReuseGroup.setFont(font);
-
- reuseEditors = new Button(editorReuseGroup, SWT.CHECK);
- reuseEditors.setText(WorkbenchMessages.getString("WorkbenchPreference.reuseEditors")); //$NON-NLS-1$
- GridData reuseEditorsData = new GridData();
- reuseEditorsData.horizontalSpan = layout.numColumns;
- reuseEditors.setLayoutData(reuseEditorsData);
- reuseEditors.setFont(font);
-
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- reuseEditors.setSelection(store.getBoolean(IPreferenceConstants.REUSE_EDITORS_BOOLEAN));
- reuseEditors.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e){
- reuseEditorsThreshold.getLabelControl(editorReuseGroup).setEnabled(reuseEditors.getSelection());
- reuseEditorsThreshold.getTextControl(editorReuseGroup).setEnabled(reuseEditors.getSelection());
- reuseDirtyEditorGroup.setEnabled(reuseEditors.getSelection());
- openNewEditor.setEnabled(reuseEditors.getSelection());
- promptToReuseEditor.setEnabled(reuseEditors.getSelection());
- }
- });
-
- reuseDirtyEditorGroup = new Group(editorReuseGroup, SWT.NONE);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = layout.numColumns;
- reuseDirtyEditorGroup.setLayoutData(data);
- GridLayout groupLayout = new GridLayout();
- groupLayout.numColumns = 2;
- reuseDirtyEditorGroup.setLayout(layout);
- reuseDirtyEditorGroup.setText(WorkbenchMessages.getString("WorkbenchPreference.reuseDirtyEditorGroupTitle")); //$NON-NLS-1$
- reuseDirtyEditorGroup.setFont(font);
- reuseDirtyEditorGroup.setEnabled(reuseEditors.getSelection());
-
- promptToReuseEditor = new Button(reuseDirtyEditorGroup, SWT.RADIO);
- promptToReuseEditor.setText(WorkbenchMessages.getString("WorkbenchPreference.promptToReuseEditor")); //$NON-NLS-1$
- GridData promptToReuseEditorData = new GridData();
- promptToReuseEditorData.horizontalSpan = groupLayout.numColumns;
- promptToReuseEditor.setLayoutData(promptToReuseEditorData);
- promptToReuseEditor.setFont(font);
- promptToReuseEditor.setSelection(store.getBoolean(IPreferenceConstants.REUSE_DIRTY_EDITORS));
- promptToReuseEditor.setEnabled(reuseEditors.getSelection());
-
- openNewEditor = new Button(reuseDirtyEditorGroup, SWT.RADIO);
- openNewEditor.setText(WorkbenchMessages.getString("WorkbenchPreference.openNewEditor")); //$NON-NLS-1$
- GridData reuseDirtyEditorsData = new GridData();
- reuseDirtyEditorsData.horizontalSpan = groupLayout.numColumns;
- openNewEditor.setLayoutData(reuseDirtyEditorsData);
- openNewEditor.setFont(font);
- openNewEditor.setSelection(!store.getBoolean(IPreferenceConstants.REUSE_DIRTY_EDITORS));
- openNewEditor.setEnabled(reuseEditors.getSelection());
-
- reuseEditorsThreshold = new IntegerFieldEditor(IPreferenceConstants.REUSE_EDITORS, WorkbenchMessages.getString("WorkbenchPreference.reuseEditorsThreshold"), editorReuseGroup); //$NON-NLS-1$
-
- reuseEditorsThreshold.setPreferenceStore(WorkbenchPlugin.getDefault().getPreferenceStore());
- reuseEditorsThreshold.setPreferencePage(this);
- reuseEditorsThreshold.setTextLimit(2);
- reuseEditorsThreshold.setErrorMessage(WorkbenchMessages.getString("WorkbenchPreference.reuseEditorsThresholdError")); //$NON-NLS-1$
- reuseEditorsThreshold.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
- reuseEditorsThreshold.setValidRange(1, 99);
- reuseEditorsThreshold.load();
- reuseEditorsThreshold.getLabelControl(editorReuseGroup).setEnabled(reuseEditors.getSelection());
- reuseEditorsThreshold.getTextControl(editorReuseGroup).setEnabled(reuseEditors.getSelection());
- reuseEditorsThreshold.setPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(FieldEditor.IS_VALID))
- setValid(reuseEditorsThreshold.isValid());
- }
- });
- }
- /**
- * Create a composite that contains entry fields specifying editor history preferences.
- */
- private 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);
- groupComposite.setFont(composite.getFont());
-
- recentFilesEditor = new IntegerFieldEditor(IPreferenceConstants.RECENT_FILES, WorkbenchMessages.getString("WorkbenchPreference.recentFiles"), groupComposite); //$NON-NLS-1$
-
- int recentFilesMax = IPreferenceConstants.MAX_RECENT_FILES_SIZE;
- recentFilesEditor.setPreferenceStore(WorkbenchPlugin.getDefault().getPreferenceStore());
- recentFilesEditor.setPreferencePage(this);
- recentFilesEditor.setTextLimit(Integer.toString(recentFilesMax).length());
- recentFilesEditor.setErrorMessage(WorkbenchMessages.format("WorkbenchPreference.recentFilesError", new Object[] { new Integer(recentFilesMax)})); //$NON-NLS-1$
- recentFilesEditor.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
- recentFilesEditor.setValidRange(0, recentFilesMax);
- recentFilesEditor.load();
- recentFilesEditor.setPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(FieldEditor.IS_VALID))
- setValid(recentFilesEditor.isValid());
- }
- });
-
- }
-}
-
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
deleted file mode 100644
index 06a4e75..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPreferencePage.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.preference.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-
-/*
- * 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 {
-protected Control createContents(Composite parent) {
- 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.
- */
-protected IPreferenceStore doGetPreferenceStore() {
- return WorkbenchPlugin.getDefault().getPreferenceStore();
-}
-/**
- * @see IWorkbenchPreferencePage
- */
-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
deleted file mode 100644
index 248e235..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EmptyPropertyPage.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.jface.preference.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.dialogs.*;
-
-/*
- * A page used as a filler for nodes in the property page dialog
- * for which no page is suppplied.
- */
-public class EmptyPropertyPage extends PropertyPage {
-/**
- * Creates empty composite for this page content.
- */
-
-protected Control createContents(Composite parent) {
- return new Composite(parent, SWT.NULL);
-}
-}
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
deleted file mode 100644
index 764e725..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/EventLoopProgressMonitor.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.*;
-
-/**
- * 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
- * (including allowing the cancel button to work).
- */
-public class EventLoopProgressMonitor extends ProgressMonitorWrapper {
-
- /**
- * 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();
-
-/**
- * Constructs a new monitor.
- */
-public EventLoopProgressMonitor(IProgressMonitor monitor) {
- super(monitor);
-}
-/**
- * @see IProgressMonitor#beginTask
- */
-public void beginTask(String name, int totalWork) {
- super.beginTask(name, totalWork);
- runEventLoop();
-}
-/**
- * @see IProgressMonitor#done
- */
-public void done() {
- super.done();
- runEventLoop();
-}
-/**
- * @see IProgressMonitor#internalWorked
- */
-public void internalWorked(double work) {
- super.internalWorked(work);
- runEventLoop();
-}
-/**
- * @see IProgressMonitor#isCanceled
- */
-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;
- }
- for (;;) {
- if (!disp.readAndDispatch()) { // Exceptions walk back to parent.
- 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;
- }
- }
-}
-/**
- * @see IProgressMonitor#setCanceled
- */
-public void setCanceled(boolean b) {
- super.setCanceled(b);
- runEventLoop();
-}
-/**
- * @see IProgressMonitor#setTaskName
- */
-public void setTaskName(String name) {
- super.setTaskName(name);
- runEventLoop();
-}
-/**
- * @see IProgressMonitor#subTask
- */
-public void subTask(String name) {
- super.subTask(name);
- runEventLoop();
-}
-/**
- * @see IProgressMonitor#worked
- */
-public void worked(int work) {
- super.worked(work);
- runEventLoop();
-}
-}
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
deleted file mode 100644
index 2a3b2ba..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ExportWizard.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * 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 workbench;
- private IStructuredSelection selection;
-
-
- //the list selection page
- class SelectionPage extends WorkbenchWizardListSelectionPage {
- SelectionPage(IWorkbench w, IStructuredSelection ss, AdaptableList e, String s) {
- super(w, ss, e, s);
- }
- public void createControl(Composite parent) {
- super.createControl(parent);
- WorkbenchHelp.setHelp(getControl(), IHelpContextIds.EXPORT_WIZARD_SELECTION_WIZARD_PAGE);
- }
- protected IWizardNode createWizardNode(WorkbenchWizardElement element) {
- return new WorkbenchWizardNode(this, element) {
- public IWorkbenchWizard createWizard() throws CoreException {
- return (IWorkbenchWizard)wizardElement.createExecutableExtension();
- }
- };
- }
- }
-/**
- * Creates the wizard's pages lazily.
- */
-public void addPages() {
- addPage(
- new SelectionPage(
- this.workbench,
- this.selection,
- getAvailableExportWizards(),
- WorkbenchMessages.getString("ExportWizard.selectDestination"))); //$NON-NLS-1$
-}
-/**
- * Returns the export wizards that are available for invocation.
- */
-protected AdaptableList getAvailableExportWizards() {
- return new WizardsRegistryReader(IWorkbenchConstants.PL_EXPORT).getWizards();
-}
-/**
- * Initializes the wizard.
- */
-public void init(IWorkbench aWorkbench,IStructuredSelection currentSelection) {
- this.workbench = aWorkbench;
- this.selection = currentSelection;
-
- setWindowTitle(WorkbenchMessages.getString("ExportWizard.title")); //$NON-NLS-1$
- 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.
- */
-public boolean performFinish() {
- ((SelectionPage)getPages()[0]).saveWidgetValues();
- return true;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeAction.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeAction.java
deleted file mode 100644
index 7225bfc..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeAction.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.model.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.*;
-import java.util.*;
-
-/**
- * A fake action for the action set dialog.
- */
-public class FakeAction implements IAdaptable, IWorkbenchAdapter {
- private String label;
- private ImageDescriptor imageDesc;
-/**
- * ActionSetContent constructor comment.
- */
-public FakeAction(String label, ImageDescriptor imageDesc) {
- this.label = label;
- this.imageDesc = imageDesc;
-}
-/**
- * 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 Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- return null;
-}
-/**
- * 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 object The object to get the children for.
- */
-public Object[] getChildren(Object o) {
- return new Object[0];
-}
-/**
- * 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.
- */
-public ImageDescriptor getImageDescriptor(Object object) {
- return imageDesc;
-}
-/**
- * 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 object The object to get a label for.
- */
-public String getLabel(Object o) {
- return label;
-}
-/**
- * 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 object The object to get the parent for.
- */
-public Object getParent(Object o) {
- return null;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeActionSetCategory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeActionSetCategory.java
deleted file mode 100644
index 64163c1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeActionSetCategory.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.registry.*;
-import java.util.*;
-
-/**
- * A fake action set category for the action set dialog.
- */
-public class FakeActionSetCategory extends ActionSetCategory {
- private HashMap map = new HashMap(10);
-/**
- * FakeActionSetCategory constructor comment.
- * @param id java.lang.String
- * @param label java.lang.String
- */
-public FakeActionSetCategory(String id, String label) {
- super(id, label);
-}
-/**
- * Adds an action set.
- */
-public void addActionSet(IActionSetDescriptor desc) {
- super.addActionSet(desc);
- map.put(desc.getId(), desc);
-}
-/**
- * Returns the action set with a given id.
- */
-public IActionSetDescriptor findActionSet(String id) {
- return (IActionSetDescriptor)map.get(id);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeActionSetDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeActionSetDescriptor.java
deleted file mode 100644
index 844bb33..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeActionSetDescriptor.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.model.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.*;
-import java.util.*;
-
-/**
- * A fake view action set.
- */
-public abstract class FakeActionSetDescriptor implements
- IAdaptable, IWorkbenchAdapter, IActionSetDescriptor
-{
- private String id;
- private Object data;
- private String category;
- private Object [] children;
-/**
- * Construct a new action set
- */
-public FakeActionSetDescriptor(String id, Object data) {
- this.id = id;
- this.data = data;
-}
-/**
- * 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
- */
-public IActionSet createActionSet() throws CoreException {
- return null;
-}
-/**
- * Returns the action image descriptor.
- */
-protected abstract ImageDescriptor getActionImageDescriptor();
-/**
- * Returns the action text.
- */
-protected abstract String getActionLabel();
-/**
- * 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 Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- return null;
-}
-/**
- * Returns the category of this action set.
- * This is the value of its <code>"category"</code> attribute.
- *
- * @return a non-empty category name or <cod>null</code> if none specified
- */
-public String getCategory() {
- return category;
-}
-/**
- * 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 object The object to get the children for.
- */
-public Object[] getChildren() {
- if (children == null) {
- children = new Object[1];
- children[0] = new FakeAction(getActionLabel(),
- getActionImageDescriptor());
- }
- return children;
-}
-/**
- * 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 object The object to get the children for.
- */
-public Object[] getChildren(Object o) {
- if (children == null) {
- children = new Object[1];
- children[0] = new FakeAction(getLabel(this),
- getActionImageDescriptor());
- }
- return children;
-}
-/**
- * Returns the data
- */
-public Object getData() {
- return data;
-}
-/**
- * Returns the description of this action set.
- * This is the value of its <code>"description"</code> attribute.
- *
- * @return the description
- */
-public String getDescription() {
- return null;
-}
-/**
- * Returns the id of this action set.
- * This is the value of its <code>"id"</code> attribute.
- *
- * @return the action set id
- */
-public String getId() {
- return id;
-}
-/**
- * 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.
- */
-public ImageDescriptor getImageDescriptor(Object object) {
- return null;
-}
-/**
- * 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 object The object to get a label for.
- */
-public String getLabel() {
- return getActionLabel();
-}
-/**
- * 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 object The object to get a label for.
- */
-public String getLabel(Object o) {
- return getActionLabel();
-}
-/**
- * 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 object The object to get the parent for.
- */
-public Object getParent(Object o) {
- return null;
-}
-/**
- * Returns whether this action set is initially visible.
- */
-public boolean isInitiallyVisible() {
- return false;
-}
-/**
- * Sets the category.
- */
-public void setCategory(String cat) {
- category = cat;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakePerspectiveActionSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakePerspectiveActionSet.java
deleted file mode 100644
index b1de2c8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakePerspectiveActionSet.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.model.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.*;
-import java.util.*;
-
-/**
- * A fake view action set.
- */
-public class FakePerspectiveActionSet extends FakeActionSetDescriptor {
-/**
- * Constructs a new action set.
- */
-public FakePerspectiveActionSet(IPerspectiveDescriptor desc) {
- super(desc.getId(), desc);
-}
-/**
- * Returns the action image descriptor.
- */
-protected ImageDescriptor getActionImageDescriptor() {
- return getPerspective().getImageDescriptor();
-}
-/**
- * Returns the action text.
- */
-protected String getActionLabel() {
- return getPerspective().getLabel();
-}
-/**
- * Returns the descriptor
- */
-public IPerspectiveDescriptor getPerspective() {
- return (IPerspectiveDescriptor)getData();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeViewActionSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeViewActionSet.java
deleted file mode 100644
index c9cddd3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeViewActionSet.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.model.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.*;
-import java.util.*;
-
-/**
- * A fake view action set.
- */
-public class FakeViewActionSet extends FakeActionSetDescriptor {
-/**
- * Constructs a new action set.
- */
-public FakeViewActionSet(IViewDescriptor desc) {
- super(desc.getID(), desc);
-}
-/**
- * Returns the action image descriptor.
- */
-protected ImageDescriptor getActionImageDescriptor() {
- return getView().getImageDescriptor();
-}
-/**
- * Returns the action text.
- */
-protected String getActionLabel() {
- return getView().getLabel();
-}
-/**
- * Returns the descriptor
- */
-public IViewDescriptor getView() {
- return (IViewDescriptor)getData();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeWizardActionSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeWizardActionSet.java
deleted file mode 100644
index ee4e69e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FakeWizardActionSet.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.model.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.*;
-import java.util.*;
-
-/**
- * A fake view action set.
- */
-public class FakeWizardActionSet extends FakeActionSetDescriptor {
-/**
- * Constructs a new action set.
- */
-public FakeWizardActionSet(WorkbenchWizardElement desc) {
- super(desc.getID(), desc);
-}
-/**
- * Returns the action image descriptor.
- */
-protected ImageDescriptor getActionImageDescriptor() {
- return getWizard().getImageDescriptor();
-}
-/**
- * Returns the action text.
- */
-protected String getActionLabel() {
- WorkbenchWizardElement wizard = getWizard();
- return wizard.getLabel(wizard);
-}
-/**
- * Returns the descriptor
- */
-public WorkbenchWizardElement getWizard() {
- return (WorkbenchWizardElement)getData();
-}
-}
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
deleted file mode 100644
index c67e8a5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileEditorsPreferencePage.java
+++ /dev/null
@@ -1,494 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.internal.registry.*;
-
-
-/**
- * The file editors page presents the collection of file names and extensions
- * for which the user has registered editors. It also lets the user add new
- * internal or external (program) editors for a given file name and extension.
- *
- * 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.
- */
-public class FileEditorsPreferencePage extends PreferencePage implements IWorkbenchPreferencePage, Listener {
- 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.
- */
-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.getString("FileEditorPreference.existsTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("FileEditorPreference.existsMessage")); //$NON-NLS-1$
- 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.
- */
-protected Control createContents(Composite parent) {
- imagesToDispose = new ArrayList();
- editorsToImages = new HashMap(50);
- Font font = parent.getFont();
-
- // 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);
- pageComponent.setFont(font);
-
- //layout the contents
-
- //layout the top table & its buttons
- Label label = new Label(pageComponent, SWT.LEFT);
- label.setText(WorkbenchMessages.getString("FileEditorPreference.fileTypes")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- label.setFont(font);
-
- resourceTypeTable = new Table(pageComponent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION);
- resourceTypeTable.addListener(SWT.Selection, this);
- resourceTypeTable.addListener(SWT.DefaultSelection, this);
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = resourceTypeTable.getItemHeight()*12;
- resourceTypeTable.setLayoutData(data);
- resourceTypeTable.setFont(font);
-
- 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);
- groupComponent.setFont(font);
-
- addResourceTypeButton = new Button(groupComponent, SWT.PUSH);
- addResourceTypeButton.setText(WorkbenchMessages.getString("FileEditorPreference.add")); //$NON-NLS-1$
- addResourceTypeButton.addListener(SWT.Selection, this);
- addResourceTypeButton.setLayoutData(data);
- addResourceTypeButton.setFont(font);
- setButtonLayoutData(addResourceTypeButton);
-
-
- removeResourceTypeButton = new Button(groupComponent, SWT.PUSH);
- removeResourceTypeButton.setText(WorkbenchMessages.getString("FileEditorPreference.remove")); //$NON-NLS-1$
- removeResourceTypeButton.addListener(SWT.Selection, this);
- removeResourceTypeButton.setFont(font);
- 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.getString("FileEditorPreference.associatedEditors")); //$NON-NLS-1$
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.horizontalSpan = 2;
- editorLabel.setLayoutData(data);
- editorLabel.setFont(font);
-
- editorTable = new Table(pageComponent, SWT.SINGLE | 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);
- editorTable.setFont(font);
-
- 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);
- groupComponent.setFont(font);
-
- addEditorButton = new Button(groupComponent, SWT.PUSH);
- addEditorButton.setText(WorkbenchMessages.getString("FileEditorPreference.addEditor")); //$NON-NLS-1$
- addEditorButton.addListener(SWT.Selection, this);
- addEditorButton.setLayoutData(data);
- addEditorButton.setFont(font);
- setButtonLayoutData(addEditorButton);
-
- removeEditorButton = new Button(groupComponent, SWT.PUSH);
- removeEditorButton.setText(WorkbenchMessages.getString("FileEditorPreference.removeEditor")); //$NON-NLS-1$
- removeEditorButton.addListener(SWT.Selection, this);
- removeEditorButton.setFont(font);
- setButtonLayoutData(removeEditorButton);
-
- defaultEditorButton= new Button(groupComponent, SWT.PUSH);
- defaultEditorButton.setText(WorkbenchMessages.getString("FileEditorPreference.default")); //$NON-NLS-1$
- defaultEditorButton.addListener(SWT.Selection, this);
- defaultEditorButton.setFont(font);
- setButtonLayoutData(defaultEditorButton);
-
- fillResourceTypeTable();
- if (resourceTypeTable.getItemCount() > 0) {
- resourceTypeTable.setSelection(0);
- }
- fillEditorTable();
- updateEnabledState();
-
- WorkbenchHelp.setHelp(parent, IHelpContextIds.FILE_EDITORS_PREFERENCE_PAGE);
-
- 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.
- */
-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.
- */
-protected IPreferenceStore doGetPreferenceStore() {
- return WorkbenchPlugin.getDefault().getPreferenceStore();
-}
-protected void fillEditorTable() {
- editorTable.removeAll();
- FileEditorMapping resourceType = getSelectedResourceType();
- if (resourceType != null) {
- IEditorDescriptor[] array = resourceType.getEditors();
- for (int i=0;i < array.length; i++) {
- IEditorDescriptor editor = array[i];
- TableItem item = new TableItem(editorTable, SWT.NULL);
- item.setData(editor);
- // Check if it is the default editor
- String defaultString = null;
- FileEditorMapping ext = getSelectedResourceType();
- if (ext != null){
- IEditorDescriptor preferredEditor = ext.getDefaultEditor();
- if (preferredEditor == editor)
- defaultString = WorkbenchMessages.getString("FileEditorPreference.defaultLabel"); //$NON-NLS-1$
- }
-
- if (defaultString != null) {
- item.setText(editor.getLabel() + " " + defaultString); //$NON-NLS-1$
- }
- else {
- item.setText(editor.getLabel());
- }
- item.setImage(getImage(editor));
- }
- }
-}
-/**
- * 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 > 0) {
- return (FileEditorMapping)items[0].getData(); //Table is single select
- } else {
- 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++)
- editorList.add(editorTable.getItem(i).getData());
-
- return (IEditorDescriptor[])editorList.toArray(new IEditorDescriptor[editorList.size()]);
- }
- else
- return null;
-}
-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
- */
-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)
- 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.
- */
-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();
- return true;
-}
-public void promptForEditor() {
- EditorSelectionDialog dialog = new EditorSelectionDialog(getControl().getShell());
- dialog.setEditorsToFilter(getAssociatedEditors());
- dialog.setMessage(WorkbenchMessages.format("Choose_the_editor_for_file", new Object[] {getSelectedResourceType().getLabel()})); //$NON-NLS-1$
- if (dialog.open() == Dialog.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(editor);
- if (isEmpty)
- item.setText(editor.getLabel() + " " + WorkbenchMessages.getString("FileEditorPreference.defaultLabel")); //$NON-NLS-2$ //$NON-NLS-1$
- else
- item.setText(editor.getLabel());
- item.setImage(getImage(editor));
- editorTable.setSelection(i);
- editorTable.setFocus();
- getSelectedResourceType().addEditor(editor);
- updateSelectedResourceType(); //in case of new default
- }
- }
-}
-public void promptForResourceType() {
- FileExtensionDialog dialog = new FileExtensionDialog(getControl().getShell());
- if (dialog.open() == Dialog.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) {
- getSelectedResourceType().removeEditor((EditorDescriptor)items[0].getData());
- items[0].dispose(); //Table is single selection
- }
- if (defaultEditor && editorTable.getItemCount() > 0){
- TableItem item = editorTable.getItem(0);
- if (item != null)
- item.setText(((EditorDescriptor)(item.getData())).getLabel() + " " + WorkbenchMessages.getString("FileEditorPreference.defaultLabel")); //$NON-NLS-2$ //$NON-NLS-1$
- }
-
-}
-/**
- * Remove the type from the table
- */
-public void removeSelectedResourceType() {
- TableItem[] items = resourceTypeTable.getSelection();
- if (items.length > 0) {
- items[0].dispose(); //Table is single selection
- }
- //Clear out the editors too
- editorTable.removeAll();
-}
-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()).getLabel());
- // Now set the new default
- EditorDescriptor editor = (EditorDescriptor)items[0].getData();
- getSelectedResourceType().setDefaultEditor(editor);
- items[0].dispose(); //Table is single selection
- TableItem item = new TableItem(editorTable, SWT.NULL, 0);
- item.setData(editor);
- item.setText(editor.getLabel() + " " + WorkbenchMessages.getString("FileEditorPreference.defaultLabel")); //$NON-NLS-2$ //$NON-NLS-1$
- item.setImage(getImage(editor));
- editorTable.setSelection(new TableItem[] {item});
- }
-}
-public void updateEnabledState() {
- //Update enabled state
- boolean resourceTypeSelected = resourceTypeTable.getSelectionIndex() != -1;
- boolean editorSelected = editorTable.getSelectionIndex() != -1;
-
- removeResourceTypeButton.setEnabled(resourceTypeSelected);
- editorLabel.setEnabled(resourceTypeSelected);
- addEditorButton.setEnabled(resourceTypeSelected);
- removeEditorButton.setEnabled(editorSelected);
- defaultEditorButton.setEnabled(editorSelected);
-}
-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
deleted file mode 100644
index db37b4f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileExtensionDialog.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.*;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This class is used to prompt the user for a file name & extension.
- */
-public class FileExtensionDialog extends TitleAreaDialog {
- private String filename = ""; //$NON-NLS-1$
- private Text filenameField;
- private Button okButton;
- /**
- * Constructs a new file extension dialog.
- */
- public FileExtensionDialog(Shell parentShell) {
- super(parentShell);
- }
- /* (non-Javadoc)
- * Method declared in Window.
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(WorkbenchMessages.getString("FileExtension.shellTitle")); //$NON-NLS-1$
- //$NON-NLS-1$
- WorkbenchHelp.setHelp(
- shell,
- IHelpContextIds.FILE_EXTENSION_DIALOG);
- }
- /**
- * Creates and returns the contents of the upper part
- * of the dialog (above the button bar).
- *
- * Subclasses should overide.
- *
- * @param the parent composite to contain the dialog area
- * @return the dialog area control
- */
- protected Control createDialogArea(Composite parent) {
- // top level composite
- Composite parentComposite = (Composite)super.createDialogArea(parent);
-
- // create a composite with standard margins and spacing
- Composite contents = new Composite(parentComposite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.numColumns = 2;
- contents.setLayout(layout);
- contents.setLayoutData(new GridData(GridData.FILL_BOTH));
- contents.setFont(parentComposite.getFont());
-
- setTitle(WorkbenchMessages.getString("FileExtension.dialogTitle")); //$NON-NLS-1$
- setMessage(WorkbenchMessages.getString("FileExtension.fileTypeMessage")); //$NON-NLS-1$
-
- // begin the layout
-
- Label label = new Label(contents, SWT.LEFT);
- label.setText(WorkbenchMessages.getString("FileExtension.fileTypeLabel")); //$NON-NLS-1$
- //$NON-NLS-1$
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- label.setFont(parent.getFont());
-
- filenameField = new Text(contents, SWT.SINGLE | SWT.BORDER);
- filenameField.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent event) {
- if (event.widget == filenameField) {
- filename = filenameField.getText().trim();
- okButton.setEnabled(validateFileType());
- }
- }
- });
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- filenameField.setLayoutData(data);
- filenameField.setFocus();
-
- return contents;
- }
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- 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.indexOf('.');
- if (index == filename.length() - 1) {
- if (index == 0 || (index == 1 && filename.charAt(0) == '*')) {
- setErrorMessage(WorkbenchMessages.getString("FileExtension.extensionEmptyMessage")); //$NON-NLS-1$
- return false;
- }
- }
-
- // check for characters before *
- // or no other characters
- // or next chatacter not '.'
- index = filename.indexOf('*');
- if (index > -1) {
- if (filename.length() == 1) {
- setErrorMessage(WorkbenchMessages.getString("FileExtension.extensionEmptyMessage")); //$NON-NLS-1$
- return false;
- }
- if (index != 0 || filename.charAt(1) != '.') {
- setErrorMessage(WorkbenchMessages.getString("FileExtension.fileNameInvalidMessage")); //$NON-NLS-1$
- return false;
- }
- }
-
- setErrorMessage(null);
- return true;
- }
- public String getExtension() {
- // We need kernel api to validate the extension or a filename
-
- int index = filename.indexOf('.');
- if (index == -1)
- return ""; //$NON-NLS-1$
- if (index == filename.length())
- return ""; //$NON-NLS-1$
- return filename.substring(index + 1, filename.length());
- }
- public String getName() {
- // We need kernel api to validate the extension or a filename
-
- int index = filename.indexOf('.');
- if (index == -1)
- return filename;
- if (index == 0)
- return "*"; //$NON-NLS-1$
- return filename.substring(0, index);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileStatesPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileStatesPage.java
deleted file mode 100644
index 068d0de..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileStatesPage.java
+++ /dev/null
@@ -1,396 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.MessageFormat;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-/**
- * The FileStatesPage is the page used to set the file states sizes for the workbench.
- */
-public class FileStatesPage
- extends PreferencePage
- implements IWorkbenchPreferencePage, Listener {
-
- private static final long defaultFileStateLongevity = 7; // 7 days
- private static final long defaultMaxFileStateSize = 1; // 1 Mb
- private static final int defaultMaxFileStates = 50;
-
- private static final String LONGEVITY_TITLE =
- WorkbenchMessages.getString("FileHistory.longevity"); //$NON-NLS-1$
- private static final String MAX_FILE_STATES_TITLE =
- WorkbenchMessages.getString("FileHistory.entries"); //$NON-NLS-1$
- private static final String MAX_FILE_STATE_SIZE_TITLE =
- WorkbenchMessages.getString("FileHistory.diskSpace"); //$NON-NLS-1$
- private static final String POSITIVE_MESSAGE =
- WorkbenchMessages.getString("FileHistory.mustBePositive"); //$NON-NLS-1$
- private static final String INVALID_VALUE_MESSAGE =
- WorkbenchMessages.getString("FileHistory.invalid"); //$NON-NLS-1$
- private static final String SAVE_ERROR_MESSAGE =
- WorkbenchMessages.getString("FileHistory.exceptionSaving"); //$NON-NLS-1$
- private static final String NOTE_MESSAGE =
- WorkbenchMessages.getString("FileHistory.restartNote"); //$NON-NLS-1$
- private static final String NOTE_LABEL =
- WorkbenchMessages.getString("Preference.note"); //$NON-NLS-1$
-
- private static final int FAILED_VALUE = -1;
-
- //Set the length of the day as we have to convert back and forth
- private static final long DAY_LENGTH = 86400000;
- private static final long MEGABYTES = 1024 * 1024;
-
- private Text longevityText;
- private Text maxStatesText;
- private Text maxStateSizeText;
-
- //Choose a maximum to prevent OutOfMemoryErrors
- private int FILE_STATES_MAXIMUM = 10000;
- private long STATE_SIZE_MAXIMUM = 100;
-
-/**
- * This method takes the string for the title of a text field and the value for the
- * text of the field.
- * @return org.eclipse.swt.widgets.Text
- * @param labelString java.lang.String
- * @param textValue java.lang.String
- * @param parent Composite
- */
-private Text addLabelAndText(String labelString, String textValue, Composite parent) {
- Label label = new Label(parent,SWT.LEFT);
- label.setText(labelString);
- label.setFont(parent.getFont());
-
- Text text = new Text(parent, SWT.LEFT | SWT.BORDER);
- GridData data = new GridData();
- text.addListener(SWT.Modify, this);
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- text.setLayoutData(data);
- text.setText(textValue);
- text.setFont(parent.getFont());
- return text;
-}
-/**
- * Recomputes the page's error state by validating all
- * the fields.
- */
-private void checkState() {
- // Assume invalid if the controls not created yet
- if (longevityText == null || maxStatesText == null || maxStateSizeText == null) {
- setValid(false);
- return;
- }
-
- if (validateLongTextEntry(longevityText) == FAILED_VALUE) {
- setValid(false);
- return;
- }
-
- if (validateMaxFileStates() == FAILED_VALUE) {
- setValid(false);
- return;
- }
-
- if (validateMaxFileStateSize() == FAILED_VALUE) {
- setValid(false);
- return;
- }
-
- setValid(true);
- setErrorMessage(null);
-}
-/*
-* Create the contents control for the workspace file states.
-* @returns Control
-* @param parent Composite
-*/
-
-protected Control createContents(Composite parent) {
-
- WorkbenchHelp.setHelp(parent, IHelpContextIds.FILE_STATES_PREFERENCE_PAGE);
-
- // button group
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- composite.setFont(parent.getFont());
-
- IWorkspaceDescription description = getWorkspaceDescription();
-
- //Get the current value and make sure we get at least one day out of it.
- long days = description.getFileStateLongevity() / DAY_LENGTH;
- if (days < 1)
- days = 1;
-
- long megabytes = description.getMaxFileStateSize() / MEGABYTES;
- if (megabytes < 1)
- megabytes = 1;
-
- this.longevityText =
- addLabelAndText(LONGEVITY_TITLE, String.valueOf(days), composite);
- this.maxStatesText =
- addLabelAndText(
- MAX_FILE_STATES_TITLE,
- String.valueOf(description.getMaxFileStates()),
- composite);
- this.maxStateSizeText =
- addLabelAndText(
- MAX_FILE_STATE_SIZE_TITLE,
- String.valueOf(megabytes),
- composite);
-
- checkState();
-
- //Create a spacing label to breakup the note from the fields
- Label spacer = new Label(composite, SWT.NONE);
- GridData spacerData = new GridData();
- spacerData.horizontalSpan = 2;
- spacer.setLayoutData(spacerData);
-
- createNoteLabel(composite);
-
- return composite;
-}
-/**
- * Get the Workspace this page is operating on.
- * @return org.eclipse.core.internal.resources.IWorkspace
- */
-private IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
-}
-/**
- * Get the Workspace Description this page is operating on.
- * @return org.eclipse.core.resources.IWorkspaceDescription
- */
-private IWorkspaceDescription getWorkspaceDescription() {
- return ResourcesPlugin.getWorkspace().getDescription();
-}
-/**
- * Sent when an event that the receiver has registered for occurs.
- *
- * @param event the event which occurred
- */
-public void handleEvent(Event event) {
- checkState();
-}
-/**
- * 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
- */
-public void init(org.eclipse.ui.IWorkbench workbench) {}
-/**
- * Performs special processing when this page's Defaults button has been pressed.
- * Reset the entries to thier default values.
- */
-protected void performDefaults() {
- super.performDefaults();
-
- this.longevityText.setText(String.valueOf(defaultFileStateLongevity));
- this.maxStatesText.setText(String.valueOf(defaultMaxFileStates));
- this.maxStateSizeText.setText(String.valueOf(defaultMaxFileStateSize));
-
- checkState();
-}
-/**
- * Perform the result of the OK from the receiver.
- */
-public boolean performOk() {
-
- long longevityValue = validateLongTextEntry(longevityText);
- int maxFileStates = validateMaxFileStates();
- long maxStateSize = validateMaxFileStateSize();
- if (longevityValue == FAILED_VALUE
- || maxFileStates == FAILED_VALUE
- || maxStateSize == FAILED_VALUE)
- return false;
-
- IWorkspaceDescription description = getWorkspaceDescription();
- description.setFileStateLongevity(longevityValue * DAY_LENGTH);
- description.setMaxFileStates(maxFileStates);
- description.setMaxFileStateSize(maxStateSize * MEGABYTES);
-
- try {
- //As it is only a copy save it back in
- ResourcesPlugin.getWorkspace().setDescription(description);
- } catch (CoreException exception) {
- ErrorDialog.openError(
- getShell(),
- SAVE_ERROR_MESSAGE,
- exception.getMessage(),
- exception.getStatus());
- return false;
- }
-
- return true;
-
-}
-/**
- * Validate a text entry for an integer field. Return the result if there are
- * no errors, otherwise return -1 and set the entry field error.
- * @return int
- */
-private int validateIntegerTextEntry(Text text) {
-
- int value;
-
- try {
- value = Integer.parseInt(text.getText());
-
- } catch (NumberFormatException exception) {
- setErrorMessage(MessageFormat.format(INVALID_VALUE_MESSAGE, new Object[] {exception.getLocalizedMessage()}));
- return FAILED_VALUE;
- }
-
- //Be sure all values are non zero and positive
- if(value <= 0){
- setErrorMessage(POSITIVE_MESSAGE);
- return FAILED_VALUE;
- }
-
- return value;
-}
-/**
- * Validate a text entry for a long field. Return the result if there are
- * no errors, otherwise return -1 and set the entry field error.
- * @return long
- */
-private long validateLongTextEntry(Text text) {
-
- long value;
-
- try {
- value = Long.parseLong(text.getText());
-
- } catch (NumberFormatException exception) {
- setErrorMessage(MessageFormat.format(INVALID_VALUE_MESSAGE, new Object[] {exception.getLocalizedMessage()}));
- return FAILED_VALUE;
- }
-
- //Be sure all values are non zero and positive
- if(value <= 0){
- setErrorMessage(POSITIVE_MESSAGE);
- return FAILED_VALUE;
- }
-
- return value;
-}
-
-/**
- * Validate the maximum file states.
- * Return the value if successful, otherwise
- * return FAILED_VALUE.
- * Set the error message if it fails.
- * @return int
- */
-private int validateMaxFileStates(){
- int maxFileStates = validateIntegerTextEntry(this.maxStatesText);
- if(maxFileStates == FAILED_VALUE)
- return maxFileStates;
-
- if(maxFileStates > FILE_STATES_MAXIMUM){
- setErrorMessage(WorkbenchMessages.format(
- "FileHistory.aboveMaxEntries",
- new String[] {String.valueOf(FILE_STATES_MAXIMUM)}
- ));
- return FAILED_VALUE;
- }
-
- return maxFileStates;
-}
-
-/**
- * Validate the maximum file state size.
- * Return the value if successful, otherwise
- * return FAILED_VALUE.
- * Set the error message if it fails.
- * @return long
- */
-private long validateMaxFileStateSize(){
- long maxFileStateSize = validateLongTextEntry(this.maxStateSizeText);
- if(maxFileStateSize == FAILED_VALUE)
- return maxFileStateSize;
-
- if(maxFileStateSize > STATE_SIZE_MAXIMUM){
- setErrorMessage(WorkbenchMessages.format(
- "FileHistory.aboveMaxFileSize",
- new String[] {String.valueOf(STATE_SIZE_MAXIMUM)}
- ));
- return FAILED_VALUE;
- }
-
- return maxFileStateSize;
-}
-
-/**
- * Create a label with a note that informs the user
- * that a restart is required for these changes to
- * take effect.
- */
-private void createNoteLabel(Composite parent){
-
- Composite messageComposite = new Composite(parent, SWT.NONE);
- GridLayout messageLayout = new GridLayout();
- messageLayout.numColumns = 2;
- messageLayout.marginWidth = 0;
-
- messageComposite.setLayout(messageLayout);
- GridData data =
- new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.horizontalSpan = 2;
- messageComposite.setLayoutData(data);
- messageComposite.setFont(parent.getFont());
-
-
- final Label noteLabel = new Label(messageComposite,SWT.BOLD);
- noteLabel.setText(NOTE_LABEL);
- noteLabel.setFont(JFaceResources.getBannerFont());
- noteLabel.setLayoutData(
- new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
-
- final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if(JFaceResources.BANNER_FONT.equals(event.getProperty())) {
- noteLabel.setFont(JFaceResources.getFont(JFaceResources.BANNER_FONT));
- }
- }
- };
- JFaceResources.getFontRegistry().addListener(fontListener);
- noteLabel.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- JFaceResources.getFontRegistry().removeListener(fontListener);
- }
- });
-
- Label messageLabel = new Label(messageComposite,SWT.WRAP);
- messageLabel.setText(NOTE_MESSAGE);
- messageLabel.setFont(parent.getFont());
-}
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileSystemResourceExporter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileSystemResourceExporter.java
deleted file mode 100644
index 517b171..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FileSystemResourceExporter.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.resources.*;
-import java.io.*;
-import java.util.*;
-
-/**
- * Helper class for exporting resources to the file system.
- */
-/*package*/ class FileSystemResourceExporter {
-/**
- * Creates the specified file system directory at <code>destinationPath</code>.
- * This creates a new file system directory.
- */
-public void createFolder(IPath destinationPath) {
- new File(destinationPath.toOSString()).mkdir();
-}
-/**
- * Writes the passed resource to the specified location recursively
- */
-public void write(IResource resource,IPath destinationPath) throws CoreException, IOException {
- if (resource.getType() == IResource.FILE)
- writeFile((IFile)resource,destinationPath);
- else
- writeChildren((IContainer)resource,destinationPath);
-}
-/**
- * Exports the passed container's children
- */
-protected void writeChildren(IContainer folder, IPath destinationPath) throws CoreException, IOException {
- if (folder.isAccessible()) {
- IResource[] children = folder.members();
- for (int i = 0; i<children.length; i++) {
- IResource child = children[i];
- writeResource(
- child,
- destinationPath.append(child.getName()));
- }
- }
-}
-/**
- * Writes the passed file resource to the specified destination on the local
- * file system
- */
-protected void writeFile(IFile file, IPath destinationPath) throws IOException, CoreException {
- FileOutputStream output = null;
- InputStream contentStream = null;
-
- try {
- output = new FileOutputStream(destinationPath.toOSString());
- contentStream = file.getContents(false);
- int chunkSize = contentStream.available();
- byte[] readBuffer = new byte[chunkSize];
- int n = contentStream.read(readBuffer);
-
- while (n > 0) {
- output.write(readBuffer);
- n = contentStream.read(readBuffer);
- }
- } finally {
- if (output != null)
- output.close();
- if (contentStream != null)
- contentStream.close();
- }
-}
-/**
- * Writes the passed resource to the specified location recursively
- */
-protected void writeResource(IResource resource,IPath destinationPath) throws CoreException, IOException {
- if (resource.getType() == IResource.FILE)
- writeFile((IFile)resource,destinationPath);
- else {
- createFolder(destinationPath);
- writeChildren((IContainer)resource,destinationPath);
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FilterDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FilterDialog.java
deleted file mode 100644
index 26cad92..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FilterDialog.java
+++ /dev/null
@@ -1,255 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*******************************************************************************
- * Copyright (c) 2002 International Business Machines Corp. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-
-/**
- * A filter dialog presents a list of filter patterns and
- * most recently used working set.
- * Zero or more filters and an optional working set can be
- * selected by the user.
- *
- * @since 2.0
- */
-public class FilterDialog extends ListSelectionDialog {
- static final int SELECT_ID = IDialogConstants.CLIENT_ID + 1;
-
- private Button workingSetButton;
- private Combo mruList;
- private Button selectButton;
- private IWorkingSet workingSet;
- /*
- * Used to update the mru list box when working sets are
- * renamed in the working set selection dialog.
- */
- private IPropertyChangeListener workingSetChangeListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
- Object newValue = event.getNewValue();
-
- if (IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE.equals(property) &&
- newValue instanceof IWorkingSet) {
- String newName = ((IWorkingSet) newValue).getName();
- int count = mruList.getItemCount();
- for (int i = 0; i < count; i++) {
- String item = mruList.getItem(i);
- IWorkingSet workingSet = (IWorkingSet) mruList.getData(item);
- if (workingSet == newValue) {
- boolean isTopItem = (mruList.getData(mruList.getText()) == workingSet);
- mruList.remove(i);
- mruList.add(newName, i);
- mruList.setData(newName, workingSet);
- if (isTopItem) {
- mruList.setText(newName);
- }
- break;
- }
- }
- }
- }
- };
-
- /**
- * Creates a filter 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 FilterDialog(Shell parentShell, Object input, IStructuredContentProvider contentProvider, ILabelProvider labelProvider, String message) {
- super(parentShell, input, contentProvider, labelProvider, message);
- }
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void buttonPressed(int buttonId) {
- if (SELECT_ID == buttonId) {
- handleWorkingSetSelection();
- }
- else {
- super.buttonPressed(buttonId);
- }
- }
- /**
- * Overrides method in Dialog
- *
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
- */
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- Composite group = new Composite(composite, SWT.NONE);
- GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
- group.setLayoutData(data);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- group.setLayout(layout);
-
- workingSetButton = new Button(group, SWT.CHECK);
- workingSetButton.setText(WorkbenchMessages.getString("FilterDialog.workingSet")); //$NON-NLS-1$
- workingSetButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleWorkingSetButtonSelection();
- }
- });
- data = new GridData();
- data.horizontalSpan = 2;
- workingSetButton.setLayoutData(data);
-
- group = new Composite(group, SWT.NONE);
- data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
- group.setLayoutData(data);
- layout = new GridLayout();
- layout.marginHeight = 0;
- group.setLayout(layout);
-
- mruList = new Combo(group, SWT.DROP_DOWN | SWT.READ_ONLY);
- data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
- mruList.setLayoutData(data);
- selectButton = createButton(group, SELECT_ID, WorkbenchMessages.getString("FilterDialog.workingSetOther"), false); //$NON-NLS-1$
-
- initializeMru();
- initializeWorkingSet();
- return composite;
- }
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- WorkbenchHelp.setHelp(newShell, IHelpContextIds.FILTER_DIALOG);
- }
- /**
- * Returns the selected working set or null if none is selected.
- *
- * @return the selected working set or null if none is selected.
- */
- public IWorkingSet getWorkingSet() {
- return workingSet;
- }
- /**
- * Opens the working set selection dialog if the "Other..." item
- * is selected in the most recently used working set list.
- */
- private void handleWorkingSetSelection() {
- IWorkingSetSelectionDialog dialog = WorkbenchPlugin.getDefault().getWorkingSetManager().createWorkingSetSelectionDialog(getShell(), false);
- IWorkingSetManager workingSetManager = WorkbenchPlugin.getDefault().getWorkingSetManager();
- IWorkingSet workingSet = workingSetManager.getWorkingSet(mruList.getText());
-
- if (workingSet != null) {
- dialog.setSelection(new IWorkingSet[]{workingSet});
- }
- workingSetManager.addPropertyChangeListener(workingSetChangeListener);
- if (dialog.open() == Window.OK) {
- IWorkingSet[] result = dialog.getSelection();
- if (result != null && result.length > 0) {
- workingSet = result[0];
- String workingSetName = workingSet.getName();
- if (mruList.indexOf(workingSetName) != -1) {
- mruList.remove(workingSetName);
- }
- mruList.add(workingSetName, 0);
- mruList.setText(workingSetName);
- mruList.setData(workingSetName, workingSet);
- }
- else {
- workingSet = null;
- }
- // remove deleted working sets from the mru list box
- String[] mruNames = mruList.getItems();
- for (int i = 0; i < mruNames.length; i++) {
- if (workingSetManager.getWorkingSet(mruNames[i]) == null) {
- mruList.remove(mruNames[i]);
- }
- }
- }
- workingSetManager.removePropertyChangeListener(workingSetChangeListener);
- }
- /**
- * Sets the enabled state of the most recently used working set list
- * based on the checked state of the working set check box.
- */
- private void handleWorkingSetButtonSelection() {
- mruList.setEnabled(workingSetButton.getSelection());
- selectButton.setEnabled(workingSetButton.getSelection());
- }
- /**
- * Populates the most recently used working set list with MRU items from
- * the working set manager as well as adds an item to enable selection of
- * a working set not in the MRU list.
- */
- private void initializeMru() {
- IWorkingSet[] workingSets = WorkbenchPlugin.getDefault().getWorkingSetManager().getRecentWorkingSets();
-
- for (int i = 0; i < workingSets.length; i++) {
- String workingSetName = workingSets[i].getName();
- mruList.add(workingSetName);
- mruList.setData(workingSetName, workingSets[i]);
- }
- if (workingSets.length > 0) {
- mruList.setText(workingSets[0].getName());
- }
- }
- /**
- * Initializes the state of the working set part of the dialog.
- */
- private void initializeWorkingSet() {
- workingSetButton.setSelection(workingSet != null);
- handleWorkingSetButtonSelection();
- if (workingSet != null && mruList.indexOf(workingSet.getName()) != -1) {
- mruList.setText(workingSet.getName());
- }
- }
- /**
- * Overrides method in Dialog
- *
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- protected void okPressed() {
- if (workingSetButton.getSelection()) {
- workingSet = (IWorkingSet) mruList.getData(mruList.getText());
- }
- else {
- workingSet = null;
- }
- super.okPressed();
- }
- /**
- * Sets the working set that should be selected in the most recently
- * used working set list.
- *
- * @param workingSet the working set that should be selected.
- * has to exist in the list returned by
- * org.eclipse.ui.IWorkingSetManager#getRecentWorkingSets().
- * Must not be null.
- */
- public void setWorkingSet(IWorkingSet workingSet) {
- this.workingSet = workingSet;
-
- if (workingSetButton != null && mruList != null) {
- initializeWorkingSet();
- }
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FontPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FontPreferencePage.java
deleted file mode 100644
index 33e0e77..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/FontPreferencePage.java
+++ /dev/null
@@ -1,437 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.text.Collator;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Set;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.resource.StringConverter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.misc.Sorter;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-public class FontPreferencePage
- extends PreferencePage
- implements IWorkbenchPreferencePage {
-
- Hashtable namesToIds;
- Hashtable idsToFontData;
- List fontList;
- Button changeFontButton;
- Button useDefaultsButton;
-
- /**
- * The label that displays the selected font, or <code>null</code> if none.
- */
- private Label valueControl;
-
- /**
- * The previewer, or <code>null</code> if none.
- */
- private DefaultPreviewer previewer;
-
- private static class DefaultPreviewer {
- private Text text;
- private Font font;
- public DefaultPreviewer(Composite parent) {
- text = new Text(parent, SWT.READ_ONLY | SWT.BORDER | SWT.WRAP);
- text.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (font != null)
- font.dispose();
- }
- });
- }
-
- public Control getControl() {
- return text;
- }
-
- public void setFont(FontData[] fontData) {
- if (font != null)
- font.dispose();
-
- FontData bestData =
- JFaceResources.getFontRegistry().
- bestData(fontData,text.getDisplay());
-
- //If there are no specified values then return.
- if(bestData == null)
- return;
-
- font = new Font(text.getDisplay(), bestData);
- text.setFont(font);
- //Also set the text here
- text.setText(WorkbenchMessages.getString("FontsPreference.SampleText")); //$NON-NLS-1$
- }
- public int getPreferredHeight() {
- return 120;
- }
- }
-
- /*
- * @see PreferencePage#createContents
- */
- public Control createContents(Composite parent) {
- WorkbenchHelp.setHelp(getControl(), IHelpContextIds.FONT_PREFERENCE_PAGE);
-
- Font defaultFont = parent.getFont();
-
- Composite mainColumn = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.makeColumnsEqualWidth = true;
- mainColumn.setFont(defaultFont);
- mainColumn.setLayout(layout);
-
- createFontList(mainColumn);
-
- Composite previewColumn = new Composite(mainColumn, SWT.NULL);
- layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- previewColumn.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.grabExcessHorizontalSpace = true;
- previewColumn.setLayoutData(data);
- previewColumn.setFont(defaultFont);
-
- createPreviewControl(previewColumn);
- createValueControl(previewColumn);
-
- Composite buttonColumn = new Composite(previewColumn, SWT.NULL);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- buttonColumn.setLayout(layout);
- data = new GridData(GridData.HORIZONTAL_ALIGN_END);
- buttonColumn.setLayoutData(data);
- buttonColumn.setFont(defaultFont);
-
- createUseDefaultsControl(
- buttonColumn,
- WorkbenchMessages.getString("FontsPreference.useSystemFont")); //$NON-NLS-1$
- createChangeControl(buttonColumn, JFaceResources.getString("openChange")); //$NON-NLS-1$
-
- return mainColumn;
- }
-
- /**
- * Create the preference page.
- */
- public FontPreferencePage() {
- setPreferenceStore(WorkbenchPlugin.getDefault().getPreferenceStore());
- }
-
- /**
- * Create the list of possible fonts.
- */
- private void createFontList(Composite firstColumn) {
-
- Font font = firstColumn.getFont();
-
- Composite parent = new Composite(firstColumn, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- parent.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.grabExcessHorizontalSpace = true;
- parent.setLayoutData(data);
-
- Label label = new Label(parent, SWT.LEFT);
- label.setText(WorkbenchMessages.getString("FontsPreference.fonts")); //$NON-NLS-1$
- label.setFont(font);
-
- fontList = new List(parent, SWT.BORDER);
- data = new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.FILL_BOTH);
- data.grabExcessHorizontalSpace = true;
- fontList.setLayoutData(data);
- fontList.setFont(font);
-
- fontList.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- String selectedFontId = getSelectedFontId();
- if (selectedFontId == null){
- changeFontButton.setEnabled(false);
- useDefaultsButton.setEnabled(false);
- }
- else{
- changeFontButton.setEnabled(true);
- useDefaultsButton.setEnabled(true);
- updateForFont((FontData[]) idsToFontData.get(selectedFontId));
- }
- }
- });
-
- Set names = namesToIds.keySet();
- int nameSize = names.size();
- String[] unsortedItems = new String[nameSize];
- names.toArray(unsortedItems);
-
- Sorter sorter = new Sorter() {
- private Collator collator = Collator.getInstance();
-
- public boolean compare(Object o1, Object o2) {
- String s1 = (String) o1;
- String s2 = (String) o2;
- return collator.compare(s1, s2) < 0;
- }
- };
-
- Object[] sortedItems = sorter.sort(unsortedItems);
- String[] listItems = new String[nameSize];
- System.arraycopy(sortedItems, 0, listItems, 0, nameSize);
-
- fontList.setItems(listItems);
- }
-
- /**
- * Return the id of the currently selected font. Return
- * null if multiple or none are selected.
- */
-
- private String getSelectedFontId() {
- String[] selection = fontList.getSelection();
- if (selection.length == 1)
- return (String) namesToIds.get(selection[0]);
- else
- return null;
- }
-
- /**
- * Creates the change button for this field editor.=
- */
- private void createChangeControl(Composite parent, String changeButtonLabel) {
- changeFontButton = new Button(parent, SWT.PUSH);
-
- changeFontButton.setText(changeButtonLabel); //$NON-NLS-1$
- changeFontButton.setFont(parent.getFont());
- setButtonLayoutData(changeFontButton);
-
- changeFontButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- String selectedFontId = getSelectedFontId();
- if (selectedFontId != null) {
- FontDialog fontDialog = new FontDialog(changeFontButton.getShell());
- FontData[] currentData = (FontData[]) idsToFontData.get(selectedFontId);
- fontDialog.setFontData(currentData[0]);
- FontData font = fontDialog.open();
- if (font != null) {
- FontData[] fonts = new FontData[1];
- fonts[0] = font;
- idsToFontData.put(selectedFontId, fonts);
- updateForFont(fonts);
- }
-
- }
-
- }
- });
-
- changeFontButton.setEnabled(false);
- }
-
- /**
- * Creates the Use System Font button for the editor.
- */
- private void createUseDefaultsControl(
- Composite parent,
- String useSystemLabel) {
-
- useDefaultsButton = new Button(parent, SWT.PUSH | SWT.CENTER);
- useDefaultsButton.setText(useSystemLabel); //$NON-NLS-1$
- useDefaultsButton.setFont(parent.getFont());
- setButtonLayoutData(useDefaultsButton);
-
- useDefaultsButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- String selectedFontId = getSelectedFontId();
- if (selectedFontId != null) {
- FontData[] defaultFontData = JFaceResources.getDefaultFont().getFontData();
- idsToFontData.put(selectedFontId, defaultFontData);
- updateForFont(defaultFontData);
- }
- }
- });
-
- useDefaultsButton.setEnabled(false);
- }
-
- /**
- * Creates the preview control for this field editor.
- */
- private void createPreviewControl(Composite parent) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(WorkbenchMessages.getString("FontsPreference.preview")); //$NON-NLS-1$
- label.setFont(parent.getFont());
-
- previewer = new DefaultPreviewer(parent);
- Control control = previewer.getControl();
- GridData gd = new GridData();
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
- gd.heightHint = previewer.getPreferredHeight();
- control.setLayoutData(gd);
- }
-
- /**
- * Creates the value control for this field editor. The value control
- * displays the currently selected font name.
- */
- private void createValueControl(Composite parent) {
- valueControl = new Label(parent, SWT.CENTER);
-
- valueControl.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- valueControl = null;
- }
- });
-
- valueControl.setFont(parent.getFont());
-
- GridData gd =
- new GridData(GridData.FILL_HORIZONTAL | GridData.HORIZONTAL_ALIGN_CENTER);
-
- gd.grabExcessHorizontalSpace = true;
- valueControl.setLayoutData(gd);
- }
-
- /**
- * Updates the value label and the previewer to reflect the
- * newly selected font.
- */
- private void updateForFont(FontData[] font) {
-
- valueControl.setText(StringConverter.asString(font[0]));
- previewer.setFont(font);
- }
-
- /*
- * @see IWorkbenchPreferencePage#init
- */
- public void init(IWorkbench workbench) {
-
- //Set up the mappings we currently have
-
- namesToIds = new Hashtable();
- namesToIds.put(
- WorkbenchMessages.getString("FontsPreference.BannerFont"), //$NON-NLS-1$
- JFaceResources.BANNER_FONT);
-
- namesToIds.put(
- WorkbenchMessages.getString("FontsPreference.TextFont"), //$NON-NLS-1$
- JFaceResources.TEXT_FONT);
-
- namesToIds.put(
- WorkbenchMessages.getString("FontsPreference.HeaderFont"), //$NON-NLS-1$
- JFaceResources.HEADER_FONT);
- //Commenting out DIALOG_FONT until all of Eclipse uses it
-// namesToIds.put(
-// WorkbenchMessages.getString("FontsPreference.DialogFont"), //$NON-NLS-1$
-// JFaceResources.DIALOG_FONT);
-
- //Now set up the fonts
-
- idsToFontData = new Hashtable();
- idsToFontData.put(
- JFaceResources.BANNER_FONT,
- (JFaceResources.getBannerFont().getFontData()));
-
- idsToFontData.put(
- JFaceResources.TEXT_FONT,
- (JFaceResources.getTextFont().getFontData()));
-
- idsToFontData.put(
- JFaceResources.HEADER_FONT,
- (JFaceResources.getHeaderFont().getFontData()));
-
-// idsToFontData.put(
-// JFaceResources.DIALOG_FONT,
-// (JFaceResources.getDialogFont().getFontData()));
-
- }
-
- /*
- * @see IWorkbenchPreferencePage#performDefaults
- */
- protected void performDefaults() {
-
- Enumeration fontSettingsEnumerator = idsToFontData.keys();
- String currentSelection = getSelectedFontId();
-
- while (fontSettingsEnumerator.hasMoreElements()) {
- String preferenceName = (String) fontSettingsEnumerator.nextElement();
- FontData[] defaultData =
- PreferenceConverter.getDefaultFontDataArray(getPreferenceStore(), preferenceName);
-
- //Now we have the defaults ask the registry which to use of these
- //values.
- FontData bestChoice =
- JFaceResources.getFontRegistry().
- bestData(defaultData,valueControl.getDisplay());
-
- //The default data was empty so use the system default
- if(bestChoice == null)
- defaultData =
- valueControl.getDisplay().
- getSystemFont().getFontData();
- else{
- defaultData = new FontData[1];
- defaultData[0] = bestChoice;
- }
-
- idsToFontData.put(preferenceName, defaultData);
-
- if (preferenceName.equals(currentSelection))
- updateForFont(defaultData);
- }
- super.performDefaults();
- }
-
- /*
- * @see IWorkbenchPreferencePage#performDefaults
- */
- public boolean performOk() {
-
- Enumeration fontSettingsEnumerator = idsToFontData.keys();
- while (fontSettingsEnumerator.hasMoreElements()) {
- String preferenceName = (String) fontSettingsEnumerator.nextElement();
- PreferenceConverter.setValue(
- getPreferenceStore(),
- preferenceName,
- (FontData[]) idsToFontData.get(preferenceName));
- }
- WorkbenchPlugin.getDefault().savePluginPreferences();
- return super.performOk();
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/IElementFilter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/IElementFilter.java
deleted file mode 100644
index 104dc19..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/IElementFilter.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import java.util.Collection;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * The IElementFilter is a interface that defines
- * the api for filtering the current selection of
- * a ResourceTreeAndListGroup in order to find a
- * subset to update as the result of a type filtering.
- * This is meant as an internal class and is used exlcusively
- * by the import dialog.
- */
-
-public interface IElementFilter {
-
- public void filterElements(Collection elements, IProgressMonitor monitor)
- throws InterruptedException;
-
- public void filterElements(Object[] elements, IProgressMonitor monitor)
- throws InterruptedException;
-
-}
\ No newline at end of file
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
deleted file mode 100644
index 47cd2ed..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/IPropertyPageContributor.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.*;
-import org.eclipse.core.runtime.IAdaptable;
-/**
- * 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 instances of PropertyPage class to the
- * property page manager.
- * @return true if pages were added, false if not.
- */
-
-public boolean contributePropertyPages(PropertyPageManager manager, IAdaptable object);
-}
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
deleted file mode 100644
index 8cb3d75..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ImportWizard.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * The import wizard allows the user to choose which nested import wizard to run.
- * The set of available wizards comes from the import wizard extension point.
- */
-public class ImportWizard extends Wizard {
- private IWorkbench workbench;
- private IStructuredSelection selection;
-
-
- //the list selection page
- class SelectionPage extends WorkbenchWizardListSelectionPage {
- SelectionPage(IWorkbench w, IStructuredSelection ss, AdaptableList e, String s) {
- super(w, ss, e, s);
- }
- public void createControl(Composite parent) {
- super.createControl(parent);
- WorkbenchHelp.setHelp(getControl(), IHelpContextIds.IMPORT_WIZARD_SELECTION_WIZARD_PAGE);
- }
- public IWizardNode createWizardNode(WorkbenchWizardElement element) {
- return new WorkbenchWizardNode(this, element) {
- public IWorkbenchWizard createWizard() throws CoreException {
- return (IWorkbenchWizard)wizardElement.createExecutableExtension();
- }
- };
- }
- }
-
-/**
- * Creates the wizard's pages lazily.
- */
-public void addPages() {
- addPage(
- new SelectionPage(
- this.workbench,
- this.selection,
- getAvailableImportWizards(),
- WorkbenchMessages.getString("ImportWizard.selectSource"))); //$NON-NLS-1$
-}
-/**
- * Returns the import wizards that are available for invocation.
- */
-protected AdaptableList getAvailableImportWizards() {
- return new WizardsRegistryReader(IWorkbenchConstants.PL_IMPORT).getWizards();
-}
-/**
- * Initializes the wizard.
- */
-public void init(IWorkbench aWorkbench, IStructuredSelection currentSelection) {
- this.workbench = aWorkbench;
- this.selection = currentSelection;
-
- setWindowTitle(WorkbenchMessages.getString("ImportWizard.title")); //$NON-NLS-1$
- setDefaultPageImageDescriptor(WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_IMPORT_WIZ));
- setNeedsProgressMonitor(true);
-}
-/**
- * Subclasses must implement this <code>IWizard</code> method
- * to perform any special finish processing for their wizard.
- */
-public boolean performFinish() {
- ((SelectionPage)getPages()[0]).saveWidgetValues();
- return true;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/InstallCapabilityStep.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/InstallCapabilityStep.java
deleted file mode 100644
index d407993..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/InstallCapabilityStep.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.ui.ICapabilityInstallWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.registry.Capability;
-
-/**
- * Represents a capability install step in a multi-step
- * wizard.
- */
-public class InstallCapabilityStep extends WizardStep {
- private Capability capability;
- private ICapabilityInstallWizard wizard;
- private IWorkbench workbench;
- private IProjectProvider projectProvider;
-
- /**
- * Creates the capability install step
- *
- * @param number step order number
- * @param capability the capability to install
- */
- public InstallCapabilityStep(int number, Capability capability, IWorkbench workbench, IProjectProvider projectProvider) {
- super(number);
- this.capability = capability;
- this.workbench = workbench;
- this.projectProvider = projectProvider;
- }
-
- /* (non-Javadoc)
- * Method declared on WizardStep.
- */
- public String getLabel() {
- return WorkbenchMessages.format("InstallCapabilityStep.label", new Object[] {capability.getName()}); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on WizardStep.
- */
- public String getDetails() {
- return capability.getInstallDetails();
- }
-
- /* (non-Javadoc)
- * Method declared on WizardStep.
- */
- public IWizard getWizard() {
- if (wizard == null) {
- wizard = capability.getInstallWizard();
- if (wizard != null) {
- wizard.init(workbench, StructuredSelection.EMPTY, projectProvider.getProject());
- wizard.addPages();
- }
- }
-
- return wizard;
- }
-
- interface IProjectProvider {
- /**
- * Returns the project to which the capability
- * is to be configured against.
- */
- public IProject getProject();
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/InternalBase64Encoder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/InternalBase64Encoder.java
deleted file mode 100644
index baf6d6a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/InternalBase64Encoder.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * This utility class converts a passed byte array into a Base 64 encoded
- * String according to the specification in RFC1521 section 5.2
- */
-/*package*/ class InternalBase64Encoder {
- private static final String mappings = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";//$NON-NLS-1$
- private static final String filler = "=";//$NON-NLS-1$
-/**
- * Answer a string representing the Base 64 encoded form of the passed
- * byte array
- *
- * @return java.lang.String
- * @param contents byte[]
- */
-public static String encode(byte[] contents) {
- StringBuffer result = new StringBuffer();
-
- for (int i = 0; i < contents.length; i = i + 3) {
- if (result.length() == 76)
- result.append("\n\r");//$NON-NLS-1$
-
- // output character 1
- result.append(mappings.charAt((contents[i] & 0xFC) >> 2));
-
- // output character 2
- int c2 = (contents[i] & 0x03) << 4;
- if (i + 1 >= contents.length) {
- result.append(mappings.charAt(c2));
- result.append(filler);
- result.append(filler);
- return result.toString();
- }
-
- c2 |= ((contents[i + 1] & 0xF0) >> 4);
- result.append(mappings.charAt(c2));
-
- // output character 3
- int c3 = (contents[i + 1] & 0x0F) << 2;
- if (i + 2 >= contents.length) {
- result.append(mappings.charAt(c3));
- result.append(filler);
- return result.toString();
- }
-
- c3 |= ((contents[i + 2] & 0xC0) >> 6);
- result.append(mappings.charAt(c3));
-
- // output character 4
- result.append(mappings.charAt(contents[i + 2] & 0x3F));
- }
-
- return result.toString();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/InternalErrorDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/InternalErrorDialog.java
deleted file mode 100644
index 41d0b18..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/InternalErrorDialog.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.PrintStream;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-
-/**
- * Added a Details button to the MessageDialog to show the exception
- * stack trace.
- */
-public class InternalErrorDialog extends MessageDialog {
-
- private Throwable detail;
- private int detailButtonID = -1;
- private Text text;
-
- //Workaround. SWT does not seem to set the default button if
- //there is not control with focus. Bug: 14668
- private int defaultButtonIndex = 0;
-
- /**
- * Size of the text in lines.
- */
- private static final int TEXT_LINE_COUNT = 15;
-
-public InternalErrorDialog(
- Shell parentShell,
- String dialogTitle,
- Image dialogTitleImage,
- String dialogMessage,
- Throwable detail,
- int dialogImageType,
- String[] dialogButtonLabels,
- int defaultIndex) {
- super(
- parentShell,
- dialogTitle,
- dialogTitleImage,
- dialogMessage,
- dialogImageType,
- dialogButtonLabels,
- defaultIndex);
- defaultButtonIndex = defaultIndex;
- this.detail = detail;
- setShellStyle(getShellStyle() | SWT.APPLICATION_MODAL);
-}
-
-//Workaround. SWT does not seem to set rigth the default button if
-//there is not control with focus. Bug: 14668
-public int open() {
- create();
- Button b = getButton(defaultButtonIndex);
- b.setFocus();
- b.getShell().setDefaultButton(b);
- return super.open();
-}
-
-/**
- * Set the detail button;
- */
-public void setDetailButton(int index) {
- detailButtonID = index;
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void buttonPressed(int buttonId) {
- if(buttonId == detailButtonID) {
- toggleDetailsArea();
- } else {
- setReturnCode(buttonId);
- close();
- }
-}
-/**
- * Toggles the unfolding of the details area. This is triggered by
- * the user pressing the details button.
- */
-private void toggleDetailsArea() {
- Point windowSize = getShell().getSize();
- Point oldSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- if (text != null) {
- text.dispose();
- text = null;
- getButton(detailButtonID).setText(IDialogConstants.SHOW_DETAILS_LABEL);
- } else {
- createDropDownText((Composite)getContents());
- getButton(detailButtonID).setText(IDialogConstants.HIDE_DETAILS_LABEL);
- }
-
- Point newSize = getContents().computeSize(SWT.DEFAULT, SWT.DEFAULT);
- getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y)));
-}
-/**
- * Create this dialog's drop-down list component.
- *
- * @param parent the parent composite
- * @return the drop-down list component
- */
-protected void createDropDownText(Composite parent) {
- // create the list
- text = new Text(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- text.setFont(parent.getFont());
-
- // print the stacktrace in the text field
- try {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- PrintStream ps = new PrintStream(baos);
- detail.printStackTrace(ps);
- if((detail instanceof SWTError) && (((SWTError)detail).throwable != null)) {
- ps.println("\n*** Stack trace of contained exception ***"); //$NON-NLS-1$
- ((SWTError)detail).throwable.printStackTrace(ps);
- } else if((detail instanceof SWTException) && (((SWTException)detail).throwable != null)) {
- ps.println("\n*** Stack trace of contained exception ***"); //$NON-NLS-1$
- ((SWTException)detail).throwable.printStackTrace(ps);
- }
- ps.flush();
- baos.flush();
- text.setText(baos.toString());
- } catch (IOException e) {
- }
-
- GridData data = new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL |
- GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL);
- data.heightHint = text.getLineHeight() * TEXT_LINE_COUNT;
- text.setLayoutData(data);
-}
-/**
- * Convenience method to open a simple Yes/No question dialog.
- *
- * @param parent the parent shell of the dialog, or <code>null</code> if none
- * @param title the dialog's title, or <code>null</code> if none
- * @param message the message
- * @return <code>true</code> if the user presses the OK button,
- * <code>false</code> otherwise
- */
-public static boolean openQuestion(Shell parent, String title, String message, Throwable detail,int defaultIndex) {
- String[] labels;
- if(detail == null)
- labels = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL};
- else
- labels = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL,IDialogConstants.SHOW_DETAILS_LABEL};
-
- InternalErrorDialog dialog = new InternalErrorDialog(
- parent,
- title,
- null, // accept the default window icon
- message,
- detail,
- QUESTION,
- labels,
- defaultIndex);
- if(detail != null)
- dialog.setDetailButton(2);
- return dialog.open() == 0;
-}
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ListContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ListContentProvider.java
deleted file mode 100644
index f34d2ad..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ListContentProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * Provides elements from a List.
- */
-public class ListContentProvider implements IStructuredContentProvider {
- List contents;
-
- public ListContentProvider() {
- }
- /**
- * Implements IStructuredContentProvider.
- *
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(Object)
- */
- public Object[] getElements(Object input) {
- if (contents != null && contents == input) {
- return contents.toArray();
- }
- return new Object[0];
- }
- /**
- * Implements IContentProvider.
- *
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(Viewer, Object, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (newInput instanceof List) {
- contents = (List) newInput;
- }
- else {
- contents = null;
- }
- }
- /**
- * Implements IContentProvider.
- *
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepCapabilityWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepCapabilityWizard.java
deleted file mode 100644
index b1072e7..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepCapabilityWizard.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.dialogs.InstallCapabilityStep.IProjectProvider;
-import org.eclipse.ui.wizards.newresource.BasicNewResourceWizard;
-
-public abstract class MultiStepCapabilityWizard extends MultiStepWizard implements IProjectProvider {
- /**
- * Creates an empty wizard
- */
- protected MultiStepCapabilityWizard() {
- super();
- }
-
- /**
- * Returns the IDs of the perspectives to present
- * as choices to the user.
- */
- protected abstract String[] getPerspectiveChoices();
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean performFinish() {
- if (!super.performFinish())
- return false;
-
- // Allow the user to choose which perspective to
- // switch to.
- if (isConfigureStepMode()) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- String[] perspIds = getPerspectiveChoices();
- if (perspIds.length > 0) {
- ProjectPerspectiveChoiceDialog dialog;
- dialog = new ProjectPerspectiveChoiceDialog(window, perspIds);
- dialog.open();
- if (dialog.getReturnCode() == Dialog.OK)
- window = dialog.showChosenPerspective();
- }
-
- IProject project = getProject();
- if (project != null) {
- BasicNewResourceWizard.selectAndReveal(project, window);
- }
- }
-
- return true;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepConfigureWizardPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepConfigureWizardPage.java
deleted file mode 100644
index c6e3084..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepConfigureWizardPage.java
+++ /dev/null
@@ -1,502 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.jface.wizard.WizardSelectionPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.internal.misc.WizardStepGroup;
-
-/**
- * This page allows the user to go thru a series of steps. Each
- * step that has a wizard will have its pages embedded into this
- * page. At the end, the step will be asked to complete its work.
- * <p>
- * Example useage:
- * <pre>
- * mainPage = new MultiStepConfigureWizardPage("multiStepWizardPage");
- * mainPage.setTitle("Project");
- * mainPage.setDescription("Configure project capability.");
- * </pre>
- * </p>
- */
-public class MultiStepConfigureWizardPage extends WizardPage {
- private MultiStepWizardDialog wizardDialog;
- private Composite pageSite;
- private WizardStepGroup stepGroup;
- private WizardStepContainer stepContainer = new WizardStepContainer();
-
- /**
- * Creates a new multi-step wizard page.
- *
- * @param pageName the name of this page
- */
- public MultiStepConfigureWizardPage(String pageName) {
- super(pageName);
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardPage
- */
- public boolean canFlipToNextPage() {
- return stepContainer.canFlipToNextPage();
- }
-
- /* (non-Javadoc)
- * Method declared on IDialogPage.
- */
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.NEW_PROJECT_CONFIGURE_WIZARD_PAGE);
-
- createStepGroup(composite);
- createEmbeddedPageSite(composite);
-
- setControl(composite);
- }
-
- /**
- * Creates the control where the step's wizard will
- * display its pages.
- */
- private void createEmbeddedPageSite(Composite parent) {
- pageSite = new Composite(parent, SWT.NONE);
- pageSite.setLayout(new GridLayout());
- pageSite.setLayoutData(new GridData(GridData.FILL_BOTH));
- }
-
- /**
- * Creates the control for the step list
- */
- private void createStepGroup(Composite parent) {
- stepGroup = new WizardStepGroup();
- stepGroup.createContents(parent);
- }
-
- /**
- * Returns the container handler for the pages
- * of the step's wizard.
- */
- /* package */ WizardStepContainer getStepContainer() {
- return stepContainer;
- }
-
- /* (non-Javadoc)
- * Method declared on IDialogPage.
- */
- public String getMessage() {
- String msg = stepContainer.getMessage();
- if (msg == null || msg.length() == 0)
- msg = super.getMessage();
- return msg;
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardPage.
- */
- public IWizardPage getPreviousPage() {
- return stepContainer.getPreviousPage();
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardPage.
- */
- public void setPreviousPage(IWizardPage page) {
- // Do not allow to go back
- super.setPreviousPage(null);
- }
-
- /**
- * Sets the steps to be displayed. Ignored if the
- * createControl has not been called yet.
- *
- * @param steps the collection of steps
- */
- /* package */ void setSteps(WizardStep[] steps) {
- if (stepGroup != null)
- stepGroup.setSteps(steps);
- }
-
- /**
- * Sets the multi-step wizard dialog processing this
- * page.
- */
- /* package */ void setWizardDialog(MultiStepWizardDialog dialog) {
- wizardDialog = dialog;
- }
-
- /* (non-Javadoc)
- * Method declared on IDialogPage.
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- WizardStep[] steps = stepGroup.getSteps();
- MultiStepWizard stepWizard = wizardDialog.getMultiStepWizard();
- wizardDialog.setFinishLabel(stepWizard.getFinishStepLabel(steps));
-
- getControl().getDisplay().asyncExec(new Runnable() {
- public void run() {
- stepContainer.processCurrentStep();
- }
- });
- }
-
- /**
- * Support for handling pages from the step's wizard
- */
- /* package */ class WizardStepContainer implements IWizardContainer {
- private int stepIndex = 0;
- private IWizard wizard;
- private IWizardPage currentPage;
-
- /* (non-Javadoc)
- * Method declared on IRunnableContext.
- */
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- getContainer().run(fork, cancelable, runnable);
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardContainer.
- */
- public IWizardPage getCurrentPage() {
- return currentPage;
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardContainer.
- */
- public Shell getShell() {
- return getContainer().getShell();
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardContainer.
- */
- public void showPage(IWizardPage page) {
- showPage(page, true);
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardContainer.
- */
- public void updateButtons() {
- getContainer().updateButtons();
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardContainer.
- */
- public void updateMessage() {
- getContainer().updateMessage();
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardContainer.
- */
- public void updateTitleBar() {
- getContainer().updateTitleBar();
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardContainer.
- */
- public void updateWindowTitle() {
- getContainer().updateWindowTitle();
- }
-
- /**
- * Handles the back button pressed
- */
- public void backPressed() {
- showPage(currentPage.getPreviousPage(), false);
- }
-
- /**
- * Handles the next button pressed
- */
- public void nextPressed() {
- showPage(currentPage.getNextPage(), true);
- }
-
- /**
- * Handles the help button pressed
- */
- public void helpPressed() {
- if (currentPage != null)
- currentPage.performHelp();
- }
-
- /**
- * Handles close request
- */
- public final boolean performCancel() {
- if (wizard != null)
- return wizard.performCancel();
- else
- return true;
- }
-
- /**
- * Handles finish request
- */
- public final boolean performFinish() {
- if (wizard != null) {
- if (wizard.performFinish()) {
- wizard.dispose();
- wizard.setContainer(null);
- stepGroup.markStepAsDone();
- stepIndex++;
- return true;
- } else {
- return false;
- }
- } else {
- return true;
- }
- }
-
- /**
- * Calculates the difference in size between the given
- * page and the page site. A larger page results
- * in a positive delta.
- *
- * @param page the page
- * @return the size difference encoded
- * as a <code>new Point(deltaWidth,deltaHeight)</code>
- */
- private Point calculatePageSizeDelta(IWizardPage page) {
- Control pageControl = page.getControl();
-
- if (pageControl == null)
- // control not created yet
- return new Point(0,0);
-
- Point contentSize = pageControl.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- Rectangle rect = pageSite.getClientArea();
- Point containerSize = new Point(rect.width, rect.height);
-
- return new Point(
- Math.max(0, contentSize.x - containerSize.x),
- Math.max(0, contentSize.y - containerSize.y));
- }
-
- /**
- * Computes the correct page site size for the given page
- * and resizes the dialog if nessessary.
- *
- * @param page the wizard page
- */
- private void updateSizeForPage(IWizardPage page) {
- // ensure the page container is large enough
- Point delta = calculatePageSizeDelta(page);
-
- if (delta.x > 0 || delta.y > 0) {
- Point siteSize = pageSite.getSize();
- GridData data = (GridData)pageSite.getLayoutData();
- data.heightHint = siteSize.y + delta.y;
- data.widthHint = siteSize.x + delta.x;
- }
- }
-
- /**
- * Computes the correct page site size for the given wizard
- * and resizes the dialog if nessessary.
- *
- * @param wizard the wizard
- */
- private void updateSizeForWizard(IWizard wizard) {
- Point delta = new Point(0,0);
- IWizardPage[] pages = wizard.getPages();
- for (int i = 0; i < pages.length; i++){
- // ensure the page site is large enough
- Point pageDelta = calculatePageSizeDelta(pages[i]);
-
- delta.x = Math.max(delta.x, pageDelta.x);
- delta.y = Math.max(delta.y, pageDelta.y);
- }
-
- if (delta.x > 0 || delta.y > 0) {
- Point siteSize = pageSite.getSize();
- GridData data = (GridData)pageSite.getLayoutData();
- data.heightHint = siteSize.y + delta.y;
- data.widthHint = siteSize.x + delta.x;
- }
- }
-
- /**
- * Process the current step's wizard.
- */
- public void processCurrentStep() {
- WizardStep[] steps = stepGroup.getSteps();
- while (stepIndex < steps.length) {
- // adjust the finish button label
- if (stepIndex == (steps.length - 1))
- wizardDialog.setFinishLabel(null);
-
- final WizardStep step = steps[stepIndex];
- stepGroup.setCurrentStep(step);
-
- final IWizard[] stepWizard = new IWizard[1];
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- stepWizard[0] = step.getWizard();
- int tries = 0;
- while (stepWizard[0] == null && tries++ < 3) {
- boolean tryAgain = wizardDialog.getMultiStepWizard().handleMissingStepWizard(step);
- if (!tryAgain)
- break;
- else
- stepWizard[0] = step.getWizard();
- }
- }
- });
-
- if (stepWizard[0] == null)
- break;
- setWizard(stepWizard[0]);
- if (stepWizard[0].getPageCount() > 0)
- return;
- else
- performFinish();
- }
-
- wizardDialog.forceClose();
- }
-
- /**
- * Sets the current wizard
- */
- public void setWizard(IWizard newWizard) {
- wizard = newWizard;
-
- // Allow the wizard pages to precreate their page controls
- // This allows the wizard to open to the correct size
- wizard.createPageControls(pageSite);
-
- // Ensure that all of the created pages are initially not visible
- IWizardPage[] pages = wizard.getPages();
- for (int i = 0; i < pages.length; i++) {
- IWizardPage page = (IWizardPage)pages[i];
- if (page.getControl() != null)
- page.getControl().setVisible(false);
- }
-
- // Ensure the dialog is large enough for the wizard
- updateSizeForWizard(wizard);
- wizardDialog.updateLayout();
-
- wizard.setContainer(this);
- showPage(wizard.getStartingPage(), false);
- }
-
- /**
- * Show the requested page
- */
- public void showPage(IWizardPage page, boolean rememberPrevious) {
- if (page == null || page == currentPage)
- return;
-
- if (rememberPrevious && currentPage != null)
- page.setPreviousPage(currentPage);
-
- if (wizard != page.getWizard())
- Assert.isTrue(false);
-
- // ensure that page control has been created
- // (this allows lazy page control creation)
- if (page.getControl() == null) {
- page.createControl(pageSite);
- // the page is responsible for ensuring the created control is accessable
- // via getControl.
- Assert.isNotNull(page.getControl());
- // ensure the dialog is large enough for this page
- updateSizeForPage(page);
- wizardDialog.updateLayout();
- }
-
- // make the new page visible
- IWizardPage oldPage = currentPage;
- currentPage = page;
- currentPage.setVisible(true);
- if (oldPage != null)
- oldPage.setVisible(false);
- page.getControl().setBounds(pageSite.getClientArea());
-
- // update the dialog controls
- wizardDialog.updateAll();
- }
-
- /**
- * Returns whether the current wizard can finish
- */
- public boolean canWizardFinish() {
- if (wizard != null)
- return wizard.canFinish();
- else
- return false;
- }
-
- /**
- * Returns whether the current page can flip to
- * the next page
- */
- public boolean canFlipToNextPage() {
- if (currentPage != null)
- return currentPage.canFlipToNextPage();
- else
- return false;
- }
-
- /**
- * Returns the current page's message
- */
- public String getMessage() {
- if (currentPage != null)
- return currentPage.getMessage();
- else
- return null;
- }
-
- /**
- * Returns the current page's previous page
- */
- public IWizardPage getPreviousPage() {
- if (currentPage != null)
- return currentPage.getPreviousPage();
- else
- return null;
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepReviewWizardPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepReviewWizardPage.java
deleted file mode 100644
index d3e9160..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepReviewWizardPage.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.misc.WizardStepGroup;
-
-/**
- * This page allows the user to review the steps to be done.
- * <p>
- * Example useage:
- * <pre>
- * mainPage = new MultiStepReviewWizardPage("multiStepReviewPage");
- * mainPage.setTitle("Project");
- * mainPage.setDescription("Review project.");
- * </pre>
- * </p>
- */
-public class MultiStepReviewWizardPage extends WizardPage {
- private Text detailsField;
- private Label instructionLabel;
- private WizardStepGroup stepGroup;
- private MultiStepWizard stepWizard;
-
- /**
- * Creates a new step review wizard page.
- *
- * @param pageName the name of this page
- */
- public MultiStepReviewWizardPage(String pageName, MultiStepWizard stepWizard) {
- super(pageName);
- this.stepWizard = stepWizard;
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardPage
- */
- public boolean canFlipToNextPage() {
- // Already know there is a next page...
- return isPageComplete() && !stepWizard.canFinishOnReviewPage();
- }
-
- /* (non-Javadoc)
- * Method declared on IDialogPage.
- */
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.NEW_PROJECT_REVIEW_WIZARD_PAGE);
-
- createStepGroup(composite);
- createDetailsGroup(composite);
- createInstructionsGroup(composite);
-
- setControl(composite);
- }
-
- /**
- * Creates the control for the details
- */
- private void createDetailsGroup(Composite parent) {
- // Create a composite to hold everything together
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // Add a label to identify the details text field
- Label label = new Label(composite, SWT.LEFT);
- label.setText(WorkbenchMessages.getString("MultiStepReviewWizardPage.detailsLabel")); //$NON-NLS-1$
- GridData data = new GridData();
- data.verticalAlignment = SWT.TOP;
- label.setLayoutData(data);
-
- // Text field to display the step's details
- detailsField = new Text(composite, SWT.WRAP | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
- detailsField.setText("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"); // prefill to show 15 lines //$NON-NLS-1$
- detailsField.setEditable(false);
- detailsField.setLayoutData(new GridData(GridData.FILL_BOTH));
- }
-
- /**
- * Creates the control for the instructions
- */
- private void createInstructionsGroup(Composite parent) {
- instructionLabel = new Label(parent, SWT.LEFT);
- instructionLabel.setText(WorkbenchMessages.getString("MultiStepReviewWizardPage.instructionLabel")); //$NON-NLS-1$
- GridData data = new GridData();
- data.verticalAlignment = SWT.TOP;
- data.horizontalSpan = 2;
- instructionLabel.setLayoutData(data);
- }
-
- /**
- * Creates the control for the step list
- */
- private void createStepGroup(Composite parent) {
- stepGroup = new WizardStepGroup();
- stepGroup.createContents(parent);
- stepGroup.setSelectionListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- if (event.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection sel = (IStructuredSelection)event.getSelection();
- WizardStep step = (WizardStep)sel.getFirstElement();
- if (step != null)
- detailsField.setText(step.getDetails());
- }
- }
- });
- }
-
- /**
- * Returns the steps to be displayed.
- */
- /* package */ WizardStep[] getSteps() {
- if (stepGroup != null)
- return stepGroup.getSteps();
- else
- return new WizardStep[0];
- }
-
- /**
- * Sets the steps to be displayed. Has no effect if
- * the page is not yet created.
- *
- * @param steps the collection of steps
- */
- /* package */ void setSteps(WizardStep[] steps) {
- if (stepGroup != null)
- stepGroup.setSteps(steps);
- }
-
- /* (non-Javadoc)
- * Method declared on IDialogPage.
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- if (stepWizard.canFinishOnReviewPage())
- instructionLabel.setText(WorkbenchMessages.getString("MultiStepReviewWizardPage.instructionFinishLabel")); //$NON-NLS-1$
- else
- instructionLabel.setText(WorkbenchMessages.getString("MultiStepReviewWizardPage.instructionNextLabel")); //$NON-NLS-1$
- ((Composite)getControl()).layout(true);
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepWizard.java
deleted file mode 100644
index 88196fd..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepWizard.java
+++ /dev/null
@@ -1,229 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.dialogs.MultiStepConfigureWizardPage.WizardStepContainer;
-
-/**
- * Standard workbench wizard to handle a multi-step page. The
- * wizard is allowed any number of pages before the multi-step
- * page is presented to the user.
- * <p>
- * Example:
- * <pre>
- * IWizard wizard = new MultiStepWizard();
- * WizardDialog dialog = new MultiStepWizardDialog(shell, wizard);
- * dialog.open();
- * </pre>
- * </p>
- */
-public abstract class MultiStepWizard extends Wizard {
- private MultiStepWizardDialog wizardDialog;
- private MultiStepReviewWizardPage reviewPage;
- private MultiStepConfigureWizardPage configPage;
-
- /**
- * Creates an empty wizard
- */
- protected MultiStepWizard() {
- super();
- setNeedsProgressMonitor(true);
- }
-
- /**
- * Adds any custom pages to the wizard before
- * the multi-step review and configure pages are
- * added.
- */
- protected abstract void addCustomPages();
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public final void addPages() {
- super.addPages();
- addCustomPages();
-
- reviewPage = new MultiStepReviewWizardPage("multiStepReviewWizardPage", this);//$NON-NLS-1$
- reviewPage.setTitle(getReviewPageTitle()); //$NON-NLS-1$
- reviewPage.setDescription(getReviewPageDescription()); //$NON-NLS-1$
- this.addPage(reviewPage);
-
- configPage = new MultiStepConfigureWizardPage("multiStepConfigureWizardPage");//$NON-NLS-1$
- configPage.setTitle(getConfigurePageTitle()); //$NON-NLS-1$
- configPage.setDescription(getConfigurePageDescription()); //$NON-NLS-1$
- configPage.setWizardDialog(wizardDialog);
- this.addPage(configPage);
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean canFinish() {
- if (getContainer().getCurrentPage() == reviewPage)
- return canFinishOnReviewPage();
- else if (isConfigureStepMode())
- return getStepContainer().canWizardFinish();
- else
- return false;
- }
-
- /**
- * Returns whether the wizard wants the Finish button
- * enabled on the review page. Should only happen if
- * there is only one step and that step does not require
- * further interaction with the user. The Next button will
- * be disabled and the instructions updated.
- */
- protected abstract boolean canFinishOnReviewPage();
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public void dispose() {
- super.dispose();
- wizardDialog = null;
- }
-
- /**
- * Returns the title for the multi-step configure
- * page.
- */
- protected abstract String getConfigurePageTitle();
-
- /**
- * Returns the description for the multi-step configure
- * page.
- */
- protected abstract String getConfigurePageDescription();
-
- /**
- * Returns the title for the multi-step review
- * page.
- */
- protected abstract String getReviewPageTitle();
-
- /**
- * Returns the label used on the finish button to
- * to indicate finishing a step. Can be <code>null</code>
- * if no special label is required.
- * <p>
- * The default implementation is to return the translated
- * label "Finish Step".
- * </p><p>
- * On the last step, the finish button label is changed to
- * be "Finish" and will no be changed.
- * </p>
- */
- protected String getFinishStepLabel(WizardStep[] steps) {
- return WorkbenchMessages.getString("MultiStepWizard.finishLabel"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public final IWizardPage getPreviousPage(IWizardPage page) {
- if (page == configPage)
- return null;
- else
- return super.getPreviousPage(page);
- }
-
- /**
- * Returns the description for the multi-step review
- * page.
- */
- protected abstract String getReviewPageDescription();
-
- /**
- * Returns the container handler for the pages
- * of the step's wizard.
- */
- /* package */ WizardStepContainer getStepContainer() {
- return configPage.getStepContainer();
- }
-
- /**
- * Handles the problem of a missing step wizard.
- *
- * @return <code>true</code> to retry, <code>false</code> to terminate
- * multi step wizard dialog.
- */
- /* package */ abstract boolean handleMissingStepWizard(WizardStep step);
-
- /**
- * Returns whether the wizard is configuring steps
- */
- /* package */ boolean isConfigureStepMode() {
- return getContainer().getCurrentPage() == configPage;
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public final boolean performCancel() {
- if (isConfigureStepMode())
- return getStepContainer().performCancel();
- else
- return true;
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean performFinish() {
- // Finish on review page is a shortcut to performing
- // the steps.
- if (getContainer().getCurrentPage() == reviewPage) {
- getContainer().showPage(configPage);
- return false;
- }
-
- // Does nothing as each step is responsible
- // to complete its work when its wizard is
- // done.
- return true;
- }
-
- /**
- * Returns the collection of steps for the wizard.
- */
- public final WizardStep[] getSteps() {
- if (reviewPage != null)
- return reviewPage.getSteps();
- else
- return new WizardStep[0];
- }
-
- /**
- * Sets the collection of steps for the wizard.
- * Ignored if the multi-step review and configure
- * pages are not yet created.
- */
- public final void setSteps(WizardStep[] steps) {
- if (reviewPage != null)
- reviewPage.setSteps(steps);
- if (configPage != null)
- configPage.setSteps(steps);
- }
-
- /**
- * Sets the multi-step wizard dialog processing this
- * wizard.
- */
- /* package */ void setWizardDialog(MultiStepWizardDialog dialog) {
- wizardDialog = dialog;
- if (configPage != null)
- configPage.setWizardDialog(wizardDialog);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepWizardDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepWizardDialog.java
deleted file mode 100644
index 21e34ec..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/MultiStepWizardDialog.java
+++ /dev/null
@@ -1,142 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * A dialog to show a multi-step wizard to the end user.
- * <p>
- * In typical usage, the client instantiates this class with
- * a multi-step wizard. The dialog serves as the wizard container
- * and orchestrates the presentation of its pages.
- * <p>
- * The standard layout is roughly as follows:
- * it has an area at the top containing both the
- * wizard's title, description, and image; the actual wizard page
- * appears in the middle; below that is a progress indicator
- * (which is made visible if needed); and at the bottom
- * of the page is message line and a button bar containing
- * Help, Next, Back, Finish, and Cancel buttons (or some subset).
- * </p>
- * <p>
- * This class is not intended to be subclassed by clients.
- * </p>
- */
-public class MultiStepWizardDialog extends WizardDialog {
- private MultiStepWizard multiStepWizard;
-
- /**
- * Creates a new wizard dialog for the given wizard.
- *
- * @param parentShell the parent shell
- * @param newWizard the multi-step wizard this dialog is working on
- */
- public MultiStepWizardDialog(Shell parentShell, MultiStepWizard newWizard) {
- super(parentShell, newWizard);
- multiStepWizard = newWizard;
- multiStepWizard.setWizardDialog(this);
- }
-
- /**
- * Forces the wizard dialog to close
- */
- /* package */ void forceClose() {
- super.finishPressed();
- }
-
- /* (non-Javadoc)
- * Method declared on WizardDialog.
- */
- protected void backPressed() {
- if (multiStepWizard.isConfigureStepMode())
- multiStepWizard.getStepContainer().backPressed();
- else
- super.backPressed();
- }
-
- /* (non-Javadoc)
- * Method declared on WizardDialog.
- */
- protected void finishPressed() {
- if (multiStepWizard.isConfigureStepMode()) {
- boolean success = multiStepWizard.getStepContainer().performFinish();
- if (success)
- multiStepWizard.getStepContainer().processCurrentStep();
- } else {
- super.finishPressed();
- }
- }
-
- /**
- * Returns the multi-step wizard for this dialog
- */
- /* package */ MultiStepWizard getMultiStepWizard() {
- return multiStepWizard;
- }
-
- /* (non-Javadoc)
- * Method declared on WizardDialog.
- */
- protected void helpPressed() {
- if (multiStepWizard.isConfigureStepMode())
- multiStepWizard.getStepContainer().helpPressed();
- else
- super.helpPressed();
- }
-
- /* (non-Javadoc)
- * Method declared on WizardDialog.
- */
- protected void nextPressed() {
- if (multiStepWizard.isConfigureStepMode())
- multiStepWizard.getStepContainer().nextPressed();
- else
- super.nextPressed();
- }
-
- /**
- * Sets the label for the finish button
- */
- /* package */ void setFinishLabel(String label) {
- Button button = getButton(IDialogConstants.FINISH_ID);
- if (button == null)
- return;
-
- if (label == null) {
- if (!button.getText().equals(IDialogConstants.FINISH_LABEL)) {
- button.setText(IDialogConstants.FINISH_LABEL);
- ((Composite)button.getParent()).layout(true);
- }
- } else {
- button.setText(label);
- ((Composite)button.getParent()).layout(true);
- }
- }
-
- /**
- * Updates everything in the dialog
- */
- /* package */ void updateAll() {
- super.update();
- }
-
- /**
- * Updates the layout of the dialog
- */
- /* package */ void updateLayout() {
- super.updateSize(getCurrentPage());
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewProjectWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewProjectWizard.java
deleted file mode 100644
index 98bf8f8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewProjectWizard.java
+++ /dev/null
@@ -1,291 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectNatureDescriptor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.registry.Capability;
-import org.eclipse.ui.internal.registry.CapabilityRegistry;
-import org.eclipse.ui.internal.registry.ICategory;
-
-/**
- * Standard workbench wizard that guides the user to supply
- * the necessary information to create a project.
- */
-public class NewProjectWizard extends MultiStepCapabilityWizard implements INewWizard {
- // init method parameters supplied
- private IWorkbench workbench;
- private IStructuredSelection selection;
-
- // Reference to the pages provided by this wizard
- private WizardNewProjectNameAndLocationPage creationPage;
- private WizardNewProjectCapabilityPage capabilityPage;
-
- // Newly created project
- private IProject newProject;
-
- // initial values for the pages provided by this wizard
- private String initialProjectName;
- private Capability[] initialProjectCapabilities;
- private ICategory[] initialSelectedCategories;
-
- /**
- * Creates an empty wizard for creating a new project
- * in the workspace.
- */
- public NewProjectWizard() {
- super();
-
- WorkbenchPlugin plugin = WorkbenchPlugin.getDefault();
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("NewProjectWizard");//$NON-NLS-1$
- if (section == null)
- section = workbenchSettings.addNewSection("NewProjectWizard");//$NON-NLS-1$
- setDialogSettings(section);
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected void addCustomPages() {
- creationPage = new WizardNewProjectNameAndLocationPage("newProjectCreationPage");//$NON-NLS-1$
- creationPage.setTitle(WorkbenchMessages.getString("NewProjectWizard.title")); //$NON-NLS-1$
- creationPage.setDescription(WorkbenchMessages.getString("WizardNewProjectCreationPage.description")); //$NON-NLS-1$
- creationPage.setInitialProjectName(initialProjectName);
- this.addPage(creationPage);
-
- capabilityPage = new WizardNewProjectCapabilityPage("newProjectCapabilityPage");//$NON-NLS-1$
- capabilityPage.setTitle(WorkbenchMessages.getString("NewProjectWizard.title")); //$NON-NLS-1$
- capabilityPage.setDescription(WorkbenchMessages.getString("WizardNewProjectCapabilityPage.description")); //$NON-NLS-1$
- capabilityPage.setInitialProjectCapabilities(initialProjectCapabilities);
- capabilityPage.setInitialSelectedCategories(initialSelectedCategories);
- this.addPage(capabilityPage);
- }
-
- /**
- * Builds the collection of steps to create and install
- * the chosen capabilities.
- *
- * @return <code>true</code> if successful, <code>false</code>
- * if a problem was detected.
- */
- private boolean buildSteps() {
- Capability[] caps = capabilityPage.getSelectedCapabilities();
- CapabilityRegistry reg = WorkbenchPlugin.getDefault().getCapabilityRegistry();
- IStatus status = reg.validateCapabilities(caps);
- if (status.isOK()) {
- Capability[] results = reg.pruneCapabilities(caps);
- WizardStep[] steps = new WizardStep[results.length + 1];
- steps[0] = new CreateProjectStep(1, creationPage, this);
- for (int i = 0; i < results.length; i++)
- steps[i+1] = new InstallCapabilityStep(i+2, results[i], workbench, this);
- setSteps(steps);
- return true;
- } else {
- ErrorDialog.openError(
- getShell(),
- WorkbenchMessages.getString("NewProjectWizard.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("NewProjectWizard.invalidCapabilities"), //$NON-NLS-1$
- status);
- return false;
- }
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected boolean canFinishOnReviewPage() {
- // yes if the only step is to create the project.
- return getSteps().length == 1;
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected String getConfigurePageTitle() {
- return WorkbenchMessages.getString("NewProjectWizard.title"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected String getConfigurePageDescription() {
- return WorkbenchMessages.getString("WizardProjectConfigurePage.description"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected String getReviewPageTitle() {
- return WorkbenchMessages.getString("NewProjectWizard.title"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected String getReviewPageDescription() {
- return WorkbenchMessages.getString("WizardProjectReviewPage.description"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected String getFinishStepLabel(WizardStep[] steps) {
- // The first step is the project creation which has no wizard
- // pages, so ignore it. If there is only one step after that,
- // then it needs the "Finish" label. So the "Finish Step" label
- // is only needed if more than 2 steps in the list.
- if (steps.length > 2)
- return super.getFinishStepLabel(steps);
- else
- return null;
- }
-
- /**
- * Returns the newly created project.
- *
- * @return the created project, or <code>null</code>
- * if project is not created yet.
- */
- public IProject getNewProject() {
- return newProject;
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected String[] getPerspectiveChoices() {
- ArrayList results = new ArrayList();
- Capability[] caps = capabilityPage.getSelectedCapabilities();
- for (int i = 0; i < caps.length; i++) {
- ArrayList ids = caps[i].getPerspectiveChoices();
- if (ids != null) {
- Iterator enum = ids.iterator();
- while (enum.hasNext()) {
- String id = (String)enum.next();
- if (!results.contains(id))
- results.add(id);
- }
- }
- }
- String[] ids = new String[results.size()];
- results.toArray(ids);
- return ids;
- }
-
- /* (non-Javadoc)
- * Method declared on IProjectProvider.
- */
- public IProject getProject() {
- return newProject;
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public IWizardPage getNextPage(IWizardPage page) {
- if (page == capabilityPage) {
- if (!buildSteps())
- return capabilityPage;
- }
- return super.getNextPage(page);
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- /* package */ boolean handleMissingStepWizard(WizardStep step) {
- MessageDialog.openError(
- getShell(),
- WorkbenchMessages.getString("NewProjectWizard.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("NewProjectWizard.noWizard", new Object[] {step.getLabel()})); //$NON-NLS-1$
- return false;
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchWizard.
- */
- public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- this.workbench = workbench;
- this.selection = currentSelection;
- initializeDefaultPageImageDescriptor();
- setWindowTitle(WorkbenchMessages.getString("NewProjectWizard.windowTitle")); //$NON-NLS-1$
- }
-
- /**
- * Sets the image banner for the wizard
- */
- protected void initializeDefaultPageImageDescriptor() {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- URL installURL = WorkbenchPlugin.getDefault().getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + "wizban/newprj_wiz.gif");//$NON-NLS-1$
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- setDefaultPageImageDescriptor(desc);
- }
- catch (MalformedURLException e) {
- // Should not happen. Ignore.
- }
- }
-
- /**
- * Sets the initial categories to be selected.
- *
- * @param categories initial categories to select
- */
- public void setInitialSelectedCategories(ICategory[] categories) {
- initialSelectedCategories = categories;
- }
-
- /**
- * Sets the initial project capabilities to be selected.
- *
- * @param capabilities initial project capabilities to select
- */
- public void setInitialProjectCapabilities(Capability[] capabilities) {
- initialProjectCapabilities = capabilities;
- }
-
- /**
- * Sets the initial project name. Leading and trailing
- * spaces in the name are ignored.
- *
- * @param name initial project name
- */
- public void setInitialProjectName(String name) {
- if (name == null)
- initialProjectName = null;
- else
- initialProjectName = name.trim();
- }
-
- /**
- * Sets the newly created project resource
- */
- /* package */ void setNewProject(IProject project) {
- newProject = project;
- }
-}
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
deleted file mode 100644
index 1e5be8e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizard.java
+++ /dev/null
@@ -1,113 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.StringTokenizer;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.internal.misc.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.*;
-
-/**
- * The new wizard is responsible for allowing the user to choose which
- * new (nested) wizard to run. The set of available new wizards comes
- * from the new extension point.
- */
-public class NewWizard extends Wizard {
- private static final String CATEGORY_SEPARATOR = "/"; //$NON-NLS-1$
-
- private IWorkbench workbench;
- private IStructuredSelection selection;
- private NewWizardSelectionPage mainPage;
- private boolean projectsOnly = false;
- private String categoryId = null;
-/**
- * Create the wizard pages
- */
-public void addPages() {
- NewWizardsRegistryReader rdr = new NewWizardsRegistryReader(projectsOnly);
- WizardCollectionElement wizards = (WizardCollectionElement)rdr.getWizards();
-
- if (categoryId != null) {
- WizardCollectionElement categories = wizards;
- StringTokenizer familyTokenizer = new StringTokenizer(categoryId, CATEGORY_SEPARATOR);
- while (familyTokenizer.hasMoreElements()) {
- categories = getChildWithID(categories, familyTokenizer.nextToken());
- if (categories == null)
- break;
- }
- if (categories != null)
- wizards = categories;
- }
-
- mainPage =
- new NewWizardSelectionPage(
- this.workbench,
- this.selection,
- wizards);
- addPage(mainPage);
-}
-/**
- * Returns the child collection element for the given id
- */
-private WizardCollectionElement getChildWithID(WizardCollectionElement parent, String id) {
- Object[] children = parent.getChildren();
- for (int i = 0; i < children.length; ++i) {
- WizardCollectionElement currentChild = (WizardCollectionElement)children[i];
- if (currentChild.getId().equals(id))
- return currentChild;
- }
- return null;
-}
-/**
- * Returns the id of the category of wizards to show
- * or <code>null</code> to show all categories.
- */
-public String getCategoryId() {
- return categoryId;
-}
-/**
- * Sets the id of the category of wizards to show
- * or <code>null</code> to show all categories.
- */
-public void setCategoryId(String id) {
- categoryId = id;
-}
-/**
- * Lazily create the wizards pages
- */
-public void init(IWorkbench aWorkbench, IStructuredSelection currentSelection) {
- this.workbench = aWorkbench;
- this.selection = currentSelection;
-
- if (projectsOnly)
- setWindowTitle(WorkbenchMessages.getString("NewProject.title")); //$NON-NLS-1$
- else
- setWindowTitle(WorkbenchMessages.getString("NewWizard.title")); //$NON-NLS-1$
- 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
- */
-public boolean performFinish() {
- //save our selection state
- mainPage.saveWidgetValues();
- return true;
-}
-/**
- * Sets the projects only flag. If <code>true</code> only projects will
- * be shown in this wizard.
- */
-public void setProjectsOnly(boolean b) {
- projectsOnly = b;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardCollectionSorter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardCollectionSorter.java
deleted file mode 100644
index c7fe41d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardCollectionSorter.java
+++ /dev/null
@@ -1,69 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.ui.internal.registry.NewWizardsRegistryReader;
-import java.text.Collator;
-import org.eclipse.jface.viewers.*;
-
-/**
- * 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.
- */
-class NewWizardCollectionSorter extends ViewerSorter {
- public final static NewWizardCollectionSorter INSTANCE = new NewWizardCollectionSorter();
- private Collator collator = Collator.getInstance();
-/**
- * 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 NewWizardCollectionSorter() {
- super();
-}
-/**
- * The 'compare' method of the sort operation.
- *
- * @return the value <code>0</code> if the argument o1 is equal to o2;
- * a value less than <code>0</code> if o1 is less than o2;
- * and a value greater than <code>0</code> if o1 is greater than o2.
- */
-public int compare(Viewer viewer,Object o1,Object o2) {
- String name1 = ((WizardCollectionElement)o1).getLabel(o1);
- String name2 = ((WizardCollectionElement)o2).getLabel(o2);
- if (name1.equals(name2))
- return 0;
-
- // Be sure that the examples category is at the end of the wizard categories
- if (name2.equalsIgnoreCase(NewWizardsRegistryReader.EXAMPLES_WIZARD_CATEGORY))
- return -1;
-
- if (name1.equalsIgnoreCase(NewWizardsRegistryReader.EXAMPLES_WIZARD_CATEGORY))
- return 1;
-
- // note that this must be checked for name2 before name1 because if they're
- // BOTH equal to BASE_CATEGORY then we want to answer false by convention
- if (name2.equalsIgnoreCase(NewWizardsRegistryReader.BASE_CATEGORY))
- return 1;
-
- if (name1.equalsIgnoreCase(NewWizardsRegistryReader.BASE_CATEGORY))
- return -1;
-
- return collator.compare(name1, name2);
-}
-/**
- * Return true if this sorter is affected by a property
- * change of propertyName on the specified element.
- */
-public boolean isSorterProperty(Object object, String propertyId) {
- 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
deleted file mode 100644
index c291fd9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardNewPage.java
+++ /dev/null
@@ -1,362 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.misc.Workbook;
-import org.eclipse.ui.internal.misc.WorkbookPage;
-import org.eclipse.ui.internal.model.WorkbenchAdapter;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.ui.model.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.jface.*;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List;
-
-/**
- *New wizard selection tab that allows the user to select a registered
- *'New' wizard to be launched
- */
-class NewWizardNewPage implements ISelectionChangedListener, IDoubleClickListener {
- private WizardCollectionElement wizardCategories;
- private IWorkbench workbench;
- private NewWizardSelectionPage page;
- private IDialogSettings settings;
-
- private TreeViewer categoryTreeViewer;
- private TableViewer wizardSelectionViewer;
-
- private final static int SIZING_LISTS_HEIGHT = 200;
- private final static int SIZING_LISTS_WIDTH = 150;
-
- // id constants
- private final static String STORE_SELECTED_CATEGORY_ID =
- "NewWizardSelectionPage.STORE_SELECTED_CATEGORY_ID"; //$NON-NLS-1$
- private final static String STORE_EXPANDED_CATEGORIES_ID =
- "NewWizardSelectionPage.STORE_EXPANDED_CATEGORIES_ID"; //$NON-NLS-1$
- private final static String STORE_SELECTED_WIZARD_ID =
- "NewWizardSelectionPage.STORE_SELECTED_WIZARD_ID"; //$NON-NLS-1$
-/**
- * Create an instance of this class
- */
-public NewWizardNewPage(NewWizardSelectionPage mainPage, IWorkbench aWorkbench, WizardCollectionElement wizardCategories) {
- this.page = mainPage;
- this.workbench = aWorkbench;
- this.wizardCategories = wizardCategories;
-}
-public void activate() {
- page.setDescription(WorkbenchMessages.getString("NewWizardNewPage.description")); //$NON-NLS-1$
-
- selectionChanged(
- new SelectionChangedEvent(
- wizardSelectionViewer,
- (IStructuredSelection)wizardSelectionViewer.getSelection()));
-
-}
-/**
- * Create this tab's visual components
- *
- * @return org.eclipse.swt.widgets.Control
- * @param parent org.eclipse.swt.widgets.Composite
- */
-protected Control createControl(Composite parent) {
-
- Font wizardFont = parent.getFont();
- // top level group
- Composite outerContainer = new Composite(parent,SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- outerContainer.setLayout(layout);
- outerContainer.setFont(wizardFont);
- outerContainer.setLayoutData(new GridData(
- GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- // category tree pane...create SWT tree directly to
- // get single selection mode instead of multi selection.
- Tree tree = new Tree(outerContainer, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- categoryTreeViewer = new TreeViewer(tree);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = SIZING_LISTS_WIDTH;
- data.heightHint = SIZING_LISTS_HEIGHT;
- categoryTreeViewer.getTree().setLayoutData(data);
- categoryTreeViewer.setContentProvider(new WorkbenchContentProvider());
- categoryTreeViewer.setLabelProvider(new WorkbenchLabelProvider());
- categoryTreeViewer.setSorter(NewWizardCollectionSorter.INSTANCE);
- categoryTreeViewer.addSelectionChangedListener(this);
- if (wizardCategories.getParent(wizardCategories) == null)
- categoryTreeViewer.setInput(wizardCategories);
- else
- categoryTreeViewer.setInput(new RootElementProxy(wizardCategories));
- tree.setFont(wizardFont);
-
- // wizard actions pane...create SWT table directly to
- // get single selection mode instead of multi selection.
- Table table = new Table(outerContainer, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- wizardSelectionViewer = new TableViewer(table);
- data = new GridData(GridData.FILL_BOTH);
- data.widthHint = SIZING_LISTS_WIDTH;
- data.heightHint = SIZING_LISTS_HEIGHT;
- wizardSelectionViewer.getTable().setLayoutData(data);
- wizardSelectionViewer.setContentProvider(getWizardProvider());
- wizardSelectionViewer.setLabelProvider(new WorkbenchLabelProvider());
- wizardSelectionViewer.addSelectionChangedListener(this);
- wizardSelectionViewer.addDoubleClickListener(this);
- table.setFont(wizardFont);
-
- restoreWidgetValues();
- if (!categoryTreeViewer.getSelection().isEmpty())
- // we only set focus if a selection was restored
- categoryTreeViewer.getTree().setFocus();
- return outerContainer;
-}
-/**
- * Create a viewer pane in this group for the passed viewer.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param width int
- * @param height int
- */
-protected Composite createViewPane(Composite parent, int width,int height) {
- Composite paneWindow = new Composite(parent, SWT.BORDER);
- GridData spec = new GridData(GridData.FILL_BOTH);
- spec.widthHint = width;
- spec.heightHint = height;
- paneWindow.setLayoutData(spec);
- paneWindow.setLayout(new FillLayout());
- return paneWindow;
-}
-/**
- * A wizard in the wizard viewer has been double clicked.
- * Treat it as a selection.
- */
-public void doubleClick(DoubleClickEvent event) {
- selectionChanged(new SelectionChangedEvent(
- wizardSelectionViewer,
- wizardSelectionViewer.getSelection()));
- page.advanceToNextPage();
-}
-/**
- * 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);
- List categoriesToExpand = new ArrayList(expandedCategoryPaths.length);
-
- for (int i = 0; i < expandedCategoryPaths.length; i++){
- WizardCollectionElement category =
- wizardCategories.findChildCollection(
- new Path(expandedCategoryPaths[i]));
- if (category != null) // ie.- it still exists
- categoriesToExpand.add(category);
- }
-
- if (!categoriesToExpand.isEmpty())
- categoryTreeViewer.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;
-}
-/**
- * Returns the content provider for this page.
- */
-protected IContentProvider getWizardProvider() {
- //want to get the wizards of the collection element
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof WizardCollectionElement) {
- return ((WizardCollectionElement)o).getWizards();
- }
- return new Object[0];
- }
- };
-}
-/**
- * Handle the (de)selection of wizard element(s)
- *
- * @param selectionEvent SelectionChangedEvent
- */
-private void handleCategorySelection(SelectionChangedEvent selectionEvent) {
- page.setErrorMessage(null);
- page.setMessage(null);
-
- Object currentSelection = wizardSelectionViewer.getInput();
- Object selectedCategory =
- getSingleSelection((IStructuredSelection)selectionEvent.getSelection());
- if (currentSelection != selectedCategory) {
- page.selectWizardNode(null);
- wizardSelectionViewer.setInput(selectedCategory);
- }
-}
-/**
- * Handle the (de)selection of wizard element(s)
- *
- * @param selectionEvent SelectionChangedEvent
- */
-private void handleWizardSelection(SelectionChangedEvent selectionEvent) {
- page.setErrorMessage(null);
-
- WorkbenchWizardElement currentSelection =
- (WorkbenchWizardElement)getSingleSelection((IStructuredSelection)selectionEvent.getSelection());
-
- // If no single selection, clear and return
- if (currentSelection == null) {
- page.setMessage(null);
- page.selectWizardNode(null);
- return;
- }
-
- page.selectWizardNode(
- new WorkbenchWizardNode(page,currentSelection) {
- public IWorkbenchWizard createWizard() throws CoreException {
- return (INewWizard)wizardElement.createExecutableExtension();
- }
- });
-
- page.setMessage((String)currentSelection.getDescription());
-}
-/**
- * Set self's widgets to the values that they held last time this page was open
- *
- */
-protected void restoreWidgetValues() {
- String[] expandedCategoryPaths = settings.getArray(STORE_EXPANDED_CATEGORIES_ID);
- if (expandedCategoryPaths == null)
- return; // no stored values
-
- expandPreviouslyExpandedCategories();
- selectPreviouslySelectedCategoryAndWizard();
-}
-/**
- * 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 newSelection ISelection
- */
-public void selectionChanged(SelectionChangedEvent selectionEvent) {
- if (selectionEvent.getSelectionProvider().equals(categoryTreeViewer))
- handleCategorySelection(selectionEvent);
- else
- handleWizardSelection(selectionEvent);
-}
-/**
- * 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 selectPreviouslySelectedCategoryAndWizard() {
- String categoryId = (String)settings.get(STORE_SELECTED_CATEGORY_ID);
- if (categoryId == null)
- return;
- WizardCollectionElement category =
- wizardCategories.findChildCollection(new Path(categoryId));
- if (category == null)
- return; // category no longer exists, or has moved
-
- StructuredSelection selection = new StructuredSelection(category);
- categoryTreeViewer.setSelection(selection);
- selectionChanged(new SelectionChangedEvent(categoryTreeViewer,selection));
-
- String wizardId = (String)settings.get(STORE_SELECTED_WIZARD_ID);
- if (wizardId == null)
- return;
- WorkbenchWizardElement wizard = category.findWizard(wizardId,false);
- if (wizard == null)
- return; // wizard no longer exists, or has moved
-
- selection = new StructuredSelection(wizard);
- wizardSelectionViewer.setSelection(selection);
- selectionChanged(new SelectionChangedEvent(wizardSelectionViewer,selection));
-}
-/**
- * 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 = categoryTreeViewer.getExpandedElements();
- String[] expandedElementPaths = new String[expandedElements.length];
- for (int i = 0; i < expandedElements.length; ++i) {
- expandedElementPaths[i] =
- ((WizardCollectionElement)expandedElements[i]).getPath().toString();
- }
- settings.put(
- STORE_EXPANDED_CATEGORIES_ID,
- expandedElementPaths);
-}
-/**
- * Stores the currently-selected category and wizard in this page's dialog store,
- * in order to recreate this page's state in the next instance of this page.
- */
-protected void storeSelectedCategoryAndWizard() {
- WizardCollectionElement selectedCategory = (WizardCollectionElement)
- getSingleSelection((IStructuredSelection)categoryTreeViewer.getSelection());
-
- if (selectedCategory != null) {
- settings.put(
- STORE_SELECTED_CATEGORY_ID,
- selectedCategory.getPath().toString());
- }
-
- WorkbenchWizardElement selectedWizard = (WorkbenchWizardElement)
- getSingleSelection((IStructuredSelection)wizardSelectionViewer.getSelection());
-
- if (selectedWizard != null) {
- settings.put(
- STORE_SELECTED_WIZARD_ID,
- selectedWizard.getID());
- }
-}
-
-private static final class RootElementProxy extends WorkbenchAdapter implements IAdaptable {
- private WizardCollectionElement[] elements;
-
- public RootElementProxy(WizardCollectionElement element) {
- super();
- elements = new WizardCollectionElement[] {element};
- }
-
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- return null;
- }
-
- public Object[] getChildren(Object o) {
- return elements;
- }
-}
-}
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
deleted file mode 100644
index fe7173f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/NewWizardSelectionPage.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.*;
-import org.eclipse.jface.*;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-/**
- * 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.
- */
-class NewWizardSelectionPage extends WorkbenchWizardSelectionPage {
- private WizardCollectionElement wizardCategories;
-
- // widgets
- private NewWizardNewPage newResourcePage;
-/**
- * Create an instance of this class
- */
-public NewWizardSelectionPage(IWorkbench aWorkbench , IStructuredSelection currentSelection, WizardCollectionElement elements) {
- // override what superclass does with elements
- super("newWizardSelectionPage", aWorkbench, currentSelection, null);//$NON-NLS-1$
- setDescription(WorkbenchMessages.getString("NewWizardSelectionPage.description")); //$NON-NLS-1$
- wizardCategories = elements;
-}
-/**
- * Makes the next page visible.
- */
-public void advanceToNextPage() {
- getContainer().showPage(getNextPage());
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
- IDialogSettings settings = getDialogSettings();
- newResourcePage = new NewWizardNewPage(this, this.workbench, wizardCategories);
- newResourcePage.setDialogSettings(settings);
-
- Control control = newResourcePage.createControl(parent);
- WorkbenchHelp.setHelp(control, IHelpContextIds.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();
-}
-}
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
deleted file mode 100644
index e681740..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspContentProvider.java
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.jface.viewers.*;
-import java.util.*;
-
-public class PerspContentProvider implements IStructuredContentProvider {
-/**
- * PerspContentProvider constructor comment.
- */
-public PerspContentProvider() {
- super();
-}
-public void dispose() {
-}
-public Object[] getElements(Object element) {
- if (element instanceof IPerspectiveRegistry) {
- IPerspectiveRegistry reg = (IPerspectiveRegistry)element;
- return reg.getPerspectives();
- }
- return null;
-}
-public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-}
-public boolean isDeleted(Object element) {
- return false;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspLabelProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspLabelProvider.java
deleted file mode 100644
index 51816a1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspLabelProvider.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.HashMap;
-import java.util.Iterator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.IWorkbenchGraphicConstants;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-public class PerspLabelProvider extends LabelProvider {
- private HashMap imageCache = new HashMap(11);
- private boolean markDefault = true;
-
- public PerspLabelProvider() {
- super();
- }
-
- public PerspLabelProvider(boolean markDefault) {
- super();
- this.markDefault = markDefault;
- }
-
- public void dispose() {
- for (Iterator i = imageCache.values().iterator(); i.hasNext();) {
- ((Image) i.next()).dispose();
- }
- imageCache.clear();
- }
-
- public Image getImage(Object element) {
- if (element instanceof IPerspectiveDescriptor) {
- IPerspectiveDescriptor desc = (IPerspectiveDescriptor) element;
- ImageDescriptor imageDescriptor = desc.getImageDescriptor();
- if (imageDescriptor == null) {
- imageDescriptor = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_DEF_PERSPECTIVE_HOVER);
- }
- Image image = (Image) imageCache.get(imageDescriptor);
- if (image == null) {
- image = imageDescriptor.createImage();
- imageCache.put(imageDescriptor, image);
- }
- return image;
- }
- return null;
- }
-
- 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 = WorkbenchMessages.format("PerspectivesPreference.defaultLabel", new Object[] { label }); //$NON-NLS-1$
- }
- return label;
- }
- return WorkbenchMessages.getString("PerspectiveLabelProvider.unknown"); //$NON-NLS-1$
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index f68a4cc..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PerspectivesPreferencePage.java
+++ /dev/null
@@ -1,541 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.util.ArrayList;
-import java.util.HashSet;
-
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.PerspectiveDescriptor;
-import org.eclipse.ui.internal.registry.PerspectiveRegistry;
-
-public class PerspectivesPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- private IWorkbench workbench;
- private PerspectiveRegistry perspectiveRegistry;
- private ArrayList perspectives;
- private String defaultPerspectiveId;
- private ArrayList perspToDelete = new ArrayList();
- private ArrayList perspToRevert = new ArrayList();
- private List list;
- private Button revertButton;
- private Button deleteButton;
- private Button setDefaultButton;
-
- // widgets for open perspective mode;
- private Button openSameWindowButton;
- private Button openNewWindowButton;
- private int openPerspMode;
-
- // widgets for open view mode
- private int openViewMode;
- private Button openEmbedButton;
- private Button openFastButton;
-
- // widgets for perspective switching when creating new projects
- private Button switchOnNewProjectButton;
- private boolean switchOnNewProject;
-
- private static final int LIST_WIDTH = 200;
- private static final int LIST_HEIGHT = 200;
-
- // labels
- private static final String NEW_PROJECT_PERSPECTIVE_TITLE = WorkbenchMessages.getString("WorkbenchPreference.projectOptionsTitle"); //$NON-NLS-1$
-
- private static final String SWITCH_PERSPECTIVES_LABEL = WorkbenchMessages.getString("WorkbenchPreference.switch"); //$NON-NLS-1$
-
- private static final String OVM_TITLE = WorkbenchMessages.getString("OpenViewMode.title"); //$NON-NLS-1$
- private static final String OVM_EMBED = WorkbenchMessages.getString("OpenViewMode.embed"); //$NON-NLS-1$
- private static final String OVM_FAST = WorkbenchMessages.getString("OpenViewMode.fast"); //$NON-NLS-1$
-
- private static final String OPM_TITLE = WorkbenchMessages.getString("OpenPerspectiveMode.optionsTitle"); //$NON-NLS-1$
- private static final String OPM_SAME_WINDOW = WorkbenchMessages.getString("OpenPerspectiveMode.sameWindow"); //$NON-NLS-1$
- private static final String OPM_NEW_WINDOW = WorkbenchMessages.getString("OpenPerspectiveMode.newWindow"); //$NON-NLS-1$
-
- /**
- * Creates the page's UI content.
- */
- protected Control createContents(Composite parent) {
- WorkbenchHelp.setHelp(parent, IHelpContextIds.PERSPECTIVES_PREFERENCE_PAGE);
-
- Composite pageComponent = new Composite(parent, SWT.NULL);
- GridData data = new GridData(GridData.FILL_BOTH);
- pageComponent.setLayoutData(data);
- pageComponent.setFont(parent.getFont());
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.verticalSpacing = 10;
- pageComponent.setLayout(layout);
-
- createOpenPerspButtonGroup(pageComponent);
- createOpenViewButtonGroup(pageComponent);
- createProjectPerspectiveGroup(pageComponent);
- createCustomizePerspective(pageComponent);
-
- return pageComponent;
- }
-
- /**
- * Create a composite that contains buttons for selecting
- * the open perspective mode.
- *
- * @param composite Composite
- */
- private void createOpenPerspButtonGroup(Composite composite) {
-
- Font font = composite.getFont();
-
- Group buttonComposite = new Group(composite, SWT.LEFT);
- buttonComposite.setText(OPM_TITLE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- buttonComposite.setLayout(layout);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- buttonComposite.setLayoutData(data);
- buttonComposite.setFont(font);
-
- openSameWindowButton = new Button(buttonComposite, SWT.RADIO);
- openSameWindowButton.setText(OPM_SAME_WINDOW);
- openSameWindowButton.setSelection(IPreferenceConstants.OPM_ACTIVE_PAGE == openPerspMode);
- openSameWindowButton.setFont(font);
- openSameWindowButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent 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.setFont(font);
- openNewWindowButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- openPerspMode = IPreferenceConstants.OPM_NEW_WINDOW;
- }
- });
- }
-
- /**
- * Create a composite that contains buttons for selecting open view mode.
- * @param composite Composite
- */
- private void createOpenViewButtonGroup(Composite composite) {
-
- Font font = composite.getFont();
-
- Group buttonComposite = new Group(composite, SWT.LEFT);
- buttonComposite.setText(OVM_TITLE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- buttonComposite.setLayout(layout);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- buttonComposite.setLayoutData(data);
- buttonComposite.setFont(font);
-
- openEmbedButton = new Button(buttonComposite, SWT.RADIO);
- openEmbedButton.setText(OVM_EMBED);
- openEmbedButton.setSelection(
- openViewMode == IPreferenceConstants.OVM_EMBED);
- openEmbedButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- openViewMode = IPreferenceConstants.OVM_EMBED;
- }
- });
- openEmbedButton.setFont(font);
-
- // Open view as float no longer supported
- if (openViewMode == IPreferenceConstants.OVM_FLOAT)
- openViewMode = IPreferenceConstants.OVM_FAST;
-
- openFastButton = new Button(buttonComposite, SWT.RADIO);
- openFastButton.setText(OVM_FAST);
- openFastButton.setSelection(
- openViewMode == IPreferenceConstants.OVM_FAST);
- openFastButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- openViewMode = IPreferenceConstants.OVM_FAST;
- }
- });
- openFastButton.setFont(font);
- }
-
- /**
- * Create a composite that contains buttons for selecting the
- * preference opening new project selections.
- */
- private void createProjectPerspectiveGroup(Composite composite) {
-
- Font font = composite.getFont();
-
- Group buttonComposite = new Group(composite, SWT.LEFT | SWT.NULL);
- GridLayout layout = new GridLayout();
- buttonComposite.setLayout(layout);
- GridData data =
- new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- buttonComposite.setLayoutData(data);
- buttonComposite.setText(NEW_PROJECT_PERSPECTIVE_TITLE);
- buttonComposite.setFont(font);
-
- // No switch button
- switchOnNewProjectButton = new Button(buttonComposite, SWT.CHECK | SWT.LEFT);
- switchOnNewProjectButton.setText(SWITCH_PERSPECTIVES_LABEL);
- switchOnNewProjectButton.setFont(buttonComposite.getFont());
- switchOnNewProjectButton.setSelection(switchOnNewProject);
- switchOnNewProjectButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- switchOnNewProject = switchOnNewProjectButton.getSelection();
- }
- });
- }
- /**
- * Create a table a 3 buttons to enable the user to manage customized
- * perspectives.
- */
- protected Composite createCustomizePerspective(Composite parent) {
-
- Font font = parent.getFont();
-
- // define container & its gridding
- Composite perspectivesComponent = new Composite(parent, SWT.NULL);
- perspectivesComponent.setLayoutData(new GridData(GridData.FILL_BOTH));
- perspectivesComponent.setFont(parent.getFont());
-
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- perspectivesComponent.setLayout(layout);
-
- // Add the label
- Label label = new Label(perspectivesComponent, SWT.LEFT);
- label.setText(WorkbenchMessages.getString("PerspectivesPreference.available")); //$NON-NLS-1$
- GridData data = new GridData();
- data.horizontalSpan = 2;
- label.setLayoutData(data);
- label.setFont(font);
-
- // Add perspective list.
- list = new List(perspectivesComponent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- list.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateButtons();
- }
- });
-
- list.setFont(font);
-
- data = new GridData(GridData.FILL_BOTH);
- data.widthHint = LIST_WIDTH;
- data.heightHint = LIST_HEIGHT;
- list.setLayoutData(data);
-
- // Populate the perspective list
- IPerspectiveDescriptor[] persps = perspectiveRegistry.getPerspectives();
- perspectives = new ArrayList(persps.length);
- for (int i = 0; i < persps.length; i++)
- perspectives.add(i, persps[i]);
- defaultPerspectiveId = perspectiveRegistry.getDefaultPerspective();
- updateList();
-
- // Create vertical button bar.
- Composite buttonBar =
- (Composite) createVerticalButtonBar(perspectivesComponent);
- data = new GridData(GridData.FILL_VERTICAL);
- buttonBar.setLayoutData(data);
- 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.
- * </p>
- *
- * @param parent the parent composite
- * @param buttonId 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 createVerticalButton(
- Composite parent,
- String label,
- boolean defaultButton) {
- Button button = new Button(parent, SWT.PUSH);
-
- button.setText(label);
-
- GridData data = setButtonLayoutData(button);
- data.horizontalAlignment = GridData.FILL;
-
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- verticalButtonPressed(event.widget);
- }
- });
- button.setToolTipText(label);
- if (defaultButton) {
- Shell shell = parent.getShell();
- if (shell != null) {
- shell.setDefaultButton(button);
- }
- }
- button.setFont(parent.getFont());
- return button;
- }
-
- /**
- * Creates and returns the vertical button bar.
- *
- * @param parent the parent composite to contain the button bar
- * @return the button bar control
- */
- protected Control createVerticalButtonBar(Composite parent) {
- // Create composite.
- Composite composite = new Composite(parent, SWT.NULL);
-
- // create a layout with spacing and margins appropriate for the font size.
- GridLayout layout = new GridLayout();
- layout.numColumns = 1;
- layout.marginWidth = 5;
- layout.marginHeight = 0;
- layout.horizontalSpacing =
- convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.verticalSpacing =
- convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- composite.setLayout(layout);
- composite.setFont(parent.getFont());
-
- // Add the buttons to the button bar.
- setDefaultButton = createVerticalButton(composite, WorkbenchMessages.getString("PerspectivesPreference.MakeDefault"), false); //$NON-NLS-1$
- setDefaultButton.setToolTipText(WorkbenchMessages.getString("PerspectivesPreference.MakeDefaultTip")); //$NON-NLS-1$
-
- revertButton = createVerticalButton(composite, WorkbenchMessages.getString("PerspectivesPreference.Reset"), false); //$NON-NLS-1$
- revertButton.setToolTipText(WorkbenchMessages.getString("PerspectivesPreference.ResetTip")); //$NON-NLS-1$
-
- deleteButton = createVerticalButton(composite, WorkbenchMessages.getString("PerspectivesPreference.Delete"), false); //$NON-NLS-1$
- deleteButton.setToolTipText(WorkbenchMessages.getString("PerspectivesPreference.DeleteTip")); //$NON-NLS-1$
- updateButtons();
-
- return composite;
- }
-
- /**
- * @see IWorkbenchPreferencePage
- */
- public void init(IWorkbench aWorkbench) {
- this.workbench = aWorkbench;
- this.perspectiveRegistry = (PerspectiveRegistry) workbench.getPerspectiveRegistry();
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- switchOnNewProject = !IWorkbenchPreferenceConstants.NO_NEW_PERSPECTIVE.equals(
- store.getString(IWorkbenchPreferenceConstants.PROJECT_OPEN_NEW_PERSPECTIVE));
- openViewMode = store.getInt(IPreferenceConstants.OPEN_VIEW_MODE);
- openPerspMode = store.getInt(IPreferenceConstants.OPEN_PERSP_MODE);
- }
-
- /**
- * The default button has been pressed.
- */
- protected void performDefaults() {
- //Project perspective preferences
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- switchOnNewProject = !IWorkbenchPreferenceConstants.NO_NEW_PERSPECTIVE.equals(
- store.getDefaultString(IWorkbenchPreferenceConstants.PROJECT_OPEN_NEW_PERSPECTIVE));
- switchOnNewProjectButton.setSelection(switchOnNewProject);
-
- openViewMode = store.getDefaultInt(IPreferenceConstants.OPEN_VIEW_MODE);
- // Open view as float no longer supported
- if (openViewMode == IPreferenceConstants.OVM_FLOAT)
- openViewMode = IPreferenceConstants.OVM_FAST;
- openEmbedButton.setSelection(openViewMode == IPreferenceConstants.OVM_EMBED);
- openFastButton.setSelection(openViewMode == IPreferenceConstants.OVM_FAST);
-
- openPerspMode = store.getDefaultInt(IPreferenceConstants.OPEN_PERSP_MODE);
- openSameWindowButton.setSelection(IPreferenceConstants.OPM_ACTIVE_PAGE == openPerspMode);
- openNewWindowButton.setSelection(IPreferenceConstants.OPM_NEW_WINDOW == openPerspMode);
- }
- /*
- * Delete the perspectives selected by the user if there is not
- * opened instance of that perspective.
- */
-
- private boolean deletePerspectives() {
- IWorkbenchWindow windows[] = workbench.getWorkbenchWindows();
- for (int i = 0; i < windows.length; i++) {
- IWorkbenchPage pages[] = windows[i].getPages();
- for (int j = 0; j < pages.length; j++) {
- WorkbenchPage page = (WorkbenchPage)pages[j];
- for (int k = 0; k < perspToDelete.size(); k++) {
- IPerspectiveDescriptor desc = (IPerspectiveDescriptor)perspToDelete.get(k);
- if(page.findPerspective(desc) != null) {
- MessageDialog.openInformation(
- getShell(),
- WorkbenchMessages.getString("PerspectivesPreference.cannotdelete.title"), //$NON-NLS-1$
- WorkbenchMessages.format("PerspectivesPreference.cannotdelete.message", new String[]{desc.getLabel()})); //$NON-NLS-1$
- return false;
- }
- }
- }
- }
-
- // Delete the perspectives
- for (int i = 0; i < perspToDelete.size(); i++)
- perspectiveRegistry.deletePerspective(
- (IPerspectiveDescriptor) perspToDelete.get(i));
- return true;
- }
- /**
- * Apply the user's changes if any
- */
- public boolean performOk() {
- // Set the default perspective
- if (!defaultPerspectiveId
- .equals(perspectiveRegistry.getDefaultPerspective()))
- perspectiveRegistry.setDefaultPerspective(defaultPerspectiveId);
-
- if(!deletePerspectives())
- return false;
-
- // Revert the perspectives
- for (int i = 0; i < perspToRevert.size(); i++)
- ((PerspectiveDescriptor) perspToRevert.get(i)).revertToPredefined();
-
- // Update perspective history.
- ((Workbench) workbench).getPerspectiveHistory().refreshFromRegistry();
-
- // store the open new project perspective settings
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- String newProjectPerspectiveSetting;
- if(!switchOnNewProject)
- newProjectPerspectiveSetting = IWorkbenchPreferenceConstants.NO_NEW_PERSPECTIVE;
- else if(openPerspMode == IPreferenceConstants.OPM_NEW_WINDOW)
- newProjectPerspectiveSetting = IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_WINDOW;
- else
- newProjectPerspectiveSetting = IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE;
-
- store.setValue(
- IWorkbenchPreferenceConstants.PROJECT_OPEN_NEW_PERSPECTIVE,
- newProjectPerspectiveSetting);
-
- // store the open view mode setting
- store.setValue(IPreferenceConstants.OPEN_VIEW_MODE, openViewMode);
-
- // store the open perspective mode setting
- store.setValue(IPreferenceConstants.OPEN_PERSP_MODE, openPerspMode);
-
- WorkbenchPlugin.getDefault().savePluginPreferences();
- return true;
- }
-
- /**
- * Update the button enablement state.
- */
- protected void updateButtons() {
- // Get selection.
- int index = list.getSelectionIndex();
-
- // Map it to the perspective descriptor
- PerspectiveDescriptor desc = null;
- if (index > -1)
- desc = (PerspectiveDescriptor) perspectives.get(index);
-
- // Do enable.
- if (desc != null) {
- revertButton.setEnabled(
- desc.isPredefined()
- && desc.hasCustomFile()
- && !perspToRevert.contains(desc));
- deleteButton.setEnabled(!desc.isPredefined());
- setDefaultButton.setEnabled(true);
- } else {
- revertButton.setEnabled(false);
- deleteButton.setEnabled(false);
- setDefaultButton.setEnabled(false);
- }
- }
-
- /**
- * Update the list items.
- */
- protected void updateList() {
- list.removeAll();
- for (int i = 0; i < perspectives.size(); i++) {
- IPerspectiveDescriptor desc =
- (IPerspectiveDescriptor) perspectives.get(i);
- String label = desc.getLabel();
- if (desc.getId().equals(defaultPerspectiveId))
- label = WorkbenchMessages.format("PerspectivesPreference.defaultLabel", new Object[] { label }); //$NON-NLS-1$
- list.add(label, i);
- }
- }
-
- /**
- * Notifies that this page's button with the given id has been pressed.
- *
- * @param buttonId the id of the button that was pressed (see
- * <code>IDialogConstants.*_ID</code> constants)
- */
- protected void verticalButtonPressed(Widget button) {
- // Get selection.
- int index = list.getSelectionIndex();
-
- // Map it to the perspective descriptor
- PerspectiveDescriptor desc = null;
- if (index > -1)
- desc = (PerspectiveDescriptor) perspectives.get(index);
- else
- return;
-
- // Take action.
- if (button == revertButton) {
- if (desc.isPredefined() && !perspToRevert.contains(desc)) {
- perspToRevert.add(desc);
- }
- } else if (button == deleteButton) {
- if (!desc.isPredefined() && !perspToDelete.contains(desc)) {
- perspToDelete.add(desc);
- perspToRevert.remove(desc);
- perspectives.remove(desc);
- updateList();
- }
- } else if (button == setDefaultButton) {
- defaultPerspectiveId = desc.getId();
- updateList();
- list.setSelection(index);
- }
-
- updateButtons();
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceErrorDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceErrorDialog.java
deleted file mode 100644
index 2b6e087..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PreferenceErrorDialog.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * A dialog to show an error while giving the user the option to continue.
- */
-public class PreferenceErrorDialog extends ErrorDialog {
- private Button detailsButton;
- private IStatus status;
- /**
- * Create a new instance of the dialog
- */
- public PreferenceErrorDialog(
- Shell parentShell,
- String dialogTitle,
- String message,
- IStatus status,
- int displayMask) {
- super(parentShell, dialogTitle, message, status, displayMask);
- this.status = status;
- }
- /**
- * Opens an error dialog to display the given error.
- */
- public static int openError(Shell parentShell, String title, String message, IStatus status) {
- int displayMask = IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR;
- ErrorDialog dialog = new PreferenceErrorDialog(parentShell, title, message, status, displayMask);
- return dialog.open();
- }
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void buttonPressed(int buttonId) {
- if (IDialogConstants.YES_ID == buttonId)
- okPressed();
- else if (IDialogConstants.NO_ID == buttonId)
- cancelPressed();
- else
- super.buttonPressed(buttonId);
- }
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- // create Yes, No, and Details buttons
- createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
- createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);
- super.createButtonsForButtonBar(parent);
- // get rid of the unwanted ok button
- Button okButton = getButton(IDialogConstants.OK_ID);
- if (okButton != null && !okButton.isDisposed()) {
- okButton.dispose();
- ((GridLayout)parent.getLayout()).numColumns--;
- }
- }
- /* (non-Javadoc)
- * Method declared on ErrorDialog.
- */
- protected Image getImage() {
- return JFaceResources.getImageRegistry().get(DLG_IMG_WARNING);
- }
-}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProductInfoDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProductInfoDialog.java
deleted file mode 100644
index 9821456..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProductInfoDialog.java
+++ /dev/null
@@ -1,373 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.io.IOException;
-import java.util.ArrayList;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseMoveListener;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Cursor;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.program.Program;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.internal.AboutItem;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Abstract superclass of about dialogs
- */
-
-public abstract class ProductInfoDialog extends Dialog{
- private static final String ATT_HTTP = "http://"; //$NON-NLS-1$
- private AboutItem item;
- private boolean webBrowserOpened;
- private Cursor handCursor;
- private Cursor busyCursor;
- private boolean mouseDown = false;
- private boolean dragEvent = false;
-
-/**
- * Create an instance of this Dialog
- */
-public ProductInfoDialog(Shell parentShell) {
- super(parentShell);
-}
-
-/**
- * Adds listeners to the given styled text
- */
-protected void addListeners(StyledText styledText) {
- styledText.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- if (e.button != 1) {
- return;
- }
- mouseDown = true;
- }
- public void mouseUp(MouseEvent e) {
- mouseDown = false;
- StyledText text = (StyledText)e.widget;
- int offset = text.getCaretOffset();
- if (dragEvent) {
- // don't activate a link during a drag/mouse up operation
- dragEvent = false;
- if (item != null && item.isLinkAt(offset)) {
- text.setCursor(handCursor);
- }
- } else if (item != null && item.isLinkAt(offset)) {
- text.setCursor(busyCursor);
- openLink(item.getLinkAt(offset));
- StyleRange selectionRange = getCurrentRange(text);
- text.setSelectionRange(selectionRange.start, selectionRange.length);
- text.setCursor(null);
- }
- }
- });
-
- styledText.addMouseMoveListener(new MouseMoveListener() {
- public void mouseMove(MouseEvent e) {
- // Do not change cursor on drag events
- if (mouseDown) {
- if (!dragEvent) {
- StyledText text = (StyledText)e.widget;
- text.setCursor(null);
- }
- dragEvent = true;
- return;
- }
- StyledText text = (StyledText)e.widget;
- int offset = -1;
- try {
- offset = text.getOffsetAtLocation(new Point(e.x, e.y));
- } catch (IllegalArgumentException ex) {
- // leave value as -1
- }
- if (offset == -1)
- text.setCursor(null);
- else if (item != null && item.isLinkAt(offset))
- text.setCursor(handCursor);
- else
- text.setCursor(null);
- }
- });
-
- styledText.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- StyledText text = (StyledText)e.widget;
- 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 = text.getSelection();
- int charCount = text.getCharCount();
- if ((nextSelection.x == charCount) && (nextSelection.y == charCount)){
- text.setSelection(0);
- }
- StyleRange nextRange = findNextRange(text);
- if (nextRange == null) {
- // Next time in start at beginning, also used by
- // TRAVERSE_TAB_PREVIOUS to indicate we traversed out
- // in the forward direction
- text.setSelection(0);
- e.doit = true;
- } else {
- text.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 = text.getSelection();
- if ((previousSelection.x == 0) && (previousSelection.y == 0))
- text.setSelection(text.getCharCount());
- StyleRange previousRange = findPreviousRange(text);
- 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
- text.setSelection(text.getCharCount());
- e.doit = true;
- }
- else {
- text.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() {
- 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);
- openLink(item.getLinkAt(offset));
- StyleRange selectionRange = getCurrentRange(text);
- text.setSelectionRange(selectionRange.start, selectionRange.length);
- text.setCursor(null);
- }
- }
- return;
- }
- }
- });
-}
-
-/**
- * Gets the busy cursor.
- * @return the busy cursor
- */
-protected Cursor getBusyCursor() {
- return busyCursor;
-}
-
-/**
- * Sets the busy cursor.
- * @param busyCursor the busy cursor
- */
-protected void setBusyCursor(Cursor busyCursor) {
- this.busyCursor = busyCursor;
-}
-
-/**
- * Gets the hand cursor.
- * @return Returns a hand cursor
- */
-protected Cursor getHandCursor() {
- return handCursor;
-}
-
-/**
- * Sets the hand cursor.
- * @param handCursor The hand cursor to set
- */
-protected void setHandCursor(Cursor handCursor) {
- this.handCursor = handCursor;
-}
-
-/**
- * Gets the about item.
- * @return the about item
- */
-protected AboutItem getItem() {
- return item;
-}
-
-/**
- * Sets the about item.
- * @param item about item
- */
-protected void setItem(AboutItem item) {
- this.item = item;
-}
-
-/**
- * Find the range of the current selection.
- */
-protected StyleRange getCurrentRange(StyledText text){
- StyleRange[] ranges = text.getStyleRanges();
- int currentSelectionEnd = text.getSelection().y;
- int currentSelectionStart = text.getSelection().x;
-
- for (int i = 0; i < ranges.length; i++) {
- if((currentSelectionStart >= ranges[i].start) &&
- (currentSelectionEnd <= (ranges[i].start + ranges[i].length))) {
- return ranges[i];
- }
- }
- return null;
-}
-
-/**
- * Find the next range after the current
- * selection.
- */
-protected StyleRange findNextRange(StyledText text){
- StyleRange[] ranges = text.getStyleRanges();
- int currentSelectionEnd = text.getSelection().y;
-
- for (int i = 0; i < ranges.length; i++) {
- if(ranges[i].start >= currentSelectionEnd)
- return ranges[i];
- }
- return null;
-}
-
-/**
- * Find the previous range before the current selection.
- */
-protected StyleRange findPreviousRange(StyledText text){
- StyleRange[] ranges = text.getStyleRanges();
- int currentSelectionStart = text.getSelection().x;
-
- for (int i = ranges.length - 1; i > -1; i--) {
- if((ranges[i].start + ranges[i].length) <= currentSelectionStart)
- return ranges[i];
- }
- return null;
-}
-
-/**
- * Open a link
- */
-protected void openLink(final String href) {
- final Display d = Display.getCurrent();
- if (SWT.getPlatform().equals("win32")) { //$NON-NLS-1$
- Program.launch(href);
- } else {
- Thread launcher = new Thread("About Link Launcher") {//$NON-NLS-1$
- public void run() {
- try {
- if (webBrowserOpened) {
- Runtime.getRuntime().exec("netscape -remote openURL(" + href + ")"); //$NON-NLS-1$ //$NON-NLS-2$
- } else {
- Process p = Runtime.getRuntime().exec("netscape " + href); //$NON-NLS-1$
- webBrowserOpened = true;
- try {
- if (p != null)
- p.waitFor();
- } catch (InterruptedException e) {
- d.asyncExec(new Runnable() {
- public void run() {
- MessageDialog.openError(getShell(), WorkbenchMessages.getString("ProductInfoDialog.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("ProductInfoDialog.unableToOpenWebBrowser"));
- }
- });
- } finally {
- webBrowserOpened = false;
- }
- }
- } catch (IOException e) {
- d.asyncExec(new Runnable() {
- public void run() {
- MessageDialog.openError(getShell(), WorkbenchMessages.getString("ProductInfoDialog.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("ProductInfoDialog.unableToOpenWebBrowser"));
- }
- });
- }
- }
- };
- launcher.start();
- }
-}
-
-/**
- * Sets the styled text's bold ranges
- */
-protected void setBoldRanges(StyledText styledText, int[][] boldRanges) {
- for (int i = 0; i < boldRanges.length; i++) {
- StyleRange r = new StyleRange(boldRanges[i][0], boldRanges[i][1], null, null, SWT.BOLD);
- styledText.setStyleRange(r);
- }
-}
-
-/**
- * Sets the styled text's link (blue) ranges
- */
-protected void setLinkRanges(StyledText styledText, int[][] linkRanges) {
- Color fg = JFaceColors.getHyperlinkText(styledText.getShell().getDisplay());
- for (int i = 0; i < linkRanges.length; i++) {
- StyleRange r = new StyleRange(linkRanges[i][0], linkRanges[i][1], fg, null);
- styledText.setStyleRange(r);
- }
-}
-
-/**
- * Scan the contents of the about text
- */
-protected AboutItem scan(String s) {
- int max = s.length();
- int i = s.indexOf(ATT_HTTP);
- ArrayList linkRanges = new ArrayList();
- ArrayList links = new ArrayList();
- while (i != -1) {
- int start = i;
- // look for the first whitespace character
- boolean found = false;
- i += ATT_HTTP.length();
- while (!found && i < max) {
- found = Character.isWhitespace(s.charAt(i++));
- }
- linkRanges.add(new int[] {start, i - start});
- links.add(s.substring(start, i));
- i = s.indexOf(ATT_HTTP, i);
- }
- return new AboutItem(
- s,
- (int[][])linkRanges.toArray(new int[linkRanges.size()][2]),
- (String[])links.toArray(new String[links.size()]));
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilityEditingPropertyPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilityEditingPropertyPage.java
deleted file mode 100644
index 6963eb2..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilityEditingPropertyPage.java
+++ /dev/null
@@ -1,348 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.ICapabilityUninstallWizard;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.registry.Capability;
-import org.eclipse.ui.internal.registry.CapabilityRegistry;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-
-/**
- * A property page for IProject resources to edit a single
- * capability at a time.
- */
-public class ProjectCapabilityEditingPropertyPage extends ProjectCapabilityPropertyPage {
- private static final int SIZING_WIZARD_WIDTH = 500;
- private static final int SIZING_WIZARD_HEIGHT = 500;
-
- private TableViewer table;
- private Button addButton;
- private Button removeButton;
- private ArrayList disabledCaps = new ArrayList();
- private Capability selectedCap;
- private CapabilityRegistry reg;
-
- /**
- * Creates a new ProjectCapabilityEditingPropertyPage.
- */
- public ProjectCapabilityEditingPropertyPage() {
- super();
- }
-
- /* (non-Javadoc)
- * Method declared on PreferencePage
- */
- protected Control createContents(Composite parent) {
- WorkbenchHelp.setHelp(parent, IHelpContextIds.PROJECT_CAPABILITY_PROPERTY_PAGE);
- noDefaultAndApplyButton();
- reg = WorkbenchPlugin.getDefault().getCapabilityRegistry();
-
- Composite topComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- topComposite.setLayout(layout);
- topComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- String instructions;
- if (reg.hasCapabilities())
- instructions = WorkbenchMessages.getString("ProjectCapabilityPropertyPage.chooseCapabilities"); //$NON-NLS-1$
- else
- instructions = WorkbenchMessages.getString("ProjectCapabilityPropertyPage.noCapabilities"); //$NON-NLS-1$
- Label label = new Label(topComposite, SWT.LEFT);
- label.setText(instructions);
-
- Capability[] caps = reg.getProjectDisabledCapabilities(getProject());
- disabledCaps.addAll(Arrays.asList(caps));
-
- Composite mainComposite = new Composite(topComposite, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- mainComposite.setLayout(layout);
- mainComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Composite capComposite = new Composite(mainComposite, SWT.NONE);
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- capComposite.setLayout(layout);
- capComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- label = new Label(capComposite, SWT.LEFT);
- label.setText(WorkbenchMessages.getString("ProjectCapabilitySelectionGroup.capabilities")); //$NON-NLS-1$
-
- table = new TableViewer(capComposite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- table.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
- table.setLabelProvider(new CapabilityLabelProvider());
- table.setContentProvider(getContentProvider());
- table.setInput(getProject());
-
- Composite buttonComposite = new Composite(mainComposite, SWT.NONE);
- layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- buttonComposite.setLayout(layout);
- buttonComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
-
- label = new Label(buttonComposite, SWT.LEFT);
- label.setText(""); //$NON-NLS-1$
-
- addButton = new Button(buttonComposite, SWT.PUSH);
- addButton.setText(WorkbenchMessages.getString("ProjectCapabilityEditingPropertyPage.add")); //$NON-NLS-1$
- addButton.setEnabled(true);
- addButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- addCapability();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, addButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- addButton.setLayoutData(data);
-
- removeButton = new Button(buttonComposite, SWT.PUSH);
- removeButton.setText(WorkbenchMessages.getString("ProjectCapabilityEditingPropertyPage.remove")); //$NON-NLS-1$
- removeButton.setEnabled(false);
- removeButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- removeCapability(selectedCap);
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.heightHint = convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.widthHint = Math.max(widthHint, removeButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- removeButton.setLayoutData(data);
-
- table.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- selectedCap = null;
- IStructuredSelection sel = (IStructuredSelection)event.getSelection();
- if (sel != null)
- selectedCap = (Capability)sel.getFirstElement();
- removeButton.setEnabled(selectedCap != null);
- }
- });
-
- return topComposite;
- }
-
- /**
- * Returns the content provider for the viewers
- */
- private IContentProvider getContentProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof IProject)
- return reg.getProjectCapabilities((IProject)parentElement);
- else
- return null;
- }
- };
- }
-
- /**
- * Returns whether the category is considered disabled
- */
- private boolean isDisabledCapability(Capability cap) {
- return disabledCaps.contains(cap);
- }
-
- private void addCapability() {
- ProjectCapabilitySimpleAddWizard wizard;
- wizard = new ProjectCapabilitySimpleAddWizard(PlatformUI.getWorkbench(), StructuredSelection.EMPTY, getProject());
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT );
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.UPDATE_CAPABILITY_WIZARD);
- dialog.open();
-
- table.refresh();
- }
-
- private void removeCapability(Capability cap) {
- ArrayList results = new ArrayList();
- results.addAll(Arrays.asList(reg.getProjectCapabilities(getProject())));
- results.remove(cap);
- Capability[] caps = new Capability[results.size()];
- results.toArray(caps);
-
- for (int i = 0; i < caps.length; i++) {
- List prereqs = Arrays.asList(reg.getPrerequisiteIds(caps[i]));
- if (prereqs.contains(cap.getId())) {
- MessageDialog.openWarning(
- getShell(),
- WorkbenchMessages.getString("ProjectCapabilityPropertyPage.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("ProjectCapabilityPropertyPage.capabilityRequired", new Object[] {caps[i].getName()})); //$NON-NLS-1$
- return;
- }
- }
-
- IStatus status = reg.validateCapabilities(caps);
- if (!status.isOK()) {
- ErrorDialog.openError(
- getShell(),
- WorkbenchMessages.getString("ProjectCapabilityPropertyPage.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("ProjectCapabilityPropertyPage.invalidSelection"), //$NON-NLS-1$
- status);
- return;
- }
-
- String[] natureIds = new String[1];
- natureIds[0] = cap.getNatureId();
-
- ICapabilityUninstallWizard wizard = cap.getUninstallWizard();
- if (wizard == null)
- wizard = new RemoveCapabilityWizard();
- if (wizard != null) {
- wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY, getProject(), natureIds);
- wizard.addPages();
- }
-
- if (wizard.getStartingPage() == null) {
- wizard.setContainer(new StubContainer());
- wizard.performFinish();
- wizard.setContainer(null);
- } else {
- wizard = cap.getUninstallWizard();
- if (wizard == null)
- wizard = new RemoveCapabilityWizard();
- if (wizard != null)
- wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY, getProject(), natureIds);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT );
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.UPDATE_CAPABILITY_WIZARD);
- dialog.open();
- }
-
- table.refresh();
- }
-
- /* (non-Javadoc)
- * Method declared on PreferencePage
- */
- public boolean performOk() {
- return true;
- }
-
-
- class CapabilityLabelProvider extends LabelProvider {
- private Map imageTable;
-
- public void dispose() {
- if (imageTable != null) {
- Iterator enum = imageTable.values().iterator();
- while (enum.hasNext())
- ((Image) enum.next()).dispose();
- imageTable = null;
- }
- }
-
- public Image getImage(Object element) {
- ImageDescriptor descriptor = ((Capability) element).getIconDescriptor();
- if (descriptor == null)
- return null;
-
- //obtain the cached image corresponding to the descriptor
- if (imageTable == null) {
- imageTable = new Hashtable(40);
- }
- Image image = (Image) imageTable.get(descriptor);
- if (image == null) {
- image = descriptor.createImage();
- imageTable.put(descriptor, image);
- }
- return image;
- }
-
- public String getText(Object element) {
- Capability cap = (Capability) element;
- String text = cap.getName();
- if (isDisabledCapability(cap))
- text = WorkbenchMessages.format("ProjectCapabilitySelectionGroup.disabledLabel", new Object[] {text}); //$NON-NLS-1$
- return text;
- }
- }
-
- class StubContainer implements IWizardContainer {
- public IWizardPage getCurrentPage() {
- return null;
- }
- public Shell getShell() {
- return ProjectCapabilityEditingPropertyPage.this.getShell();
- }
- public void showPage(IWizardPage page) {
- }
- public void updateButtons() {
- }
- public void updateMessage() {
- }
- public void updateTitleBar() {
- }
- public void updateWindowTitle() {
- }
- public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- new ProgressMonitorDialog(getShell()).run(fork, cancelable, runnable);
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilityPropertyPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilityPropertyPage.java
deleted file mode 100644
index 03cf81f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilityPropertyPage.java
+++ /dev/null
@@ -1,186 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.misc.ProjectCapabilitySelectionGroup;
-import org.eclipse.ui.internal.registry.Capability;
-import org.eclipse.ui.internal.registry.CapabilityRegistry;
-import org.eclipse.ui.internal.registry.ICategory;
-
-/**
- * A property page for IProject resources to view and edit the
- * capabilities assigned to the project.
- */
-public class ProjectCapabilityPropertyPage extends PropertyPage {
- /**
- * 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 IProject project;
- private ProjectCapabilitySelectionGroup capabilityGroup;
-
- /**
- * Creates a new ProjectCapabilityPropertyPage.
- */
- public ProjectCapabilityPropertyPage() {
- super();
- }
-
- /* (non-Javadoc)
- * Method declared on PreferencePage
- */
- protected Control createContents(Composite parent) {
- WorkbenchHelp.setHelp(parent, IHelpContextIds.PROJECT_CAPABILITY_PROPERTY_PAGE);
- noDefaultAndApplyButton();
- CapabilityRegistry reg = WorkbenchPlugin.getDefault().getCapabilityRegistry();
-
- String instructions;
- if (reg.hasCapabilities())
- instructions = WorkbenchMessages.getString("ProjectCapabilityPropertyPage.chooseCapabilities"); //$NON-NLS-1$
- else
- instructions = WorkbenchMessages.getString("ProjectCapabilityPropertyPage.noCapabilities"); //$NON-NLS-1$
- Label label = new Label(parent, SWT.LEFT);
- label.setText(instructions);
-
- Capability[] caps = reg.getProjectCapabilities(getProject());
- Capability[] disabledCaps = reg.getProjectDisabledCapabilities(getProject());
- ICategory[] cats = new ICategory[0];
- capabilityGroup = new ProjectCapabilitySelectionGroup(cats, caps, disabledCaps, reg);
- return capabilityGroup.createContents(parent);
- }
-
- /**
- * Returns the project which this property page applies to
- *
- * @return IProject the project for this property page
- */
- /* package */ IProject getProject() {
- if (project == null)
- project = (IProject) getElement().getAdapter(IResource.class);
-
- return project;
- }
-
- /* (non-Javadoc)
- * Method declared on PreferencePage
- */
- public boolean performOk() {
- // Avoid doing any work if no changes were made.
- if (!capabilityGroup.getCapabilitiesModified())
- return true;
-
- // Validate the requested changes are ok
- CapabilityRegistry reg = WorkbenchPlugin.getDefault().getCapabilityRegistry();
- Capability[] caps = capabilityGroup.getSelectedCapabilities();
- IStatus status = reg.validateCapabilities(caps);
- if (!status.isOK()) {
- ErrorDialog.openError(
- getShell(),
- WorkbenchMessages.getString("ProjectCapabilityPropertyPage.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("ProjectCapabilityPropertyPage.invalidSelection"), //$NON-NLS-1$
- status);
- return true;
- }
-
- // Get the current set of nature ids on the project
- String[] natureIds;
- try {
- natureIds = getProject().getDescription().getNatureIds();
- natureIds = getProject().getWorkspace().sortNatureSet(natureIds);
- } catch (CoreException e) {
- ErrorDialog.openError(
- getShell(),
- WorkbenchMessages.getString("ProjectCapabilityPropertyPage.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("ProjectCapabilityPropertyPage.internalError"), //$NON-NLS-1$
- e.getStatus());
- return true;
- }
-
- // Keep only the nature ids whose capability is selected
- ArrayList keepIds = new ArrayList();
- ArrayList removeCaps = new ArrayList();
- for (int i = 0; i < natureIds.length; i++) {
- boolean isRemoved = true;
- String id = natureIds[i];
- for (int j = 0; j < caps.length; j++) {
- if (id.equals(caps[j].getNatureId())) {
- keepIds.add(id);
- isRemoved = false;
- break;
- }
- }
- if (isRemoved)
- removeCaps.add(reg.getCapabilityForNature(id));
- }
-
- // Collect the capabilities to add
- ArrayList newCaps = new ArrayList();
- for (int i = 0; i < caps.length; i++) {
- boolean isNew = true;
- Capability cap = caps[i];
- for (int j = 0; j < natureIds.length; j++) {
- if (natureIds[j].equals(cap.getNatureId())) {
- isNew = false;
- break;
- }
- }
- if (isNew)
- newCaps.add(cap);
- }
-
- // Launch the step wizard if needed
- if (newCaps.size() > 0 || removeCaps.size() > 0) {
- Capability[] newCapabilities = new Capability[newCaps.size()];
- newCaps.toArray(newCapabilities);
-
- Capability[] removeCapabilities = new Capability[removeCaps.size()];
- removeCaps.toArray(removeCapabilities);
-
- UpdateProjectCapabilityWizard wizard =
- new UpdateProjectCapabilityWizard(getProject(), newCapabilities, removeCapabilities);
-
- MultiStepWizardDialog dialog = new MultiStepWizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT );
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.UPDATE_CAPABILITY_WIZARD);
- dialog.open();
- }
-
- return true;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilitySimpleAddWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilitySimpleAddWizard.java
deleted file mode 100644
index 9e15ca1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilitySimpleAddWizard.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-public class ProjectCapabilitySimpleAddWizard extends Wizard {
- private ProjectCapabilitySimpleSelectionPage mainPage;
- private IWorkbench workbench;
- private IStructuredSelection selection;
- private IProject project;
-
- public ProjectCapabilitySimpleAddWizard(IWorkbench workbench, IStructuredSelection selection, IProject project) {
- super();
- this.workbench = workbench;
- this.selection = selection;
- this.project = project;
- setForcePreviousAndNextButtons(true);
- setNeedsProgressMonitor(true);
- initializeDefaultPageImageDescriptor();
- setWindowTitle(WorkbenchMessages.getString("ProjectCapabilitySimpleSelectionPage.windowTitle")); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard
- */
- public void addPages() {
- mainPage =
- new ProjectCapabilitySimpleSelectionPage(
- "projectCapabilitySimpleSelectionPage", //$NON-NLS-1$
- workbench,
- selection,
- project);
- mainPage.setTitle(WorkbenchMessages.getString("ProjectCapabilitySimpleSelectionPage.title")); //$NON-NLS-1$
- mainPage.setDescription(WorkbenchMessages.getString("ProjectCapabilitySimpleSelectionPage.description")); //$NON-NLS-1$
- addPage(mainPage);
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean canFinish() {
- return false;
- }
-
- /**
- * Sets the image banner for the wizard
- */
- protected void initializeDefaultPageImageDescriptor() {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- URL installURL = WorkbenchPlugin.getDefault().getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + "wizban/newprj_wiz.gif");//$NON-NLS-1$
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- setDefaultPageImageDescriptor(desc);
- }
- catch (MalformedURLException e) {
- // Should not happen. Ignore.
- }
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard
- */
- public boolean performFinish() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilitySimpleSelectionPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilitySimpleSelectionPage.java
deleted file mode 100644
index 0940686..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectCapabilitySimpleSelectionPage.java
+++ /dev/null
@@ -1,220 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.ICapabilityInstallWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.registry.Capability;
-import org.eclipse.ui.internal.registry.CapabilityRegistry;
-import org.eclipse.ui.internal.registry.ICategory;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-public class ProjectCapabilitySimpleSelectionPage extends WizardPage {
- private IWorkbench workbench;
- private IStructuredSelection selection;
- private IProject project;
- private TreeViewer viewer;
- private CapabilityRegistry reg;
- private Capability chosenCapability;
- private HashMap mapCapToWizard = new HashMap();
-
- /**
- * Creates an instance of this page.
- */
- public ProjectCapabilitySimpleSelectionPage(String pageName, IWorkbench workbench, IStructuredSelection selection, IProject project) {
- super(pageName);
- this.workbench = workbench;
- this.selection = selection;
- this.project = project;
- this.reg = WorkbenchPlugin.getDefault().getCapabilityRegistry();
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardPage
- */
- public boolean canFlipToNextPage() {
- return isPageComplete();
- }
-
- /* (non-Javadoc)
- * Method declared on IDialogPage
- */
- public void createControl(Composite parent) {
- Composite topContainer = new Composite(parent, SWT.NONE);
- topContainer.setLayout(new GridLayout());
- topContainer.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label label = new Label(topContainer, SWT.LEFT);
- label.setText(WorkbenchMessages.getString("ProjectCapabilitySelectionGroup.capabilities")); //$NON-NLS-1$
- GridData data = new GridData();
- data.verticalAlignment = SWT.TOP;
- label.setLayoutData(data);
-
- viewer = new TreeViewer(topContainer, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- viewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.setContentProvider(getContentProvider());
- viewer.setInput(reg);
-
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- chosenCapability = null;
- if (event.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- if (sel != null && !sel.isEmpty()) {
- Object result = sel.getFirstElement();
- if (result instanceof Capability) {
- chosenCapability = (Capability) result;
- }
- }
- }
-
- setPageComplete(validateChosenCapability());
- }
- });
-
- setControl(topContainer);
- }
-
- /**
- * Returns the content provider for the viewer
- */
- private IContentProvider getContentProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof CapabilityRegistry) {
- ArrayList cats = reg.getUsedCategories();
- if (reg.getMiscCategory() != null)
- cats.add(reg.getMiscCategory());
- return cats.toArray();
- }
- if (parentElement instanceof ICategory)
- return ((ICategory)parentElement).getChildren(parentElement);
- return null;
- }
-
- public boolean hasChildren(Object element) {
- if (element instanceof CapabilityRegistry)
- return true;
- if (element instanceof ICategory)
- return ((ICategory)element).hasElements();
- return false;
- }
- };
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardPage.
- */
- public IWizardPage getNextPage() {
- if (chosenCapability == null)
- return null;
-
- final IWizard[] wizard = new IWizard[1];
- wizard[0] = (IWizard)mapCapToWizard.get(chosenCapability);
- if (wizard[0] == null) {
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- ICapabilityInstallWizard wiz;
- wiz = chosenCapability.getInstallWizard();
- if (wiz != null) {
- wiz.init(workbench, selection, project);
- wiz.addPages();
- mapCapToWizard.put(chosenCapability, wiz);
- wizard[0] = wiz;
- }
- }
- });
- }
-
- if (wizard[0] == null)
- return null;
-
- IWizardPage page = wizard[0].getStartingPage();
- wizard[0] = null;
- return page;
- }
-
- private boolean validateChosenCapability() {
- if (chosenCapability == null) {
- setErrorMessage(null);
- return false;
- }
-
- Capability[] caps = reg.getProjectCapabilities(project);
- List existingCaps = Arrays.asList(caps);
- if (existingCaps.contains(chosenCapability)) {
- setErrorMessage(WorkbenchMessages.getString("ProjectCapabilitySimpleSelectionPage.capabilityExist")); //$NON-NLS-1$
- return false;
- }
-
- String[] ids = reg.getPrerequisiteIds(chosenCapability);
- Capability[] prereqs = reg.findCapabilities(ids);
- for (int i = 0; i < prereqs.length; i++) {
- if (prereqs[i] == null) {
- setErrorMessage(WorkbenchMessages.format("ProjectCapabilitySimpleSelectionPage.capabilityMissing", new Object[] {ids[i]})); //$NON-NLS-1$
- return false;
- }
- if (!existingCaps.contains(prereqs[i])) {
- setErrorMessage(WorkbenchMessages.format("ProjectCapabilitySimpleSelectionPage.capabilityRequired", new Object[] {prereqs[i].getName()})); //$NON-NLS-1$
- return false;
- }
- }
-
- ids = reg.getMembershipSetIds(chosenCapability);
- List idsList = Arrays.asList(ids);
- for (int i = 0; i < caps.length; i++) {
- String[] setIds = reg.getMembershipSetIds(caps[i]);
- for (int j = 0; j < setIds.length; j++) {
- if (idsList.contains(setIds[j])) {
- setErrorMessage(WorkbenchMessages.format("ProjectCapabilitySimpleSelectionPage.capabilitySet", new Object[] {caps[i].getName()})); //$NON-NLS-1$
- return false;
- }
- }
- }
-
- Capability[] newCaps = new Capability[caps.length + 1];
- System.arraycopy(caps, 0, newCaps, 0, caps.length);
- newCaps[caps.length] = chosenCapability;
- IStatus status = reg.validateCapabilities(newCaps);
- if (!status.isOK()) {
- setErrorMessage(status.getMessage());
- return false;
- }
-
- setErrorMessage(null);
- return true;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectPerspectiveChoiceDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectPerspectiveChoiceDialog.java
deleted file mode 100644
index 6fab597..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectPerspectiveChoiceDialog.java
+++ /dev/null
@@ -1,279 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveRegistry;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-public class ProjectPerspectiveChoiceDialog extends Dialog {
- private static final int MIN_DIALOG_WIDTH = 200;
- private static final int MIN_DIALOG_HEIGHT = 250;
-
- private IWorkbenchWindow window;
- private ArrayList persps;
- private IPerspectiveDescriptor chosenPersp;
- private boolean sameWindow = true;
-
- private TableViewer list;
-
- private Comparator comparator = new Comparator() {
- private Collator collator = Collator.getInstance();
-
- public int compare(Object ob1, Object ob2) {
- IPerspectiveDescriptor d1 = (IPerspectiveDescriptor) ob1;
- IPerspectiveDescriptor d2 = (IPerspectiveDescriptor) ob2;
- return collator.compare(d1.getLabel(), d2.getLabel());
- }
- };
-
- /**
- * Create a ProjectPerspectiveChoiceDialog
- * @param window the workbench window launching this dialog
- * @param perspIds the list of ids the user can choose from
- */
- public ProjectPerspectiveChoiceDialog(IWorkbenchWindow window, String[] perspIds) {
- super(window.getShell());
- this.window = window;
-
- IWorkbenchPage page = window.getActivePage();
- if (page != null)
- chosenPersp = page.getPerspective();
-
- IPerspectiveRegistry reg = window.getWorkbench().getPerspectiveRegistry();
- persps = new ArrayList(perspIds.length);
- for (int i = 0; i < perspIds.length; i++) {
- IPerspectiveDescriptor desc;
- desc = reg.findPerspectiveWithId(perspIds[i]);
- if (desc != null && desc != chosenPersp)
- persps.add(desc);
- }
- Collections.sort(persps, comparator);
-
- if (chosenPersp != null)
- persps.add(0,chosenPersp);
- }
-
- /* (non-Javadoc)
- * Method declared in Window.
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(WorkbenchMessages.getString("ProjectPerspectiveChoiceDialog.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(shell, IHelpContextIds.SHOW_PROJECT_PERSPECTIVE_DIALOG);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- // page group
- Composite composite = (Composite) super.createDialogArea(parent);
-
- composite.setLayout(new GridLayout());
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = MIN_DIALOG_WIDTH;
- data.heightHint = MIN_DIALOG_HEIGHT;
- composite.setLayoutData(data);
-
- createPerspectiveGroup(composite);
- createOptionGroup(composite);
-
- if (chosenPersp != null)
- list.setSelection(new StructuredSelection(chosenPersp));
-
- return composite;
- }
-
- /**
- * Creates the perspective choice controls.
- *
- * @param parent the parent composite
- */
- private void createPerspectiveGroup(Composite parent) {
-
- // Label for choosing perspective
- Label label = new Label(parent, SWT.NONE);
- label.setText(WorkbenchMessages.getString("ProjectPerspectiveChoiceDialog.choosePerspective")); //$NON-NLS-1$
-
- // Add perspective list.
- list = new TableViewer(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- list.setLabelProvider(new PerspLabelProvider(false));
- list.setContentProvider(new PerspectiveContentProvider());
- list.setInput(persps);
- list.addSelectionChangedListener(new SelectionListener());
- list.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
- }
-
- /**
- * Creates the option controls.
- *
- * @param parent the parent composite
- */
- private void createOptionGroup(Composite parent) {
-
- // Create the option group
- Group optionGroup = new Group(parent, SWT.LEFT);
- GridLayout layout = new GridLayout();
- optionGroup.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- optionGroup.setLayoutData(data);
- optionGroup.setText(WorkbenchMessages.getString("ProjectPerspectiveChoiceDialog.options")); //$NON-NLS-1$
-
- // Same window option
- Button button = new Button(optionGroup, SWT.RADIO | SWT.LEFT);
- button.setText(WorkbenchMessages.getString("ProjectPerspectiveChoiceDialog.sameWindow")); //$NON-NLS-1$
- data = new GridData();
- button.setLayoutData(data);
- button.setSelection(sameWindow);
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- sameWindow = true;
- }
- });
-
- // New window option
- button = new Button(optionGroup, SWT.RADIO | SWT.LEFT);
- button.setText(WorkbenchMessages.getString("ProjectPerspectiveChoiceDialog.newWindow")); //$NON-NLS-1$
- data = new GridData();
- button.setLayoutData(data);
- button.setSelection(!sameWindow);
- button.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- sameWindow = false;
- }
- });
- }
-
- /**
- * Shows the choosen perspective in the same or
- * new window depending on the option checked.
- * Returns the workbench window the perspective
- * was shown in.
- */
- public IWorkbenchWindow showChosenPerspective() {
- if (chosenPersp == null)
- return window;
-
- final IWorkbenchWindow[] results = new IWorkbenchWindow[1];
- final WorkbenchException[] errors = new WorkbenchException[1];
- BusyIndicator.showWhile(window.getShell().getDisplay(), new Runnable() {
- public void run() {
- if (sameWindow) {
- results[0] = window;
- IWorkbenchPage page = window.getActivePage();
- if (page != null)
- page.setPerspective(chosenPersp);
- } else {
- try {
- results[0] = window.getWorkbench().openWorkbenchWindow(
- chosenPersp.getId(),
- ResourcesPlugin.getWorkspace().getRoot());
- } catch (WorkbenchException e) {
- errors[0] = e;
- }
- }
- }
- });
-
- IWorkbenchWindow result = results[0];
- results[0] = null;
-
- if (errors[0] != null) {
- ErrorDialog.openError(
- window.getShell(),
- WorkbenchMessages.getString("ProjectPerspectiveChoiceDialog.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("ProjectPerspectiveChoiceDialog.errorMessage"), //$NON-NLS-1$
- errors[0].getStatus());
- errors[0] = null;
- return window;
- }
-
- return result;
- }
-
- class PerspectiveContentProvider implements IStructuredContentProvider {
- public PerspectiveContentProvider() {
- super();
- }
-
- public void dispose() {
- }
-
- public Object[] getElements(Object element) {
- if (element instanceof ArrayList) {
- return ((ArrayList)element).toArray();
- }
- return null;
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- public boolean isDeleted(Object element) {
- return false;
- }
- }
-
- class SelectionListener implements ISelectionChangedListener {
- public SelectionListener() {
- super();
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- if (selection != null)
- chosenPersp = (IPerspectiveDescriptor)selection.getFirstElement();
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectReferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectReferencePage.java
deleted file mode 100644
index bc3ef20..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ProjectReferencePage.java
+++ /dev/null
@@ -1,218 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-
-/**
- * A property page for viewing and modifying the set
- * of projects referenced by a given project.
- */
-public class ProjectReferencePage extends PropertyPage {
- private IProject project;
- private boolean modified = false;
- //widgets
- private CheckboxTableViewer listViewer;
-
- private static final int PROJECT_LIST_MULTIPLIER = 30;
-/**
- * Creates a new ProjectReferencePage.
- */
-public ProjectReferencePage() {
-}
-/**
- * @see PreferencePage#createContents
- */
-protected Control createContents(Composite parent) {
-
- WorkbenchHelp.setHelp(parent, IHelpContextIds.PROJECT_REFERENCE_PROPERTY_PAGE);
- Font font = parent.getFont();
-
- 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.FILL_HORIZONTAL));
- composite.setFont(font);
-
- listViewer = CheckboxTableViewer.newCheckList(composite, SWT.TOP | SWT.BORDER);
- listViewer.getTable().setFont(font);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.heightHint =
- getDefaultFontHeight(listViewer.getTable(), PROJECT_LIST_MULTIPLIER);
- listViewer.getTable().setLayoutData(data);
- listViewer.getTable().setFont(font);
-
- listViewer.setLabelProvider(new WorkbenchLabelProvider());
- listViewer.setContentProvider(getContentProvider(project));
- listViewer.setSorter(new ViewerSorter() {});
- listViewer.setInput(project.getWorkspace());
- try {
- listViewer.setCheckedElements(project.getReferencedProjects());
- } catch (CoreException e) {
- //don't initial-check anything
- }
-
- //check for initial modification to avoid work if no changes are made
- listViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- modified = true;
- }
- });
-
- return composite;
-}
-/* (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
- initialize();
-
- Composite content= new Composite(parent, SWT.NULL);
- GridLayout layout= new GridLayout();
- layout.marginHeight = layout.marginWidth = 0;
- content.setLayout(layout);
- content.setFont(parent.getFont());
-
- createDescriptionLabel(content);
-
- createContents(content);
-
- setControl(content);
-}
-/**
- * Returns a content provider for the list dialog. It
- * will return all projects in the workspace except
- * the given project, plus any projects referenced
- * by the given project which do no exist in the
- * workspace.
- */
-protected IStructuredContentProvider getContentProvider(final IProject project) {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (!(o instanceof IWorkspace)) {
- return new Object[0];
- }
-
- // Collect all the projects in the workspace except the given project
- IProject[] projects = ((IWorkspace)o).getRoot().getProjects();
- ArrayList referenced = new ArrayList(projects.length);
- boolean found = false;
- for (int i = 0; i < projects.length; i++) {
- if (!found && projects[i].equals(project)) {
- found = true;
- continue;
- }
- referenced.add(projects[i]);
- }
-
- // Add any referenced that do not exist in the workspace currently
- try {
- projects = project.getReferencedProjects();
- for (int i = 0; i < projects.length; i++) {
- if (!referenced.contains(projects[i]))
- referenced.add(projects[i]);
- }
- }
- catch (CoreException e) {
- }
-
- return referenced.toArray();
- }
- };
-}
-/**
- * Get the defualt widget height for the supplied control.
- * @return int
- * @param control - the control being queried about fonts
- * @param lines - the number of lines to be shown on the table.
- */
-private static int getDefaultFontHeight(Control control, int lines) {
- FontData[] viewerFontData = control.getFont().getFontData();
- int fontHeight = 10;
-
- //If we have no font data use our guess
- if (viewerFontData.length > 0)
- fontHeight = viewerFontData[0].getHeight();
- return lines * fontHeight;
-
-}
-/**
- * @see PreferencePage#doOk
- */
-protected void handle(InvocationTargetException e) {
- IStatus error;
- Throwable target = e.getTargetException();
- if (target instanceof CoreException) {
- error = ((CoreException) target).getStatus();
- } else {
- String msg = target.getMessage();
- if (msg == null)
- msg = WorkbenchMessages.getString("Internal_error"); //$NON-NLS-1$
- error = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 1, msg, target);
- }
- ErrorDialog.openError(getControl().getShell(), null, null, error);
-}
-/**
- * Initializes a ProjectReferencePage.
- */
-private void initialize() {
- project = (IProject) getElement().getAdapter(IResource.class);
- noDefaultAndApplyButton();
- setDescription(WorkbenchMessages.format("ProjectReferencesPage.label", new Object[] {project.getName()}));//$NON-NLS-1$
-}
-/**
- * @see PreferencePage#performOk
- */
-public boolean performOk() {
- if (!modified) return true;
- Object[] checked = listViewer.getCheckedElements();
- final IProject[] refs = new IProject[checked.length];
- System.arraycopy(checked, 0, refs, 0, checked.length);
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor) throws InvocationTargetException {
-
- try {
- IProjectDescription description = project.getDescription();
- description.setReferencedProjects(refs);
- project.setDescription(description, monitor);
- } catch (CoreException e) {
- throw new InvocationTargetException(e);
- }
- }
- };
- try {
- new ProgressMonitorDialog(getControl().getShell()).run(true, true, runnable);
- } catch (InterruptedException e) {
- } catch (InvocationTargetException e) {
- handle(e);
- return false;
- }
- return true;
-}
-}
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
deleted file mode 100644
index 09f992c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyDialog.java
+++ /dev/null
@@ -1,60 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.*;
-
-/**
- * This dialog is created and shown when 'Properties'
- * action is performed while an object is selected.
- * It shows one or more pages registered for object's type.
- */
-public class PropertyDialog extends PreferenceDialog {
- private ISelection selection;
-
- //The id of the last page that was selected
- private static String lastPropertyId = null;
-
-/**
- * The constructor.
- */
-
-public PropertyDialog(Shell parentShell, PreferenceManager mng, ISelection selection) {
- super(parentShell, mng);
- setSelection(selection);
-}
-/**
- * Returns selection in the "Properties" action context.
- */
-
-public ISelection getSelection() {
- return selection;
-}
-/**
- * Sets the selection that will be used to
- * determine target object.
- */
-
-public void setSelection(ISelection newSelection) {
- selection = newSelection;
-}
-
-/**
- * Get the name of the selected item preference
- */
-protected String getSelectedNodePreference(){
- return lastPropertyId;
-}
-
-/**
- * Get the name of the selected item preference
- */
-protected void setSelectedNodePreference(String pageId){
- lastPropertyId = pageId;
-}
-
-}
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
deleted file mode 100644
index 9460eeb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageContributorManager.java
+++ /dev/null
@@ -1,119 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.Collator;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.IContributorResourceAdapter;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.Sorter;
-import org.eclipse.ui.internal.registry.PropertyPagesRegistryReader;
-
-/**
- * Extends generic object contributor manager by loading property page
- * contributors from the registry.
- */
-
-public class PropertyPageContributorManager extends ObjectContributorManager {
- private static PropertyPageContributorManager sharedInstance=null;
- private boolean contributorsLoaded=false;
-
- private Sorter sorter = new Sorter() {
- private Collator collator = Collator.getInstance();
-
- public boolean compare(Object o1, Object o2) {
- // Make sure the workbench info page is always at the top.
- RegistryPageContributor c1 = (RegistryPageContributor)o1;
- RegistryPageContributor c2 = (RegistryPageContributor)o2;
- if (IWorkbenchConstants.WORKBENCH_PROPERTIES_PAGE_INFO.equals(c1.getPageId())) {
- // c1 is the info page
- if (IWorkbenchConstants.WORKBENCH_PROPERTIES_PAGE_INFO.equals(c2.getPageId())) {
- // both are the info page so c2 is not greater
- return false;
- }
- // c2 is any other page so it must be greater
- return true;
- }
- if (IWorkbenchConstants.WORKBENCH_PROPERTIES_PAGE_INFO.equals(c2.getPageId())) {
- // c1 is any other page so it is greater
- return false;
- }
-
- // The other pages are sorted in alphabetical order
- String s1 = c1.getPageName();
- String s2 = c2.getPageName();
- //Return true if c2 is 'greater than' c1
- return collator.compare(s2, s1) > 0;
- }
- };
-/**
- * The constructor.
- */
-public PropertyPageContributorManager() {
- super();
-}
-/**
- * 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.
- *
- * @return true if contribution took place, false otherwise.
- */
-public boolean contribute(PropertyPageManager manager, IAdaptable object) {
- // Lazy initialize
- if (!contributorsLoaded)
- loadContributors();
-
- List result = getContributors(object);
-
- if (result == null || result.size() == 0)
- return false;
-
- // Sort the results
- Object[] sortedResult = sorter.sort(result.toArray());
-
- // Allow each contributor to add its page to the manager.
- boolean actualContributions = false;
- for (int i = 0; i < sortedResult.length; i++) {
- IPropertyPageContributor ppcont = (IPropertyPageContributor) sortedResult[i];
- if (!ppcont.isApplicableTo(object)) continue;
- if (ppcont.contributePropertyPages(manager, object))
- actualContributions = true;
- }
- return actualContributions;
-}
-/**
- * Ideally, shared instance should not be used
- * and manager should be located in the workbench class.
- */
-public static PropertyPageContributorManager getManager() {
- if (sharedInstance==null)
- sharedInstance = new PropertyPageContributorManager();
- return sharedInstance;
-}
-/**
- * Returns true if contributors exist in the manager for
- * this object. If contributors wer not loaded from
- * the registry, load them first.
- */
-public boolean hasContributorsFor(Object object) {
- if (!contributorsLoaded) loadContributors();
- return super.hasContributorsFor(object);
-}
-/**
- * Loads property page contributors from the registry.
- */
-private void loadContributors() {
- PropertyPagesRegistryReader reader = new PropertyPagesRegistryReader(this);
- reader.registerPropertyPages(Platform.getPluginRegistry());
- contributorsLoaded=true;
-
-}
-
-}
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
deleted file mode 100644
index 3a29388..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageManager.java
+++ /dev/null
@@ -1,22 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.preference.*;
-/**
- * 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 {
-/**
- * The constructor.
- */
-public PropertyPageManager() {
- super();
-}
-}
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
deleted file mode 100644
index 3a04add..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/PropertyPageNode.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.IWorkbenchPropertyPage;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Property page node allows us to achive 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.
- */
-public class PropertyPageNode extends PreferenceNode {
- private RegistryPageContributor contributor;
- private IWorkbenchPropertyPage page;
- private Image icon;
- private IAdaptable element;
-/**
- * PropertyPageNode constructor.
- */
-public PropertyPageNode(RegistryPageContributor contributor, IAdaptable element) {
- super(contributor.getPageId());
- 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.
- */
-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.
- ErrorDialog.openError(
- (Shell)null,
- WorkbenchMessages.getString("PropertyPageNode.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("PropertyPageNode.errorMessage"), //$NON-NLS-1$
- e.getStatus());
- page = new EmptyPropertyPage();
- }
- setPage(page);
-}
-/** (non-Javadoc)
- * Method declared on IPreferenceNode.
- */
-public void disposeResources() {
- page = null;
- if (icon != null) {
- icon.dispose();
- icon = null;
- }
-}
-/**
- * Returns page icon, if defined.
- */
-public Image getLabelImage() {
- if (icon==null) {
- ImageDescriptor desc = contributor.getPageIcon();
- if (desc != null) {
- icon = desc.createImage();
- }
- }
- return icon;
-}
-/**
- * Returns page label as defined in the registry.
- */
-public String getLabelText() {
- 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
deleted file mode 100644
index 5be7a61..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RegistryPageContributor.java
+++ /dev/null
@@ -1,191 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.HashMap;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IActionFilter;
-import org.eclipse.ui.IWorkbenchPropertyPage;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.PropertyPagesRegistryReader;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * This property page contributor is created from page entry
- * in the registry. Since instances of this class are created
- * by the workbench, there is no danger of premature loading
- * of plugins.
- */
-
-public class RegistryPageContributor implements IPropertyPageContributor {
- private String pageName;
- private String iconName;
- private String pageId;
- private boolean isResourceContributor = false;
- private IConfigurationElement pageElement;
- private HashMap filterProperties;
-
- private static String [] resourceClassNames =
- {
- IResource.class.getName(),
- IContainer.class.getName(),
- IFolder.class.getName(),
- IProject.class.getName(),
- IFile.class.getName()
- };
-
-/**
- * PropertyPageContributor constructor.
- */
-public RegistryPageContributor(String pageId, String pageName, String iconName, HashMap filterProperties, String objectClassName, boolean adaptable, IConfigurationElement pageElement) {
- this.pageId = pageId;
- this.pageName = pageName;
- this.iconName = iconName;
- this.filterProperties = filterProperties;
- this.pageElement = pageElement;
-
- //Only adapt if explicitly allowed to do so
- if(adaptable)
- checkIsResourcePage(objectClassName);
-}
-/**
- * Implements the interface by creating property page specified with
- * the configuration element.
- */
-public boolean contributePropertyPages(PropertyPageManager mng, IAdaptable element) {
- PropertyPageNode node = new PropertyPageNode(this, element);
- mng.addToRoot(node);
- return true;
-}
-/**
- * Creates the page based on the information in the configuration element.
- */
-public IWorkbenchPropertyPage createPage(IAdaptable element) throws CoreException {
- IWorkbenchPropertyPage ppage = null;
- ppage = (IWorkbenchPropertyPage)WorkbenchPlugin.createExtension(
- pageElement, PropertyPagesRegistryReader.ATT_CLASS);
-
- if(isResourceContributor)
- ppage.setElement((IAdaptable) element.getAdapter(IResource.class));
- else
- ppage.setElement(element);
- ppage.setTitle(pageName);
- return ppage;
-}
-/**
- * Returns page icon as defined in the registry.
- */
-public ImageDescriptor getPageIcon() {
- if (iconName==null) return null;
- return WorkbenchImages.getImageDescriptorFromExtension(pageElement.getDeclaringExtension(), iconName);
-}
-/**
- * Returns page ID as defined in the registry.
- */
-
-public String getPageId() {
- return pageId;
-}
-/**
- * Returns page name as defined in the registry.
- */
-
-public String getPageName() {
- return pageName;
-}
-/**
- * Return true if name filter is not defined in the registry for this page,
- * or if name of the selected object matches the name filter.
- */
-public boolean isApplicableTo(Object object) {
- // Test name filter
- String nameFilter = pageElement.getAttribute(PropertyPagesRegistryReader.ATT_NAME_FILTER);
- if (nameFilter != null) {
- String objectName = object.toString();
- if (object instanceof IAdaptable) {
- IWorkbenchAdapter adapter = (IWorkbenchAdapter)((IAdaptable)object).getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- String elementName = adapter.getLabel(object);
- if (elementName != null) {
- objectName = elementName;
- }
- }
- }
- if (!SelectionEnabler.verifyNameMatch(objectName, nameFilter))
- return false;
- }
-
- // Test custom filter
- if (filterProperties == null)
- return true;
- IActionFilter filter = null;
-
- // If this is a resource contributor and the object is not a resource but
- // is an adaptable then get the object's resource via the adaptable mechanism.
- Object testObject = object;
- if (isResourceContributor
- && !(object instanceof IResource)
- && (object instanceof IAdaptable)) {
- Object result = ((IAdaptable)object).getAdapter(IResource.class);
- if (result != null)
- testObject = result;
- }
-
- if (testObject instanceof IActionFilter)
- filter = (IActionFilter)testObject;
- else if (testObject instanceof IAdaptable)
- filter = (IActionFilter)((IAdaptable)testObject).getAdapter(IActionFilter.class);
-
- if (filter != null)
- return testCustom(testObject, filter);
- else
- return true;
-}
-/**
- * Returns whether the object passes a custom key value filter
- * implemented by a matcher.
- */
-private boolean testCustom(Object object, IActionFilter filter) {
- if (filterProperties == null)
- return false;
- Iterator iter = filterProperties.keySet().iterator();
- while (iter.hasNext()) {
- String key = (String)iter.next();
- String value = (String)filterProperties.get(key);
- if (!filter.testAttribute(object, key, value))
- return false;
- }
- return true;
-}
-
-/**
- * Check if the object class name is for a class that
- * inherits from IResource. If so mark the receiver as
- * a resource contributor
- */
-
-private void checkIsResourcePage(String objectClassName){
-
- for(int i = 0; i < resourceClassNames.length; i++){
- if(resourceClassNames[i].equals(objectClassName)){
- isResourceContributor = true;
- return;
- }
- }
-}
-
-
-/*
- * @see IObjectContributor#canAdapt()
- */
-public boolean canAdapt() {
- return isResourceContributor;
-}
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RemoveCapabilityStep.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RemoveCapabilityStep.java
deleted file mode 100644
index 299f9e9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RemoveCapabilityStep.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.ui.ICapabilityUninstallWizard;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.registry.Capability;
-import org.eclipse.ui.internal.registry.CapabilityRegistry;
-
-/**
- * Represents the removal of a capability step in a multi-step
- * wizard.
- */
-public class RemoveCapabilityStep extends WizardStep {
- private Capability capability;
- private String[] natureIds;
- private IProject project;
- private ICapabilityUninstallWizard wizard;
-
- /**
- * Creates the remove capability step
- *
- * @param number step order number
- * @param capability the capability to be removed
- * @param natureIds the list of nature ids to remove on the project
- * @param project the project to remove the capability from
- */
- public RemoveCapabilityStep(int number, Capability capability, String[] natureIds, IProject project) {
- super(number);
- this.capability = capability;
- this.natureIds = natureIds;
- this.project = project;
- }
-
- /* (non-Javadoc)
- * Method declared on WizardStep.
- */
- public String getLabel() {
- return WorkbenchMessages.format("RemoveCapabilityStep.label", new Object[] {capability.getName()}); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on WizardStep.
- */
- public String getDetails() {
- String details = capability.getUninstallDetails();
- if (details == null) {
- if (natureIds.length == 1) {
- details = WorkbenchMessages.format("RemoveCapabilityStep.defaultDescription0", new Object[] {capability.getName()}); //$NON-NLS-1$
- } else if (natureIds.length == 2) {
- CapabilityRegistry reg = WorkbenchPlugin.getDefault().getCapabilityRegistry();
- Capability otherCapability = reg.getCapabilityForNature(natureIds[1]);
- if (otherCapability == capability)
- otherCapability = reg.getCapabilityForNature(natureIds[0]);
- details = WorkbenchMessages.format("RemoveCapabilityStep.defaultDescription1", new Object[] {capability.getName(), otherCapability.getName()}); //$NON-NLS-1$
- } else {
- StringBuffer msg = new StringBuffer();
- CapabilityRegistry reg = WorkbenchPlugin.getDefault().getCapabilityRegistry();
- for (int i = 0; i < natureIds.length; i++) {
- Capability cap = reg.getCapabilityForNature(natureIds[i]);
- if (cap != capability) {
- msg.append("\n "); //$NON-NLS-1$
- msg.append(cap.getName());
- }
- }
- details = WorkbenchMessages.format("RemoveCapabilityStep.defaultDescription2", new Object[] {capability.getName(), msg.toString()}); //$NON-NLS-1$
- }
- }
-
- return details;
- }
-
- /* (non-Javadoc)
- * Method declared on WizardStep.
- */
- public IWizard getWizard() {
- if (wizard == null) {
- wizard = capability.getUninstallWizard();
- if (wizard == null)
- wizard = new RemoveCapabilityWizard();
- if (wizard != null) {
- wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY, project, natureIds);
- wizard.addPages();
- }
- }
-
- return wizard;
- }
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RemoveCapabilityWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RemoveCapabilityWizard.java
deleted file mode 100644
index f30c11a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/RemoveCapabilityWizard.java
+++ /dev/null
@@ -1,135 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.ICapabilityUninstallWizard;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Internal workbench wizard to remove a capability
- * from a project. Also removes prerequisite natures
- * as specified in the <code>init</code> method.
- * <p>
- * This wizard is intended to be used by the
- * <code>RemoveCapabilityStep</code> class only.
- * </p>
- */
-public class RemoveCapabilityWizard extends Wizard implements ICapabilityUninstallWizard {
- private IWorkbench workbench;
- private IProject project;
- private String[] natureIds;
-
- /**
- * Creates an empty wizard for removing a capability
- * from a project.
- */
- /* package */ RemoveCapabilityWizard() {
- super();
- }
-
- /* (non-Javadoc)
- * Method declared on ICapabilityUninstallWizard.
- */
- public void init(IWorkbench workbench, IStructuredSelection selection, IProject project, String[] natureIds) {
- this.workbench = workbench;
- this.project = project;
- this.natureIds = natureIds;
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean performFinish() {
- return updateNatures();
- }
-
- /**
- * Update the project natures
- */
- private boolean updateNatures() {
- // define the operation to update natures
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- try {
- IProjectDescription description = project.getDescription();
- String[] oldIds = description.getNatureIds();
- ArrayList newIds = new ArrayList(oldIds.length);
- for (int i = 0; i < oldIds.length; i++) {
- boolean keepNature = true;
- for (int j = 0; j < natureIds.length; j++) {
- if (natureIds[j].equals(oldIds[i])) {
- keepNature = false;
- break;
- }
- }
- if (keepNature)
- newIds.add(oldIds[i]);
- }
- String[] results = new String[newIds.size()];
- newIds.toArray(results);
- description.setNatureIds(results);
- project.setDescription(description, monitor);
- } finally {
- monitor.done();
- }
- }
- };
-
- // run the update nature operation
- try {
- getContainer().run(true, true, op);
- }
- catch (InterruptedException e) {
- return false;
- }
- catch (InvocationTargetException e) {
- Throwable t = e.getTargetException();
- if (t instanceof CoreException) {
- ErrorDialog.openError(
- getShell(),
- WorkbenchMessages.getString("RemoveCapabilityWizard.errorMessage"), //$NON-NLS-1$
- null, // no special message
- ((CoreException) t).getStatus());
- } else {
- // Unexpected runtime exceptions and errors may still occur.
- Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog().log(
- new Status(
- Status.ERROR,
- PlatformUI.PLUGIN_ID,
- 0,
- t.toString(),
- t));
- MessageDialog.openError(
- getShell(),
- WorkbenchMessages.getString("RemoveCapabilityWizard.errorMessage"), //$NON-NLS-1$
- WorkbenchMessages.format("RemoveCapabilityWizard.internalError", new Object[] {t.getMessage()})); //$NON-NLS-1$
- }
- return false;
- }
-
- return true;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceInfoPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceInfoPage.java
deleted file mode 100644
index 9f13b65..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceInfoPage.java
+++ /dev/null
@@ -1,353 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.File;
-import java.text.DateFormat;
-import java.text.MessageFormat;
-import java.util.Date;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * This is a dummy page that is added to the property dialog
- * when multiple elements are selected. At the moment
- * we don't handle multiple selection in a meaningful way.
- */
-public class ResourceInfoPage extends PropertyPage {
-
- private Button editableBox;
- private Button derivedBox;
- private boolean readOnlyValue;
- private boolean derivedValue;
- private static String READ_ONLY = WorkbenchMessages.getString("ResourceInfo.readOnly"); //$NON-NLS-1$
- private static String DERIVED = WorkbenchMessages.getString("ResourceInfo.derived"); //$NON-NLS-1$
- private static String NAME_TITLE = WorkbenchMessages.getString("ResourceInfo.name"); //$NON-NLS-1$
- private static String TYPE_TITLE = WorkbenchMessages.getString("ResourceInfo.type"); //$NON-NLS-1$
- private static String LOCATION_TITLE = WorkbenchMessages.getString("ResourceInfo.location"); //$NON-NLS-1$
- private static String SIZE_TITLE = WorkbenchMessages.getString("ResourceInfo.size"); //$NON-NLS-1$
- private static String BYTES_LABEL = WorkbenchMessages.getString("ResourceInfo.bytes"); //$NON-NLS-1$
- private static String FILE_LABEL = WorkbenchMessages.getString("ResourceInfo.file"); //$NON-NLS-1$
- private static String FOLDER_LABEL = WorkbenchMessages.getString("ResourceInfo.folder"); //$NON-NLS-1$
- private static String PROJECT_LABEL = WorkbenchMessages.getString("ResourceInfo.project"); //$NON-NLS-1$
- private static String UNKNOWN_LABEL = WorkbenchMessages.getString("ResourceInfo.unknown"); //$NON-NLS-1$
- private static String NOT_LOCAL_TEXT = WorkbenchMessages.getString("ResourceInfo.notLocal"); //$NON-NLS-1$
- private static String PATH_TITLE = WorkbenchMessages.getString("ResourceInfo.path"); //$NON-NLS-1$
- private static String TIMESTAMP_TITLE = WorkbenchMessages.getString("ResourceInfo.lastModified"); //$NON-NLS-1$
-
- //Max value width in characters before wrapping
- private static final int MAX_VALUE_WIDTH = 80;
-
-/**
- * Create the group that shows the name, location, size and type.
- *
- * @param parent the composite the group will be created in
- * @param resource the resource the information is being taken from.
- * @return the composite for the group
- */
-private Composite createBasicInfoGroup(Composite parent, IResource resource) {
-
- Font font = parent.getFont();
-
- Composite basicInfoComposite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- basicInfoComposite.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- basicInfoComposite.setLayoutData(data);
- basicInfoComposite.setFont(font);
-
- //The group for path
- Label pathLabel = new Label(basicInfoComposite, SWT.NONE);
- pathLabel.setText(PATH_TITLE);
- GridData gd = new GridData();
- gd.verticalAlignment = SWT.TOP;
- pathLabel.setLayoutData(gd);
- pathLabel.setFont(font);
-
- // path value label
- Text pathValueText = new Text(basicInfoComposite, SWT.WRAP | SWT.READ_ONLY);
- pathValueText.setText(resource.getFullPath().toString());
- gd = new GridData();
- gd.widthHint = convertWidthInCharsToPixels(MAX_VALUE_WIDTH);
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalAlignment = GridData.FILL;
- pathValueText.setLayoutData(gd);
- pathValueText.setFont(font);
-
- //The group for types
- Label typeTitle = new Label(basicInfoComposite, SWT.LEFT);
- typeTitle.setText(TYPE_TITLE);
- typeTitle.setFont(font);
-
- Text typeValue = new Text(basicInfoComposite, SWT.LEFT | SWT.READ_ONLY);
- typeValue.setText(getTypeString(resource));
- typeValue.setFont(font);
-
- //The group for location
- Label locationTitle = new Label(basicInfoComposite, SWT.LEFT);
- locationTitle.setText(LOCATION_TITLE);
- gd = new GridData();
- gd.verticalAlignment = SWT.TOP;
- locationTitle.setLayoutData(gd);
- locationTitle.setFont(font);
-
-
- Text locationValue = new Text(basicInfoComposite, SWT.WRAP | SWT.READ_ONLY);
- locationValue.setText(getLocationText(resource));
- gd = new GridData();
- gd.widthHint = convertWidthInCharsToPixels(MAX_VALUE_WIDTH);
- gd.grabExcessHorizontalSpace = true;
- gd.horizontalAlignment = GridData.FILL;
- locationValue.setLayoutData(gd);
- locationValue.setFont(font);
-
- if (resource.getType() == IResource.FILE) {
- //The group for size
- Label sizeTitle = new Label(basicInfoComposite, SWT.LEFT);
- sizeTitle.setText(SIZE_TITLE);
- sizeTitle.setFont(font);
-
- Text sizeValue = new Text(basicInfoComposite, SWT.LEFT | SWT.READ_ONLY);
- sizeValue.setText(MessageFormat.format(BYTES_LABEL, new Object[] {getSizeString((IFile) resource)}));
- sizeValue.setFont(font);
- }
-
- return basicInfoComposite;
-}
-protected Control createContents(Composite parent) {
-
- WorkbenchHelp.setHelp(parent, IHelpContextIds.RESOURCE_INFO_PROPERTY_PAGE);
-
- // layout the page
- IResource resource = (IResource) getElement();
- this.readOnlyValue = resource.isReadOnly();
- if(resource.getType()!= IResource.PROJECT)
- this.derivedValue = resource.isDerived();
-
- // top level group
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- GridData data = new GridData(GridData.FILL);
- data.grabExcessHorizontalSpace = true;
- composite.setLayoutData(data);
- composite.setFont(parent.getFont());
-
- createBasicInfoGroup(composite, resource);
- createSeparator(composite);
- createStateGroup(composite,resource);
-
- return composite;
-}
-/**
- * Create the isEditable button and it's associated label as a child of parent
- * using the editableValue of the receiver. The Composite will be the parent of
- * the button.
- */
-private void createEditableButton(Composite composite) {
-
- this.editableBox = new Button(composite, SWT.CHECK | SWT.RIGHT);
- this.editableBox.setAlignment(SWT.LEFT);
- this.editableBox.setText(READ_ONLY);
- this.editableBox.setSelection(this.readOnlyValue);
- this.editableBox.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- readOnlyValue = editableBox.getSelection();
- }
- });
- this.editableBox.setFont(composite.getFont());
- GridData data = new GridData();
- data.horizontalSpan = 2;
- this.editableBox.setLayoutData(data);
-}
-
-/**
- * Create the derived button and it's associated label as a child of parent
- * using the derived of the receiver. The Composite will be the parent of
- * the button.
- */
-private void createDerivedButton(Composite composite) {
-
- this.derivedBox = new Button(composite, SWT.CHECK | SWT.RIGHT);
- this.derivedBox.setAlignment(SWT.LEFT);
- this.derivedBox.setText(DERIVED);
- this.derivedBox.setSelection(this.derivedValue);
- this.derivedBox.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- derivedValue = editableBox.getSelection();
- }
- });
-
- this.derivedBox.setFont(composite.getFont());
- GridData data = new GridData();
- data.horizontalSpan = 2;
- this.derivedBox.setLayoutData(data);
-}
-
-/**
- * Create a separator that goes across the entire page
- */
-private void createSeparator(Composite composite) {
-
- Label separator =
- new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData gridData = new GridData();
- gridData.horizontalAlignment = GridData.FILL;
- gridData.grabExcessHorizontalSpace = true;
- separator.setLayoutData(gridData);
-}
-/**
- * Create the group that shows the read only state and the timestamp.
- *
- * @return the composite for the group
- * @param parent the composite the group will be created in
- * @param resource the resource the information is being taken from.
- */
-private void createStateGroup(Composite parent, IResource resource) {
-
- Font font = parent.getFont();
-
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
- composite.setFont(font);
-
- Label timeStampLabel = new Label(composite, SWT.NONE);
- timeStampLabel.setText(TIMESTAMP_TITLE);
- timeStampLabel.setFont(font);
-
- // path value label
- Text timeStampValue = new Text(composite, SWT.WRAP | SWT.READ_ONLY);
- timeStampValue.setText(getDateStringValue(resource));
- timeStampValue.setFont(font);
-
- createEditableButton(composite);
-
- //Not relevant to projects
- if(resource.getType() != IResource.PROJECT)
- createDerivedButton(composite);
-}
-/**
- * Return the value for the date String for the timestamp of the supplied resource.
- * @return String
- * @param IResource - the resource to query
- */
-private String getDateStringValue(IResource resource) {
-
- if (!resource.isLocal(IResource.DEPTH_ZERO))
- return NOT_LOCAL_TEXT;
- else {
- File localFile = resource.getLocation().toFile();
- DateFormat format = DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM);
- return format.format(new Date(localFile.lastModified()));
- }
-}
-/**
- * Get the location of a resource
- */
-private String getLocationText(IResource resource) {
- //Location can be null if the resource is not local
- IPath location = resource.getLocation();
- if (location != null) {
- return location.toOSString();
- }
- else {
- return NOT_LOCAL_TEXT;
- }
-}
-/**
- * Return a String that indicates the size of the supplied file.
- */
-private String getSizeString(IFile file) {
- if (!file.isLocal(IResource.DEPTH_ZERO))
- return NOT_LOCAL_TEXT;
- else {
- File localFile = file.getLocation().toFile();
- return Long.toString(localFile.length());
- }
-}
-/**
- * Get the string that identifies the type of this resource.
- */
-private String getTypeString(IResource resource) {
-
- if(resource.getType() == IResource.FILE)
- return FILE_LABEL;
-
- if(resource.getType() == IResource.FOLDER)
- return FOLDER_LABEL;
-
- if(resource.getType() == IResource.PROJECT)
- return PROJECT_LABEL;
-
- //Should not be possible
- return UNKNOWN_LABEL;
-}
-/**
- * Reset the editableBox to the false.
- */
-protected void performDefaults() {
-
- this.readOnlyValue = false;
- this.editableBox.setSelection(this.readOnlyValue);
-
- //Nothing to update if we never made the box
- if(this.derivedBox != null){
- this.derivedValue = false;
- this.derivedBox.setSelection(this.derivedValue);
- }
-}
-/**
- * Apply the read only state to the resource.
- */
-public boolean performOk() {
- IResource resource = (IResource) getElement();
- resource.setReadOnly(editableBox.getSelection());
-
- //Nothing to update if we never made the box
- if(this.derivedBox != null){
- try{
- resource.setDerived(derivedBox.getSelection());
- }
- catch (CoreException exception){
- ErrorDialog.openError(
- getShell(),
- WorkbenchMessages.getString("InternalError"), //$NON-NLS-1$
- exception.getLocalizedMessage(),
- exception.getStatus());
- return false;
- }
- }
- return true;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceSorter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceSorter.java
deleted file mode 100644
index 597b7b3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceSorter.java
+++ /dev/null
@@ -1,179 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-/**
- * Sorter for viewers that display items of type <code>IResource</code>.
- * The sorter supports two sort criteria:
- * <p>
- * <code>NAME</code>: Folders are given order precedence, followed by files.
- * Within these two groups resources are ordered by name. All name comparisons
- * are case-insensitive.
- * </p>
- * <p>
- * <code>TYPE</code>: Folders are given order precedence, followed by files.
- * Within these two groups resources are ordered by extension. All extension
- * comparisons are case-insensitive.
- * </p>
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class ResourceSorter extends ViewerSorter {
-
- /**
- * Constructor argument value that indicates to sort items by name.
- */
- public final static int NAME = 1;
-
- /**
- * Constructor argument value that indicates to sort items by extension.
- */
- public final static int TYPE = 2;
-
- private int criteria;
-
- /**
- * Creates a resource sorter that will use the given sort criteria.
- *
- * @param criteria the sort criterion to use: one of <code>NAME</code> or
- * <code>TYPE</code>
- */
- public ResourceSorter(int criteria) {
- super();
- this.criteria = criteria;
- }
-
- /**
- * Returns an integer value representing the relative sort priority of the
- * given element based on its class.
- * <p>
- * <ul>
- * <li>resources (<code>IResource</code>) - 2</li>
- * <li>project references (<code>ProjectReference</code>) - 1</li>
- * <li>everything else - 0</li>
- * </ul>
- * </p>
- *
- * @param element the element
- * @return the sort priority (larger numbers means more important)
- */
- protected int classComparison(Object element) {
- if (element instanceof IResource) {
- return 2;
- }
- return 0;
- }
-
- /* (non-Javadoc)
- * Method declared on ViewerSorter.
- */
- public int compare(Viewer viewer, Object o1, Object o2) {
- //have to deal with non-resources in navigator
- //if one or both objects are not resources, returned a comparison
- //based on class.
- if (!(o1 instanceof IResource && o2 instanceof IResource)) {
- return compareClass(o1, o2);
- }
- IResource r1 = (IResource) o1;
- IResource r2 = (IResource) o2;
-
- if (r1 instanceof IContainer && r2 instanceof IContainer)
- return compareNames(r1, r2);
- else if (r1 instanceof IContainer)
- return -1;
- else if (r2 instanceof IContainer)
- return 1;
- else if (criteria == NAME)
- return compareNames(r1, r2);
- else if (criteria == TYPE)
- return compareTypes(r1, r2);
- else
- return 0;
- }
-
- /**
- * Returns a number reflecting the collation order of the given elements
- * based on their class.
- *
- * @param element1 the first element to be ordered
- * @param element2 the second element to be ordered
- * @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
- */
- protected int compareClass(Object element1, Object element2) {
- return classComparison(element1) - classComparison(element2);
- }
-
- /**
- * Returns a number reflecting the collation order of the given resources
- * based on their resource names.
- *
- * @param resource1 the first resource element to be ordered
- * @param resource2 the second resource element to be ordered
- * @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
- */
- protected int compareNames(IResource resource1, IResource resource2) {
- return collator.compare(resource1.getName(), resource2.getName());
- }
-
- /**
- * Returns a number reflecting the collation order of the given resources
- * based on their respective file extensions. Resources with the same file
- * extension will be collated based on their names.
- *
- * @param resource1 the first resource element to be ordered
- * @param resource2 the second resource element to be ordered
- * @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
- */
- protected int compareTypes(IResource resource1, IResource resource2) {
- String ext1 = getExtensionFor(resource1);
- String ext2 = getExtensionFor(resource2);
-
- // Compare extensions. If they're different then return a value that
- // indicates correct extension ordering. If they're the same then
- // return a value that indicates the correct NAME ordering.
- int result = collator.compare(ext1, ext2);
-
- if (result != 0) // ie.- different extensions
- return result;
-
- return compareNames(resource1, resource2);
- }
-
- /**
- * Returns the sort criteria of this this sorter.
- *
- * @return the sort criterion: one of <code>NAME</code> or <code>TYPE</code>
- */
- public int getCriteria() {
- return criteria;
- }
-
- /**
- * Returns the extension portion of the given resource.
- *
- * @param resource the resource
- * @return the file extension, possibily the empty string
- */
- private String getExtensionFor(IResource resource) {
- String ext = resource.getFileExtension();
- return ext == null ? "" : ext; //$NON-NLS-1$
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceTreeAndListGroup.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceTreeAndListGroup.java
deleted file mode 100644
index e88c26d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceTreeAndListGroup.java
+++ /dev/null
@@ -1,933 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.Table;
-
-import java.io.File;
-
-/**
- * Workbench-level composite that combines a CheckboxTreeViewer and CheckboxListViewer.
- * All viewer selection-driven interactions are handled within this object
- */
-public class ResourceTreeAndListGroup implements ICheckStateListener, ISelectionChangedListener, ITreeViewerListener {
- private Object root;
- private Object currentTreeSelection;
- private Collection expandedTreeNodes = new HashSet();
- private Map checkedStateStore = new HashMap(9);
- private Collection whiteCheckedTreeItems = new HashSet();
- private Collection listeners = new HashSet();
-
- private ITreeContentProvider treeContentProvider;
- private IStructuredContentProvider listContentProvider;
- private ILabelProvider treeLabelProvider;
- private ILabelProvider listLabelProvider;
-
- // widgets
- private CheckboxTreeViewer treeViewer;
- private CheckboxTableViewer listViewer;
-
-/**
- * Create an instance of this class. Use this constructor if you wish to specify
- * the width and/or height of the combined widget (to only hardcode one of the
- * sizing dimensions, specify the other dimension's value as -1)
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param style int
- * @param rootObject java.lang.Object
- * @param childPropertyName java.lang.String
- * @param parentPropertyName java.lang.String
- * @param listPropertyName java.lang.String
- * @param width int
- * @param height int
- */
-public ResourceTreeAndListGroup(
- Composite parent,Object rootObject,
- ITreeContentProvider treeContentProvider,ILabelProvider treeLabelProvider,
- IStructuredContentProvider listContentProvider,ILabelProvider listLabelProvider,
- int style,int width,int height) {
-
- root = rootObject;
- this.treeContentProvider = treeContentProvider;
- this.listContentProvider = listContentProvider;
- this.treeLabelProvider = treeLabelProvider;
- this.listLabelProvider = listLabelProvider;
- createContents(parent, width, height, style);
-}
-/**
- * This method must be called just before this window becomes visible.
- */
-public void aboutToOpen() {
- determineWhiteCheckedDescendents(root);
- checkNewTreeElements(treeContentProvider.getElements(root));
- currentTreeSelection = null;
-
- //select the first element in the list
- Object[] elements = treeContentProvider.getElements(root);
- Object primary = elements.length > 0 ? elements[0] : null;
- if (primary != null) {
- treeViewer.setSelection(new StructuredSelection(primary));
- }
- treeViewer.getControl().setFocus();
-}
-/**
- * Add the passed listener to self's collection of clients
- * that listen for changes to element checked states
- *
- * @param listener ICheckStateListener
- */
-public void addCheckStateListener(ICheckStateListener listener) {
- listeners.add(listener);
-}
-/**
- * Return a boolean indicating whether all children of the passed tree element
- * are currently white-checked
- *
- * @return boolean
- * @param treeElement java.lang.Object
- */
-protected boolean areAllChildrenWhiteChecked(Object treeElement) {
- Object[] children = treeContentProvider.getChildren(treeElement);
- for (int i = 0; i < children.length; ++i) {
- if (!whiteCheckedTreeItems.contains(children[i]))
- return false;
- }
-
- return true;
-}
-/**
- * Return a boolean indicating whether all list elements associated with
- * the passed tree element are currently checked
- *
- * @return boolean
- * @param treeElement java.lang.Object
- */
-protected boolean areAllElementsChecked(Object treeElement) {
- List checkedElements = (List)checkedStateStore.get(treeElement);
- if (checkedElements == null) // ie.- tree item not even gray-checked
- return false;
-
- return getListItemsSize(treeElement) == checkedElements.size();
-}
-/**
- * Iterate through the passed elements which are being realized for the first
- * time and check each one in the tree viewer as appropriate
- */
-protected void checkNewTreeElements(Object[] elements) {
- for (int i = 0; i < elements.length; ++i) {
- Object currentElement = elements[i];
- boolean checked = checkedStateStore.containsKey(currentElement);
- treeViewer.setChecked(currentElement,checked);
- treeViewer.setGrayed(currentElement,checked && !whiteCheckedTreeItems.contains(currentElement));
- }
-}
-/**
-* An item was checked in one of self's two views. Determine which
-* view this occurred in and delegate appropriately
-*
-* @param event CheckStateChangedEvent
-*/
-public void checkStateChanged(final CheckStateChangedEvent event) {
-
- //Potentially long operation - show a busy cursor
- BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
- public void run() {
- if (event.getCheckable().equals(treeViewer))
- treeItemChecked(event.getElement(), event.getChecked());
- else
- listItemChecked(event.getElement(), event.getChecked(), true);
-
- notifyCheckStateChangeListeners(event);
- }
- });
-}
-/**
- * Lay out and initialize self's visual components.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param width int
- * @param height int
- */
-protected void createContents(Composite parent, int width, int height, int style) {
- // group pane
- Composite composite = new Composite(parent,style);
- composite.setFont(parent.getFont());
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = true;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createTreeViewer(composite, width/2, height);
- createListViewer(composite, width/2, height);
-
- initialize();
-}
-/**
- * Create this group's list viewer.
- */
-protected void createListViewer(Composite parent, int width, int height) {
- listViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = width;
- data.heightHint = height;
- listViewer.getTable().setLayoutData(data);
- listViewer.getTable().setFont(parent.getFont());
- listViewer.setContentProvider(listContentProvider);
- listViewer.setLabelProvider(listLabelProvider);
- listViewer.addCheckStateListener(this);
-}
-/**
- * Create this group's tree viewer.
- */
-protected void createTreeViewer(Composite parent, int width, int height) {
- Tree tree = new Tree(parent, SWT.CHECK | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = width;
- data.heightHint = height;
- tree.setLayoutData(data);
- tree.setFont(parent.getFont());
-
- treeViewer = new CheckboxTreeViewer(tree);
- treeViewer.setContentProvider(treeContentProvider);
- treeViewer.setLabelProvider(treeLabelProvider);
- treeViewer.addTreeListener(this);
- treeViewer.addCheckStateListener(this);
- treeViewer.addSelectionChangedListener(this);
-}
-/**
- * Returns a boolean indicating whether the passed tree element should be
- * at LEAST gray-checked. Note that this method does not consider whether
- * it should be white-checked, so a specified tree item which should be
- * white-checked will result in a <code>true</code> answer from this method.
- * To determine whether a tree item should be white-checked use method
- * #determineShouldBeWhiteChecked(Object).
- *
- * @param element java.lang.Object
- * @return boolean
- * @see #determineShouldBeWhiteChecked(java.lang.Object)
- */
-protected boolean determineShouldBeAtLeastGrayChecked(Object treeElement) {
- // if any list items associated with treeElement are checked then it
- // retains its gray-checked status regardless of its children
- List checked = (List) checkedStateStore.get(treeElement);
- if (checked != null && (!checked.isEmpty()))
- return true;
-
- // if any children of treeElement are still gray-checked then treeElement
- // must remain gray-checked as well. Only ask expanded nodes
- if (expandedTreeNodes.contains(treeElement)) {
- Object[] children = treeContentProvider.getChildren(treeElement);
- for (int i = 0; i < children.length; ++i) {
- if (checkedStateStore.containsKey(children[i]))
- return true;
- }
- }
-
- return false;
-}
-/**
- * Returns a boolean indicating whether the passed tree item should be
- * white-checked.
- *
- * @return boolean
- * @param treeElement java.lang.Object
- */
-protected boolean determineShouldBeWhiteChecked(Object treeElement) {
- return areAllChildrenWhiteChecked(treeElement) && areAllElementsChecked(treeElement);
-}
-/**
- * Recursively add appropriate tree elements to the collection of
- * known white-checked tree elements.
- *
- * @param treeElement java.lang.Object
- */
-protected void determineWhiteCheckedDescendents(Object treeElement) {
- // always go through all children first since their white-checked
- // statuses will be needed to determine the white-checked status for
- // this tree element
- Object[] children = treeContentProvider.getElements(treeElement);
- for (int i = 0; i < children.length; ++i)
- determineWhiteCheckedDescendents(children[i]);
-
- // now determine the white-checked status for this tree element
- if (determineShouldBeWhiteChecked(treeElement))
- setWhiteChecked(treeElement,true);
-}
-/**
- * Cause the tree viewer to expand all its items
- */
-public void expandAll() {
- treeViewer.expandAll();
-}
-/**
- * Expand an element in a tree viewer
- */
-private void expandTreeElement(final Object item) {
- BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
- public void run() {
-
- // First see if the children need to be given their checked state at all. If they've
- // already been realized then this won't be necessary
- if (expandedTreeNodes.contains(item))
- checkNewTreeElements(treeContentProvider.getChildren(item));
- else {
-
- expandedTreeNodes.add(item);
- if (whiteCheckedTreeItems.contains(item)) {
- //If this is the first expansion and this is a white checked node then check the children
- Object[] children = treeContentProvider.getChildren(item);
- for (int i = 0; i < children.length; ++i) {
- if (!whiteCheckedTreeItems.contains(children[i])) {
- Object child = children[i];
- setWhiteChecked(child, true);
- treeViewer.setChecked(child, true);
- checkedStateStore.put(child, new ArrayList());
- }
- }
-
- //Now be sure to select the list of items too
- setListForWhiteSelection(item);
- }
- }
-
- }
- });
-}
-/**
- * Add all of the selected children of nextEntry to result recursively.
- * This does not set any values in the checked state.
- * @param The treeElement being queried
- * @param addAll a boolean to indicate if the checked state store needs to be queried
- * @param filter IElementFilter - the filter being used on the data
- * @param monitor IProgressMonitor or null that the cancel is polled for
-*/
-private void findAllSelectedListElements(
- Object treeElement,
- String parentLabel,
- boolean addAll,
- IElementFilter filter,
- IProgressMonitor monitor) throws InterruptedException{
-
- String fullLabel = null;
- if(monitor != null && monitor.isCanceled())
- return;
- if(monitor != null){
- fullLabel = getFullLabel(treeElement,parentLabel);
- monitor.subTask(fullLabel);
- }
-
- if (addAll)
- filter.filterElements(listContentProvider.getElements(treeElement),monitor);
- else { //Add what we have stored
- if (checkedStateStore.containsKey(treeElement))
- filter.filterElements((Collection) checkedStateStore.get(treeElement),monitor);
- }
-
- Object[] treeChildren = treeContentProvider.getChildren(treeElement);
- for (int i = 0; i < treeChildren.length; i++) {
- Object child = treeChildren[i];
- if (addAll)
- findAllSelectedListElements(child, fullLabel,true, filter,monitor);
- else { //Only continue for those with checked state
- if (checkedStateStore.containsKey(child))
- findAllSelectedListElements(
- child,
- fullLabel,
- whiteCheckedTreeItems.contains(child),
- filter,
- monitor);
- }
-
- }
-}
-/**
- * Find all of the white checked children of the treeElement and add them to the collection.
- * If the element itself is white select add it. If not then add any selected list elements
- * and recurse down to the children.
- * @param treeElement java.lang.Object
- * @param result java.util.Collection
- */
-private void findAllWhiteCheckedItems(Object treeElement, Collection result) {
-
- if (whiteCheckedTreeItems.contains(treeElement))
- result.add(treeElement);
- else {
- Collection listChildren = (Collection) checkedStateStore.get(treeElement);
- //if it is not in the store then it and it's children are not interesting
- if (listChildren == null)
- return;
- result.addAll(listChildren);
- Object[] children = treeContentProvider.getChildren(treeElement);
- for (int i = 0; i < children.length; ++i) {
- findAllWhiteCheckedItems(children[i], result);
- }
- }
-}
-/**
- * Returns a flat list of all of the leaf elements which
- * are checked. Filter then based on the supplied ElementFilter.
- * If monitor is cancelled then return null
- * @param filter - the filter for the data
- * @param monitor IProgressMonitor or null
- * @return all of the leaf elements which are checked
- */
-public void getAllCheckedListItems(IElementFilter filter, IProgressMonitor monitor) throws InterruptedException{
-
- //Iterate through the children of the root as the root is not in the store
- Object[] children = treeContentProvider.getChildren(root);
- for (int i = 0; i < children.length; ++i) {
- findAllSelectedListElements(
- children[i],
- null,
- whiteCheckedTreeItems.contains(children[i]),
- filter,
- monitor);
- }
-}
-
-/**
- * Returns a flat list of all of the leaf elements which are checked.
- *
- * @return all of the leaf elements which are checked. This API does not
- * return null in order to keep backwards compatibility.
- */
-public List getAllCheckedListItems() {
-
- final ArrayList returnValue = new ArrayList();
-
- IElementFilter passThroughFilter = new IElementFilter() {
-
- public void filterElements(Collection elements,IProgressMonitor monitor) throws InterruptedException{
- returnValue.addAll(elements);
- }
-
- public void filterElements(Object[] elements,IProgressMonitor monitor) throws InterruptedException{
- for(int i =0; i < elements.length; i ++){
- returnValue.add(elements[i]);
- }
- }
- };
-
- try{
- getAllCheckedListItems(passThroughFilter,null);
- }
- catch (InterruptedException exception){
- return new ArrayList();
- }
- return returnValue;
-
-}
-
-/**
- * Returns a list of all of the items that are white checked.
- * Any folders that are white checked are added and then any files
- * from white checked folders are added.
- *
- * @return the list of all of the items that are white checked
- */
-public List getAllWhiteCheckedItems() {
-
- List result = new ArrayList();
-
- //Iterate through the children of the root as the root is not in the store
- Object[] children = treeContentProvider.getChildren(root);
- for (int i = 0; i < children.length; ++i) {
- findAllWhiteCheckedItems(children[i], result);
- }
-
- return result;
-}
-/**
- * Answer the number of elements that have been checked by the
- * user.
- *
- * @return int
- */
-public int getCheckedElementCount() {
- return checkedStateStore.size();
-}
-/**
- * Get the full label of the treeElement (its name and its parent's name).
- * @param treeElement - the element being exported
- * @param parentLabel - the label of the parent, can be null
- * @return String
- */
-protected String getFullLabel(Object treeElement,String parentLabel) {
- String parentName = parentLabel;
-
- if (parentLabel == null)
- parentName = ""; //$NON-NLS-1$
-
- if (parentName.length() > 0 && (!parentName.endsWith(File.separator))) {
- parentName += File.separatorChar;
- }
- return parentName + treeLabelProvider.getText(treeElement);
-}
-/**
- * Return a count of the number of list items associated with a
- * given tree item.
- *
- * @return int
- * @param treeElement java.lang.Object
- */
-protected int getListItemsSize(Object treeElement) {
- Object[] elements = listContentProvider.getElements(treeElement);
- return elements.length;
-}
-/**
- * Get the table the list viewer uses.
- * @return org.eclipse.swt.widgets.Table
- */
-public Table getListTable() {
- return this.listViewer.getTable();
-}
-/**
- * Logically gray-check all ancestors of treeItem by ensuring that they
- * appear in the checked table
- */
-protected void grayCheckHierarchy(Object treeElement) {
-
- //expand the element first to make sure we have populated for it
- expandTreeElement(treeElement);
-
- // if this tree element is already gray then its ancestors all are as well
- if (checkedStateStore.containsKey(treeElement))
- return; // no need to proceed upwards from here
-
- checkedStateStore.put(treeElement,new ArrayList());
- Object parent = treeContentProvider.getParent(treeElement);
- if (parent != null)
- grayCheckHierarchy(parent);
-}
-/**
- * Set the checked state of self and all ancestors appropriately. Do not white check anyone - this is
- * only done down a hierarchy.
- */
-private void grayUpdateHierarchy(Object treeElement) {
-
- boolean shouldBeAtLeastGray = determineShouldBeAtLeastGrayChecked(treeElement);
-
- treeViewer.setGrayChecked(treeElement, shouldBeAtLeastGray);
-
- if (whiteCheckedTreeItems.contains(treeElement))
- whiteCheckedTreeItems.remove(treeElement);
-
- // proceed up the tree element hierarchy
- Object parent = treeContentProvider.getParent(treeElement);
- if (parent != null) {
- grayUpdateHierarchy(parent);
- }
-}
-/**
- * Set the initial checked state of the passed list element to true.
- */
-public void initialCheckListItem(Object element) {
- Object parent = treeContentProvider.getParent(element);
- selectAndReveal(parent);
- //Check the element in the viewer as if it had been manually checked
- listViewer.setChecked(element,true);
- //As this is not done from the UI then set the box for updating from the selection to false
- listItemChecked(element, true, false);
- grayUpdateHierarchy(parent);
-}
-/**
- * Set the initial checked state of the passed element to true,
- * as well as to all of its children and associated list elements
- */
-public void initialCheckTreeItem(Object element) {
- treeItemChecked(element, true);
- selectAndReveal(element);
-}
-
-private void selectAndReveal(Object treeElement){
- treeViewer.reveal(treeElement);
- IStructuredSelection selection = new StructuredSelection(treeElement);
- treeViewer.setSelection(selection);
-}
-
-/**
- * Initialize this group's viewers after they have been laid out.
- */
-protected void initialize() {
- treeViewer.setInput(root);
- this.expandedTreeNodes = new ArrayList();
- this.expandedTreeNodes.add(root);
-
-}
-/**
- * Callback that's invoked when the checked status of an item in the list
- * is changed by the user. Do not try and update the hierarchy if we are building the
- * initial list.
- */
-protected void listItemChecked(
- Object listElement,
- boolean state,
- boolean updatingFromSelection) {
- List checkedListItems = (List) checkedStateStore.get(currentTreeSelection);
- //If it has not been expanded do so as the selection of list items will affect gray state
- if (!expandedTreeNodes.contains(currentTreeSelection))
- expandTreeElement(currentTreeSelection);
-
- if (state) {
- if (checkedListItems == null) {
- // since the associated tree item has gone from 0 -> 1 checked
- // list items, tree checking may need to be updated
- grayCheckHierarchy(currentTreeSelection);
- checkedListItems = (List) checkedStateStore.get(currentTreeSelection);
- }
- checkedListItems.add(listElement);
- } else {
- checkedListItems.remove(listElement);
- if (checkedListItems.isEmpty()) {
- // since the associated tree item has gone from 1 -> 0 checked
- // list items, tree checking may need to be updated
- ungrayCheckHierarchy(currentTreeSelection);
- }
- }
-
- //Update the list with the selections if there are any
- if (checkedListItems.size() > 0)
- checkedStateStore.put(currentTreeSelection, checkedListItems);
- if (updatingFromSelection)
- grayUpdateHierarchy(currentTreeSelection);
-}
-/**
- * Notify all checked state listeners that the passed element has had
- * its checked state changed to the passed state
- */
-protected void notifyCheckStateChangeListeners(CheckStateChangedEvent event) {
- Iterator listenersEnum = listeners.iterator();
- while (listenersEnum.hasNext())
- ((ICheckStateListener)listenersEnum.next()).checkStateChanged(event);
-}
-/**
- *Set the contents of the list viewer based upon the specified selected
- *tree element. This also includes checking the appropriate list items.
- *
- *@param treeElement java.lang.Object
- */
-protected void populateListViewer(final Object treeElement) {
- listViewer.setInput(treeElement);
-
- //If the element is white checked but not expanded we have not set up all of the children yet
- if (!(expandedTreeNodes.contains(treeElement))
- && whiteCheckedTreeItems.contains(treeElement)) {
-
- //Potentially long operation - show a busy cursor
- BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
- public void run() {
- setListForWhiteSelection(treeElement);
- listViewer.setAllChecked(true);
- }
- });
-
- } else {
- List listItemsToCheck = (List) checkedStateStore.get(treeElement);
-
- if (listItemsToCheck != null) {
- Iterator listItemsEnum = listItemsToCheck.iterator();
- while (listItemsEnum.hasNext())
- listViewer.setChecked(listItemsEnum.next(), true);
- }
- }
-}
-/**
- * Logically gray-check all ancestors of treeItem by ensuring that they
- * appear in the checked table. Add any elements to the selectedNodes
- * so we can track that has been done.
- */
-private void primeHierarchyForSelection(Object item, Set selectedNodes) {
-
- //Only prime it if we haven't visited yet
- if (selectedNodes.contains(item)) return;
-
- checkedStateStore.put(item, new ArrayList());
-
- //mark as expanded as we are going to populate it after this
- expandedTreeNodes.add(item);
- selectedNodes.add(item);
-
- Object parent = treeContentProvider.getParent(item);
- if (parent != null)
- primeHierarchyForSelection(parent, selectedNodes);
-}
-/**
- * Remove the passed listener from self's collection of clients
- * that listen for changes to element checked states
- *
- * @param listener ICheckStateListener
- */
-public void removeCheckStateListener(ICheckStateListener listener) {
- listeners.remove(listener);
-}
-/**
- * Handle the selection of an item in the tree viewer
- *
- * @param selection ISelection
- */
-public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- Object selectedElement = selection.getFirstElement();
- if (selectedElement == null) {
- currentTreeSelection = null;
- listViewer.setInput(currentTreeSelection);
- return;
- }
-
- // ie.- if not an item deselection
- if (selectedElement != currentTreeSelection)
- populateListViewer(selectedElement);
-
- currentTreeSelection = selectedElement;
-}
-/**
- * Select or deselect all of the elements in the tree depending on the value of the selection
- * boolean. Be sure to update the displayed files as well.
- */
-public void setAllSelections(final boolean selection) {
-
- //If there is no root there is nothing to select
- if(root == null)
- return;
-
- //Potentially long operation - show a busy cursor
- BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
- public void run() {
- setTreeChecked(root, selection);
- listViewer.setAllChecked(selection);
- }
- });
-}
-/**
- * The treeElement has been white selected. Get the list for the element and
- * set it in the checked state store.
- * @param treeElement the element being updated
- */
-private void setListForWhiteSelection(Object treeElement) {
-
- Object[] listItems = listContentProvider.getElements(treeElement);
- List listItemsChecked = new ArrayList();
- for (int i = 0; i < listItems.length; ++i) {
- listItemsChecked.add(listItems[i]);
- }
-
- checkedStateStore.put(treeElement, listItemsChecked);
-}
-/**
- * Set the list viewer's providers to those passed
- *
- * @param contentProvider ITreeContentProvider
- * @param labelProvider ILabelProvider
- */
-public void setListProviders(IStructuredContentProvider contentProvider, ILabelProvider labelProvider) {
- listViewer.setContentProvider(contentProvider);
- listViewer.setLabelProvider(labelProvider);
-}
-/**
- * Set the sorter that is to be applied to self's list viewer
- */
-public void setListSorter(ViewerSorter sorter) {
- listViewer.setSorter(sorter);
-}
-/**
- * Set the root of the widget to be new Root. Regenerate all of the tables and lists from this
- * value.
- * @param newRoot
- */
-public void setRoot(Object newRoot) {
- this.root = newRoot;
- initialize();
-}
-/**
- * Set the checked state of the passed tree element appropriately, and
- * do so recursively to all of its child tree elements as well
- */
-protected void setTreeChecked(Object treeElement, boolean state) {
-
- if (treeElement.equals(currentTreeSelection)) {
- listViewer.setAllChecked(state);
- }
-
- if (state) {
- setListForWhiteSelection(treeElement);
- } else
- checkedStateStore.remove(treeElement);
-
- setWhiteChecked(treeElement, state);
- treeViewer.setChecked(treeElement, state);
- treeViewer.setGrayed(treeElement, false);
-
- // now logically check/uncheck all children as well if it has been expanded
- if (expandedTreeNodes.contains(treeElement)) {
- Object[] children = treeContentProvider.getChildren(treeElement);
- for (int i = 0; i < children.length; ++i) {
- setTreeChecked(children[i], state);
- }
- }
-}
-/**
- * Set the tree viewer's providers to those passed
- *
- * @param contentProvider ITreeContentProvider
- * @param labelProvider ILabelProvider
- */
-public void setTreeProviders(ITreeContentProvider contentProvider, ILabelProvider labelProvider) {
- treeViewer.setContentProvider(contentProvider);
- treeViewer.setLabelProvider(labelProvider);
-}
-/**
- * Set the sorter that is to be applied to self's tree viewer
- */
-public void setTreeSorter(ViewerSorter sorter) {
- treeViewer.setSorter(sorter);
-}
-/**
- * Adjust the collection of references to white-checked tree elements appropriately.
- *
- * @param treeElement java.lang.Object
- * @param isWhiteChecked boolean
- */
-protected void setWhiteChecked(Object treeElement, boolean isWhiteChecked) {
- if (isWhiteChecked) {
- if (!whiteCheckedTreeItems.contains(treeElement))
- whiteCheckedTreeItems.add(treeElement);
- } else
- whiteCheckedTreeItems.remove(treeElement);
-}
-/**
- * Handle the collapsing of an element in a tree viewer
- */
-public void treeCollapsed(TreeExpansionEvent event) {
- // We don't need to do anything with this
-}
-/**
- * Handle the expansionsion of an element in a tree viewer
- */
-public void treeExpanded(TreeExpansionEvent event) {
- expandTreeElement(event.getElement());
-}
-/**
- * Callback that's invoked when the checked status of an item in the tree
- * is changed by the user.
- */
-protected void treeItemChecked(Object treeElement,boolean state) {
-
- // recursively adjust all child tree elements appropriately
- setTreeChecked(treeElement,state);
-
- Object parent = treeContentProvider.getParent(treeElement);
- if (parent == null)
- return;
-
- // now update upwards in the tree hierarchy
- if (state)
- grayCheckHierarchy(parent);
- else
- ungrayCheckHierarchy(parent);
-
- //Update the hierarchy but do not white select the parent
- grayUpdateHierarchy(parent);
-}
-/**
- * Logically un-gray-check all ancestors of treeItem iff appropriate.
- */
-protected void ungrayCheckHierarchy(Object treeElement) {
- if (!determineShouldBeAtLeastGrayChecked(treeElement))
- checkedStateStore.remove(treeElement);
-
- Object parent = treeContentProvider.getParent(treeElement);
- if (parent != null)
- ungrayCheckHierarchy(parent);
-}
-/**
- * Set the checked state of self and all ancestors appropriately
- */
-protected void updateHierarchy(Object treeElement) {
-
- boolean whiteChecked = determineShouldBeWhiteChecked(treeElement);
- boolean shouldBeAtLeastGray = determineShouldBeAtLeastGrayChecked(treeElement);
-
- treeViewer.setChecked(treeElement, shouldBeAtLeastGray);
- setWhiteChecked(treeElement, whiteChecked);
- if (whiteChecked)
- treeViewer.setGrayed(treeElement, false);
- else
- treeViewer.setGrayed(treeElement, shouldBeAtLeastGray);
-
- // proceed up the tree element hierarchy but gray select all of them
- Object parent = treeContentProvider.getParent(treeElement);
- if (parent != null) {
- grayUpdateHierarchy(parent);
- }
-}
-/**
- * Update the selections of the tree elements in items to reflect the new
- * selections provided.
- * @param Map with keys of Object (the tree element) and values of List (the selected
- * list elements). NOTE: This method does not special case keys with no values (i.e.,
- * a tree element with an empty list). If a tree element does not have any selected
- * items, do not include the element in the Map.
- */
-public void updateSelections(Map items) {
- // We are replacing all selected items with the given selected items,
- // so reinitialize everything.
- this.listViewer.setAllChecked(false);
- this.treeViewer.setCheckedElements(new Object[0]);
- this.whiteCheckedTreeItems = new HashSet();
- Set selectedNodes = new HashSet();
- checkedStateStore = new HashMap();
-
- //Update the store before the hierarchy to prevent updating parents before all of the children are done
- Iterator keyIterator = items.keySet().iterator();
- while (keyIterator.hasNext()) {
- Object key = keyIterator.next();
- List selections = (List) items.get(key);
- //Replace the items in the checked state store with those from the supplied items
- checkedStateStore.put(key, selections);
- selectedNodes.add(key);
- // proceed up the tree element hierarchy
- Object parent = treeContentProvider.getParent(key);
- if (parent != null) {
- // proceed up the tree element hierarchy and make sure everything is in the table
- primeHierarchyForSelection(parent, selectedNodes);
- }
- }
-
- // Update the checked tree items. Since each tree item has a selected
- // item, all the tree items will be gray checked.
- treeViewer.setCheckedElements(checkedStateStore.keySet().toArray());
- treeViewer.setGrayedElements(checkedStateStore.keySet().toArray());
-
- // Update the listView of the currently selected tree item.
- if (currentTreeSelection != null) {
- Object displayItems = items.get(currentTreeSelection);
- if (displayItems != null)
- listViewer.setCheckedElements(((List) displayItems).toArray());
- }
-}
-/**
- * Set the focus on to the list widget.
- */
-public void setFocus(){
-
- this.treeViewer.getTree().setFocus();
-}
-
-}
-
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceWorkingSetPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceWorkingSetPage.java
deleted file mode 100644
index 0dedb90..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ResourceWorkingSetPage.java
+++ /dev/null
@@ -1,404 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 International Business Machines Corp. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ui.internal.dialogs;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.dialogs.IWorkingSetPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.model.*;
-
-/**
- * A resource working set page allows the user to edit an
- * existing working set and create a new working set.
- * <p>
- * Working set elements are presented as a simple resource tree.
- * </p>
- *
- * @since 2.0
- */
-public class ResourceWorkingSetPage extends WizardPage implements IWorkingSetPage {
- private final static int SIZING_SELECTION_WIDGET_WIDTH = 50;
- private final static int SIZING_SELECTION_WIDGET_HEIGHT = 200;
-
- private Text text;
- private CheckboxTreeViewer tree;
- private IWorkingSet workingSet;
- private boolean firstCheck = false; // set to true if selection is set in setSelection
-
- /**
- * Creates a new instance of the receiver.
- */
- public ResourceWorkingSetPage() {
- super("resourceWorkingSetPage", WorkbenchMessages.getString("ResourceWorkingSetPage.title"), WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_RESOURCEWORKINGSET_WIZ)); //$NON-NLS-1$ $NON-NLS-2$
- setDescription(WorkbenchMessages.getString("ResourceWorkingSetPage.description")); //$NON-NLS-1$
- }
- /**
- * Overrides method in WizardPage.
- *
- * @see org.eclipse.jface.wizard.WizardPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- Composite composite= new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- setControl(composite);
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.WORKING_SET_RESOURCE_PAGE);
- Label label = new Label(composite, SWT.WRAP);
- label.setText(WorkbenchMessages.getString("ResourceWorkingSetPage.message")); //$NON-NLS-1$
- GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
- label.setLayoutData(data);
-
- text = new Text(composite, SWT.SINGLE | SWT.BORDER);
- text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
- text.addModifyListener(
- new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- validateInput();
- }
- }
- );
- text.setFocus();
-
- label = new Label(composite, SWT.WRAP);
- label.setText(WorkbenchMessages.getString("ResourceWorkingSetPage.label.tree")); //$NON-NLS-1$
- data = new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
- label.setLayoutData(data);
-
- tree = new CheckboxTreeViewer(composite);
- tree.setUseHashlookup(true);
- tree.setContentProvider(new WorkbenchContentProvider());
- tree.setLabelProvider(
- new DecoratingLabelProvider(
- new WorkbenchLabelProvider(),
- WorkbenchPlugin.getDefault().getWorkbench().getDecoratorManager().getLabelDecorator()));
- tree.setInput(WorkbenchPlugin.getPluginWorkspace().getRoot());
- tree.setSorter(new ResourceSorter(ResourceSorter.NAME));
-
- data = new GridData(GridData.FILL_BOTH | GridData.GRAB_VERTICAL);
- data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
- tree.getControl().setLayoutData(data);
-
- tree.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- handleCheckStateChange(event);
- }
- });
-
- tree.addTreeListener(new ITreeViewerListener() {
- public void treeCollapsed(TreeExpansionEvent event) {
- }
- public void treeExpanded(TreeExpansionEvent event) {
- final Object element = event.getElement();
- if (tree.getGrayed(element) == false)
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- setSubtreeChecked((IContainer) element, tree.getChecked(element), false);
- }
- });
- }
- });
- initializeCheckedState();
- disableClosedProjects();
- if (workingSet != null) {
- text.setText(workingSet.getName());
- }
- setPageComplete(false);
- }
- /**
- * Grays all closed projects
- */
- private void disableClosedProjects() {
- IProject[] projects = WorkbenchPlugin.getPluginWorkspace().getRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- if (!projects[i].isOpen())
- tree.setGrayed(projects[i], true);
- }
- }
- /**
- * Collects all checked resources in the specified container.
- *
- * @param checkedResources the output, list of checked resources
- * @param container the container to collect checked resources in
- */
- private void findCheckedResources(List checkedResources, IContainer container) {
- IResource[] resources = null;
- try {
- resources = container.members();
- } catch (CoreException ex) {
- handleCoreException(ex, getShell(), WorkbenchMessages.getString("ResourceWorkingSetPage.error"), //$NON-NLS-1$
- WorkbenchMessages.getString("ResourceWorkingSetPage.error.updateCheckedState")); //$NON-NLS-1$
- }
- for (int i = 0; i < resources.length; i++) {
- if (tree.getGrayed(resources[i])) {
- findCheckedResources(checkedResources, (IContainer) resources[i]);
- } else if (tree.getChecked(resources[i])) {
- checkedResources.add(resources[i]);
- }
- }
- }
- /**
- * Implements IWorkingSetPage.
- *
- * @see org.eclipse.ui.dialogs.IWorkingSetPage#finish()
- */
- public void finish() {
- ArrayList resources = new ArrayList(10);
- findCheckedResources(resources, (IContainer) tree.getInput());
- if (workingSet == null) {
- IWorkingSetManager workingSetManager = WorkbenchPlugin.getDefault().getWorkingSetManager();
- workingSet = workingSetManager.createWorkingSet(getWorkingSetName(), (IAdaptable[]) resources.toArray(new IAdaptable[resources.size()]));
- } else {
- // Add inaccessible resources
- IAdaptable[] oldItems = workingSet.getElements();
-
- for (int i = 0; i < oldItems.length; i++) {
- IResource oldResource = null;
- if (oldItems[i] instanceof IResource) {
- oldResource = (IResource) oldItems[i];
- } else {
- oldResource = (IResource) oldItems[i].getAdapter(IResource.class);
- }
- if (oldResource != null && oldResource.isAccessible() == false) {
- resources.add(oldResource);
- }
- }
- ((WorkingSet) workingSet).setName(getWorkingSetName());
- ((WorkingSet) workingSet).setElements((IAdaptable[]) resources.toArray(new IAdaptable[resources.size()]));
- }
- }
- /**
- * Implements IWorkingSetPage.
- *
- * @see org.eclipse.ui.dialogs.IWorkingSetPage#getSelection()
- */
- public IWorkingSet getSelection() {
- return workingSet;
- }
- /**
- * Returns the name entered in the working set name field.
- *
- * @return the name entered in the working set name field.
- */
- private String getWorkingSetName() {
- return text.getText();
- }
- /**
- * Called when the checked state of a tree item changes.
- *
- * @param event the checked state change event.
- */
- private void handleCheckStateChange(final CheckStateChangedEvent event) {
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- IResource resource = (IResource) event.getElement();
- if (resource.isAccessible() == false) {
- MessageDialog.openInformation(
- getShell(),
- WorkbenchMessages.getString("ResourceWorkingSetPage.projectClosedDialog.title"), //$NON-NLS-1$
- WorkbenchMessages.getString("ResourceWorkingSetPage.projectClosedDialog.message")); //$NON-NLS-1$
- //$NON-NLS-2$ //$NON-NLS-1$
- tree.setChecked(resource, false);
- tree.setGrayed(resource, true);
- return;
- }
- boolean state = event.getChecked();
- tree.setGrayed(resource, false);
- if (resource instanceof IContainer) {
- setSubtreeChecked((IContainer) resource, state, true);
- }
- updateParentState(resource);
- validateInput();
- }
- });
- }
- /**
- * Displays an error message when a CoreException occured.
- *
- * @param exception the CoreException
- * @param shell parent shell for the message box
- * @param title the mesage box title
- * @param message additional error message
- */
- private void handleCoreException(CoreException exception, Shell shell, String title, String message) {
- IStatus status = exception.getStatus();
- if (status != null) {
- ErrorDialog.openError(shell, title, message, status);
- } else {
- MessageDialog.openError(shell, WorkbenchMessages.getString("InternalError"), exception.getLocalizedMessage()); //$NON-NLS-1$
- }
- }
- /**
- * Sets the checked state of tree items based on the initial
- * working set, if any.
- */
- private void initializeCheckedState() {
- if (workingSet == null)
- return;
-
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- IAdaptable[] items = workingSet.getElements();
- tree.setCheckedElements(items);
- for (int i = 0; i < items.length; i++) {
- IAdaptable item = items[i];
- IContainer container = null;
- IResource resource = null;
-
- if (item instanceof IContainer) {
- container = (IContainer) item;
- } else {
- container = (IContainer) item.getAdapter(IContainer.class);
- }
- if (container != null) {
- setSubtreeChecked(container, true, true);
- }
- if (item instanceof IResource) {
- resource = (IResource) item;
- } else {
- resource = (IResource) item.getAdapter(IResource.class);
- }
- updateParentState(resource);
- }
- }
- });
- }
- /**
- * Implements IWorkingSetPage.
- *
- * @see org.eclipse.ui.dialogs.IWorkingSetPage#setSelection(IWorkingSet)
- */
- public void setSelection(IWorkingSet workingSet) {
- Assert.isNotNull(workingSet, "Working set must not be null"); //$NON-NLS-1$
- this.workingSet = workingSet;
- if (getShell() != null && text != null) {
- firstCheck = true;
- initializeCheckedState();
- disableClosedProjects();
- text.setText(workingSet.getName());
- }
- }
- /**
- * Sets the checked state of the container's members.
- *
- * @param container the container whose children should be checked/unchecked
- * @param state true=check all members in the container. false=uncheck all
- * members in the container.
- * @param checkExpandedState true=recurse into sub-containers and set the
- * checked state. false=only set checked state of members of this container
- */
- private void setSubtreeChecked(IContainer container, boolean state, boolean checkExpandedState) {
- if (container.isAccessible() == false || tree.getExpandedState(container) == false && checkExpandedState) {
- return;
- }
- IResource[] members = null;
- try {
- members = container.members();
- } catch (CoreException ex) {
- handleCoreException(ex, getShell(), WorkbenchMessages.getString("ResourceWorkingSetPage.error"), //$NON-NLS-1$
- WorkbenchMessages.getString("ResourceWorkingSetPage.error.updateCheckedState")); //$NON-NLS-1$
- }
- for (int i = members.length - 1; i >= 0; i--) {
- IResource element = members[i];
- if (state) {
- tree.setChecked(element, true);
- tree.setGrayed(element, false);
- } else {
- tree.setGrayChecked(element, false);
- }
- if (element instanceof IContainer) {
- setSubtreeChecked((IContainer) element, state, true);
- }
- }
- }
- /**
- * Check and gray the resource parent if all resources of the
- * parent are checked.
- *
- * @param child the resource whose parent checked state should
- * be set.
- */
- private void updateParentState(IResource child) {
- if (child == null || child.getParent() == null || child.isAccessible() == false)
- return;
-
- IContainer parent = child.getParent();
- boolean childChecked = false;
- IResource[] members = null;
- try {
- members = parent.members();
- } catch (CoreException ex) {
- handleCoreException(ex, getShell(), WorkbenchMessages.getString("ResourceWorkingSetPage.error"), //$NON-NLS-1$
- WorkbenchMessages.getString("ResourceWorkingSetPage.error.updateCheckedState")); //$NON-NLS-1$
- }
- for (int i = members.length - 1; i >= 0; i--) {
- if (tree.getChecked(members[i]) || tree.getGrayed(members[i])) {
- childChecked = true;
- break;
- }
- }
- tree.setGrayChecked(parent, childChecked);
- updateParentState(parent);
- }
- /**
- * Validates the working set name and the checked state of the
- * resource tree.
- */
- private void validateInput() {
- String errorMessage = null; //$NON-NLS-1$
- String newText = text.getText();
-
- if (newText.equals(newText.trim()) == false) {
- errorMessage = WorkbenchMessages.getString("ResourceWorkingSetPage.warning.nameWhitespace"); //$NON-NLS-1$
- }
- else
- if (firstCheck) {
- firstCheck = false;
- return;
- }
- if (newText.equals("")) { //$NON-NLS-1$
- errorMessage = WorkbenchMessages.getString("ResourceWorkingSetPage.warning.nameMustNotBeEmpty"); //$NON-NLS-1$
- }
- if (errorMessage == null && (workingSet == null || newText.equals(workingSet.getName()) == false)) {
- IWorkingSet[] workingSets = WorkbenchPlugin.getDefault().getWorkingSetManager().getWorkingSets();
- for (int i = 0; i < workingSets.length; i++) {
- if (newText.equals(workingSets[i].getName())) {
- errorMessage = WorkbenchMessages.getString("ResourceWorkingSetPage.warning.workingSetExists"); //$NON-NLS-1$
- }
- }
- }
- if (errorMessage == null && tree.getCheckedElements().length == 0) {
- errorMessage = WorkbenchMessages.getString("ResourceWorkingSetPage.warning.resourceMustBeChecked"); //$NON-NLS-1$
- }
- setErrorMessage(errorMessage);
- setPageComplete(errorMessage == null);
- }
-}
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
deleted file mode 100644
index ce703e8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SavePerspectiveDialog.java
+++ /dev/null
@@ -1,264 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.events.*;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-
-/**
- * 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;
- private TableViewer list;
- private Button okButton;
- private PerspectiveRegistry perspReg;
- private String perspName;
- private IPerspectiveDescriptor persp;
- private IPerspectiveDescriptor initialSelection;
- private boolean ignoreSelection = false;
-
- final private static int LIST_WIDTH = 40;
- final private static int TEXT_WIDTH = 40;
- final private static int LIST_HEIGHT = 14;
-/**
- * PerspectiveDialog constructor comment.
- */
-public SavePerspectiveDialog(Shell parentShell, PerspectiveRegistry perspReg) {
- super(parentShell);
- this.perspReg = perspReg;
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(WorkbenchMessages.getString("SavePerspective.shellTitle")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(shell, IHelpContextIds.SAVE_PERSPECTIVE_DIALOG);
-}
-/**
- * Add buttons to the dialog's button bar.
- *
- * @param parent the button bar composite
- */
-protected void createButtonsForButtonBar(Composite parent) {
- okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, 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 the parent composite to contain the dialog area
- * @return the dialog area control
- */
-protected Control createDialogArea(Composite parent) {
- // Run super.
- Composite composite = (Composite)super.createDialogArea(parent);
-
- // description
- Label descLabel = new Label(composite, SWT.WRAP);
- descLabel.setText(WorkbenchMessages.getString("SavePerspectiveDialog.description")); //$NON-NLS-1$
- 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.getString("SavePerspective.name")); //$NON-NLS-1$
- label.setFont(parent.getFont());
-
- // 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.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.getString("SavePerspective.existing")); //$NON-NLS-1$
- label.setFont(parent.getFont());
-
- // Add perspective list.
- list = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- list.setLabelProvider(new PerspLabelProvider());
- list.setContentProvider(new PerspContentProvider());
- list.setSorter(new ViewerSorter() {});
- list.setInput(perspReg);
- list.addSelectionChangedListener(this);
-
- // 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.
- */
-public IPerspectiveDescriptor getPersp() {
- return persp;
-}
-/**
- * Returns the target name.
- */
-public String getPerspName() {
- return perspName;
-}
-/**
- * The user has typed some text.
- */
-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>
- */
-protected void okPressed() {
- perspName = text.getText();
- persp = perspReg.findPerspectiveWithLabel(perspName);
- if (persp != null) {
- // Confirm ok to overwrite
- String message = WorkbenchMessages.format("SavePerspective.overwriteQuestion", new Object[] {perspName}); //$NON-NLS-1$
- String [] buttons= new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL
- };
- MessageDialog d= new MessageDialog(
- this.getShell(),
- WorkbenchMessages.getString("SavePerspective.overwriteTitle"), //$NON-NLS-1$
- null,
- message,
- MessageDialog.QUESTION,
- buttons,
- 0
- );
-
- 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
- */
-public void selectionChanged(SelectionChangedEvent event) {
- // If a selection is caused by modifyText ignore it.
- if (ignoreSelection)
- return;
-
- // Get selection.
- IStructuredSelection sel = (IStructuredSelection)list.getSelection();
- 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));
- }
-}
-}
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
deleted file mode 100644
index 017ce0f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SelectPerspectiveDialog.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.events.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-
-/**
- * A dialog for perspective creation
- */
-public class SelectPerspectiveDialog extends org.eclipse.jface.dialogs.Dialog
- implements ISelectionChangedListener
-{
- private TableViewer list;
- private IPerspectiveRegistry perspReg;
- private IViewDescriptor selection;
- private IPerspectiveDescriptor perspDesc;
- private Button okButton;
- private Button cancelButton;
-
- final private static int LIST_WIDTH = 200;
- final private static int LIST_HEIGHT = 200;
-/**
- * PerspectiveDialog constructor comment.
- */
-public SelectPerspectiveDialog(Shell parentShell, IPerspectiveRegistry perspReg) {
- super(parentShell);
- this.perspReg = perspReg;
-}
-/**
- * Notifies that the cancel button of this dialog has been pressed.
- */
-protected void cancelPressed() {
- perspDesc = null;
- super.cancelPressed();
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(WorkbenchMessages.getString("SelectPerspective.shellTitle")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(shell, IHelpContextIds.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
- */
-protected void createButtonsForButtonBar(Composite parent) {
- okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
-}
-/**
- * Creates and returns the contents of the upper part
- * of this dialog (above the button bar).
- *
- * @param the parent composite to contain the dialog area
- * @return the dialog area control
- */
-protected Control createDialogArea(Composite parent) {
- // Run super.
- Composite composite = (Composite)super.createDialogArea(parent);
-
- // Add perspective list.
- list = new TableViewer(composite, SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- list.setLabelProvider(new PerspLabelProvider());
- list.setContentProvider(new PerspContentProvider());
- list.setSorter(new ViewerSorter() {});
- list.setInput(perspReg);
- list.addSelectionChangedListener(this);
- list.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClickEvent();
- }
- });
-
- // Set list layout.
- Control ctrl = list.getControl();
- GridData spec = new GridData(GridData.FILL_BOTH);
- spec.widthHint = LIST_WIDTH;
- spec.heightHint = LIST_HEIGHT;
- ctrl.setLayoutData(spec);
-
- // Return results.
- return composite;
-}
-/**
- * Returns the current selection.
- */
-public IPerspectiveDescriptor getSelection() {
- return perspDesc;
-}
-/**
- * Handle a double click event on the list
- */
-protected void handleDoubleClickEvent() {
- okPressed();
-}
-/**
- * Notifies that the selection has changed.
- *
- * @param event event object describing the change
- */
-public void selectionChanged(SelectionChangedEvent event) {
- updateSelection();
- updateButtons();
-}
-/**
- * Update the button enablement state.
- */
-protected void updateButtons() {
- okButton.setEnabled(getSelection() != null);
-}
-/**
- * Update the selection object.
- */
-protected void updateSelection() {
- perspDesc = null;
- IStructuredSelection sel = (IStructuredSelection)list.getSelection();
- if (!sel.isEmpty()) {
- Object obj = sel.getFirstElement();
- if (obj instanceof IPerspectiveDescriptor)
- perspDesc = (IPerspectiveDescriptor)obj;
- }
-}
-}
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
deleted file mode 100644
index 5c2bbd5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ShowViewDialog.java
+++ /dev/null
@@ -1,228 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001, 2002.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.*;
-
-/**
- * The Show View dialog.
- */
-public class ShowViewDialog extends org.eclipse.jface.dialogs.Dialog
- implements ISelectionChangedListener, IDoubleClickListener
-{
- private TreeViewer tree;
- private IViewRegistry viewReg;
- private IViewDescriptor[] viewDescs = new IViewDescriptor[0];
- private Button okButton;
- private Button cancelButton;
-
- private static final int LIST_WIDTH = 250;
- private static final int LIST_HEIGHT = 300;
-
- private static final String DIALOG_SETTING_SECTION_NAME = "ShowViewDialog";//$NON-NLS-1$
- private static final String STORE_EXPANDED_CATEGORIES_ID =
- DIALOG_SETTING_SECTION_NAME + ".STORE_EXPANDED_CATEGORIES_ID";//$NON-NLS-1$
-
-/**
- * Constructs a new ShowViewDialog.
- */
-public ShowViewDialog(Shell parentShell, IViewRegistry viewReg) {
- super(parentShell);
- this.viewReg = viewReg;
-}
-
-/**
- * This method is called if a button has been pressed.
- */
-protected void buttonPressed(int buttonId) {
- if (buttonId == IDialogConstants.OK_ID)
- saveWidgetValues();
- super.buttonPressed(buttonId);
-}
-
-/**
- * Notifies that the cancel button of this dialog has been pressed.
- */
-protected void cancelPressed() {
- viewDescs = new IViewDescriptor[0];
- super.cancelPressed();
-}
-
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(WorkbenchMessages.getString("ShowView.shellTitle")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(shell, IHelpContextIds.SHOW_VIEW_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
- */
-protected void createButtonsForButtonBar(Composite parent) {
- okButton = createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- cancelButton = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
-}
-/**
- * Creates and returns the contents of the upper part
- * of this dialog (above the button bar).
- *
- * @param the parent composite to contain the dialog area
- * @return the dialog area control
- */
-protected Control createDialogArea(Composite parent) {
- // Run super.
- Composite composite = (Composite)super.createDialogArea(parent);
-
- // Add perspective list.
- tree = new TreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
- tree.setLabelProvider(new ViewLabelProvider());
- tree.setContentProvider(new ViewContentProvider());
- tree.setSorter(new ViewSorter((ViewRegistry) viewReg));
- tree.setInput(viewReg);
- tree.addSelectionChangedListener(this);
- tree.addDoubleClickListener(this);
-
- // Set tree size.
- Control ctrl = tree.getControl();
- GridData spec = new GridData(GridData.FILL_BOTH);
- spec.widthHint = LIST_WIDTH;
- spec.heightHint = LIST_HEIGHT;
- ctrl.setLayoutData(spec);
-
- // Restore the last state
- restoreWidgetValues();
-
- // Return results.
- return composite;
-}
-/* (non-Javadoc)
- * Method declared on IDoubleClickListener
- */
-public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection s = (IStructuredSelection) event.getSelection();
- Object element = s.getFirstElement();
- if (tree.isExpandable(element)) {
- tree.setExpandedState(element, !tree.getExpandedState(element));
- }
- else if (viewDescs.length > 0) {
- saveWidgetValues();
- setReturnCode(OK);
- close();
- }
-}
-/**
- * Return the dialog store to cache values into
- */
-protected IDialogSettings getDialogSettings() {
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection(DIALOG_SETTING_SECTION_NAME);
- if(section == null)
- section = workbenchSettings.addNewSection(DIALOG_SETTING_SECTION_NAME);
- return section;
-}
-
-/**
- * Returns the descriptors for the selected views.
- */
-public IViewDescriptor[] getSelection() {
- return viewDescs;
-}
-
-/**
- * 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();
- String[] expandedCategoryIds = settings.getArray(STORE_EXPANDED_CATEGORIES_ID);
- if (expandedCategoryIds == null)
- return;
-
- ViewRegistry reg = (ViewRegistry)viewReg;
- ArrayList categoriesToExpand = new ArrayList(expandedCategoryIds.length);
- for (int i = 0; i < expandedCategoryIds.length; i++) {
- ICategory category = reg.findCategory(expandedCategoryIds[i]);
- if (category != null) // ie.- it still exists
- categoriesToExpand.add(category);
- }
-
- if (!categoriesToExpand.isEmpty())
- tree.setExpandedElements(categoriesToExpand.toArray());
-}
-
-/**
- * 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();
-
- // Collect the ids of the all expanded categories
- Object[] expandedElements = tree.getExpandedElements();
- String[] expandedCategoryIds = new String[expandedElements.length];
- for (int i = 0; i < expandedElements.length; ++i)
- expandedCategoryIds[i] = ((ICategory)expandedElements[i]).getId();
-
- // Save them for next time.
- settings.put(
- STORE_EXPANDED_CATEGORIES_ID,
- expandedCategoryIds);
-}
-
-/**
- * Notifies that the selection has changed.
- *
- * @param event event object describing the change
- */
-public void selectionChanged(SelectionChangedEvent event) {
- updateSelection();
- updateButtons();
-}
-
-/**
- * Update the button enablement state.
- */
-protected void updateButtons() {
- okButton.setEnabled(getSelection() != null);
-}
-
-/**
- * Update the selection object.
- */
-protected void updateSelection() {
- ArrayList descs = new ArrayList();
- IStructuredSelection sel = (IStructuredSelection) tree.getSelection();
- for (Iterator i = sel.iterator(); i.hasNext();) {
- Object o = i.next();
- if (o instanceof IViewDescriptor) {
- descs.add(o);
- }
- }
- viewDescs = new IViewDescriptor[descs.size()];
- descs.toArray(viewDescs);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SimpleListContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SimpleListContentProvider.java
deleted file mode 100644
index cdbd2db..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/SimpleListContentProvider.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-/**
- * The SimpleListContentProvider is a class designed to return a static list of items
- * when queried for use in simple list dialogs.
- */
-public class SimpleListContentProvider implements IStructuredContentProvider{
-
- //The elements to display
- private Object[] elements;
-
-/**
- * SimpleListContentProvider constructor comment.
- */
-public SimpleListContentProvider() {
- super();
-}
-/**
- * Do nothing when disposing,
- */
-public void dispose() {}
-/**
- * Returns the elements to display in the viewer. The inputElement is ignored for this
- * provider.
- */
-public Object[] getElements(Object inputElement) {
- return this.elements;
-}
-/**
- * Required method from IStructuredContentProvider. The input is assumed to not change
- * for the SimpleListContentViewer so do nothing here.
- */
-public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
-/**
- * Set the elements to display.
- * @param items Object[]
- */
-public void setElements(Object[] items) {
-
- this.elements = items;
-}
-}
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
deleted file mode 100644
index 03a0045..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/StartupPreferencePage.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-
-public class StartupPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- private Table pluginsList;
- private Workbench workbench;
-
- /**
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
- WorkbenchHelp.setHelp(parent, IHelpContextIds.STARTUP_PREFERENCE_PAGE);
-
- Font font = parent.getFont();
-
- 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(font);
-
- Label label = new Label(composite,SWT.NONE);
- label.setText(WorkbenchMessages.getString("StartupPreferencePage.label")); //$NON-NLS-1$
- label.setFont(font);
- data = new GridData(GridData.FILL_HORIZONTAL);
- label.setLayoutData(data);
- pluginsList = new Table(composite,SWT.BORDER | SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL);
- data = new GridData(GridData.FILL_BOTH);
- pluginsList.setFont(font) ;
- pluginsList.setLayoutData(data);
- populatePluginsList();
-
- return composite;
- }
- private void populatePluginsList() {
- IPluginDescriptor descriptors[] = workbench.getEarlyActivatedPlugins();
- IPreferenceStore store = workbench.getPreferenceStore();
- String pref = store.getString(IPreferenceConstants.PLUGINS_NOT_ACTIVATED_ON_STARTUP);
- if(pref == null)
- pref = new String();
- for (int i = 0; i < descriptors.length; i++) {
- IPluginDescriptor desc = descriptors[i];
- TableItem item = new TableItem(pluginsList,SWT.NONE);
- item.setText(desc.getLabel());
- item.setData(desc);
- String id = desc.getUniqueIdentifier() + IPreferenceConstants.SEPARATOR;
- item.setChecked(pref.indexOf(id) < 0);
- }
- }
- /**
- * @see IWorkbenchPreferencePage
- */
- public void init(IWorkbench workbench) {
- this.workbench = (Workbench)workbench;
- }
- /**
- * @see PreferencePage
- */
- protected void performDefaults() {
- TableItem items[] = pluginsList.getItems();
- for (int i = 0; i < items.length; i++) {
- items[i].setChecked(true);
- }
- }
- /**
- * @see PreferencePage
- */
- public boolean performOk() {
- StringBuffer preference = new StringBuffer();
- TableItem items[] = pluginsList.getItems();
- for (int i = 0; i < items.length; i++) {
- if(!items[i].getChecked()) {
- IPluginDescriptor descriptor = (IPluginDescriptor)items[i].getData();
- preference.append(descriptor.getUniqueIdentifier());
- preference.append(IPreferenceConstants.SEPARATOR);
- }
- }
- String pref = preference.toString();
- IPreferenceStore store = workbench.getPreferenceStore();
- store.putValue(IPreferenceConstants.PLUGINS_NOT_ACTIVATED_ON_STARTUP,pref);
- return true;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/UpdateProjectCapabilityWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/UpdateProjectCapabilityWizard.java
deleted file mode 100644
index 24487ed..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/UpdateProjectCapabilityWizard.java
+++ /dev/null
@@ -1,234 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.registry.Capability;
-import org.eclipse.ui.internal.registry.CapabilityRegistry;
-
-/**
- * Standard workbench wizard that guides the user to supply
- * the necessary information to configure new capabilities
- * on an existing project.
- */
-public class UpdateProjectCapabilityWizard extends MultiStepCapabilityWizard {
- private IProject project;
- private Capability[] addCapabilities;
- private Capability[] removeCapabilities;
-
- /**
- * Creates a wizard.
- *
- * @param project the project to configure new capabilities
- * @param addCapabilities the new capabilities to configure on the project
- * @param removeCapabilities the old capabilities to remove from the project
- * in reverse order (first item last to be removed)
- */
- public UpdateProjectCapabilityWizard(IProject project, Capability[] addCapabilities, Capability[] removeCapabilities) {
- super();
- this.project = project;
- this.addCapabilities = addCapabilities;
- this.removeCapabilities = removeCapabilities;
- initializeDefaultPageImageDescriptor();
- setWindowTitle(WorkbenchMessages.getString("UpdateProjectCapabilityWizard.windowTitle")); //$NON-NLS-1$
- }
-
- /**
- * Builds the collection of steps
- */
- private void buildSteps() {
- int stepNumber = 1;
- ArrayList steps = new ArrayList(removeCapabilities.length + addCapabilities.length);
-
- // collect the minimum remove capability steps
- if (removeCapabilities.length > 0) {
- // Reserve the order so prereq aren't removed before dependents
- for (int i = removeCapabilities.length - 1; i >= 0; i--) {
- if (removeCapabilities[i] != null) {
- // Collect all the nature ids this capability should
- // remove. Includes itself and any ones that it
- // handles the ui for.
- ArrayList natureIds = new ArrayList();
- natureIds.add(removeCapabilities[i].getNatureId());
- ArrayList uiIds = removeCapabilities[i].getHandleUIs();
- if (uiIds != null) {
- Iterator enum = uiIds.iterator();
- while (enum.hasNext()) {
- String id = (String)enum.next();
- for (int j = 0; j < removeCapabilities.length; j++) {
- if (removeCapabilities[j] != null) {
- if (removeCapabilities[j].getId().equals(id)) {
- natureIds.add(removeCapabilities[j].getNatureId());
- removeCapabilities[j] = null;
- }
- }
- }
- }
- }
- // Create a step to remove this capability and prereq natures
- String[] ids = new String[natureIds.size()];
- natureIds.toArray(ids);
- steps.add(new RemoveCapabilityStep(stepNumber, removeCapabilities[i], ids, project));
- stepNumber++;
- }
- }
- }
-
- // Collect the minimum add capability steps
- if (addCapabilities.length > 0) {
- IWorkbench workbench = PlatformUI.getWorkbench();
- CapabilityRegistry reg = WorkbenchPlugin.getDefault().getCapabilityRegistry();
- Capability[] results = reg.pruneCapabilities(addCapabilities);
- for (int i = 0; i < results.length; i++, stepNumber++)
- steps.add(new InstallCapabilityStep(stepNumber, results[i], workbench, this));
- }
-
- // Set the list of steps to do
- WizardStep[] results = new WizardStep[steps.size()];
- steps.toArray(results);
- setSteps(results);
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected void addCustomPages() {
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected boolean canFinishOnReviewPage() {
- WizardStep[] steps = getSteps();
- // yes if the only step is to remove capabilities
- return steps.length == 1
- && steps[0] instanceof RemoveCapabilityStep;
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected String getConfigurePageTitle() {
- return WorkbenchMessages.getString("UpdateProjectCapabilityWizard.title"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected String getConfigurePageDescription() {
- return WorkbenchMessages.getString("WizardProjectConfigurePage.description"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected String getFinishStepLabel(WizardStep[] steps) {
- int count = 0;
- for (int i = 0; i < steps.length; i++) {
- if (!(steps[i] instanceof RemoveCapabilityStep)) {
- count++;
- if (count > 1)
- return super.getFinishStepLabel(steps);
- }
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected String[] getPerspectiveChoices() {
- ArrayList results = new ArrayList();
- for (int i = 0; i < addCapabilities.length; i++) {
- ArrayList ids = addCapabilities[i].getPerspectiveChoices();
- if (ids != null) {
- Iterator enum = ids.iterator();
- while (enum.hasNext()) {
- String id = (String)enum.next();
- if (!results.contains(id))
- results.add(id);
- }
- }
- }
- String[] ids = new String[results.size()];
- results.toArray(ids);
- return ids;
- }
-
- /* (non-Javadoc)
- * Method declared on IProjectProvider.
- */
- public IProject getProject() {
- return project;
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected String getReviewPageTitle() {
- return WorkbenchMessages.getString("UpdateProjectCapabilityWizard.title"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- protected String getReviewPageDescription() {
- return WorkbenchMessages.getString("WizardProjectReviewPage.description"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public IWizardPage getStartingPage() {
- IWizardPage page = super.getStartingPage();
- buildSteps();
- return page;
- }
-
- /* (non-Javadoc)
- * Method declared on MultiStepWizard.
- */
- /* package */ boolean handleMissingStepWizard(WizardStep step) {
- MessageDialog.openError(
- getShell(),
- WorkbenchMessages.getString("UpdateProjectCapabilityWizard.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("UpdateProjectCapabilityWizard.noWizard", new Object[] {step.getLabel()})); //$NON-NLS-1$
- return false;
- }
-
- /**
- * Sets the image banner for the wizard
- */
- protected void initializeDefaultPageImageDescriptor() {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- URL installURL = WorkbenchPlugin.getDefault().getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + "wizban/newprj_wiz.gif");//$NON-NLS-1$
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- setDefaultPageImageDescriptor(desc);
- }
- catch (MalformedURLException e) {
- // Should not happen. Ignore.
- }
- }
-}
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
deleted file mode 100644
index 08a949c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewContentProvider.java
+++ /dev/null
@@ -1,67 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.jface.viewers.*;
-import java.util.*;
-
-public class ViewContentProvider implements ITreeContentProvider {
-/**
- * PerspContentProvider constructor comment.
- */
-public ViewContentProvider() {
- super();
-}
-public void dispose() {
-}
-/**
- * Returns the child elements of the given parent element.
- */
-public Object[] getChildren(Object element) {
- if (element instanceof IViewRegistry) {
- IViewRegistry reg = (IViewRegistry)element;
- return reg.getCategories();
- } else if (element instanceof ICategory) {
- ArrayList list = ((ICategory)element).getElements();
- if (list != null) {
- return list.toArray();
- } else {
- return new Object[0];
- }
- }
- return new Object[0];
-}
-/**
- * Return the children of an element.
- */
-public Object[] getElements(Object element) {
- return getChildren(element);
-}
-/**
- * Returns the parent for the given element, or <code>null</code>
- * indicating that the parent can't be computed.
- */
-public Object getParent(Object element) {
- return null;
-}
-/**
- * Returns whether the given element has children.
- */
-public boolean hasChildren(java.lang.Object element) {
- if (element instanceof IViewRegistry)
- return true;
- else if (element instanceof ICategory)
- return true;
- return false;
-}
-public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-}
-public boolean isDeleted(Object element) {
- return false;
-}
-}
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
deleted file mode 100644
index e29bcbd..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewLabelProvider.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.resource.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.registry.*;
-import java.util.HashMap;
-import java.util.Iterator;
-
-public class ViewLabelProvider extends LabelProvider {
- private HashMap images;
-Image cacheImage(ImageDescriptor desc) {
- if (images == null)
- images = new HashMap(21);
- Image image = (Image) images.get(desc);
- if (image == null) {
- image = desc.createImage();
- images.put(desc, image);
- }
- return image;
-}
-public void dispose() {
- if (images != null) {
- for (Iterator i = images.values().iterator(); i.hasNext();) {
- ((Image) i.next()).dispose();
- }
- images = null;
- }
- super.dispose();
-}
-public Image getImage(Object element) {
- if (element instanceof IViewDescriptor) {
- ImageDescriptor desc = ((IViewDescriptor)element).getImageDescriptor();
- if (desc != null)
- return cacheImage(desc);
- } else if (element instanceof ICategory) {
- ImageDescriptor desc = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- return cacheImage(desc);
- }
- return null;
-}
-public String getText(Object element) {
- String label = WorkbenchMessages.getString("ViewLabel.unknown"); //$NON-NLS-1$
- if (element instanceof ICategory)
- label = ((ICategory)element).getLabel();
- else if (element instanceof IViewDescriptor)
- label = ((ViewDescriptor)element).getLabel();
- return DialogUtil.removeAccel(label);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewSorter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewSorter.java
deleted file mode 100644
index d623cb9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewSorter.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.jface.viewers.*;
-
-/**
- * This is used to sort views in a ShowViewDialog.
- */
-public class ViewSorter extends ViewerSorter {
- private ViewRegistry viewReg;
-/**
- * ViewSorter constructor comment.
- */
-public ViewSorter(ViewRegistry reg) {
- super();
- viewReg = reg;
-}
-/**
- * Returns a negative, zero, or positive number depending on whether
- * the first element is less than, equal to, or greater than
- * the second element.
- */
-public int compare(Viewer viewer, Object e1, Object e2) {
- if (e1 instanceof IViewDescriptor) {
- String str1 = DialogUtil.removeAccel(((IViewDescriptor)e1).getLabel());
- String str2 = DialogUtil.removeAccel(((IViewDescriptor)e2).getLabel());
- return collator.compare(str1, str2);
- } else if (e1 instanceof ICategory) {
- if (e1 == viewReg.getMiscCategory())
- return 1;
- if (e2 == viewReg.getMiscCategory())
- return -1;
- String str1 = DialogUtil.removeAccel(((ICategory)e1).getLabel());
- String str2 = DialogUtil.removeAccel(((ICategory)e2).getLabel());
- return collator.compare(str1, str2);
- }
- return 0;
-}
-}
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
deleted file mode 100644
index 3f8eb71..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ViewsPreferencePage.java
+++ /dev/null
@@ -1,328 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-/**
- * The ViewsPreferencePage is the page used to set preferences for the look of the
- * views in the workbench.
- */
-public class ViewsPreferencePage
- extends PreferencePage
- implements IWorkbenchPreferencePage {
- private Button editorTopButton;
- private Button editorBottomButton;
- private Button viewTopButton;
- private Button viewBottomButton;
-
- private ColorFieldEditor errorColorEditor;
- private ColorFieldEditor hyperlinkColorEditor;
- private ColorFieldEditor activeHyperlinkColorEditor;
- /*
- * No longer supported - removed when confirmed!
- * private Button openFloatButton;
- */
- private int editorAlignment;
- private int viewAlignment;
-
- private static final String EDITORS_TITLE = WorkbenchMessages.getString("ViewsPreference.editors"); //$NON-NLS-1$
- private static final String EDITORS_TOP_TITLE = WorkbenchMessages.getString("ViewsPreference.editors.top"); //$NON-NLS-1$
- private static final String EDITORS_BOTTOM_TITLE = WorkbenchMessages.getString("ViewsPreference.editors.bottom"); //$NON-NLS-1$
- private static final String VIEWS_TITLE = WorkbenchMessages.getString("ViewsPreference.views"); //$NON-NLS-1$
- private static final String VIEWS_TOP_TITLE = WorkbenchMessages.getString("ViewsPreference.views.top"); //$NON-NLS-1$
- private static final String VIEWS_BOTTOM_TITLE = WorkbenchMessages.getString("ViewsPreference.views.bottom"); //$NON-NLS-1$
- /*
- * No longer supported - remove when confirmed!
- * private static final String OVM_FLOAT = WorkbenchMessages.getString("OpenViewMode.float"); //$NON-NLS-1$
- */
- private static final String NOTE_LABEL = WorkbenchMessages.getString("Preference.note"); //$NON-NLS-1$
- private static final String APPLY_MESSAGE = WorkbenchMessages.getString("ViewsPreference.applyMessage"); //$NON-NLS-1$
-/**
- * Create a composite that for creating the tab toggle buttons.
- * @param composite Composite
- * @param title String
- */
-private Group createButtonGroup(Composite composite, String title) {
-
- Group buttonComposite = new Group(composite, SWT.LEFT);
- buttonComposite.setText(title);
- buttonComposite.setFont(composite.getFont());
- GridLayout layout = new GridLayout();
- buttonComposite.setLayout(layout);
- GridData data =
- new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- buttonComposite.setLayoutData(data);
-
- return buttonComposite;
-
-}
-/**
- * Creates and returns the SWT control for the customized body
- * of this preference page under the given parent composite.
- * <p>
- * This framework method must be implemented by concrete
- * subclasses.
- * </p>
- *
- * @param parent the parent composite
- * @return the new control
- */
-protected Control createContents(Composite parent) {
-
- Font font = parent.getFont();
-
- WorkbenchHelp.setHelp(parent, IHelpContextIds.VIEWS_PREFERENCE_PAGE);
-
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- editorAlignment = store.getInt(IPreferenceConstants.EDITOR_TAB_POSITION);
- viewAlignment = store.getInt(IPreferenceConstants.VIEW_TAB_POSITION);
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayoutData(
- new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
- composite.setFont(font);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.verticalSpacing = 10;
-
- composite.setLayout(layout);
-
- createEditorTabButtonGroup(composite);
- createViewTabButtonGroup(composite);
-
- Composite messageComposite = new Composite(composite, SWT.NONE);
- GridLayout messageLayout = new GridLayout();
- messageLayout.numColumns = 2;
- messageLayout.marginWidth = 0;
- messageLayout.marginHeight = 0;
- messageComposite.setLayout(messageLayout);
- messageComposite.setLayoutData(
- new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- messageComposite.setFont(font);
-
- final Label noteLabel = new Label(messageComposite,SWT.BOLD);
- noteLabel.setText(NOTE_LABEL);
- noteLabel.setFont(JFaceResources.getBannerFont());
- noteLabel.setLayoutData(
- new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
-
- final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if(JFaceResources.BANNER_FONT.equals(event.getProperty())) {
- noteLabel.setFont(JFaceResources.getFont(JFaceResources.BANNER_FONT));
- }
- }
- };
- JFaceResources.getFontRegistry().addListener(fontListener);
- noteLabel.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- JFaceResources.getFontRegistry().removeListener(fontListener);
- }
- });
-
- Label messageLabel = new Label(messageComposite,SWT.NONE);
- messageLabel.setText(APPLY_MESSAGE);
- messageLabel.setFont(font);
-
- new Label(composite, SWT.NONE);
-
- Group colorComposite = new Group(composite,SWT.NONE);
- colorComposite.setLayout(new GridLayout());
- colorComposite.setText(WorkbenchMessages.getString("ViewsPreference.ColorsTitle")); //$NON-NLS-1$
- colorComposite.setFont(font);
-
- GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- colorComposite.setLayoutData(data);
-
- //Add in an intermediate composite to allow for spacing
- Composite spacingComposite = new Composite(colorComposite,SWT.NONE);
- spacingComposite.setLayout(new GridLayout());
- spacingComposite.setFont(font);
-
- errorColorEditor = new ColorFieldEditor(
- JFacePreferences.ERROR_COLOR,
- WorkbenchMessages.getString("ViewsPreference.ErrorText"), //$NON-NLS-1$,
- spacingComposite);
-
- errorColorEditor.setPreferenceStore(doGetPreferenceStore());
- errorColorEditor.load();
-
- hyperlinkColorEditor = new ColorFieldEditor(
- JFacePreferences.HYPERLINK_COLOR,
- WorkbenchMessages.getString("ViewsPreference.HyperlinkText"), //$NON-NLS-1$
- spacingComposite);
-
- hyperlinkColorEditor.setPreferenceStore(doGetPreferenceStore());
- hyperlinkColorEditor.load();
-
- activeHyperlinkColorEditor = new ColorFieldEditor(
- JFacePreferences.ACTIVE_HYPERLINK_COLOR,
- WorkbenchMessages.getString("ViewsPreference.ActiveHyperlinkText"), //$NON-NLS-1$
- spacingComposite);
-
- activeHyperlinkColorEditor.setPreferenceStore(doGetPreferenceStore());
- activeHyperlinkColorEditor.load();
-
- return composite;
-}
-/**
- * Create a composite that contains buttons for selecting tab position for the edit selection.
- * @param composite Composite
- * @param store IPreferenceStore
- */
-private void createEditorTabButtonGroup(Composite composite) {
-
- Font font = composite.getFont();
-
- Group buttonComposite = createButtonGroup(composite,EDITORS_TITLE);
-
- this.editorTopButton = new Button(buttonComposite, SWT.RADIO);
- this.editorTopButton.setText(EDITORS_TOP_TITLE);
- this.editorTopButton.setSelection(this.editorAlignment == SWT.TOP);
- this.editorTopButton.setFont(font);
-
- this.editorTopButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- editorAlignment = SWT.TOP;
- }
- });
-
- this.editorTopButton.getAccessible().addAccessibleListener(new AccessibleAdapter() {
- public void getName(AccessibleEvent e) {
- e.result = EDITORS_TITLE;
- }
- });
-
- this.editorBottomButton = new Button(buttonComposite, SWT.RADIO);
- this.editorBottomButton.setText(EDITORS_BOTTOM_TITLE);
- this.editorBottomButton.setSelection(this.editorAlignment == SWT.BOTTOM);
- this.editorBottomButton.setFont(font);
-
- this.editorBottomButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- editorAlignment = SWT.BOTTOM;
- }
- });
-
-}
-
-/**
- * Create a composite that contains buttons for selecting tab position for the view selection.
- * @param composite Composite
- * @param store IPreferenceStore
- */
-private void createViewTabButtonGroup(Composite composite) {
-
- Font font = composite.getFont();
-
- Group buttonComposite = createButtonGroup(composite,VIEWS_TITLE);
- buttonComposite.setFont(font);
-
- this.viewTopButton = new Button(buttonComposite, SWT.RADIO);
- this.viewTopButton.setText(VIEWS_TOP_TITLE);
- this.viewTopButton.setSelection(this.viewAlignment == SWT.TOP);
- this.viewTopButton.setFont(font);
-
- this.viewTopButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- viewAlignment = SWT.TOP;
- }
- });
-
- this.viewBottomButton = new Button(buttonComposite, SWT.RADIO);
- this.viewBottomButton.setText(VIEWS_BOTTOM_TITLE);
- this.viewBottomButton.setSelection(this.viewAlignment == SWT.BOTTOM);
- this.viewBottomButton.setFont(font);
-
- this.viewBottomButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- viewAlignment = SWT.BOTTOM;
- }
- });
-
-}
-/**
- * Returns preference store that belongs to the our plugin.
- *
- * @return the preference store for this plugin
- */
-protected IPreferenceStore doGetPreferenceStore() {
- return WorkbenchPlugin.getDefault().getPreferenceStore();
-}
-/**
- * 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
- */
-public void init(org.eclipse.ui.IWorkbench workbench) {}
-/**
- * The default button has been pressed.
- */
-protected void performDefaults() {
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- int editorTopValue =
- store.getDefaultInt(IPreferenceConstants.EDITOR_TAB_POSITION);
- editorTopButton.setSelection(editorTopValue == SWT.TOP);
- editorBottomButton.setSelection(editorTopValue == SWT.BOTTOM);
- editorAlignment = editorTopValue;
-
- int viewTopValue =
- store.getDefaultInt(IPreferenceConstants.VIEW_TAB_POSITION);
- viewTopButton.setSelection(viewTopValue == SWT.TOP);
- viewBottomButton.setSelection(viewTopValue == SWT.BOTTOM);
- viewAlignment = viewTopValue;
-
- errorColorEditor.loadDefault();
- hyperlinkColorEditor.loadDefault();
- activeHyperlinkColorEditor.loadDefault();
-
- /*
- * No longer supported - remove when confirmed!
- * if (openFloatButton != null)
- * openFloatButton.setSelection(value == IPreferenceConstants.OVM_FLOAT);
- */
-
- WorkbenchPlugin.getDefault().savePluginPreferences();
- super.performDefaults();
-}
-/**
- * The user has pressed Ok. Store/apply this page's values appropriately.
- */
-public boolean performOk() {
- IPreferenceStore store = getPreferenceStore();
-
- // store the editor tab value to setting
- store.setValue(IPreferenceConstants.EDITOR_TAB_POSITION, editorAlignment);
-
- // store the view tab value to setting
- store.setValue(IPreferenceConstants.VIEW_TAB_POSITION, viewAlignment);
-
- errorColorEditor.store();
- hyperlinkColorEditor.store();
- activeHyperlinkColorEditor.store();
- return true;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeEditor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeEditor.java
deleted file mode 100644
index bc2d63a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeEditor.java
+++ /dev/null
@@ -1,799 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.preference.JFacePreferences;
-import org.eclipse.jface.resource.JFaceColors;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.part.EditorPart;
-
-/**
- * A "fake" editor to show a welcome page
- * The contents of this page are supplied in the product configuration
- *
- * @private
- * This class is internal to the workbench and must not be called outside the workbench
- */
-public class WelcomeEditor extends EditorPart {
-
- private final static int HORZ_SCROLL_INCREMENT = 20;
- private final static int VERT_SCROLL_INCREMENT = 20;
- // width at which wrapping will stop and a horizontal scroll bar will be
- // introduced
- private final static int WRAP_MIN_WIDTH = 150;
-
- private Composite editorComposite;
-
- private Cursor handCursor;
- private Cursor busyCursor;
-
- private IWorkbench workbench;
- private WelcomeParser parser;
- private Image image;
-
- private ArrayList hyperlinkRanges = new ArrayList();
- private ArrayList texts = new ArrayList();
- private ScrolledComposite scrolledComposite;
-
- private IPropertyChangeListener colorListener;
- private boolean mouseDown = false;
- private boolean dragEvent = false;
-
- private StyledText firstText, lastText;
- private boolean nextTabAbortTraversal, previousTabAbortTraversal = false;
-
-
-/**
- * Create a new instance of the welcome editor
- */
-public WelcomeEditor() {
- super();
- setTitle(WorkbenchMessages.getString("WelcomeEditor.title")); //$NON-NLS-1$
-}
-
-/**
- * Update the welcome page to start at the
- * beginning of the text.
- */
-private void focusOn(StyledText newText, int caretOffset){
- if(newText == null)
- return;
- newText.setFocus();
- newText.setCaretOffset(caretOffset);
- scrolledComposite.setOrigin(0,newText.getLocation().y);
-}
-
-/**
- * Find the next text
- */
-private StyledText nextText(StyledText text){
- int index = 0;
- if(text == null)
- return (StyledText) texts.get(0);
- else
- index = texts.indexOf(text);
-
- //If we are not at the end....
- if(index < texts.size() - 1)
- return (StyledText) texts.get(index + 1);
- else
- return (StyledText) texts.get(0);
-}
-
-/**
- * Find the previous text
- */
-private StyledText previousText(StyledText text){
- int index = 0;
- if(text == null)
- return (StyledText) texts.get(0);
- else
- index = texts.indexOf(text);
-
- //If we are at the beginning....
- if(index == 0)
- return (StyledText) texts.get(texts.size() - 1);
- else
- return (StyledText) texts.get(index - 1);
-}
-
-/**
- * Find the next link after the current selection.
- */
-private StyleRange findNextLink(StyledText text) {
- if(text == null)
- return null;
-
- WelcomeItem item = (WelcomeItem)text.getData();
- StyleRange[] ranges = text.getStyleRanges();
- int currentSelectionEnd = text.getSelection().y;
-
- for (int i = 0; i < ranges.length; i++) {
- if(ranges[i].start >= currentSelectionEnd)
- if (item.isLinkAt(ranges[i].start))
- return ranges[i];
- }
- return null;
-}
-
-/**
- * Find the previous link before the current selection.
- */
-private StyleRange findPreviousLink(StyledText text) {
- if(text == null)
- return null;
-
- WelcomeItem item = (WelcomeItem)text.getData();
- StyleRange[] ranges = text.getStyleRanges();
- int currentSelectionStart = text.getSelection().x;
-
- for (int i = ranges.length - 1; i > -1; i--) {
- if((ranges[i].start + ranges[i].length) < currentSelectionStart)
- if (item.isLinkAt(ranges[i].start + ranges[i].length - 1))
- return ranges[i];
- }
- return null;
-}
-/**
- * Adds listeners to the given styled text
- */
-private void addListeners(StyledText styledText) {
- styledText.addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- if (e.button != 1) {
- return;
- }
- mouseDown = true;
- }
- public void mouseUp(MouseEvent e) {
- mouseDown = false;
- StyledText text = (StyledText)e.widget;
- WelcomeItem item = (WelcomeItem)e.widget.getData();
- int offset = text.getCaretOffset();
- if (dragEvent) {
- dragEvent = false;
- if (item.isLinkAt(offset)) {
- text.setCursor(handCursor);
- }
- } else if (item.isLinkAt(offset)) {
- text.setCursor(busyCursor);
- item.triggerLinkAt(offset);
- text.setCursor(null);
- }
- }
- });
-
- styledText.addMouseMoveListener(new MouseMoveListener() {
- public void mouseMove(MouseEvent e) {
- // Do not change cursor on drag events
- if (mouseDown) {
- if (!dragEvent) {
- StyledText text = (StyledText)e.widget;
- text.setCursor(null);
- }
- dragEvent = true;
- return;
- }
- StyledText text = (StyledText)e.widget;
- WelcomeItem item = (WelcomeItem)e.widget.getData();
- int offset = -1;
- try {
- offset = text.getOffsetAtLocation(new Point(e.x, e.y));
- } catch (IllegalArgumentException ex) {
- // location is not over a character
- }
- if (offset == -1)
- text.setCursor(null);
- else if (item.isLinkAt(offset))
- text.setCursor(handCursor);
- else
- text.setCursor(null);
- }
- });
-
- styledText.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- StyledText text = (StyledText)e.widget;
-
- switch (e.detail) {
- case SWT.TRAVERSE_ESCAPE:
- e.doit = true;
- break;
- case SWT.TRAVERSE_TAB_NEXT:
- // Handle Ctrl-Tab
- if ((e.stateMask & SWT.CTRL) != 0) {
- if (e.widget == lastText)
- return;
- else {
- e.doit = false;
- nextTabAbortTraversal = true;
- lastText.traverse(SWT.TRAVERSE_TAB_NEXT);
- return;
- }
- }
- if (nextTabAbortTraversal) {
- nextTabAbortTraversal = false;
- return;
- }
- // Find the next link in current widget, if applicable
- // Stop at top of widget
- StyleRange nextLink = findNextLink(text);
- if (nextLink == null) {
- // go to the next widget, focus at beginning
- StyledText nextText = nextText(text);
- nextText.setSelection(0);
- focusOn(nextText,0);
- }
- else {
- // focusOn: allow none tab traversals to align
- focusOn(text, text.getSelection().x);
- text.setSelectionRange(nextLink.start, nextLink.length);
- }
- e.detail = SWT.TRAVERSE_NONE;
- e.doit = true;
- break;
- case SWT.TRAVERSE_TAB_PREVIOUS:
- // Handle Ctrl-Shift-Tab
- if ((e.stateMask & SWT.CTRL) != 0) {
- if (e.widget == firstText)
- return;
- else {
- e.doit = false;
- previousTabAbortTraversal = true;
- firstText.traverse(SWT.TRAVERSE_TAB_PREVIOUS);
- return;
- }
- }
- if (previousTabAbortTraversal) {
- previousTabAbortTraversal = false;
- return;
- }
- // Find the previous link in current widget, if applicable
- // Stop at top of widget also
- StyleRange previousLink = findPreviousLink(text);
- if (previousLink == null) {
- if (text.getSelection().x == 0) {
- // go to the previous widget, focus at end
- StyledText previousText = previousText(text);
- previousText.setSelection(previousText.getCharCount());
- previousLink = findPreviousLink(previousText);
- if (previousLink == null)
- focusOn(previousText,0);
- else {
- focusOn(previousText, previousText.getSelection().x);
- previousText.setSelectionRange(previousLink.start, previousLink.length);
- }
- }
- else {
- // stay at top of this widget
- focusOn(text, 0);
- }
- }
- else {
- // focusOn: allow none tab traversals to align
- focusOn(text, text.getSelection().x);
- text.setSelectionRange(previousLink.start, previousLink.length);
- }
- e.detail = SWT.TRAVERSE_NONE;
- e.doit = true;
- break;
- default:
- break;
- }
- }
- });
-
- styledText.addKeyListener(new KeyListener() {
- public void keyReleased(KeyEvent e){
- //Ignore a key release
- }
- public void keyPressed (KeyEvent event){
- StyledText text = (StyledText)event.widget;
- if(event.character == ' ' || event.character == SWT.CR){
- if(text != null) {
- WelcomeItem item = (WelcomeItem)text.getData();
-
- //Be sure we are in the selection
- int offset = text.getSelection().x + 1;
-
- if (item.isLinkAt(offset)) {
- text.setCursor(busyCursor);
- item.triggerLinkAt(offset);
- text.setCursor(null);
- }
- }
- return;
- }
-
- // When page down is pressed, move the cursor to the next item in the
- // welcome page. Note that this operation wraps (pages to the top item
- // when the last item is reached).
- if(event.keyCode == SWT.PAGE_DOWN){
- focusOn(nextText(text),0);
- return;
- }
-
- // When page up is pressed, move the cursor to the previous item in the
- // welcome page. Note that this operation wraps (pages to the bottom item
- // when the first item is reached).
- if(event.keyCode == SWT.PAGE_UP){
- focusOn(previousText(text),0);
- return;
- }
- }
- });
-
- styledText.addFocusListener(new FocusAdapter() {
- // Handle mouse events, retain current position, remove highlights
- public void focusLost(FocusEvent e) {
- StyledText text = (StyledText)e.widget;
- text.setSelection(text.getSelection().x);
- }
-});
-
-}
-
-/**
- * Creates the wizard's title area.
- *
- * @param parent the SWT parent for the title area composite
- * @return the created info area composite
- */
-private Composite createInfoArea(Composite parent) {
- // Create the title area which will contain
- // a title, message, and image.
- this.scrolledComposite = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
- this.scrolledComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- final Composite infoArea = new Composite(this.scrolledComposite, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 10;
- layout.verticalSpacing = 5;
- layout.numColumns = 2;
- infoArea.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- infoArea.setLayoutData(data);
- boolean wrapped = parser.isFormatWrapped();
-
- if (wrapped) {
- scrolledComposite.addListener(SWT.Resize, new Listener() {
- public void handleEvent(Event event) {
- // in the wrapped case the height of the StyledText widgets will change as
- // the width of the info area changes, so recompute the height
- Point p = infoArea.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- scrolledComposite.setMinHeight(p.y);
- }
- });
- }
-
- // Get the background color for the title area
- Display display = parent.getDisplay();
- Color background = JFaceColors.getBannerBackground(display);
- Color foreground = JFaceColors.getBannerForeground(display);
- infoArea.setBackground(background);
-
- int textStyle = SWT.MULTI | SWT.READ_ONLY;
- if (wrapped) {
- textStyle = textStyle | SWT.WRAP;
- }
- StyledText sampleStyledText = null;
- // Create the intro item
- WelcomeItem item = getIntroItem();
- if (item != null) {
- StyledText styledText = new StyledText(infoArea, textStyle);
- this.texts.add(styledText);
- sampleStyledText = styledText;
- styledText.setCursor(null);
- JFaceColors.setColors(styledText,foreground,background);
- styledText.setText(getIntroItem().getText());
- setBoldRanges(styledText, item.getBoldRanges());
- setLinkRanges(styledText, item.getActionRanges());
- setLinkRanges(styledText, item.getHelpRanges());
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- gd.horizontalIndent = 20;
- styledText.setLayoutData(gd);
- styledText.setData(item);
- addListeners(styledText);
-
- Label spacer = new Label(infoArea, SWT.NONE);
- spacer.setBackground(background);
- gd = new GridData();
- gd.horizontalSpan = 2;
- spacer.setLayoutData(gd);
- }
- firstText = sampleStyledText;
-
- // Create the welcome items
- WelcomeItem[] items = getItems();
- for (int i = 0; i < items.length; i++) {
- Label image = new Label(infoArea, SWT.NONE);
- image.setBackground(background);
- image.setImage(WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_OBJS_WELCOME_ITEM));
- GridData gd = new GridData();
- gd.horizontalIndent = 20;
- gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
- image.setLayoutData(gd);
-
- StyledText styledText = new StyledText(infoArea, textStyle);
- this.texts.add(styledText);
- sampleStyledText = styledText;
- styledText.setCursor(null);
- JFaceColors.setColors(styledText,foreground,background);
- styledText.setText(items[i].getText());
- setBoldRanges(styledText, items[i].getBoldRanges());
- setLinkRanges(styledText, items[i].getActionRanges());
- setLinkRanges(styledText, items[i].getHelpRanges());
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.verticalAlignment = GridData.VERTICAL_ALIGN_BEGINNING;
- gd.verticalSpan = 2;
- styledText.setLayoutData(gd);
- styledText.setData(items[i]);
- addListeners(styledText);
-
- Label spacer = new Label(infoArea, SWT.NONE);
- spacer.setBackground(background);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- spacer.setLayoutData(gd);
- }
- lastText = sampleStyledText;
- this.scrolledComposite.setContent(infoArea);
- Point p = infoArea.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- this.scrolledComposite.setMinHeight(p.y);
- if (wrapped) {
- // introduce a horizontal scroll bar after a minimum width is reached
- this.scrolledComposite.setMinWidth(WRAP_MIN_WIDTH);
- } else {
- this.scrolledComposite.setMinWidth(p.x);
- }
- this.scrolledComposite.setExpandHorizontal(true);
- this.scrolledComposite.setExpandVertical(true);
-
- // Adjust the scrollbar increments
- if (sampleStyledText == null) {
- this.scrolledComposite.getHorizontalBar().setIncrement(HORZ_SCROLL_INCREMENT);
- this.scrolledComposite.getVerticalBar().setIncrement(VERT_SCROLL_INCREMENT);
- } else {
- GC gc = new GC(sampleStyledText);
- int width = gc.getFontMetrics().getAverageCharWidth();
- gc.dispose();
- this.scrolledComposite.getHorizontalBar().setIncrement(width);
- this.scrolledComposite.getVerticalBar().setIncrement(sampleStyledText.getLineHeight());
- }
- return infoArea;
-}
-
-
-/**
- * Creates the SWT controls for this workbench part.
- * <p>
- * Clients should not call this method (the workbench calls this method at
- * appropriate times).
- * </p>
- * <p>
- * For implementors this is a multi-step process:
- * <ol>
- * <li>Create one or more controls within the parent.</li>
- * <li>Set the parent layout as needed.</li>
- * <li>Register any global actions with the <code>IActionService</code>.</li>
- * <li>Register any popup menus with the <code>IActionService</code>.</li>
- * <li>Register a selection provider with the <code>ISelectionService</code>
- * (optional). </li>
- * </ol>
- * </p>
- *
- * @param parent the parent control
- */
-public void createPartControl(Composite parent) {
- // read our contents
- readFile();
- if (parser == null)
- return;
-
- handCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_HAND);
- busyCursor = new Cursor(parent.getDisplay(), SWT.CURSOR_WAIT);
-
- editorComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 0;
- editorComposite.setLayout(layout);
-
- createTitleArea(editorComposite);
-
- Label titleBarSeparator = new Label(editorComposite, SWT.HORIZONTAL | SWT.SEPARATOR);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- titleBarSeparator.setLayoutData(gd);
-
- createInfoArea(editorComposite);
-
- WorkbenchHelp.setHelp(editorComposite, IHelpContextIds.WELCOME_EDITOR);
-
- this.colorListener =
- new IPropertyChangeListener(){
- public void propertyChange(PropertyChangeEvent event){
- if(event.getProperty().equals(JFacePreferences.HYPERLINK_COLOR)){
- Color fg = JFaceColors.getHyperlinkText(editorComposite.getDisplay());
- Iterator links = hyperlinkRanges.iterator();
- while(links.hasNext()){
- StyleRange range = (StyleRange) links.next();
- range.foreground = fg;
- }
- }
- }
- };
-
- JFacePreferences.getPreferenceStore().addPropertyChangeListener(this.colorListener);
-
-}
-/**
- * Creates the wizard's title area.
- *
- * @param parent the SWT parent for the title area composite
- * @return the created title area composite
- */
-private Composite createTitleArea(Composite parent) {
- // Get the background color for the title area
- Display display = parent.getDisplay();
- Color background = JFaceColors.getBannerBackground(display);
- Color foreground = JFaceColors.getBannerForeground(display);
-
- // Create the title area which will contain
- // a title, message, and image.
- Composite titleArea = new Composite(parent, SWT.NONE | SWT.NO_FOCUS);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- layout.verticalSpacing = 0;
- layout.horizontalSpacing = 0;
- layout.numColumns = 2;
- titleArea.setLayout(layout);
- titleArea.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- titleArea.setBackground(background);
-
- // Message label
- final CLabel messageLabel = new CLabel(titleArea, SWT.LEFT);
- JFaceColors.setColors(messageLabel,foreground,background);
- messageLabel.setText(getBannerTitle());
- messageLabel.setFont(JFaceResources.getHeaderFont());
-
- final IPropertyChangeListener fontListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if(JFaceResources.HEADER_FONT.equals(event.getProperty())) {
- messageLabel.setFont(JFaceResources.getHeaderFont());
- }
- }
- };
-
- messageLabel.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent event) {
- JFaceResources.getFontRegistry().removeListener(fontListener);
- }
- });
-
- JFaceResources.getFontRegistry().addListener(fontListener);
-
-
- GridData gd = new GridData(GridData.FILL_BOTH);
- messageLabel.setLayoutData(gd);
-
- // Title image
- Label titleImage = new Label(titleArea, SWT.LEFT);
- titleImage.setBackground(background);
- titleImage.setImage(WorkbenchImages.getImage(IWorkbenchGraphicConstants.IMG_OBJS_WELCOME_BANNER));
- gd = new GridData();
- gd.horizontalAlignment = GridData.END;
- titleImage.setLayoutData(gd);
-
- return titleArea;
-}
-/**
- * The <code>WorkbenchPart</code> implementation of this
- * <code>IWorkbenchPart</code> method disposes the title image
- * loaded by <code>setInitializationData</code>. Subclasses may extend.
- */
-public void dispose() {
- super.dispose();
- if (busyCursor != null)
- busyCursor.dispose();
- if (handCursor != null)
- handCursor.dispose();
- if (this.colorListener != null) {
- JFacePreferences.getPreferenceStore().
- removePropertyChangeListener(this.colorListener);
- }
-}
-/* (non-Javadoc)
- * 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
- */
-public void doSave(IProgressMonitor monitor) {
- // do nothing
-}
-/* (non-Javadoc)
- * 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
- */
-public void doSaveAs() {
- // do nothing
-}
-/**
- * Returns the title obtained from the parser
- */
-private String getBannerTitle() {
- if (parser.getTitle() == null)
- return ""; //$NON-NLS-1$
- return parser.getTitle();
-}
-/**
- * Returns the intro item or <code>null</code>
- */
-private WelcomeItem getIntroItem() {
- return parser.getIntroItem();
-}
-/**
- * Returns the welcome items
- */
-private WelcomeItem[] getItems() {
- return parser.getItems();
-}
-/* (non-Javadoc)
- * Sets the cursor and selection state for this editor to the passage defined
- * by the given marker.
- * <p>
- * Subclasses may override. For greater details, see <code>IEditorPart</code>
- * </p>
- *
- * @see IEditorPart
- */
-public void gotoMarker(IMarker marker) {
- // do nothing
-}
-/* (non-Javadoc)
- * 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(editorInput);
- * </pre>
- */
-public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- if (!(input instanceof WelcomeEditorInput))
- throw new PartInitException("Invalid Input: Must be IFileEditorInput");
- setSite(site);
- setInput(input);
-}
-
-/* (non-Javadoc)
- * 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
- */
-public boolean isDirty() {
- return false;
-}
-/* (non-Javadoc)
- * 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>
- * </p>
- *
- * @see IEditorPart
- */
-public boolean isSaveAsAllowed() {
- return false;
-}
-/**
- * Read the contents of the welcome page
- */
-public void read(InputStream is) {
- parser = new WelcomeParser();
- parser.parse(is);
-}
-/**
- * Reads the welcome file
- */
-public void readFile() {
- URL url = ((WelcomeEditorInput)getEditorInput()).getAboutInfo().getWelcomePageURL();
-
- if (url == null)
- // should not happen
- return;
-
- InputStream is = null;
- try {
- is = url.openStream();
- read(is);
- }
- catch (IOException e) {
- IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 1, WorkbenchMessages.getString("WelcomeEditor.accessException"), e); //$NON-NLS-1$
- WorkbenchPlugin.log(WorkbenchMessages.getString("WelcomeEditor.readFileError"), status); //$NON-NLS-1$
- }
- finally {
- try {
- if (is != null)
- is.close();
- } catch (IOException e) {}
- }
-}
-/**
- * Sets the styled text's bold ranges
- */
-private void setBoldRanges(StyledText styledText, int[][] boldRanges) {
- for (int i = 0; i < boldRanges.length; i++) {
- StyleRange r = new StyleRange(boldRanges[i][0], boldRanges[i][1], null, null, SWT.BOLD);
- styledText.setStyleRange(r);
- }
-}
-/**
- * Asks this part to take focus within the workbench.
- * <p>
- * Clients should not call this method (the workbench calls this method at
- * appropriate times).
- * </p>
- */
-public void setFocus() {
- if (editorComposite != null) {
- editorComposite.setFocus();
- }
-}
-/**
- * Sets the styled text's link (blue) ranges
- */
-private void setLinkRanges(StyledText styledText, int[][] linkRanges) {
- //Color fg = styledText.getDisplay().getSystemColor(SWT.COLOR_BLUE);
- Color fg = JFaceColors.getHyperlinkText(styledText.getShell().getDisplay());
- for (int i = 0; i < linkRanges.length; i++) {
- StyleRange r = new StyleRange(linkRanges[i][0], linkRanges[i][1], fg, null);
- styledText.setStyleRange(r);
- hyperlinkRanges.add(r);
- }
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeEditorInput.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeEditorInput.java
deleted file mode 100644
index ba1ec27..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeEditorInput.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.net.URL;
-
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.*;
-import org.eclipse.jface.resource.*;
-/**
- * A simple editor input for the welcome editor
- */
-public class WelcomeEditorInput implements IEditorInput {
- private AboutInfo aboutInfo;
- private final static String FACTORY_ID = "org.eclipse.ui.internal.dialogs.WelcomeEditorInputFactory"; //$NON-NLS-1$
- public final static String FEATURE_ID = "featureId"; //$NON-NLS-1$
-/**
- * WelcomeEditorInput constructor comment.
- */
-public WelcomeEditorInput(AboutInfo info) {
- super();
- Assert.isNotNull(info);
- aboutInfo = info;
-}
- public boolean exists() {
- return false;
- }
- public Object getAdapter(Class adapter) {
- return null;
- }
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
- public String getName() {
- return WorkbenchMessages.getString("WelcomeEditor.title"); //$NON-NLS-1$
- }
- public IPersistableElement getPersistable() {
- return new IPersistableElement() {
- public String getFactoryId() {
- return FACTORY_ID;
- }
- public void saveState(IMemento memento) {
- memento.putString(FEATURE_ID, aboutInfo.getFeatureId());
- }
- };
- }
- public AboutInfo getAboutInfo() {
- return aboutInfo;
- }
- public boolean equals(Object o) {
- if((o != null) && (o instanceof WelcomeEditorInput)) {
- if (((WelcomeEditorInput)o).aboutInfo.getFeatureId().equals(
- aboutInfo.getFeatureId()))
- return true;
- }
- return false;
- }
- public String getToolTipText() {
- return WorkbenchMessages.format("WelcomeEditor.toolTip", new Object[]{aboutInfo.getFeatureLabel()}); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeEditorInputFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeEditorInputFactory.java
deleted file mode 100644
index 78b147c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeEditorInputFactory.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.AboutInfo;
-import org.eclipse.ui.internal.Workbench;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-/**
- * A simple factory for the welcome editor
- */
-public class WelcomeEditorInputFactory implements IElementFactory {
-/**
- * WelcomeEditorInputFactory constructor comment.
- */
-public WelcomeEditorInputFactory() {
- super();
-}
-/**
- * Re-creates and returns an object from the state captured within the given
- * memento.
- * <p>
- * Under normal circumstances, the resulting object can be expected to be
- * persistable; that is,
- * <pre>
- * result.getAdapter(org.eclipse.ui.IPersistableElement.class)
- * </pre>
- * should not return <code>null</code>.
- * </p>
- *
- * @param memento a memento containing the state for the object
- * @return an object, or <code>null</code> if the element could not be created
- */
-public IAdaptable createElement(IMemento memento) {
- // Get the feature id.
- String featureId = memento.getString(WelcomeEditorInput.FEATURE_ID);
- if (featureId == null)
- return null;
-
- AboutInfo info = null;
- AboutInfo [] infos =
- ((Workbench)(WorkbenchPlugin.getDefault().getWorkbench())).getFeaturesInfo();
- for (int i = 0; i < infos.length; i++) {
- if (featureId.equals(infos[i].getFeatureId())) {
- info = infos[i];
- break;
- }
- }
- if (info == null)
- return null;
-
- return new WelcomeEditorInput(info);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeItem.java
deleted file mode 100644
index 9c67c41..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeItem.java
+++ /dev/null
@@ -1,161 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.*;
-import org.eclipse.help.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.swt.custom.BusyIndicator;
-/**
- * Holds the information for an item appearing in the welcome editor
- */
-public class WelcomeItem {
- private String text;
- private int[][] boldRanges;
- private int[][] helpRanges;
- private String[] helpIds;
- private String[] helpHrefs;
- private int[][] actionRanges;
- private String[] actionPluginIds;
- private String[] actionClasses;
-/**
- * Creates a new welcome item
- */
-public WelcomeItem(
- String text,
- int[][] boldRanges,
- int[][] actionRanges,
- String[] actionPluginIds,
- String[] actionClasses,
- int[][] helpRanges,
- String[] helpIds,
- String[] helpHrefs) {
-
- this.text = text;
- this.boldRanges = boldRanges;
- this.actionRanges = actionRanges;
- this.actionPluginIds = actionPluginIds;
- this.actionClasses = actionClasses;
- this.helpRanges = helpRanges;
- this.helpIds = helpIds;
- this.helpHrefs = helpHrefs;
-}
-/**
- * Returns the action ranges (character locations)
- */
-public int[][] getActionRanges() {
- return actionRanges;
-}
-/**
- * Returns the bold ranges (character locations)
- */
-public int[][] getBoldRanges() {
- return boldRanges;
-}
-/**
- * Returns the help ranges (character locations)
- */
-public int[][] getHelpRanges() {
- return helpRanges;
-}
-/**
- * Returns the text to display
- */
-public String getText() {
- return text;
-}
-/**
- * Returns true is a link (action or help) is present at the given character location
- */
-public boolean isLinkAt(int offset) {
- // Check if there is a link at the offset
- for (int i = 0; i < helpRanges.length; i++){
- if (offset >= helpRanges[i][0] && offset < helpRanges[i][0] + helpRanges[i][1]) {
- return true;
- }
- }
-
- // Check if there is an action link at the offset
- for (int i = 0; i < actionRanges.length; i++){
- if (offset >= actionRanges[i][0] && offset < actionRanges[i][0] + actionRanges[i][1]) {
- return true;
- }
- }
- return false;
-}
-/**
- * Logs a error to the workbench log
- */
-public void logActionLinkError(String actionPluginId, String actionClass) {
- WorkbenchPlugin.log(WorkbenchMessages.getString("WelcomeItem.unableToLoadClass") + actionPluginId + " " + actionClass); //$NON-NLS-1$ //$NON-NLS-2$
-}
-/**
- * Open a help topic
- */
-private void openHelpTopic(String topic, String href) {
- IHelp helpSupport = WorkbenchHelp.getHelpSupport();
- if (helpSupport != null) {
- if (href != null)
- helpSupport.displayHelpResource(href);
- else
- helpSupport.displayHelpResource(topic);
- }
-}
-/**
- * Run an action
- */
-private void runAction(String pluginId, String className) {
- IPluginDescriptor desc = Platform.getPluginRegistry().getPluginDescriptor(pluginId);
- if (desc == null) {
- logActionLinkError(pluginId, className);
- return;
- }
- Class actionClass;
- IAction action;
- try {
- actionClass = desc.getPluginClassLoader().loadClass(className);
- } catch (ClassNotFoundException e) {
- logActionLinkError(pluginId, className);
- return;
- }
- try {
- action = (IAction)actionClass.newInstance();
- } catch (InstantiationException e) {
- logActionLinkError(pluginId, className);
- return;
- } catch (IllegalAccessException e) {
- logActionLinkError(pluginId, className);
- return;
- } catch (ClassCastException e) {
- logActionLinkError(pluginId, className);
- return;
- }
- action.run();
-}
-/**
- * Triggers the link at the given offset (if there is one)
- */
-public void triggerLinkAt(int offset) {
- // Check if there is a help link at the offset
- for (int i = 0; i < helpRanges.length; i++){
- if (offset >= helpRanges[i][0] && offset < helpRanges[i][0] + helpRanges[i][1]) {
- // trigger the link
- openHelpTopic(helpIds[i], helpHrefs[i]);
- return;
- }
- }
-
- // Check if there is an action link at the offset
- for (int i = 0; i < actionRanges.length; i++){
- if (offset >= actionRanges[i][0] && offset < actionRanges[i][0] + actionRanges[i][1]) {
- // trigger the link
- runAction(actionPluginIds[i], actionClasses[i]);
- return;
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeParser.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeParser.java
deleted file mode 100644
index 92849e1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WelcomeParser.java
+++ /dev/null
@@ -1,274 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.*;
-import org.eclipse.core.runtime.*;
-import org.xml.sax.*;
-import org.apache.xerces.parsers.*;
-import org.xml.sax.helpers.*;
-import java.io.*;
-import java.util.*;
-/**
- * A parser for the the welcome page
- */
-public class WelcomeParser extends DefaultHandler {
- private static final String TAG_WELCOME_PAGE = "welcomePage"; //$NON-NLS-1$
- private static final String TAG_INTRO = "intro"; //$NON-NLS-1$
- private static final String TAG_ITEM = "item"; //$NON-NLS-1$
- private static final String TAG_BOLD = "b"; //$NON-NLS-1$
- private static final String TAG_ACTION = "action"; //$NON-NLS-1$
- private static final String TAG_PARAGRAPH = "p"; //$NON-NLS-1$
- private static final String TAG_TOPIC = "topic"; //$NON-NLS-1$
- private static final String ATT_TITLE = "title"; //$NON-NLS-1$
- private static final String ATT_FORMAT = "format"; //$NON-NLS-1$
- private static final String ATT_PLUGIN_ID = "pluginId"; //$NON-NLS-1$
- private static final String ATT_CLASS = "class"; //$NON-NLS-1$
- private static final String ATT_ID = "id"; //$NON-NLS-1$
- private static final String ATT_HREF = "href"; //$NON-NLS-1$
-
- private static final String FORMAT_WRAP = "wrap";
- private static final String FORMAT_NOWRAP = "nowrap";
- private static final char DELIMITER = '\n'; // sax parser replaces crlf with lf
-
- private SAXParser parser;
-
- private String title;
- private WelcomeItem introItem;
- private ArrayList items = new ArrayList();
- private String format;
-
- private class WelcomeContentHandler implements ContentHandler {
- protected ContentHandler parent;
- public void setParent(ContentHandler p) {
- parent = p;
- }
- public void characters(char[] ch, int start, int length) throws SAXException {
- }
- public void endDocument() throws SAXException {
- }
- public void endElement(String namespaceURI, String localName, String qName) throws SAXException {
- }
- public void endPrefixMapping(String prefix) throws SAXException {
- }
- public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
- }
- public void processingInstruction(String target, String data) throws SAXException {
- }
- public void setDocumentLocator(Locator locator) {
- }
- public void skippedEntity(String name) throws SAXException {
- }
- public void startDocument() throws org.xml.sax.SAXException {
- }
- public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
- }
- public void startPrefixMapping(String prefix, String uri) throws SAXException {
- }
- }
-
- private class WelcomePageHandler extends WelcomeContentHandler {
- public WelcomePageHandler(String newTitle) {
- title = newTitle;
- }
- public void startElement (String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
- if (localName.equals(TAG_INTRO)) {
- ItemHandler h = new IntroItemHandler();
- h.setParent(WelcomePageHandler.this);
- parser.setContentHandler(h);
- } else if (localName.equals(TAG_ITEM)) {
- ItemHandler h = new ItemHandler();
- h.setParent(WelcomePageHandler.this);
- parser.setContentHandler(h);
- }
- }
- }
-
- private class ItemHandler extends WelcomeContentHandler {
- private ArrayList boldRanges = new ArrayList();
- protected ArrayList wrapRanges = new ArrayList();
- private ArrayList actionRanges = new ArrayList();
- private ArrayList pluginIds = new ArrayList();
- private ArrayList classes = new ArrayList();
- private ArrayList helpRanges = new ArrayList();
- private ArrayList helpIds = new ArrayList();
- private ArrayList helpHrefs = new ArrayList();
- private StringBuffer text = new StringBuffer();
- protected int offset = 0;
- protected int textStart;
- protected int wrapStart;
-
- private class BoldHandler extends WelcomeContentHandler {
- public void characters(char[] ch, int start, int length) throws SAXException {
- ItemHandler.this.characters(ch, start, length);
- }
- public void endElement (String namespaceURI, String localName, String qName) throws SAXException {
- if (localName.equals(TAG_BOLD)) {
- boldRanges.add(new int[] {textStart, offset - textStart});
- parser.setContentHandler(parent);
- }
- }
- }
- private class ActionHandler extends WelcomeContentHandler {
- public ActionHandler(String pluginId, String className) {
- pluginIds.add(pluginId);
- classes.add(className);
- }
- public void characters(char[] ch, int start, int length) throws SAXException {
- ItemHandler.this.characters(ch, start, length);
- }
- public void endElement (String namespaceURI, String localName, String qName) throws SAXException {
- if (localName.equals(TAG_ACTION)) {
- actionRanges.add(new int[] {textStart, offset - textStart});
- parser.setContentHandler(parent);
- }
- }
- }
- private class TopicHandler extends WelcomeContentHandler {
- public TopicHandler(String helpId, String href) {
- helpIds.add(helpId);
- helpHrefs.add(href);
- }
- public void characters(char[] ch, int start, int length) throws SAXException {
- ItemHandler.this.characters(ch, start, length);
- }
- public void endElement (String namespaceURI, String localName, String qName) throws SAXException {
- if (localName.equals(TAG_TOPIC)) {
- helpRanges.add(new int[] {textStart, offset - textStart});
- parser.setContentHandler(parent);
- }
- }
- }
-
- protected WelcomeItem constructWelcomeItem() {
- if (isFormatWrapped()) {
- // replace all line delimiters with a space
- for (int i=0; i<wrapRanges.size(); i++) {
- int[] range = (int[])wrapRanges.get(i);
- int start = range[0];
- int length = range[1];
- for (int j=start; j<start+length; j++) {
- char ch = text.charAt(j);
- if (ch == DELIMITER) {
- text.replace(j,j+1," ");
- }
- }
- }
- }
- return new WelcomeItem(
- text.toString(),
- (int[][])boldRanges.toArray(new int[boldRanges.size()][2]),
- (int[][])actionRanges.toArray(new int[actionRanges.size()][2]),
- (String[])pluginIds.toArray(new String[pluginIds.size()]),
- (String[])classes.toArray(new String[classes.size()]),
- (int[][])helpRanges.toArray(new int[helpRanges.size()][2]),
- (String[])helpIds.toArray(new String[helpIds.size()]),
- (String[])helpHrefs.toArray(new String[helpHrefs.size()]));
- }
- public void characters(char[] ch, int start, int length) throws SAXException {
- for (int i = 0; i < length; i++) {
- text.append(ch[start + i]);
- }
- offset += length;
- }
-
- public void startElement (String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
- textStart = offset;
- if (localName.equals(TAG_BOLD)) {
- BoldHandler h = new BoldHandler();
- h.setParent(ItemHandler.this);
- parser.setContentHandler(h);
- } else if(localName.equals(TAG_ACTION)) {
- ActionHandler h = new ActionHandler(atts.getValue(ATT_PLUGIN_ID), atts.getValue(ATT_CLASS));
- h.setParent(ItemHandler.this);
- parser.setContentHandler(h);
- } else if(localName.equals(TAG_PARAGRAPH)) {
- wrapStart = textStart;
- } else if(localName.equals(TAG_TOPIC)) {
- TopicHandler h = new TopicHandler(atts.getValue(ATT_ID), atts.getValue(ATT_HREF));
- h.setParent(ItemHandler.this);
- parser.setContentHandler(h);
- }
- }
- public void endElement (String namespaceURI, String localName, String qName) throws SAXException {
- if (localName.equals(TAG_ITEM)) {
- items.add(constructWelcomeItem());
- parser.setContentHandler(parent);
- } else if (localName.equals(TAG_PARAGRAPH)) {
- wrapRanges.add(new int[] {wrapStart, offset - wrapStart});
- }
- }
- }
- private class IntroItemHandler extends ItemHandler {
- public void endElement (String namespaceURI, String localName, String qName) throws SAXException {
- if (localName.equals(TAG_INTRO)) {
- introItem = constructWelcomeItem();
- parser.setContentHandler(parent);
- } else if (localName.equals(TAG_PARAGRAPH)) {
- wrapRanges.add(new int[] {wrapStart, offset - wrapStart});
- }
- }
- }
-/**
- * Creates a new welcome parser.
- */
-public WelcomeParser() {
- super();
- parser = new SAXParser();
- parser.setContentHandler(this);
- parser.setDTDHandler(this);
- parser.setEntityResolver(this);
- parser.setErrorHandler(this);
-}
-/**
- * Returns the intro item.
- */
-public WelcomeItem getIntroItem() {
- return introItem;
-}
-/**
- * Returns the items.
- */
-public WelcomeItem[] getItems() {
- return (WelcomeItem[])items.toArray(new WelcomeItem[items.size()]);
-}
-/**
- * Returns the title
- */
-public String getTitle() {
- return title;
-}
-/**
- * Returns whether or not the welcome editor input should be wrapped.
- */
-public boolean isFormatWrapped() {
- return FORMAT_WRAP.equals(format);
-}
-/**
- * Parse the contents of the input stream
- */
-public void parse(InputStream is) {
- try {
- parser.parse(new InputSource(is));
- } catch (SAXException e) {
- IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 1, WorkbenchMessages.getString("WelcomeParser.parseException"), e); //$NON-NLS-1$
- WorkbenchPlugin.log(WorkbenchMessages.getString("WelcomeParser.parseError"), status); //$NON-NLS-1$
- } catch (IOException e) {
- IStatus status = new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH, 1, WorkbenchMessages.getString("WelcomeParser.parseException"), e); //$NON-NLS-1$
- WorkbenchPlugin.log(WorkbenchMessages.getString("WelcomeParser.parseError"), status); //$NON-NLS-1$
- }
-}
-/**
- * Handles the start element
- */
-public void startElement (String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
- if (localName.equals(TAG_WELCOME_PAGE)) {
- WelcomeContentHandler h = new WelcomePageHandler(atts.getValue(ATT_TITLE));
- format = atts.getValue(ATT_FORMAT);
- h.setParent(this);
- parser.setContentHandler(h);
- }
-}
-}
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
deleted file mode 100644
index 1953657..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardCollectionElement.java
+++ /dev/null
@@ -1,162 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.jface.*;
-import org.eclipse.ui.part.*;
-import java.util.*;
-/**
- * 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 {
- private String id;
- private String name;
- private WizardCollectionElement parent;
- private AdaptableList wizards = new AdaptableList();
-/**
- * Creates a new <code>WizardCollectionElement</code>. Parent can be null.
- *
- * @param name java.lang.String
- */
-public WizardCollectionElement(String id, String name,WizardCollectionElement parent) {
- this.name = name;
- this.id = id;
- this.parent = parent;
-}
-/**
- * Adds a wizard collection to this collection.
- */
-public AdaptableList add(IAdaptable a) {
- if (a instanceof WorkbenchWizardElement) {
- wizards.add(a);
- } else {
- super.add(a);
- }
- return this;
-}
-/**
- * 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) {
- Object[] children = getChildren(null);
- String searchString = searchPath.segment(0);
- for (int i = 0; i < children.length; ++i) {
- WizardCollectionElement currentCategory = (WizardCollectionElement)children[i];
- if (currentCategory.getLabel(null).equals(searchString)) {
- if (searchPath.segmentCount() == 1)
- return currentCategory;
-
- return currentCategory.findChildCollection(searchPath.removeFirstSegments(1));
- }
- }
-
- 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.
- */
-public WorkbenchWizardElement findWizard(String searchId,boolean recursive) {
- Object[] wizards = getWizards();
- for (int i = 0; i < wizards.length; ++i) {
- WorkbenchWizardElement currentWizard = (WorkbenchWizardElement)wizards[i];
- if (currentWizard.getID().equals(searchId))
- return currentWizard;
- }
- 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)
- 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.
- */
-public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) {
- return this;
- }
- return Platform.getAdapterManager().getAdapter(this, adapter);
-}
-/**
- * Returns the unique ID of this element.
- */
-public String getId() {
- return id;
-}
-/**
- * Returns the label for this collection.
- */
-public String getLabel(Object o) {
- return name;
-}
-/**
- * Returns the logical parent of the given object in its tree.
- */
-public Object getParent(Object o) {
- return parent;
-}
-/**
- * Returns a path representing this collection's ancestor chain.
- */
-public IPath getPath() {
- if (parent == null)
- return new Path("");//$NON-NLS-1$
-
- return parent.getPath().append(name);
-}
-/**
- * Returns this collection element's associated collection of wizards.
- */
-public Object[] getWizards() {
- return wizards.getChildren();
-}
-/**
- * Returns true if this element has no children and no wizards.
- */
-public boolean isEmpty() {
- return size() == 0 && wizards.size() == 0;
-}
-/**
- * Sets this collection's unique id.
- */
-public void setId(java.lang.String newId) {
- id = newId;
-}
-/**
- * Sets the collection of wizards associated with this collection element.
- */
-public void setWizards(AdaptableList value) {
- wizards = value;
-}
-/**
- * For debugging purposes.
- */
-public String toString() {
- StringBuffer buf = new StringBuffer("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();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardNewProjectCapabilityPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardNewProjectCapabilityPage.java
deleted file mode 100644
index c73b4ef..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardNewProjectCapabilityPage.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.misc.ProjectCapabilitySelectionGroup;
-import org.eclipse.ui.internal.registry.Capability;
-import org.eclipse.ui.internal.registry.CapabilityRegistry;
-import org.eclipse.ui.internal.registry.ICategory;
-
-/**
- * Second page for the new project creation wizard. This page
- * collects the capabilities of the new project.
- * <p>
- * Example useage:
- * <pre>
- * mainPage = new WizardNewProjectCapabilityPage("wizardNewProjectCapabilityPage");
- * mainPage.setTitle("Project");
- * mainPage.setDescription("Choose project's capabilities.");
- * </pre>
- * </p>
- */
-public class WizardNewProjectCapabilityPage extends WizardPage {
- // initial value stores
- private Capability[] initialProjectCapabilities;
- private ICategory[] initialSelectedCategories;
-
- // widgets
- private ProjectCapabilitySelectionGroup capabilityGroup;
-
- /**
- * Creates a new project capabilities wizard page.
- *
- * @param pageName the name of this page
- */
- public WizardNewProjectCapabilityPage(String pageName) {
- super(pageName);
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardPage
- */
- public boolean canFlipToNextPage() {
- // Already know there is a next page...
- return isPageComplete();
- }
-
- /* (non-Javadoc)
- * Method declared on IDialogPage.
- */
- public void createControl(Composite parent) {
- WorkbenchHelp.setHelp(parent, IHelpContextIds.NEW_PROJECT_CAPABILITY_WIZARD_PAGE);
- CapabilityRegistry reg = WorkbenchPlugin.getDefault().getCapabilityRegistry();
- capabilityGroup = new ProjectCapabilitySelectionGroup(initialSelectedCategories, initialProjectCapabilities, reg);
- setControl(capabilityGroup.createContents(parent));
-
- capabilityGroup.setCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- getWizard().getContainer().updateButtons();
- }
- });
-
- if (!reg.hasCapabilities())
- setMessage(WorkbenchMessages.getString("WizardNewProjectCapabilityPage.noCapabilities"), WARNING); //$NON-NLS-1$
- }
-
- /**
- * Returns the collection of capabilities selected
- * by the user. The collection is not in prerequisite
- * order.
- *
- * @return array of selected capabilities
- */
- /* package */ Capability[] getSelectedCapabilities() {
- return capabilityGroup.getSelectedCapabilities();
- }
-
- /**
- * Sets the initial categories to be selected.
- *
- * @param categories initial categories to select
- */
- /* package */ void setInitialSelectedCategories(ICategory[] categories) {
- initialSelectedCategories = categories;
- }
-
- /**
- * Sets the initial project capabilities to be selected.
- *
- * @param capabilities initial project capabilities to select
- */
- /* package */ void setInitialProjectCapabilities(Capability[] capabilities) {
- initialProjectCapabilities = capabilities;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardNewProjectNameAndLocationPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardNewProjectNameAndLocationPage.java
deleted file mode 100644
index 5bac7f6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardNewProjectNameAndLocationPage.java
+++ /dev/null
@@ -1,433 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.io.File;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectDescription;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * First page for the new project creation wizard. This page
- * collects the name and location of the new project.
- * <p>
- * Example useage:
- * <pre>
- * mainPage = new WizardNewProjectNameAndLocationPage("wizardNewProjectNameAndLocationPage");
- * mainPage.setTitle("Project");
- * mainPage.setDescription("Create a new project.");
- * </pre>
- * </p>
- */
-public class WizardNewProjectNameAndLocationPage extends WizardPage {
- // Whether to use default or custom project location
- private boolean useDefaults = true;
-
- // initial value stores
- private String initialProjectFieldValue;
- private IPath initialLocationFieldValue;
-
- // the value the user has entered
- private String customLocationFieldValue;
-
- // widgets
- private Text projectNameField;
- private Text locationPathField;
- private Label locationLabel;
- private Button browseButton;
-
- private Listener nameModifyListener = new Listener() {
- public void handleEvent(Event e) {
- setLocationForSelection();
- setPageComplete(validatePage());
- }
- };
-
- private Listener locationModifyListener = new Listener() {
- public void handleEvent(Event e) {
- setPageComplete(validatePage());
- }
- };
-
- // constants
- private static final int SIZING_TEXT_FIELD_WIDTH = 250;
- private static final int SIZING_INDENTATION_WIDTH = 10;
-
- /**
- * Creates a new project creation wizard page.
- *
- * @param pageName the name of this page
- */
- public WizardNewProjectNameAndLocationPage(String pageName) {
- super(pageName);
- setPageComplete(false);
- initialLocationFieldValue = Platform.getLocation();
- customLocationFieldValue = ""; //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on IWizardPage
- */
- public boolean canFlipToNextPage() {
- // Already know there is a next page...
- return isPageComplete();
- }
-
- /* (non-Javadoc)
- * Method declared on IDialogPage.
- */
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.NEW_PROJECT_WIZARD_PAGE);
-
- createProjectNameGroup(composite);
- createProjectLocationGroup(composite);
-
- validatePage();
-
- // Show description on opening
- setErrorMessage(null);
- setMessage(null);
- setControl(composite);
- }
-
- /**
- * Creates the project location specification controls.
- *
- * @param parent the parent composite
- */
- private final void createProjectLocationGroup(Composite parent) {
-
- // project specification group
- Composite projectGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // new project label
- Label projectContentsLabel = new Label(projectGroup, SWT.NONE);
- projectContentsLabel.setText(WorkbenchMessages.getString("WizardNewProjectCreationPage.projectContentsLabel")); //$NON-NLS-1$
-
- GridData labelData = new GridData();
- labelData.horizontalSpan = 3;
- projectContentsLabel.setLayoutData(labelData);
-
- final Button useDefaultsButton = new Button(projectGroup, SWT.CHECK | SWT.RIGHT);
- useDefaultsButton.setText(WorkbenchMessages.getString("WizardNewProjectCreationPage.useDefaultLabel")); //$NON-NLS-1$
- useDefaultsButton.setSelection(useDefaults);
-
- GridData buttonData = new GridData();
- buttonData.horizontalSpan = 3;
- useDefaultsButton.setLayoutData(buttonData);
-
- createUserSpecifiedProjectLocationGroup(projectGroup, !useDefaults);
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- useDefaults = useDefaultsButton.getSelection();
- browseButton.setEnabled(!useDefaults);
- locationPathField.setEnabled(!useDefaults);
- locationLabel.setEnabled(!useDefaults);
- if (useDefaults) {
- customLocationFieldValue = locationPathField.getText();
- setLocationForSelection();
- } else {
- locationPathField.setText(customLocationFieldValue);
- }
- }
- };
- useDefaultsButton.addSelectionListener(listener);
- }
-
- /**
- * Creates the project name specification controls.
- *
- * @param parent the parent composite
- */
- private final void createProjectNameGroup(Composite parent) {
- // project specification group
- Composite projectGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // new project label
- Label projectLabel = new Label(projectGroup, SWT.NONE);
- projectLabel.setText(WorkbenchMessages.getString("WizardNewProjectCreationPage.nameLabel")); //$NON-NLS-1$
-
- // new project name entry field
- projectNameField = new Text(projectGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- projectNameField.setLayoutData(data);
-
- // Set the initial value first before listener
- // to avoid handling an event during the creation.
- if (initialProjectFieldValue != null)
- projectNameField.setText(initialProjectFieldValue);
- projectNameField.addListener(SWT.Modify, nameModifyListener);
- }
-
- /**
- * Creates the project location specification controls.
- *
- * @param projectGroup the parent composite
- * @param boolean - the initial enabled state of the widgets created
- */
- private void createUserSpecifiedProjectLocationGroup(Composite projectGroup, boolean enabled) {
-
- // location label
- locationLabel = new Label(projectGroup, SWT.NONE);
- locationLabel.setText(WorkbenchMessages.getString("WizardNewProjectCreationPage.locationLabel")); //$NON-NLS-1$
- locationLabel.setEnabled(enabled);
-
- // project location entry field
- locationPathField = new Text(projectGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- locationPathField.setLayoutData(data);
- locationPathField.setEnabled(enabled);
-
- // browse button
- browseButton = new Button(projectGroup, SWT.PUSH);
- browseButton.setText(WorkbenchMessages.getString("WizardNewProjectCreationPage.browseLabel")); //$NON-NLS-1$
- browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- handleLocationBrowseButtonPressed();
- }
- });
-
- browseButton.setEnabled(enabled);
-
- // Set the initial value first before listener
- // to avoid handling an event during the creation.
- if (initialLocationFieldValue != null)
- locationPathField.setText(initialLocationFieldValue.toOSString());
- locationPathField.addListener(SWT.Modify, locationModifyListener);
- }
-
- /**
- * Returns the current project location path as entered by
- * the user, or its anticipated initial value.
- *
- * @return the project location path, its anticipated initial value, or <code>null</code>
- * if no project location path is known
- */
- /* package */ IPath getLocationPath() {
- if (useDefaults)
- return initialLocationFieldValue;
-
- return new Path(getProjectLocationFieldValue());
- }
-
- /**
- * Creates a project resource handle for the current project name field value.
- * <p>
- * This method does not create the project resource; this is the responsibility
- * of <code>IProject::create</code> invoked by the new project resource wizard.
- * </p>
- *
- * @return the new project resource handle
- */
- /* package */ IProject getProjectHandle() {
- return ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName());
- }
-
- /**
- * Returns the current project name as entered by the user, or its anticipated
- * initial value.
- *
- * @return the project name, its anticipated initial value, or <code>null</code>
- * if no project name is known
- */
- /* package */ String getProjectName() {
- if (projectNameField == null)
- return initialProjectFieldValue;
-
- return getProjectNameFieldValue();
- }
-
- /**
- * Returns the value of the project name field
- * with leading and trailing spaces removed.
- *
- * @return the project name in the field
- */
- private String getProjectNameFieldValue() {
- if (projectNameField == null)
- return ""; //$NON-NLS-1$
- else
- return projectNameField.getText().trim();
- }
-
- /**
- * Returns the value of the project location field
- * with leading and trailing spaces removed.
- *
- * @return the project location directory in the field
- */
- private String getProjectLocationFieldValue() {
- if (locationPathField == null)
- return ""; //$NON-NLS-1$
- else
- return locationPathField.getText().trim();
- }
-
- /**
- * Open an appropriate directory browser
- */
- private void handleLocationBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell());
- dialog.setMessage(WorkbenchMessages.getString("WizardNewProjectCreationPage.directoryLabel")); //$NON-NLS-1$
-
- String dirName = getProjectLocationFieldValue();
- if (!dirName.equals("")) { //$NON-NLS-1$
- File path = new File(dirName);
- if (path.exists())
- dialog.setFilterPath(new Path(dirName).toOSString());
- }
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null) {
- customLocationFieldValue = selectedDirectory;
- locationPathField.setText(customLocationFieldValue);
- }
- }
-
- /**
- * Returns whether the currently specified project
- * content directory points to an exising project
- */
- private boolean isExistingProjectLocation() {
- IPath path = getLocationPath();
- path = path.append(IProjectDescription.DESCRIPTION_FILE_NAME);
- return path.toFile().exists();
- }
-
- /**
- * Sets the initial project name that this page will use when
- * created. The name is ignored if the createControl(Composite)
- * method has already been called. Leading and trailing spaces
- * in the name are ignored.
- *
- * @param name initial project name for this page
- */
- /* package */ void setInitialProjectName(String name) {
- if (name == null)
- initialProjectFieldValue = null;
- else
- initialProjectFieldValue = name.trim();
- }
-
- /**
- * Set the location to the default location if we are set to useDefaults.
- */
- private void setLocationForSelection() {
- if (useDefaults) {
- IPath defaultPath = Platform.getLocation().append(getProjectNameFieldValue());
- locationPathField.setText(defaultPath.toOSString());
- }
- }
-
- /**
- * Returns whether this page's controls currently all contain valid
- * values.
- *
- * @return <code>true</code> if all controls are valid, and
- * <code>false</code> if at least one is invalid
- */
- private boolean validatePage() {
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
-
- String projectFieldContents = getProjectNameFieldValue();
- if (projectFieldContents.equals("")) { //$NON-NLS-1$
- setErrorMessage(null);
- setMessage(WorkbenchMessages.getString("WizardNewProjectCreationPage.projectNameEmpty")); //$NON-NLS-1$
- return false;
- }
-
- IStatus nameStatus = workspace.validateName(projectFieldContents, IResource.PROJECT);
- if (!nameStatus.isOK()) {
- setErrorMessage(nameStatus.getMessage());
- return false;
- }
-
- String locationFieldContents = getProjectLocationFieldValue();
-
- if (locationFieldContents.equals("")) { //$NON-NLS-1$
- setErrorMessage(null);
- setMessage(WorkbenchMessages.getString("WizardNewProjectCreationPage.projectLocationEmpty")); //$NON-NLS-1$
- return false;
- }
-
- IPath path = new Path(""); //$NON-NLS-1$
- if (!path.isValidPath(locationFieldContents)) {
- setErrorMessage(WorkbenchMessages.getString("WizardNewProjectCreationPage.locationError")); //$NON-NLS-1$
- return false;
- }
- if (!useDefaults && Platform.getLocation().isPrefixOf(new Path(locationFieldContents))) {
- setErrorMessage(WorkbenchMessages.getString("WizardNewProjectCreationPage.defaultLocationError")); //$NON-NLS-1$
- return false;
- }
-
- if (getProjectHandle().exists()) {
- setErrorMessage(WorkbenchMessages.getString("WizardNewProjectCreationPage.projectExistsMessage")); //$NON-NLS-1$
- return false;
- }
-
- if (isExistingProjectLocation()) {
- setErrorMessage(WorkbenchMessages.getString("WizardNewProjectCreationPage.projectLocationExistsMessage")); //$NON-NLS-1$
- return false;
- }
-
- setErrorMessage(null);
- setMessage(null);
- return true;
- }
-
-/*
- * see @DialogPage.setVisible(boolean)
- */
-public void setVisible(boolean visible) {
- super.setVisible(visible);
- if(visible)
- projectNameField.setFocus();
-}
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardStep.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardStep.java
deleted file mode 100644
index 6f35f2c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WizardStep.java
+++ /dev/null
@@ -1,78 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.jface.wizard.IWizard;
-
-/**
- * Represents a step in a multi-step wizard.
- */
-public abstract class WizardStep {
- private int number;
- private boolean done = false;
-
- /**
- * Creates a wizard step.
- *
- * @param number the step number
- */
- public WizardStep(int number) {
- super();
- this.number = number;
- }
-
- /**
- * Returns the label for this step that can
- * be presented to the user.
- *
- * @return String the label of this step
- */
- abstract public String getLabel();
-
- /**
- * Returns an explaination of this step that can
- * be presented to the user.
- *
- * @return String the details of this step
- */
- abstract public String getDetails();
-
- /**
- * Returns the step's number.
- *
- * @return int the step's number
- */
- public int getNumber() {
- return number;
- }
-
- /**
- * Returns the step's wizard. Subclasses are
- * responsible for calling addPages method on
- * the wizard, if needed, before returning.
- *
- * @return IWizard the wizard to complete the step
- */
- public abstract IWizard getWizard();
-
- /**
- * Returns whether the step is done it's work
- */
- public boolean isDone() {
- return done;
- }
-
- /**
- * Sets the step as being done
- */
- public void markAsDone() {
- done = true;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkInProgressPreferencePage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkInProgressPreferencePage.java
deleted file mode 100644
index c9ccf78..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkInProgressPreferencePage.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- * (c) Copyright 2001 MyCorporation.
- * All Rights Reserved.
- */
-package org.eclipse.ui.internal.dialogs;
-
-import java.io.UnsupportedEncodingException;
-import java.util.ArrayList;
-import java.util.Collections;
-
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Preferences;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.util.OpenStrategy;
-
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.internal.*;
-
-/**
- * @version 1.0
- * @author
- */
-public class WorkInProgressPreferencePage extends WorkbenchPreferencePage {
-
- // Temporary option to enable navigation items
- private Button navigationHistoryButton;
- private static String ENABLE_NAVIGATION_HISTORY = "ENABLE_NAVIGATION_HISTORY"; //$NON-NLS-1$
- private static boolean useNavigationHistory = true;
-
-
- static {
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
-
- //Set the default values.
- store.setDefault(ENABLE_NAVIGATION_HISTORY, true);
- useNavigationHistory = store.getBoolean(ENABLE_NAVIGATION_HISTORY);
- }
-
- public static boolean useNavigationHistory() {
- return useNavigationHistory;
- }
-
- /**
- * @see IWorkbenchPreferencePage
- */
- public void init(IWorkbench aWorkbench) {
- super.init(aWorkbench);
- }
- /**
- * Creates a temporary option checkbox.
- */
- private Button createTempOption(Composite parent, String text, String prefId, boolean restartNeeded,String labelText) {
- // create composite needed to get tab order right
- 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));
-
- Button button = new Button(composite, SWT.CHECK);
- button.setText(text);
- IPreferenceStore store = getPreferenceStore();
- button.setSelection(store.getBoolean(prefId));
-
- if (restartNeeded) {
- Label label = new Label(composite, SWT.NONE);
- if(labelText == null)
- label.setText(WorkbenchMessages.getString("WorkInProgressPreference.noEffectUntilRestarted")); //$NON-NLS-1$
- else
- label.setText(labelText);
- }
-
- return button;
- }
-
- /*
- * @see PreferencePage#createContents(Composite)
- */
- protected Control createContents(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(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- // Temporary option to enable cool bars
- createSpace(composite);
- navigationHistoryButton =
- createTempOption(
- composite,
- WorkbenchMessages.getString("WorkInProgressPreference.enableNavigationHistory"), //$NON-NLS-1$
- ENABLE_NAVIGATION_HISTORY, //$NON-NLS-1$
- true,
- null); //$NON-NLS-1$
-
- return composite;
- }
-
- /**
- * The default button has been pressed.
- */
- protected void performDefaults() {
- IPreferenceStore store = getPreferenceStore();
-
- navigationHistoryButton.setSelection(store.getDefaultBoolean(ENABLE_NAVIGATION_HISTORY)); //$NON-NLS-1$
- }
-
- /**
- * The user has pressed Ok. Store/apply this page's values appropriately.
- */
- public boolean performOk() {
- IPreferenceStore store = getPreferenceStore();
-
- store.setValue(ENABLE_NAVIGATION_HISTORY, navigationHistoryButton.getSelection());
-
- ResourcesPlugin.getPlugin().savePluginPreferences();
- WorkbenchPlugin.getDefault().savePluginPreferences();
- return true;
- }
-}
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
deleted file mode 100644
index b72b083..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchEditorsDialog.java
+++ /dev/null
@@ -1,576 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.text.Collator;
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.SelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-
-/**
- * Implements a dialog showing all opened editors in the workbench
- * and the recent closed editors
- */
-public class WorkbenchEditorsDialog extends SelectionDialog {
-
- private WorkbenchWindow window;
- private Table editorsTable;
- private Button saveSelected;
- private Button closeSelected;
- private Button selectClean;
- private Button invertSelection;
-
- private boolean showAllPersp = false;
- private int sortColumn;
- private List elements = new ArrayList();
- private HashMap imageCache = new HashMap(11);
- private HashMap disabledImageCache = new HashMap(11);
- private boolean reverse = false;
- private Collator collator = Collator.getInstance();
- private Rectangle bounds;
- private int columnsWidth[];
-
- private static final String SORT = "sort"; //$NON-NLS-1$
- private static final String HISTORY = "history"; //$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 COLUMNS = "columns"; //$NON-NLS-1$
-
- private SelectionListener headerListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int index = editorsTable.indexOf((TableColumn) e.widget);
- if(index == sortColumn)
- reverse = !reverse;
- else
- sortColumn = index;
- updateItems();
- }
- };
-
- /**
- * Constructor for WorkbenchEditorsDialog.
- */
- public WorkbenchEditorsDialog(WorkbenchWindow window) {
- super(window.getShell());
- this.window = window;
- setTitle(WorkbenchMessages.getString("WorkbenchEditorsDialog.title")); //$NON-NLS-1$
- setShellStyle(getShellStyle() | SWT.RESIZE);
-
- 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 = new Integer(array[0]).intValue();
- bounds.y = new Integer(array[1]).intValue();
- bounds.width = new Integer(array[2]).intValue();
- bounds.height = new Integer(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] = new Integer(array[i]).intValue();
- }
- }
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- WorkbenchHelp.setHelp(newShell, IHelpContextIds.WORKBENCH_EDITORS_DIALOG);
- }
-
- /**
- * Initialize the dialog bounds with the bounds saved
- * from the settings.
- */
- 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.
- */
- protected Control createDialogArea(Composite parent) {
-
- Composite dialogArea = (Composite) super.createDialogArea(parent);
- //Label over the table
- Label l = new Label(dialogArea, SWT.NONE);
- l.setText(WorkbenchMessages.getString("WorkbenchEditorsDialog.label")); //$NON-NLS-1$
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- l.setLayoutData(data);
- //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);
-
- final GridData tableData = new GridData(GridData.FILL_BOTH);
- tableData.heightHint = 16 * editorsTable.getItemHeight();
- tableData.widthHint = (int) (2.5 * tableData.heightHint);
-
- editorsTable.setLayoutData(tableData);
- editorsTable.setLayout(new Layout() {
- protected Point computeSize(Composite composite, int wHint, int hHint, boolean flushCache){
- return new Point(tableData.widthHint, tableData.heightHint);
- }
- 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.getString("WorkbenchEditorsDialog.name")); //$NON-NLS-1$
- tc.addSelectionListener(headerListener);
- //Full path column
- tc = new TableColumn(editorsTable,SWT.NONE);
- tc.setResizable(true);
- tc.setText(WorkbenchMessages.getString("WorkbenchEditorsDialog.path")); //$NON-NLS-1$
- tc.addSelectionListener(headerListener);
- //A composite for save editors and close editors buttons
- Composite selectionButtons = new Composite(dialogArea,SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = 4;
- selectionButtons.setLayout(layout);
- //Close editors button
- closeSelected = new Button(selectionButtons,SWT.PUSH);
- closeSelected.setText(WorkbenchMessages.getString("WorkbenchEditorsDialog.closeSelected")); //$NON-NLS-1$
- closeSelected.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- closeItems(editorsTable.getSelection());
- }
- });
- //Save editors button
- saveSelected = new Button(selectionButtons,SWT.PUSH);
- saveSelected.setText(WorkbenchMessages.getString("WorkbenchEditorsDialog.saveSelected")); //$NON-NLS-1$
- saveSelected.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- saveItems(editorsTable.getItems(),null);
- }
- });
- //Select clean editors button
- selectClean = new Button(selectionButtons,SWT.PUSH);
- selectClean.setText(WorkbenchMessages.getString("WorkbenchEditorsDialog.selectClean")); //$NON-NLS-1$
- selectClean.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- editorsTable.setSelection(selectClean(editorsTable.getItems()));
- updateButtons();
- }
- });
- //Invert selection button
- invertSelection = new Button(selectionButtons,SWT.PUSH);
- invertSelection.setText(WorkbenchMessages.getString("WorkbenchEditorsDialog.invertSelection")); //$NON-NLS-1$
- invertSelection.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- editorsTable.setSelection(invertedSelection(editorsTable.getItems(),editorsTable.getSelection()));
- updateButtons();
- }
- });
-
- //Show only active perspective button
- final Button showAllPerspButton = new Button(dialogArea,SWT.CHECK);
- showAllPerspButton.setText(WorkbenchMessages.getString("WorkbenchEditorsDialog.showAllPersp")); //$NON-NLS-1$
- showAllPerspButton.setSelection(showAllPersp);
- showAllPerspButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- showAllPersp = showAllPerspButton.getSelection();
- updateItems();
- }
- });
- //Create the items and update buttons state
- updateItems();
- updateButtons();
-
- editorsTable.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateButtons();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- okPressed();
- }
- });
- editorsTable.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- for (Iterator images = imageCache.values().iterator(); images.hasNext();) {
- Image i = (Image)images.next();
- i.dispose();
- }
- for (Iterator images = disabledImageCache.values().iterator(); images.hasNext();) {
- Image i = (Image)images.next();
- i.dispose();
- }
- }
- });
- editorsTable.setFocus();
- return dialogArea;
- }
- /**
- * Updates the button state (enabled/disabled)
- */
- private void updateButtons() {
- TableItem selectedItems[] = editorsTable.getSelection();
- boolean hasDirty = false;
- for (int i = 0; i < selectedItems.length; i ++) {
- Adapter editor = (Adapter)selectedItems[i].getData();
- if(editor.isDirty()) {
- hasDirty = true;
- break;
- }
- }
- saveSelected.setEnabled(hasDirty);
-
- TableItem allItems[] = editorsTable.getItems();
- boolean hasClean = false;
- for (int i = 0; i < allItems.length; i ++) {
- Adapter editor = (Adapter)allItems[i].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)
- return;
- for (int i = 0; i < items.length; i++) {
- Adapter e = (Adapter)items[i].getData();
- e.close();
- }
- updateItems();
- }
- /**
- * Saves the specified editors
- */
- private void saveItems(TableItem items[],IProgressMonitor monitor) {
- if(items.length == 0)
- return;
- ProgressMonitorDialog pmd = new ProgressMonitorDialog(getShell());
- pmd.open();
- for (int i = 0; i < items.length; i++) {
- Adapter editor = (Adapter)items[i].getData();
- editor.save(pmd.getProgressMonitor());
- updateItem(items[i],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 (int i = 0; i < items.length; i++) {
- Adapter editor = (Adapter)items[i].getData();
- if(!editor.isDirty())
- cleanItems.add(items[i]);
- }
- 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])
- 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 images[] = editor.getImage();
- for (int i = 0; i < images.length; i++) {
- if (images[i] != null)
- item.setImage(i, images[i]);
- }
- }
- /**
- * Adds all editors to elements
- */
- private void updateEditors(IWorkbenchPage[] pages) {
- for (int j = 0; j < pages.length; j++) {
- IEditorReference editors[] = pages[j].getEditorReferences();
- for (int k = 0; k < editors.length; k++) {
- elements.add(new Adapter(editors[k]));
- }
- }
- }
- /**
- * Updates all items in the table
- */
- private void updateItems() {
- editorsTable.removeAll();
- elements = new ArrayList();
- if(showAllPersp) {
- IWorkbenchWindow windows[] = window.getWorkbench().getWorkbenchWindows();
- for (int i = 0; i < windows.length; i++)
- updateEditors(windows[i].getPages());
- } else {
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- updateEditors(new IWorkbenchPage[]{page});
- }
- }
- sort();
- Object selection = null;
- if(window.getActivePage() != null)
- selection = window.getActivePage().getActiveEditor();
- for (Iterator iterator = elements.iterator(); iterator.hasNext();) {
- Adapter e = (Adapter) iterator.next();
- TableItem item = new TableItem(editorsTable,SWT.NULL);
- updateItem(item,e);
- if((selection != null) && (selection == e.editorRef))
- editorsTable.setSelection(new TableItem[]{item});
- }
- // 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))
- sortColumn = 0;
- 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.
- */
- protected void okPressed() {
- TableItem items[] = editorsTable.getSelection();
- if(items.length != 1) {
- super.okPressed();
- return;
- }
-
- saveDialogSettings();
-
- 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();
- }
- /**
- * 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)
- thisSettings = settings.addNewSection(getClass().getName());
- return thisSettings;
- }
- /**
- * A helper inner class to adapt EditorHistoryItem and IEditorPart
- * in the same type.
- */
- private class Adapter implements Comparable {
- IEditorReference editorRef;
- IEditorInput input;
- IEditorDescriptor desc;
- String text[];
- Image images[];
- Adapter(IEditorReference ref) {
- editorRef = ref;
- }
- Adapter(IEditorInput input,IEditorDescriptor desc) {
- this.input = input;
- this.desc = desc;
- }
- boolean isDirty() {
- if(editorRef == null)
- return false;
- return editorRef.isDirty();
- }
- boolean isOpened() {
- return editorRef != null;
- }
- void close() {
- if(editorRef == null)
- return;
- WorkbenchPage p = ((WorkbenchPartReference)editorRef).getPane().getPage();
- p.closeEditor(editorRef,true);
- }
- void save(IProgressMonitor monitor) {
- if(editorRef == null)
- return;
- ((IEditorPart)editorRef.getPart(true)).doSave(monitor);
- }
- String[] getText() {
- if(text != null)
- return text;
- 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();
- }
- return text;
- }
- Image[] getImage() {
- if(images != null)
- return images;
- images = new Image[2];
- if(editorRef != null) {
- images[0] = editorRef.getTitleImage();
- WorkbenchPage p = ((WorkbenchPartReference)editorRef).getPane().getPage();
- IPerspectiveDescriptor persp = p.getPerspective();
- ImageDescriptor image = persp.getImageDescriptor();
- if(image == null)
- image = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_DEF_PERSPECTIVE);
- } else {
- ImageDescriptor image = null;
- if(desc != null)
- image = desc.getImageDescriptor();
- if(image == null) {
- IEditorRegistry registry = WorkbenchPlugin.getDefault().getEditorRegistry();
- image = registry.getImageDescriptor(input.getName());
- if (image == null) {
- image = registry.getDefaultEditor().getImageDescriptor();
- }
- }
- if (image != null) {
- images[0] = (Image)disabledImageCache.get(image);
- if(images[0] == null) {
- Image enabled = image.createImage();
- Image disabled = new Image(editorsTable.getDisplay(), enabled, SWT.IMAGE_DISABLE);
- enabled.dispose();
- disabledImageCache.put(image, disabled);
- images[0] = disabled;
- }
- }
- }
- return images;
- }
-
- 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();
- try {
- if(desc != null)
- p.openEditor(input,desc.getId(),true);
- else if(input instanceof IFileEditorInput)
- p.openEditor(((IFileEditorInput)input).getFile());
- } catch (PartInitException e) {
- }
- }
- }
- 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)
- return result * -1;
- return result;
- }
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 3fe53ae..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceDialog.java
+++ /dev/null
@@ -1,260 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.io.File;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Preferences;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceNode;
-import org.eclipse.jface.preference.IPreferencePage;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.PreferenceManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-
-
-
-/**
- * Prefence dialog for the workbench including the ability
- * to load/save preferences.
- */
-public class WorkbenchPreferenceDialog extends PreferenceDialog {
- /**
- * The Load button.
- */
- private Button loadButton;
- /**
- * The Load button id.
- */
- private final static int LOAD_ID = IDialogConstants.CLIENT_ID + 1;
- /**
- * The Load dialogs settings key
- */
- private final static String LOAD_SETTING = "WorkbenchPreferenceDialog.load"; //$NON-NLS-1$
-
- /**
- * The Save button.
- */
- private Button saveButton;
- /**
- * The Save button id.
- */
- private final static int SAVE_ID = IDialogConstants.CLIENT_ID + 2;
- /**
- * The Save dialogs settings key
- */
- private final static String SAVE_SETTING = "WorkbenchPreferenceDialog.save"; //$NON-NLS-1$
-
- /**
- * The extension for preferences files
- */
- private final static String PREFERENCE_EXT = "epf"; //$NON-NLS-1$
-
- /**
- * The extensions for the file dialogs
- */
- private final static String[] DIALOG_PREFERENCE_EXTENSIONS = new String[] {"*."+PREFERENCE_EXT, "*.*"}; //$NON-NLS-2$ //$NON-NLS-1$
-
- /**
- * Creates a new preference dialog under the control of the given preference
- * manager.
- *
- * @param shell the parent shell
- * @param manager the preference manager
- */
- public WorkbenchPreferenceDialog(Shell parentShell, PreferenceManager manager) {
- super(parentShell, manager);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void buttonPressed(int buttonId) {
- switch (buttonId) {
- case LOAD_ID : {
- loadPressed();
- return;
- }
- case SAVE_ID : {
- savePressed();
- return;
- }
- }
- super.buttonPressed(buttonId);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- loadButton = createButton(parent, LOAD_ID, WorkbenchMessages.getString("WorkbenchPreferenceDialog.load"), false); //$NON-NLS-1$
- saveButton = createButton(parent, SAVE_ID, WorkbenchMessages.getString("WorkbenchPreferenceDialog.save"), false); //$NON-NLS-1$
- Label l = new Label(parent, SWT.NONE);
- l.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout layout = (GridLayout)parent.getLayout();
- layout.numColumns++;
- layout.makeColumnsEqualWidth = false;
-
- super.createButtonsForButtonBar(parent);
- }
-
- /**
- * Handle a request to load preferences
- */
- protected void loadPressed() {
- // Get the file to load
- String lastFilename = WorkbenchPlugin.getDefault().getDialogSettings().get(LOAD_SETTING);
- FileDialog d = new FileDialog(getShell(), SWT.OPEN);
- d.setFileName(lastFilename);
- d.setFilterExtensions(DIALOG_PREFERENCE_EXTENSIONS);
- String filename = d.open();
- if (filename == null)
- return;
- // Append the default filename if none was specifed and such a file does not exist
- IPath path = new Path(filename);
- if (path.getFileExtension() == null) {
- if (!path.toFile().exists()) {
- path = path.addFileExtension(PREFERENCE_EXT);
- filename = path.toOSString();
- }
- }
-
- WorkbenchPlugin.getDefault().getDialogSettings().put(LOAD_SETTING, filename);
-
- // Verify the file
- IStatus status = Preferences.validatePreferenceVersions(path);
- if (status.getSeverity() == IStatus.ERROR) {
- // Show the error and about
- ErrorDialog.openError(
- getShell(),
- WorkbenchMessages.getString("WorkbenchPreferenceDialog.loadErrorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("WorkbenchPreferenceDialog.verifyErrorMessage", new Object[]{filename}), //$NON-NLS-1$
- status);
- return;
- }
- if (status.getSeverity() == IStatus.WARNING) {
- // Show the warning and give the option to continue
- int result = PreferenceErrorDialog.openError(
- getShell(),
- WorkbenchMessages.getString("WorkbenchPreferenceDialog.loadErrorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("WorkbenchPreferenceDialog.verifyWarningMessage", new Object[]{filename}), //$NON-NLS-1$
- status);
- if (result != Dialog.OK)
- return;
- }
- // Load file
- try {
- Preferences.importPreferences(path);
- } catch (CoreException e) {
- ErrorDialog.openError(
- getShell(),
- WorkbenchMessages.getString("WorkbenchPreferenceDialog.loadErrorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("WorkbenchPreferenceDialog.loadErrorMessage", new Object[]{filename}), //$NON-NLS-1$
- e.getStatus());
- return;
- }
-
- MessageDialog.openInformation(
- getShell(),
- WorkbenchMessages.getString("WorkbenchPreferenceDialog.loadTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("WorkbenchPreferenceDialog.loadMessage", new Object[]{filename})); //$NON-NLS-1$
-
- // Close the dialog since it shows an invalid state
- close();
- }
-
- /**
- * Handle a request to save preferences
- */
- protected void savePressed() {
- // Get the file to save
- String lastFilename = WorkbenchPlugin.getDefault().getDialogSettings().get(SAVE_SETTING);
- FileDialog d = new FileDialog(getShell(), SWT.SAVE);
- d.setFileName(lastFilename);
- d.setFilterExtensions(DIALOG_PREFERENCE_EXTENSIONS);
- String filename = d.open();
- if (filename == null)
- return;
- // Append the default filename if none was specifed
- IPath path = new Path(filename);
- if (path.getFileExtension() == null) {
- path = path.addFileExtension(PREFERENCE_EXT);
- filename = path.toOSString();
- }
-
- WorkbenchPlugin.getDefault().getDialogSettings().put(SAVE_SETTING, filename);
-
- // See if the file already exists
- File file = path.toFile();
- if(file.exists()) {
- if(!MessageDialog.openConfirm(
- getShell(),
- WorkbenchMessages.getString("WorkbenchPreferenceDialog.saveTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("WorkbenchPreferenceDialog.existsErrorMessage", new Object[]{filename}))) //$NON-NLS-1$
- return;
- }
-
- // Save all the pages and give them a chance to abort
- Iterator nodes = getPreferenceManager().getElements(PreferenceManager.PRE_ORDER).iterator();
- while (nodes.hasNext()) {
- IPreferenceNode node = (IPreferenceNode) nodes.next();
- IPreferencePage page = node.getPage();
- if (page != null) {
- if(!page.performOk())
- return;
- }
- }
-
- long lastModified = file.lastModified();
- // Save to file
- try {
- Preferences.exportPreferences(path);
- } catch (CoreException e) {
- ErrorDialog.openError(
- getShell(),
- WorkbenchMessages.getString("WorkbenchPreferenceDialog.saveErrorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("WorkbenchPreferenceDialog.saveErrorMessage", new Object[]{filename}), //$NON-NLS-1$
- e.getStatus());
- return;
- }
- // See if we actually created a file (there where preferences to export).
- if(file.exists() && file.lastModified() != lastModified) {
- MessageDialog.openInformation(
- getShell(),
- WorkbenchMessages.getString("WorkbenchPreferenceDialog.saveTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("WorkbenchPreferenceDialog.saveMessage", new Object[]{filename})); //$NON-NLS-1$
- } else {
- MessageDialog.openError(
- getShell(),
- WorkbenchMessages.getString("WorkbenchPreferenceDialog.saveErrorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("WorkbenchPreferenceDialog.noPreferencesMessage")); //$NON-NLS-1$
- }
-
-
- // Close since we have "performed Ok" and cancel is no longer valid
- close();
- }
-}
-
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
deleted file mode 100644
index fc9c7ed..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferenceNode.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.jface.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.Image;
-import java.util.*;
-
-/**
- * A proxy for a preference page to avoid creation of preference page
- * just to show a node in the preference dialog tree.
- */
-public class WorkbenchPreferenceNode extends PreferenceNode {
- private String category;
- private IConfigurationElement configurationElement;
- public final static String ATT_CONTRIBUTOR_CLASS = "class";//$NON-NLS-1$
- private IWorkbench workbench;
-public WorkbenchPreferenceNode(String nodeId, String nodeLabel, String category, ImageDescriptor nodeImage, IConfigurationElement element, IWorkbench newWorkbench) {
- super(nodeId, nodeLabel, nodeImage, null);
- this.category = category;
- this.configurationElement = element;
- this.workbench = newWorkbench;
-}
-public WorkbenchPreferenceNode(String nodeId, String nodeLabel, String category, ImageDescriptor nodeImage, IWorkbenchPreferencePage preferencePage) {
- super(nodeId, nodeLabel, nodeImage, null);
- setPage(preferencePage);
-}
-/**
- * Creates the preference page this node stands for.
- */
-public void createPage() {
- IWorkbenchPreferencePage page;
- try {
- page = (IWorkbenchPreferencePage)WorkbenchPlugin.createExtension(
- configurationElement, ATT_CONTRIBUTOR_CLASS);
- }
- catch (CoreException e) {
- // Just inform the user about the error. The details are
- // written to the log by now.
- ErrorDialog.openError(
- (Shell)null,
- WorkbenchMessages.getString("PreferenceNode.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("PreferenceNode.errorMessage"), //$NON-NLS-1$
- e.getStatus());
- page = new EmptyPreferencePage();
- }
-
- page.init(workbench);
- if (getLabelImage() != null)
- page.setImageDescriptor(getImageDescriptor());
- page.setTitle(getLabelText());
- setPage(page);
-}
-/**
- *
- * @return java.lang.String
- */
-public String getCategory() {
- return 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
deleted file mode 100644
index 87183d0..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchPreferencePage.java
+++ /dev/null
@@ -1,405 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.*;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.Hashtable;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.preference.*;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.OpenStrategy;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.GlobalBuildAction;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.*;
-
-public class WorkbenchPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
- private IWorkbench workbench;
- private Button autoBuildButton;
- private Button autoSaveAllButton;
- private Button linkButton;
- private Button refreshButton;
- private IntegerFieldEditor saveInterval;
-
- private Button doubleClickButton;
- private Button singleClickButton;
- private Button selectOnHoverButton;
- private Button openAfterDelayButton;
- private boolean openOnSingleClick;
- private boolean selectOnHover;
- private boolean openAfterDelay;
-
- /**
- * Creates composite control and sets the default layout data.
- *
- * @param parent the parent of the new composite
- * @param numColumns the number of columns for the new composite
- * @return the newly-created coposite
- */
- private Composite createComposite(Composite parent, int numColumns) {
- Composite composite = new Composite(parent, SWT.NULL);
-
- // GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- composite.setLayout(layout);
-
- // GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
- return composite;
- }
- /**
- * Create this page's visual contents
- *
- * @return org.eclipse.swt.widgets.Control
- * @param parent org.eclipse.swt.widgets.Composite
- */
- protected Control createContents(Composite parent) {
-
- Font font = parent.getFont();
-
- WorkbenchHelp.setHelp(parent, IHelpContextIds.WORKBENCH_PREFERENCE_PAGE);
-
- Composite composite = new Composite(parent, SWT.NULL);
- 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));
- composite.setFont(font);
-
- autoBuildButton = new Button(composite, SWT.CHECK);
- autoBuildButton.setText(WorkbenchMessages.getString("WorkbenchPreference.autobuild")); //$NON-NLS-1$
- autoBuildButton.setFont(font);
- setButtonLayoutData(autoBuildButton);
-
- autoSaveAllButton = new Button(composite, SWT.CHECK);
- autoSaveAllButton.setText(WorkbenchMessages.getString("WorkbenchPreference.savePriorToBuilding")); //$NON-NLS-1$
- autoSaveAllButton.setFont(font);
- setButtonLayoutData(autoSaveAllButton);
-
- linkButton = new Button(composite, SWT.CHECK);
- linkButton.setText(WorkbenchMessages.getString("WorkbenchPreference.linkNavigator")); //$NON-NLS-1$
- linkButton.setFont(font);
- setButtonLayoutData(linkButton);
-
- refreshButton = new Button(composite, SWT.CHECK);
- refreshButton.setText(WorkbenchMessages.getString("WorkbenchPreference.refreshButton")); //$NON-NLS-1$
- refreshButton.setFont(font);
- setButtonLayoutData(refreshButton);
-
- createSpace(composite);
- createSaveIntervalGroup(composite);
-
- createSpace(composite);
- createSingleClickGroup(composite);
-
- // set initial values
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- autoBuildButton.setSelection(ResourcesPlugin.getWorkspace().isAutoBuilding());
- autoSaveAllButton.setSelection(store.getBoolean(IPreferenceConstants.SAVE_ALL_BEFORE_BUILD));
- linkButton.setSelection(store.getBoolean(IWorkbenchPreferenceConstants.LINK_NAVIGATOR_TO_EDITOR));
- refreshButton.setSelection(store.getBoolean(IPreferenceConstants.REFRESH_WORKSPACE_ON_STARTUP));
-
- return composite;
- }
-
- private void createSingleClickGroup(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.getString("WorkInProgressPreference.openMode")); //$NON-NLS-1$
- buttonComposite.setFont(font);
-
-
- String label = WorkbenchMessages.getString("WorkInProgressPreference.doubleClick"); //$NON-NLS-1$
- doubleClickButton = createRadioButton(buttonComposite,label);
- doubleClickButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- selectClickMode(singleClickButton.getSelection());
- }
- });
- doubleClickButton.setSelection(!openOnSingleClick);
-
- label = WorkbenchMessages.getString("WorkInProgressPreference.singleClick"); //$NON-NLS-1$
- singleClickButton = createRadioButton(buttonComposite,label);
- singleClickButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- selectClickMode(singleClickButton.getSelection());
- }
- });
- singleClickButton.setSelection(openOnSingleClick);
-
- label = WorkbenchMessages.getString("WorkInProgressPreference.singleClick_SelectOnHover"); //$NON-NLS-1$
- selectOnHoverButton = new Button(buttonComposite, SWT.CHECK | SWT.LEFT);
- selectOnHoverButton.setText(label);
- selectOnHoverButton.setFont(font);
- selectOnHoverButton.setEnabled(openOnSingleClick);
- selectOnHoverButton.setSelection(selectOnHover);
- selectOnHoverButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- selectOnHover = selectOnHoverButton.getSelection();
- }
- });
- data = new GridData();
- data.horizontalIndent = 20;
- selectOnHoverButton.setLayoutData(data);
-
-
- label = WorkbenchMessages.getString("WorkInProgressPreference.singleClick_OpenAfterDelay"); //$NON-NLS-1$
- openAfterDelayButton = new Button(buttonComposite, SWT.CHECK | SWT.LEFT);
- openAfterDelayButton.setText(label);
- openAfterDelayButton.setEnabled(openOnSingleClick);
- openAfterDelayButton.setSelection(openAfterDelay);
- openAfterDelayButton.setFont(font);
- openAfterDelayButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- openAfterDelay = openAfterDelayButton.getSelection();
- }
- });
- data = new GridData();
- data.horizontalIndent = 20;
- openAfterDelayButton.setLayoutData(data);
-
- Label note = new Label(buttonComposite, SWT.NONE);
- note.setText(WorkbenchMessages.getString("WorkInProgressPreference.noEffectOnAllViews")); //$NON-NLS-1$
- note.setFont(font);
- }
-
- private void selectClickMode(boolean singleClick) {
- openOnSingleClick = singleClick;
- selectOnHoverButton.setEnabled(openOnSingleClick);
- openAfterDelayButton.setEnabled(openOnSingleClick);
- }
- /**
- * Create a composite that contains entry fields specifying save interval preference.
- */
- private void createSaveIntervalGroup(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);
- groupComposite.setFont(composite.getFont());
-
- saveInterval = new IntegerFieldEditor(IPreferenceConstants.SAVE_INTERVAL, WorkbenchMessages.getString("WorkbenchPreference.saveInterval"), groupComposite); //$NON-NLS-1$
-
- saveInterval.setPreferenceStore(WorkbenchPlugin.getDefault().getPreferenceStore());
- saveInterval.setPreferencePage(this);
- saveInterval.setTextLimit(Integer.toString(IPreferenceConstants.MAX_SAVE_INTERVAL).length());
- saveInterval.setErrorMessage(WorkbenchMessages.format("WorkbenchPreference.saveIntervalError", new Object[] { new Integer(IPreferenceConstants.MAX_SAVE_INTERVAL)})); //$NON-NLS-1$
- saveInterval.setValidateStrategy(StringFieldEditor.VALIDATE_ON_KEY_STROKE);
- saveInterval.setValidRange(1, IPreferenceConstants.MAX_SAVE_INTERVAL);
-
- IWorkspaceDescription description = ResourcesPlugin.getWorkspace().getDescription();
- long interval = description.getSnapshotInterval() / 60000;
- saveInterval.setStringValue(Long.toString(interval));
-
- saveInterval.setPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(FieldEditor.IS_VALID))
- setValid(saveInterval.isValid());
- }
- });
-
- }
- /**
- * 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);
- button.setFont(parent.getFont());
- 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);
- combo.setFont(parent.getFont());
- 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);
- label.setFont(parent.getFont());
- 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 = 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
- */
- protected IPreferenceStore doGetPreferenceStore() {
- return WorkbenchPlugin.getDefault().getPreferenceStore();
- }
- /**
- * @see IWorkbenchPreferencePage
- */
- public void init(IWorkbench aWorkbench) {
- workbench = aWorkbench;
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- openOnSingleClick = store.getBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK); //$NON-NLS-1$
- selectOnHover = store.getBoolean(IPreferenceConstants.SELECT_ON_HOVER); //$NON-NLS-1$
- openAfterDelay = store.getBoolean(IPreferenceConstants.OPEN_AFTER_DELAY); //$NON-NLS-1$
- }
- /**
- * The default button has been pressed.
- */
- protected void performDefaults() {
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- autoBuildButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.AUTO_BUILD));
- autoSaveAllButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.SAVE_ALL_BEFORE_BUILD));
- linkButton.setSelection(store.getDefaultBoolean(IWorkbenchPreferenceConstants.LINK_NAVIGATOR_TO_EDITOR));
- refreshButton.setSelection(store.getDefaultBoolean(IPreferenceConstants.REFRESH_WORKSPACE_ON_STARTUP));
- saveInterval.loadDefault();
-
- openOnSingleClick = store.getDefaultBoolean(IPreferenceConstants.OPEN_ON_SINGLE_CLICK); //$NON-NLS-1$
- selectOnHover = store.getDefaultBoolean(IPreferenceConstants.SELECT_ON_HOVER); //$NON-NLS-1$
- openAfterDelay = store.getDefaultBoolean(IPreferenceConstants.OPEN_AFTER_DELAY); //$NON-NLS-1$
- singleClickButton.setSelection(openOnSingleClick);
- doubleClickButton.setSelection(!openOnSingleClick);
- selectOnHoverButton.setSelection(selectOnHover);
- openAfterDelayButton.setSelection(openAfterDelay);
- selectOnHoverButton.setEnabled(openOnSingleClick);
- openAfterDelayButton.setEnabled(openOnSingleClick);
-
- super.performDefaults();
- }
- /**
- * The user has pressed Ok. Store/apply this page's values appropriately.
- */
- public boolean performOk() {
- IPreferenceStore store = getPreferenceStore();
-
- // inform the workbench of whether it should do autobuilds or not
- boolean newAutoBuildSetting = autoBuildButton.getSelection();
- IWorkspaceDescription description = ResourcesPlugin.getWorkspace().getDescription();
- boolean oldAutoBuildSetting = description.isAutoBuilding();
- description.setAutoBuilding(newAutoBuildSetting);
- try {
- ResourcesPlugin.getWorkspace().setDescription(description);
- } catch (CoreException e) {
- WorkbenchPlugin.log("Error changing autobuild pref", e.getStatus());
- }
- if (oldAutoBuildSetting != newAutoBuildSetting) {
- // fire off a property change notification so interested
- // parties can know about the auto build setting change
- // since it is not kept in the preference store.
- store.firePropertyChangeEvent(IPreferenceConstants.AUTO_BUILD, new Boolean(oldAutoBuildSetting), new Boolean(newAutoBuildSetting));
-
- // If auto build is turned on, then do a global incremental
- // build on all the projects.
- if (newAutoBuildSetting) {
- GlobalBuildAction action = new GlobalBuildAction(this.workbench, getShell(), IncrementalProjectBuilder.INCREMENTAL_BUILD);
- action.doBuild();
- }
- }
-
- // store the save all prior to build setting
- store.setValue(IPreferenceConstants.SAVE_ALL_BEFORE_BUILD, autoSaveAllButton.getSelection());
-
- // store the link navigator to editor setting
- store.setValue(IWorkbenchPreferenceConstants.LINK_NAVIGATOR_TO_EDITOR, linkButton.getSelection());
-
- // store the link navigator to editor setting
- store.setValue(IPreferenceConstants.REFRESH_WORKSPACE_ON_STARTUP, refreshButton.getSelection());
-
- long oldSaveInterval = description.getSnapshotInterval() / 60000;
- long newSaveInterval = new Long(saveInterval.getStringValue()).longValue();
- if(oldSaveInterval != newSaveInterval) {
- try {
- description.setSnapshotInterval(newSaveInterval * 60000);
- ResourcesPlugin.getWorkspace().setDescription(description);
- store.firePropertyChangeEvent(IPreferenceConstants.SAVE_INTERVAL, new Integer((int)oldSaveInterval), new Integer((int)newSaveInterval));
- } catch (CoreException e) {
- WorkbenchPlugin.log("Error changing save interval preference", e.getStatus());
- }
- }
-
- store.setValue(IPreferenceConstants.OPEN_ON_SINGLE_CLICK,openOnSingleClick); //$NON-NLS-1$
- store.setValue(IPreferenceConstants.SELECT_ON_HOVER,selectOnHover); //$NON-NLS-1$
- store.setValue(IPreferenceConstants.OPEN_AFTER_DELAY,openAfterDelay); //$NON-NLS-1$
- 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);
-
- WorkbenchPlugin.getDefault().savePluginPreferences();
- return true;
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 79abce1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardElement.java
+++ /dev/null
@@ -1,201 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.internal.SelectionEnabler;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.model.WorkbenchAdapter;
-import org.eclipse.ui.internal.registry.WizardsRegistryReader;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * Instances represent registered wizards.
- */
-public class WorkbenchWizardElement extends WorkbenchAdapter implements IAdaptable {
- private String id;
- private String name;
- private ImageDescriptor imageDescriptor;
- private String description;
- private SelectionEnabler selectionEnabler;
- private IConfigurationElement configurationElement;
-/**
- * Create a new instance of this class
- *
- * @param name java.lang.String
- */
-public WorkbenchWizardElement(String name) {
- this.name = name;
-}
-/**
- * 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 reciever 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
- */
-public IStructuredSelection adaptedSelection(IStructuredSelection selection) {
- if (canHandleSelection(selection))
- return selection;
-
- 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.
- */
-public Object createExecutableExtension () throws CoreException {
- return WorkbenchPlugin.createExtension(configurationElement,
- WizardsRegistryReader.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.
- */
-public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) {
- return this;
- }
- return Platform.getAdapterManager().getAdapter(this, adapter);
-}
-/**
- *
- * @return IConfigurationElement
- */
-public IConfigurationElement getConfigurationElement() {
- return configurationElement;
-}
-/**
- * Answer the description parameter of this element
- *
- * @return java.lang.String
- */
-public String getDescription() {
- return description;
-}
-/**
- * Answer the id as specified in the extension.
- *
- * @return java.lang.String
- */
-public String getID() {
- return id;
-}
-/**
- * Answer the icon of this element.
- */
-public ImageDescriptor getImageDescriptor() {
- return imageDescriptor;
-}
-/**
- * Returns the name of this wizard element.
- */
-public ImageDescriptor getImageDescriptor(Object element) {
- return imageDescriptor;
-}
-/**
- * Returns the name of this wizard element.
- */
-public String getLabel(Object element) {
- return name;
-}
-/**
- * Answer self's action enabler, creating it first iff necessary
- */
-protected SelectionEnabler getSelectionEnabler() {
- if (selectionEnabler == null)
- selectionEnabler = new SelectionEnabler(configurationElement);
-
- return selectionEnabler;
-}
-/**
- *
- * @param newConfigurationElement IConfigurationElement
- */
-public void setConfigurationElement(IConfigurationElement newConfigurationElement) {
- configurationElement = newConfigurationElement;
-}
-/**
- * Set the description parameter of this element
- *
- * @param value java.lang.String
- */
-public void setDescription(String value) {
- description = value;
-}
-/**
- * Set the id parameter of this element
- *
- * @param value java.lang.String
- */
-public void setID(String value) {
- id = value;
-}
-/**
- * Set the icon of this element.
- */
-public void setImageDescriptor(ImageDescriptor value) {
- imageDescriptor = value;
-}
-
-/**
- * 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 a new
- * empty selection
- *
- * @param originalSelection IStructuredSelection
- * @return IStructuredSelection
- */
-private IStructuredSelection convertToResources(IStructuredSelection originalSelection) {
- List result = new ArrayList();
- Iterator elements = originalSelection.iterator();
-
- while (elements.hasNext()) {
- Object currentElement = elements.next();
- if (currentElement instanceof IResource) { // already a resource
- result.add(currentElement);
- } else if (!(currentElement instanceof IAdaptable)) { // cannot be converted to resource
- return StructuredSelection.EMPTY; // so fail
- } else {
- Object adapter = ((IAdaptable)currentElement).getAdapter(IResource.class);
- if (!(adapter instanceof IResource)) // chose not to be converted to resource
- return StructuredSelection.EMPTY; // so fail
- result.add(adapter); // add the converted resource
- }
- }
-
- return new StructuredSelection(result.toArray()); // all converted fine, answer new selection
-}
-}
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
deleted file mode 100644
index 17dc949..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardListSelectionPage.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.*;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.ui.*;
-import org.eclipse.ui.model.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-
-/**
- * Abstract implementation of a wizard selection page which simply displays
- * a list of specified wizard elements and allows the user to select one to
- * be 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 {
- private String message;
-
- // id constants
- private static final String STORE_SELECTED_WIZARD_ID = "WizardListSelectionPage.STORE_SELECTED_WIZARD_ID";//$NON-NLS-1$
- private final static int SIZING_LISTS_HEIGHT = 200;
- private final static int SIZING_LISTS_WIDTH = 150;
-/**
- * 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
- */
-protected WorkbenchWizardListSelectionPage(IWorkbench aWorkbench, IStructuredSelection currentSelection, AdaptableList wizardElements, String message) {
- super("singleWizardSelectionPage", aWorkbench, currentSelection, wizardElements);//$NON-NLS-1$
- setDescription(WorkbenchMessages.getString("WizardList.description")); //$NON-NLS-1$
- this.message = message;
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-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);
-
- //Create a table for the list
- Table table = new Table(outerContainer, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = SIZING_LISTS_WIDTH;
- data.heightHint = SIZING_LISTS_HEIGHT;
- table.setLayoutData(data);
- table.setFont(font);
-
- // the list viewer
- wizardSelectionViewer = new TableViewer(table);
- wizardSelectionViewer.setContentProvider(new WorkbenchContentProvider());
- wizardSelectionViewer.setLabelProvider(new WorkbenchLabelProvider());
- wizardSelectionViewer.setSorter(new WorkbenchViewerSorter());
- wizardSelectionViewer.addSelectionChangedListener(this);
- wizardSelectionViewer.addDoubleClickListener(this);
-
- wizardSelectionViewer.setInput(wizardElements);
- restoreWidgetValues();
-
- setControl(outerContainer);
-}
-/**
- * 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.
- */
-public void doubleClick(DoubleClickEvent event) {
- selectionChanged(
- new SelectionChangedEvent(
- wizardSelectionViewer,
- wizardSelectionViewer.getSelection()));
- getContainer().showPage(getNextPage());
-}
-/**
- * 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() {
- // reselect previous wizard
- String wizardId = getDialogSettings().get(STORE_SELECTED_WIZARD_ID);
- WorkbenchWizardElement wizard = findWizard(wizardId);
- if (wizard == null)
- return; // wizard no longer exists, or has moved
-
- StructuredSelection selection = new StructuredSelection(wizard);
- wizardSelectionViewer.setSelection(selection);
- selectionChanged(new SelectionChangedEvent(wizardSelectionViewer,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() {
- IDialogSettings settings = getDialogSettings();
-
- // since the user is able to leave this page then exactly one wizard
- // must be currently selected
- IStructuredSelection sel = (IStructuredSelection)wizardSelectionViewer.getSelection();
- // We are losing the selection going back
- if (sel.size() > 0) {
- WorkbenchWizardElement selectedWizard = (WorkbenchWizardElement) sel.getFirstElement();
- settings.put(
- STORE_SELECTED_WIZARD_ID,
- selectedWizard.getID());
- }
-}
-/**
- * Notes the newly-selected wizard element and updates the page accordingly.
- *
- * @param event the selection changed event
- */
-public void selectionChanged(SelectionChangedEvent event) {
- setErrorMessage(null);
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- WorkbenchWizardElement currentWizardSelection = (WorkbenchWizardElement) selection.getFirstElement();
- if (currentWizardSelection == null) {
- setMessage(null);
- setSelectedNode(null);
- return;
- }
-
- setSelectedNode(createWizardNode(currentWizardSelection));
- setMessage((String) 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
deleted file mode 100644
index a30d096..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardNode.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.custom.BusyIndicator;
-import java.util.*;
-
-/**
- * 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 overide 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 (eg.-
- * New, Import, etc.).</p>
- */
-public abstract class WorkbenchWizardNode implements IWizardNode {
- protected WorkbenchWizardElement wizardElement;
- protected IWizard wizard;
- protected WorkbenchWizardSelectionPage parentWizardPage;
-/**
- * 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.
- */
-public WorkbenchWizardNode(WorkbenchWizardSelectionPage aWizardPage, WorkbenchWizardElement element) {
- super();
- this.parentWizardPage = aWizardPage;
- this.wizardElement = element;
-}
-
-/**
- * Returns the wizard represented by this wizard node. <b>Subclasses</b>
- * must override this method.
- */
-public abstract IWorkbenchWizard createWizard() throws CoreException;
-/**
- * @see org.eclipse.jface.wizard.IWizardNode#dispose()
- */
-public void dispose() {
- // 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();
-}
-/**
- * @see org.eclipse.jface.wizard.IWizardNode#getExtent()
- */
-public Point getExtent() {
- return new Point(-1,-1);
-}
-/**
- * @see org.eclipse.jface.wizards.IWizardNode#getWizard()
- */
-public IWizard getWizard() {
- 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(), new Runnable() {
- public void run() {
- Platform.run(new SafeRunnable() {
- public void run() {
- try {
- workbenchWizard[0] = createWizard(); // create instance of target wizard
- } catch (CoreException e) {
- statuses[0] = e.getStatus();
- }
- }
-
- /**
- * Add the exception details to status is one happens.
- */
- public void handleException(Throwable e) {
- statuses[0] =
- new Status(
- IStatus.ERROR,
- wizardElement.getConfigurationElement().getDeclaringExtension().getUniqueIdentifier(),
- IStatus.OK,
- e.getMessage(),
- e);
- }
- });
- }
- });
-
- if (statuses[0] != null) {
- parentWizardPage.setErrorMessage(WorkbenchMessages.getString("WorkbenchWizard.errorMessage")); //$NON-NLS-1$
- ErrorDialog.openError(
- parentWizardPage.getShell(),
- WorkbenchMessages.getString("WorkbenchWizard.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.getString("WorkbenchWizard.errorMessage"), //$NON-NLS-1$
- statuses[0]);
- return null;
- }
-
- IStructuredSelection currentSelection = getCurrentResourceSelection();
-
- //Get the adapted version of the selection that works for the
- //wizard node
- currentSelection = wizardElement.adaptedSelection(currentSelection);
-
- workbenchWizard[0].init(getWorkbench(),currentSelection);
-
- wizard = workbenchWizard[0];
- return wizard;
-}
-/**
- * Returns the wizard element.
- */
-public WorkbenchWizardElement getWizardElement() {
- return wizardElement;
-}
-/**
- * Returns the current workbench.
- */
-protected IWorkbench getWorkbench() {
- return parentWizardPage.getWorkbench();
-}
-/**
- * @see org.eclipse.jface.wizard.IWizardNode#isContentCreated()
- */
-public boolean isContentCreated() {
- 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
deleted file mode 100644
index 2d288b6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkbenchWizardSelectionPage.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-
-/**
- * Page for selecting a wizard from a group of available wizards.
- */
-public abstract class WorkbenchWizardSelectionPage extends WizardSelectionPage {
-
- // variables
- protected IWorkbench workbench;
- protected AdaptableList wizardElements;
- public TableViewer wizardSelectionViewer;
- protected IStructuredSelection currentResourceSelection;
-/**
- * Create an instance of this class
- */
-public WorkbenchWizardSelectionPage(String name, IWorkbench aWorkbench, IStructuredSelection currentSelection, AdaptableList elements) {
- super(name);
- this.wizardElements = elements;
- this.currentResourceSelection = currentSelection;
- this.workbench = aWorkbench;
- setTitle(WorkbenchMessages.getString("Select")); //$NON-NLS-1$
-}
-/**
- * Answer the wizard object corresponding to the passed id, or null
- * if such an object could not be found
- *
- * @return WizardElement
- * @param searchPath java.lang.String
- */
-protected WorkbenchWizardElement findWizard(String searchId) {
- Object[] children = wizardElements.getChildren();
- for (int i = 0; i < children.length; ++i) {
- WorkbenchWizardElement currentWizard = (WorkbenchWizardElement)children[i];
- if (currentWizard.getID().equals(searchId))
- return currentWizard;
- }
-
- return null;
-}
-public IStructuredSelection getCurrentResourceSelection() {
- return currentResourceSelection;
-}
-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);
-}
-}
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
deleted file mode 100644
index 79084a5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetEditWizard.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 International Business Machines Corp. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ui.internal.dialogs;
-
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.dialogs.IWorkingSetEditWizard;
-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.
- *
- * @since 2.0
- * @see org.eclipse.ui.dialog.IWorkingSetPage
- */
-public class WorkingSetEditWizard extends Wizard implements IWorkingSetEditWizard {
- private IWorkingSetPage workingSetEditPage;
- 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.getString("WorkingSetEditWizard.title")); //$NON-NLS-1$
- }
- /**
- * Overrides Wizard.
- *
- * @see org.eclipse.jface.wizard.Wizard#addPages
- */
- public void addPages() {
- super.addPages();
- addPage(workingSetEditPage);
- }
- /**
- * Overrides Wizard.
- *
- * @see org.eclipse.jface.wizard.Wizard#canFinish()
- */
- public boolean canFinish() {
- return workingSetEditPage.isPageComplete();
- }
- /**
- * Returns the working set that is being edited.
- *
- * @return the working set that is being edited.
- */
- public IWorkingSet getSelection() {
- return workingSet;
- }
- /**
- * Overrides Wizard.
- * Notifies the IWorkingSetPage that the wizard is being closed.
- *
- * @see org.eclipse.jface.wizard.Wizard#performFinish
- */
- public boolean performFinish() {
- 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);
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 2222fe8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetNewWizard.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 International Business Machines Corp. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ui.internal.dialogs;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.dialogs.IWorkingSetPage;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-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.
- *
- * @since 2.0
- * @see org.eclipse.ui.dialog.IWorkingSetPage
- */
-public class WorkingSetNewWizard extends Wizard {
- private WorkingSetTypePage workingSetTypePage;
- private IWorkingSetPage workingSetEditPage;
- private String editPageId;
- private IWorkingSet workingSet;
- private String workingSetEditPageId;
-
- /**
- * Creates a new instance of the receiver.
- */
- public WorkingSetNewWizard() {
- super();
- setWindowTitle(WorkbenchMessages.getString("WorkingSetNewWizard.title")); //$NON-NLS-1$
- }
- /**
- * 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()
- */
- public void addPages() {
- super.addPages();
-
- IWizardPage page;
- WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
- WorkingSetDescriptor[] descriptors = registry.getWorkingSetDescriptors();
- if (descriptors.length > 1) {
- page = workingSetTypePage = new WorkingSetTypePage();
- }
- 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()
- */
- public boolean canFinish() {
- 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)
- */
- 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);
- workingSetEditPage.setWizard(this);
- 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.
- */
- public IWorkingSet getSelection() {
- 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()
- */
- public boolean performFinish() {
- workingSetEditPage.finish();
- workingSet = workingSetEditPage.getSelection();
- ((WorkingSet) workingSet).setEditPageId(editPageId);
- return true;
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 600c12e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetSelectionDialog.java
+++ /dev/null
@@ -1,414 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-
-import java.util.*;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.WorkingSetDescriptor;
-import org.eclipse.ui.internal.registry.WorkingSetRegistry;
-import org.eclipse.ui.model.WorkbenchViewerSorter;
-
-/**
- * A working set selection dialog displays a list of working
- * sets available in the workbench.
- *
- * @see IWorkingSetSelectionDialog
- * @since 2.0
- */
-public class WorkingSetSelectionDialog extends SelectionDialog implements IWorkingSetSelectionDialog {
- private final static int SIZING_SELECTION_WIDGET_HEIGHT = 200;
- private final static int SIZING_SELECTION_WIDGET_WIDTH = 50;
-
- private static class WorkingSetLabelProvider extends LabelProvider {
- private Map icons;
-
- public WorkingSetLabelProvider() {
- icons = new Hashtable();
- }
- public void dispose() {
- Iterator iterator = icons.values().iterator();
-
- while (iterator.hasNext()) {
- Image icon = (Image) iterator.next();
- icon.dispose();
- }
- super.dispose();
- }
- public Image getImage(Object workingSet) {
- Assert.isTrue(workingSet instanceof WorkingSet);
- WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
- WorkingSetDescriptor descriptor = registry.getWorkingSetDescriptor(((WorkingSet) workingSet).getEditPageId());
-
- if (descriptor == null) {
- return null;
- }
- ImageDescriptor imageDescriptor = descriptor.getIcon();
- if (imageDescriptor == null) {
- return null;
- }
- Image icon = (Image) icons.get(imageDescriptor);
- if (icon == null) {
- icon = imageDescriptor.createImage();
- icons.put(imageDescriptor, icon);
- }
- return icon;
- }
- public String getText(Object workingSet) {
- Assert.isTrue(workingSet instanceof WorkingSet);
- return ((IWorkingSet) workingSet).getName();
- }
- }
-
- private ILabelProvider labelProvider;
- private IStructuredContentProvider contentProvider;
- private TableViewer listViewer;
- private Button newButton;
- private Button detailsButton;
- private Button removeButton;
- private IWorkingSet[] result;
- private boolean multiSelect;
- private List addedWorkingSets;
- private List removedWorkingSets;
- private Map editedWorkingSets;
-
- /**
- * Creates a working set selection dialog.
- *
- * @param parentShell the parent shell
- * @param multi true=more than one working set can be chosen
- * in the dialog. false=only one working set can be chosen. Multiple
- * working sets can still be selected and removed from the list but
- * the dialog can only be closed when a single working set is selected.
- */
- public WorkingSetSelectionDialog(Shell parentShell, boolean multi) {
- super(parentShell);
- contentProvider = new ListContentProvider();
- labelProvider = new WorkingSetLabelProvider();
- multiSelect = multi;
- if (multiSelect) {
- setTitle(WorkbenchMessages.getString("WorkingSetSelectionDialog.title.multiSelect")); //$NON-NLS-1$;
- setMessage(WorkbenchMessages.getString("WorkingSetSelectionDialog.message.multiSelect")); //$NON-NLS-1$
- }
- else {
- setTitle(WorkbenchMessages.getString("WorkingSetSelectionDialog.title")); //$NON-NLS-1$;
- setMessage(WorkbenchMessages.getString("WorkingSetSelectionDialog.message")); //$NON-NLS-1$
- }
- }
- /**
- * Adds the modify buttons to the dialog.
- *
- * @param composite Composite to add the buttons to
- */
- private void addModifyButtons(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);
-
- int id = IDialogConstants.CLIENT_ID + 1;
- newButton = createButton(buttonComposite, id++, WorkbenchMessages.getString("WorkingSetSelectionDialog.newButton.label"), false); //$NON-NLS-1$
- newButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- createWorkingSet();
- }
- });
-
- detailsButton = createButton(buttonComposite, id++, WorkbenchMessages.getString("WorkingSetSelectionDialog.detailsButton.label"), false); //$NON-NLS-1$
- detailsButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- editSelectedWorkingSet();
- }
- });
-
- removeButton = createButton(buttonComposite, id++, WorkbenchMessages.getString("WorkingSetSelectionDialog.removeButton.label"), false); //$NON-NLS-1$
- removeButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- removeSelectedWorkingSets();
- }
- });
- }
- /**
- * Overrides method from Dialog.
- *
- * @see Dialog#cancelPressed()
- */
- protected void cancelPressed() {
- restoreAddedWorkingSets();
- restoreChangedWorkingSets();
- restoreRemovedWorkingSets();
- super.cancelPressed();
- }
- /**
- * Overrides method from Window.
- *
- * @see org.eclipse.jface.window.Window#configureShell(Shell)
- */
- protected void configureShell(Shell shell) {
- super.configureShell(shell);
- WorkbenchHelp.setHelp(shell, IHelpContextIds.WORKING_SET_SELECTION_DIALOG);
- }
- /**
- * Overrides method from Dialog.
- * Create the dialog widgets.
- *
- * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(Composite)
- */
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
-
- createMessageArea(composite);
- listViewer = new TableViewer(composite, SWT.BORDER | SWT.MULTI);
- 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.setSorter(new WorkbenchViewerSorter());
- listViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChanged();
- }
- });
- listViewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- okPressed();
- }
- });
- addModifyButtons(composite);
- listViewer.setInput(Arrays.asList(WorkbenchPlugin.getDefault().getWorkingSetManager().getWorkingSets()));
-
- return composite;
- }
- /**
- * Overrides method from Dialog.
- * Sets the initial selection, if any.
- *
- * @see org.eclipse.jface.dialogs.Dialog#createContents(Composite)
- */
- 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;
- }
- /**
- * Opens a working set wizard for creating a new working set.
- */
- private void createWorkingSet() {
- WorkingSetNewWizard wizard = new WorkingSetNewWizard();
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
-
- dialog.create();
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.WORKING_SET_NEW_WIZARD);
- if (dialog.open() == Window.OK) {
- IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager();
- IWorkingSet workingSet = wizard.getSelection();
-
- listViewer.add(workingSet);
- listViewer.setSelection(new StructuredSelection(workingSet), true);
- manager.addWorkingSet(workingSet);
- addedWorkingSets.add(workingSet);
- }
- }
- /**
- * Opens a working set wizard for editing the currently selected
- * working set.
- *
- * @see org.eclipse.ui.IWorkingSetPage
- */
- private void editSelectedWorkingSet() {
- IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager();
- WorkingSet editWorkingSet = (WorkingSet) getSelectedWorkingSets().get(0);
- IWorkingSetEditWizard wizard = manager.createWorkingSetEditWizard(editWorkingSet);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- WorkingSet originalWorkingSet = (WorkingSet) editedWorkingSets.get(editWorkingSet);
- boolean firstEdit = originalWorkingSet == null;
-
- // save the original working set values for restoration when selection
- // dialog is cancelled.
- if (firstEdit) {
- originalWorkingSet = new WorkingSet(editWorkingSet.getName(), editWorkingSet.getElements());
- }
- else {
- editedWorkingSets.remove(editWorkingSet);
- }
- dialog.create();
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.WORKING_SET_EDIT_WIZARD);
- if (dialog.open() == Window.OK) {
- editWorkingSet = (WorkingSet) wizard.getSelection();
- listViewer.update(editWorkingSet, null);
- }
- editedWorkingSets.put(editWorkingSet, originalWorkingSet);
- }
- /**
- * Implements IWorkingSetSelectionDialog.
- *
- * @see org.eclipse.ui.dialogs.IWorkingSetSelectionDialog#getSelection()
- */
- public IWorkingSet[] getSelection() {
- return result;
- }
- /**
- * Returns the selected working sets.
- *
- * @return the selected working sets
- */
- private List getSelectedWorkingSets() {
- ISelection selection = listViewer.getSelection();
- if (selection instanceof IStructuredSelection)
- return ((IStructuredSelection) selection).toList();
- return null;
- }
- /**
- * Called when the selection has changed.
- */
- private void handleSelectionChanged() {
- updateButtonAvailability();
- }
- /**
- * Sets the selected working sets as the dialog result.
- * Overrides method from Dialog
- *
- * @see org.eclipse.jface.dialogs.Dialog#okPressed()
- */
- protected void okPressed() {
- List newResult = getSelectedWorkingSets();
-
- result = (IWorkingSet[]) newResult.toArray(new IWorkingSet[newResult.size()]);
- setResult(newResult);
- super.okPressed();
- }
- /**
- * Overrides method in Dialog
- *
- * @see org.eclipse.jface.dialogs.Dialog#open()
- */
- public int open() {
- addedWorkingSets = new ArrayList();
- removedWorkingSets = new ArrayList();
- editedWorkingSets = new HashMap();
- return super.open();
- }
- /**
- * Removes the selected working sets from the workbench.
- */
- private void removeSelectedWorkingSets() {
- ISelection selection = listViewer.getSelection();
-
- if (selection instanceof IStructuredSelection) {
- IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager();
- Iterator iter = ((IStructuredSelection) selection).iterator();
- while (iter.hasNext()) {
- IWorkingSet workingSet = (IWorkingSet) iter.next();
- manager.removeWorkingSet(workingSet);
- if (addedWorkingSets.contains(workingSet)) {
- addedWorkingSets.remove(workingSet);
- }
- else {
- removedWorkingSets.add(workingSet);
- }
- }
- listViewer.remove(((IStructuredSelection) selection).toArray());
- }
- }
- /**
- * Removes newly created working sets from the working set manager.
- */
- private void restoreAddedWorkingSets() {
- IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager();
- Iterator iterator = addedWorkingSets.iterator();
-
- while (iterator.hasNext()) {
- manager.removeWorkingSet(((IWorkingSet) iterator.next()));
- }
- }
- /**
- * Rolls back changes to working sets.
- */
- private void restoreChangedWorkingSets() {
- Iterator iterator = editedWorkingSets.keySet().iterator();
-
- while (iterator.hasNext()) {
- IWorkingSet editedWorkingSet = (IWorkingSet) iterator.next();
- IWorkingSet originalWorkingSet = (IWorkingSet) editedWorkingSets.get(editedWorkingSet);
-
- if (editedWorkingSet.getName().equals(originalWorkingSet.getName()) == false) {
- editedWorkingSet.setName(originalWorkingSet.getName());
- }
- if (editedWorkingSet.getElements().equals(originalWorkingSet.getElements()) == false) {
- editedWorkingSet.setElements(originalWorkingSet.getElements());
- }
- }
- }
-
- /**
- * Adds back removed working sets to the working set manager.
- */
- private void restoreRemovedWorkingSets() {
- IWorkingSetManager manager = WorkbenchPlugin.getDefault().getWorkingSetManager();
- Iterator iterator = removedWorkingSets.iterator();
-
- while (iterator.hasNext()) {
- manager.addWorkingSet(((IWorkingSet) iterator.next()));
- }
- }
- /**
- * Implements IWorkingSetSelectionDialog.
- *
- * @see org.eclipse.ui.dialogs.IWorkingSetSelectionDialog#setSelection(IWorkingSet[])
- */
- public void setSelection(IWorkingSet[] workingSets) {
- result = workingSets;
- setInitialSelections(workingSets);
- }
- /**
- * Updates the modify buttons' enabled state based on the
- * current seleciton.
- */
- private void updateButtonAvailability() {
- ISelection selection = listViewer.getSelection();
- boolean hasSelection = selection != null && !selection.isEmpty();
- boolean hasSingleSelection = hasSelection;
-
- removeButton.setEnabled(hasSelection);
- if (hasSelection && selection instanceof IStructuredSelection) {
- hasSingleSelection = ((IStructuredSelection) selection).size() == 1;
- }
- detailsButton.setEnabled(hasSingleSelection);
- if (multiSelect == false) {
- getOkButton().setEnabled(hasSelection == false || hasSingleSelection);
- }
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 8569c0e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/WorkingSetTypePage.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2002 International Business Machines Corp. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ui.internal.dialogs;
-
-import java.util.*;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.registry.WorkingSetDescriptor;
-import org.eclipse.ui.internal.registry.WorkingSetRegistry;
-
-/**
- * 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 final static int SIZING_SELECTION_WIDGET_WIDTH = 50;
- private final static int SIZING_SELECTION_WIDGET_HEIGHT = 200;
-
- private TableViewer typesListViewer;
- private Map icons;
-
- /**
- * Creates a new instance of the receiver
- */
- public WorkingSetTypePage() {
- super("workingSetTypeSelectionPage", WorkbenchMessages.getString("Select"), WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_WIZBAN_RESOURCEWORKINGSET_WIZ)); //$NON-NLS-1$ //$NON-NLS-2$
- setDescription(WorkbenchMessages.getString("WorkingSetTypePage.description")); //$NON-NLS-1$
- icons = new Hashtable();
- }
- /**
- * Overrides method in WizardPage
- *
- * @see org.eclipse.jface.wizard.IWizardPage#canFlipToNextPage()
- */
- public boolean canFlipToNextPage() {
- return isPageComplete();
- }
- /**
- * Populates the working set types list.
- */
- private void createContent() {
- WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
- WorkingSetDescriptor[] descriptors = registry.getWorkingSetDescriptors();
- Table table = (Table) typesListViewer.getControl();
-
- for (int i = 0; i < descriptors.length; i++) {
- TableItem tableItem = new TableItem(table, SWT.NULL);
- ImageDescriptor imageDescriptor = descriptors[i].getIcon();
-
- if (imageDescriptor != null) {
- Image icon = (Image) icons.get(imageDescriptor);
- if (icon == null) {
- icon = imageDescriptor.createImage();
- icons.put(imageDescriptor, icon);
- }
- tableItem.setImage(icon);
- }
- tableItem.setText(descriptors[i].getName());
- tableItem.setData(descriptors[i]);
- }
- }
- /**
- * Implements IDialogPage
- *
- * @see org.eclipse.jface.dialogs.IDialogPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- setControl(composite);
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.WORKING_SET_TYPE_PAGE);
- Label typesLabel = new Label(composite, SWT.NONE);
- typesLabel.setText(WorkbenchMessages.getString("WorkingSetTypePage.typesLabel")); //$NON-NLS-1$
- GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
- typesLabel.setLayoutData(data);
-
- typesListViewer = new TableViewer(composite, SWT.BORDER | SWT.MULTI);
- data = new GridData(GridData.FILL_BOTH);
- data.heightHint = SIZING_SELECTION_WIDGET_HEIGHT;
- data.widthHint = SIZING_SELECTION_WIDGET_WIDTH;
- typesListViewer.getTable().setLayoutData(data);
- typesListViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChanged();
- }
- });
- typesListViewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClick();
- }
- });
- createContent();
- setPageComplete(false);
- }
- /**
- * Overrides method in DialogPage
- *
- * @see org.eclipse.jface.dialogs.IDialogPage#dispose()
- */
- public void dispose() {
- Iterator iterator = icons.values().iterator();
-
- while (iterator.hasNext()) {
- Image icon = (Image) iterator.next();
- icon.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() {
- ISelection selection = typesListViewer.getSelection();
- boolean hasSelection = selection != null && selection.isEmpty() == false;
-
- if (hasSelection && selection instanceof IStructuredSelection) {
- WorkingSetDescriptor workingSetDescriptor = (WorkingSetDescriptor) ((IStructuredSelection) selection).getFirstElement();
- return workingSetDescriptor.getId();
- }
- return null;
- }
- /**
- * 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() {
- ISelection selection = typesListViewer.getSelection();
- boolean hasSelection = selection != null && selection.isEmpty() == false;
-
- setPageComplete(hasSelection);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ZipFileResourceExportOperation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ZipFileResourceExportOperation.java
deleted file mode 100644
index 7b2d126..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ZipFileResourceExportOperation.java
+++ /dev/null
@@ -1,310 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.jface.operation.*;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-/**
- * Operation for exporting a resource and its children to a new .zip file
- */
-/*package*/ class ZipFileResourceExportOperation implements IRunnableWithProgress {
- private ZipFileResourceExporter exporter;
- private String destinationFilename;
- private IProgressMonitor monitor;
- private int leadupStartDepth = 0;
- private List resourcesToExport;
- private IResource resource;
- private List errorTable = new ArrayList(1); //IStatus
-
- private boolean useCompression = true;
- private boolean createLeadupStructure = true;
- private boolean generateManifestFile = false;
-/**
- * Create an instance of this class. Use this constructor if you wish to
- * export specific resources without a common parent resource
- *
- * @param resources java.util.Vector
- * @param filename java.lang.String
- */
-public ZipFileResourceExportOperation(List resources,String filename) {
- super();
-
- // Eliminate redundancies in list of resources being exported
- Iterator elementsEnum = resources.iterator();
- while (elementsEnum.hasNext()) {
- IResource currentResource = (IResource) elementsEnum.next();
- if (isDescendent(resources, currentResource))
- elementsEnum.remove(); //Removes currentResource;
- }
-
- resourcesToExport = resources;
- destinationFilename = filename;
-}
-/**
- * Create an instance of this class. Use this constructor if you wish
- * to recursively export a single resource.
- *
- * @param res org.eclipse.core.resources.IResource;
- * @param filename java.lang.String
- */
-public ZipFileResourceExportOperation(IResource res,String filename) {
- super();
- resource = res;
- destinationFilename = filename;
-}
-/**
- * Create an instance of this class. Use this constructor if you wish to
- * export specific resources with a common parent resource (affects container
- * directory creation)
- *
- * @param res org.eclipse.core.resources.IResource
- * @param resources java.util.Vector
- * @param filename java.lang.String
- */
-public ZipFileResourceExportOperation(IResource res, List resources, String filename) {
- this(res,filename);
- resourcesToExport = resources;
-}
-/**
- * Add a new entry to the error table with the passed information
- */
-protected void addError(String message,Throwable e) {
- errorTable.add(
- new Status(
- IStatus.ERROR,
- PlatformUI.PLUGIN_ID,
- 0,
- message,
- e));
-}
-/**
- * Answer the total number of file resources that exist at or below self
- * in the resources hierarchy.
- *
- * @return int
- * @param resource org.eclipse.core.resources.IResource
- */
-protected int countChildrenOf(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE)
- return 1;
-
- int count = 0;
- if (resource.isAccessible()) {
- IResource[] children = ((IContainer) resource).members();
- for (int i = 0; i<children.length; i++)
- count += countChildrenOf(children[i]);
- }
-
- return count;
-}
-/**
- * Answer a boolean indicating the number of file resources that were
- * specified for export
- *
- * @return int
- */
-protected int countSelectedResources() throws CoreException {
- int result = 0;
- Iterator resources = resourcesToExport.iterator();
- while (resources.hasNext())
- result += countChildrenOf((IResource)resources.next());
-
- return result;
-}
-/**
- * Export the passed resource to the destination .zip
- *
- * @param resource org.eclipse.core.resources.IResource
- */
-protected void exportResource(IResource resource) throws InterruptedException {
- if (!resource.isAccessible())
- return;
-
- if (resource.getType() == IResource.FILE) {
- String destinationName = resource.getFullPath().removeFirstSegments(leadupStartDepth).toString();
- monitor.subTask(destinationName);
-
- try {
- exporter.write((IFile)resource,destinationName);
- } catch (IOException e) {
- addError(WorkbenchMessages.format("ZipExport.errorOnResource", new Object[] {resource.getFullPath()}) ,e); //$NON-NLS-1$
- } catch (CoreException e) {
- addError(WorkbenchMessages.format("ZipExport.errorOnResource", new Object[] {resource.getFullPath()}) ,e); //$NON-NLS-1$
- }
-
- monitor.worked(1);
- ModalContext.checkCanceled(monitor);
- } else {
- IResource[] children = null;
-
- try {
- children = ((IContainer)resource).members();
- } catch (CoreException e) {
- // this should never happen because an #isAccessible check is done before #members is invoked
- addError(WorkbenchMessages.format("ZipExport.errorOnResource", new Object[] {resource.getFullPath()}) ,e); //$NON-NLS-1$
- }
-
- for (int i = 0; i<children.length; i++)
- exportResource(children[i]);
- }
-}
-/**
- * Export the resources contained in the previously-defined
- * resourcesToExport collection
- */
-protected void exportSpecifiedResources() throws InterruptedException {
- Iterator resources = resourcesToExport.iterator();
-
- while (resources.hasNext()) {
- IResource currentResource = (IResource)resources.next();
- if (resource == null && !createLeadupStructure)
- leadupStartDepth = currentResource.getFullPath().segmentCount() - 1;
-
- exportResource(currentResource);
- }
-}
-/**
- * Answer the error table
- *
- * @return Vector of IStatus
- */
-public List getResult() {
- return errorTable;
-}
-/**
- * Returns the status of the operation.
- * If there were any errors, the result is a status object containing
- * individual status objects for each error.
- * If there were no errors, the result is a status object with error code <code>OK</code>.
- *
- * @return the status
- */
-public IStatus getStatus() {
- IStatus[] errors = new IStatus[errorTable.size()];
- errorTable.toArray(errors);
- return new MultiStatus(
- PlatformUI.PLUGIN_ID,
- IStatus.OK,
- errors,
- WorkbenchMessages.getString("ZipExport.problemEncountered"), //$NON-NLS-1$
- null);
-}
-/**
- * Initialize this operation
- *
- * @exception java.io.IOException
- */
-protected void initialize() throws IOException {
- exporter = new ZipFileResourceExporter(destinationFilename,useCompression,generateManifestFile);
-
- if (resource == null) // ie.- no parent resource was specified so just strip out projects
- leadupStartDepth = 1;
- else {
- leadupStartDepth = resource.getFullPath().segmentCount();
-
- if (resource.getType() == IResource.FILE)
- leadupStartDepth--;
-
- if (createLeadupStructure)
- leadupStartDepth = Math.min(1,leadupStartDepth);
- }
-}
-/**
- * Answer a boolean indicating whether the passed child is a descendent
- * of one or more members of the passed resources collection
- *
- * @return boolean
- * @param resources java.util.Vector
- * @param child org.eclipse.core.resources.IResource
- */
-protected boolean isDescendent(List resources, IResource child) {
- if (child.getType() == IResource.PROJECT)
- return false;
-
- IResource parent = child.getParent();
- if (resources.contains(parent))
- return true;
-
- return isDescendent(resources,parent);
-}
-/**
- * Export the resources that were previously specified for export
- * (or if a single resource was specified then export it recursively)
- */
-public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- this.monitor = monitor;
-
- try {
- initialize();
- } catch (IOException e) {
- throw new InvocationTargetException(e, WorkbenchMessages.getString("ZipExport.unableToOpen") + e.getMessage()); //$NON-NLS-1$
- }
-
- try {
- // ie.- a single resource for recursive export was specified
- int totalWork = IProgressMonitor.UNKNOWN;
- try {
- if (resourcesToExport == null)
- totalWork = countChildrenOf(resource);
- else
- totalWork = countSelectedResources();
- }
- catch (CoreException e) {
- // Should not happen
- }
- monitor.beginTask(WorkbenchMessages.getString("ZipExport.progress"), totalWork); //$NON-NLS-1$
- if (resourcesToExport == null) {
- exportResource(resource);
- }
- else {
- // ie.- a list of specific resources to export was specified
- exportSpecifiedResources();
- }
-
- try {
- exporter.finished();
- } catch (IOException e) {
- throw new InvocationTargetException(e, WorkbenchMessages.getString("ZipExport.unableToClose") + e.getMessage()); //$NON-NLS-1$
- }
- } finally {
- monitor.done();
- }
-}
-/**
- * Set this boolean indicating whether each exported resource's path should
- * include containment hierarchies as dictated by its parents
- *
- * @param value boolean
- */
-public void setCreateLeadupStructure(boolean value) {
- createLeadupStructure = value;
-}
-/**
- * Set this boolean indicating whether a manifest.mf file based upon
- * the exported contents should be created and included in the final
- * archive
- *
- * @param value boolean
- */
-public void setGenerateManifestFile(boolean value) {
- generateManifestFile = value;
-}
-/**
- * Set this boolean indicating whether exported resources should
- * be compressed (as opposed to simply being stored)
- *
- * @param value boolean
- */
-public void setUseCompression(boolean value) {
- useCompression = value;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ZipFileResourceExporter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ZipFileResourceExporter.java
deleted file mode 100644
index 50c76b8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/dialogs/ZipFileResourceExporter.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.eclipse.ui.internal.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.dialogs.*;
-import java.io.*;
-import java.security.*;
-import java.util.zip.*;
-
-/**
- * Exports resources to a .zip file
- */
-/*package*/ class ZipFileResourceExporter {
- private ZipOutputStream outputStream;
- private StringBuffer manifestContents;
-
- private boolean generateManifestFile = false;
- private boolean useCompression = true;
-
- // constants
- private static final String newline = "\r\n"; //$NON-NLS-1$
- private static final String manifestMagic = "Manifest-Version: 1.0" + newline + newline;//$NON-NLS-1$
- private static final String nameLabel = "Name: ";//$NON-NLS-1$
- private static final String digestsLabel = "Digest-Algorithms: SHA MD5" + newline;//$NON-NLS-1$
- private static final String shaLabel = "SHA-Digest: ";//$NON-NLS-1$
- private static final String md5Label = "MD5-Digest: ";//$NON-NLS-1$
- private static final String manifestPath = "meta-inf/Manifest.mf";//$NON-NLS-1$
-/**
- * Create an instance of this class.
- *
- * @param filename java.lang.String
- * @param compress boolean
- * @param includeManifestFile boolean
- * @exception java.io.IOException
- */
-public ZipFileResourceExporter(String filename,boolean compress,boolean includeManifestFile) throws IOException {
- outputStream = new ZipOutputStream(new FileOutputStream(filename));
- useCompression = compress;
- generateManifestFile = includeManifestFile;
-
- if (generateManifestFile)
- manifestContents = new StringBuffer(manifestMagic);
-}
-/**
- * Create a new entry in the manifest file being constructed.
- *
- * @param pathname java.lang.String
- * @param file org.eclipse.core.resources.IFile
- * @exception java.io.IOException
- * @exception org.eclipse.core.runtime.CoreException
- */
-protected void appendToManifest(String pathname, IFile file) throws IOException, CoreException {
- StringBuffer manifestEntry = new StringBuffer();
- manifestEntry.append(nameLabel);
- manifestEntry.append(pathname);
- manifestEntry.append(newline);
- manifestEntry.append(digestsLabel);
- manifestEntry.append(shaLabel);
-
- byte[] fileContents = null;
-
- // we don't have to EnsureLocal because it was already done in #write
- InputStream contentStream = file.getContents(false);
- Reader in = new InputStreamReader(contentStream);
- int chunkSize = contentStream.available();
- StringBuffer buffer = new StringBuffer(chunkSize);
- char[] readBuffer = new char[chunkSize];
- int n = in.read(readBuffer);
- while (n > 0) {
- buffer.append(readBuffer);
- n = in.read(readBuffer);
- }
- contentStream.close();
- fileContents = buffer.toString().getBytes();
-
- try {
- byte[] hashValue = MessageDigest.getInstance("SHA").digest(fileContents);//$NON-NLS-1$
- manifestEntry.append(InternalBase64Encoder.encode(hashValue));
- manifestEntry.append(newline);
- manifestEntry.append(md5Label);
- hashValue = MessageDigest.getInstance("MD5").digest(fileContents);//$NON-NLS-1$
- manifestEntry.append(InternalBase64Encoder.encode(hashValue));
- manifestEntry.append(newline + newline);
- } catch (NoSuchAlgorithmException e) {
- // should never happen
- return;
- }
- manifestContents.append(manifestEntry.toString());
-}
-/**
- * Do all required cleanup now that we're finished with the
- * currently-open .zip
- *
- * @exception java.io.IOException
- */
-public void finished() throws IOException {
- if (generateManifestFile)
- writeManifestFile();
-
- outputStream.close();
-}
-/**
- * Create a new ZipEntry with the passed pathname and contents, and write it
- * to the current archive
- *
- * @param pathname java.lang.String
- * @param contents byte[]
- * @exception java.io.IOException
- */
-protected void write(String pathname, byte[] contents) throws IOException {
- ZipEntry newEntry = new ZipEntry(pathname);
-
- // if the contents are being compressed then we get the below for free.
- if (!useCompression) {
- newEntry.setMethod(ZipEntry.STORED);
- newEntry.setSize(contents.length);
- CRC32 checksumCalculator = new CRC32();
- checksumCalculator.update(contents);
- newEntry.setCrc(checksumCalculator.getValue());
- }
-
- outputStream.putNextEntry(newEntry);
- outputStream.write(contents);
- outputStream.closeEntry();
-}
-/**
- * Write the passed resource to the current archive
- *
- * @param resource org.eclipse.core.resources.IFile
- * @param destinationPath java.lang.String
- * @exception java.io.IOException
- * @exception org.eclipse.core.runtime.CoreException
- */
-public void write(IFile resource, String destinationPath) throws IOException, CoreException {
- ByteArrayOutputStream output = null;
- InputStream contentStream = null;
-
- try {
- output = new ByteArrayOutputStream();
- contentStream = resource.getContents(false);
- int chunkSize = contentStream.available();
- byte[] readBuffer = new byte[chunkSize];
- int n = contentStream.read(readBuffer);
-
- while (n > 0) {
- output.write(readBuffer);
- n = contentStream.read(readBuffer);
- }
- } finally {
- if (output != null)
- output.close();
- if (contentStream != null)
- contentStream.close();
- }
-
- write(destinationPath,output.toByteArray());
- if (generateManifestFile)
- appendToManifest(destinationPath, resource);
-}
-/**
- * Write the constructed manifest.mf file to the current archive
- *
- * @exception java.io.IOException
- */
-protected void writeManifestFile() throws IOException {
- write(manifestPath,manifestContents.toString().getBytes());
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Action.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Action.java
deleted file mode 100644
index 7e44433..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Action.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import org.eclipse.ui.IMemento;
-
-public final class Action implements Comparable {
-
- public final static String TAG = "action";
- private final static String ATTRIBUTE_VALUE = "value";
-
- public static Action create(String value) {
- return new Action(value);
- }
-
- public static Action read(IMemento memento)
- throws IllegalArgumentException {
- if (memento == null)
- throw new IllegalArgumentException();
-
- return Action.create(memento.getString(ATTRIBUTE_VALUE));
- }
-
- public static void write(IMemento memento, Action action)
- throws IllegalArgumentException {
- if (memento == null || action == null)
- throw new IllegalArgumentException();
-
- memento.putString(ATTRIBUTE_VALUE, action.getValue());
- }
-
- private String value;
-
- private Action(String value) {
- super();
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
-
- public int compareTo(Object object) {
- if (!(object instanceof Action))
- throw new ClassCastException();
-
- return Util.compare(value, ((Action) object).value);
- }
-
- public boolean equals(Object object) {
- if (!(object instanceof Action))
- return false;
-
- String value = ((Action) object).value;
- return this.value == null ? value == null : this.value.equals(value);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/ActionMatch.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/ActionMatch.java
deleted file mode 100644
index 9f39083..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/ActionMatch.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-public final class ActionMatch {
-
- public static ActionMatch create(Action action, int match)
- throws IllegalArgumentException {
- return new ActionMatch(action, match);
- }
-
- private Action action;
- private int match;
-
- private ActionMatch(Action action, int match)
- throws IllegalArgumentException {
- if (action == null || match < 0)
- throw new IllegalArgumentException();
-
- this.action = action;
- this.match = match;
- }
-
- public Action getAction() {
- return action;
- }
-
- public int getMatch() {
- return match;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Configuration.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Configuration.java
deleted file mode 100644
index 1c804c4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Configuration.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import org.eclipse.ui.IMemento;
-
-public final class Configuration {
-
- public final static String TAG = "configuration";
-
- public static Configuration create() {
- return new Configuration(Path.create());
- }
-
- public static Configuration create(Path path)
- throws IllegalArgumentException {
- return new Configuration(path);
- }
-
- public static Configuration read(IMemento memento)
- throws IllegalArgumentException {
- if (memento == null)
- throw new IllegalArgumentException();
-
- return Configuration.create(Path.read(memento.getChild(Path.TAG)));
- }
-
- public static void write(IMemento memento, Configuration configuration)
- throws IllegalArgumentException {
- if (memento == null || configuration == null)
- throw new IllegalArgumentException();
-
- Path.write(memento.createChild(Path.TAG), configuration.getPath());
- }
-
- private Path path;
-
- private Configuration(Path path)
- throws IllegalArgumentException {
- super();
-
- if (path == null)
- throw new IllegalArgumentException();
-
- this.path = path;
- }
-
- public Path getPath() {
- return path;
- }
-
- public int match(Configuration configuration)
- throws IllegalArgumentException {
- if (configuration == null)
- throw new IllegalArgumentException();
-
- return (path.match(configuration.path));
- }
-
- public int compareTo(Object object) {
- if (!(object instanceof Configuration))
- throw new ClassCastException();
-
- return path.compareTo(((Configuration) object).path);
- }
-
- public boolean equals(Object object) {
- if (!(object instanceof Configuration))
- return false;
-
- return path.equals(((Configuration) object).path);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Contributor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Contributor.java
deleted file mode 100644
index 56e66c9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Contributor.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import org.eclipse.ui.IMemento;
-
-public final class Contributor implements Comparable {
-
- public final static String TAG = "contributor";
- private final static String ATTRIBUTE_VALUE = "value";
-
- public static Contributor create(String value) {
- return new Contributor(value);
- }
-
- public static Contributor read(IMemento memento)
- throws IllegalArgumentException {
- if (memento == null)
- throw new IllegalArgumentException();
-
- return Contributor.create(memento.getString(ATTRIBUTE_VALUE));
- }
-
- public static void write(IMemento memento, Contributor contributor)
- throws IllegalArgumentException {
- if (memento == null || contributor == null)
- throw new IllegalArgumentException();
-
- memento.putString(ATTRIBUTE_VALUE, contributor.getValue());
- }
-
- private String value;
-
- private Contributor(String value) {
- super();
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
-
- public int compareTo(Object object) {
- if (!(object instanceof Contributor))
- throw new ClassCastException();
-
- return Util.compare(value, ((Contributor) object).value);
- }
-
- public boolean equals(Object object) {
- if (!(object instanceof Contributor))
- return false;
-
- String value = ((Contributor) object).value;
- return this.value == null ? value == null : this.value.equals(value);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Element.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Element.java
deleted file mode 100644
index 22cc242..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Element.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import org.eclipse.ui.IMemento;
-
-public final class Element implements Comparable {
-
- public final static String TAG = "element";
- private final static String ATTRIBUTE_VALUE = "value";
-
- public static Element create(String value)
- throws IllegalArgumentException {
- return new Element(value);
- }
-
- public static Element[] create(String[] values)
- throws IllegalArgumentException {
- if (values == null)
- throw new IllegalArgumentException();
-
- Element[] elements = new Element[values.length];
-
- for (int i = 0; i < values.length; i++)
- elements[i] = create(values[i]);
-
- return elements;
- }
-
- public static Element read(IMemento memento)
- throws IllegalArgumentException {
- if (memento == null)
- throw new IllegalArgumentException();
-
- return Element.create(memento.getString(ATTRIBUTE_VALUE));
- }
-
- public static void write(IMemento memento, Element element)
- throws IllegalArgumentException {
- if (memento == null || element == null)
- throw new IllegalArgumentException();
-
- memento.putString(ATTRIBUTE_VALUE, element.getValue());
- }
-
- private String value;
-
- private Element(String value)
- throws IllegalArgumentException {
- super();
-
- if (value == null)
- throw new IllegalArgumentException();
-
- this.value = value;
- }
-
- public String getValue() {
- return value;
- }
-
- public int compareTo(Object object) {
- if (!(object instanceof Element))
- throw new ClassCastException();
-
- return value.compareTo(((Element) object).value);
- }
-
- public boolean equals(Object object) {
- if (!(object instanceof Element))
- return false;
-
- return value.equals(((Element) object).value);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeyBinding.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeyBinding.java
deleted file mode 100644
index ad85940..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeyBinding.java
+++ /dev/null
@@ -1,236 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.Writer;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.XMLMemento;
-
-public final class KeyBinding implements Comparable {
-
- public final static String ROOT = "keybindings";
- public final static String TAG = "keybinding";
-
- public static KeyBinding create(KeySequence keySequence, State state,
- Contributor contributor, Action action)
- throws IllegalArgumentException {
- return new KeyBinding(keySequence, state, contributor, action);
- }
-
- public static KeyBinding read(IMemento memento)
- throws IllegalArgumentException {
- if (memento == null)
- throw new IllegalArgumentException();
-
- KeySequence sequence =
- KeySequence.read(memento.getChild(KeySequence.TAG));
- State state = State.read(memento.getChild(State.TAG));
- Contributor contributor =
- Contributor.read(memento.getChild(Contributor.TAG));
- Action action = Action.read(memento.getChild(Action.TAG));
- return KeyBinding.create(sequence, state, contributor, action);
- }
-
- public static void write(IMemento memento, KeyBinding binding)
- throws IllegalArgumentException {
- if (memento == null || binding == null)
- throw new IllegalArgumentException();
-
- KeySequence.write(memento.createChild(KeySequence.TAG),
- binding.getKeySequence());
- State.write(memento.createChild(State.TAG), binding.getState());
- Contributor.write(memento.createChild(Contributor.TAG),
- binding.getContributor());
- Action.write(memento.createChild(Action.TAG), binding.getAction());
- }
-
- public static List readBindingsFromReader(Reader reader)
- throws IOException {
- try {
- XMLMemento xmlMemento = XMLMemento.createReadRoot(reader);
- return readBindings(xmlMemento);
- } catch (WorkbenchException eWorkbench) {
- throw new IOException();
- }
- }
-
- public static void writeBindingsToWriter(Writer writer, String root,
- List bindings)
- throws IOException {
- XMLMemento xmlMemento = XMLMemento.createWriteRoot(root);
- writeBindings(xmlMemento, bindings);
- xmlMemento.save(writer);
- }
-
- public static List readBindings(IMemento memento)
- throws IllegalArgumentException {
- if (memento == null)
- throw new IllegalArgumentException();
-
- IMemento[] mementos = memento.getChildren(KeyBinding.TAG);
-
- if (mementos == null)
- throw new IllegalArgumentException();
-
- List bindings = new ArrayList(mementos.length);
-
- for (int i = 0; i < mementos.length; i++)
- bindings.add(KeyBinding.read(mementos[i]));
-
- return bindings;
- }
-
- public static void writeBindings(IMemento memento, List bindings)
- throws IllegalArgumentException {
- if (memento == null || bindings == null)
- throw new IllegalArgumentException();
-
- Iterator iterator = bindings.iterator();
-
- while (iterator.hasNext())
- KeyBinding.write(memento.createChild(KeyBinding.TAG),
- (KeyBinding) iterator.next());
- }
-
- public static void filterAction(List bindings, Set actions,
- boolean exclusive) {
- Iterator iterator = bindings.iterator();
-
- while (iterator.hasNext()) {
- KeyBinding binding = (KeyBinding) iterator.next();
- Action action = binding.getAction();
-
- if (exclusive ^ !actions.contains(action))
- iterator.remove();
- }
- }
-
- public static void filterConfiguration(List bindings, Set configurations,
- boolean exclusive) {
- Iterator iterator = bindings.iterator();
-
- while (iterator.hasNext()) {
- KeyBinding binding = (KeyBinding) iterator.next();
- State state = binding.getState();
- Configuration configuration = state.getConfiguration();
-
- if (exclusive ^ !configurations.contains(configuration))
- iterator.remove();
- }
- }
-
- public static void filterLocale(List bindings, Set locales,
- boolean exclusive) {
- Iterator iterator = bindings.iterator();
-
- while (iterator.hasNext()) {
- KeyBinding binding = (KeyBinding) iterator.next();
- State state = binding.getState();
- Locale locale = state.getLocale();
-
- if (exclusive ^ !locales.contains(locale))
- iterator.remove();
- }
- }
-
- public static void filterPlatform(List bindings, Set platforms,
- boolean exclusive) {
- Iterator iterator = bindings.iterator();
-
- while (iterator.hasNext()) {
- KeyBinding binding = (KeyBinding) iterator.next();
- State state = binding.getState();
- Platform platform = state.getPlatform();
-
- if (exclusive ^ !platforms.contains(platform))
- iterator.remove();
- }
- }
-
- public static void filterScope(List bindings, Set scopes,
- boolean exclusive) {
- Iterator iterator = bindings.iterator();
-
- while (iterator.hasNext()) {
- KeyBinding binding = (KeyBinding) iterator.next();
- State state = binding.getState();
- Scope scope = state.getScope();
-
- if (exclusive ^ !scopes.contains(scope))
- iterator.remove();
- }
- }
-
- private KeySequence keySequence;
- private State state;
- private Contributor contributor;
- private Action action;
-
- private KeyBinding(KeySequence keySequence, State state,
- Contributor contributor, Action action)
- throws IllegalArgumentException {
- super();
-
- if (keySequence == null || state == null || contributor == null ||
- action == null)
- throw new IllegalArgumentException();
-
- this.keySequence = keySequence;
- this.state = state;
- this.contributor = contributor;
- this.action = action;
- }
-
- public KeySequence getKeySequence() {
- return keySequence;
- }
-
- public State getState() {
- return state;
- }
-
- public Contributor getContributor() {
- return contributor;
- }
-
- public Action getAction() {
- return action;
- }
-
- public int compareTo(Object object) {
- if (!(object instanceof KeyBinding))
- throw new ClassCastException();
-
- KeyBinding binding = (KeyBinding) object;
- int compareTo = keySequence.compareTo(binding.keySequence);
-
- if (compareTo == 0) {
- compareTo = state.compareTo(binding.state);
-
- if (compareTo == 0)
- compareTo = contributor.compareTo(binding.contributor);
-
- if (compareTo == 0)
- compareTo = action.compareTo(binding.action);
- }
-
- return compareTo;
- }
-
- public boolean equals(Object object) {
- if (!(object instanceof KeyBinding))
- return false;
-
- KeyBinding binding = (KeyBinding) object;
- return keySequence.equals(binding.keySequence) &&
- state.equals(binding.state) &&
- contributor.equals(binding.contributor) &&
- action.equals(binding.action);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeyBindingManager.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeyBindingManager.java
deleted file mode 100644
index d34c791..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeyBindingManager.java
+++ /dev/null
@@ -1,397 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.SortedSet;
-import java.util.StringTokenizer;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.registry.Accelerator;
-import org.eclipse.ui.internal.registry.AcceleratorConfiguration;
-import org.eclipse.ui.internal.registry.AcceleratorRegistry;
-import org.eclipse.ui.internal.registry.AcceleratorScope;
-import org.eclipse.ui.internal.registry.AcceleratorSet;
-
-public final class KeyBindingManager {
-
- private final static String KEY_SEQUENCE_SEPARATOR = ", ";
- private final static String KEY_STROKE_SEPARATOR = " ";
-
- private static KeyBindingManager instance;
-
- public static KeyBindingManager getInstance() {
- if (instance == null)
- instance = new KeyBindingManager();
-
- return instance;
- }
-
- private SortedMap configurationMap = new TreeMap();
- private SortedMap scopeMap = new TreeMap();
-
- private List bindings = new ArrayList();
- private SortedMap tree = new TreeMap();
-
- private Configuration configuration = Configuration.create();
- private Locale locale = Locale.system();
- private Platform platform = Platform.system();
- private Scope[] scopes = new Scope[] { Scope.create() };
-
- private KeySequence mode = KeySequence.create();
- private SortedMap keySequenceActionMap = null;
- private SortedMap keySequenceActionMapForMode = null;
-
- private KeyBindingManager() {
- super();
- AcceleratorRegistry acceleratorRegistry =
- WorkbenchPlugin.getDefault().getAcceleratorRegistry();
- AcceleratorConfiguration[] acceleratorConfigurations =
- acceleratorRegistry.getConfigurations();
-
- for (int i = 0; i < acceleratorConfigurations.length; i++) {
- AcceleratorConfiguration acceleratorConfiguration =
- acceleratorConfigurations[i];
- String id = acceleratorConfiguration.getId();
- String initialId = id;
- List elements = new ArrayList();
- acceleratorConfiguration =
- acceleratorConfiguration.getParentConfiguration();
-
- while (acceleratorConfiguration != null) {
- elements.add(0, Element.create(id));
- id = acceleratorConfiguration.getId();
- acceleratorConfiguration =
- acceleratorConfiguration.getParentConfiguration();
- }
-
- configurationMap.put(initialId,
- Configuration.create(Path.create(elements)));
- }
-
- AcceleratorScope[] acceleratorScopes = acceleratorRegistry.getScopes();
-
- for (int i = 0; i < acceleratorScopes.length; i++) {
- AcceleratorScope acceleratorScope = acceleratorScopes[i];
- String id = acceleratorScope.getId();
- String initialId = id;
- List elements = new ArrayList();
- acceleratorScope = acceleratorScope.getParentScope();
-
- while (acceleratorScope != null) {
- elements.add(0, Element.create(id));
- id = acceleratorScope.getId();
- acceleratorScope = acceleratorScope.getParentScope();
- }
-
- scopeMap.put(initialId,
- Scope.create(Path.create(elements)));
- }
-
- List acceleratorSets = acceleratorRegistry.getAcceleratorSets();
-
- for (Iterator iterator = acceleratorSets.iterator();
- iterator.hasNext();) {
- AcceleratorSet acceleratorSet = (AcceleratorSet) iterator.next();
- Accelerator[] accelerators = acceleratorSet.getAccelerators();
-
- String configurationId = acceleratorSet.getConfigurationId();
- Configuration configuration =
- (Configuration) configurationMap.get(configurationId);
-
- String scopeId = acceleratorSet.getScopeId();
- Scope scope = (Scope) scopeMap.get(scopeId);
-
- if (configuration != null && scope != null) {
- for (int i = 0; i < accelerators.length; i++) {
- Accelerator accelerator = accelerators[i];
- int[][] a = accelerator.getAccelerators();
- String id = accelerator.getId();
- String localeString = accelerator.getLocale();
- List localeElements = new ArrayList();
-
- if (!localeString.equals(Accelerator.DEFAULT_LOCALE)) {
- StringTokenizer st =
- new StringTokenizer(localeString, "_");
-
- while (st.hasMoreElements()) {
- String element = ((String) st.nextElement()).trim();
-
- if (element.length() > 0) {
- localeElements.add(element);
- }
- }
- }
-
- Locale locale = Locale.create(Path.create(localeElements));
- String platformString = accelerator.getPlatform();
- List platformElements = new ArrayList();
-
- if (!platformString.equals(Accelerator.DEFAULT_PLATFORM))
- platformElements.add(platformString);
-
- Platform platform =
- Platform.create(Path.create(platformElements));
- State state =
- State.create(configuration, locale, platform, scope);
-
- // TBD:
- Contributor contributor = Contributor.create("");
- Action action = Action.create(id);
-
- for (int j = 0; j < a.length; j++) {
- int[] b = a[j];
- List strokes = new ArrayList();
-
- for (int k = 0; k < b.length; k++) {
- strokes.add(KeyStroke.create(b[k]));
- }
-
- KeySequence sequence = KeySequence.create(strokes);
- Node.addToTree(tree, KeyBinding.create(sequence, state,
- contributor, action));
- }
- }
- }
- }
-
- // TBD: add all custom bindings here..
- // don't forget to add them: Node.addToTree(tree, binding);
-
- /*
- try {
- FileWriter fileWriter = new FileWriter("c:\\bindings.xml");
- KeyBinding.writeBindingsToWriter(fileWriter, KeyBinding.ROOT,
- Node.toBindings(tree));
- } catch (IOException eIO) {
- }
- */
-
- solve();
- }
-
- public Configuration getConfigurationForId(String id) {
- return (Configuration) configurationMap.get(id);
- }
-
- public Scope getScopeForId(String id) {
- return (Scope) scopeMap.get(id);
- }
-
- public Configuration getConfiguration() {
- return configuration;
- }
-
- public void setConfiguration(Configuration configuration)
- throws IllegalArgumentException {
- if (configuration == null)
- throw new IllegalArgumentException();
-
- if (!this.configuration.equals(configuration)) {
- this.configuration = configuration;
- solve();
- }
- }
-
- public Scope[] getScopes() {
- Scope[] scopes = new Scope[this.scopes.length];
- System.arraycopy(this.scopes, 0, scopes, 0, this.scopes.length);
- return scopes;
- }
-
- public void setScopes(Scope[] scopes)
- throws IllegalArgumentException {
- if (scopes == null || scopes.length < 1)
- throw new IllegalArgumentException();
-
- Scope[] scopesCopy = new Scope[scopes.length];
- System.arraycopy(scopes, 0, scopesCopy, 0, scopes.length);
-
- if (!Arrays.equals(this.scopes, scopesCopy)) {
- this.scopes = scopesCopy;
- solve();
- }
- }
-
- public KeySequence getMode() {
- return mode;
- }
-
- public void setMode(KeySequence mode)
- throws IllegalArgumentException {
- if (mode == null)
- throw new IllegalArgumentException();
-
- this.mode = mode;
- keySequenceActionMap = null;
- keySequenceActionMapForMode = null;
- }
-
- public SortedMap getActionKeySequenceSetMap() {
- SortedMap actionKeySequenceSetMap = new TreeMap();
- SortedMap keySequenceActionMap = getKeySequenceActionMap();
- Iterator iterator = keySequenceActionMap.entrySet().iterator();
-
- while (iterator.hasNext()) {
- Map.Entry entry = (Map.Entry) iterator.next();
- KeySequence keySequence = (KeySequence) entry.getKey();
- Action action = (Action) entry.getValue();
- SortedSet keySequenceSet =
- (SortedSet) actionKeySequenceSetMap.get(action);
-
- if (keySequenceSet == null) {
- keySequenceSet = new TreeSet();
- actionKeySequenceSetMap.put(action, keySequenceSet);
- }
-
- keySequenceSet.add(keySequence);
- }
-
- return actionKeySequenceSetMap;
- }
-
- public SortedMap getActionKeySequenceSetMapForMode() {
- SortedMap actionKeySequenceSetMap = new TreeMap();
- SortedMap keySequenceActionMap = getKeySequenceActionMapForMode();
- Iterator iterator = keySequenceActionMap.entrySet().iterator();
-
- while (iterator.hasNext()) {
- Map.Entry entry = (Map.Entry) iterator.next();
- KeySequence keySequence = (KeySequence) entry.getKey();
- Action action = (Action) entry.getValue();
- SortedSet keySequenceSet =
- (SortedSet) actionKeySequenceSetMap.get(action);
-
- if (keySequenceSet == null) {
- keySequenceSet = new TreeSet();
- actionKeySequenceSetMap.put(action, keySequenceSet);
- }
-
- keySequenceSet.add(keySequence);
- }
-
- return actionKeySequenceSetMap;
- }
-
- public SortedMap getKeySequenceActionMap() {
- /*
- if (keySequenceActionMap == null) {
- if (tree != null)
- keySequenceActionMap = Collections.unmodifiableSortedMap(
- Node.toKeySequenceActionMap(tree));
- }
-
- return keySequenceActionMap;
- */
-
- if (tree != null)
- return Collections.unmodifiableSortedMap(
- Node.toKeySequenceActionMap(tree));
- else
- return null;
- }
-
- public SortedMap getKeySequenceActionMapForMode() {
- /*
- if (keySequenceActionMapForMode == null) {
- SortedMap tree = Node.find(this.tree, mode);
-
- if (tree != null)
- keySequenceActionMapForMode = Collections.unmodifiableSortedMap(
- Node.toKeySequenceActionMap(tree));
- }
-
- return keySequenceActionMapForMode;
- */
-
- if (tree == null)
- return null;
-
- SortedMap tree = Node.find(this.tree, mode);
-
- if (tree != null)
- return Collections.unmodifiableSortedMap(
- Node.toKeySequenceActionMap(tree));
- else
- return null;
- }
-
- public SortedSet getStrokeSetForMode() {
- SortedSet strokeSetForMode = new TreeSet();
- SortedMap keySequenceActionMapForMode =
- getKeySequenceActionMapForMode();
- Iterator iterator = keySequenceActionMapForMode.keySet().iterator();
-
- while (iterator.hasNext()) {
- KeySequence keySequence = (KeySequence) iterator.next();
- List keyStrokes = keySequence.getKeyStrokes();
-
- if (keyStrokes.size() >= 1)
- strokeSetForMode.add(keyStrokes.get(0));
- }
-
- return strokeSetForMode;
- }
-
- public String getAcceleratorTextForAction(String action)
- throws IllegalArgumentException {
- if (action == null)
- throw new IllegalArgumentException();
-
- SortedMap actionSequenceMap = getActionKeySequenceSetMap();
- SortedSet keySequenceSet =
- (SortedSet) actionSequenceMap.get(Action.create(action));
-
- if (keySequenceSet == null)
- return null;
- else {
- Iterator iterator = keySequenceSet.iterator();
- StringBuffer stringBuffer = new StringBuffer();
- int i = 0;
-
- while (iterator.hasNext()) {
- if (i != 0)
- stringBuffer.append(KEY_SEQUENCE_SEPARATOR);
-
- KeySequence keySequence = (KeySequence) iterator.next();
- Iterator iterator2 = keySequence.getKeyStrokes().iterator();
- int j = 0;
-
- while (iterator2.hasNext()) {
- if (j != 0)
- stringBuffer.append(KEY_STROKE_SEPARATOR);
-
- KeyStroke keyStroke = (KeyStroke) iterator2.next();
- int accelerator = keyStroke.getAccelerator();
- stringBuffer.append(
- org.eclipse.jface.action.Action.convertAccelerator(
- accelerator));
- j++;
- }
-
- i++;
- }
-
- return stringBuffer.toString();
- }
- }
-
- private void solve() {
- State[] states = new State[scopes.length];
-
- for (int i = 0; i < scopes.length; i++) {
- states[i] = State.create(configuration, locale, platform,
- scopes[i]);
- }
-
- Node.solveTree(tree, states);
- keySequenceActionMap = null;
- keySequenceActionMapForMode = null;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeySequence.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeySequence.java
deleted file mode 100644
index ead69d2..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeySequence.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.ui.IMemento;
-
-public final class KeySequence implements Comparable {
-
- public final static String TAG = "keysequence";
-
- public static KeySequence create() {
- return new KeySequence(Collections.EMPTY_LIST);
- }
-
- public static KeySequence create(KeyStroke keyStroke)
- throws IllegalArgumentException {
- return new KeySequence(Collections.singletonList(keyStroke));
- }
-
- public static KeySequence create(KeyStroke[] keyStrokes)
- throws IllegalArgumentException {
- return new KeySequence(Arrays.asList(keyStrokes));
- }
-
- public static KeySequence create(List keyStrokes)
- throws IllegalArgumentException {
- return new KeySequence(keyStrokes);
- }
-
- public static KeySequence read(IMemento memento)
- throws IllegalArgumentException {
- if (memento == null)
- throw new IllegalArgumentException();
-
- IMemento[] mementos = memento.getChildren(KeyStroke.TAG);
-
- if (mementos == null)
- throw new IllegalArgumentException();
-
- List keyStrokes = new ArrayList(mementos.length);
-
- for (int i = 0; i < mementos.length; i++)
- keyStrokes.add(KeyStroke.read(mementos[i]));
-
- return KeySequence.create(keyStrokes);
- }
-
- public static void write(IMemento memento, KeySequence sequence)
- throws IllegalArgumentException {
- if (memento == null || sequence == null)
- throw new IllegalArgumentException();
-
- Iterator iterator = sequence.getKeyStrokes().iterator();
-
- while (iterator.hasNext())
- KeyStroke.write(memento.createChild(KeyStroke.TAG),
- (KeyStroke) iterator.next());
- }
-
- private List keyStrokes;
-
- private KeySequence(List keyStrokes)
- throws IllegalArgumentException {
- super();
-
- if (keyStrokes == null)
- throw new IllegalArgumentException();
-
- this.keyStrokes =
- Collections.unmodifiableList(new ArrayList(keyStrokes));
- Iterator iterator = this.keyStrokes.iterator();
-
- while (iterator.hasNext())
- if (!(iterator.next() instanceof KeyStroke))
- throw new IllegalArgumentException();
- }
-
- public List getKeyStrokes() {
- return keyStrokes;
- }
-
- public int compareTo(Object object) {
- if (!(object instanceof KeySequence))
- throw new ClassCastException();
-
- return Util.compare(keyStrokes.iterator(),
- ((KeySequence) object).keyStrokes.iterator());
- }
-
- public boolean equals(Object object) {
- return object instanceof KeySequence &&
- keyStrokes.equals(((KeySequence) object).keyStrokes);
- }
-
- public boolean equalsOrIsChildOf(KeySequence keySequence) {
- return keyStrokes.size() >= keySequence.keyStrokes.size() &&
- keyStrokes.subList(0, keySequence.keyStrokes.size()).equals(
- keySequence.keyStrokes);
- }
-
- public boolean isChildOf(KeySequence keySequence) {
- return keyStrokes.size() > keySequence.keyStrokes.size() &&
- keyStrokes.subList(0, keySequence.keyStrokes.size()).equals(
- keySequence.keyStrokes);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeyStroke.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeyStroke.java
deleted file mode 100644
index 522df93..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/KeyStroke.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import org.eclipse.ui.IMemento;
-
-public final class KeyStroke implements Comparable {
-
- public final static String TAG = "keystroke";
- private final static String ATTRIBUTE_ACCELERATOR = "accelerator";
-
- public static KeyStroke create(int accelerator) {
- return new KeyStroke(accelerator);
- }
-
- public static KeyStroke[] create(int[] accelerators)
- throws IllegalArgumentException {
- if (accelerators == null)
- throw new IllegalArgumentException();
-
- KeyStroke[] keyStrokes = new KeyStroke[accelerators.length];
-
- for (int i = 0; i < accelerators.length; i++)
- keyStrokes[i] = create(accelerators[i]);
-
- return keyStrokes;
- }
-
- public static KeyStroke read(IMemento memento)
- throws IllegalArgumentException {
- if (memento == null)
- throw new IllegalArgumentException();
-
- Integer accelerator = memento.getInteger(ATTRIBUTE_ACCELERATOR);
-
- if (accelerator == null)
- throw new IllegalArgumentException();
-
- return KeyStroke.create(accelerator.intValue());
- }
-
- public static void write(IMemento memento, KeyStroke keyStroke)
- throws IllegalArgumentException {
- if (memento == null || keyStroke == null)
- throw new IllegalArgumentException();
-
- memento.putInteger(ATTRIBUTE_ACCELERATOR, keyStroke.getAccelerator());
- }
-
- private int accelerator;
-
- private KeyStroke(int accelerator) {
- super();
- this.accelerator = accelerator;
- }
-
- public int getAccelerator() {
- return accelerator;
- }
-
- public int compareTo(Object object) {
- if (!(object instanceof KeyStroke))
- throw new ClassCastException();
-
- return accelerator - ((KeyStroke) object).accelerator;
- }
-
- public boolean equals(Object object) {
- return object instanceof KeyStroke &&
- accelerator == ((KeyStroke) object).accelerator;
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Locale.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Locale.java
deleted file mode 100644
index 9a534df..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Locale.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.ui.IMemento;
-
-public final class Locale {
-
- public final static String TAG = "locale";
-
- public static Locale create() {
- return new Locale(Path.create());
- }
-
- public static Locale create(Path path)
- throws IllegalArgumentException {
- return new Locale(path);
- }
-
- public static Locale read(IMemento memento)
- throws IllegalArgumentException {
- if (memento == null)
- throw new IllegalArgumentException();
-
- return Locale.create(Path.read(memento.getChild(Path.TAG)));
- }
-
- public static void write(IMemento memento, Locale locale)
- throws IllegalArgumentException {
- if (memento == null || locale == null)
- throw new IllegalArgumentException();
-
- Path.write(memento.createChild(Path.TAG), locale.getPath());
- }
-
- public static Locale system() {
- List elements = new ArrayList();
- java.util.Locale locale = java.util.Locale.getDefault();
-
- if (locale != null) {
- String language = locale.getLanguage();
-
- if (language != null && language.length() > 0) {
- elements.add(Element.create(language));
- String country = locale.getCountry();
-
- if (country != null && country.length() > 0) {
- elements.add(Element.create(country));
- String variant = locale.getVariant();
-
- if (variant != null && variant.length() > 0)
- elements.add(Element.create(variant));
- }
- }
- }
-
- return Locale.create(Path.create(elements));
- }
-
- private Path path;
-
- private Locale(Path path)
- throws IllegalArgumentException {
- super();
-
- if (path == null)
- throw new IllegalArgumentException();
-
- this.path = path;
- }
-
- public Path getPath() {
- return path;
- }
-
- public int match(Locale locale)
- throws IllegalArgumentException {
- if (locale == null)
- throw new IllegalArgumentException();
-
- return (path.match(locale.path));
- }
-
- public int compareTo(Object object) {
- if (!(object instanceof Locale))
- throw new ClassCastException();
-
- return path.compareTo(((Locale) object).path);
- }
-
- public boolean equals(Object object) {
- if (!(object instanceof Locale))
- return false;
-
- return path.equals(((Locale) object).path);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Node.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Node.java
deleted file mode 100644
index aa0183d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Node.java
+++ /dev/null
@@ -1,316 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.SortedMap;
-import java.util.SortedSet;
-import java.util.TreeMap;
-import java.util.TreeSet;
-
-public class Node {
-
- public static boolean add(SortedMap contributions,
- Contributor contributor, Action action)
- throws IllegalArgumentException {
- if (contributions == null || contributor == null || action == null)
- throw new IllegalArgumentException();
-
- SortedSet actions = (SortedSet) contributions.get(contributor);
-
- if (actions == null) {
- actions = new TreeSet();
- contributions.put(contributor, actions);
- }
-
- return actions.add(action);
- }
-
- public static boolean remove(SortedMap contributions,
- Contributor contributor, Action action)
- throws IllegalArgumentException {
- if (contributions == null || contributor == null || action == null)
- throw new IllegalArgumentException();
-
- SortedSet actions = (SortedSet) contributions.get(contributor);
-
- if (actions == null)
- return false;
-
- boolean removed = actions.remove(action);
-
- if (actions.isEmpty())
- contributions.remove(contributor);
-
- return removed;
- }
-
- public static Action solve(SortedMap contributions)
- throws IllegalArgumentException {
- if (contributions == null)
- throw new IllegalArgumentException();
-
- SortedSet actions =
- (SortedSet) contributions.get(Contributor.create(null));
-
- if (actions == null) {
- actions = new TreeSet();
- Iterator iterator = contributions.values().iterator();
-
- while (iterator.hasNext())
- actions.addAll((SortedSet) iterator.next());
- }
-
- return actions.size() == 1 ?
- (Action) actions.first() : Action.create(null);
- }
-
- public static boolean add(SortedMap states, State state,
- Contributor contributor, Action action)
- throws IllegalArgumentException {
- if (states == null || state == null || contributor == null ||
- action == null)
- throw new IllegalArgumentException();
-
- SortedMap contributions = (SortedMap) states.get(state);
-
- if (contributions != null) {
- contributions = new TreeMap();
- states.put(state, contributions);
- }
-
- return add(contributions, contributor, action);
- }
-
- public static boolean remove(SortedMap states, State state,
- Contributor contributor, Action action)
- throws IllegalArgumentException {
- if (states == null || state == null || contributor == null ||
- action == null)
- throw new IllegalArgumentException();
-
- SortedMap contributions = (SortedMap) states.get(state);
-
- if (contributions == null)
- return false;
-
- boolean removed = remove(contributions, contributor, action);
-
- if (contributions.isEmpty())
- states.remove(contributions);
-
- return removed;
- }
-
- public static ActionMatch solve(SortedMap states, State state)
- throws IllegalArgumentException {
- if (states == null || state == null)
- throw new IllegalArgumentException();
-
- ActionMatch actionMatch = null;
- Iterator iterator = states.entrySet().iterator();
-
- while (iterator.hasNext()) {
- Map.Entry entry = (Map.Entry) iterator.next();
- State testState = (State) entry.getKey();
- SortedMap testContributions = (SortedMap) entry.getValue();
-
- if (testContributions != null) {
- Action testAction = solve(testContributions);
-
- if (testAction != null && testAction.getValue() != null) {
- int match = testState.match(state);
-
- if (match >= 0) {
- if (match == 0)
- return ActionMatch.create(testAction, 0);
- else if (actionMatch == null ||
- match < actionMatch.getMatch())
- actionMatch = ActionMatch.create(testAction, match);
- }
- }
- }
- }
-
- return actionMatch;
- }
-
- public static ActionMatch solve(SortedMap states, State[] stack)
- throws IllegalArgumentException {
- if (states == null || stack == null)
- throw new IllegalArgumentException();
-
- for (int i = 0; i < stack.length; i++) {
- if (stack == null)
- throw new IllegalArgumentException();
- }
-
- for (int i = 0; i < stack.length; i++) {
- ActionMatch actionMatch = solve(states, stack[i]);
-
- if (actionMatch != null)
- return actionMatch;
- }
-
- return null;
- }
-
- public static void addToTree(SortedMap tree, KeyBinding keyBinding) {
- List keyStrokes = keyBinding.getKeySequence().getKeyStrokes();
- SortedMap root = tree;
- Node node = null;
-
- for (int i = 0; i < keyStrokes.size(); i++) {
- KeyStroke keyStroke = (KeyStroke) keyStrokes.get(i);
- node = (Node) root.get(keyStroke);
-
- if (node == null) {
- node = new Node();
- root.put(keyStroke, node);
- }
-
- root = node.children;
- }
-
- if (node != null) {
- SortedMap states = node.states;
- State state = keyBinding.getState();
- SortedMap contributorToActionSetMap = (SortedMap) states.get(state);
-
- if (contributorToActionSetMap == null) {
- contributorToActionSetMap = new TreeMap();
- states.put(state, contributorToActionSetMap);
- }
-
- add(contributorToActionSetMap, keyBinding.getContributor(),
- keyBinding.getAction());
- }
- }
-
- public static boolean removeFromTree(SortedMap tree,
- KeyBinding keyBinding) {
- // TBD
- return false;
- }
-
- public static void solveTree(SortedMap tree, State[] stack) {
- Iterator iterator = tree.values().iterator();
-
- while (iterator.hasNext()) {
- Node node = (Node) iterator.next();
- node.bestActionMatch = solve(node.states, stack);
- solveTree(node.children, stack);
- Iterator iterator2 = node.children.values().iterator();
-
- while (iterator2.hasNext()) {
- Node child = (Node) iterator2.next();
- ActionMatch childActionMatch = child.bestActionMatch;
-
- if (childActionMatch != null &&
- (node.bestChildActionMatch == null ||
- childActionMatch.getMatch() <
- node.bestChildActionMatch.getMatch()))
- node.bestChildActionMatch = childActionMatch;
- }
- }
- }
-
- public static SortedMap find(SortedMap tree, KeySequence prefix) {
- Iterator iterator = prefix.getKeyStrokes().iterator();
-
- while (iterator.hasNext()) {
- Node node = (Node) tree.get(iterator.next());
-
- if (node == null)
- return null;
-
- tree = node.children;
- }
-
- return tree;
- }
-
- public static List toBindings(SortedMap tree) {
- List bindings = new ArrayList();
- toBindings(tree, KeySequence.create(), bindings);
- return bindings;
- }
-
- private static void toBindings(SortedMap tree, KeySequence prefix,
- List bindings) {
- Iterator iterator = tree.entrySet().iterator();
-
- while (iterator.hasNext()) {
- Map.Entry entry = (Map.Entry) iterator.next();
- KeyStroke keyStroke = (KeyStroke) entry.getKey();
- List keyStrokes = new ArrayList(prefix.getKeyStrokes());
- keyStrokes.add(keyStroke);
- KeySequence keySequence = KeySequence.create(keyStrokes);
- Node node = (Node) entry.getValue();
- Iterator iterator2 = node.states.entrySet().iterator();
-
- while (iterator2.hasNext()) {
- Map.Entry entry2 = (Map.Entry) iterator2.next();
- State state = (State) entry2.getKey();
- SortedMap contributions = (SortedMap) entry2.getValue();
- Iterator iterator3 = contributions.entrySet().iterator();
-
- while (iterator3.hasNext()) {
- Map.Entry entry3 = (Map.Entry) iterator3.next();
- Contributor contributor = (Contributor) entry3.getKey();
- SortedSet actions = (SortedSet) entry3.getValue();
- Iterator iterator4 = actions.iterator();
-
- while (iterator4.hasNext()) {
- Action action = (Action) iterator4.next();
- bindings.add(KeyBinding.create(keySequence, state,
- contributor, action));
- }
- }
- }
-
- toBindings(node.children, keySequence, bindings);
- }
- }
-
- public static SortedMap toKeySequenceActionMap(SortedMap tree) {
- SortedMap keySequenceActionMap = new TreeMap();
- toKeySequenceActionMap(tree, KeySequence.create(),
- keySequenceActionMap);
- return keySequenceActionMap;
- }
-
- private static void toKeySequenceActionMap(SortedMap tree,
- KeySequence prefix, SortedMap keySequenceActionMap) {
- Iterator iterator = tree.entrySet().iterator();
-
- while (iterator.hasNext()) {
- Map.Entry entry = (Map.Entry) iterator.next();
- KeyStroke keyStroke = (KeyStroke) entry.getKey();
- List keyStrokes = new ArrayList(prefix.getKeyStrokes());
- keyStrokes.add(keyStroke);
- KeySequence keySequence = KeySequence.create(keyStrokes);
- Node node = (Node) entry.getValue();
-
- if (node.bestChildActionMatch != null &&
- (node.bestActionMatch == null ||
- node.bestChildActionMatch.getMatch() <
- node.bestActionMatch.getMatch()))
- toKeySequenceActionMap(node.children, keySequence,
- keySequenceActionMap);
- else if (node.bestActionMatch != null) {
- Action action = node.bestActionMatch.getAction();
-
- if (action.getValue() != null)
- keySequenceActionMap.put(keySequence, action);
- }
- }
- }
-
- public SortedMap children = new TreeMap();
- public SortedMap states = new TreeMap();
-
- public ActionMatch bestActionMatch = null;
- public ActionMatch bestChildActionMatch = null;
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Path.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Path.java
deleted file mode 100644
index c8dd410..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Path.java
+++ /dev/null
@@ -1,122 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.ui.IMemento;
-
-public final class Path implements Comparable {
-
- public final static String TAG = "path";
-
- public static Path create() {
- return new Path(Collections.EMPTY_LIST);
- }
-
- public static Path create(Element element)
- throws IllegalArgumentException {
- return new Path(Collections.singletonList(element));
- }
-
- public static Path create(Element[] elements)
- throws IllegalArgumentException {
- return new Path(Arrays.asList(elements));
- }
-
- public static Path create(List elements)
- throws IllegalArgumentException {
- return new Path(elements);
- }
-
- public static Path read(IMemento memento)
- throws IllegalArgumentException {
- if (memento == null)
- throw new IllegalArgumentException();
-
- IMemento[] mementos = memento.getChildren(Element.TAG);
-
- if (mementos == null)
- throw new IllegalArgumentException();
-
- List elements = new ArrayList(mementos.length);
-
- for (int i = 0; i < mementos.length; i++)
- elements.add(Element.read(mementos[i]));
-
- return Path.create(elements);
- }
-
- public static void write(IMemento memento, Path path)
- throws IllegalArgumentException {
- if (memento == null || path == null)
- throw new IllegalArgumentException();
-
- Iterator iterator = path.getElements().iterator();
-
- while (iterator.hasNext())
- Element.write(memento.createChild(Element.TAG),
- (Element) iterator.next());
- }
-
- private List elements;
-
- private Path(List elements)
- throws IllegalArgumentException {
- super();
-
- if (elements == null)
- throw new IllegalArgumentException();
-
- this.elements = Collections.unmodifiableList(new ArrayList(elements));
- Iterator iterator = this.elements.iterator();
-
- while (iterator.hasNext())
- if (!(iterator.next() instanceof Element))
- throw new IllegalArgumentException();
- }
-
- public List getElements() {
- return elements;
- }
-
- public int match(Path path)
- throws IllegalArgumentException {
- if (path == null)
- throw new IllegalArgumentException();
-
- if (path.equalsOrIsChildOf(this)) {
- int match = path.elements.size() - elements.size();
-
- if (match < 256)
- return match;
- }
-
- return -1;
- }
-
- public int compareTo(Object object) {
- if (!(object instanceof Path))
- throw new ClassCastException();
-
- return Util.compare(elements.iterator(),
- ((Path) object).elements.iterator());
- }
-
- public boolean equals(Object object) {
- return object instanceof Path &&
- elements.equals(((Path) object).elements);
- }
-
- public boolean equalsOrIsChildOf(Path path) {
- return elements.size() >= path.elements.size() &&
- elements.subList(0, path.elements.size()).equals(path.elements);
- }
-
- public boolean isChildOf(Path path) {
- return elements.size() > path.elements.size() &&
- elements.subList(0, path.elements.size()).equals(path.elements);
- }
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Platform.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Platform.java
deleted file mode 100644
index 6bfe29d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Platform.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.IMemento;
-
-public final class Platform {
-
- public final static String TAG = "platform";
-
- public static Platform create() {
- return new Platform(Path.create());
- }
-
- public static Platform create(Path path)
- throws IllegalArgumentException {
- return new Platform(path);
- }
-
- public static Platform read(IMemento memento)
- throws IllegalArgumentException {
- if (memento == null)
- throw new IllegalArgumentException();
-
- return Platform.create(Path.read(memento.getChild(Path.TAG)));
- }
-
- public static void write(IMemento memento, Platform platform)
- throws IllegalArgumentException {
- if (memento == null || platform == null)
- throw new IllegalArgumentException();
-
- Path.write(memento.createChild(Path.TAG), platform.getPath());
- }
-
- public static Platform system() {
- List elements = new ArrayList();
- String platform = SWT.getPlatform();
-
- if (platform != null) {
- elements.add(Element.create(platform));
- }
-
- return Platform.create(Path.create(elements));
- }
-
- private Path path;
-
- private Platform(Path path)
- throws IllegalArgumentException {
- super();
-
- if (path == null)
- throw new IllegalArgumentException();
-
- this.path = path;
- }
-
- public Path getPath() {
- return path;
- }
-
- public int match(Platform platform)
- throws IllegalArgumentException {
- if (platform == null)
- throw new IllegalArgumentException();
-
- return (path.match(platform.path));
- }
-
- public int compareTo(Object object) {
- if (!(object instanceof Platform))
- throw new ClassCastException();
-
- return path.compareTo(((Platform) object).path);
- }
-
- public boolean equals(Object object) {
- if (!(object instanceof Platform))
- return false;
-
- return path.equals(((Platform) object).path);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Scope.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Scope.java
deleted file mode 100644
index 7237414..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Scope.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import org.eclipse.ui.IMemento;
-
-public final class Scope {
-
- public final static String TAG = "scope";
-
- public static Scope create() {
- return new Scope(Path.create());
- }
-
- public static Scope create(Path path)
- throws IllegalArgumentException {
- return new Scope(path);
- }
-
- public static Scope read(IMemento memento)
- throws IllegalArgumentException {
- if (memento == null)
- throw new IllegalArgumentException();
-
- return Scope.create(Path.read(memento.getChild(Path.TAG)));
- }
-
- public static void write(IMemento memento, Scope scope)
- throws IllegalArgumentException {
- if (memento == null || scope == null)
- throw new IllegalArgumentException();
-
- Path.write(memento.createChild(Path.TAG), scope.getPath());
- }
-
- private Path path;
-
- private Scope(Path path)
- throws IllegalArgumentException {
- super();
-
- if (path == null)
- throw new IllegalArgumentException();
-
- this.path = path;
- }
-
- public Path getPath() {
- return path;
- }
-
- public int match(Scope scope)
- throws IllegalArgumentException {
- if (scope == null)
- throw new IllegalArgumentException();
-
- return (path.match(scope.path));
- }
-
- public int compareTo(Object object) {
- if (!(object instanceof Scope))
- throw new ClassCastException();
-
- return path.compareTo(((Scope) object).path);
- }
-
- public boolean equals(Object object) {
- if (!(object instanceof Scope))
- return false;
-
- return path.equals(((Scope) object).path);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/State.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/State.java
deleted file mode 100644
index 874eb16..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/State.java
+++ /dev/null
@@ -1,134 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import org.eclipse.ui.IMemento;
-
-public final class State implements Comparable {
-
- public final static String TAG = "state";
-
- public static State create(Configuration configuration, Locale locale,
- Platform platform, Scope scope)
- throws IllegalArgumentException {
- return new State(configuration, locale, platform, scope);
- }
-
- public static State read(IMemento memento)
- throws IllegalArgumentException {
- if (memento == null)
- throw new IllegalArgumentException();
-
- Configuration configuration =
- Configuration.read(memento.getChild(Configuration.TAG));
- Locale locale = Locale.read(memento.getChild(Locale.TAG));
- Platform platform = Platform.read(memento.getChild(Platform.TAG));
- Scope scope = Scope.read(memento.getChild(Scope.TAG));
- return State.create(configuration, locale, platform, scope);
- }
-
- public static void write(IMemento memento, State state)
- throws IllegalArgumentException {
- if (memento == null || state == null)
- throw new IllegalArgumentException();
-
- Configuration.write(memento.createChild(Configuration.TAG),
- state.getConfiguration());
- Locale.write(memento.createChild(Locale.TAG), state.getLocale());
- Platform.write(memento.createChild(Platform.TAG), state.getPlatform());
- Scope.write(memento.createChild(Scope.TAG), state.getScope());
- }
-
- private Configuration configuration;
- private Locale locale;
- private Platform platform;
- private Scope scope;
-
- private State(Configuration configuration, Locale locale,
- Platform platform, Scope scope)
- throws IllegalArgumentException {
- super();
-
- if (configuration == null || locale == null || platform == null ||
- scope == null)
- throw new IllegalArgumentException();
-
- this.configuration = configuration;
- this.locale = locale;
- this.platform = platform;
- this.scope = scope;
- }
-
- public Configuration getConfiguration() {
- return configuration;
- }
-
- public Locale getLocale() {
- return locale;
- }
-
- public Platform getPlatform() {
- return platform;
- }
-
- public Scope getScope() {
- return scope;
- }
-
- public int match(State state) {
- int configurationMatch = configuration.match(state.configuration);
-
- if (configurationMatch == -1)
- return -1;
-
- int localeMatch = locale.match(state.locale);
-
- if (localeMatch == -1)
- return -1;
-
- int platformMatch = platform.match(state.platform);
-
- if (platformMatch == -1)
- return -1;
-
- int scopeMatch = scope.match(state.scope);
-
- if (scopeMatch == -1)
- return -1;
-
- return (scopeMatch << 24) + (configurationMatch << 16) +
- (platformMatch << 8) + (localeMatch);
- }
-
- public int compareTo(Object object) {
- if (!(object instanceof State))
- throw new ClassCastException();
-
- State state = (State) object;
- int compareTo = configuration.compareTo(state.configuration);
-
- if (compareTo == 0) {
- compareTo = locale.compareTo(state.locale);
-
- if (compareTo == 0) {
- compareTo = platform.compareTo(state.platform);
-
- if (compareTo == 0)
- compareTo = scope.compareTo(state.scope);
- }
- }
-
- return compareTo;
- }
-
- public boolean equals(Object object) {
- if (!(object instanceof State))
- return false;
-
- State state = (State) object;
- return configuration.equals(state.configuration) &&
- locale.equals(state.locale) && platform.equals(state.platform) &&
- scope.equals(state.scope);
- }
-}
-
-
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Util.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Util.java
deleted file mode 100644
index 24a0349..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/keybindings/Util.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.ui.internal.keybindings;
-
-import java.util.Iterator;
-
-public final class Util {
-
- 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
- return left.compareTo(right);
- }
-
- 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 {
- for (int i = 0; i < left.length && i < right.length; i++) {
- int compareTo = compare(left[i], right[i]);
-
- if (compareTo != 0)
- return compareTo;
- }
-
- return left.length - right.length;
- }
- }
-
- public static int compare(Iterator left, Iterator right)
- throws ClassCastException {
- if (left == null && right == null)
- return 0;
- else if (left == null)
- return -1;
- else if (right == null)
- return +1;
- else {
- while (left.hasNext() && right.hasNext()) {
- int compareTo = ((Comparable) left.next()).compareTo(
- (Comparable) right.next());
-
- if (compareTo != 0)
- return compareTo;
- }
-
- return left.hasNext() ? +1 : right.hasNext() ? -1 : 0;
- }
- }
-
- private Util() {
- super();
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties
deleted file mode 100644
index 00e80f4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/messages.properties
+++ /dev/null
@@ -1,1267 +0,0 @@
-# ==============================================================================
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-# ==============================================================================
-
-# package: org.eclipse.ui
-
-
-# ==============================================================================
-# Global Actions
-# ==============================================================================
-
-# --- File Menu ---
-Workbench.file = &File
-Workbench.new = &New
-CreateProjectAction.text = Configurable &Project...
-CreateProjectAction.toolTip = Open New Configurable Project Wizard
-NewProjectAction.text = P&roject...
-NewProjectAction.toolTip = Open New Project Wizard
-NewWizardAction.text = &Other...@Ctrl+N
-NewWizardAction.toolTip = Open The New Wizard
-CloseAllAction.text = C&lose All@Ctrl+Shift+F4
-CloseAllAction.toolTip = Close All Open Editors
-CloseAllSavedAction.text = Cl&ose All Saved@Ctrl+Shift+W
-CloseAllSavedAction.toolTip = Close All Saved Editors
-CloseEditorAction.text = &Close@Ctrl+F4
-CloseEditorAction.toolTip = Close Open Editor
-SaveAction.text = &Save@Ctrl+S
-SaveAction.textOneArg = &Save {0}@Ctrl+S
-SaveAction.toolTip = Save Editor Contents
-SaveAs.text = Save &As...
-SaveAs.textOneArg = Save {0} &As...
-SaveAs.toolTip = Save To Another Location
-SaveAsDialog.title = Save As
-SaveAsDialog.message = Save file to another location.
-SaveAsDialog.text = Save File As
-SaveAsDialog.fileLabel = &File name:
-SaveAsDialog.file = file
-SaveAsDialog.overwriteQuestion = The file {0} already exists. Do you want to replace the existing file?
-SaveAll.text = Sav&e All@Ctrl+Shift+S
-SaveAll.toolTip = Save All Open Files
-Workbench.print = &Print...@Ctrl+P
-Workbench.printToolTip = Print
-ExportResourcesAction.text = E&xport...
-ExportResourcesAction.fileMenuText = Exp&ort...
-ExportResourcesAction.toolTip = Export Selected Resources
-ImportResourcesAction.text = &Import...
-ImportResourcesAction.toolTip = Import Resources
-Workbench.openRecent = &Open Recent
-OpenRecent.errorTitle = Problems opening editor
-Exit.text = E&xit
-Exit.toolTip = Exit Workbench
-
-# --- Edit Menu ---
-Workbench.edit = &Edit
-Workbench.undo = &Undo@Ctrl+Z
-Workbench.undoToolTip = Undo Last Action
-Workbench.redo = &Redo@Ctrl+Y
-Workbench.redoToolTip = Redo Last Action
-Workbench.cut = Cu&t@Ctrl+X
-Workbench.cutToolTip = Cut Selection
-Workbench.copy = &Copy@Ctrl+C
-Workbench.copyToolTip = Copy Selection
-Workbench.paste = &Paste@Ctrl+V
-Workbench.pasteToolTip = Paste
-Workbench.delete = &Delete@Delete
-Workbench.deleteToolTip = Delete Selection
-Workbench.selectAll = Select &All@Ctrl+A
-Workbench.selectAllToolTip = Select Entire Contents
-Workbench.findReplace = &Find/Replace...@Ctrl+F
-Workbench.findReplaceToolTip = Open Find Replace Dialog
-Workbench.addBookMark = Add Bookmar&k...
-Workbench.addBookMarkToolTip = Add Bookmark
-Workbench.addTask = Add Ta&sk...
-Workbench.addTaskToolTip = Add Task
-
-# --- Perspective Menu ---
-Workbench.perspective = &Perspective
-Workbench.showPerspectiveError = Problems opening perspective: ({0})
-
-Workbench.open = &Open
-PerspectiveMenu.otherItem = &Other...
-SelectPerspective.shellTitle = Select Perspective
-ChangeToPerspectiveMenu.errorTitle = Problems Changing Perspective
-
-Workbench.showView = Show &View
-ShowView.title = &Other...
-ShowView.shellTitle = Show View
-ShowView.errorTitle = Problems Showing View
-
-ToggleEditor.hideEditors = Hide &Editors
-ToggleEditor.showEditors = Show &Editors
-ToggleEditor.toolTip = Toggle Editor Area Visibility
-
-SavePerspective.text = Save &As...
-SavePerspective.toolTip = Save Current Perspective Layout
-SavePerspective.shellTitle = Save Perspective As...
-SavePerspectiveDialog.description = Enter or select a name to save the current\nperspective as.
-SavePerspective.name = &Name:
-SavePerspective.existing = &Existing Perspectives:
-SavePerspective.overwriteTitle = Overwrite Perspective
-SavePerspective.overwriteQuestion = A perspective with the name ({0}) already exist. Do you want to overwrite?
-SavePerspective.singletonQuestion = The current perspective can only be opened once and cannot be saved using a new name. Do you want to overwrite?
-SavePerspective.errorTitle = Cannot Save Perspective
-SavePerspective.errorMessage = Invalid Perspective Descriptor
-
-EditorActionSetsAction.text = Customi&ze...
-EditorActionSetsAction.toolTip = Customize Current Perspective...
-ActionSetSelection.customize = Customize Perspective
-ActionSetSelection.selectLabel = Select the items to be displayed in the current perspective ({0}).
-ActionSetSelection.available = Available &Items:
-ActionSetSelection.details = Details:
-ActionSetRegistry.otherCategory = Other
-ActionSetDialogInput.viewCategory = Window > Show View
-ActionSetDialogInput.perspectiveCategory = Window > Open Perspective
-ActionSetDialogInput.wizardCategory = File > New
-
-ResetPerspective.message = Do you want to reset the current {0} perspective to its defaults?
-ResetPerspective.title = Reset Perspective
-ResetPerspective.text = &Reset...
-ResetPerspective.toolTip = Reset Current Perspective
-ClosePerspectiveAction.text = &Close
-ClosePerspectiveAction.toolTip = Close Active Perspective
-CloseAllPerspectivesAction.text = C&lose All
-CloseAllPerspectivesAction.toolTip = Close All Perspectives
-
-# --- Workbench Menu ---
-Workbench.workbench = Work&bench
-GlobalBuildAction.text = &Build@Ctrl+B
-GlobalBuildAction.toolTip = Global Incremental Build Of Modified Resources
-GlobalBuildAction.rebuildText = Rebuild &All
-GlobalBuildAction.rebuildToolTip = Global Full Build Of All Resources
-GlobalBuildAction.problemTitle = Build Problems
-GlobalBuildAction.buildProblems = Build problems
-GlobalBuildAction.internalError = Internal error: {0}
-OpenPreferences.text = &Preferences
-OpenPreferences.toolTip = Open Preferences Dialog
-
-# --- Window Menu ---
-Workbench.window = &Window
-Workbench.launch = &Launch
-Workbench.shortcuts = &Keyboard Shortcuts
-Workbench.openNewWindow = &New Window
-OpenNewWindowAction.text = &New Window
-OpenNewWindowAction.toolTip = Open New Window
-OpenNewWindowAction.errorTitle = Problems Opening New Window
-OpenInNewWindowAction.text = Open in &New Window
-OpenInNewWindowAction.toolTip = Open in New Window
-OpenInNewWindowAction.errorTitle = Problems Opening New Window
-CycleEditorAction.next.text = Next Editor@Ctrl+F6
-CycleEditorAction.next.toolTip = Next Editor
-CycleEditorAction.prev.text = Previous Editor@Ctrl+Shift+F6
-CycleEditorAction.prev.toolTip = Previous Editor
-CycleEditorAction.header=Editors
-CyclePartAction.next.text = Next View@Ctrl+F7
-CyclePartAction.next.toolTip = Next View
-CyclePartAction.prev.text = Previous View@Ctrl+Shift+F7
-CyclePartAction.prev.toolTip = Previous View
-CyclePartAction.header = Views
-CyclePartAction.editor = Editor
-CyclePerspectiveAction.next.text = Next Perspective@Ctrl+F8
-CyclePerspectiveAction.next.toolTip = Next Perspective
-CyclePerspectiveAction.prev.text = Previous Perspective@Ctrl+Shift+F8
-CyclePerspectiveAction.prev.toolTip = Previous Perspective
-CyclePerspectiveAction.header=Perspectives
-ActivateEditorAction.text = Activate Editor@F12
-ActivateEditorAction.toolTip = Activate Editor
-
-
-# --- Help Menu ---
-Workbench.help = &Help
-QuickStart.text = &Welcome...
-QuickStart.toolTip = Open a Welcome Editor
-QuickStartMessageDialog.title = Welcome
-QuickStartMessageDialog.message = No features with quick start information are available
-WelcomePageSelectionDialog.title = Welcome
-WelcomePageSelectionDialog.message = &Show welcome page for:
-AboutAction.text = &About {0}
-AboutAction.toolTip = About {0}
-AboutDialog.shellTitle = About {0}
-AboutDialog.featureInfo = &Feature Details
-AboutDialog.pluginInfo = &Plug-in Details
-AboutDialog.platformInfo = Built with Eclipse technology
-AboutDialog.systemInfo = &Configuration Details
-ProductInfoDialog.errorTitle = Problems Opening Link
-ProductInfoDialog.unableToOpenWebBrowser = Unable to open web browser.
-AboutPluginsDialog.shellTitle = About {0} Plugins
-AboutPluginsDialog.pluginName = Plugin name
-AboutPluginsDialog.version = Version
-AboutPluginsDialog.provider = Provider
-AboutPluginsDialog.moreInfo = More &Info
-AboutPluginsDialog.errorTitle = Problems Opening File
-AboutPluginsDialog.unableToOpenFile = Unable to find file {0} in plugin {1}.
-AboutFeaturesDialog.shellTitle = About {0} Features
-AboutFeaturesDialog.featureName = Feature name
-AboutFeaturesDialog.version = Version
-AboutFeaturesDialog.provider = Provider
-AboutFeaturesDialog.moreInfo = More &Info
-AboutFeaturesDialog.pluginsInfo = &Plug-in Details
-AboutFeaturesDialog.errorTitle = Error
-AboutFeaturesDialog.unableToOpenFile = Unable to find file {0} in plugin {1}
-AboutFeaturesDialog.noInformation = No further information is available for this feature.
-AboutFeaturesDialog.pluginInfoTitle = Feature Plug-ins
-AboutFeaturesDialog.pluginInfoMessage = Plug-ins contributed by feature: {0}
-AboutFeaturesDialog.unableToObtainFeatureInfo = Unable to obtain feature information.
-AboutFeaturesDialog.noInfoTitle = No Further Information
-
-
-# --- Shortcutbar ---
-SetPagePerspectiveAction.text = Change Perspective
-SetPagePerspectiveAction.toolTip = {0} Perspective
-
-WorkbenchWindow.close = Close
-WorkbenchWindow.closeAll = Close All
-WorkbenchWindow.restore = Fast View
-WorkbenchPage.PerspectiveFormat = {0} - {1}
-WorkbenchPage.ErrorRecreatingPerspective = Unable to recreate perspective
-WorkbenchPage.UndefinedPerspective = Perspective ID is undefined
-
-# --- navigation actions ---
-NavigationHistoryAction.forward.text=&Forward
-NavigationHistoryAction.forward.toolTip=Forward
-NavigationHistoryAction.backward.text=&Backward
-NavigationHistoryAction.backward.toolTip=Backward
-
-# --- menu reorg ---
-Workbench.project = &Project
-Workbench.navigate = &Navigate
-
-Workbench.revert = Rever&t
-Workbench.revertToolTip = Revert
-Workbench.refresh = Re&fresh
-Workbench.refreshToolTip = Refresh
-Workbench.properties = P&roperties@Alt+Enter
-Workbench.propertiesToolTip = Properties
-
-Workbench.move = Mo&ve...
-Workbench.moveToolTip = Move
-Workbench.rename = Rena&me...
-Workbench.renameToolTip = Rename
-Workbench.goInto = Go &Into
-Workbench.goIntoToolTip = Go Into
-Workbench.goTo = &Go To
-Workbench.back = &Back
-Workbench.backToolTip = Back
-Workbench.forward = &Forward
-Workbench.forwardToolTip = Forward
-Workbench.up = &Up One Level
-Workbench.upToolTip = Up
-Workbench.next = Ne&xt@Ctrl+.
-Workbench.nextToolTip = Next
-Workbench.previous = Pre&vious@Ctrl+,
-Workbench.previousToolTip = Previous
-Workbench.buildProject = &Build Project
-Workbench.buildProjectToolTip = Build Project
-Workbench.rebuildProject = &Rebuild Project
-Workbench.rebuildProjectToolTip = Rebuild Project
-Workbench.buildAll = Build &All@Ctrl+B
-Workbench.buildAllToolTip = Build All
-Workbench.rebuildAll = Rebuild A&ll
-Workbench.rebuildAllToolTip = Rebuild All
-Workbench.openProject = &Open Project
-Workbench.openProjectToolTip = Open Project
-Workbench.closeProject = &Close Project
-Workbench.closeProjectToolTip = Close Project
-
-Workbench.openPerspective = &Open Perspective
-Workbench.savePerspectiveAs = Save Perspective &As...
-Workbench.customizePerspective = Customi&ze Perspective...
-Workbench.lockPerspectiveToolBar = Lock the &Toolbars
-Workbench.resetPerspective = &Reset Perspective
-Workbench.closePerspective = &Close Perspective
-Workbench.closeAllPerspectives = Close A&ll Perspectives
-
-# --- end menu reorg ---
-
-
-# ==============================================================================
-# Navigator Actions
-# ==============================================================================
-OpenWithMenu.dialogTitle = Problems Opening Editor
-
-CopyProjectAction.title = &Copy
-CopyProjectAction.toolTip = Copy Project
-CopyProjectAction.progressTitle = Copying:
-CopyProjectAction.copyTitle = Copy Project
-CopyProjectAction.copyNameOneArg = Copy of {0}
-CopyProjectAction.copyNameTwoArgs = Copy ({0}) of {1}
-CopyProjectAction.alreadyExists = Project {0} already exists.
-CopyProjectAction.copyFailedMessage = Problems occurred copying the project.
-CopyProjectAction.copyFailedTitle = Copy Problems
-CopyProjectAction.internalError = Internal error: {0}
-
-CopyResourceAction.title = &Copy
-CopyResourceAction.toolTip = Copy Resource
-CopyResourceAction.selectDestination = Select the &destination:
-CopyResourceAction.operationTitle = Copying
-CopyResourceAction.copying = Copying
-CopyResourceAction.copyNameTwoArgs = Copy ({0}) of {1}
-CopyResourceAction.copyNameOneArg = Copy of {0}
-CopyResourceAction.resourceExists = Resource Exists
-CopyResourceAction.overwriteProblem = The folder {0} already exists and cannot be overwritten since it contains {1}.
-CopyResourceAction.overwriteProblemTitle = Overwrite Problem
-CopyResourceAction.overwriteQuestion = {0} exists. Do you wish to overwrite?
-CopyResourceAction.nameCollision = A resource name collision was detected.
-CopyResourceAction.copyFailedTitle = Copy Problems
-CopyResourceAction.deletingCollision = Deleting collisions
-CopyResourceAction.problemMessage = Problems occurred copying the selected resources.
-CopyResourceAction.internalError = Internal error: {0}
-CopyResourceAction.destinationAccessError = Destination folder must be accessible.
-CopyResourceAction.destinationDescendentError = Destination cannot be a descendent of the source.
-
-MoveProjectAction.text = Mo&ve...
-MoveProjectAction.toolTip = Move Project
-MoveProjectAction.moveTitle = Move Project
-MoveProjectAction.progressMessage = Moving:
-MoveProjectAction.dialogTitle = Move Problems
-MoveProjectAction.internalError = Internal error: {0}
-
-MoveResourceAction.text = Mo&ve...
-MoveResourceAction.toolTip = Move Resource
-MoveResourceAction.sameSourceAndDest = The source and destination are the same.
-MoveResourceAction.title = Check Move
-MoveResourceAction.checkMoveMessage = {0} is read only. Do you still wish to move it?
-MoveResourceAction.progressMessage = Moving
-MoveResourceAction.dialogTitle = Move Problems
-MoveResourceAction.problemMessage = Problems occurred moving the selected resources.
-
-ReadOnlyCheck.problems = Read Only Checking Problems
-
-RenameResourceAction.text = Rena&me
-RenameResourceAction.toolTip = Rename Resource
-RenameResourceAction.inputDialogTitle = Rename Resource
-RenameResourceAction.inputDialogMessage = Enter the new resource name:
-RenameResourceAction.checkTitle = Check Rename
-RenameResourceAction.readOnlyCheck = {0} is read only. Do you still wish to rename it?
-RenameResourceAction.resourceExists = Resource Exists
-RenameResourceAction.nameExists = A resource with that name already exists
-RenameResourceAction.overwriteQuestion = {0} exists. Do you wish to overwrite?
-RenameResourceAction.progressMessage = Renaming
-RenameResourceAction.problemTitle = Rename Problems
-RenameResourceAction.progress = Renaming:
-RenameResourceAction.nameMustBeDifferent = You must use a different name
-RenameResourceAction.problemMessage = Problems occurred renaming the selected resource.
-
-DeleteResourceAction.text = &Delete
-DeleteResourceAction.toolTip = Delete
-DeleteResourceAction.title1 = Confirm Resource Delete
-DeleteResourceAction.titleN = Confirm Multiple Resource Delete
-DeleteResourceAction.confirm1 = Are you sure you want to delete ''{0}''?
-DeleteResourceAction.confirmN = Are you sure you want to delete these {0} resources?
-DeleteResourceAction.titleProject1 = Confirm Project Delete
-DeleteResourceAction.titleProjectN = Confirm Multiple Project Delete
-DeleteResourceAction.confirmProject1 = Are you sure you want to delete project ''{0}''?
-DeleteResourceAction.confirmProjectN = Are you sure you want to delete these {0} projects?
-DeleteResourceAction.deleteContents1 = &Also delete contents under {0}
-DeleteResourceAction.deleteContentsN = &Also delete contents in the file system
-DeleteResourceAction.doNotDeleteContents = &Do not delete contents
-DeleteResourceAction.readOnlyQuestion = {0} is read only. Do you still wish to delete it?
-DeleteResourceAction.errorTitle = Delete Problems
-DeleteResourceAction.messageTitle = Problems deleting
-DeleteResourceAction.internalError = Internal error: {0}
-DeleteResourceAction.outOfSyncError = Resource is out of sync with the file system. Refresh and try again.
-DeleteResourceAction.outOfSyncQuestion = Resource {0} is out of sync with the file system. Do you want to delete it anyway?
-
-AddBookmarkLabel = Add Boo&kmark
-AddBookmarkToolTip = Add Bookmark
-
-AddTaskLabel = Add &Task
-AddTaskToolTip = Add Task
-
-OpenFileAction.text = Op&en
-OpenFileAction.toolTip = Edit File
-OpenFileAction.openFileError = Workbench page must be supplied to OpenFileAction
-OpenFileAction.openFileErrorTitle = Error in OpenFileAction.openFile
-OpenFileAction.openFileShellTitle = Problems Opening Editor
-
-OpenResourceAction.text = Op&en Project
-OpenResourceAction.toolTip = Open Project
-OpenResourceAction.dialogTitle = Open Problems
-OpenResourceAction.problemMessage = Problems occurred opening the selected resources.
-
-CloseResourceAction.text = Clo&se Project
-CloseResourceAction.toolTip = Close Project
-CloseResourceAction.title = Close Problems
-CloseResourceAction.problemMessage = Problems occurred closing the selected resources.
-
-BuildAction.text = &Build Project
-BuildAction.toolTip = Incremental Build Of Selected Projects
-BuildAction.problemMessage = Problems occurred building the selected resources.
-BuildAction.problemTitle = Build Problems
-BuildAction.verifyExceptionMessage = Exception in {0}.run: {1}
-BuildAction.buildProblems = Build problems
-BuildAction.operationMessage =
-BuildAction.internalError = Internal error: {0}
-
-RebuildAction.text = Rebuild Pro&ject
-RebuildAction.tooltip = Full Build Of Selected Projects
-
-RefreshAction.text = Re&fresh
-RefreshAction.toolTip = Refresh
-RefreshAction.progressMessage = Refreshing:
-RefreshAction.problemTitle = Refresh Problems
-RefreshAction.problemMessage = Problems occurred refreshing the selected resources.
-RefreshAction.locationDeletedMessage = The location for project {0} ({1}) has been deleted.\n Delete {0} from the workspace?
-RefreshAction.dialogTitle = Project location has been deleted
-
-# --- Operations ---
-CopyProjectOperation.progressTitle = Copying:
-CopyProjectOperation.copyFailedMessage = Problems occurred copying the project.
-CopyProjectOperation.copyFailedTitle = Copy Problems
-CopyProjectOperation.internalError = Internal error: {0}
-CopyProjectOperation.copyProject = Copy Project
-
-CopyFilesAndFoldersOperation.copyFailedTitle = Copy Problems
-CopyFilesAndFoldersOperation.problemMessage = Problems occurred copying the selected resources.
-CopyFilesAndFoldersOperation.operationTitle = Copying
-CopyFilesAndFoldersOperation.nameCollision = A resource name collision was detected.
-CopyFilesAndFoldersOperation.internalError = Internal error: {0}
-CopyFilesAndFoldersOperation.resourceExists = Resource Exists
-CopyFilesAndFoldersOperation.overwriteQuestion = {0} exists. Do you wish to overwrite?
-CopyFilesAndFoldersOperation.overwriteMergeQuestion = {0} exists. Do you wish to overwrite?\nFolder contents will be merged, existing files will be overwritten.
-CopyFilesAndFoldersOperation.copyNameTwoArgs = Copy ({0}) of {1}
-CopyFilesAndFoldersOperation.copyNameOneArg = Copy of {0}
-CopyFilesAndFoldersOperation.destinationAccessError = Destination folder must be accessible.
-CopyFilesAndFoldersOperation.destinationDescendentError = Destination cannot be a descendent of the source.
-CopyFilesAndFoldersOperation.overwriteProblem = The folder {0} already exists and cannot be overwritten since it contains {1}.
-CopyFilesAndFoldersOperation.overwriteProblemTitle = Overwrite Problem
-CopyFilesAndFoldersOperation.deletingCollision = Deleting collisions
-CopyFilesAndFoldersOperation.copying = Copying
-CopyFilesAndFoldersOperation.question = Question
-CopyFilesAndFoldersOperation.importErrorDialogTitle = Import Problems
-CopyFilesAndFoldersOperation.inputDialogTitle = Name Conflict
-CopyFilesAndFoldersOperation.inputDialogMessage = Enter a new name for ''{0}''
-CopyFilesAndFoldersOperation.nameExists = A resource with that name already exists
-CopyFilesAndFoldersOperation.nameMustBeDifferent = You must use a different name
-CopyFilesAndFoldersOperation.sameSourceAndDest = Cannot copy {0}. The source and destination are the same.
-CopyFilesAndFoldersOperation.importSameSourceAndDest = Cannot import {0}. The source and destination are the same.
-
-MoveFilesAndFoldersOperation.sameSourceAndDest = Cannot move {0}. The source and destination are the same.
-MoveFilesAndFoldersOperation.moveFailedTitle = Move Problems
-MoveFilesAndFoldersOperation.problemMessage = Problems occurred moving the selected resources.
-
-# ==============================================================================
-# Drill Actions
-# ==============================================================================
-GoHome.text = Go &Home
-GoHome.toolTip = Home
-GoBack.text = Go &Back
-GoBack.toolTip = Back
-GoInto.text = Go &Into
-GoInto.toolTip = Go Into
-
-
-# ==============================================================================
-# Capability selection group
-# ==============================================================================
-ProjectCapabilitySelectionGroup.categories = Ca&tegories:
-ProjectCapabilitySelectionGroup.capabilities = &Capabilities:
-ProjectCapabilitySelectionGroup.description = &Description:
-ProjectCapabilitySelectionGroup.grayItems = Note that some checked capabilities appear grayed out because they are\nrequired by other checked capabilities.
-ProjectCapabilitySelectionGroup.disabledLabel = Disabled: {0}
-ProjectCapabilitySelectionGroup.errorTitle = Capability Problem
-ProjectCapabilitySelectionGroup.disabledCapability = The disabled capability cannot be added to the project.
-ProjectCapabilitySelectionGroup.invalidCapability = The missing capability cannot be added to the project.
-ProjectCapabilitySelectionGroup.missingPrereqs = The {0} capability requires a capability that is disabled or missing ({1}).\n\nThe {0} capability cannot be checked.
-ProjectCapabilitySelectionGroup.requiredPrereq = The {0} capability is required by the {1} capability, which is checked.\n\nThe {0} capability must remain checked.
-ProjectCapabilitySelectionGroup.requiredPrereqs = The {0} capability is required by the following checked capabilities: {1}\n\nThe {0} capability must remain checked.
-ProjectCapabilitySelectionGroup.membershipConflict = The project cannot have both the {0} and {1} capabilities at the same time. Uncheck the {1} capability first.
-ProjectCapabilitySelectionGroup.membershipPrereqConflict = The {0} capability requires the {1} capability. However the project cannot have both the {1} and {2} capabilities at the same time. Uncheck the {2} capability first.
-
-Capability.nameMissing = Missing ({0})
-
-ICategory.other = Other
-
-# ==============================================================================
-# Wizards
-# ==============================================================================
-NewWizard.title = New
-NewWizardNewPage.description = The following resource creation wizards are available.
-WizardList.description = The following wizards are available.
-Select = Select
-NewWizardSelectionPage.description = Select a wizard
-NewWizardShortcutAction.errorTitle = Problem Opening Wizard
-NewWizardShortcutAction.errorMessage = The selected wizard could not be started.
-
-NewWizardsRegistryReader.otherCategory = Other
-
-WorkbenchWizard.errorMessage = The selected wizard could not be started.
-WorkbenchWizard.errorTitle = Problem Opening Wizard
-WizardDataTransfer.existsQuestion = {0} already exists. Would you like to overwrite it?
-WizardDataTransfer.overwriteNameAndPathQuestion = Overwrite {0} in folder {1}?
-WizardDataTransfer.exceptionMessage = Error occured during operation: {0}
-WizardTransferPage.selectTypes = Select &Types...
-WizardTransferPage.selectAll = &Select All
-WizardTransferPage.deselectAll = &Deselect All
-TypesFiltering.title = Select Types
-TypesFiltering.message = Reduce selection to only files of &type(s):
-TypesFiltering.otherExtensions = &Other Extensions:
-TypesFiltering.typeDelimiter = ,
-
-NewProjectWizard.windowTitle = New Configurable Project
-NewProjectWizard.title = Project
-NewProjectWizard.errorTitle = New Project Problems
-NewProjectWizard.invalidCapabilities = The requested group of capabilities is invalid.
-NewProjectWizard.noWizard = The current step, {0}, could not be started. This wizard will be closed.\n\nThe project will not be configured correctly. Open the project''s properties to add missing capabilities.
-
-CreateProjectWizard.errorTitle = Creation Problems
-CreateProjectWizard.internalError = Internal error: {0}
-CreateProjectWizard.caseVariantExistsError = The project contents directory specified is being used by another project. Please enter a new project contents directory.
-
-RemoveCapabilityWizard.errorMessage = Remove Capability Problem
-RemoveCapabilityWizard.internalError = Internal error: {0}
-
-WizardNewProjectCapabilityPage.description = Choose project's capabilities
-WizardNewProjectCapabilityPage.noCapabilities = There are no capabilities available to choose from.
-WizardProjectReviewPage.description = Review project
-WizardProjectConfigurePage.description = Configure project's capability
-
-UpdateProjectCapabilityWizard.windowTitle = Update Project
-UpdateProjectCapabilityWizard.title = Project
-UpdateProjectCapabilityWizard.errorTitle = Update Project Problems
-UpdateProjectCapabilityWizard.noWizard = The current step, {0}, could not be started. This wizard will be closed.\n\nThe project will not be configured correctly.
-
-WizardStepGroup.stepsLabel = &Steps:
-MultiStepReviewWizardPage.detailsLabel = &Details:
-MultiStepReviewWizardPage.instructionNextLabel = Review steps and press Next button when ready to continue.
-MultiStepReviewWizardPage.instructionFinishLabel = Review steps and press Finish button when ready to continue.
-
-MultiStepWizard.finishLabel = &Finish Step
-
-CreateProjectStep.label = Create Project
-CreateProjectStep.details = This step will create a new project resource named "{0}".
-
-InstallCapabilityStep.label = Add {0}
-
-RemoveCapabilityStep.label = Remove {0}
-RemoveCapabilityStep.defaultDescription0 = Removes the {0} capability from the project.
-RemoveCapabilityStep.defaultDescription1 = Removes the {0} capability from the project, along with the {1} capability.
-RemoveCapabilityStep.defaultDescription2 = Removes the {0} capability from the project, along with the following capabilities: {1}.
-
-ProjectCapabilitySimpleSelectionPage.description = Choose a capability
-ProjectCapabilitySimpleSelectionPage.title = Select
-ProjectCapabilitySimpleSelectionPage.windowTitle = Add Capability
-ProjectCapabilitySimpleSelectionPage.capabilityExist = The project already has the chosen capability.
-ProjectCapabilitySimpleSelectionPage.capabilityRequired = The chosen capability requires the {0} capability to be added first.
-ProjectCapabilitySimpleSelectionPage.capabilityMissing = The chosen capability requires a missing capability ({0}).
-ProjectCapabilitySimpleSelectionPage.capabilitySet = The chosen capability cannot be added until the {0} capability is removed.
-
-# --- Import ---
-ImportWizard.title = Import
-ImportWizard.selectSource = &Select an import source:
-WizardImportPage.specifyFolder = Please specify folder
-WizardImportPage.folderMustExist = Folder must be accessible.
-WizardImportPage.errorDialogTitle = Import Problems
-WizardImportPage.folder = Folder:
-WizardImportPage.browseLabel = Browse...
-WizardImportPage.browse2 = Bro&wse...
-WizardImportPage.selectFolderLabel = Select a folder to import into:
-WizardImportPage.destinationLabel = Select the destination for imported resources:
-WizardImportPage.options = Options:
-WizardImportPage.projectNotExist = Destination project does not exist.
-WizardImportPage.importOnReceiver = Source is in the hierarchy of the destination.
-WizardImportPage.noOpenProjects = Cannot import into a workspace with no open projects. Please create a project before importing.
-
-# --- Export ---
-ExportWizard.title = Export
-ExportWizard.selectDestination = &Select an export destination:
-WizardExportPage.errorDialogTitle = Export Problems
-WizardExportPage.mustExistMessage = Resource must exist.
-WizardExportPage.mustBeAccessibleMessage = Resource must be accessible.
-WizardExportPage.detailsMessage = All file resources matching this criteria
-WizardExportPage.whatLabel = Select the resources to &export:
-WizardExportPage.whereLabel = Select the export destination:
-WizardExportPage.options = Options:
-WizardExportPage.selectionDialogMessage = Select the resource types to export.
-WizardExportPage.resourceTypeDialog = Resource Type Selection
-WizardExportPage.progressMessage = Retrieving content:
-WizardExportPage.contentRetrievalProblems = Content Retrieval Problems
-WizardExportPage.contentRetrievalProblemsMessage = Problems occurred retrieving content for the selected resources.
-WizardExportPage.folder = Fo&lder:
-WizardExportPage.browse = Browse...
-WizardExportPage.allTypes = All types
-WizardExportPage.specificTypes = Specific types:
-WizardExportPage.edit = Edit...
-WizardExportPage.details = Details...
-WizardExportPage.selectResourcesTitle = Select the resources to export.
-WizardExportPage.oneResourceSelected = 1 resource selected
-WizardExportPage.selectResourcesToExport = Select the resource to export.
-WizardExportPage.internalErrorTitle = Internal error
-WizardExportPage.internalErrorMessage = Internal error: {0}
-WizardExportPage.resourceCountMessage = {0} resources selected
-
-ZipExport.problemEncountered = Problems were encountered during export:
-ZipExport.progress = Exporting:
-ZipExport.unableToOpen = Unable to open destination file: {0}
-ZipExport.unableToClose = Unable to close destination file: {0}
-ZipExport.errorOnResource = Error exporting {0}
-
-# --- New Project ---
-NewProject.title = New Project
-WizardNewProjectCreationPage.description = Create a new project
-WizardNewProjectCreationPage.locationError = Invalid project contents directory
-WizardNewProjectCreationPage.defaultLocationError = Project contents cannot be inside workspace directory
-WizardNewProjectCreationPage.projectNameEmpty = Project name must be specified
-WizardNewProjectCreationPage.projectLocationEmpty = Project contents directory must be specified
-WizardNewProjectCreationPage.projectExistsMessage = A project with that name already exists in the workspace.
-WizardNewProjectCreationPage.projectLocationExistsMessage = Another project exist at the specified content directory.
-WizardNewProjectCreationPage.projectContentsLabel = Project contents:
-WizardNewProjectCreationPage.useDefaultLabel = Use &default
-WizardNewProjectCreationPage.nameLabel = &Project name:
-WizardNewProjectCreationPage.directoryLabel = Select the project contents directory.
-WizardNewProjectCreationPage.locationLabel = Director&y:
-WizardNewProjectCreationPage.browseLabel = B&rowse...
-WizardNewProjectReferences.title = &Referenced projects:
-
-# --- New Folder ---
-WizardNewFolderMainPage.folderName = Fo&lder name:
-WizardNewFolderMainPage.folderLabel = folder
-WizardNewFolderMainPage.description = Create a new folder resource.
-WizardNewFolderCreationPage.progress = Creating
-WizardNewFolderCreationPage.errorTitle = Creation Problems
-WizardNewFolderCreationPage.internalErrorTitle = Creation problems
-WizardNewFolder.internalError = Internal error: {0}
-
-# --- New File ---
-WizardNewFileCreationPage.progress = Creating
-WizardNewFileCreationPage.errorTitle = Creation Problems
-WizardNewFileCreationPage.fileLabel = Fi&le name:
-WizardNewFileCreationPage.file = file
-WizardNewFileCreationPage.internalErrorTitle = Creation problems
-WizardNewFileCreationPage.internalErrorMessage = Internal error: {0}
-WizardNewFileCreationPage.fileExistsMessage = A file {0} already exists in the file system.
-
-
-# ==============================================================================
-# Preference Pages
-# ==============================================================================
-PreferenceNode.errorTitle = Preference Page Creation Problems
-PreferenceNode.errorMessage = Unable to create the selected preference page.
-Preference.note = Note:
-
-# --- Workbench ---
-WorkbenchPreference.acceleratorConfiguration = &Key bindings:
-WorkbenchPreference.autobuild = Perform &build automatically on resource modification
-WorkbenchPreference.savePriorToBuilding = Save all &modified resources automatically prior to manual build
-WorkbenchPreference.linkNavigator = &Link Navigator selection to active editor
-WorkbenchPreference.refreshButton = &Refresh Workspace on startup
-WorkbenchPreference.replaceCurrent = &Replace current
-WorkbenchPreference.control = Ctrl
-WorkbenchPreference.shift = Shift
-WorkbenchPreference.shiftAlt = Shift-Alt
-WorkbenchPreference.encoding = Text file encoding
-WorkbenchPreference.defaultEncoding = Defaul&t ({0})
-WorkbenchPreference.otherEncoding = &Other:
-WorkbenchPreference.unsupportedEncoding = The selected encoding is not supported.
-WorkbenchPreference.numDefaultEncodings = 6
-WorkbenchPreference.defaultEncoding1 = ISO-8859-1
-WorkbenchPreference.defaultEncoding2 = UTF-8
-WorkbenchPreference.defaultEncoding3 = UTF-16
-WorkbenchPreference.defaultEncoding4 = UTF-16BE
-WorkbenchPreference.defaultEncoding5 = UTF-16LE
-WorkbenchPreference.defaultEncoding6 = US-ASCII
-
-# --- Appearance ---
-ViewsPreference.editors = Editor tab positions
-ViewsPreference.editors.top = &Top
-ViewsPreference.editors.bottom = &Bottom
-ViewsPreference.views = View tab positions
-ViewsPreference.views.top = To&p
-ViewsPreference.views.bottom = Botto&m
-ViewsPreference.note = Note:
-ViewsPreference.applyMessage = Changes to the tab positions are not applied to the current workbench. \nRestart the workbench to use the tab position settings.
-ViewsPreference.ColorsTitle = Workbench colors
-ViewsPreference.ErrorText = &Error text
-ViewsPreference.HyperlinkText = &Hyperlink text
-ViewsPreference.ActiveHyperlinkText = A&ctive hyperlink text
-
-# --- File Editors ---
-FileEditorPreference.fileTypes = File &types:
-FileEditorPreference.add = &Add...
-FileEditorPreference.remove = &Remove
-FileEditorPreference.associatedEditors = Associated &editors:
-FileEditorPreference.addEditor = A&dd...
-FileEditorPreference.removeEditor = Re&move
-FileEditorPreference.default = De&fault
-FileEditorPreference.existsTitle = File Type Exists
-FileEditorPreference.existsMessage = An entry already exists for that file type
-FileEditorPreference.type = Type
-FileEditorPreference.defaultLabel = (default)
-
-FileExtension.extensionEmptyMessage = The file extension cannot be empty
-FileExtension.fileNameInvalidMessage = The file name cannot include the wild card character (*) in the current location
-FileExtension.fileTypeMessage = Enter file type to add: (e.g. *.doc or report.doc)
-FileExtension.fileTypeLabel = File &type:
-FileExtension.shellTitle = New File Type
-FileExtension.dialogTitle = Define a New File Type
-
-Choose_the_editor_for_file = Choose the editor for files of type ({0})
-EditorSelection.chooseAnEditor = Choose an editor:
-EditorSelection.internal = &Internal Editors
-EditorSelection.external = &External Programs
-EditorSelection.browse = &Browse...
-EditorSelection.title = Editor Selection
-
-# --- Local History ---
-FileHistory.longevity = Days to &keep files:
-FileHistory.entries = &Entries per file:
-FileHistory.diskSpace = &Maximum file size (MB):
-FileHistory.mustBePositive = Values must be positive
-FileHistory.invalid = Invalid value: {0}
-FileHistory.exceptionSaving = Internal error saving local history
-FileHistory.aboveMaxEntries = Above maximum Entries per file: {0}
-FileHistory.aboveMaxFileSize = Above maximum File size value: {0}
-FileHistory.restartNote = The Entries per file and Days to keep files values are only applied on Workbench restart.
-
-# --- Perspectives ---
-OpenPerspectiveMode.optionsTitle = Open a new perspective
-OpenPerspectiveMode.sameWindow = In the &same window
-OpenPerspectiveMode.newWindow = In a &new window
-PerspectivesPreference.MakeDefault = Ma&ke Default
-PerspectivesPreference.MakeDefaultTip = Make the Current Selection the Default Perspective
-PerspectivesPreference.Reset = &Reset
-PerspectivesPreference.ResetTip = Reset the Current Selection to its Original Value
-PerspectivesPreference.Delete = D&elete
-PerspectivesPreference.DeleteTip = Delete a User Defined Perspective
-PerspectivesPreference.available = A&vailable perspectives:
-PerspectivesPreference.defaultLabel = {0} (default)
-PerspectivesPreference.cannotdelete.title=Unable to delete perspective
-PerspectivesPreference.cannotdelete.message=Unable to delete perspective {0}. It has open instances.
-
-PerspectiveLabelProvider.unknown = Unknown Element Type
-OpenViewMode.title = Open a new view
-OpenViewMode.embed = Within the &perspective
-OpenViewMode.fast = As &fast view
-OpenViewMode.float = As f&loating view
-WorkbenchPreference.projectOptionsTitle = New project options
-WorkbenchPreference.switch = S&witch to recommended perspective
-
-# --- Build Order ---
-BuildOrderPreference.up = &Up
-BuildOrderPreference.down = Dow&n
-BuildOrderPreference.add = Add &Project...
-BuildOrderPreference.remove = &Remove Project
-BuildOrderPreference.selectProject = Select a Project
-BuildOrderPreference.selectOtherProjects = Select &projects to add to build path:
-BuildOrderPreference.useDefaults = Use d&efault build order
-BuildOrderPreference.projectBuildOrder = Project build &order:
-BuildOrderPreference.note = Projects marked with a '*' are involved in a dependency\ncycle. These projects will be built in an arbitrary order\nafter all other projects have been built.
-
-# --- Fonts ---
-FontsPreference.fonts = &Fonts:
-FontsPreference.preview = &Preview:
-FontsPreference.BannerFont = Banner Font
-FontsPreference.DialogFont = Dialog Font
-FontsPreference.HeaderFont = Header Font
-FontsPreference.TextFont = Text Font
-FontsPreference.SampleText=AaBbYyZz
-FontsPreference.useSystemFont=&Use System Font
-
-# --- Decorators ---
-DecoratorsPreferencePage.description = Descriptio&n:
-DecoratorsPreferencePage.decoratorsLabel = Available &label decorations:
-DecoratorsPreferencePage.explanation = \
- Label decorations show extra information about an item on its label or icon.\n\
- Select which additional decorations should be displayed.
-DecoratorsPreferencePage.noDescription = (No description available)
-
-# --- Startup preferences ---
-StartupPreferencePage.label=&Plugins activated on startup:
-
-# --- Work in Progress ---
-WorkInProgressPreference.noEffectUntilRestarted=Note: This preference will only take effect after restarting
-WorkInProgressPreference.enableCoolbars=Enable cool bars
-WorkInProgressPreference.enableNavigationHistory=Enable navigation history
-WorkInProgressPreference.onlyAffectsNewWindows=Note: This preference will only take effect on new windows
-
-WorkInProgressPreference.openMode=Open mode
-WorkInProgressPreference.doubleClick=D&ouble click
-WorkInProgressPreference.singleClick=&Single click
-WorkInProgressPreference.singleClick_SelectOnHover=Select on &hover
-WorkInProgressPreference.singleClick_OpenAfterDelay=Open when using arrow &keys
-WorkInProgressPreference.noEffectOnAllViews=Note: This preference may not take effect on all views
-
-
-# ==============================================================================
-# Property Pages
-# ==============================================================================
-PropertyDialog.text = P&roperties
-PropertyDialog.toolTip = Open Properties Dialog
-PropertyDialog.messageTitle = Property Pages
-PropertyDialog.noPropertyMessage = No property pages for {0}.
-PropertyDialog.propertyMessage = Properties for {0}
-PropertyPageNode.errorTitle = Property Page Creation Problems
-PropertyPageNode.errorMessage = Unable to create the selected property page.
-
-# --- Info ---
-ResourceInfo.readOnly = &Read Only
-ResourceInfo.derived = Deri&ved
-ResourceInfo.name = Name:
-ResourceInfo.type = Type:
-ResourceInfo.location = Location:
-ResourceInfo.size = Size:
-ResourceInfo.bytes = {0} bytes
-ResourceInfo.file = File
-ResourceInfo.folder = Folder
-ResourceInfo.project = Project
-ResourceInfo.unknown = Unknown
-ResourceInfo.notLocal = <file contents not local>
-ResourceInfo.path = Path:
-ResourceInfo.lastModified = Last Modified:
-
-# --- Project References ---
-ProjectReferencesPage.label = Projects may refer to other projects in the workspace.\nUse this page to specify what other projects are referenced by the project.\n\n&Project references for {0}:
-
-# --- Project Capabilities ---
-ProjectCapabilityPropertyPage.chooseCapabilities = Choose the capabilities for the project.
-ProjectCapabilityPropertyPage.noCapabilities = There are no capabilities available to choose from.
-ProjectCapabilityPropertyPage.errorTitle = Project Capability Problems
-ProjectCapabilityPropertyPage.internalError = Internal error updating project''s capabilities.
-ProjectCapabilityPropertyPage.invalidSelection = The requested project capability changes are invalid.
-
-ProjectCapabilityEditingPropertyPage.add = &Add...
-ProjectCapabilityEditingPropertyPage.remove = &Remove
-ProjectCapabilityPropertyPage.capabilityRequired = The chosen capability is required by the {0} capability and cannot be removed.
-
-# ==============================================================================
-# Editors
-# ==============================================================================
-OleEditor.renameTitle = Rename File
-OleEditor.renameMessage = Enter new file name:
-OleEditor.errorSaving = Exception saving file
-OleEditor.oleExceptionTitle = OLE Exception
-OleEditor.oleExceptionMessage = OLE Error Saving
-OleEditor.savingTitle = Error Saving
-OleEditor.savingMessage = Could not save
-OleEditor.invalidInput = Invalid Input: {0}. Input must implement IFileEditorInput
-
-SystemEditorDescription.name = &System Editor
-DefaultEditorDescription.name = &Default Editor
-
-WelcomeEditor.accessException = An exception occurred when trying to access the welcome page
-WelcomeEditor.readFileError = Error in WelcomeEditor.readFile
-WelcomeEditor.title = Welcome
-WelcomeEditor.toolTip = Welcome to {0}
-WelcomeItem.unableToLoadClass = Unable to load class
-WelcomeParser.parseError = Error in WelcomeParser.parse
-WelcomeParser.parseException = An exception occurred when parsing the welcome page
-Workbench.openEditorErrorDialogTitle = Problem
-Workbench.openEditorErrorDialogMessage = Unable to open editor
-QuickStartAction.openEditorException = An exception occurred when opening the editor
-
-# ==============================================================================
-# Dialogs
-# ==============================================================================
-Error = Error
-Information = Information
-Question = Question
-
-WorkbenchPreferenceDialog.load = Import...
-WorkbenchPreferenceDialog.save = Export...
-WorkbenchPreferenceDialog.verifyErrorMessage = The file {0} is not a valid preference file.
-WorkbenchPreferenceDialog.verifyWarningMessage = There is a minor compatibility problem with the preferences in file {0}. Do you wish to continue?
-WorkbenchPreferenceDialog.loadErrorTitle = Import Problem
-WorkbenchPreferenceDialog.loadErrorMessage = Unable to import preferences from file {0}
-WorkbenchPreferenceDialog.loadTitle = Import
-WorkbenchPreferenceDialog.loadMessage = Preferences imported from file {0}.
-WorkbenchPreferenceDialog.saveErrorTitle = Export Problem
-WorkbenchPreferenceDialog.saveErrorMessage = Unable to export preferences to file {0}
-WorkbenchPreferenceDialog.saveTitle = Export
-WorkbenchPreferenceDialog.saveMessage = Preferences exported to file {0}.
-WorkbenchPreferenceDialog.existsErrorMessage = {0} already exists. Would you like to overwrite it?
-WorkbenchPreferenceDialog.noPreferencesMessage = No preferences have been set.
-
-ContainerSelectionDialog.title = Folder Selection
-ContainerSelectionDialog.message = Enter or select the folder:
-
-ContainerGroup.message = &Enter or select the folder:
-ContainerGroup.selectFolder = Select the folder:
-
-ContainerGenerator.progressMessage = Generate Folder
-
-ResourceGroup.resource = resource
-ResourceGroup.nameExists = The same name already exists.
-ResourceGroup.folderEmpty = The folder is empty.
-ResourceGroup.noProject = The specified project does not exist.
-ResourceGroup.emptyName = The {0} name is empty.
-ResourceGroup.containsSeparator = The {0} name contains a separator.
-ResourceGroup.invalidFilename = {0} is not a valid file name.
-
-FileSelectionDialog.title = File Selection
-FileSelectionDialog.message = Select the files:
-
-ListSelection.title = Selection Needed
-ListSelection.message = Select the items:
-
-ProjectLocationSelectionDialog.nameLabel = &Project name:
-ProjectLocationSelectionDialog.locationLabel = &Location:
-ProjectLocationSelectionDialog.browseLabel = &Browse...
-ProjectLocationSelectionDialog.directoryLabel = Select the location directory.
-ProjectLocationSelectionDialog.locationError = Invalid location path
-ProjectLocationSelectionDialog.selectionTitle = Project
-ProjectLocationSelectionDialog.useDefaultLabel = Use &default location
-
-ProjectPerspectiveChoiceDialog.title = Choose Perspective
-ProjectPerspectiveChoiceDialog.choosePerspective = Show project in &perspective:
-ProjectPerspectiveChoiceDialog.options = Options
-ProjectPerspectiveChoiceDialog.newWindow = &New window
-ProjectPerspectiveChoiceDialog.sameWindow = &Same window
-ProjectPerspectiveChoiceDialog.errorTitle = Show Perspective Problem
-ProjectPerspectiveChoiceDialog.errorMessage = Unable to show the chosen perspective.
-
-ResourceSelectionDialog.title = Resource Selection
-ResourceSelectionDialog.message = Select the resources:
-
-SelectionDialog.selectLabel = &Select All
-SelectionDialog.deselectLabel = &Deselect All
-
-MarkerResolutionSelectionDialog.title = Quick Fix
-MarkerResolutionSelectionDialog.messageLabel = Available fixes:
-
-ElementTreeSelectionDialog.nothing_available=No entries available.
-
-CheckedTreeSelectionDialog.nothing_available=No entries available.
-CheckedTreeSelectionDialog.select_all=Select &All
-CheckedTreeSelectionDialog.deselect_all=&Deselect All
-
-MultiElementListSelectionDialog.pageInfoMessage=Page {0} of {1}
-
-FilterDialog.workingSet = Select a &working set (matching files will be shown):
-FilterDialog.workingSetOther = Other...
-
-Updates.title = Updates
-Updates.message = You have updates.\nDo you wish to open the Update Manager now?
-
-CopyToClipboardProblemDialog.title=Problem Copying to Clipboard
-CopyToClipboardProblemDialog.message=There was a problem when accessing the system clipboard. Retry?
-
-# ==============================================================================
-# Editor Framework
-# ==============================================================================
-EditorManager.saveResourcesMessage = Select the &resources to save:
-EditorManager.saveResourcesTitle = Save Resources
-EditorManager.saveFailed = Save Failed
-EditorManager.exceptionRestoringEditor = Internal error activating an Editor.
-EditorManager.unableToCreateEditor = Unable to create editor: {0}.
-EditorManager.systemEditorError = System editor can only open file base resources.
-EditorManager.unableToInstantiate = Unable to instantiate editor: {0} {1}
-EditorManager.siteIncorrect = Editor initialization failed: {0}. Site is incorrect.
-EditorManager.saveFailedMessage = Save Failed: {0}
-EditorManager.unknownEditorIDMessage = Unable to open editor, unknown editor ID: {0}
-EditorManager.errorOpeningExternalEditor = Unable to open external editor {0} ({1}).
-EditorManager.errorInitializingExternalEditor = Unable to open external editor {0} ({1}){2}).
-EditorManager.unableToOpenExternalEditor = Unable to open external editor for {0}.
-EditorManager.unableToOpenEditor=Unable to open editor for {0}.
-EditorManager.operationFailed = {0} Failed
-EditorManager.saveChangesQuestion = {0} has been modified. Save changes?
-EditorPane.errorMessage = An error has occurred when creating this editor
-EditorPane.moveEditor=&Editor
-EditorPane.moveFolder=&Tab Group
-EditorPane.pinEditor=&Pin
-
-OpenSystemEditorAction.pageError = Workbench page must be supplied to OpenSystemEditorAction
-OpenSystemEditorAction.logTitle = Error in OpenSystemEditorAction.openFile
-OpenSystemEditorAction.dialogTitle = Problems Opening System Editor
-OpenSystemEditorAction.text = &System Editor
-OpenSystemEditorAction.toolTip = Edit File With System Editor
-
-ExternalEditor.errorMessage = Error opening external editor ({0}).
-) = )
-Save = Save
-Save_Resource = Save Resource
-Save_All = Save All
-
-
-# ==============================================================================
-# Perspective Framework
-# ==============================================================================
-OpenNewPage.text = Open In Same Window
-OpenNewPage.toolTip = Open In Same Window
-OpenNewPage.errorTitle = Problems Opening Perspective
-
-OpenNewPageMenu.dialogTitle = Problems Opening Page
-OpenNewPageMenu.unknownPageInput = Unknown Page Input
-
-OpenNewWindowMenu.dialogTitle = Problems Opening Window
-OpenNewWindowMenu.unknownInput = Unknown Window Input
-
-OpenPerspectiveMenu.pageProblemsTitle = Problems Opening Perspective
-OpenPerspectiveMenu.errorUnknownInput = Unknown Perspective Input
-OpenPerspectiveMenu.dialogTitle = Problems Opening Window
-OpenPerspectiveMenu.unknownInput = Unknown Window Input
-
-Perspective.oneErrorRestoring = An error has occurred while restoring the workbench: See error log for more details.
-Perspective.multipleErrorsRestoring = Errors have occurred while restoring the workbench: See error log for more details.
-
-Perspective.oneError = An error has occurred while saving the workbench: See error log for more details.
-Perspective.multipleErrors = Errors have occurred while saving the workbench: See error log for more details.
-
-Perspective.problemRestoringTitle = Restoring Problems
-Perspective.errorReadingState = Unable to read workbench state.
-WorkbenchPage.problemRestoringTitle = Restoring Problems
-WorkbenchPage.errorReadingState = Unable to read workbench state.
-
-Perspective.problemSavingTitle = Saving Problems
-Perspective.problemSavingMessage = Unable to store layout state.
-
-Perspective.unableToLoad = Unable to load perspective: {0}
-Perspective.exceptionRestoringView = An error has occurred while restoring the view: {0}
-Perspective.couldNotFind = Could not find view: {0}
-
-PerspectiveContributionItem.toolTip = Open a Perspective
-
-# ==============================================================================
-# Views Framework
-# ==============================================================================
-Menu = Menu
-Close = Close
-ViewPane.fastView = &Fast View
-ViewPane.minimize = Minimize
-ViewPane.minimizeView= Mi&nimize
-ViewPane.pin = Fast View
-ViewPane.errorMessage = An error has occurred when creating this view
-ViewPane.moveView=&View
-ViewPane.moveFolder=&Tab Group
-
-ViewLabel.unknown = Unknown
-
-ViewFactory.initException = Unable to instantiate view: {0}
-ViewFactory.siteException = View initialization failed: {0}. Site is incorrect.
-ViewFactory.couldNotCreate = Could not create view: {0}
-ViewFactory.couldNotSave = Could not save view: {0}
-ViewFactory.unableToRestoreViewTitle = Error Restoring View
-ViewFactory.unableToRestoreViewMessage = Unable to restore: {0}.
-
-
-# ==============================================================================
-# Workspace
-# ==============================================================================
-WorkspaceAction.problemsTitle = Problems
-WorkspaceAction.logTitle = Exception in {0}. run: {1}
-WorkbenchAction.problemsMessage = The following problems occurred.
-WorkbenchAction.internalError = Internal error.
-Workspace = Workspace
-UIWorkspaceLock.errorModDuringNotification = The resource tree is locked for modifications.
-
-
-# ==============================================================================
-# Workbench
-# ==============================================================================
-WorkbenchWindow.shellTitle = {0} - {1}
-WorkbenchPage.UnknownLabel = <Unknown Label>
-
-WorkbenchPage.editorAlreadyOpenedMsg = {0} is opened and has unsaved changes. Do you want to save it?
-
-PartPane.restore = &Restore
-PartPane.move=&Move
-PartPane.size=&Size
-PartPane.sizeLeft=&Left
-PartPane.sizeRight=&Right
-PartPane.sizeTop=&Top
-PartPane.sizeBottom=&Bottom
-PartPane.maximize = Ma&ximize
-PartPane.close = &Close
-PartPane.unableToCreate = Unable to create part: {0}
-
-EditorManager.unableToRestoreEditorTitle = Error Restoring Editor
-EditorManager.unableToRestoreEditorMessage = Unable to restore: {0}.
-
-PluginAction.operationNotAvailableMessage = The chosen operation is not currently available.
-PluginAction.disabledMessage = The chosen operation is not enabled.
-ActionDescriptor.invalidLabel = Unknown Label
-
-XMLMemento.parserConfigError = Internal XML parser configuration error.
-XMLMemento.ioError = Could not read content of XML file.
-XMLMemento.formatError = Could not parse content of XML file.
-XMLMemento.noElement = Could not find root element node of XML file.
-
-# --- Workbench Errors/Problems ---
-WorkbenchWindow.exceptionMessage = Abnormal Workbench Condition
-WorkbenchPage.AbnormalWorkbenchCondition = Abnormal Workbench Condition
-Abnormal_Workbench_Conditi = Abnormal Workbench Condition
-WorkbenchPage.ErrorActivatingView = An error has occurred when activating this view
-WorkbenchPage.ErrorExtractingEditorIDFromMarker = Error extracting editor ID from marker
-WorkbenchPage.oneErrorClosingPage = An error has occurred while closing workbench page: See error log for more details.
-WorkbenchPage.multipleErrorsClosingPage = Errors have occurred while closing workbench page: See error log for more details.
-
-DecoratorManager.ErrorActivatingDecorator = An error has occurred activating decorator {0}.
-
-EditorRegistry.errorTitle = Load Problem
-EditorRegistry.errorMessage = Unable to load editor associations.
-
-SafeRunnable.errorMessage = An error has occurred. See error log for more details.
-ActionSetLabelProvider.Unknown = Unknown
-
-ErrorClosing = An error has occurred when closing the workbench. See error log for more details.
-ErrorClosingNoArg = An error has occurred. See error log for more details. Do you want to exit?
-ErrorClosingOneArg = An error has occurred: {0}. See error log for more details. Do you want to exit?
-ErrorReadingState = Unable to read workbench state. Workbench UI layout will be reset.
-ErrorReadingWorkbenchState = Unable to read workbench state.
-
-Internal_error = Internal error
-InternalError = Internal Error
-InternalErrorNoArg = An internal error has occurred.\nSee error log for more details.\n\nExit workspace?
-InternalErrorOneArg = An internal error has occurred.\n{0}\nSee error log for more details.\n\nExit workspace?
-
-FatalError_RecursiveError = A internal error occurred while showing an internal error.
-FatalError_OutOfMemoryError = An out of memory error has occurred.
-FatalError_StackOverflowError = A stack overflow error has occurred.
-FatalError_VirtualMachineError = A virtual machine error has occurred.
-FatalError_SWTError = A SWT error has occurred.
-FatalError = \nIt is recommended to exit the workbench.\nSubsequent errors may happen and may terminate the workbench without warning.\nSee error log for more details.\n\nExit workspace?
-
-Invalid_workbench_state_ve = Invalid workbench state version. workbench.xml will be deleted
-Workbench.incompatibleUIState = Cannot Preserve Layout
-Workbench.incompatibleSavedStateVersion = \
- The saved user interface layout is in an obsolete format and cannot be preserved.\n\n\
- Your projects and files will not be affected.\n\n\
- Press OK to convert to the new format.\n\
- Press Cancel to exit with no changes.
-ProblemSavingState = Unable to store workbench state.
-ProblemSavingWorkbench = Problems occurred while trying to save the state of the workbench.
-ProblemsSavingWorkspace = Problems saving workspace
-SavingProblem = Saving Problems
-
-Problems_Opening_Page = Problems Opening Page
-Restoring_Problem = Restoring Problem
-Restoring_Problems = Restoring Problems
-
-Workbench.instalationError = Installation error detected.
-Unhandled_exception = Unhandled exception caught in event loop.
-
-Workspace.problemMessage = Problems occurred refreshing workspace.
-Workspace.problemsTitle = Problems
-
-Workbench.problemsRestoringMsg=Could not restore workbench layout.
-Workbench.problemsSavingMsg=Could not save workbench layout.
-Workbench.problemsRestoring=Problems occurred restoring workbench.
-Workbench.problemsSaving=Problems occurred saving workbench.
-WorkbenchWindow.problemsRestoringWindow=Problems occurred restoring window.
-WorkbenchWindow.problemsSavingWindow=Problems occurred saving window.
-EditorManager.problemsRestoringEditors=Problems occurred restoring editors.
-EditorManager.problemsSavingEditors=Problems occurred saving editors.
-RootLayoutContainer.problemsRestoringPerspective=Problems occurred restoring perspective.
-RootLayoutContainer.problemsSavingPerspective=Problems occurred saving perspective.
-ViewFactory.problemsSavingViews=Problems occurred saving views.
-
-EditorManager.unableToSaveEditor=Unable to save editor: {0}.
-Perspective.problemsRestoringPerspective=Problems occurred restoring perspective.
-Perspective.problemsSavingPerspective=Problems occurred saving perspective.
-Perspective.problemsRestoringViews=Problems occurred restoring views.
-WorkbenchWindow.unableToRestorePerspective=Unable to restore perspective: {0}.
-WorkbenchPage.unableToRestorePerspective=Unable to restore perspective: {0}.
-WorkbenchPage.unableToSavePerspective=Unable to save perspective: {0}.
-Perspective.unableToRestorePerspective=Unable to restore perspective: {0}.
-
-# ==============================================================================
-# Keys with references but don't show in the UI
-# ==============================================================================
-CreateFileAction.text = New &File
-CreateFileAction.toolTip = Create New File
-CreateFileAction.title = New
-
-CreateFolderAction.text = New F&older
-CreateFolderAction.toolTip = Create New Folder
-CreateFolderAction.title = New
-
-NewWizardDropDown.text = &New Wizards
-ScrubLocalAction.problemsMessage = Problems occurred removing the local contents of the selected resources.
-ScrubLocalAction.text = Discard &Local Copy
-ScrubLocalAction.toolTip = Discard Local Contents
-ScrubLocalAction.problemsTitle = Content Removal Problems
-ScrubLocalAction.progress = Discarding content:
-
-ReplacePerspective.text = Replace With
-ReplacePerspective.toolTip = Replace Perspective
-
-TextAction.selectAll = Select All
-Cut = Cut
-Copy = Copy
-Paste = Paste
-Delete = Delete
-
-# ==============================================================================
-# Keys used in the reuse editor which is released as experimental.
-# ==============================================================================
-EditorManager.openNewEditorLabel=Open new editor
-EditorManager.reuseEditorDialogTitle=Reusing dirty editors
-PinEditorAction.text=Pin Active Editor
-PinEditorAction.toolTip=Pin the active editor so it won't be reused.
-WorkbenchPreference.reuseEditors=&Close editors automatically
-WorkbenchPreference.reuseDirtyEditorGroupTitle=When all editors are dirty or pinned
-WorkbenchPreference.promptToReuseEditor=&Prompt to save and reuse
-WorkbenchPreference.openNewEditor=Open &new editor
-WorkbenchPreference.reuseEditorsThreshold=Number of opened &editors before closing:
-WorkbenchPreference.reuseEditorsThresholdError=The number of opened editors should be more than 0.
-WorkbenchPreference.recentFiles=Size of recently opened &files list:
-WorkbenchPreference.recentFilesError=The size of the recently opened files list should be between 0 and {0}.
-WorkbenchPreference.saveInterval=&Workspace save interval (in minutes):
-WorkbenchPreference.saveIntervalError=The workspace save interval should be between 1 and {0}.
-
-WorkbenchEditorsAction.label=&Switch to Editor...@Ctrl+Shift+W
-
-WorkbenchEditorsDialog.title=Switch to Editor
-WorkbenchEditorsDialog.label=Select an &editor to switch to:
-WorkbenchEditorsDialog.closeSelected=&Close Selected Editors
-WorkbenchEditorsDialog.saveSelected=&Save Selected Editors
-WorkbenchEditorsDialog.selectClean=Se&lect Clean Editors
-WorkbenchEditorsDialog.invertSelection=&Invert Selection
-WorkbenchEditorsDialog.showAllPersp=Show editors from &all windows
-WorkbenchEditorsDialog.includeRecentlyUsed=Include &recently used editors
-WorkbenchEditorsDialog.name=Name
-WorkbenchEditorsDialog.path=Path
-WorkbenchEditorsDialog.perspective=Perspective
-WorkbenchEditorsDialog.recentlyUsed=<Recently Used>
-
-ShowPartPaneMenuAction.text=Show System Menu@Alt+-
-ShowPartPaneMenuAction.toolTip=Show System Menu
-ShowViewMenuAction.text=Show View Menu@Ctrl+F10
-ShowViewMenuAction.toolTip=Show View Menu
-
-
-# ==============================================================================
-# Working Set Framework.
-# ==============================================================================
-ProblemSavingWorkingSetState.message = Unable to store working set state.
-ProblemSavingWorkingSetState.title = Saving Problems
-ProblemRestoringWorkingSetState.message = Unable to restore working set state.
-ProblemRestoringWorkingSetState.title = Restoring Problems
-
-WorkingSetEditWizard.title=Edit Working Set
-WorkingSetNewWizard.title=New Working Set
-
-WorkingSetTypePage.description=Select a working set type.
-WorkingSetTypePage.typesLabel=&Working set type:
-
-ResourceWorkingSetPage.title=Resource Working Set
-ResourceWorkingSetPage.description=Enter a working set name and select the working set resources.
-ResourceWorkingSetPage.message=&Working set name:
-ResourceWorkingSetPage.label.tree=Working set &contents:
-ResourceWorkingSetPage.warning.nameMustNotBeEmpty= The name must not be empty.
-ResourceWorkingSetPage.warning.nameWhitespace= The name must not have leading or trailing whitespace.
-ResourceWorkingSetPage.warning.workingSetExists= A working set with the same name already exists.
-ResourceWorkingSetPage.warning.resourceMustBeChecked= At least one resource must be checked.
-ResourceWorkingSetPage.error= Error
-ResourceWorkingSetPage.error.updateCheckedState= Error during update of checked state
-ResourceWorkingSetPage.projectClosedDialog.message= A closed project can not be modified
-ResourceWorkingSetPage.projectClosedDialog.title= Working Set Change
-
-WorkingSetSelectionDialog.title= Select Working Set
-WorkingSetSelectionDialog.title.multiSelect= Select Working Sets
-WorkingSetSelectionDialog.message= &Select a working set:
-WorkingSetSelectionDialog.message.multiSelect= &Select working sets:
-WorkingSetSelectionDialog.detailsButton.label= &Edit...
-WorkingSetSelectionDialog.newButton.label= &New...
-WorkingSetSelectionDialog.removeButton.label= &Remove
-
-# =================================================================
-# System Summary
-# =================================================================
-SystemSummary.name=Configuration Details
-SystemSummary.tooltip=Configuration Details
-SystemSummary.dialogTitle=Save As
-SystemSummary.saveErrorTitle = Error
-SystemSummary.saveErrorMessage = An error occured saving to file {0}\n\n{1}.
-
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/AcceleratorHook.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/AcceleratorHook.java
deleted file mode 100644
index 46e2a0f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/AcceleratorHook.java
+++ /dev/null
@@ -1,192 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-
-/**
- * A strategy for hooking accelerators on a control.
- * <p>
- * In SWT an accelerator which is defined in a shell menu is global. If
- * enabled, it will always be executed regardless of the current focus control or its
- * abilities. This creates a problem where the focus control has an equivalent
- * key sequence. For example, if <code>Ctrl+C</code> is defined as the accelerator
- * for <code>Copy</code> at the shell level it will override the same key sequence
- * in a text widget within the shell, thus breaking the text widget.
- * </p><p>
- * To avoid this problem an <code>AcceleratorHook</code> may be used to define
- * the accelerators locally on each control rather than globally on the shell.
- * The accelerators defined in an <code>AcceleratorHook</code> are only operational
- * when the control has focus.
- * </p><p>
- * To use this class, instantiate an instance for a particular control and register
- * each action which has an accelerator. If the accelerator is pressed the action will
- * be invoked.
- * </p><p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class AcceleratorHook implements Listener {
- private ArrayList actionList;
-
- private class ActionItem {
- public ActionItem(int accel, IAction act) {
- accelerator = accel;
- action = act;
- }
- public int accelerator;
- public IAction action;
- }
-
- private class FakeAction extends Action {
- public FakeAction(String name) {
- super(name);
- }
- public void run() {
- }
- }
-/**
- * AcceleratorHook constructor comment.
- */
-public AcceleratorHook(Control ctrl) {
- actionList = new ArrayList(5);
- ctrl.addListener(SWT.KeyDown, this);
- ctrl.addListener(SWT.KeyUp, this);
-}
-/**
- * Adds an action to the control. If the action accelerator is pressed
- * the action will be run.
- * <p>
- * The accelerator for the action is derived from the action.
- * </p>
- *
- * @param action an action with unique accelerator
- */
-public void add(IAction action) {
- if (action.getAccelerator() == 0)
- return;
- actionList.add(new ActionItem(action.getAccelerator(), action));
-}
-/**
- * Adds an action to the control with a particular accelerator.
- * If the accelerator is pressed the action will be run.
- * <p>
- * The accelerator for the action is derived from <code>strAccel</code>
- * string. The content of this string must conform to the standard JFace
- * conventions for accelerator declaration. For more information see
- * the <code>org.eclipse.jface.action.Action</code> class.
- * </p>
- *
- * @param action an action
- * @param strAccel the action accelerator
- * @see org.eclipse.jface.action.Action
- */
-public void add(IAction action, String strAccel) {
- Action fakeAction = new FakeAction("Fake\t"+strAccel);//$NON-NLS-1$
- if (fakeAction.getAccelerator() == 0)
- return;
- actionList.add(new ActionItem(fakeAction.getAccelerator(), action));
-}
-/**
- * Returns the first item which represents the action.
- *
- * @returns the first item to match, or <code>null</code>.
- */
-private ActionItem findItem(IAction action) {
- Iterator iter = actionList.iterator();
- while (iter.hasNext()) {
- ActionItem item = (ActionItem)iter.next();
- if (item.action == action)
- return item;
- }
- return null;
-}
-/**
- * Returns the first item with an accelerator which maches
- * the key event.
- *
- * @returns the first item to match, or <code>null</code>.
- */
-private ActionItem findItem(Event e) {
- // Map event to accel.
- int accel = getAccel(e);
- if (accel == 0)
- return null;
-
- // Map accelerator to item.
- Iterator iter = actionList.iterator();
- while (iter.hasNext()) {
- ActionItem item = (ActionItem)iter.next();
- // System.out.println("Accel = " + Integer.toString(item.accelerator, 16));
- if (item.accelerator == accel)
- return item;
- }
- return null;
-}
-/**
- * Convert a key event to an accelerator.
- *
- * @param e the key event
- * @return the int accelerator value
- */
-private int getAccel(Event e) {
- // Debug.
- /*
- System.out.println("KeyEvent");
- System.out.println("\tChar = " + Integer.toString((int)e.character, 16));
- System.out.println("\tKeyCode = " + Integer.toString(e.keyCode, 16));
- System.out.println("\tState Mask = " + Integer.toString(e.stateMask, 16));
- */
-
- // Real work.
- int key = (int)Character.toUpperCase(e.character);
- int mods = 0;
- if ((e.stateMask & SWT.ALT) > 0)
- mods |= SWT.ALT;
- if ((e.stateMask & SWT.SHIFT) > 0)
- mods |= SWT.SHIFT;
- if ((e.stateMask & SWT.CTRL) > 0) {
- mods |= SWT.CTRL;
- key = key + 'A' - 1; // Convert unicode to char.
- }
- int accel = key | mods | e.keyCode;
-
- // Debug
- /*
- System.out.println("Accel = " + Integer.toString(accel, 16));
- */
- return accel;
-}
-
-/**
- * Notifies that a key has been pressed on the system keyboard.
- * <p>
- * This method is a callback from the target control for this hook.
- * Other clients are not expected to call this method.
- * </p>
- *
- * @param e an event containing information about the key press
- */
-public void handleEvent(Event event) {
- ActionItem item = findItem(event);
- if (item != null)
- item.action.runWithEvent(event);
-}
-
-/**
- * Removes an action from the hook. Does nothing if the action is
- * not found.
- *
- * @param action an action
- */
-public void remove(IAction action) {
- ActionItem item = findItem(action);
- if (item != null)
- actionList.remove(item);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ActivatorBar.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ActivatorBar.java
deleted file mode 100644
index 0495f7c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ActivatorBar.java
+++ /dev/null
@@ -1,183 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import java.util.*;
-import java.util.List;
-
-/**
- * A Label which supports aligned text and/or an image and different border styles.
- * If there is not enough space a SmartLabel uses the following strategy to fit the information into the
- * available space:
- * <pre>
- * - ignores the indent in left align mode
- * - ignores the image and the gap
- * - shortens the text by replacing the center portion of the label with an ellipsis
- * - shortens the text by removing the center portion of the label
- * </pre>
- */
-public class ActivatorBar extends Canvas implements PaintListener {
- private ActivatorItem activeItem = null;
- private ItemListener listener;
- private ArrayList items = new ArrayList(5);
- /**
- * Create a SmartLabel with the given borderStyle as a child of parent.
- */
- public ActivatorBar(Composite parent) {
- super(parent, SWT.NONE);
- addPaintListener(this);
- setLayout(new ActivatorBarLayout());
- }
-/**
- * Add an item to the bar.
- */
-protected void addItem(ActivatorItem item) {
- items.add(item);
- layout();
-}
-/**
- * Add a selection listener.
- */
-public void addItemListener(ItemListener listener) {
- this.listener = listener;
-}
-/**
- * Gets the item count.
- */
-public ActivatorItem getItem(int nX) {
- return (ActivatorItem)items.get(nX);
-}
-/**
- * Gets the item count.
- */
-public int getItemCount() {
- return items.size();
-}
-/**
- * Gets the active tab.
- */
-public ActivatorItem getSelection() {
- return activeItem;
-}
-/**
- * Gets the active tab.
- */
-public int getSelectionIndex() {
- if (activeItem == null)
- return -1;
- else
- return items.indexOf(activeItem);
-}
-/**
- * A close button has been pressed. Notify any listeners.
- */
-protected void itemClosePressed(ActivatorItem item) {
- if (listener != null)
- listener.itemClosePressed(item);
-}
-/**
- * A button has been pressed. Notify any listeners.
- */
-protected void itemSelected(ActivatorItem item) {
- if (listener != null)
- listener.itemSelected(item);
-}
- //---- painting
-
- /**
- * Implements PaintListener.
- * @private
- */
- public void paintControl(PaintEvent event) {
- Display disp = getDisplay();
- GC gc= event.gc;
- Rectangle r= getClientArea();
- paintGradient(disp, gc, r);
- }
- //---- painting
- static protected void paintGradient(Display disp, GC gc, Rectangle r)
- {
- Color c1 = disp.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
- Color c2 = disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
-
- int y = 0;
- int STEPS = 20;
- int dY = r.height / STEPS + 1;
-
- // Loop through bands.
- for (int nStep = 0; nStep < STEPS; nStep ++) {
- // Calculate band color.
- int red = (c1.getRed() * (STEPS - nStep) + c2.getRed() * nStep) / STEPS;
- int green = (c1.getGreen() * (STEPS - nStep) + c2.getGreen() * nStep) / STEPS;
- int blue = (c1.getBlue() * (STEPS - nStep) + c2.getBlue() * nStep) / STEPS;
-
- // Draw the band.
- Color bandColor = new Color(disp, red, green, blue);
- Color oldColor = gc.getBackground();
- gc.setBackground(bandColor);
- gc.fillRectangle(0, y, r.width, dY);
- gc.setBackground(oldColor);
- bandColor.dispose();
-
- // Next step.
- y += dY;
- }
- }
-/**
- * Remove all items from the bar.
- */
-public void removeAllItems() {
- List safeCopy = (List)items.clone();
- Iterator enum = safeCopy.iterator();
- while (enum.hasNext()) {
- ActivatorItem item = (ActivatorItem)enum.next();
- item.dispose(); // This affects the item list.
- }
- items.clear();
- layout();
-}
-/**
- * Remove an item from o the bar.
- */
-protected void removeItem(ActivatorItem item) {
- int nIndex = items.indexOf(item);
- if (nIndex >= 0) {
- if (activeItem == item)
- activeItem = null;
- items.remove(nIndex);
- }
- layout();
-}
-/**
- * Remove a selection listener.
- */
-public void removeSelectionListener (ItemListener listener) {
- this.listener = null;
-}
-/**
- * Sets the active tab.
- */
-public void setSelection(ActivatorItem item) {
- if (activeItem == item)
- return;
- if (activeItem != null)
- activeItem.setPressed(false);
- activeItem = item;
- if (activeItem != null)
- activeItem.setPressed(true);
-}
-/**
- * Sets the active tab.
- */
-public void setSelectionIndex(int nX) {
- ActivatorItem item = (ActivatorItem)items.get(nX);
- setSelection(item);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ActivatorBarLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ActivatorBarLayout.java
deleted file mode 100644
index e0bf29e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ActivatorBarLayout.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.SWT;
-
-public class ActivatorBarLayout extends Layout {
- private int preferredWidth;
- private int lastClientWidth;
-public ActivatorBarLayout() {
-}
-/**
- * Computes the size of the client area
- **/
-protected Point computeSize (Composite composite, int wHint, int hHint, boolean flushCache) {
- Control [] children = composite.getChildren ();
- int count = children.length;
- if (count == 0)
- return new Point(5, 22);
- int width = 0, height = 22;
- for (int i=0; i<count; i++) {
- Control child = children [i];
- Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, flushCache);
- width += pt.x;
- height = Math.max(height, pt.y);
- }
- preferredWidth = width;
- return new Point(width, height);
-}
-/**
- * Lays out children of a composite in a horizontal fashion.
- * If the preferred size of these children extend beyond the
- * horizontal space available they are scaled accordingly.
- */
-protected void layout (Composite composite, boolean flushCache)
-{
- // Get the children.
- Control [] children = composite.getChildren ();
- int count = children.length;
- if (count == 0) return;
-
- // Get the basic proportions for layout.
- Rectangle client = composite.getClientArea ();
- int x = client.x;
- int y = client.y;
- int height = client.height;
-
- // Scale everything if the client area is too small.
- float scale = 1.0f;
- if (flushCache || (client.width != lastClientWidth)) {
- preferredWidth = computeSize(composite, 0, 0, true).x;
- lastClientWidth = client.width;
- }
- // System.out.println("Pref " + preferredWidth);
- // System.out.println("Avail " + client.width);
- if (preferredWidth > client.width)
- scale = (float)client.width / (float)preferredWidth;
-
- // Layout children.
- for (int i=0; i<count; i++) {
- Control child = children [i];
- Point pt = child.computeSize (SWT.DEFAULT, SWT.DEFAULT, false);
- int width = (int)((float)pt.x * scale);
- if ((scale < 1.0f) && (i == (count - 1)))
- width = client.width - x;
- child.setBounds (x, y, width, height);
- x += width;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ActivatorItem.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ActivatorItem.java
deleted file mode 100644
index cc715a6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ActivatorItem.java
+++ /dev/null
@@ -1,392 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-
-
-/**
- * A Label which supports aligned text and/or an image and different border styles.
- * If there is not enough space a SmartLabel uses the following strategy to fit the information into the
- * available space:
- * <pre>
- * - ignores the indent in left align mode
- * - ignores the image and the gap
- * - shortens the text by replacing the center portion of the label with an ellipsis
- * - shortens the text by removing the center portion of the label
- * </pre>
- */
-public class ActivatorItem extends Canvas implements PaintListener,
- MouseListener, DisposeListener
-{
-
- protected String fText;
- protected Image fImage;
- static protected Image fCloseImage;
- static protected int fInstanceCount;
- protected ActivatorBar fParent;
- protected boolean fPressed = false;
- final static int GAP = 5;
- /**
- * Create a SmartLabel with the given borderStyle as a child of parent.
- */
- public ActivatorItem(ActivatorBar parent) {
- super(parent, 0);
- addInstance();
- fParent = parent;
- addPaintListener(this);
- addMouseListener(this);
- addDisposeListener(this);
- fParent.addItem(this);
- }
-/**
- * Add an instance. Create the close image.
- */
-static private void addInstance() {
- if (fInstanceCount == 0) {
- ImageDescriptor desc = WorkbenchImages.getImageDescriptor(
- IWorkbenchGraphicConstants.IMG_LCL_CLOSE_VIEW);
- if (desc != null)
- fCloseImage = desc.createImage();
- }
- ++ fInstanceCount;
-}
- //---- layout
-
- /**
- * Compute the size.
- * @private
- */
- public Point computeSize(int wHint, int hHint, boolean changed) {
- Point e= getMinimumSize();
- if (wHint != SWT.DEFAULT)
- e.x= wHint;
- if (hHint != SWT.DEFAULT)
- e.y= hHint;
- return e;
- }
- /**
- * Dispose the control.
- */
- public void dispose() {
- super.dispose();
- fParent.removeItem(this);
- }
- //---- private stuff
-
- /**
- * Draw a rectangle in the given colors.
- * @private
- */
- private static void drawBevelRect(GC gc, int x, int y, int w, int h, Color topleft, Color bottomright) {
-
- gc.setForeground(topleft);
- gc.drawLine(x, y, x+w-1, y);
- gc.drawLine(x, y, x, y+h-1);
-
- gc.setForeground(bottomright);
- gc.drawLine(x+w, y, x+w, y+h);
- gc.drawLine(x, y+h, x+w, y+h);
- }
- /**
- * Return the SmartLabel's image or <code>null</code>.
- */
- public Image getImage() {
- return fImage;
- }
- /**
- * Compute the minimum size.
- * @private
- */
- public Point getMinimumSize() {
- Point size= new Point(0, 22);
-
- // get image extent.
- if (fImage != null) {
- Rectangle r= fImage.getBounds();
- size.x = r.width;
- }
-
- // get text extent.
- if (fText != null && fText.length() > 0) {
- GC gc= new GC(this);
- Point e= gc.textExtent(fText);
- size.x += e.x + 2 * GAP;
- gc.dispose();
- }
-
- // get close button extent.
- if (fCloseImage != null) {
- Rectangle r= fCloseImage.getBounds();
- size.x += r.width + 2;
- }
-
- return size;
- }
- //---- setters & getters
-
- /**
- * Return the SmartLabel's label text.
- */
- public String getText() {
- return fText;
- }
-/**
- * mouseDoubleClick method comment.
- */
-public void mouseDoubleClick(org.eclipse.swt.events.MouseEvent e) {}
-/**
- * mouseDown method comment.
- */
-public void mouseDown(org.eclipse.swt.events.MouseEvent e) {
- if (e.button == 1) {
- int textExtent = 100000;
- if (fPressed && (fCloseImage != null))
- textExtent = getClientArea().width - fCloseImage.getBounds().width - 4;
- if (e.x < textExtent)
- fParent.itemSelected(this);
- else
- fParent.itemClosePressed(this);
- }
-}
-/**
- * mouseUp method comment.
- */
-public void mouseUp(org.eclipse.swt.events.MouseEvent e) {}
- /**
- * Paint the Label's border.
- */
- protected void paintBorder(GC gc, Rectangle r) {
-
- Display disp= getDisplay();
-
- Color c1= null;
- Color c2= null;
-
- if (fPressed) {
- c1= disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- c2= disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
- } else {
- c1= disp.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
- c2= disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- }
-
- if (c1 != null && c2 != null) {
- gc.setLineWidth(1);
- drawBevelRect(gc, r.x, r.y, r.width-1, r.height-1, c1, c2);
- }
- }
- /**
- * Paint the Label's border.
- */
- protected void paintBorder(GC gc, Rectangle r, boolean bPressed) {
-
- Display disp= getDisplay();
-
- Color c1= null;
- Color c2= null;
-
- if (bPressed) {
- c1= disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- c2= disp.getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW);
- } else {
- c1= disp.getSystemColor(SWT.COLOR_WIDGET_LIGHT_SHADOW);
- c2= disp.getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
- }
-
- if (c1 != null && c2 != null) {
- gc.setLineWidth(1);
- drawBevelRect(gc, r.x, r.y, r.width-1, r.height-1, c1, c2);
- }
- }
- //---- painting
-
- /**
- * Implements PaintListener.
- * @private
- */
- public void paintControl(PaintEvent event) {
-
- GC gc= event.gc;
- Rectangle r= getClientArea();
-
- // Draw background.
- if (fPressed) {
- gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));
- gc.fillRectangle(r);
- } else
- ActivatorBar.paintGradient(getDisplay(), gc, r);
-
- // Draw border.
- paintBorder(gc, r);
-
- // Get image extent.
- int imageWidth = 0;
- Image image= fImage;
- Rectangle imageBounds = null;
- if (image != null) {
- imageBounds = image.getBounds();
- imageWidth = image.getBounds().width;
- }
-
- // Get text extent.
- Point textExtent = null;
- if (fText != null && fText.length() > 0)
- textExtent= gc.textExtent(fText);
-
- // Get close button extent.
- Rectangle closeBox = new Rectangle(0, 0, 0, 0);
- if (fCloseImage != null) {
- int width = fCloseImage.getBounds().width + 2;
- closeBox = new Rectangle(r.x + r.width - width, r.y,
- width, r.height);
- }
-
- // Shorten text as required.
- boolean shortenText= false;
- if (fText != null) {
- int availableWidth= r.width - 2 * GAP - imageWidth - closeBox.width;
- if (textExtent.x > availableWidth) {
- image = null;
- imageWidth = 0;
- availableWidth= r.width - 2 * GAP - imageWidth - closeBox.width;
- if (textExtent.x > availableWidth) {
- shortenText= true;
- }
- }
- }
- String t= fText;
- if (shortenText) {
- int availableWidth= r.width - 2 * GAP - imageWidth - closeBox.width;
- t= shortenText(gc, fText, availableWidth);
- textExtent.x= gc.textExtent(t).x;
- setToolTipText(fText);
- } else {
- setToolTipText(null);
- }
-
- // draw the image
- int x= r.x;
- if (image != null) {
- gc.drawImage(image, 0, 0, imageBounds.width, imageBounds.height,
- x, (r.height-imageBounds.height)/2, imageBounds.width, imageBounds.height);
- x+= imageBounds.width;
- }
-
- // draw the text
- if (t != null) {
- x+= GAP;
- gc.setForeground(getDisplay().getSystemColor(SWT.COLOR_BLACK));
- gc.drawText(t, x, r.y + (r.height - textExtent.y) / 2, true);
- }
-
- // draw the close box.
- if (fPressed && (fCloseImage != null)) {
- closeBox.x += 1;
- closeBox.width -= 2;
- closeBox.y += 1;
- closeBox.height -= 2;
- gc.setBackground(getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
- gc.fillRectangle(closeBox);
- Rectangle imgBounds = fCloseImage.getBounds();
- gc.drawImage(fCloseImage, 0, 0, imgBounds.width, imgBounds.height,
- closeBox.x + (closeBox.width-imgBounds.width) / 2,
- closeBox.y + (closeBox.height-imgBounds.height) / 2,
- imgBounds.width, imgBounds.height);
- paintBorder(gc, closeBox, false);
- }
- }
-/**
- * Remove an instance. Dispose the close image.
- */
-static private void removeInstance() {
- -- fInstanceCount;
- if (fInstanceCount <= 0) {
- if (fCloseImage != null) {
- fCloseImage.dispose();
- fCloseImage = null;
- }
- }
-}
- /**
- * Sets the widget's font to the given value and forces
- * a redraw of the widget.
- */
- public void setFont(Font font) {
- super.setFont(font);
- redraw();
- }
- /**
- * Set the SmartLabel's Image.
- * The value <code>null</code> clears it.
- */
- public void setImage(Image image) {
- if (image != fImage) {
- fImage= image;
- redraw();
- }
- }
- /**
- * Sets the control state.
- */
- public void setPressed(boolean pressed) {
- fPressed = pressed;
- redraw();
- }
- /**
- * Set the SmartLabel's label text.
- * The value <code>null</code> clears it.
- */
- public void setText(String text) {
- if (text == null)
- text= "";//$NON-NLS-1$
- if (!text.equals(fText)) {
- fText= text;
- }
- fParent.layout();
- redraw();
- }
- /**
- * 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.
- */
- protected String shortenText(GC gc, String t, int width) {
- String ellipsis= "...";//$NON-NLS-1$
- int w= gc.textExtent(ellipsis).x;
- int l= t.length();
- int pivot= l/2;
- int s= pivot;
- int e= pivot+1;
- while (s >= 0 && e < l) {
- String s1= t.substring(0, s);
- String s2= t.substring(e, l);
- int l1= gc.textExtent(s1).x;
- int l2= gc.textExtent(s2).x;
- if (l1+w+l2 < width) {
- t= s1 + ellipsis + s2;
- break;
- }
- s--;
- e++;
- }
- return t;
- }
-/**
- * widgetDisposed method comment.
- */
-public void widgetDisposed(org.eclipse.swt.events.DisposeEvent e) {
- if (fImage != null)
- fImage.dispose();
- removeInstance();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Assert.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Assert.java
deleted file mode 100644
index ec8f8a5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Assert.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * <code>Assert</code> is useful for for embedding runtime sanity checks
- * in code.
- * The predicate methods all test a condition and throw some
- * type of unchecked exception if the condition does not hold.
- * <p>
- * Assertion failure exceptions, like most runtime exceptions, are
- * thrown when something is misbehaving. Assertion failures are invariably
- * unspecified behavior; consequently, clients should never rely on
- * these being thrown (and certainly should not being catching them
- * specifically).
- * </p>
- */
-public final class Assert {
-/* This class is not intended to be instantiated. */
-private Assert() {
-}
-/** Asserts that an argument is legal. If the given boolean is
- * not <code>true</code>, an <code>IllegalArgumentException</code>
- * is thrown.
- *
- * @param expression the outcode of the check
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- * @exception IllegalArgumentException if the legality test failed
- */
-public static boolean isLegal(boolean expression) {
- return isLegal(expression, "");//$NON-NLS-1$
-}
-/** Asserts that an argument is legal. If the given boolean is
- * not <code>true</code>, an <code>IllegalArgumentException</code>
- * is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param expression the outcode of the check
- * @param message the message to include in the exception
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- * @exception IllegalArgumentException if the legality test failed
- */
-public static boolean isLegal(boolean expression, String message) {
- if (!expression)
- throw new IllegalArgumentException();
- return expression;
-}
-/** Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- *
- * @param object the value to test
- * @exception IllegalArgumentException if the object is <code>null</code>
- */
-public static void isNotNull(Object object) {
- isNotNull(object, "");//$NON-NLS-1$
-}
-/** Asserts that the given object is not <code>null</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param object the value to test
- * @param message the message to include in the exception
- * @exception IllegalArgumentException if the object is <code>null</code>
- */
-public static void isNotNull(Object object, String message) {
- if (object == null)
- throw new AssertionFailedException("null argument;" + message);//$NON-NLS-1$
-}
-/** Asserts that the given boolean is <code>true</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- *
- * @param expression the outcode of the check
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- */
-public static boolean isTrue(boolean expression) {
- return isTrue(expression, "");//$NON-NLS-1$
-}
-/** Asserts that the given boolean is <code>true</code>. If this
- * is not the case, some kind of unchecked exception is thrown.
- * The given message is included in that exception, to aid debugging.
- *
- * @param expression the outcode of the check
- * @param message the message to include in the exception
- * @return <code>true</code> if the check passes (does not return
- * if the check fails)
- */
-public static boolean isTrue(boolean expression, String message) {
- if (!expression)
- throw new AssertionFailedException("assertion failed; "+message);//$NON-NLS-1$
- return expression;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/AssertionFailedException.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/AssertionFailedException.java
deleted file mode 100644
index abda07b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/AssertionFailedException.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * <code>AssertionFailedException</code> is a runtime exception thrown
- * by some of the methods in <code>Assert</code>.
- * <p>
- * This class is not declared public to prevent some misuses; programs that catch
- * or otherwise depend on assertion failures are susceptible to unexpected
- * breakage when assertions in the code are added or removed.
- * </p>
- */
-/* package */
-class AssertionFailedException extends RuntimeException {
-/** Constructs a new exception.
- */
-public AssertionFailedException() {
-}
-/** Constructs a new exception with the given message.
- */
-public AssertionFailedException(String detail) {
- super(detail);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/CheckboxDoubleListGroup.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/CheckboxDoubleListGroup.java
deleted file mode 100644
index 079be5e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/CheckboxDoubleListGroup.java
+++ /dev/null
@@ -1,381 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List;
-
-/**
- * Workbench-level composite that combines two CheckboxListViewers.
- * All viewer selection-driven interactions are handled within this object
- */
-public class CheckboxDoubleListGroup extends Composite implements ICheckStateListener, ISelectionChangedListener {
- private Object root;
- private Object currentList1Selection;
- private Map checkedStateStore = new HashMap(9);
- private List listeners = new ArrayList();
- private boolean singleList1Check = false;
- private boolean singleList2Check = false;
-
- private IStructuredContentProvider list1ContentProvider;
- private IStructuredContentProvider list2ContentProvider;
- private ILabelProvider list1LabelProvider;
- private ILabelProvider list2LabelProvider;
-
- // widgets
- private CheckboxTableViewer list1Viewer;
- private CheckboxTableViewer list2Viewer;
-/**
- * Create an instance of this class. Use this constructor if you want
- * the combined widget to act like others w.r.t. sizing and set its
- * size according to whatever is required to fill its context.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param rootObject java.lang.Object
- * @param style int
- * @param childPropertyName java.lang.String
- * @param parentPropertyName java.lang.String
- * @param listPropertyName java.lang.String
- */
-public CheckboxDoubleListGroup(
- Composite parent,Object rootObject,
- IStructuredContentProvider list1ContentProvider,ILabelProvider list1LabelProvider,
- IStructuredContentProvider list2ContentProvider,ILabelProvider list2LabelProvider,
- int style) {
-
- this(
- parent,rootObject,
- list1ContentProvider,list1LabelProvider,
- list2ContentProvider,list2LabelProvider,
- style,-1,-1);
-}
-/**
- * Create an instance of this class. Use this constructor if you wish to specify
- * the width and/or height of the combined widget (to only hardcode one of the
- * sizing dimensions, specify the other dimension's value as -1)
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param style int
- * @param rootObject java.lang.Object
- * @param childPropertyName java.lang.String
- * @param parentPropertyName java.lang.String
- * @param listPropertyName java.lang.String
- * @param width int
- * @param height int
- */
-public CheckboxDoubleListGroup(
- Composite parent,Object rootObject,
- IStructuredContentProvider list1ContentProvider,ILabelProvider list1LabelProvider,
- IStructuredContentProvider list2ContentProvider,ILabelProvider list2LabelProvider,
- int style,int width,int height) {
-
- super(parent,style);
- root = rootObject;
- this.list1ContentProvider = list1ContentProvider;
- this.list2ContentProvider = list2ContentProvider;
- this.list1LabelProvider = list1LabelProvider;
- this.list2LabelProvider = list2LabelProvider;
- createContents(parent,width,height);
-}
-/**
- * Add the passed listener to self's collection of clients
- * that listen for changes to element checked states
- *
- * @param listener ICheckStateListener
- */
-public void addCheckStateListener(ICheckStateListener listener) {
- listeners.add(listener);
-}
-/**
- * An item was checked in one of self's two views. Determine which
- * view this occurred in and delegate appropriately
- *
- * @param event CheckStateChangedEvent
- */
-public void checkStateChanged(CheckStateChangedEvent event) {
- if (event.getCheckable().equals(list1Viewer))
- list1ItemChecked(event.getElement(),event.getChecked());
- else
- list2ItemChecked(event.getElement(),event.getChecked());
-
- notifyCheckStateChangeListeners(event);
-}
-/**
- * Compute the preferred size.
- *
- * @return org.eclipse.swt.graphics.Point
- * @param wHint int
- * @param hHint int
- * @param changed boolean
- */
-public Point computeSize(int wHint,int hHint,boolean changed) {
- return new Point(-1,-1);
-}
-/**
- * Lay out and initialize self's visual components.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param width int
- * @param height int
- */
-protected void createContents(Composite parent,int width,int height) {
- // group pane
- Composite composite = new Composite(parent,SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(
- GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- createList1Viewer(createViewPane(composite, width/2, height/2));
- createList2Viewer(createViewPane(composite, width/2, height/2));
-
- list1Viewer.setInput(root);
-}
-/**
- * Create the left viewer for this group.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- */
-protected void createList1Viewer(Composite parent) {
- list1Viewer = CheckboxTableViewer.newCheckList(parent, SWT.NONE);
- list1Viewer.setContentProvider(list1ContentProvider);
- list1Viewer.setLabelProvider(list1LabelProvider);
- list1Viewer.addCheckStateListener(this);
- list1Viewer.addSelectionChangedListener(this);
-}
-/**
- * Create the right viewer for this group.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- */
-protected void createList2Viewer(Composite parent) {
- list2Viewer = CheckboxTableViewer.newCheckList(parent, SWT.NONE);
- list2Viewer.setContentProvider(list2ContentProvider);
- list2Viewer.setLabelProvider(list2LabelProvider);
- list2Viewer.addCheckStateListener(this);
-}
-/**
- * Create a viewer pane in this group for the passed viewer.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param width int
- * @param height int
- */
-protected Composite createViewPane(Composite parent, int width, int height) {
- Composite pane = new Composite(parent, SWT.BORDER);
- GridData spec = new GridData(GridData.FILL_BOTH);
- spec.widthHint = width;
- spec.heightHint = height;
- pane.setLayoutData(spec);
- pane.setLayout(new FillLayout());
- return pane;
-}
-/**
- * Answer a collection of all of the checked elements in the list 1
- * portion of self
- *
- * @return java.util.Set
- */
-public Set getAllCheckedList1Items() {
- return checkedStateStore.keySet();
-}
-/**
- * Answer a flat collection of all of the checked elements in the
- * list 2 portion of self
- *
- * @return java.util.Vector
- */
-public List getAllCheckedList2Items() {
- List result = new ArrayList();
- Iterator listCollectionsEnum = checkedStateStore.values().iterator();
-
- while (listCollectionsEnum.hasNext()) {
- Iterator currentCollection = ((List)listCollectionsEnum.next()).iterator();
- while (currentCollection.hasNext())
- result.add(currentCollection.next());
- }
-
- return result;
-}
-/**
- * Answer the number of elements that have been checked by the
- * user.
- *
- * @return int
- */
-public int getCheckedElementCount() {
- return checkedStateStore.size();
-}
-/**
- * Set the checked state of the passed list 1 element, as well
- * as its associated list 2 elements
- */
-public void initialCheckList1Item(Object element) {
- checkedStateStore.put(element,new ArrayList());
- list1Viewer.setChecked(element,true);
-}
-/**
- * Handle the checking of a list 1 item
- */
-protected void list1ItemChecked(Object listElement,boolean state) {
-
- if (state) {
- // if only one list 1 item can be checked at a time then clear the
- // previous checked list 1 item, if any
- if (singleList1Check) {
- checkedStateStore.clear();
- list1Viewer.setAllChecked(false);
- }
-
- checkedStateStore.put(listElement,new ArrayList());
-
- } else {
- checkedStateStore.remove(listElement);
- list2Viewer.setAllChecked(false);
- }
-
- // the following may seem redundant, but it allows other methods to invoke
- // this method in order to fully simulate the user clicking a list 1 item
- list1Viewer.setChecked(listElement,state);
-}
-/**
- * Handle the checking of a list 2 item
- */
-protected void list2ItemChecked(Object listElement,boolean state) {
- List checkedListItems = (List)checkedStateStore.get(currentList1Selection);
-
- if (state) {
- // if only one list 2 item can be checked at a time then clear the
- // previous checked list 2 item, if any
- if (singleList2Check) {
- checkedListItems = null;
- list2Viewer.setAllChecked(false);
- list2Viewer.setChecked(listElement,true);
- }
-
- if (checkedListItems == null) {
- list1ItemChecked(currentList1Selection,true);
- checkedListItems = (List)checkedStateStore.get(currentList1Selection);
- }
-
- checkedListItems.add(listElement);
-
- } else {
- checkedListItems.remove(listElement);
- if (checkedListItems.isEmpty())
- list1ItemChecked(currentList1Selection,false);
- }
-}
-/**
- * Notify all checked state listeners that the passed element has had
- * its checked state changed to the passed state
- */
-protected void notifyCheckStateChangeListeners(CheckStateChangedEvent event) {
- Iterator listenersEnum = listeners.iterator();
- while (listenersEnum.hasNext())
- ((ICheckStateListener)listenersEnum.next()).checkStateChanged(event);
-}
-/**
- * Remove the passed listener from self's collection of clients
- * that listen for changes to element checked states
- *
- * @param listener ICheckStateListener
- */
-public void removeCheckStateListener(ICheckStateListener listener) {
- listeners.remove(listener);
-}
-/**
- *Handle the selection of a list 1 item
- *
- *@param selection ISelection
- */
-public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- final Object selectedElement = selection.getFirstElement();
- if (selectedElement == null) {
- currentList1Selection = null;
- list2Viewer.setInput(currentList1Selection);
- return;
- }
-
- // ie.- if not an item deselection
- if (selectedElement != currentList1Selection) {
- list2Viewer.setInput(selectedElement);
- List listItemsToCheck = (List)checkedStateStore.get(selectedElement);
- if (listItemsToCheck != null) {
- Iterator listItemsEnum = listItemsToCheck.iterator();
- while (listItemsEnum.hasNext())
- list2Viewer.setChecked(listItemsEnum.next(), true);
- }
- }
- currentList1Selection = selectedElement;
-}
-/**
- * Change the list 1 viewer's providers to those passed
- *
- * @param contentProvider ITreeContentProvider
- * @param labelProvider ILabelProvider
- */
-public void setList1Providers(IStructuredContentProvider contentProvider, ILabelProvider labelProvider) {
- list1Viewer.setContentProvider(contentProvider);
- list1Viewer.setLabelProvider(labelProvider);
-}
-/**
- * Set the sorter that is to be applied to self's list 1 viewer
- */
-public void setList1Sorter(ViewerSorter sorter) {
- list1Viewer.setSorter(sorter);
-}
-/**
- * Change the list 2 viewer's providers to those passed
- *
- * @param contentProvider ITreeContentProvider
- * @param labelProvider ILabelProvider
- */
-public void setList2Providers(IStructuredContentProvider contentProvider, ILabelProvider labelProvider) {
- list2Viewer.setContentProvider(contentProvider);
- list2Viewer.setLabelProvider(labelProvider);
-}
-/**
- * Set the sorter that is to be applied to self's list 2 viewer
- *
- * @param sorter IViewerSorter
- */
-public void setList2Sorter(ViewerSorter sorter) {
- list2Viewer.setSorter(sorter);
-}
-/**
- * Set the root element that determines the content of list viewer 1
- */
-public void setRoot(Object rootElement) {
- root = rootElement;
- checkedStateStore.clear();
- list1Viewer.setInput(rootElement);
-}
-/**
- * If this is set to true then only one list 1 item can be
- * checked at a time. The default value for this is false.
- *
- * @param value boolean
- */
-public void setSingleList1Check(boolean value) {
- singleList1Check = value;
-}
-/**
- * If this is set to true then only one list 2 item can be
- * checked at a time. The default value for this is false.
- *
- * @param value boolean
- */
-public void setSingleList2Check(boolean value) {
- singleList2Check = value;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/CheckboxTreeAndListGroup.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/CheckboxTreeAndListGroup.java
deleted file mode 100644
index 6dabd0a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/CheckboxTreeAndListGroup.java
+++ /dev/null
@@ -1,675 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List;
-
-/**
- * Workbench-level composite that combines a CheckboxTreeViewer and CheckboxListViewer.
- * All viewer selection-driven interactions are handled within this object
- */
-public class CheckboxTreeAndListGroup implements ICheckStateListener, ISelectionChangedListener, ITreeViewerListener {
- private Object root;
- private Object currentTreeSelection;
- private List expandedTreeNodes = new ArrayList();
- private Map checkedStateStore = new HashMap(9);
- private List whiteCheckedTreeItems = new ArrayList();
- private List listeners = new ArrayList();
-
- private ITreeContentProvider treeContentProvider;
- private IStructuredContentProvider listContentProvider;
- private ILabelProvider treeLabelProvider;
- private ILabelProvider listLabelProvider;
-
- // widgets
- private CheckboxTreeViewer treeViewer;
- private CheckboxTableViewer listViewer;
-/**
- * Create an instance of this class. Use this constructor if you wish to specify
- * the width and/or height of the combined widget (to only hardcode one of the
- * sizing dimensions, specify the other dimension's value as -1)
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param style int
- * @param rootObject java.lang.Object
- * @param childPropertyName java.lang.String
- * @param parentPropertyName java.lang.String
- * @param listPropertyName java.lang.String
- * @param width int
- * @param height int
- */
-public CheckboxTreeAndListGroup(
- Composite parent,Object rootObject,
- ITreeContentProvider treeContentProvider,ILabelProvider treeLabelProvider,
- IStructuredContentProvider listContentProvider,ILabelProvider listLabelProvider,
- int style,int width,int height) {
-
- root = rootObject;
- this.treeContentProvider = treeContentProvider;
- this.listContentProvider = listContentProvider;
- this.treeLabelProvider = treeLabelProvider;
- this.listLabelProvider = listLabelProvider;
- createContents(parent, width, height, style);
-}
-/**
- * This method must be called just before this window becomes visible.
- */
-public void aboutToOpen() {
- determineWhiteCheckedDescendents(root);
- checkNewTreeElements(treeContentProvider.getElements(root));
- currentTreeSelection = null;
-
- //select the first element in the list
- Object[] elements = treeContentProvider.getElements(root);
- Object primary = elements.length > 0 ? elements[0] : null;
- if (primary != null) {
- treeViewer.setSelection(new StructuredSelection(primary));
- }
- treeViewer.getControl().setFocus();
-}
-/**
- * Add the passed listener to self's collection of clients
- * that listen for changes to element checked states
- *
- * @param listener ICheckStateListener
- */
-public void addCheckStateListener(ICheckStateListener listener) {
- listeners.add(listener);
-}
-/**
- * Add the receiver and all of it's ancestors to the checkedStateStore if they
- * are not already there.
- */
-private void addToHierarchyToCheckedStore(Object treeElement) {
-
- // if this tree element is already gray then its ancestors all are as well
- if (!checkedStateStore.containsKey(treeElement))
- checkedStateStore.put(treeElement, new ArrayList());
-
- Object parent = treeContentProvider.getParent(treeElement);
- if (parent != null)
- addToHierarchyToCheckedStore(parent);
-}
-/**
- * Return a boolean indicating whether all children of the passed tree element
- * are currently white-checked
- *
- * @return boolean
- * @param treeElement java.lang.Object
- */
-protected boolean areAllChildrenWhiteChecked(Object treeElement) {
- Object[] children = treeContentProvider.getChildren(treeElement);
- for (int i = 0; i < children.length; ++i) {
- if (!whiteCheckedTreeItems.contains(children[i]))
- return false;
- }
-
- return true;
-}
-/**
- * Return a boolean indicating whether all list elements associated with
- * the passed tree element are currently checked
- *
- * @return boolean
- * @param treeElement java.lang.Object
- */
-protected boolean areAllElementsChecked(Object treeElement) {
- List checkedElements = (List)checkedStateStore.get(treeElement);
- if (checkedElements == null) // ie.- tree item not even gray-checked
- return false;
-
- return getListItemsSize(treeElement) == checkedElements.size();
-}
-/**
- * Iterate through the passed elements which are being realized for the first
- * time and check each one in the tree viewer as appropriate
- */
-protected void checkNewTreeElements(Object[] elements) {
- for (int i = 0; i < elements.length; ++i) {
- Object currentElement = elements[i];
- boolean checked = checkedStateStore.containsKey(currentElement);
- treeViewer.setChecked(currentElement,checked);
- treeViewer.setGrayed(currentElement,checked && !whiteCheckedTreeItems.contains(currentElement));
- }
-}
-/**
-* An item was checked in one of self's two views. Determine which
-* view this occurred in and delegate appropriately
-*
-* @param event CheckStateChangedEvent
-*/
-public void checkStateChanged(final CheckStateChangedEvent event) {
-
- //Potentially long operation - show a busy cursor
- BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
- public void run() {
- if (event.getCheckable().equals(treeViewer))
- treeItemChecked(event.getElement(), event.getChecked());
- else
- listItemChecked(event.getElement(), event.getChecked(), true);
-
- notifyCheckStateChangeListeners(event);
- }
- });
-}
-/**
- * Lay out and initialize self's visual components.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- * @param width int
- * @param height int
- */
-protected void createContents(Composite parent, int width, int height, int style) {
- // group pane
- Composite composite = new Composite(parent,style);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = true;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createTreeViewer(composite, width/2, height);
- createListViewer(composite, width/2, height);
-
- initialize();
-}
-/**
- * Create this group's list viewer.
- */
-protected void createListViewer(Composite parent, int width, int height) {
- listViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = width;
- data.heightHint = height;
- listViewer.getTable().setLayoutData(data);
- listViewer.setContentProvider(listContentProvider);
- listViewer.setLabelProvider(listLabelProvider);
- listViewer.addCheckStateListener(this);
-}
-/**
- * Create this group's tree viewer.
- */
-protected void createTreeViewer(Composite parent, int width, int height) {
- Tree tree = new Tree(parent, SWT.CHECK | SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = width;
- data.heightHint = height;
- tree.setLayoutData(data);
-
- treeViewer = new CheckboxTreeViewer(tree);
- treeViewer.setContentProvider(treeContentProvider);
- treeViewer.setLabelProvider(treeLabelProvider);
- treeViewer.addTreeListener(this);
- treeViewer.addCheckStateListener(this);
- treeViewer.addSelectionChangedListener(this);
-}
-/**
- * Returns a boolean indicating whether the passed tree element should be
- * at LEAST gray-checked. Note that this method does not consider whether
- * it should be white-checked, so a specified tree item which should be
- * white-checked will result in a <code>true</code> answer from this method.
- * To determine whether a tree item should be white-checked use method
- * #determineShouldBeWhiteChecked(Object).
- *
- * @param element java.lang.Object
- * @return boolean
- * @see #determineShouldBeWhiteChecked(java.lang.Object)
- */
-protected boolean determineShouldBeAtLeastGrayChecked(Object treeElement) {
- // if any list items associated with treeElement are checked then it
- // retains its gray-checked status regardless of its children
- List checked = (List)checkedStateStore.get(treeElement);
- if (checked != null && (!checked.isEmpty()))
- return true;
-
- // if any children of treeElement are still gray-checked then treeElement
- // must remain gray-checked as well
- Object[] children = treeContentProvider.getChildren(treeElement);
- for (int i = 0 ; i < children.length; ++i) {
- if (checkedStateStore.containsKey(children[i]))
- return true;
- }
-
- return false;
-}
-/**
- * Returns a boolean indicating whether the passed tree item should be
- * white-checked.
- *
- * @return boolean
- * @param treeElement java.lang.Object
- */
-protected boolean determineShouldBeWhiteChecked(Object treeElement) {
- return areAllChildrenWhiteChecked(treeElement) && areAllElementsChecked(treeElement);
-}
-/**
- * Recursively add appropriate tree elements to the collection of
- * known white-checked tree elements.
- *
- * @param treeElement java.lang.Object
- */
-protected void determineWhiteCheckedDescendents(Object treeElement) {
- // always go through all children first since their white-checked
- // statuses will be needed to determine the white-checked status for
- // this tree element
- Object[] children = treeContentProvider.getElements(treeElement);
- for (int i = 0; i < children.length; ++i)
- determineWhiteCheckedDescendents(children[i]);
-
- // now determine the white-checked status for this tree element
- if (determineShouldBeWhiteChecked(treeElement))
- setWhiteChecked(treeElement,true);
-}
-/**
- * Cause the tree viewer to expand all its items
- */
-public void expandAll() {
- treeViewer.expandAll();
-}
-/**
- * Answer a flat collection of all of the checked elements in the
- * list portion of self
- *
- * @return java.util.Vector
- */
-public Iterator getAllCheckedListItems() {
- List result = new ArrayList();
- Iterator listCollectionsEnum = checkedStateStore.values().iterator();
-
- while (listCollectionsEnum.hasNext()) {
- Iterator currentCollection = ((List)listCollectionsEnum.next()).iterator();
- while (currentCollection.hasNext())
- result.add(currentCollection.next());
- }
-
- return result.iterator();
-}
-/**
- * Answer a collection of all of the checked elements in the tree portion
- * of self
- *
- * @return java.util.Vector
- */
-public Set getAllCheckedTreeItems() {
- return checkedStateStore.keySet();
-}
-/**
- * Answer the number of elements that have been checked by the
- * user.
- *
- * @return int
- */
-public int getCheckedElementCount() {
- return checkedStateStore.size();
-}
-/**
- * Return a count of the number of list items associated with a
- * given tree item.
- *
- * @return int
- * @param treeElement java.lang.Object
- */
-protected int getListItemsSize(Object treeElement) {
- Object[] elements = listContentProvider.getElements(treeElement);
- return elements.length;
-}
-/**
- * Get the table the list viewer uses.
- * @return org.eclipse.swt.widgets.Table
- */
-public Table getListTable() {
- return this.listViewer.getTable();
-}
-/**
- * Logically gray-check all ancestors of treeItem by ensuring that they
- * appear in the checked table
- */
-protected void grayCheckHierarchy(Object treeElement) {
-
- // if this tree element is already gray then its ancestors all are as well
- if (checkedStateStore.containsKey(treeElement))
- return; // no need to proceed upwards from here
-
- checkedStateStore.put(treeElement,new ArrayList());
- if (determineShouldBeWhiteChecked(treeElement)) {
- setWhiteChecked(treeElement, true);
- }
- Object parent = treeContentProvider.getParent(treeElement);
- if (parent != null)
- grayCheckHierarchy(parent);
-}
-/**
- * Set the initial checked state of the passed list element to true.
- */
-public void initialCheckListItem(Object element) {
- Object parent = treeContentProvider.getParent(element);
- currentTreeSelection = parent;
- //As this is not done from the UI then set the box for updating from the selection to false
- listItemChecked(element, true, false);
- updateHierarchy(parent);
-}
-/**
- * Set the initial checked state of the passed element to true,
- * as well as to all of its children and associated list elements
- */
-public void initialCheckTreeItem(Object element) {
- treeItemChecked(element, true);
-}
-/**
- * Initialize this group's viewers after they have been laid out.
- */
-protected void initialize() {
- treeViewer.setInput(root);
-}
-/**
- * Callback that's invoked when the checked status of an item in the list
- * is changed by the user. Do not try and update the hierarchy if we are building the
- * initial list.
- */
-protected void listItemChecked(
- Object listElement,
- boolean state,
- boolean updatingFromSelection) {
- List checkedListItems = (List) checkedStateStore.get(currentTreeSelection);
-
- if (state) {
- if (checkedListItems == null) {
- // since the associated tree item has gone from 0 -> 1 checked
- // list items, tree checking may need to be updated
- grayCheckHierarchy(currentTreeSelection);
- checkedListItems = (List) checkedStateStore.get(currentTreeSelection);
- }
- checkedListItems.add(listElement);
- } else {
- checkedListItems.remove(listElement);
- if (checkedListItems.isEmpty()) {
- // since the associated tree item has gone from 1 -> 0 checked
- // list items, tree checking may need to be updated
- ungrayCheckHierarchy(currentTreeSelection);
- }
- }
-
- if (updatingFromSelection)
- updateHierarchy(currentTreeSelection);
-}
-/**
- * Notify all checked state listeners that the passed element has had
- * its checked state changed to the passed state
- */
-protected void notifyCheckStateChangeListeners(CheckStateChangedEvent event) {
- Iterator listenersEnum = listeners.iterator();
- while (listenersEnum.hasNext())
- ((ICheckStateListener)listenersEnum.next()).checkStateChanged(event);
-}
-/**
- *Set the contents of the list viewer based upon the specified selected
- *tree element. This also includes checking the appropriate list items.
- *
- *@param treeElement java.lang.Object
- */
-protected void populateListViewer(final Object treeElement) {
- listViewer.setInput(treeElement);
- List listItemsToCheck = (List) checkedStateStore.get(treeElement);
-
- if (listItemsToCheck != null) {
- Iterator listItemsEnum = listItemsToCheck.iterator();
- while (listItemsEnum.hasNext())
- listViewer.setChecked(listItemsEnum.next(), true);
- }
-}
-/**
- * Remove the passed listener from self's collection of clients
- * that listen for changes to element checked states
- *
- * @param listener ICheckStateListener
- */
-public void removeCheckStateListener(ICheckStateListener listener) {
- listeners.remove(listener);
-}
-/**
- * Handle the selection of an item in the tree viewer
- *
- * @param selection ISelection
- */
-public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- Object selectedElement = selection.getFirstElement();
- if (selectedElement == null) {
- currentTreeSelection = null;
- listViewer.setInput(currentTreeSelection);
- return;
- }
-
- // ie.- if not an item deselection
- if (selectedElement != currentTreeSelection)
- populateListViewer(selectedElement);
-
- currentTreeSelection = selectedElement;
-}
-/**
- * Select or deselect all of the elements in the tree depending on the value of the selection
- * boolean. Be sure to update the displayed files as well.
- */
-public void setAllSelections(final boolean selection) {
-
- //Potentially long operation - show a busy cursor
- BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
- public void run() {
- setTreeChecked(root, selection);
- listViewer.setAllChecked(selection);
- }
- });
-}
-/**
- * Set the list viewer's providers to those passed
- *
- * @param contentProvider ITreeContentProvider
- * @param labelProvider ILabelProvider
- */
-public void setListProviders(IStructuredContentProvider contentProvider, ILabelProvider labelProvider) {
- listViewer.setContentProvider(contentProvider);
- listViewer.setLabelProvider(labelProvider);
-}
-/**
- * Set the sorter that is to be applied to self's list viewer
- */
-public void setListSorter(ViewerSorter sorter) {
- listViewer.setSorter(sorter);
-}
-/**
- * Set the root of the widget to be new Root. Regenerate all of the tables and lists from this
- * value.
- * @param newRoot
- */
-public void setRoot(Object newRoot) {
- this.root = newRoot;
- initialize();
-}
-/**
- * Set the checked state of the passed tree element appropriately, and
- * do so recursively to all of its child tree elements as well
- */
-protected void setTreeChecked(Object treeElement,boolean state) {
-
- if (treeElement.equals(currentTreeSelection)) {
- listViewer.setAllChecked(state);
- }
-
- if (state) {
- Object[] listItems = listContentProvider.getElements(treeElement);
- List listItemsChecked = new ArrayList();
- for (int i = 0; i < listItems.length; ++i)
- listItemsChecked.add(listItems[i]);
-
- checkedStateStore.put(treeElement,listItemsChecked);
- } else
- checkedStateStore.remove(treeElement);
-
- setWhiteChecked(treeElement,state);
- treeViewer.setChecked(treeElement,state);
- treeViewer.setGrayed(treeElement,false);
-
- // now logically check/uncheck all children as well
- Object[] children = treeContentProvider.getChildren(treeElement);
- for (int i = 0; i < children.length; ++i) {
- setTreeChecked(children[i],state);
- }
-}
-/**
- * Set the tree viewer's providers to those passed
- *
- * @param contentProvider ITreeContentProvider
- * @param labelProvider ILabelProvider
- */
-public void setTreeProviders(ITreeContentProvider contentProvider, ILabelProvider labelProvider) {
- treeViewer.setContentProvider(contentProvider);
- treeViewer.setLabelProvider(labelProvider);
-}
-/**
- * Set the sorter that is to be applied to self's tree viewer
- */
-public void setTreeSorter(ViewerSorter sorter) {
- treeViewer.setSorter(sorter);
-}
-/**
- * Adjust the collection of references to white-checked tree elements appropriately.
- *
- * @param treeElement java.lang.Object
- * @param isWhiteChecked boolean
- */
-protected void setWhiteChecked(Object treeElement, boolean isWhiteChecked) {
- if (isWhiteChecked) {
- if (!whiteCheckedTreeItems.contains(treeElement))
- whiteCheckedTreeItems.add(treeElement);
- } else
- whiteCheckedTreeItems.remove(treeElement);
-}
-/**
- * Handle the collapsing of an element in a tree viewer
- */
-public void treeCollapsed(TreeExpansionEvent event) {
- // We don't need to do anything with this
-}
-/**
- * Handle the expansionsion of an element in a tree viewer
- */
-public void treeExpanded(TreeExpansionEvent event) {
-
- Object item = event.getElement();
-
- // First see if the children need to be given their checked state at all. If they've
- // already been realized then this won't be necessary
- if (!expandedTreeNodes.contains(item)) {
- expandedTreeNodes.add(item);
- checkNewTreeElements(treeContentProvider.getChildren(item));
- }
-}
-/**
- * Callback that's invoked when the checked status of an item in the tree
- * is changed by the user.
- */
-protected void treeItemChecked(Object treeElement,boolean state) {
-
- // recursively adjust all child tree elements appropriately
- setTreeChecked(treeElement,state);
-
- Object parent = treeContentProvider.getParent(treeElement);
- if (parent == null)
- return;
-
- // now update upwards in the tree hierarchy
- if (state)
- grayCheckHierarchy(parent);
- else
- ungrayCheckHierarchy(parent);
-
- updateHierarchy(treeElement);
-}
-/**
- * Logically un-gray-check all ancestors of treeItem iff appropriate.
- */
-protected void ungrayCheckHierarchy(Object treeElement) {
- if (!determineShouldBeAtLeastGrayChecked(treeElement))
- checkedStateStore.remove(treeElement);
-
- Object parent = treeContentProvider.getParent(treeElement);
- if (parent != null)
- ungrayCheckHierarchy(parent);
-}
-/**
- * Set the checked state of self and all ancestors appropriately
- */
-protected void updateHierarchy(Object treeElement) {
-
- boolean whiteChecked = determineShouldBeWhiteChecked(treeElement);
- boolean shouldBeAtLeastGray = determineShouldBeAtLeastGrayChecked(treeElement);
-
- treeViewer.setChecked(treeElement, shouldBeAtLeastGray);
- setWhiteChecked(treeElement, whiteChecked);
- if (!whiteChecked)
- treeViewer.setGrayed(treeElement, shouldBeAtLeastGray);
-
- // proceed up the tree element hierarchy
- Object parent = treeContentProvider.getParent(treeElement);
- if (parent != null) {
- updateHierarchy(parent);
- }
-}
-/**
- * Update the selections of the tree elements in items to reflect the new
- * selections provided.
- * @param Map with keys of Object (the tree element) and values of List (the selected
- * list elements).
- */
-public void updateSelections(final Map items) {
-
- //Potentially long operation - show a busy cursor
- BusyIndicator.showWhile(treeViewer.getControl().getDisplay(), new Runnable() {
- public void run() {
- Iterator keyIterator = items.keySet().iterator();
-
- //Update the store before the hierarchy to prevent updating parents before all of the children are done
- while (keyIterator.hasNext()) {
- Object key = keyIterator.next();
- //Replace the items in the checked state store with those from the supplied items
- List selections = (List) items.get(key);
- if (selections.size() == 0)
- //If it is empty remove it from the list
- checkedStateStore.remove(key);
- else {
- checkedStateStore.put(key, selections);
- // proceed up the tree element hierarchy
- Object parent = treeContentProvider.getParent(key);
- if (parent != null) {
- addToHierarchyToCheckedStore(parent);
- }
- }
- }
-
- //Now update hierarchies
- keyIterator = items.keySet().iterator();
-
- while (keyIterator.hasNext()) {
- Object key = keyIterator.next();
- updateHierarchy(key);
- if (currentTreeSelection != null && currentTreeSelection.equals(key)) {
- listViewer.setAllChecked(false);
- listViewer.setCheckedElements(((List) items.get(key)).toArray());
- }
- }
- }
- });
-
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ContainerContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ContainerContentProvider.java
deleted file mode 100644
index a39483d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ContainerContentProvider.java
+++ /dev/null
@@ -1,105 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.*;
-import java.util.*;
-/**
- * Provides content for a tree viewer that shows only containers.
- */
-public class ContainerContentProvider implements ITreeContentProvider {
- private Viewer viewer;
- private boolean showClosedProjects = true;
-/**
- * Creates a new ResourceContentProvider.
- */
-public ContainerContentProvider() {
-}
-/**
- * The visual part that is using this content provider is about
- * to be disposed. Deallocate all allocated SWT resources.
- */
-public void dispose() {}
-/**
- * @see ITreeContentProvider#getChildren
- */
-public Object[] getChildren(Object element) {
- if (element instanceof IWorkspace) {
- // check if closed projects should be shown
- IProject[] allProjects = ((IWorkspace) element).getRoot().getProjects();
- if (showClosedProjects)
- return allProjects;
-
- ArrayList accessibleProjects = new ArrayList();
- for (int i = 0; i < allProjects.length; i++){
- if (allProjects[i].isOpen()){
- accessibleProjects.add(allProjects[i]);
- }
- }
- return accessibleProjects.toArray();
- } else if (element instanceof IContainer) {
- IContainer container = (IContainer)element;
- if (container.isAccessible()) {
- try {
- List children = new ArrayList();
- IResource[] members = container.members();
- for (int i = 0; i < members.length; i++) {
- if (members[i].getType() != IResource.FILE) {
- children.add(members[i]);
- }
- }
- return children.toArray();
- } catch (CoreException e) {
- // this should never happen because we call #isAccessible before invoking #members
- }
- }
- }
- return new Object[0];
-}
-/**
- * @see ITreeContentProvider#getElements
- */
-public Object[] getElements(Object element) {
- return getChildren(element);
-}
-/**
- * @see ITreeContentProvider#getParent
- */
-public Object getParent(Object element) {
- if (element instanceof IResource)
- return ((IResource) element).getParent();
- return null;
-}
-/**
- * @see ITreeContentProvider#hasChildren
- */
-public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
-}
-/**
- * @see IContentProvider#inputChanged
- */
-public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- this.viewer = viewer;
-}
-/**
- * @see IContentProvider#isDeleted
- */
-public boolean isDeleted(Object element) {
- return ((element instanceof IResource) && !((IResource) element).exists());
-}
-/**
- * Specify whether or not to show closed projects in the tree
- * viewer. Default is to show closed projects.
- *
- * @param show boolean if false, do not show closed projects in the tree
- */
-public void showClosedProjects(boolean show){
- showClosedProjects = show;
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ContainerSelectionGroup.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ContainerSelectionGroup.java
deleted file mode 100644
index 2421101..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ContainerSelectionGroup.java
+++ /dev/null
@@ -1,243 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.*;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List;
-
-/**
- * Workbench-level composite for choosing a container.
- */
-public class ContainerSelectionGroup extends Composite {
- // The listener to notify of events
- private Listener listener;
-
- // Enable user to type in new container name
- private boolean allowNewContainerName = true;
-
- // show all projects by default
- private boolean showClosedProjects = true;
-
- // Last selection made by user
- private IContainer selectedContainer;
-
- // handle on parts
- private Text containerNameField;
- private TreeViewer treeViewer;
-
- // the message to display at the top of this dialog
- private static final String DEFAULT_MSG_NEW_ALLOWED = WorkbenchMessages.getString("ContainerGroup.message"); //$NON-NLS-1$
- private static final String DEFAULT_MSG_SELECT_ONLY = WorkbenchMessages.getString("ContainerGroup.selectFolder"); //$NON-NLS-1$
-
- // sizing constants
- private static final int SIZING_SELECTION_PANE_WIDTH = 320;
- private static final int SIZING_SELECTION_PANE_HEIGHT = 300;
-/**
- * Creates a new instance of the widget.
- *
- * @param parent The parent widget of the group.
- * @param listener A listener to forward events to. Can be null if
- * no listener is required.
- * @param allowNewContainerName Enable the user to type in a new container
- * name instead of just selecting from the existing ones.
- */
-public ContainerSelectionGroup (Composite parent, Listener listener, boolean allowNewContainerName) {
- this(parent, listener, allowNewContainerName, null);
-}
-/**
- * Creates a new instance of the widget.
- *
- * @param parent The parent widget of the group.
- * @param listener A listener to forward events to. Can be null if
- * no listener is required.
- * @param allowNewContainerName Enable the user to type in a new container
- * name instead of just selecting from the existing ones.
- * @param message The text to present to the user.
- */
-public ContainerSelectionGroup (Composite parent, Listener listener, boolean allowNewContainerName, String message) {
- this(parent, listener, allowNewContainerName, message, true);
-}
-/**
- * Creates a new instance of the widget.
- *
- * @param parent The parent widget of the group.
- * @param listener A listener to forward events to. Can be null if
- * no listener is required.
- * @param allowNewContainerName Enable the user to type in a new container
- * name instead of just selecting from the existing ones.
- * @param message The text to present to the user.
- * @param showClosedProjects Whether or not to show closed projects.
- */
-public ContainerSelectionGroup (Composite parent, Listener listener, boolean allowNewContainerName, String message, boolean showClosedProjects) {
- super (parent, SWT.NONE);
- this.listener = listener;
- this.allowNewContainerName = allowNewContainerName;
- this.showClosedProjects = showClosedProjects;
- this.setFont(parent.getFont());
- if (message != null)
- createContents(message);
- else if (allowNewContainerName)
- createContents(DEFAULT_MSG_NEW_ALLOWED);
- else
- createContents(DEFAULT_MSG_SELECT_ONLY);
-}
-/**
- * The container selection has changed in the
- * tree view. Update the container name field
- * value and notify all listeners.
- */
-public void containerSelectionChanged(IContainer container) {
- selectedContainer = container;
-
- if (allowNewContainerName) {
- if (container == null)
- containerNameField.setText("");//$NON-NLS-1$
- else
- containerNameField.setText(container.getFullPath().makeRelative().toString());
- }
-
- // fire an event so the parent can update its controls
- if (listener != null) {
- Event changeEvent = new Event();
- changeEvent.type = SWT.Selection;
- changeEvent.widget = this;
- listener.handleEvent(changeEvent);
- }
-}
-/**
- * Creates the contents of the composite.
- */
-public void createContents(String message) {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- setLayout(layout);
- setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label label = new Label(this,SWT.WRAP);
- label.setText(message);
- label.setFont(this.getFont());
-
- if (allowNewContainerName) {
- containerNameField = new Text(this, SWT.SINGLE | SWT.BORDER);
- containerNameField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- containerNameField.addListener(SWT.Modify, listener);
- containerNameField.setFont(this.getFont());
- }
- else {
- // filler...
- new Label(this, SWT.NONE);
- }
-
- createTreeViewer();
-}
-/**
- * Returns a new drill down viewer for this dialog.
- *
- * @return a new drill down viewer
- */
-protected void createTreeViewer() {
- // Create drill down.
- DrillDownComposite drillDown = new DrillDownComposite(this, SWT.BORDER);
- GridData spec = new GridData(
- GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL |
- GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
- spec.widthHint = SIZING_SELECTION_PANE_WIDTH;
- spec.heightHint = SIZING_SELECTION_PANE_HEIGHT;
- drillDown.setLayoutData(spec);
- drillDown.setFont(this.getFont());
-
- // Create tree viewer inside drill down.
- treeViewer = new TreeViewer(drillDown, SWT.NONE);
- drillDown.setChildTree(treeViewer);
- ContainerContentProvider cp = new ContainerContentProvider();
- cp.showClosedProjects(showClosedProjects);
- treeViewer.setContentProvider(cp);
- treeViewer.setLabelProvider(new WorkbenchLabelProvider());
- treeViewer.setSorter(new ViewerSorter() {});
- treeViewer.addSelectionChangedListener(
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection)event.getSelection();
- containerSelectionChanged((IContainer) selection.getFirstElement()); // allow null
- }
- });
- treeViewer.addDoubleClickListener(
- new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
- Object item = ((IStructuredSelection)selection).getFirstElement();
- if (treeViewer.getExpandedState(item))
- treeViewer.collapseToLevel(item, 1);
- else
- treeViewer.expandToLevel(item, 1);
- }
- }
- });
-
- // This has to be done after the viewer has been laid out
- treeViewer.setInput(ResourcesPlugin.getWorkspace());
- treeViewer.getTree().setFont(this.getFont());
-}
-/**
- * Returns the currently entered container name.
- * Null if the field is empty. Note that the
- * container may not exist yet if the user
- * entered a new container name in the field.
- */
-public IPath getContainerFullPath() {
- if (allowNewContainerName) {
- String pathName = containerNameField.getText();
- if (pathName == null || pathName.length() < 1)
- return null;
- else
- //The user may not have made this absolute so do it for them
- return (new Path(pathName)).makeAbsolute();
- } else {
- if (selectedContainer == null)
- return null;
- else
- return selectedContainer.getFullPath();
- }
-}
-/**
- * Gives focus to one of the widgets in the group, as determined by the group.
- */
-public void setInitialFocus() {
- if (allowNewContainerName)
- containerNameField.setFocus();
- else
- treeViewer.getTree().setFocus();
-}
-/**
- * Sets the selected existing container.
- */
-public void setSelectedContainer(IContainer container) {
- selectedContainer = container;
-
- //expand to and select the specified container
- List itemsToExpand = new ArrayList();
- IContainer parent = container.getParent();
- while (parent != null) {
- itemsToExpand.add(0,parent);
- parent = parent.getParent();
- }
- treeViewer.setExpandedElements(itemsToExpand.toArray());
- treeViewer.setSelection(new StructuredSelection(container),true);
-}
-}
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
deleted file mode 100644
index 285426f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalEditor.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.internal.plugins.*;
-import org.eclipse.ui.internal.registry.EditorDescriptor;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.*;
-import org.eclipse.swt.program.Program;
-import java.net.*;
-import java.io.*;
-
-public class ExternalEditor {
- private IFile file;
- private EditorDescriptor descriptor;
-/**
- * Create an external editor.
- */
-public ExternalEditor(IFile newFile, EditorDescriptor editorDescriptor) {
- this.file = newFile;
- 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 {
-
- Program program = this.descriptor.getProgram();
- if (program == null)
- openWithUserDefinedProgram();
- else {
- String path = file.getLocation().toOSString();
- if (!program.execute(path))
- throw new CoreException(new Status(
- Status.ERROR,
- WorkbenchPlugin.PI_WORKBENCH,
- 0,
- WorkbenchMessages.format("ExternalEditor.errorMessage", new Object[] {path}), //$NON-NLS-1$
- 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.
-
- 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) {
- // Get editor's plugin directory.
- URL installURL = configurationElement.getDeclaringExtension().getDeclaringPluginDescriptor().getInstallURL();
- try {
- // See if the program file is in the plugin directory
- URL commandURL = new URL(installURL, descriptor.getFileName());
- URL localName = Platform.asLocalURL(commandURL); // this will bring the file local if the plugin is on a server
- 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
- }
- }
-
- if (programFileName == null)
- // Program file is not in the plugin directory therefore
- // assume it is on the path
- programFileName = descriptor.getFileName();
-
- // Get the full path of the file to open
- String path = file.getLocation().toOSString();
-
- // 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
-
- int nRetCode = 0;
- Exception ex = null;
- try {
- Process p = Runtime.getRuntime().exec(new String[]{programFileName, path});
- } catch (Exception e) {
- throw new CoreException(new Status(
- Status.ERROR,
- WorkbenchPlugin.PI_WORKBENCH,
- 0,
- WorkbenchMessages.format("ExternalEditor.errorMessage", new Object[] {path}), //$NON-NLS-1$
- 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
deleted file mode 100644
index a0a27c1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ExternalProgramImageDescriptor.java
+++ /dev/null
@@ -1,80 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.program.Program;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.*;
-
-/**
- * The external program image descriptor is the descriptor used to
- * handle images that are from a Program.
- */
-public class ExternalProgramImageDescriptor extends org.eclipse.jface.resource.ImageDescriptor {
-
- 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;
-}
-/**
- * @see Object#equals
- */
-public boolean equals(Object 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)
- return other.program.equals(program);
- else {
- 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 ImageData getImageData() {
- ImageData data = null;
- ImageData defaultImage = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE).getImageData();
- if(defaultImage == null)
- return 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)
- return defaultImage;
-
- return data;
-}
-/**
- * @see Object#hashCode
- */
-public int hashCode() {
- String programName = program.getName();
- if(programName == null)
- return program.hashCode();
- else
- return programName.hashCode();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ItemListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ItemListener.java
deleted file mode 100644
index 05e2d24..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ItemListener.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * Defines the events fired by an <code>ActivatorItem</code>.
- */
-public interface ItemListener {
-/**
- * Notifies the receiver that the close box has been pressed for an item.
- */
-public void itemClosePressed(ActivatorItem item);
-/**
- * Notifies the receiver that an item has been selected.
- */
-public void itemSelected(ActivatorItem item);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/OverlayComposite.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/OverlayComposite.java
deleted file mode 100644
index fd8eff4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/OverlayComposite.java
+++ /dev/null
@@ -1,169 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.*;
-import org.eclipse.swt.graphics.*;
-import java.util.*;
-/**
- * Instances represent images that are composed by overlaying one or more
- * stand-alone images directly on top of each other.
- */
-public class OverlayComposite extends CompositeImageDescriptor {
- private ImageData backgroundImage;
- private ImageData leftImage;
- private ImageData rightImage;
- private ImageData topImage;
- private ImageData bottomImage;
-
- private List foregroundImages = new ArrayList();
-/**
- * Create an instance of this class.
- */
-public OverlayComposite(ImageData background) {
- backgroundImage = background;
-}
-/**
- * Add the passed image to this descriptor's collection of images to
- * be composed together to create an image.
- */
-public void addForegroundImage(ImageData image) {
- foregroundImages.add(image);
-}
-/**
- *Superimpose self's images within the given bounds by means of #drawImage
- *
- *@see CompositeImage#drawImage(ImageData src,int ox,int oy)
- */
-protected void drawCompositeImage(int width, int height) {
- //draw background
- drawImage(backgroundImage, getLeftBound(), getTopBound());
-
- //draw foreground images
- Iterator e = foregroundImages.iterator();
- while (e.hasNext())
- drawImage(((ImageData) e.next()), getLeftBound(), getTopBound());
-
- //draw extensions
- if (topImage != null)
- drawImage(topImage, getLeftBound(), 0);
- if (bottomImage != null)
- drawImage(bottomImage, getLeftBound(), height - bottomImage.height);
- if (leftImage != null)
- drawImage(leftImage, 0, getTopBound());
- if (rightImage != null)
- drawImage(rightImage, width - rightImage.width, getTopBound());
-
-}
-/**
- * @see Object#equals
- */
-public boolean equals(Object o) {
- if (!(o instanceof OverlayComposite)) {
- return false;
- }
- OverlayComposite other = (OverlayComposite) o;
-
- return equals(backgroundImage, other.backgroundImage)
- && equals(leftImage, other.leftImage)
- && equals(rightImage, other.rightImage)
- && equals(topImage, other.topImage)
- && equals(bottomImage, other.bottomImage)
- && equals(foregroundImages, other.foregroundImages);
-}
-/**
- * Private utility for comparing two possibly-null objects.
- */
-private boolean equals(Object o1, Object o2) {
- return o1 == null ? o2 == null : o1.equals(o2);
-}
-/**
- * Answer the left-most coordinate that the main image can draw to
- *
- * @return int
- */
-protected int getLeftBound() {
- if (leftImage == null)
- return 0;
-
- return leftImage.width;
-}
-/**
- * Answer self's size, as determined by the size of the initially-
- * provided base-level image
- */
-protected Point getSize() {
- //start with basic size
- Point size = new Point(backgroundImage.width,backgroundImage.height);
-
- //overlays may increase size.
- if (topImage != null)
- size.y += topImage.height;
-
- if (bottomImage != null)
- size.y += bottomImage.height;
-
- if (leftImage != null)
- size.x += leftImage.width;
-
- if (rightImage != null)
- size.x += rightImage.width;
-
- return size;
-}
-/**
- * Answer the top-most coordinate that the main image can draw to
- *
- * @return int
- */
-protected int getTopBound() {
- if (topImage == null)
- return 0;
-
- return topImage.height;
-}
-/**
- * @see Object#hashCode
- */
-public int hashCode() {
- return hashCode(backgroundImage)
- + hashCode(leftImage)
- + hashCode(rightImage)
- + hashCode(topImage)
- + hashCode(bottomImage)
- + hashCode(foregroundImages);
-}
-/**
- * Private utility for getting the hashCode for an
- * object that may be null.
- */
-private int hashCode(Object o) {
- return o == null ? 0 : o.hashCode();
-}
-/**
- * Set the image to be drawn below the primary overlay region.
- */
-public void setBottomExtension(ImageData value) {
- bottomImage = value;
-}
-/**
- * Set the image to be drawn to the left of the primary overlay region.
- */
-public void setLeftExtension(ImageData value) {
- leftImage = value;
-}
-/**
- * Set the image to be drawn to the right of the primary overlay region.
- */
-public void setRightExtension(ImageData value) {
- rightImage = value;
-}
-/**
- * Set the image to be drawn above the primary overlay region.
- */
-public void setTopExtension(ImageData value) {
- topImage = value;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/OverlayIcon.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/OverlayIcon.java
deleted file mode 100644
index 380b766..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/OverlayIcon.java
+++ /dev/null
@@ -1,112 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.graphics.ImageData;
-import org.eclipse.swt.graphics.Point;
-
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * An OverlayIcon consists of a main icon and several adornments.
- */
-public class OverlayIcon extends CompositeImageDescriptor {
-
- static final int DEFAULT_WIDTH= 22;
- static final int DEFAULT_HEIGHT= 16;
-
- private Point fSize= null;
-
- private ImageDescriptor fBase;
- private ImageDescriptor fOverlays[][];
-
- public OverlayIcon(ImageDescriptor base, ImageDescriptor[][] overlays, Point size) {
- fBase= base;
- fOverlays= overlays;
- fSize= size;
- }
- protected void drawBottomLeft(ImageDescriptor[] overlays) {
- if (overlays == null)
- return;
- int length= overlays.length;
- int x= 0;
- for (int i= 0; i < 3; i++) {
- if (i < length && overlays[i] != null) {
- ImageData id= overlays[i].getImageData();
- drawImage(id, x, getSize().y-id.height);
- x+= id.width;
- }
- }
- }
- protected void drawBottomRight(ImageDescriptor[] overlays) {
- if (overlays == null)
- return;
- int length= overlays.length;
- int x= getSize().x;
- for (int i= 2; i >= 0; i--) {
- if (i < length && overlays[i] != null) {
- ImageData id= overlays[i].getImageData();
- x-= id.width;
- drawImage(id, x, getSize().y-id.height);
- }
- }
- }
- /**
- * @see CompositeImage#fill
- */
- protected void drawCompositeImage(int width, int height) {
- ImageData bg;
- if (fBase == null || (bg= fBase.getImageData()) == null)
- bg= DEFAULT_IMAGE_DATA;
- drawImage(bg, 0, 0);
-
- if (fOverlays != null) {
- if (fOverlays.length > 0)
- drawTopRight( fOverlays[0]);
-
- if (fOverlays.length > 1)
- drawBottomRight(fOverlays[1]);
-
- if (fOverlays.length > 2)
- drawBottomLeft(fOverlays[2]);
-
- if (fOverlays.length > 3)
- drawTopLeft(fOverlays[3]);
- }
- }
- protected void drawTopLeft(ImageDescriptor[] overlays) {
- if (overlays == null)
- return;
- int length= overlays.length;
- int x= 0;
- for (int i= 0; i < 3; i++) {
- if (i < length && overlays[i] != null) {
- ImageData id= overlays[i].getImageData();
- drawImage(id, x, 0);
- x+= id.width;
- }
- }
- }
- protected void drawTopRight(ImageDescriptor[] overlays) {
- if (overlays == null)
- return;
- int length= overlays.length;
- int x= getSize().x;
- for (int i= 2; i >= 0; i--) {
- if (i < length && overlays[i] != null) {
- ImageData id= overlays[i].getImageData();
- x-= id.width;
- drawImage(id, x, 0);
- }
- }
- }
- /**
- * @see CompositeImage#getSize
- */
- protected Point getSize() {
- return fSize;
- }
-}
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
deleted file mode 100644
index 38b5cb1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ProgramImageDescriptor.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.*;
-
-/**
- * An image descriptor that loads its data from a program file.
- */
-public class ProgramImageDescriptor extends ImageDescriptor {
- private String filename;
- 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;
-}
-/**
- * @see Object#equals
- */
-public boolean equals(Object o) {
- 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.
- */
-public ImageData getImageData() {
- /*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();
-}
-/**
- * @see Object#hashCode
- */
-public int hashCode() {
- return filename.hashCode() + offset;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ProjectCapabilitySelectionGroup.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ProjectCapabilitySelectionGroup.java
deleted file mode 100644
index f194dfd..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ProjectCapabilitySelectionGroup.java
+++ /dev/null
@@ -1,749 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.Map;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.registry.Capability;
-import org.eclipse.ui.internal.registry.CapabilityRegistry;
-import org.eclipse.ui.internal.registry.ICategory;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.model.WorkbenchViewerSorter;
-
-/**
- * A group of controls used to view and modify the
- * set of capabilities on a project.
- */
-public class ProjectCapabilitySelectionGroup {
- private static final String EMPTY_DESCRIPTION = "\n\n\n"; //$NON-NLS-1$
-
- private CapabilityRegistry registry;
- private ICategory[] initialCategories;
- private Capability[] initialCapabilities;
- private Capability[] disabledCapabilities;
- private boolean modified = false;
- private Text descriptionText;
- private CheckboxTableViewer checkboxViewer;
- private ICheckStateListener checkStateListener;
- private ArrayList visibleCapabilities = new ArrayList();
- private ArrayList checkedCapabilities = new ArrayList();
- private Collection disabledCaps;
-
- // For a given capability as key, the value will be a list of
- // other capabilities that require the capability. Also,
- // it may include the capability key if it was selected by the
- // user before being required by other capabilities.
- private HashMap dependents = new HashMap();
-
- // For a given membership set id as key, the value is
- // a checked capability
- private HashMap memberships = new HashMap();
-
- // Sort categories
- private Comparator categoryComparator = new Comparator() {
- private Collator collator = Collator.getInstance();
-
- public int compare(Object ob1, Object ob2) {
- ICategory c1 = (ICategory) ob1;
- ICategory c2 = (ICategory) ob2;
- return collator.compare(c1.getLabel(), c2.getLabel());
- }
- };
-
- // Sort capabilities
- private Comparator capabilityComparator = new Comparator() {
- private Collator collator = Collator.getInstance();
-
- public int compare(Object ob1, Object ob2) {
- Capability c1 = (Capability) ob1;
- Capability c2 = (Capability) ob2;
- return collator.compare(c1.getName(), c2.getName());
- }
- };
-
- /**
- * Creates a new instance of the <code>ProjectCapabilitySelectionGroup</code>
- *
- * @param categories the initial collection of valid categories to select
- * @param capabilities the intial collection of valid capabilities to select
- * @param registry all available capabilities registered by plug-ins
- */
- public ProjectCapabilitySelectionGroup(ICategory[] categories, Capability[] capabilities, CapabilityRegistry registry) {
- this(categories, capabilities, null, registry);
- }
-
- /**
- * Creates a new instance of the <code>ProjectCapabilitySelectionGroup</code>
- *
- * @param categories the initial collection of valid categories to select
- * @param capabilities the intial collection of valid capabilities to select
- * @param disabledCapabilities the collection of capabilities to show as disabled
- * @param registry all available capabilities registered by plug-ins
- */
- public ProjectCapabilitySelectionGroup(ICategory[] categories, Capability[] capabilities, Capability[] disabledCapabilities, CapabilityRegistry registry) {
- super();
- this.initialCategories = categories;
- this.initialCapabilities = capabilities;
- this.disabledCapabilities = disabledCapabilities;
- this.registry = registry;
- }
-
- /**
- * Create the contents of this group. The basic layout is a checkbox
- * list with a text field at the bottom to display the capability
- * description.
- */
- public Control createContents(Composite parent) {
- // Create the main composite for the other controls
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- layout.makeColumnsEqualWidth = true;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // Composite for category label and list...
- Composite catComposite = new Composite(composite, SWT.NONE);
- catComposite.setLayout(new GridLayout());
- catComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // Add a label to identify the list viewer of categories
- Label categoryLabel = new Label(catComposite, SWT.LEFT);
- categoryLabel.setText(WorkbenchMessages.getString("ProjectCapabilitySelectionGroup.categories")); //$NON-NLS-1$
- GridData data = new GridData();
- data.verticalAlignment = SWT.TOP;
- categoryLabel.setLayoutData(data);
-
- // List viewer of all available categories
- ListViewer listViewer = new ListViewer(catComposite);
- listViewer.getList().setLayoutData(new GridData(GridData.FILL_BOTH));
- listViewer.setLabelProvider(new WorkbenchLabelProvider());
- listViewer.setContentProvider(getContentProvider());
- listViewer.setInput(getAvailableCategories());
-
- // Composite for capability label and table...
- Composite capComposite = new Composite(composite, SWT.NONE);
- capComposite.setLayout(new GridLayout());
- capComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // Add a label to identify the checkbox tree viewer of capabilities
- Label capabilityLabel = new Label(capComposite, SWT.LEFT);
- capabilityLabel.setText(WorkbenchMessages.getString("ProjectCapabilitySelectionGroup.capabilities")); //$NON-NLS-1$
- data = new GridData();
- data.verticalAlignment = SWT.TOP;
- capabilityLabel.setLayoutData(data);
-
- // Checkbox tree viewer of capabilities in selected categories
- checkboxViewer = CheckboxTableViewer.newCheckList(capComposite, SWT.SINGLE | SWT.TOP | SWT.BORDER);
- checkboxViewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH));
- checkboxViewer.setLabelProvider(new CapabilityLabelProvider());
- checkboxViewer.setContentProvider(getContentProvider());
- checkboxViewer.setInput(visibleCapabilities);
-
- // Add a label to identify the text field of capability's description
- Label descLabel = new Label(composite, SWT.LEFT);
- descLabel.setText(WorkbenchMessages.getString("ProjectCapabilitySelectionGroup.description")); //$NON-NLS-1$
- data = new GridData();
- data.verticalAlignment = SWT.TOP;
- data.horizontalSpan = 2;
- descLabel.setLayoutData(data);
-
- // Text field to display the capability's description
- descriptionText = new Text(composite, SWT.WRAP | SWT.MULTI | SWT.V_SCROLL | SWT.BORDER);
- descriptionText.setText(EMPTY_DESCRIPTION);
- descriptionText.setEditable(false);
- data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.horizontalSpan = 2;
- descriptionText.setLayoutData(data);
-
- // Add a text field to explain grayed out items
- Label grayLabel = new Label(composite, SWT.LEFT);
- grayLabel.setText(WorkbenchMessages.getString("ProjectCapabilitySelectionGroup.grayItems")); //$NON-NLS-1$
- data = new GridData();
- data.verticalAlignment = SWT.TOP;
- data.horizontalSpan = 2;
- grayLabel.setLayoutData(data);
-
- // Setup initial context
- populateDependents();
- populateMemberships();
-
- // Listen for selection changes to update the description field
- checkboxViewer.addSelectionChangedListener(new ISelectionChangedListener () {
- public void selectionChanged(SelectionChangedEvent event) {
- updateDescription(event.getSelection());
- }
- });
-
- // Properly handle user checking and unchecking project features
- checkboxViewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- Capability cap = (Capability)event.getElement();
- if (event.getChecked())
- handleCapabilityChecked(cap);
- else
- handleCapabilityUnchecked(cap);
- checkboxViewer.setSelection(new StructuredSelection(cap));
- }
- });
-
- // Listen for category selection and update the list of capabilities
- listViewer.addSelectionChangedListener(new ISelectionChangedListener () {
- public void selectionChanged(SelectionChangedEvent event) {
- if (event.getSelection() instanceof IStructuredSelection) {
- IStructuredSelection sel = (IStructuredSelection)event.getSelection();
- visibleCapabilities.clear();
- Iterator enum = sel.iterator();
- while (enum.hasNext()) {
- ICategory cat = (ICategory)enum.next();
- visibleCapabilities.addAll(cat.getElements());
- }
- Collections.sort(visibleCapabilities, capabilityComparator);
- checkboxViewer.refresh();
- enum = visibleCapabilities.iterator();
- while (enum.hasNext()) {
- Capability cap = (Capability)enum.next();
- if (hasDependency(cap))
- checkboxViewer.setGrayed(cap, true);
- if (checkedCapabilities.contains(cap))
- checkboxViewer.setChecked(cap, true);
- }
- updateDescription(checkboxViewer.getSelection());
- }
- }
- });
-
- // initialize
- if (initialCapabilities != null)
- checkedCapabilities.addAll(Arrays.asList(initialCapabilities));
- if (initialCategories != null)
- listViewer.setSelection(new StructuredSelection(initialCategories));
-
- return composite;
- }
-
- /**
- * Marks the capability as being checked.
- */
- private void markCapabilityChecked(Capability target, Capability dependent) {
- // Check the target capability
- if (!checkedCapabilities.contains(target))
- checkedCapabilities.add(target);
- checkboxViewer.setChecked(target, true);
-
- // Gray the target to show the user its required
- // by another capability.
- if (target != dependent)
- checkboxViewer.setGrayed(target, true);
-
- // Update the dependent map for the target capability
- addDependency(target, dependent);
-
- // Update the membership set for the target capability
- String[] ids = registry.getMembershipSetIds(target);
- for (int j = 0; j < ids.length; j++)
- memberships.put(ids[j], target);
- }
-
- /**
- * Marks the capability as being unchecked.
- */
- private void markCapabilityUnchecked(Capability target) {
- // Uncheck the target capability
- checkedCapabilities.remove(target);
- checkboxViewer.setChecked(target, false);
-
- // Ungray the target as there is no dependency on it
- checkboxViewer.setGrayed(target, false);
-
- // Remove the dependency entry
- dependents.remove(target);
-
- // Update the membership set for the target capability
- String[] ids = registry.getMembershipSetIds(target);
- for (int j = 0; j < ids.length; j++) {
- if (memberships.get(ids[j]) == target)
- memberships.remove(ids[j]);
- }
- }
-
- /**
- * Returns the list of categories that have capabilities
- * registered against it.
- */
- private ArrayList getAvailableCategories() {
- ArrayList results = registry.getUsedCategories();
- Collections.sort(results, categoryComparator);
- if (registry.getMiscCategory() != null)
- results.add(registry.getMiscCategory());
- return results;
- }
-
- /**
- * Return <code>true</code> if the user may have made changes
- * to the capabilities of the project. Otherwise <code>false</code>
- * if no changes were made.
- *
- * @return <code>true</true> when possible changes may have been made,
- * <code>false</code> otherwise
- */
- public boolean getCapabilitiesModified() {
- return modified;
- }
-
- /**
- * Returns the content provider for the viewers
- */
- private IContentProvider getContentProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof ArrayList)
- return ((ArrayList)parentElement).toArray();
- else
- return null;
- }
- };
- }
-
- /**
- * The user has changed the project capability selection.
- * Set the modified flag and clear the caches.
- */
- private void capabilitiesModified() {
- modified = true;
- }
-
- /**
- * Add a dependency between the target and dependent
- * capabilities
- */
- private void addDependency(Capability target, Capability dependent) {
- ArrayList descriptors = (ArrayList) dependents.get(target);
- if (descriptors == null) {
- descriptors = new ArrayList();
- descriptors.add(dependent);
- dependents.put(target, descriptors);
- }
- else if (!descriptors.contains(dependent)) {
- descriptors.add(dependent);
- }
- }
-
- /**
- * Returns true if the capability has any
- * dependencies on it.
- */
- private boolean hasDependency(Capability capability) {
- ArrayList descriptors = (ArrayList) dependents.get(capability);
- if (descriptors == null)
- return false;
- if (descriptors.size() == 1 && descriptors.get(0) == capability)
- return false;
- return true;
- }
-
- /**
- * Returns whether the category is considered disabled
- */
- private boolean isDisabledCapability(Capability cap) {
- if (disabledCaps == null) {
- if (disabledCapabilities == null)
- disabledCaps = new ArrayList(0);
- else
- disabledCaps = Arrays.asList(disabledCapabilities);
- }
- return disabledCaps.contains(cap);
- }
-
- /**
- * Populate the dependents map based on the
- * current set of capabilities.
- */
- private void populateDependents() {
- if (initialCapabilities == null)
- return;
-
- LinkedList capabilities = new LinkedList();
- capabilities.addAll(Arrays.asList(initialCapabilities));
-
- while (!capabilities.isEmpty()) {
- // Retrieve the target capability
- Capability target;
- target = (Capability) capabilities.removeFirst();
- // Add the capability as a dependent of itself.
- // It will indicate to the uncheck handler to not uncheck this
- // capability automatically even if a another capability which
- // depended on it is unchecked.
- addDependency(target, target);
-
- if (registry.hasPrerequisites(target)) {
- // Retrieve the prerequisite capabilities...
- String[] prereqIds = registry.getPrerequisiteIds(target);
- Capability[] prereqCapabilities;
- prereqCapabilities = registry.findCapabilities(prereqIds);
- // For each prerequisite capability...
- for (int i = 0; i < prereqCapabilities.length; i++) {
- // Update the dependent map for the prerequisite capability
- addDependency(prereqCapabilities[i], target);
- // Recursive if prerequisite capability also has prerequisites
- if (registry.hasPrerequisites(prereqCapabilities[i]))
- capabilities.addLast(prereqCapabilities[i]);
- }
- }
- }
- }
-
- /**
- * Populate the memberships map based on the
- * current set of capabilities.
- */
- private void populateMemberships() {
- if (initialCapabilities == null)
- return;
-
- Iterator enum = (Arrays.asList(initialCapabilities)).iterator();
- while (enum.hasNext()) {
- Capability cap = (Capability)enum.next();
- String[] ids = registry.getMembershipSetIds(cap);
- for (int j = 0; j < ids.length; j++) {
- memberships.put(ids[j], cap);
- }
- }
- }
-
- /**
- * Handle the case of a capability being checked
- * by ensuring the action is allowed and the prerequisite
- * capabilities are also checked.
- */
- private void handleCapabilityChecked(Capability capability) {
- // Cannot allow a disabled capability to be checked
- if (isDisabledCapability(capability)) {
- MessageDialog.openWarning(
- checkboxViewer.getControl().getShell(),
- WorkbenchMessages.getString("ProjectCapabilitySelectionGroup.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("ProjectCapabilitySelectionGroup.disabledCapability", new Object[] {capability.getName()})); //$NON-NLS-1$
- checkboxViewer.setChecked(capability, false);
- return;
- }
-
- // Cannot allow an invalid capability to be checked
- if (!capability.isValid()) {
- MessageDialog.openWarning(
- checkboxViewer.getControl().getShell(),
- WorkbenchMessages.getString("ProjectCapabilitySelectionGroup.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("ProjectCapabilitySelectionGroup.invalidCapability", new Object[] {capability.getName()})); //$NON-NLS-1$
- checkboxViewer.setChecked(capability, false);
- return;
- }
-
- // Is there a membership set problem...
- String[] ids = registry.getMembershipSetIds(capability);
- for (int i = 0; i < ids.length; i++) {
- Capability member = (Capability)memberships.get(ids[i]);
- if (member != null && member != capability) {
- MessageDialog.openWarning(
- checkboxViewer.getControl().getShell(),
- WorkbenchMessages.getString("ProjectCapabilitySelectionGroup.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("ProjectCapabilitySelectionGroup.membershipConflict", new Object[] {capability.getName(), member.getName()})); //$NON-NLS-1$
- checkboxViewer.setChecked(capability, false);
- return;
- }
- }
-
- // Handle prerequisite by auto-checking them if possible
- if (registry.hasPrerequisites(capability)) {
- // Check for any prerequisite problems...
- // Retrieve all the prerequisite capabilities, including
- // any prerequisite of the prerequisites!
- LinkedList capabilities = new LinkedList();
- capabilities.addLast(capability);
- while (!capabilities.isEmpty()) {
- Capability target;
- target = (Capability) capabilities.removeFirst();
- // Retrieve the capability's immediate prerequisites
- String[] prereqIds = registry.getPrerequisiteIds(target);
- Capability[] prereqCapabilities;
- prereqCapabilities = registry.findCapabilities(prereqIds);
- for (int i = 0; i < prereqCapabilities.length; i++) {
- // If the prerequisite is missing, warn the user and
- // do not allow the check to proceed.
- if (prereqCapabilities[i] == null || isDisabledCapability(prereqCapabilities[i]) || !prereqCapabilities[i].isValid()) {
- MessageDialog.openWarning(
- checkboxViewer.getControl().getShell(),
- WorkbenchMessages.getString("ProjectCapabilitySelectionGroup.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("ProjectCapabilitySelectionGroup.missingPrereqs", new Object[] {capability.getName(), prereqIds[i]})); //$NON-NLS-1$
- checkboxViewer.setChecked(capability, false);
- return;
- }
- // If there is a membership problem, warn the user and
- // do not allow the check to proceed
- ids = registry.getMembershipSetIds(prereqCapabilities[i]);
- for (int j = 0; j < ids.length; j++) {
- Capability member = (Capability)memberships.get(ids[j]);
- if (member != null && member != prereqCapabilities[i]) {
- MessageDialog.openWarning(
- checkboxViewer.getControl().getShell(),
- WorkbenchMessages.getString("ProjectCapabilitySelectionGroup.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("ProjectCapabilitySelectionGroup.membershipPrereqConflict", new Object[] {capability.getName(), prereqCapabilities[i].getName(), member.getName()})); //$NON-NLS-1$
- checkboxViewer.setChecked(capability, false);
- return;
- }
- }
- // If the prerequisite capability has prerequisites
- // also, then add it to be processed.
- if (registry.hasPrerequisites(prereqCapabilities[i]))
- capabilities.addLast(prereqCapabilities[i]);
- }
- }
-
- // Auto-check all prerequisite capabilities
- capabilities = new LinkedList();
- capabilities.addLast(capability);
- // For each capability that has prerequisites...
- while (!capabilities.isEmpty()) {
- Capability target;
- target = (Capability) capabilities.removeFirst();
- // Retrieve the prerequisite capabilities...
- String[] prereqIds = registry.getPrerequisiteIds(target);
- Capability[] prereqCapabilities;
- prereqCapabilities = registry.findCapabilities(prereqIds);
- // For each prerequisite capability...
- for (int i = 0; i < prereqCapabilities.length; i++) {
- // Mark it as being checked
- markCapabilityChecked(prereqCapabilities[i], target);
- // Recursive if prerequisite capability also has prerequisites
- if (registry.hasPrerequisites(prereqCapabilities[i]))
- capabilities.addLast(prereqCapabilities[i]);
- }
- }
- }
-
- // Mark the capability as checked. Adds itself as a
- // dependent - this will indicate to the uncheck handler
- // to not uncheck this capability automatically even if
- // another capability which depends on it is unchecked.
- markCapabilityChecked(capability, capability);
-
- // Notify those interested
- capabilitiesModified();
- notifyCheckStateListner();
- }
-
- /**
- * Handle the case of a capability being unchecked
- * by ensuring the action is allowed.
- */
- private void handleCapabilityUnchecked(Capability capability) {
- ArrayList descriptors = (ArrayList) dependents.get(capability);
-
- // Note, there is no need to handle the case where descriptors size
- // is zero because it cannot happen. For this method to be called, the
- // item must have been checked previously. If it was checked by the user,
- // then the item itself would be a dependent. If the item was checked
- // because it was required by another capability, then that other capability
- // would be a dependent.
-
- if (descriptors.size() == 1 && descriptors.get(0) == capability) {
- // If the only dependent is itself, then its ok to uncheck
- capabilitiesModified();
- markCapabilityUnchecked(capability);
-
- // Remove this capability as a dependent on its prerequisite
- // capabilities. Recursive if a prerequisite capability
- // no longer has any dependents.
- if (registry.hasPrerequisites(capability)) {
- LinkedList capabilities = new LinkedList();
- capabilities.addLast(capability);
- // For each capability that has prerequisite capabilities
- while (!capabilities.isEmpty()) {
- Capability target;
- target = (Capability) capabilities.removeFirst();
- // Retrieve the prerequisite capabilities...
- String[] prereqIds = registry.getPrerequisiteIds(target);
- Capability[] prereqCapabilities;
- prereqCapabilities = registry.findCapabilities(prereqIds);
- // For each prerequisite capability...
- for (int i = 0; i < prereqCapabilities.length; i++) {
- // Retrieve the list of dependents on the prerequisite capability...
- Capability prereqCap = prereqCapabilities[i];
- ArrayList prereqDependents = (ArrayList) dependents.get(prereqCap);
- // Remove the dependent target capability...
- prereqDependents.remove(target);
- if (prereqDependents.isEmpty()) {
- // Unchecked the prerequisite capability
- markCapabilityUnchecked(prereqCap);
- // Recursive if prerequisite capability also has
- // prerequisite capabilities
- if (registry.hasPrerequisites(prereqCap))
- capabilities.addLast(prereqCap);
- }
- else if (prereqDependents.size() == 1 && prereqDependents.get(0) == prereqCap) {
- // Only dependent is itself so ungray the item to let the
- // user know no other capability is dependent on it
- checkboxViewer.setGrayed(prereqCap, false);
- }
- }
- }
- }
-
- // Notify those interested
- notifyCheckStateListner();
- }
- else {
- // At least one other capability depends on it being checked
- // so force it to remain checked and warn the user.
- checkboxViewer.setChecked(capability, true);
- // Get a copy and remove the target capability
- ArrayList descCopy = (ArrayList) descriptors.clone();
- descCopy.remove(capability);
- // Show the prereq problem to the user
- if (descCopy.size() == 1) {
- Capability cap = (Capability) descCopy.get(0);
- MessageDialog.openWarning(
- checkboxViewer.getControl().getShell(),
- WorkbenchMessages.getString("ProjectCapabilitySelectionGroup.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("ProjectCapabilitySelectionGroup.requiredPrereq", new Object[] {capability.getName(), cap.getName()})); //$NON-NLS-1$
- } else {
- StringBuffer msg = new StringBuffer();
- Iterator enum = descCopy.iterator();
- while (enum.hasNext()) {
- Capability cap = (Capability) enum.next();
- msg.append("\n "); //$NON-NLS-1$
- msg.append(cap.getName());
- }
- MessageDialog.openWarning(
- checkboxViewer.getControl().getShell(),
- WorkbenchMessages.getString("ProjectCapabilitySelectionGroup.errorTitle"), //$NON-NLS-1$
- WorkbenchMessages.format("ProjectCapabilitySelectionGroup.requiredPrereqs", new Object[] {capability.getName(), msg.toString()})); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * Returns the collection of capabilities selected
- * by the user. The collection is not in prerequisite
- * order.
- *
- * @return array of selected capabilities
- */
- public Capability[] getSelectedCapabilities() {
- Capability[] capabilities = new Capability[checkedCapabilities.size()];
- checkedCapabilities.toArray(capabilities);
- return capabilities;
- }
-
- /**
- * Return the current listener interested when the check
- * state of a capability actually changes.
- *
- * @return Returns a ICheckStateListener
- */
- public ICheckStateListener getCheckStateListener() {
- return checkStateListener;
- }
-
- /**
- * Set the current listener interested when the check
- * state of a capability actually changes.
- *
- * @param checkStateListener The checkStateListener to set
- */
- public void setCheckStateListener(ICheckStateListener checkStateListener) {
- this.checkStateListener = checkStateListener;
- }
-
- /**
- * Notify the check state listener that a capability
- * check state has changed. The event past will
- * always be <code>null</code> as it could be
- * triggered by code instead of user input.
- */
- private void notifyCheckStateListner() {
- if (checkStateListener != null)
- checkStateListener.checkStateChanged(null);
- }
-
- /**
- * Updates the description field for the selected capability
- */
- private void updateDescription(ISelection selection) {
- String text = EMPTY_DESCRIPTION;
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection sel = (IStructuredSelection)selection;
- Capability cap = (Capability)sel.getFirstElement();
- if (cap != null)
- text = cap.getDescription();
- }
- descriptionText.setText(text);
- }
-
- class CapabilityLabelProvider extends LabelProvider {
- private Map imageTable;
-
- public void dispose() {
- if (imageTable != null) {
- Iterator enum = imageTable.values().iterator();
- while (enum.hasNext())
- ((Image) enum.next()).dispose();
- imageTable = null;
- }
- }
-
- public Image getImage(Object element) {
- ImageDescriptor descriptor = ((Capability) element).getIconDescriptor();
- if (descriptor == null)
- return null;
-
- //obtain the cached image corresponding to the descriptor
- if (imageTable == null) {
- imageTable = new Hashtable(40);
- }
- Image image = (Image) imageTable.get(descriptor);
- if (image == null) {
- image = descriptor.createImage();
- imageTable.put(descriptor, image);
- }
- return image;
- }
-
- public String getText(Object element) {
- Capability cap = (Capability) element;
- String text = cap.getName();
- if (isDisabledCapability(cap))
- text = WorkbenchMessages.format("ProjectCapabilitySelectionGroup.disabledLabel", new Object[] {text}); //$NON-NLS-1$
- return text;
- }
- }
-}
-
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ResourceAndContainerGroup.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ResourceAndContainerGroup.java
deleted file mode 100644
index 3c84e7a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/ResourceAndContainerGroup.java
+++ /dev/null
@@ -1,333 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/**
- * Copyright (c) 2000, 2002 IBM Corp. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * Randy Giffen: Added initial file selection
- * Eduardo Pereira: Fix for 1GIT1G6
- * Karice McIntyre: Fix for 1GF68LO and pruint support
- * Leon J. Breedt: Added multiple folder creation support
- * Tod Creasey: Integration of patches and fonts
- */
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.internal.WorkbenchMessages;
-
-/**
- * Workbench-level composite for resource and container specification by the user.
- * Services such as field validation are performed by the group.
- * The group can be configured to accept existing resources, or only
- * new resources.
- */
-public class ResourceAndContainerGroup implements Listener {
- // problem identifiers
- public static final int PROBLEM_NONE = 0;
- public static final int PROBLEM_RESOURCE_EMPTY = 1;
- public static final int PROBLEM_RESOURCE_EXIST = 2;
- public static final int PROBLEM_RESOURCE_CONTAINS_SEPARATOR = 3;
- public static final int PROBLEM_PATH_INVALID = 4;
- public static final int PROBLEM_CONTAINER_EMPTY = 5;
- public static final int PROBLEM_PROJECT_DOES_NOT_EXIST = 6;
- public static final int PROBLEM_NAME_INVALID = 7;
-
- // the client to notify of changes
- private Listener client;
-
- // whether to allow existing resources
- private boolean allowExistingResources = false;
-
- // resource type (file, folder, project)
- private String resourceType = WorkbenchMessages.getString("ResourceGroup.resource"); //$NON-NLS-1$
-
- // show closed projects in the tree, by default
- private boolean showClosedProjects = true;
-
- // problem indicator
- private String problemMessage = "";//$NON-NLS-1$
- private int problemType = PROBLEM_NONE;
-
- // widgets
- private ContainerSelectionGroup containerGroup;
- private Button browseButton;
- private Text resourceNameField;
-
- // constants
- private static final int SIZING_TEXT_FIELD_WIDTH = 250;
-/**
- * Create an instance of the group to allow the user
- * to enter/select a container and specify a resource
- * name.
- *
- * @param parent composite widget to parent the group
- * @param client object interested in changes to the group's fields value
- * @param resourceFieldLabel label to use in front of the resource name field
- * @param resourceType one word, in lowercase, to describe the resource to the user (file, folder, project)
- */
-public ResourceAndContainerGroup(Composite parent, Listener client, String resourceFieldLabel, String resourceType) {
- this(parent, client, resourceFieldLabel, resourceType, true);
-}
-/**
- * Create an instance of the group to allow the user
- * to enter/select a container and specify a resource
- * name.
- *
- * @param parent composite widget to parent the group
- * @param client object interested in changes to the group's fields value
- * @param resourceFieldLabel label to use in front of the resource name field
- * @param resourceType one word, in lowercase, to describe the resource to the user (file, folder, project)
- * @param showClosedProjects whether or not to show closed projects
- */
-public ResourceAndContainerGroup(Composite parent, Listener client, String resourceFieldLabel, String resourceType, boolean showClosedProjects) {
- super();
- this.resourceType = resourceType;
- this.showClosedProjects = showClosedProjects;
- createContents(parent,resourceFieldLabel);
- this.client = client;
-}
-/**
- * Returns a boolean indicating whether all controls in this group
- * contain valid values.
- *
- * @return boolean
- */
-public boolean areAllValuesValid() {
- return problemType == PROBLEM_NONE;
-}
-/**
- * Creates this object's visual components.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- */
-protected void createContents(Composite parent,String resourceLabelString) {
-
- Font font = parent.getFont();
- // server name group
- 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.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
- composite.setFont(font);
-
- // container group
- containerGroup = new ContainerSelectionGroup(composite, this, true, null,showClosedProjects);
-
- // resource name group
- Composite nameGroup = new Composite(composite,SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- layout.marginWidth = 0;
- nameGroup.setLayout(layout);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- nameGroup.setLayoutData(data);
- nameGroup.setFont(font);
-
- Label label = new Label(nameGroup,SWT.NONE);
- label.setText(resourceLabelString);
- label.setFont(font);
-
- // resource name entry field
- resourceNameField = new Text(nameGroup,SWT.BORDER);
- resourceNameField.addListener(SWT.Modify,this);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- resourceNameField.setLayoutData(data);
- resourceNameField.setFont(font);
-
- validateControls();
-}
-/**
- * Returns the path of the currently selected container
- * or null if no container has been selected. Note that
- * the container may not exist yet if the user entered
- * a new container name in the field.
- */
-public IPath getContainerFullPath() {
- return containerGroup.getContainerFullPath();
-}
-/**
- * Returns an error message indicating the current problem with the value
- * of a control in the group, or an empty message if all controls in the
- * group contain valid values.
- *
- * @return java.lang.String
- */
-public String getProblemMessage() {
- return problemMessage;
-}
-/**
- * Returns the type of problem with the value of a control
- * in the group.
- *
- * @return one of the PROBLEM_* constants
- */
-public int getProblemType() {
- return problemType;
-}
-/**
- * Returns a string that is the path of the currently selected
- * container. Returns an empty string if no container has been
- * selected.
- */
-public String getResource() {
- return resourceNameField.getText();
-}
-/**
- * Handles events for all controls in the group.
- *
- * @param e org.eclipse.swt.widgets.Event
- */
-public void handleEvent(Event e) {
- validateControls();
- if (client != null) {
- client.handleEvent(e);
- }
-}
-/**
- * Sets the flag indicating whether existing resources are permitted.
- */
-public void setAllowExistingResources(boolean value) {
- allowExistingResources = value;
-}
-/**
- * Sets the value of this page's container.
- *
- * @param value Full path to the container.
- */
-public void setContainerFullPath(IPath path) {
- IResource initial =
- ResourcesPlugin.getWorkspace().getRoot().findMember(path);
- if (initial != null) {
- if (!(initial instanceof IContainer)) {
- initial = initial.getParent();
- }
- containerGroup.setSelectedContainer((IContainer) initial);
- }
- validateControls();
-}
-/**
- * Gives focus to the resource name field and selects its contents
- */
-public void setFocus() {
- //select the whole resource name.
- resourceNameField.setSelection(0, resourceNameField.getText().length());
- resourceNameField.setFocus();
-}
-/**
- * Sets the value of this page's resource name.
- *
- * @param value new value
- */
-public void setResource(String value) {
- resourceNameField.setText(value);
- validateControls();
-}
-/**
- * Returns a <code>boolean</code> indicating whether a container name represents
- * a valid container resource in the workbench. An error message is stored for
- * future reference if the name does not represent a valid container.
- *
- * @return <code>boolean</code> indicating validity of the container name
- */
-protected boolean validateContainer() {
- IPath path = containerGroup.getContainerFullPath();
- if (path == null) {
- problemType = PROBLEM_CONTAINER_EMPTY;
- problemMessage = WorkbenchMessages.getString("ResourceGroup.folderEmpty"); //$NON-NLS-1$
- return false;
- }
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- String projectName = path.segment(0);
- if (projectName == null || !workspace.getRoot().getProject(projectName).exists()) {
- problemType = PROBLEM_PROJECT_DOES_NOT_EXIST;
- problemMessage = WorkbenchMessages.getString("ResourceGroup.noProject"); //$NON-NLS-1$
- return false;
- }
- return true;
-}
-/**
- * Validates the values for each of the group's controls. If an invalid
- * value is found then a descriptive error message is stored for later
- * reference. Returns a boolean indicating the validity of all of the
- * controls in the group.
- */
-protected boolean validateControls() {
- // don't attempt to validate controls until they have been created
- if (containerGroup == null) {
- return false;
- }
- problemType = PROBLEM_NONE;
- problemMessage = "";//$NON-NLS-1$
-
- if (!validateContainer() || !validateResourceName())
- return false;
-
- IPath path = containerGroup.getContainerFullPath().append(resourceNameField.getText());
- return validateFullResourcePath(path);
-}
-/**
- * Returns a <code>boolean</code> indicating whether the specified resource
- * path represents a valid new resource in the workbench. An error message
- * is stored for future reference if the path does not represent a valid
- * new resource path.
- *
- * @param containerName the container name to validate
- * @return <code>boolean</code> indicating validity of the resource path
- */
-protected boolean validateFullResourcePath(IPath resourcePath) {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
-
- IStatus result = workspace.validatePath(resourcePath.toString(),IResource.FOLDER);
- if (!result.isOK()) {
- problemType = PROBLEM_PATH_INVALID;
- problemMessage = result.getMessage();
- return false;
- }
-
- if (!allowExistingResources && (workspace.getRoot().getFolder(resourcePath).exists() || workspace.getRoot().getFile(resourcePath).exists())) {
- problemType = PROBLEM_RESOURCE_EXIST;
- problemMessage = WorkbenchMessages.getString("ResourceGroup.nameExists"); //$NON-NLS-1$
- return false;
- }
- return true;
-}
-/**
- * Returns a <code>boolean</code> indicating whether the resource name rep-
- * resents a valid resource name in the workbench. An error message is stored
- * for future reference if the name does not represent a valid resource name.
- *
- * @return <code>boolean</code> indicating validity of the resource name
- */
-protected boolean validateResourceName() {
- String resourceName = resourceNameField.getText();
-
- if (resourceName.equals("")) {//$NON-NLS-1$
- problemType = PROBLEM_RESOURCE_EMPTY;
- problemMessage = WorkbenchMessages.format("ResourceGroup.emptyName", new Object[] {resourceType}); //$NON-NLS-1$
- return false;
- }
-
- if(!(new Path("")).isValidSegment(resourceName)){
- problemType = PROBLEM_NAME_INVALID;
- problemMessage = WorkbenchMessages.format("ResourceGroup.invalidFilename", new String[] {resourceName});
- return false;
- }
-
- return true;
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Sorter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Sorter.java
deleted file mode 100644
index b23e5e3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Sorter.java
+++ /dev/null
@@ -1,66 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * The SortOperation takes a collection of objects and returns
- * a sorted collection of these objects. Concrete instances of this
- * class provide the criteria for the sorting of the objects based on
- * the type of the objects.
- */
-public abstract class Sorter {
-/**
- * Returns true if elementTwo is 'greater than' elementOne
- * This is the 'ordering' method of the sort operation.
- * Each subclass overides this method with the particular
- * implementation of the 'greater than' concept for the
- * objects being sorted.
- */
-public abstract boolean compare(Object elementOne, Object elementTwo);
-/**
- * Sort the objects in sorted collection and return that collection.
- */
-private Object[] quickSort(Object[] sortedCollection, int left, int right) {
- int originalLeft = left;
- int originalRight = right;
- Object mid = sortedCollection[ (left + right) / 2];
-
- do {
- while (compare(sortedCollection[left], mid))
- left++;
- while (compare(mid, sortedCollection[right]))
- right--;
- if (left <= right) {
- Object tmp = sortedCollection[left];
- sortedCollection[left] = sortedCollection[right];
- sortedCollection[right] = tmp;
- left++;
- right--;
- }
- } while (left <= right);
-
- if (originalLeft < right)
- sortedCollection = quickSort(sortedCollection, originalLeft, right);
- if (left < originalRight)
- sortedCollection = quickSort(sortedCollection, left, originalRight);
-
- return sortedCollection;
-}
-/**
- * Return a new sorted collection from this unsorted collection.
- * Sort using quick sort.
- */
-public Object[] sort(Object[] unSortedCollection) {
- int size = unSortedCollection.length;
- Object[] sortedCollection = new Object[size];
-
- //copy the array so can return a new sorted collection
- System.arraycopy(unSortedCollection, 0, sortedCollection, 0, size);
- if (size > 1)
- quickSort(sortedCollection, 0, size - 1);
-
- return sortedCollection;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StatusUtil.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StatusUtil.java
deleted file mode 100644
index f18059c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StatusUtil.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import java.util.*;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * Utility class to create status objects.
- *
- * @private - This class is an internal implementation class and should
- * not be referenced or subclassed outside of the workbench
- *
- * <p>
- * [Issue: Implementation contains illegal references to
- * org.eclipse.core.internal.resources.ResourceStatus,
- * ]
- * </p>
- */
-public class StatusUtil {
-/**
- * Answer a flat collection of the passed status and its recursive children
- */
-protected static List flatten(IStatus aStatus) {
- List result = new ArrayList();
-
- if (aStatus.isMultiStatus()) {
- IStatus[] children = aStatus.getChildren();
- for (int i = 0; i < children.length; i++){
- IStatus currentChild = children[i];
- if (currentChild.isMultiStatus()) {
- Iterator childStatiiEnum = flatten(currentChild).iterator();
- while (childStatiiEnum.hasNext())
- result.add(childStatiiEnum.next());
- } else
- result.add(currentChild);
- }
- } else
- result.add(aStatus);
-
- return result;
-}
-/**
- * This method must not be called outside the workbench.
- *
- * Utility method for creating status.
- */
-protected static IStatus newStatus(
- IStatus[] stati,
- String message,
- Throwable exception) {
-
- Assert.isTrue(message != null);
- Assert.isTrue(message.trim().length() != 0);
-
- return new MultiStatus(WorkbenchPlugin.PI_WORKBENCH, IStatus.ERROR,
- stati, message, exception);
-}
-/**
- * This method must not be called outside the workbench.
- *
- * Utility method for creating status.
- */
-public static IStatus newStatus(
- int severity,
- String message,
- Throwable exception) {
-
- Assert.isTrue(message != null);
- Assert.isTrue(message.trim().length() != 0);
-
- return new Status(severity, WorkbenchPlugin.PI_WORKBENCH, severity, message, exception);
-}
-/**
- * This method must not be called outside the workbench.
- *
- * Utility method for creating status.
- */
-public static IStatus newStatus(
- List children,
- String message,
- Throwable exception) {
-
- List flatStatusCollection = new ArrayList();
- Iterator iter = children.iterator();
- while (iter.hasNext()) {
- IStatus currentStatus = (IStatus)iter.next();
- Iterator childrenIter = flatten(currentStatus).iterator();
- while (childrenIter.hasNext())
- flatStatusCollection.add(childrenIter.next());
- }
-
- IStatus[] stati = new IStatus[flatStatusCollection.size()];
- flatStatusCollection.toArray(stati);
- return newStatus(stati, message, exception);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Stopwatch.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Stopwatch.java
deleted file mode 100644
index 326ebf6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Stopwatch.java
+++ /dev/null
@@ -1,100 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * A Stopwatch is used to measure the time elapsed during
- * an operation. To do this create a stopwatch before the
- * operation is executed and call stop() when the operation
- * afterwards. The elapsed time will be printed.
- *
- * A Stopwatch can also be used to measure an interval time. To
- * do this create a stopwatch and call printInterval after
- * every important interval. The resetInterval method can also
- * be used to start a new interval.
- *
- * A Stopwatch can also be registered for global access. To
- * do this create a stopwatch and call register. From this point
- * on a handle to the stopwatch can be retrieved by calling
- * Stopwatch.getStopwatch("name"). The stopwatch should be
- * unregistered when no longer needed.
- */
-public class Stopwatch {
- private long startTime;
- private long lastTime;
- private String name;
- private static Map registry;
-/**
- * Construct a new Stopwatch and start it.
- * To reset the watch at a later time just call start() again.
- */
-public Stopwatch(String name) {
- this.name = name;
- start();
-}
-/**
- * Get a stopwatch from the registry.
- */
-static public Stopwatch getStopwatch(String name) {
- if (registry != null)
- return (Stopwatch)registry.get(name);
- else
- return null;
-}
-/**
- * Print the elapsed time since start(), printInterval(), or
- * resetInterval() was last called.
- */
-public void printInterval(String hint) {
- long time = System.currentTimeMillis() - lastTime;
- System.out.println(name + " '" + hint + "' took " + time + " ms");//$NON-NLS-3$//$NON-NLS-2$//$NON-NLS-1$
- lastTime = System.currentTimeMillis();
-}
-/**
- * Print the current elapsed time.
- */
-public void printTime() {
- long time = System.currentTimeMillis() - startTime;
- System.out.print(name + " is now " + time + " ms");//$NON-NLS-2$//$NON-NLS-1$
-}
-/**
- * Add this stopwatch to the registry.
- */
-public void register() {
- if (registry == null)
- registry = new HashMap(2);
- registry.put(name, this);
-}
-/**
- * Reset the interval timer.
- */
-public void resetInterval() {
- lastTime = System.currentTimeMillis();
-}
-/**
- * Start the watch.
- */
-public void start() {
- startTime = lastTime = System.currentTimeMillis();
- System.out.println(name + " started");//$NON-NLS-1$
-}
-/**
- * Stop the watch and print the elapsed time.
- */
-public void stop() {
- long time = System.currentTimeMillis() - startTime;
- System.out.println(name + " finished in " + time + " ms");//$NON-NLS-2$//$NON-NLS-1$
-}
-/**
- * Remove this stopwatch from the registry.
- */
-public void unregister() {
- if (registry != null)
- registry.remove(name);
-}
-}
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
deleted file mode 100644
index 98ebaf6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/StringMatcher.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.internal.misc;
-
-import java.util.*;
-
-/**
- * A string pattern matcher, suppporting * and ? wildcards.
- */
-public class StringMatcher {
- protected String fPattern;
- protected int fLength; // pattern length
- protected boolean fIgnoreWildCards;
- protected boolean fIgnoreCase;
- protected boolean fHasLeadingStar;
- protected boolean fHasTrailingStar;
- protected String fSegments[]; //the given pattern is split into * separated segments
-
- /* boundary value beyond which we don't need to search in the text */
- protected int fBound= 0;
-
-
- protected static final char fSingleWildCard= '\u0000';
-
- 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();
-
- if (fIgnoreWildCards) {
- parseNoWildCards();
- } else {
- parseWildCards();
- }
- }
- /**
- * Find the first occurrence of the pattern between <code>start</code)(inclusive)
- * and <code>end</code>(exclusive).
- * @param <code>text</code>, the String object to search in
- * @param <code>start</code>, the starting index of the search range, inclusive
- * @param <code>end</code>, the ending index of the search range, exclusive
- * @return an <code>StringMatcher.Position</code> object that keeps the starting
- * (inclusive) and ending positions (exclusive) of the first occurrence of the
- * pattern in the specified range of the text; return null if not found or subtext
- * is empty (start==end). A pair of zeros is returned if pattern is empty string
- * Note that for pattern like "*abc*" with leading and trailing stars, position of "abc"
- * is returned. For a pattern like"*??*" in text "abcdf", (1,3) is returned
- */
- public StringMatcher.Position find(String text, int start, int end) {
- if (text == null)
- throw new IllegalArgumentException();
-
- int tlen= text.length();
- if (start < 0)
- start= 0;
- if (end > tlen)
- end= tlen;
- if (end < 0 ||start >= end )
- return null;
- if (fLength == 0)
- return new Position(start, start);
- if (fIgnoreWildCards) {
- int x= posIn(text, start, end);
- if (x < 0)
- return null;
- return new Position(x, x+fLength);
- }
-
- int segCount= fSegments.length;
- if (segCount == 0)//pattern contains only '*'(s)
- return new Position (start, end);
-
- int curPos= start;
- int matchStart= -1;
- int i;
- for (i= 0; i < segCount && curPos < end; ++i) {
- String current= fSegments[i];
- int nextMatch= regExpPosIn(text, curPos, end, current);
- if (nextMatch < 0 )
- return null;
- if(i == 0)
- matchStart= nextMatch;
- curPos= nextMatch + current.length();
- }
- if (i < segCount)
- return null;
- return new Position(matchStart, curPos);
- }
- /**
- * match the given <code>text</code> with the pattern
- * @return true if matched eitherwise false
- * @param <code>text</code>, a String object
- */
- public boolean match(String text) {
- 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 String <code>text</code>, a String object that contains the substring to match
- * @param int <code>start<code> marks the starting position (inclusive) of the substring
- * @param int <code>end<code> marks the ending index (exclusive) of the substring
- */
- public boolean match(String text, int start, int end) {
- if (null == text)
- throw new IllegalArgumentException();
-
- if (start > end)
- return false;
-
- if (fIgnoreWildCards)
- return (end - start == fLength) && fPattern.regionMatches(fIgnoreCase, 0, text, start, fLength);
- int segCount= fSegments.length;
- if (segCount == 0 && (fHasLeadingStar || fHasTrailingStar)) // pattern contains only '*'(s)
- return true;
- if (start == end)
- return fLength == 0;
- if (fLength == 0)
- return start == end;
-
- int tlen= text.length();
- if (start < 0)
- start= 0;
- if (end > tlen)
- end= tlen;
-
- int tCurPos= start;
- int bound= end - fBound;
- if ( bound < 0)
- return false;
- int i=0;
- String current= fSegments[i];
- int segLength= current.length();
-
- /* process first segment */
- if (!fHasLeadingStar){
- if(!regExpRegionMatches(text, start, current, 0, segLength)) {
- return false;
- } else {
- ++i;
- tCurPos= tCurPos + segLength;
- }
- }
-
- /* process middle segments */
- while (i < segCount) {
- current= fSegments[i];
- int currentMatch;
- int k= current.indexOf(fSingleWildCard);
- if (k < 0) {
- currentMatch= textPosIn(text, tCurPos, end, current);
- if (currentMatch < 0)
- return false;
- } else {
- currentMatch= regExpPosIn(text, tCurPos, end, current);
- if (currentMatch < 0)
- return false;
- }
- tCurPos= currentMatch + current.length();
- i++;
- }
-
- /* process final segment */
- if (!fHasTrailingStar && tCurPos != end) {
- int clen= current.length();
- return regExpRegionMatches(text, end - clen, current, 0, clen);
- }
- return i == segCount ;
- }
- /**
- * 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() {
- fSegments= new String[1];
- fSegments[0]= fPattern;
- fBound= fLength;
- }
- /**
- * Parses the given pattern into segments seperated by wildcard '*' characters.
- * @param p, a String object that is a simple regular expression with ‘*’ and/or ‘?’
- */
- private void parseWildCards() {
- if(fPattern.startsWith("*"))//$NON-NLS-1$
- fHasLeadingStar= true;
- if(fPattern.endsWith("*")) {//$NON-NLS-1$
- /* make sure it's not an escaped wildcard */
- if (fLength > 1 && fPattern.charAt(fLength - 2) != '\\') {
- fHasTrailingStar= true;
- }
- }
-
- Vector temp= new Vector();
-
- int pos= 0;
- StringBuffer buf= new StringBuffer();
- while (pos < fLength) {
- char c= fPattern.charAt(pos++);
- switch (c) {
- case '\\':
- if (pos >= fLength) {
- buf.append(c);
- } else {
- char next= fPattern.charAt(pos++);
- /* if it's an escape sequence */
- if (next == '*' || next == '?' || next == '\\') {
- buf.append(next);
- } else {
- /* not an escape sequence, just insert literally */
- buf.append(c);
- buf.append(next);
- }
- }
- break;
- case '*':
- if (buf.length() > 0) {
- /* new segment */
- temp.addElement(buf.toString());
- fBound += buf.length();
- buf.setLength(0);
- }
- break;
- case '?':
- /* append special character representing single match wildcard */
- buf.append(fSingleWildCard);
- break;
- default:
- buf.append(c);
- }
- }
-
- /* add last buffer to segment list */
- if (buf.length() > 0) {
- temp.addElement(buf.toString());
- fBound += buf.length();
- }
-
- fSegments= new String[temp.size()];
- temp.copyInto(fSegments);
- }
- /**
- * @param <code>text</code>, a string which contains no wildcard
- * @param <code>start</code>, the starting index in the text for search, inclusive
- * @param <code>end</code>, 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)
- return -1;
- return i;
- }
-
- for (int i= start; i <= max; ++i) {
- if (text.regionMatches(true, i, fPattern, 0, fLength))
- return i;
- }
-
- return -1;
- }
- /**
- * @param <code>text</code>, a simple regular expression that may only contain '?'(s)
- * @param <code>start</code>, the starting index in the text for search, inclusive
- * @param <code>end</code>, the stopping point of search, exclusive
- * @param <code>p</code>, a simple regular expression that may contains '?'
- * @param <code>caseIgnored</code>, wether the pattern is not casesensitive
- * @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 boolean
- * @param <code>text</code>, a String to match
- * @param <code>start</code>, int that indicates the starting index of match, inclusive
- * @param <code>end</code> int that indicates the ending index of match, exclusive
- * @param <code>p</code>, String, String, a simple regular expression that may contain '?'
- * @param <code>ignoreCase</code>, boolean indicating wether 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)
- continue;
- 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
- if (Character.toLowerCase(tchar) == Character.toLowerCase(pchar))
- continue;
- }
- return false;
- }
- return true;
- }
- /**
- * @param <code>text</code>, the string to match
- * @param <code>start</code>, the starting index in the text for search, inclusive
- * @param <code>end</code>, the stopping point of search, exclusive
- * @param code>p</code>, a string that has no wildcard
- * @param <code>ignoreCase</code>, boolean indicating wether code>p</code> is case sensitive
- * @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;
- }
-
- for (int i= start; i <= max; ++i) {
- if (text.regionMatches(true, i, p, 0, plen))
- return i;
- }
-
- return -1;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestPageListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestPageListener.java
deleted file mode 100644
index 6a4db45..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestPageListener.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-
-/**
- * Prints out page listener events.
- */
-public class TestPageListener implements IPageListener {
-/**
- * TestPageListener constructor comment.
- */
-public TestPageListener() {
- super();
-}
-/**
- * Notifies this listener that the given page has been activated.
- *
- * @param page the page that was activated
- * @see IWorkbenchWindow#setActivePage
- */
-public void pageActivated(IWorkbenchPage page) {
- System.out.println("pageActivated(" + page + ")");//$NON-NLS-2$//$NON-NLS-1$
-}
-/**
- * Notifies this listener that the given page has been closed.
- *
- * @param page the page that was closed
- * @see IWorkbenchPage#close
- */
-public void pageClosed(IWorkbenchPage page) {
- System.out.println("pageClosed(" + page + ")");//$NON-NLS-2$//$NON-NLS-1$
-}
-/**
- * Notifies this listener that the given page has been opened.
- *
- * @param page the page that was opened
- * @see IWorkbenchWindow#openPage
- */
-public void pageOpened(IWorkbenchPage page) {
- System.out.println("pageOpened(" + page + ")");//$NON-NLS-2$//$NON-NLS-1$
-}
-}
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
deleted file mode 100644
index 315b950..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestPartListener.java
+++ /dev/null
@@ -1,70 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-
-/**
- * Prints out part listener events
- */
-public class TestPartListener implements IPartListener {
-/**
- * TestPartListener constructor comment.
- */
-public TestPartListener() {
- super();
-}
-/**
- * Notifies this listener that the given part has been activated.
- *
- * @param part the part that was activated
- * @see IPerspective#activate
- */
-public void partActivated(IWorkbenchPart part) {
- 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
- */
-public void partBroughtToTop(IWorkbenchPart part) {
- 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
- */
-public void partClosed(IWorkbenchPart part) {
- 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
- */
-public void partDeactivated(IWorkbenchPart part) {
- 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
- */
-public void partOpened(IWorkbenchPart part) {
- 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/TestSelectionListener.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestSelectionListener.java
deleted file mode 100644
index 612f90e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/TestSelectionListener.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.*;
-import org.eclipse.ui.*;
-
-/**
- * Print out selection listener events.
- */
-public class TestSelectionListener implements org.eclipse.ui.ISelectionListener {
-/**
- * TestSelectionListener constructor comment.
- */
-public TestSelectionListener() {
- super();
-}
-/**
- * Notifies this listener that the selection has changed.
- *
- * @param part the workbench part containing the selection
- * @param selection the new selection, or <code>null</code> if none
- */
-public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- System.out.println("selectionChanged(" + selection + ")");//$NON-NLS-2$//$NON-NLS-1$
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIHackFinder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIHackFinder.java
deleted file mode 100644
index 392c251..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/UIHackFinder.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-public class UIHackFinder {
-/**
- * Used to mark code/functionality that we may want in the future.
- */
-public static void fixFuture() {}
-/**
- * Used to mark code that must be fixed up related to error handling.
- */
-public static void fixHandler() {}
-/**
- * Used to mark code that must be fixed up related to ISV or plugin.
- */
-public static void fixPR() {}
-/**
- * Used to mark code that must be fixed up.
- */
-public static void fixUI() {}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/WizardStepGroup.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/WizardStepGroup.java
deleted file mode 100644
index eaf2ab6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/WizardStepGroup.java
+++ /dev/null
@@ -1,272 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.IContentProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.dialogs.WizardStep;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-
-/**
- * A group of controls used to view the list of
- * wizard steps to be done.
- */
-public class WizardStepGroup {
- private Image doneImage;
- private Image currentImage;
- private WizardStep currentStep;
- private Composite parentComposite;
- private TableViewer stepViewer;
- private ISelectionChangedListener selectionListener;
-
- /**
- * Creates a new instance of the <code>WizardStepGroup</code>
- *
- * @param numberColWidth the width in pixel for the number column
- */
- public WizardStepGroup() {
- super();
- }
-
- /**
- * Create the contents of this group. The basic layout is a table
- * with a label above it.
- */
- public Control createContents(Composite parent) {
- parentComposite = parent;
-
- // Create a composite to hold everything together
- Composite composite = new Composite(parent, SWT.NULL);
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
- composite.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (doneImage != null) {
- doneImage.dispose();
- doneImage = null;
- }
- if (currentImage != null) {
- currentImage.dispose();
- currentImage = null;
- }
- }
- });
-
- // Add a label to identify the step list field
- Label label = new Label(composite, SWT.LEFT);
- label.setText(WorkbenchMessages.getString("WizardStepGroup.stepsLabel")); //$NON-NLS-1$
- GridData data = new GridData();
- data.verticalAlignment = SWT.TOP;
- label.setLayoutData(data);
-
- // Table viewer of all the steps
- stepViewer = new TableViewer(composite, SWT.SINGLE | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
- data = new GridData(GridData.FILL_BOTH);
- stepViewer.getTable().setLayoutData(data);
- stepViewer.setContentProvider(getStepProvider());
- stepViewer.setLabelProvider(new StepLabelProvider());
-
- if (selectionListener != null)
- stepViewer.addSelectionChangedListener(selectionListener);
-
- return composite;
- }
-
- /**
- * Creates an image descriptor.
- */
- private Image createImage(String iconFileName) {
- String iconPath = "icons/full/clcl16/"; //$NON-NLS-1$
- ImageDescriptor desc = null;
- try {
- URL url_basic = WorkbenchPlugin.getDefault().getDescriptor().getInstallURL();
- URL url = new URL(url_basic, iconPath + iconFileName);
- desc = ImageDescriptor.createFromURL(url);
- } catch (MalformedURLException e) {
- return null;
- }
-
- return desc.createImage();
- }
-
- /**
- * Return the image indicating a step is current
- */
- private Image getCurrentImage() {
- if (currentImage == null) {
- currentImage = createImage("step_current.gif"); //$NON-NLS-1$
- }
- return currentImage;
- }
-
- /**
- * Return the image indicating a step is done
- */
- private Image getDoneImage() {
- if (doneImage == null) {
- doneImage = createImage("step_done.gif"); //$NON-NLS-1$
- }
- return doneImage;
- }
-
- /**
- * Returns the content provider for the step viewer
- */
- private IContentProvider getStepProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object parentElement) {
- if (parentElement instanceof StepRoot)
- return ((StepRoot) parentElement).getSteps();
- else
- return null;
- }
-
- };
- }
-
- /**
- * Returns the steps.
- */
- public WizardStep[] getSteps() {
- if (stepViewer != null) {
- StepRoot root = (StepRoot)stepViewer.getInput();
- if (root != null)
- return root.getSteps();
- }
-
- return new WizardStep[0];
- }
-
- /**
- * Marks the current step as being done
- */
- public void markStepAsDone() {
- if (currentStep != null)
- currentStep.markAsDone();
- }
-
- /**
- * Sets the current step being worked on. Assumes
- * the step provided exist in the steps within the
- * group's viewer.
- *
- * @param step the wizard step being worked on
- */
- public void setCurrentStep(WizardStep step) {
- WizardStep oldStep = currentStep;
- currentStep = step;
- if (stepViewer != null) {
- if (oldStep != null)
- stepViewer.update(oldStep, null);
- if (currentStep != null)
- stepViewer.update(currentStep, null);
-
- // Update the layout so that there is enough
- // room for the icon now.
- if (oldStep == null && currentStep != null)
- parentComposite.layout(true);
- }
- }
-
- /**
- * Set the current listener interested when the selection
- * state changes.
- *
- * @param listener The selection listener to set
- */
- public void setSelectionListener(ISelectionChangedListener listener) {
- if (selectionListener != null && stepViewer != null)
- stepViewer.removeSelectionChangedListener(selectionListener);
- selectionListener = listener;
- if (selectionListener != null && stepViewer != null)
- stepViewer.addSelectionChangedListener(selectionListener);
- }
-
- /**
- * Sets the steps to be displayed. Ignored is the
- * method createContents has not been called yet.
- *
- * @param steps the collection of steps
- */
- public void setSteps(WizardStep[] steps) {
- if (stepViewer != null) {
- stepViewer.setInput(new StepRoot(steps));
- parentComposite.layout(true);
- }
- }
-
- /**
- * Holder of all the steps within the viewer
- */
- private class StepRoot {
- private WizardStep[] steps;
-
- public StepRoot(WizardStep[] steps) {
- super();
- this.steps = steps;
- }
-
- public WizardStep[] getSteps() {
- if (steps == null)
- return new WizardStep[0];
- else
- return steps;
- }
- }
-
- /**
- * Label provider for step table viewer
- */
- private class StepLabelProvider extends LabelProvider {
- public String getText(Object element) {
- if (element instanceof WizardStep) {
- WizardStep step = (WizardStep) element;
- return String.valueOf(step.getNumber()) + ". " + step.getLabel(); //$NON-NLS-1$
- }
-
- return ""; //$NON-NLS-1$
- }
-
- public Image getImage(Object element) {
- if (element instanceof WizardStep) {
- WizardStep step = (WizardStep) element;
- if (step.isDone())
- return getDoneImage();
- if (step == currentStep)
- return getCurrentImage();
- }
-
- return null;
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Workbook.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Workbook.java
deleted file mode 100644
index 6364855..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/Workbook.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-
-public class Workbook {
- private TabFolder tabFolder;
- private TabItem selectedTab;
-/**
- * Workbook constructor comment.
- */
-public Workbook(Composite parent, int style) {
- tabFolder = new TabFolder(parent, style);
-
- tabFolder.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- TabItem newSelectedTab = (TabItem) event.item;
- if (selectedTab == newSelectedTab) // Do nothing if the selection did not change.
- return;
-
- if (selectedTab != null && (!selectedTab.isDisposed())) {
- WorkbookPage selectedPage = getWorkbookPage(selectedTab);
- if (!selectedPage.deactivate()) {
- tabFolder.setSelection(new TabItem[] {selectedTab});
- return;
- }
- }
-
- selectedTab = newSelectedTab;
- WorkbookPage newSelectedPage = getWorkbookPage(newSelectedTab);
- newSelectedPage.activate();
-
- }
- });
-
-}
-public WorkbookPage getSelectedPage() {
-
- int index = tabFolder.getSelectionIndex();
- if (index == -1) // When can this be -1
- return null;
-
- TabItem selectedItem = tabFolder.getItem(index);
-
- return (WorkbookPage)selectedItem.getData();
-}
-public TabFolder getTabFolder() {
-
- return tabFolder;
-
-}
-protected WorkbookPage getWorkbookPage(TabItem item) {
-
- try {
- return (WorkbookPage) item.getData();
- } catch (ClassCastException e) {
- return null;
- }
-}
-public WorkbookPage[] getWorkbookPages() {
-
- TabItem[] tabItems = tabFolder.getItems();
- int nItems = tabItems.length;
- WorkbookPage[] workbookPages = new WorkbookPage[nItems];
- for (int i = 0; i < nItems; i++)
- workbookPages[i] = getWorkbookPage(tabItems[i]);
- return workbookPages;
-}
-public void setSelectedPage (WorkbookPage workbookPage)
-{
- TabItem newSelectedTab = workbookPage.getTabItem();
-
- if (selectedTab == newSelectedTab)
- return;
-
- selectedTab = newSelectedTab;
- workbookPage.activate();
- tabFolder.setSelection(new TabItem[] {newSelectedTab});
-
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/WorkbookPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/WorkbookPage.java
deleted file mode 100644
index 7ba38d1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/misc/WorkbookPage.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.ui.internal.misc;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-public abstract class WorkbookPage {
- public TabItem tabItem;
-/**
- * WorkbookPage constructor comment.
- */
-public WorkbookPage(Workbook parent) {
- TabFolder folder = parent.getTabFolder();
- tabItem = new TabItem(folder,SWT.NONE);
- tabItem.setData(this);
-}
-public void activate() {
-
- if (tabItem.getControl() == null)
- tabItem.setControl(createControl(tabItem.getParent()));
-
-}
-protected abstract Control createControl (Composite parent);
-public boolean deactivate() {
- return true;
-}
-public void dispose() {
-
- if (tabItem == null)
- return;
-
- TabItem oldItem = tabItem;
- tabItem = null;
- oldItem.dispose();
-}
-public TabItem getTabItem() {
- return tabItem;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/AdaptableList.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/AdaptableList.java
deleted file mode 100644
index 664b8a4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/AdaptableList.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-import java.util.*;
-
-/**
- * A list of adaptable objects. This is a generic list that can
- * be used to display an arbitrary set of adaptable objects in the workbench.
- * Also implements the IWorkbenchAdapter interface for simple display
- * and navigation.
- */
-public class AdaptableList extends WorkbenchAdapter implements IAdaptable {
- protected List children = null;
-/**
- * Creates a new adaptable list.
- */
-public AdaptableList() {
- children = new ArrayList();
-}
-/**
- * Creates a new adaptable list with the given size.
- */
-public AdaptableList(int size) {
- children = new ArrayList(size);
-}
-/**
- * Creates a new adaptable list with the given children.
- */
-public AdaptableList(IAdaptable[] newChildren) {
- this(newChildren.length);
- for (int i = 0; i < newChildren.length; i++) {
- children.add(newChildren[i]);
- }
-}
-/**
- * Adds all the adaptable objects in the given enumeration to this list.
- * Returns this list.
- */
-public AdaptableList add(Iterator e) {
- while (e.hasNext()) {
- add((IAdaptable)e.next());
- }
- return this;
-}
-/**
- * Adds the given adaptable object to this list. Returns this list.
- */
-public AdaptableList add(IAdaptable a) {
- children.add(a);
- return 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.
- */
-public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
-}
-/**
- * Returns the elements in this list.
- */
-public Object[] getChildren() {
- return children.toArray();
-}
-/**
- * Returns the elements in this list.
- * @see IWorkbenchAdapter#getChildren
- */
-public Object[] getChildren(Object o) {
- return children.toArray();
-}
-/**
- * Adds the given adaptable object to this list.
- */
-public void remove(IAdaptable a) {
- children.remove(a);
-}
-/**
- * Returns the number of items in the list
- */
-public int size() {
- return children.size();
-}
-/**
- * For debugging purposes only.
- */
-public String toString() {
- return children.toString();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/ResourceFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/ResourceFactory.java
deleted file mode 100644
index f4c248d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/ResourceFactory.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * The ResourceFactory is used to save and recreate an IResource object.
- * As such, it implements the IPersistableElement interface for storage
- * and the IElementFactory interface for recreation.
- *
- * @see IMemento
- * @see IPersistableElement
- * @see IElementFactory
- */
-public class ResourceFactory implements IElementFactory, IPersistableElement {
-
- // These persistence constants are stored in XML. Do not
- // change them.
- private static final String TAG_PATH = "path";//$NON-NLS-1$
- private static final String FACTORY_ID = "org.eclipse.ui.internal.model.ResourceFactory";//$NON-NLS-1$
-
- // IPersistable data.
- private IResource res;
-/**
- * Create a ResourceFactory. This constructor is typically used
- * for our IElementFactory side.
- */
-public ResourceFactory() {
-}
-/**
- * Create a ResourceFactory. This constructor is typically used
- * for our IPersistableElement side.
- */
-public ResourceFactory(IResource input) {
- res = input;
-}
-/**
- * @see IElementFactory
- */
-public IAdaptable createElement(IMemento memento) {
-
- // Get the file name.
- String fileName = memento.getString(TAG_PATH);
- if (fileName == null)
- return null;
-
- // Create an IResource.
- res = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(fileName));
- return res;
-}
-/**
- * @see IPersistableElement.
- */
-public String getFactoryId() {
- return FACTORY_ID;
-}
-/**
- * @see IPersistableElement
- */
-public void saveState(IMemento memento) {
- memento.putString(TAG_PATH, res.getFullPath().toString());
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchAdapter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchAdapter.java
deleted file mode 100644
index 4aa0765..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchAdapter.java
+++ /dev/null
@@ -1,57 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * A default implementation of the IWorkbenchAdapter interface.
- * Provides basic implementations of the interface methods.
- */
-public abstract class WorkbenchAdapter implements IWorkbenchAdapter {
- protected static final Object[] NO_CHILDREN = new Object[0];
-/**
- * @see IWorkbenchAdapter#getChildren
- */
-public Object[] getChildren(Object o) {
- return NO_CHILDREN;
-}
-/**
- * A convenience method for getting the label of an adaptable
- * object that responds to the IWorkbenchAdapter adapter interface.
- * Returns a toString() of the object if it is not adaptable
- */
-public static String getElementLabel(IAdaptable a) {
- if (a == null) {
- return "";//$NON-NLS-1$
- }
- IWorkbenchAdapter adapter = (IWorkbenchAdapter)a.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- return adapter.getLabel(a);
- } else {
- return a.toString();
- }
-}
-/**
- * @see IWorkbenchAdapter#getImageDescriptor
- */
-public ImageDescriptor getImageDescriptor(Object object) {
- return null;
-}
-/**
- * @see IWorkbenchAdapter#getLabel
- */
-public String getLabel(Object o) {
- return o == null ? "" : o.toString();//$NON-NLS-1$
-}
-/**
- * @see IWorkbenchAdapter#getParent
- */
-public Object getParent(Object o) {
- return null;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchAdapterBuilder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchAdapterBuilder.java
deleted file mode 100644
index cab9426..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchAdapterBuilder.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-
-/**
- * Registers the adapters on core constructs
- * used in the workbench UI.
- */
-public class WorkbenchAdapterBuilder {
-/**
- * Creates extenders and registers
- */
-public void registerAdapters() {
- IAdapterManager manager = Platform.getAdapterManager();
- IAdapterFactory factory = new WorkbenchAdapterFactory();
- manager.registerAdapters(factory, IWorkspace.class);
- manager.registerAdapters(factory, IWorkspaceRoot.class);
- manager.registerAdapters(factory, IProject.class);
- manager.registerAdapters(factory, IFolder.class);
- manager.registerAdapters(factory, IFile.class);
- manager.registerAdapters(factory, IMarker.class);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchAdapterFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchAdapterFactory.java
deleted file mode 100644
index fabafc6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchAdapterFactory.java
+++ /dev/null
@@ -1,152 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.ui.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * Dispenses adapters for various core objects.
- * Returns IWorkbenchAdapter adapters, used for displaying,
- * navigating, and populating menus for core objects.
- */
-class WorkbenchAdapterFactory implements IAdapterFactory {
- private Object workspaceAdapter = new WorkbenchWorkspace();
- private Object rootAdapter = new WorkbenchRootResource();
- private Object projectAdapter = new WorkbenchProject();
- private Object folderAdapter = new WorkbenchFolder();
- private Object fileAdapter = new WorkbenchFile();
-
- private Object markerAdapter = new WorkbenchMarker();
-
- private Object resourceFactory = new ResourceFactory();
- private Object workspaceFactory = new WorkspaceFactory();
-/**
- * Returns the IActionFilter for an object.
- */
-protected Object getActionFilter(Object o) {
- if (o instanceof IResource) {
- switch (((IResource) o).getType()) {
- case IResource.FILE :
- return fileAdapter;
- case IResource.FOLDER :
- return folderAdapter;
- case IResource.PROJECT :
- return projectAdapter;
- }
- }
- if (o instanceof IMarker) {
- return markerAdapter;
- }
- return null;
-}
-/**
- * Returns an object which is an instance of the given class
- * associated with the given object. Returns <code>null</code> if
- * no such object can be found.
- *
- * @param adaptableObject the adaptable object being queried
- * (usually an instance of <code>IAdaptable</code>)
- * @param adapterType the type of adapter to look up
- * @return a object castable to the given adapter type,
- * or <code>null</code> if this adapter provider
- * does not have an adapter of the given type for the
- * given object
- */
-public Object getAdapter(Object o, Class adapterType) {
- if (adapterType.isInstance(o)) {
- return o;
- }
- if (adapterType == IWorkbenchAdapter.class) {
- return getWorkbenchElement(o);
- }
- if (adapterType == IPersistableElement.class) {
- return getPersistableElement(o);
- }
- if (adapterType == IElementFactory.class) {
- return getElementFactory(o);
- }
- if (adapterType == IActionFilter.class) {
- return getActionFilter(o);
- }
- return null;
-}
-/**
- * Returns the collection of adapater types handled by this
- * provider.
- * <p>
- * This method is generally used by an adapter manager
- * to discover which adapter types are supported, in adavance
- * of dispatching any actual <code>getAdapter</code> requests.
- * </p>
- *
- * @return the collection of adapter types
- */
-public Class[] getAdapterList() {
- return new Class[] {
- IWorkbenchAdapter.class,
- IElementFactory.class,
- IPersistableElement.class,
- IActionFilter.class
- };
-}
-/**
- * Returns an object which is an instance of IElementFactory
- * associated with the given object. Returns <code>null</code> if
- * no such object can be found.
- */
-protected Object getElementFactory(Object o) {
- if (o instanceof IResource) {
- return resourceFactory;
- }
- if (o instanceof IWorkspace) {
- return workspaceFactory;
- }
- return null;
-}
-/**
- * Returns an object which is an instance of IPersistableElement
- * associated with the given object. Returns <code>null</code> if
- * no such object can be found.
- */
-protected Object getPersistableElement(Object o) {
- if (o instanceof IResource) {
- return new ResourceFactory((IResource)o);
- }
- if (o instanceof IWorkspace) {
- return workspaceFactory;
- }
- return null;
-}
-/**
- * Returns an object which is an instance of IWorkbenchAdapter
- * associated with the given object. Returns <code>null</code> if
- * no such object can be found.
- */
-protected Object getWorkbenchElement(Object o) {
- if (o instanceof IResource) {
- switch (((IResource) o).getType()) {
- case IResource.FILE :
- return fileAdapter;
- case IResource.FOLDER :
- return folderAdapter;
- case IResource.PROJECT :
- return projectAdapter;
- }
- }
- if (o instanceof IWorkspaceRoot) {
- return rootAdapter;
- }
- if (o instanceof IWorkspace) {
- return workspaceAdapter;
- }
- if (o instanceof IMarker) {
- return markerAdapter;
- }
- return null;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchFile.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchFile.java
deleted file mode 100644
index 762197c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchFile.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.jface.resource.ImageDescriptor;
-/**
- * An IWorkbenchAdapter that represents IFiles.
- */
-public class WorkbenchFile extends WorkbenchResource {
-/**
- * Answer the appropriate base image to use for the passed resource, optionally
- * considering the passed open status as well iff appropriate for the type of
- * passed resource
- */
-protected ImageDescriptor getBaseImage(IResource resource) {
- ImageDescriptor image = WorkbenchPlugin.getDefault().getEditorRegistry().getImageDescriptor((IFile) resource);
- if (image == null)
- image = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
- return image;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchFolder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchFolder.java
deleted file mode 100644
index 4c064c4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchFolder.java
+++ /dev/null
@@ -1,35 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * An IWorkbenchAdapter that represents IFolders.
- */
-public class WorkbenchFolder extends WorkbenchResource {
-/**
- * Answer the appropriate base image to use for the passed resource, optionally
- * considering the passed open status as well iff appropriate for the type of
- * passed resource
- */
-protected ImageDescriptor getBaseImage(IResource resource) {
- return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
-}
-/**
- * Returns the children of this container.
- */
-public Object[] getChildren(Object o) {
- try {
- return ((IContainer)o).members();
- } catch (CoreException e) {
- return NO_CHILDREN;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchMarker.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchMarker.java
deleted file mode 100644
index b9c8708..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchMarker.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.IMarkerActionFilter;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.actions.SimpleWildcardTester;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * Model object for adapting IMarker objects to the IWorkbenchAdapter
- * interface.
- */
-public class WorkbenchMarker
- extends WorkbenchAdapter
- implements IMarkerActionFilter {
- private static final ImageDescriptor image =
- WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJS_BKMRK_TSK);
-/**
- * @see IWorkbenchAdapter#getImageDescriptor
- */
-public ImageDescriptor getImageDescriptor(Object o) {
- if(!(o instanceof IMarker))
- return null;
- return WorkbenchPlugin.getDefault().getMarkerImageProviderRegistry().getImageDescriptor((IMarker)o);
-}
-/**
- * Returns the name of this element. This will typically
- * be used to assign a label to this object when displayed
- * in the UI.
- */
-public String getLabel(Object o) {
- IMarker marker = (IMarker) o;
- return marker.getAttribute(IMarker.MESSAGE, "");//$NON-NLS-1$
-}
-/**
- * Returns the logical parent of the given object in its tree.
- */
-public Object getParent(Object o) {
- return ((IMarker)o).getResource();
-}
-/**
- * Returns whether the specific attribute matches the state of the target
- * object.
- *
- * @param taret the target object
- * @param name the attribute name
- * @param value the attriute value
- * @return <code>true</code> if the attribute matches; <code>false</code> otherwise
- */
-public boolean testAttribute(Object target, String name, String value) {
- IMarker marker = (IMarker) target;
- if (name.equals(TYPE)) {
- try {
- return value.equals(marker.getType());
- } catch (CoreException e) {
- return false;
- }
- } else if (name.equals(SUPER_TYPE)) {
- try {
- return marker.isSubtypeOf(value);
- } catch (CoreException e) {
- return false;
- }
- } else if (name.equals(PRIORITY)) {
- return testIntegerAttribute(marker, IMarker.PRIORITY, value);
- } else if (name.equals(SEVERITY)) {
- return testIntegerAttribute(marker, IMarker.SEVERITY, value);
- } else if (name.equals(MESSAGE)) {
- try {
- String msg = (String)marker.getAttribute(IMarker.MESSAGE);
- if (msg == null)
- return false;
- return SimpleWildcardTester.testWildcardIgnoreCase(value, msg);
- } catch (CoreException e) {
- return false;
- }
- } else if (name.equals(DONE)) {
- try {
- value = value.toLowerCase();
- Boolean done = (Boolean)marker.getAttribute(IMarker.DONE);
- if (done == null)
- return false;
- return (done.booleanValue() == value.equals("true"));//$NON-NLS-1$
- } catch (CoreException e) {
- return false;
- }
- }
- return false;
-}
-/**
- * Returns whether the specific integer attribute matches a value.
- */
-private boolean testIntegerAttribute(IMarker marker, String attrName, String value) {
- Integer i1, i2;
- try {
- i1 = (Integer)marker.getAttribute(attrName);
- if (i1 == null)
- return false;
- } catch (CoreException e) {
- return false;
- }
- try {
- i2 = Integer.valueOf(value);
- } catch (NumberFormatException e) {
- return false;
- }
- return i1.equals(i2);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchProject.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchProject.java
deleted file mode 100644
index fac8940..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchProject.java
+++ /dev/null
@@ -1,95 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.HashMap;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.misc.OverlayIcon;
-
-/**
- * An IWorkbenchAdapter that represents IProject.
- */
-public class WorkbenchProject extends WorkbenchResource
- implements IProjectActionFilter
-{
- HashMap imageCache = new HashMap(11);
-/**
- * Answer the appropriate base image to use for the passed resource, optionally
- * considering the passed open status as well iff appropriate for the type of
- * passed resource
- */
-protected ImageDescriptor getBaseImage(IResource resource) {
- IProject project = (IProject) resource;
- boolean isOpen = project.isOpen();
- String baseKey = isOpen ? ISharedImages.IMG_OBJ_PROJECT : ISharedImages.IMG_OBJ_PROJECT_CLOSED;
- if (isOpen) {
- try {
- String[] natureIds = project.getDescription().getNatureIds();
- for (int i = 0; i < natureIds.length; ++i) {
- // Have to use a cache because OverlayIcon does not define its own equality criteria,
- // so WorkbenchLabelProvider would always create a new image otherwise.
- String imageKey = natureIds[i];
- ImageDescriptor overlayImage = (ImageDescriptor) imageCache.get(imageKey);
- if (overlayImage != null) {
- return overlayImage;
- }
- ImageDescriptor natureImage = WorkbenchPlugin.getDefault().getProjectImageRegistry().getNatureImage(natureIds[i]);
- if (natureImage != null) {
- ImageDescriptor baseImage = WorkbenchImages.getImageDescriptor(baseKey);
- overlayImage = new OverlayIcon(baseImage, new ImageDescriptor[][] {{ natureImage }}, new Point(16, 16));
- imageCache.put(imageKey, overlayImage);
- return overlayImage;
- }
- }
- }
- catch (CoreException e) {
- }
- }
- return WorkbenchImages.getImageDescriptor(baseKey);
-}
-/**
- * Returns the children of this container.
- */
-public Object[] getChildren(Object o) {
- IProject project = (IProject) o;
- if (project.isOpen()) {
- try {
- return project.members();
- } catch (CoreException e) {
- //don't get the children if there are problems with the project
- }
- }
- return NO_CHILDREN;
-}
-/**
- * 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 attriute value
- * @return <code>true</code> if the attribute matches; <code>false</code> otherwise
- */
-public boolean testAttribute(Object target, String name, String value) {
- IProject proj = (IProject) target;
- if (name.equals(NATURE)) {
- try {
- return proj.isAccessible() && proj.hasNature(value);
- } catch (CoreException e) {
- return false;
- }
- } else if (name.equals(OPEN)) {
- value = value.toLowerCase();
- return (proj.isOpen() == value.equals("true"));//$NON-NLS-1$
- }
- return super.testAttribute(target, name, value);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchResource.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchResource.java
deleted file mode 100644
index de93db0..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchResource.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.IResourceActionFilter;
-import org.eclipse.ui.actions.SimpleWildcardTester;
-import java.util.Iterator;
-
-/**
- * An IWorkbenchAdapter that represents IResources.
- */
-public abstract class WorkbenchResource extends WorkbenchAdapter
- implements IResourceActionFilter
-{
-/**
- * Answer the appropriate base image to use for the resource.
- */
-protected abstract ImageDescriptor getBaseImage(IResource resource);
-/**
- * Returns an image descriptor for this object.
- */
-public ImageDescriptor getImageDescriptor(Object o) {
- IResource resource = getResource(o);
- return resource == null ? null : getBaseImage(resource);
-}
-/**
- * getLabel method comment.
- */
-public String getLabel(Object o) {
- IResource resource = getResource(o);
- return resource == null ? null : resource.getName();
-}
-/**
- * Returns the parent of the given object. Returns null if the
- * parent is not available.
- */
-public Object getParent(Object o) {
- IResource resource = getResource(o);
- return resource == null ? null : resource.getParent();
-}
-/**
- * Returns the resource corresponding to this object,
- * or null if there is none.
- */
-protected IResource getResource(Object o) {
- if (o instanceof IResource) {
- return (IResource)o;
- }
- if (o instanceof IAdaptable) {
- return (IResource)((IAdaptable)o).getAdapter(IResource.class);
- }
- return null;
-}
-/**
- * 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
- */
-public boolean testAttribute(Object target, String name, String value) {
- if (!(target instanceof IResource)) {
- return false;
- }
- IResource res = (IResource) target;
- if (name.equals(NAME)) {
- return SimpleWildcardTester.testWildcardIgnoreCase(value,
- res.getName());
- } else if (name.equals(PATH)) {
- return SimpleWildcardTester.testWildcardIgnoreCase(value,
- res.getFullPath().toString());
- } else if (name.equals(EXTENSION)) {
- return SimpleWildcardTester.testWildcardIgnoreCase(value,
- res.getFileExtension());
- } else if (name.equals(READ_ONLY)) {
- return (res.isReadOnly() == value.equalsIgnoreCase("true"));//$NON-NLS-1$
- } else if (name.equals(PROJECT_NATURE)) {
- try {
- IProject proj = res.getProject();
- return proj.isAccessible() && proj.hasNature(value);
- } catch (CoreException e) {
- return false;
- }
- } else if (name.equals(PERSISTENT_PROPERTY)) {
- return testProperty(res, true, false, value);
- } else if (name.equals(PROJECT_PERSISTENT_PROPERTY)) {
- return testProperty(res, true, true, value);
- } else if (name.equals(SESSION_PROPERTY)) {
- return testProperty(res, false, false, value);
- } else if (name.equals(PROJECT_SESSION_PROPERTY)) {
- return testProperty(res, false, true, value);
- }
- return false;
-}
-
-/**
- * Tests whether a session or persistent property on the resource or its project
- * matches the given value.
- *
- * @param resource the resource to check
- * @param persistentFlag <code>true</code> for a persistent property,
- * <code>false</code> for a session property
- * @param projectFlag <code>true</code> to check the resource's project,
- * <code>false</code> to check the resource itself
- * @param value the attribute value, which has either the form "propertyName"
- * or "propertyName=propertyValue"
- * @return whether there is a match
- */
-private boolean testProperty(IResource resource, boolean persistentFlag, boolean projectFlag, String value) {
- String propertyName;
- String expectedVal;
- int i = value.indexOf('=');
- if (i != -1) {
- propertyName = value.substring(0, i).trim();
- expectedVal = value.substring(i+1).trim();
- }
- else {
- propertyName = value.trim();
- expectedVal = null;
- }
- try {
- QualifiedName key;
- int dot = propertyName.lastIndexOf('.');
- if (dot != -1) {
- key = new QualifiedName(propertyName.substring(0, dot), propertyName.substring(dot+1));
- }
- else {
- key = new QualifiedName(null, propertyName);
- }
- IResource resToCheck = projectFlag ? resource.getProject() : resource;
- // getProject() on workspace root can be null
- if (resToCheck == null) {
- return false;
- }
- if (persistentFlag) {
- String actualVal = resToCheck.getPersistentProperty(key);
- if (actualVal == null) {
- return false;
- }
- return expectedVal == null || expectedVal.equals(actualVal);
- }
- else {
- Object actualVal = resToCheck.getSessionProperty(key);
- if (actualVal == null) {
- return false;
- }
- return expectedVal == null || expectedVal.equals(actualVal.toString());
- }
- } catch (CoreException e) {
- // ignore
- }
- return false;
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchRootResource.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchRootResource.java
deleted file mode 100644
index 6572afb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchRootResource.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import java.util.Arrays;
-import java.util.Iterator;
-
-/**
- * An IWorkbenchAdapter implementation for IWorkspaceRoot objects.
- */
-public class WorkbenchRootResource extends WorkbenchAdapter {
-/**
- * @see IWorkbenchAdapter#getChildren
- * Returns the children of the root resource.
- */
-public Object[] getChildren(Object o) {
- IWorkspaceRoot root = (IWorkspaceRoot) o;
- return root.getProjects();
-}
-/**
- * @see IWorkbenchAdapter#getImageDescriptor
- */
-public ImageDescriptor getImageDescriptor(Object object) {
- return null;
-}
-/**
- * Returns the name of this element. This will typically
- * be used to assign a label to this object when displayed
- * in the UI.
- */
-public String getLabel(Object o) {
- //root resource has no name
- return WorkbenchMessages.getString("Workspace"); //$NON-NLS-1$
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchStatus.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchStatus.java
deleted file mode 100644
index bb7372d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchStatus.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import java.util.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * UI manfestation of a status object.
- */
-public class WorkbenchStatus extends WorkbenchAdapter implements IAdaptable {
- private IStatus status;
- private Object[] children;
-public WorkbenchStatus(IStatus status) {
- this.status = status;
-}
-/**
- * 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 Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
-}
-/**
- * Returns the children of this element.
- */
-public Object[] getChildren(Object o) {
- if (children == null) {
- IStatus[] childStatii = status.getChildren();
- children = new Object[childStatii.length];
- for (int i = 0; i < childStatii.length; i++) {
- children[i] = new WorkbenchStatus(childStatii[i]);
- }
- }
- return children;
-}
-/**
- * @see IWorkbenchAdapter#getLabel
- */
-public String getLabel(Object o) {
- return status.getMessage();
-}
-/**
- * Returns the wrapped status object.
- */
-public IStatus getStatus() {
- return status;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchStatusList.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchStatusList.java
deleted file mode 100644
index 6687b6a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchStatusList.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import java.util.*;
-
-public class WorkbenchStatusList extends WorkbenchAdapter implements IAdaptable {
- private ArrayList statii = new ArrayList(10);
-public void add(IStatus status) {
- statii.add(new WorkbenchStatus(status));
-}
-public void clear() {
- statii.clear();
-}
-/**
- * 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 Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
-}
-/**
- * Returns the children of this element.
- */
-public Object[] getChildren(Object o) {
- return statii.toArray();
-}
-public void remove(WorkbenchStatus status) {
- statii.remove(status);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchWorkspace.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchWorkspace.java
deleted file mode 100644
index 59b5c4f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkbenchWorkspace.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.jface.resource.ImageDescriptor;
-import java.util.*;
-
-/**
- * IWorkbenchAdapter adapter for the IWorkspace object.
- */
-public class WorkbenchWorkspace extends WorkbenchAdapter {
-/**
- * @see IWorkbenchAdapter#getChildren
- * Returns the children of the workspace.
- */
-public Object[] getChildren(Object o) {
- IWorkspace workspace = (IWorkspace) o;
- return workspace.getRoot().getProjects();
-}
-/**
- * @see IWorkbenchAdapter#getImageDescriptor
- */
-public ImageDescriptor getImageDescriptor(Object object) {
- return null;
-}
-/**
- * getLabel method comment.
- */
-public String getLabel(Object o) {
- //workspaces don't have a name
- return WorkbenchMessages.getString("Workspace"); //$NON-NLS-1$
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkspaceFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkspaceFactory.java
deleted file mode 100644
index 0736f35..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/model/WorkspaceFactory.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.ui.internal.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * The ResourceFactory is used to save and recreate an IResource object.
- * As such, it implements the IPersistableElement interface for storage
- * and the IElementFactory interface for recreation.
- *
- * @see IMemento
- * @see IPersistableElement
- * @see IElementFactory
- */
-public class WorkspaceFactory implements IElementFactory, IPersistableElement {
- private static final String FACTORY_ID = "org.eclipse.ui.internal.model.WorkspaceFactory";//$NON-NLS-1$
-/**
- * Create a ResourceFactory. This constructor is typically used
- * for our IElementFactory side.
- */
-public WorkspaceFactory() {
-}
-/**
- * @see IElementFactory
- */
-public IAdaptable createElement(IMemento memento) {
- return ResourcesPlugin.getWorkspace();
-}
-/**
- * @see IPersistableElement.
- */
-public String getFactoryId() {
- return FACTORY_ID;
-}
-/**
- * @see IPersistableElement
- */
-public void saveState(IMemento memento) {
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Accelerator.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Accelerator.java
deleted file mode 100644
index 7f6c85c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Accelerator.java
+++ /dev/null
@@ -1,146 +0,0 @@
-package org.eclipse.ui.internal.registry;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.SWT;
-
-/**
- * Captures the attributes of a mapping between an accelerator key
- * and an action id. Accelerators may be specific to a locale and/or platform,
- * or they may general accelerators applicable to all platforms and locales. If
- * two accelerators exist, one with locale and/or platform of "all", and the other
- * with a more specific locale and/or platform, the more specific accelerator is
- * used.
- */
-public class Accelerator {
- //The id defined in XML
- private String id;
- //The key sequence defined in XML
- private String key;
- //The key sequence after being localized.
- private String text;
- //The locale which this accelerator was defined for.
- private String locale;
- //The platform which this accelerator was defined for.
- private String platform;
- //he key sequence after being converted to ints.
- private int accelerators[][];
-
- public static final String DEFAULT_LOCALE = "all"; //$NON-NLS-1$
- public static final String DEFAULT_PLATFORM = "all"; //$NON-NLS-1$
-
- /**
- * Create an instance of Accelerator and initializes
- * it with its id, key, locale and platform.
- */
- public Accelerator(String id, String key, String locale, String platform) {
- this.id = id;
- this.key = key;
- this.locale = locale;
- this.platform = platform;
-
- if(locale==null)
- this.locale = DEFAULT_LOCALE;
- if(platform==null)
- this.platform = DEFAULT_PLATFORM;
- }
- /**
- * Create an instance of Accelerator and initializes
- * it with its id and accelerator.
- */
- public Accelerator(String id,int accelerator) {
- this(id,null,null,null);
- accelerators = new int[1][];
- accelerators[0] = new int[]{accelerator};
- }
- /**
- * Return this accelerators' id
- */
- public String getId() {
- return id;
- }
- /**
- * Return this accelerators' key or null if none is specified.
- */
- public String getKey() {
- return key;
- }
- /**
- * Return this accelerator's key as a localized String.
- */
- public String getText() {
- if(text != null)
- return text;
- int acc[][] = getAccelerators();
- StringBuffer accBuffer = new StringBuffer();
- for (int i = 0; i < acc.length; i++) {
- int orAcc[] = acc[i];
- for (int j = 0; j < orAcc.length; j++) {
- accBuffer.append(Action.convertAccelerator(orAcc[j]));
- if(j + 1 < orAcc.length)
- accBuffer.append(' ');
- }
- if(i + 1 < acc.length)
- accBuffer.append(", "); //$NON-NLS-1$
- }
- text = new String(accBuffer);
- return text;
- }
- /**
- * Return this accelerators' locale of DEFAULT_LOCALE if none is spefified.
- */
- public String getLocale() {
- return locale;
- }
- /**
- * Return this accelerators' platform of DEFAULT_PLATFORM if none is spefified.
- */
- public String getPlatform() {
- return platform;
- }
- /**
- * Returns an array of array of Integers with all accelerators
- * For example:
- * if an accelerator is specified as Ctrl+X Ctrl+C || Ctrl+Shift+F4
- * the return of this method will be "result = new Integer[2][]".
- * result[0] will have 2 elements: SWT.CTRL | 'X' and SWT.CTRL | 'C'; and
- * result[1] will have 1 element: SWT.CTRL | SWT.SHIFT | SWT.F4.
- */
- public int[][] getAccelerators() {
- if(accelerators == null)
- accelerators = convertAccelerator();
- return accelerators;
- }
- /**
- * Parses the given accelerator text, and converts it to a
- * int[][] (possibly of length 1) of accelerator key codes.
- */
- private int[][] convertAccelerator() {
- List accelerators = new ArrayList(1);
- StringTokenizer orTokenizer = new StringTokenizer(key,"||"); //$NON-NLS-1$
- while (orTokenizer.hasMoreTokens()) {
- List acc = new ArrayList(2);
- StringTokenizer spaceTokenizer = new StringTokenizer(orTokenizer.nextToken());
- while (spaceTokenizer.hasMoreTokens()) {
- int accelerator = Action.convertAccelerator(spaceTokenizer.nextToken());
- acc.add(new Integer(accelerator));
- }
- int result[] = new int[acc.size()];
- for (int i = 0; i < result.length; i++) {
- result[i] = ((Integer)acc.get(i)).intValue();
- }
- accelerators.add(result);
- }
- int result[][] = new int[accelerators.size()][];
- accelerators.toArray(result);
- return result;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorConfiguration.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorConfiguration.java
deleted file mode 100644
index 7899e0d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorConfiguration.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.ui.internal.registry;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.IWorkbenchConstants;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-/**
- * An accelerator configuration represents a collection of accelerator key to
- * action id mappings. Accelerators belong to accelerator sets. Each
- * accelerator set is assigned to a certain accelerator configurations.
- */
-public class AcceleratorConfiguration {
- private String id;
- private String name;
- private String description;
- private String parentConfigurationString;
- private AcceleratorConfiguration parentConfiguration;
- /**
- * Create an instance of AcceleratorConfiguration and initializes
- * it with its id, name and description.
- */
- public AcceleratorConfiguration(String id, String name, String description) {
- this.id = id;
- this.name = name;
- this.description = description;
- }
- /**
- * Return this configuration's id.
- */
- public String getId() {
- return id;
- }
- /**
- * Return this configuration's name.
- */
- public String getName() {
- return name;
- }
-
- public AcceleratorConfiguration getParentConfiguration() {
- if(id.equals(IWorkbenchConstants.DEFAULT_ACCELERATOR_CONFIGURATION_ID))
- return null;
- AcceleratorRegistry registry = WorkbenchPlugin.getDefault().getAcceleratorRegistry();
- if(parentConfiguration == null) {
- parentConfiguration = registry.getConfiguration(parentConfigurationString);
- if(parentConfiguration == null)
- parentConfiguration = registry.getConfiguration(IWorkbenchConstants.DEFAULT_ACCELERATOR_CONFIGURATION_ID);
- }
- return parentConfiguration;
- }
-
- /**
- * Return this configuration's description.
- */
- public String getDescription() {
- return description;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorRegistry.java
deleted file mode 100644
index 5ec61c50..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorRegistry.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package org.eclipse.ui.internal.registry;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.Collator;
-import java.util.*;
-
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IPluginPrerequisite;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.ui.internal.IWorkbenchConstants;
-
-/**
- * Provides access to a list of accelerator configurations, a list
- * of accelerator scopes, and a list of accelerator sets.
- */
-public class AcceleratorRegistry {
- //All registered AcceleratorConfiguration(s).
- private List configurations;
- //All registered AcceleratorScope(s).
- private List scopes;
- //All registered AcceleratorSet(s).
- private List sets;
- //All registered actions without definitions.
- private List fakeAccelerators;
- //Maps AcceleratorScope's ids to AcceleratorScope
- private HashMap idToScope;
- /**
- * Create an instance of AcceleratorRegistry and initializes it.
- */
- public AcceleratorRegistry() {
- configurations = new ArrayList();
- scopes = new ArrayList();
- sets = new ArrayList();
- fakeAccelerators = new ArrayList();
- }
-
- public List getAcceleratorSets() {
- return sets;
- }
-
- /**
- * Adds the given accelerator configuration to the registry.
- */
- public boolean addConfiguration(AcceleratorConfiguration a) {
- return configurations.add(a);
- }
- /**
- * Returns all registered configurations.
- */
- public AcceleratorConfiguration[] getConfigurations() {
- AcceleratorConfiguration[] result = new AcceleratorConfiguration[configurations.size()];
- configurations.toArray(result);
- return result;
- }
- /**
- * Returns all registered configurations.
- */
- public AcceleratorConfiguration getConfiguration(String id) {
- for (Iterator iterator = configurations.iterator(); iterator.hasNext();) {
- AcceleratorConfiguration element = (AcceleratorConfiguration)iterator.next();
- if(element.getId().equals(id))
- return element;
- }
- return null;
- }
- /**
- * Adds the given accelerator scope to the registry.
- */
- public boolean addScope(AcceleratorScope a) {
- return scopes.add(a);
- }
- /**
- * Returns all registered scopes.
- */
- public AcceleratorScope[] getScopes() {
- AcceleratorScope[] result = new AcceleratorScope[scopes.size()];
- scopes.toArray(result);
- return result;
- }
- /**
- * Adds the given accelerator set to the registry.
- */
- public boolean addSet(AcceleratorSet a) {
- return sets.add(a);
- }
- /**
- * Finds the set with the specified configuration, scope and plugin Ids and
- * return it.
- *
- * @return an AcceleratorSet or null
- */
- public AcceleratorSet getSet(String configId, String scopeId,String pluginId) {
- for (Iterator iterator = sets.iterator(); iterator.hasNext();) {
- AcceleratorSet set = (AcceleratorSet) iterator.next();
- if(set.getConfigurationId().equals(configId) &&
- set.getScopeId().equals(scopeId) &&
- set.getPluginId().equals(pluginId))
- return set;
- }
- return null;
- }
- /**
- * Loads the accelerator registry from the platform's
- * plugin registry.
- */
- public void load() {
- AcceleratorRegistryReader reader =
- new AcceleratorRegistryReader();
- reader.read(Platform.getPluginRegistry(), this);
- }
- /**
- * Queries the given accelerator configuration and scope to find accelerators
- * which belong to both. Returns a mapping between action definition ids and
- * accelerator keys representing these accelerators.
- *
- * @param configId the accelerator configuration to be queried
- * @param scopeId the accelerator scope to be queried
- */
- public Accelerator[] getAccelerators(String configId, String scopeId) {
- List accelarators = new ArrayList();
- List matchingList = new ArrayList();
- if(scopeId.equals(IWorkbenchConstants.DEFAULT_ACCELERATOR_SCOPE_ID))
- accelarators.addAll(getFakeAccelerators());
- for(int i=0;i<sets.size();i++) {
- AcceleratorSet set = (AcceleratorSet)(sets.get(i));
- String setConfigId = set.getConfigurationId();
- String setScopeId = set.getScopeId();
- if(configId.equals(setConfigId) && setScopeId.equals(setScopeId)) {
- matchingList.add(set);
- }
- }
- AcceleratorSet matchingSets[] = new AcceleratorSet[matchingList.size()];
- matchingList.toArray(matchingSets);
- sortSets(matchingSets);
- for (int i = 0; i < matchingSets.length; i++) {
- accelarators.addAll(Arrays.asList(matchingSets[i].getAccelerators()));
- }
- Accelerator[] result = new Accelerator[accelarators.size()];
- accelarators.toArray(result);
- return result;
- }
- /*
- * Sort the AcceleratorSets according to the plugin they are defined in.
- * If plugin A requeres B. A comes first.
- * If plugin A does not requere B they are sorted by id.
- */
- private void sortSets(AcceleratorSet matchingSets[]) {
- final IPluginRegistry registry = Platform.getPluginRegistry();
- Arrays.sort(matchingSets,new Comparator() {
- public int compare(Object o1, Object o2) {
- String plug1 = ((AcceleratorSet)o1).getPluginId();
- String plug2 = ((AcceleratorSet)o2).getPluginId();
- IPluginDescriptor desc1 = registry.getPluginDescriptor(plug1);
- IPluginDescriptor desc2 = registry.getPluginDescriptor(plug2);
- if(dependsOn(registry,desc1,desc2))
- return 1;
- else if(dependsOn(registry,desc1,desc2))
- return -1;
- return plug2.compareTo(plug1);
- }
- });
- }
- private boolean dependsOn(IPluginRegistry registry,IPluginDescriptor descriptor0, IPluginDescriptor descriptor1) {
- IPluginPrerequisite[] prerequisites= descriptor0.getPluginPrerequisites();
- for (int i= 0; i < prerequisites.length; i++) {
- IPluginPrerequisite prerequisite= prerequisites[i];
- String id= prerequisite.getUniqueIdentifier();
- IPluginDescriptor descriptor= registry.getPluginDescriptor(id);
- if (descriptor != null && (descriptor.equals(descriptor1) || dependsOn(registry,descriptor, descriptor1)))
- return true;
- }
-
- return false;
- }
- /**
- * Returns a List with all actions without definition registered
- * in this registry.
- */
- private List getFakeAccelerators() {
- return fakeAccelerators;
- }
- /**
- * Add a new accelerator to this registry for a action without
- * an action definiton.
- */
- public void addFakeAccelerator(String id,int accelerator) {
- fakeAccelerators.add(new Accelerator(id,accelerator));
- }
- /**
- * Remove all actions without definition from this registry.
- */
- public void clearFakeAccelerators() {
- fakeAccelerators.clear();
- }
- /**
- * Returns a list of all the configurations in the registry for which
- * there are registered accelerator sets.
- */
- public AcceleratorConfiguration[] getConfigsWithSets() {
- List list = new ArrayList();
- for(int i=0; i<configurations.size(); i++) {
- AcceleratorConfiguration config = (AcceleratorConfiguration)configurations.get(i);
- String configId = config.getId();
- for(int j=0; j<sets.size(); j++) {
- AcceleratorSet set = (AcceleratorSet)sets.get(j);
- if(configId.equals(set.getConfigurationId())) {
- list.add(config);
- break;
- }
- }
- // temporary hack until some sets are registered with default configuration
- if(configId.equals(IWorkbenchConstants.DEFAULT_ACCELERATOR_CONFIGURATION_ID))
- list.add(config);
- }
- AcceleratorConfiguration result[] = new AcceleratorConfiguration[list.size()];
- list.toArray(result);
- return result;
- }
- /**
- * Returns the scope associated to the specified id or null if
- * none is found.
- */
- public AcceleratorScope getScope(String scopeID) {
- if(idToScope == null) {
- idToScope = new HashMap();
- AcceleratorScope scopes[] = getScopes();
- for (int i = 0; i < scopes.length; i++) {
- AcceleratorScope s = scopes[i];
- idToScope.put(s.getId(),s);
- }
- }
- return (AcceleratorScope)idToScope.get(scopeID);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorRegistryReader.java
deleted file mode 100644
index 6283ccc..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorRegistryReader.java
+++ /dev/null
@@ -1,260 +0,0 @@
-package org.eclipse.ui.internal.registry;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Locale;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.core.runtime.IPluginRegistry;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-
-/**
- * This class is used to read accelerator configurations, accelerator scopes,
- * and accelerator sets (as well as the accelerators they contain, in certain cases)
- * from the platform registry and stores them in the accelerator registry. An
- * accelerator set's accelerators are only read if the set belongs to the active
- * accelerator configuration or the default accelerator configuration.
- */
-public class AcceleratorRegistryReader extends RegistryReader{
- private static final String TAG_ACCEL_CONFIG = "acceleratorConfiguration"; //$NON-NLS-1$
- private static final String TAG_ACCEL_SCOPE = "acceleratorScope"; //$NON-NLS-1$
- private static final String TAG_ACCEL_SET = "acceleratorSet"; //$NON-NLS-1$
- private static final String TAG_ACCELERATOR = "accelerator"; //$NON-NLS-1$
-
- private static final String CONFIG_ATT_ID = "id"; //$NON-NLS-1$
- private static final String CONFIG_ATT_NAME = "name"; //$NON-NLS-1$
- private static final String CONFIG_ATT_DESCRIPTION = "description"; //$NON-NLS-1$
-
- private static final String SCOPE_ATT_ID = "id"; //$NON-NLS-1$
- private static final String SCOPE_ATT_NAME = "name"; //$NON-NLS-1$
- private static final String SCOPE_ATT_DESCRIPTION = "description"; //$NON-NLS-1$
- private static final String SCOPE_ATT_PARENT_SCOPE = "parentScope"; //$NON-NLS-1$
-
- private static final String SET_ATT_CONFIG_ID = "configurationId"; //$NON-NLS-1$
- private static final String SET_ATT_SCOPE_ID = "scopeId"; //$NON-NLS-1$
-
- private static final String ACCEL_ATT_ID = "id"; //$NON-NLS-1$
- private static final String ACCEL_ATT_KEY = "key"; //$NON-NLS-1$
- private static final String ACCEL_ATT_LOCALE = "locale"; //$NON-NLS-1$
- private static final String ACCEL_ATT_PLATFORM = "platform"; //$NON-NLS-1$
-
- private static final String PLATFORM = SWT.getPlatform();
- private static final String EMPTY = ""; //$NON-NLS-1$
-
- private AcceleratorRegistry acceleratorRegistry;
- private AcceleratorSet acceleratorSet;
-
- /* (non-Javadoc)
- * Method declared in RegistryReader.
- */
- protected boolean readElement(IConfigurationElement element) {
- String name = element.getName();
- if (name.equals(TAG_ACCEL_CONFIG))
- return readConfiguration(element);
- if (name.equals(TAG_ACCEL_SCOPE))
- return readScope(element);
- if (name.equals(TAG_ACCEL_SET))
- return readSet(element);
- if (name.equals(TAG_ACCELERATOR))
- return readAccelerator(element);
- return false;
- }
-
- /**
- * Reads an element if it is an acclerator configuration, and stores it in
- * the accelerator registry.
- */
- private boolean readConfiguration(IConfigurationElement element) {
- String id = element.getAttribute(CONFIG_ATT_ID);
- String name = element.getAttribute(CONFIG_ATT_NAME);
- String description = element.getAttribute(CONFIG_ATT_DESCRIPTION);
-
- if (id==null) {
- logMissingAttribute(element, CONFIG_ATT_ID);
- }
- if (name==null) {
- logMissingAttribute(element, CONFIG_ATT_NAME);
- }
- if (description==null) {
- logMissingAttribute(element, CONFIG_ATT_DESCRIPTION);
- }
-
- AcceleratorConfiguration a = new AcceleratorConfiguration(id, name, description);
- acceleratorRegistry.addConfiguration(a);
- return true;
- }
-
- /**
- * Reads an element if it is an acclerator scope, and stores it in
- * the accelerator registry.
- */
- private boolean readScope(IConfigurationElement element) {
- String id = element.getAttribute(SCOPE_ATT_ID);
- String name = element.getAttribute(SCOPE_ATT_NAME);
- String description = element.getAttribute(SCOPE_ATT_DESCRIPTION);
- String parentScope = element.getAttribute(SCOPE_ATT_PARENT_SCOPE);
-
- if (id==null) {
- logMissingAttribute(element, SCOPE_ATT_ID);
- }
- if (name==null) {
- logMissingAttribute(element, SCOPE_ATT_NAME);
- }
- if (description==null) {
- logMissingAttribute(element, SCOPE_ATT_DESCRIPTION);
- }
-
- AcceleratorScope a = new AcceleratorScope(id, name, description, parentScope);
- acceleratorRegistry.addScope(a);
- return true;
- }
-
- /**
- * Reads an element if it is an acclerator set, and stores it in
- * the accelerator registry. If the set belongs to the active or
- * default accelerator configuration, the set's accelerators are
- * also read and stored in the accelerator registry.
- */
- private boolean readSet(IConfigurationElement element) {
- String configurationId = element.getAttribute(SET_ATT_CONFIG_ID);
- String scopeId = element.getAttribute(SET_ATT_SCOPE_ID);
-
- if (configurationId==null) {
- logMissingAttribute(element, SET_ATT_CONFIG_ID);
- }
- if (scopeId==null) {
- logMissingAttribute(element, SET_ATT_SCOPE_ID);
- }
-
- String pluginId = element.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier();
- acceleratorSet = acceleratorRegistry.getSet(configurationId,scopeId,pluginId);
- if(acceleratorSet == null) {
- acceleratorSet = new AcceleratorSet(configurationId, scopeId, pluginId);
- acceleratorRegistry.addSet(acceleratorSet);
- }
- readElementChildren(element);
- return true;
- }
- /*
- * Reads an element if it is an accelerator, and stores it in it's accelerator
- * set in the accelerator registry.
- */
- private boolean readAccelerator(IConfigurationElement element) {
- String id = element.getAttribute(ACCEL_ATT_ID);
- String key = element.getAttribute(ACCEL_ATT_KEY);
- String locale = element.getAttribute(ACCEL_ATT_LOCALE);
- String platform = element.getAttribute(ACCEL_ATT_PLATFORM);
-
- if (id==null) {
- logMissingAttribute(element, ACCEL_ATT_ID);
- }
- if (key==null) {
- logMissingAttribute(element, ACCEL_ATT_KEY);
- }
- Accelerator oldAcc = acceleratorSet.getAccelerator(id);
- Accelerator newAcc = new Accelerator(id, key, locale, platform);
- int newAccMatchValue = computeValue(newAcc);
- if(newAccMatchValue < 0)
- return true;
- if(oldAcc == null) {
- acceleratorSet.add(newAcc);
- } else {
- int oldAccMatchValue = computeValue(oldAcc);
- if(oldAccMatchValue < newAccMatchValue) {
- acceleratorSet.removeAccelerator(oldAcc);
- acceleratorSet.add(newAcc);
- }
- }
- return true;
- }
- /*
- * Return a value representing how well acc has match platform and locale.
- * Return -1 if acc should not be include in the current platform, ie, if the
- * platform and/or locale are specified and don't match.
- * Return a number between 0 and 7 if platform and/or locale match.
- */
- private int computeValue(Accelerator acc) {
- int result = 0;
- Locale defaultLocale = Locale.getDefault();
- if(defaultLocale.toString().equals(acc.getLocale())) {
- result = result + 3;
- } else {
- String[] localeArray = parseLocale(acc.getLocale());
- //Language
- if(localeArray[0].equals(defaultLocale.getLanguage()))
- result++;
- else if(localeArray[0] != EMPTY)
- return -1;
- //Country
- if(localeArray[1].equals(defaultLocale.getCountry()))
- result++;
- else if(localeArray[1] != EMPTY)
- return -1;
- //Variant
- if(localeArray[2].equals(defaultLocale.getVariant()))
- result++;
- else if(localeArray[2] != EMPTY)
- return -1;
- }
- //Platform
- if(PLATFORM.equals(acc.getPlatform()))
- result = result + 4;
- else if(!Accelerator.DEFAULT_PLATFORM.equals(acc.getPlatform()))
- return -1;
- return result;
- }
- /*
- * Return a new String[3]{language,country,variant}
- */
- private String[] parseLocale(String locale) {
- //Parse language
- String localeArray[] = {EMPTY,EMPTY,EMPTY};
- if(Accelerator.DEFAULT_LOCALE.equals(locale))
- return localeArray;
-
- int index = locale.indexOf("_"); //$NON-NLS-1$
- if(index < 0) {
- localeArray[0] = locale;
- return localeArray;
- } else if(index >= 0) {
- localeArray[0] = locale.substring(0,index);
- }
- if(index + 1 >= locale.length())
- return localeArray;
- //Parse country
- int newIndex = locale.indexOf("_",index + 1); //$NON-NLS-1$
- if(newIndex < 0) {
- localeArray[1] = locale.substring(index + 1);
- return localeArray;
- } else if(newIndex > 0) {
- localeArray[1] = locale.substring(index + 1,newIndex);
- }
- index = newIndex;
- if(index + 1 >= locale.length())
- return localeArray;
- //Parse variant
- newIndex = locale.indexOf("_",index + 1); //$NON-NLS-1$
- if(newIndex < 0) {
- localeArray[2] = locale.substring(index + 1);
- return localeArray;
- } else if(newIndex > 0) {
- localeArray[2] = locale.substring(index + 1,newIndex);
- }
- return localeArray;
- }
- /**
- * Reads from the plugin registry and stores results in the accelerator
- * registry.
- */
- public void read(IPluginRegistry registry, AcceleratorRegistry out) {
- acceleratorRegistry = out;
- readRegistry(registry, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_ACCELERATOR_CONFIGURATIONS);
- readRegistry(registry, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_ACCELERATOR_SCOPES);
- readRegistry(registry, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_ACCELERATOR_SETS);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorScope.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorScope.java
deleted file mode 100644
index 7744f63..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorScope.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.eclipse.ui.internal.registry;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-import java.util.HashMap;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.ui.internal.*;
-
-/**
- * An accelerator scope is a range in which a given accelerator (a mapping
- * between an accelerator key and an action id) is available.
- * A scope may represent a view, editor, a page of a multi-page editor, etc.
- * An accelerator is available when the part represented by its scope is active.
- */
-public class AcceleratorScope {
- private String id;
- private String name;
- private String description;
- private String parentScopeString;
- private AcceleratorScope parentScope;
-
- /**
- * Create an instance of AcceleratorScope and initializes
- * it with its id, name, description and parent scope.
- */
- public AcceleratorScope(String id, String name, String description, String parentScope) {
- this.id = id;
- this.name = name;
- this.description = description;
- this.parentScopeString = parentScope;
- if(parentScope==null)
- this.parentScopeString = IWorkbenchConstants.DEFAULT_ACCELERATOR_SCOPE_ID;
- }
- /**
- * Return this scope's id
- */
- public String getId() {
- return id;
- }
- /**
- * Return this scope's name
- */
- public String getName() {
- return name;
- }
- /**
- * Return this scope's description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Returns the parent scope of the current scope. For example, if the current
- * scope is that of a page of a multi-page editor, the parent scope would be
- * the scope of the editor.
- */
- public AcceleratorScope getParentScope() {
- if(id.equals(IWorkbenchConstants.DEFAULT_ACCELERATOR_SCOPE_ID))
- return null;
- AcceleratorRegistry registry = WorkbenchPlugin.getDefault().getAcceleratorRegistry();
- if(parentScope == null) {
- parentScope = registry.getScope(parentScopeString);
- if(parentScope == null)
- parentScope = registry.getScope(IWorkbenchConstants.DEFAULT_ACCELERATOR_SCOPE_ID);
- }
- return parentScope;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorSet.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorSet.java
deleted file mode 100644
index 7e44154..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/AcceleratorSet.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.ui.internal.registry;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.HashSet;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-
-/**
- * A set of mappings between an accelerator key and an action id.
- */
-public class AcceleratorSet {
- private String configurationId;
- private String scopeId;
- private String pluginId;
- private String pluginVersion;
- private HashSet accelerators;
- /**
- * Create an instance of AcceleratorSet and initializes
- * it with its configuration id, scope id and plugin id.
- */
- public AcceleratorSet(String configurationId, String scopeId, String pluginId) {
- this.configurationId = configurationId;
- this.scopeId = scopeId;
- this.pluginId = pluginId;
- accelerators = new HashSet();
- }
- /**
- * Returns this AcceleratorSet's configuration id.
- */
- public String getConfigurationId() {
- return configurationId;
- }
- /**
- * Returns this AcceleratorSet's scope id.
- */
- public String getScopeId() {
- return scopeId;
- }
- /**
- * Returns this AcceleratorSet's plugin id.
- */
- public String getPluginId() {
- return pluginId;
- }
- /**
- * Returns an array with all accelerators defined in this set.
- */
- public Accelerator[] getAccelerators() {
- Accelerator[] result = new Accelerator[accelerators.size()];
- accelerators.toArray(result);
- return result;
- }
- /**
- * Adds the given accelerator to the set.
- */
- public boolean add(Accelerator a) {
- return accelerators.add(a);
- }
- /**
- * Find and return an accelerator with the specified id.
- *
- * @return Accelerator or null.
- */
- public Accelerator getAccelerator(String id) {
- for (Iterator iterator = accelerators.iterator(); iterator.hasNext();) {
- Accelerator acc = (Accelerator) iterator.next();
- if(acc.getId().equals(id))
- return acc;
- }
- return null;
- }
- /**
- * Remove the specified Accelerator from this set.
- */
- public void removeAccelerator(Accelerator acc) {
- accelerators.remove(acc);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionDefinition.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionDefinition.java
deleted file mode 100644
index b97b14d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionDefinition.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.ui.internal.registry;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * Captures the attributes of an action definition.
- */
-public class ActionDefinition {
- private String id;
- private String label;
- private String icon;
- private String menubarPath;
- private String toolbarPath;
- private String toolTip;
- private String helpContextId;
- private String state;
- /**
- * Create an instance of Accelerator and initializes
- * it with its id, label, icon and menupath.
- */
- public ActionDefinition(String id, String label, String icon, String menubarPath,
- /* Note:
- * This implementation is using only the id.
- */
- String toolbarPath, String tooltip, String helpContextId, String state) {
- this.id = id;
- this.label = label;
- this.icon = icon;
- this.menubarPath = menubarPath;
- this.toolbarPath = toolbarPath;
- this.toolTip = tooltip;
- this.helpContextId = helpContextId;
- this.state = state;
- }
- /**
- * Return this definition's id.
- */
- public String getId() {
- return id;
- }
- /**
- * Return this definition's label.
- */
- public String getLabel() {
- return label;
- }
- /**
- * Return this definition's icon name.
- */
- public String getIcon() {
- return icon;
- }
- /**
- * Return this definition's menu path.
- */
- public String getMenubarPath() {
- return menubarPath;
- }
- /**
- * Return this definition's tool bar path.
- */
- public String getToolbarPath() {
- return toolbarPath;
- }
- /**
- * Return this definition's tooltip.
- */
- public String getToolTip() {
- return toolTip;
- }
- /**
- * Return this definition's help context id.
- */
- public String getHelpContextId() {
- return helpContextId;
- }
- /**
- * Return this definition's state.
- */
- public String getState() {
- return state;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionDefinitionRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionDefinitionRegistry.java
deleted file mode 100644
index 314b0eb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionDefinitionRegistry.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.ui.internal.registry;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-
-/**
- * Provides access to a list of action defintions.
- */
-public class ActionDefinitionRegistry {
- private List actionDefinitions;
- /**
- * Create an instance of Accelerator and initializes it.
- */
- public ActionDefinitionRegistry() {
- actionDefinitions = new ArrayList();
- }
- /**
- * Adds an action definition to the registry.
- */
- public boolean add(ActionDefinition a) {
- return actionDefinitions.add(a);
- }
- /**
- * Returns the action definition with the same ID;
- */
- public ActionDefinition getDefinition(String id) {
- for (Iterator iterator = actionDefinitions.iterator(); iterator.hasNext();) {
- ActionDefinition element = (ActionDefinition)iterator.next();
- if(element.getId().equals(id))
- return element;
- }
- return null;
- }
- /**
- * Loads the action definition registry from the platform's plugin registry.
- */
- public void load() {
- ActionDefinitionRegistryReader reader = new ActionDefinitionRegistryReader();
- reader.readActionDefinitions(Platform.getPluginRegistry(), this);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionDefinitionRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionDefinitionRegistryReader.java
deleted file mode 100644
index 0286e64..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionDefinitionRegistryReader.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.ui.internal.registry;
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-
-/**
- * This class is used to read action definitions from the platform registry.
- * Action definitions are stored in an ActionDefinitionRegistry once read.
- */
-public class ActionDefinitionRegistryReader extends RegistryReader {
- private static final String TAG_ACTION_DEF = "actionDefinition"; //$NON-NLS-1$
- private static final String ATT_ID = "id"; //$NON-NLS-1$
- private static final String ATT_LABEL = "label"; //$NON-NLS-1$
- private static final String ATT_ICON = "icon"; //$NON-NLS-1$
- private static final String ATT_MENUBAR_PATH = "menubarPath"; //$NON-NLS-1$
- private static final String ATT_TOOLBAR_PATH = "toolbarPath"; //$NON-NLS-1$
- private static final String ATT_TOOLTIP = "tooltip"; //$NON-NLS-1$
- private static final String ATT_HELP_CONTEXT_ID = "helpContextId"; //$NON-NLS-1$
- private static final String ATT_STATE = "state"; //$NON-NLS-1$
-
- private ActionDefinitionRegistry actionDefinitions;
-
- /* (non-Javadoc)
- * Method declared in RegistryReader.
- */
- protected boolean readElement(IConfigurationElement element) {
- if (!element.getName().equals(TAG_ACTION_DEF))
- return false;
- String id = element.getAttribute(ATT_ID);
- String label = element.getAttribute(ATT_LABEL);
- String icon = element.getAttribute(ATT_ICON);
- String menubarPath = element.getAttribute(ATT_MENUBAR_PATH);
- String toolbarPath = element.getAttribute(ATT_TOOLBAR_PATH);
- String tooltip = element.getAttribute(ATT_TOOLTIP);
- String helpContextId = element.getAttribute(ATT_HELP_CONTEXT_ID);
- String state = element.getAttribute(ATT_STATE);
-
- if (id==null) {
- logMissingAttribute(element, ATT_ID);
- }
- if (label==null) {
- logMissingAttribute(element, ATT_LABEL);
- }
- if (tooltip==null) {
- logMissingAttribute(element, ATT_TOOLTIP);
- }
- if (helpContextId==null) {
- logMissingAttribute(element, ATT_HELP_CONTEXT_ID);
- }
-
- ActionDefinition a = new ActionDefinition(id, label, icon, menubarPath,
- toolbarPath, tooltip, helpContextId, state);
- actionDefinitions.add(a);
- return true;
- }
-
- /**
- * Reads the action definition extensions within the plugin registry and stores
- * the results in the action definition registry.
- */
- public void readActionDefinitions(IPluginRegistry registry, ActionDefinitionRegistry out) {
- actionDefinitions = out;
- readRegistry(registry, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_ACTION_DEFINITIONS);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetCategory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetCategory.java
deleted file mode 100644
index 7a1753c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetCategory.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import java.util.ArrayList;
-
-/**
- *
- */
-public class ActionSetCategory {
- private String id;
- private String label;
- private ArrayList actionSets;
-/**
- * ActionSetCategory constructor comment.
- */
-public ActionSetCategory(String id, String label) {
- super();
- this.id = id;
- this.label = label;
-}
-/**
- * Adds an action set to this category.
- */
-public void addActionSet(IActionSetDescriptor desc) {
- if (actionSets == null)
- actionSets = new ArrayList(5);
- actionSets.add(desc);
- desc.setCategory(id);
-}
-/**
- * Returns the action sets for this category.
- * May be null.
- */
-public ArrayList getActionSets() {
- return actionSets;
-}
-/**
- * Returns category id.
- */
-public String getId() {
- return id;
-}
-/**
- * Returns category name.
- */
-public String getLabel() {
- return label;
-}
-}
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
deleted file mode 100644
index 430a3d7..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetDescriptor.java
+++ /dev/null
@@ -1,148 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.PluginActionSet;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.PluginActionSetReader;
-import org.eclipse.ui.internal.model.WorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * ActionSetDescriptor
- */
-public class ActionSetDescriptor extends WorkbenchAdapter
- implements IActionSetDescriptor, IAdaptable
-{
- private String id;
- private String label;
- private String category;
- private boolean visible;
- private String description;
- private String className;
- private IConfigurationElement configElement;
- private static final String ATT_ID="id";//$NON-NLS-1$
- private static final String ATT_LABEL="label";//$NON-NLS-1$
- private static final String ATT_VISIBLE="visible";//$NON-NLS-1$
- private static final String ATT_DESC="description";//$NON-NLS-1$
-/**
- * Create a descriptor from a config element.
- */
-public ActionSetDescriptor(IConfigurationElement configElement)
- throws CoreException
-{
- super();
- this.configElement = configElement;
- id = configElement.getAttribute(ATT_ID);
- label = configElement.getAttribute(ATT_LABEL);
- description = configElement.getAttribute(ATT_DESC);
- String str = configElement.getAttribute(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
- */
-public IActionSet createActionSet()
- throws CoreException
-{
- 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.
- */
-public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- return null;
-}
-/**
- * Returns the category of this action set.
- *
- * @return a non-empty category name or <cod>null</code> if none specified
- */
-public String getCategory() {
- return category;
-}
-/**
- * @see IWorkbenchAdapter#getChildren
- */
-public Object[] getChildren(Object o) {
- if (o == this)
- return (new PluginActionSetReader()).readActionDescriptors(this);
-
- return NO_CHILDREN;
-}
-/**
- * Returns the config element
- */
-public IConfigurationElement getConfigElement() {
- return configElement;
-}
-/**
- * Returns this action set's description.
- * This is the value of its <code>"description"</code> attribute.
- *
- * @return the description
- */
-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
- */
-public String getId() {
- return id;
-}
-/**
- * Returns this action set's label.
- * This is the value of its <code>"label"</code> attribute.
- *
- * @return the label
- */
-public String getLabel() {
- return label;
-}
-/**
- * @see IWorkbenchAdapter#getLabel
- */
-public String getLabel(Object o) {
- if (o == this)
- return getLabel();
- return "Unknown Label";//$NON-NLS-1$
-}
-/**
- * Returns whether this action set is initially visible.
- */
-public boolean isInitiallyVisible() {
- return visible;
-}
-/**
- * Sets the category of this action set.
- *
- * @param cat a non-empty category id
- */
-public void setCategory(String id) {
- category = id;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetPartAssociationsReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetPartAssociationsReader.java
deleted file mode 100644
index eb63c4d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetPartAssociationsReader.java
+++ /dev/null
@@ -1,73 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.*;
-
-/**
- * A strategy to read action set part association extension from the registry.
- */
-public class ActionSetPartAssociationsReader extends RegistryReader {
- private ActionSetRegistry registry;
- private static final String TAG_EXTENSION="actionSetPartAssociation";//$NON-NLS-1$
- private static final String TAG_PART="part";//$NON-NLS-1$
- private static final String ATT_ID="id";//$NON-NLS-1$
- private static final String ATT_TARGET_ID="targetID";//$NON-NLS-1$
-
-/**
- * Creates a new reader.
- */
-public ActionSetPartAssociationsReader() {
- super();
-}
-
-/**
- * Process an extension.
- */
-private boolean processExtension(IConfigurationElement element) {
- String actionSetId = element.getAttribute(ATT_TARGET_ID);
- IConfigurationElement [] children = element.getChildren();
- for (int i = 0; i < children.length; i++) {
- IConfigurationElement child = children[i];
- String type = child.getName();
- if (type.equals(TAG_PART)) {
- String partId = child.getAttribute(ATT_ID);
- if (partId != null)
- registry.addAssociation(actionSetId, partId);
- } else {
- WorkbenchPlugin.log("Unable to process element: " +//$NON-NLS-1$
- type +
- " in action set part associations extension: " +//$NON-NLS-1$
- element.getDeclaringExtension().getUniqueIdentifier());
- }
- }
- return true;
-}
-
-/**
- * Reads the given element.
- */
-protected boolean readElement(IConfigurationElement element) {
- String type = element.getName();
- if (type.equals(TAG_EXTENSION)) {
- return processExtension(element);
- }
- return false;
-}
-
-/**
- * Read the association extensions within a registry.
- */
-public void readRegistry(IPluginRegistry in, ActionSetRegistry out)
-{
- registry = out;
- readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_ACTION_SET_PART_ASSOCIATIONS);
-}
-}
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
deleted file mode 100644
index da0f938..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetRegistry.java
+++ /dev/null
@@ -1,153 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.model.WorkbenchAdapter;
-import java.util.*;
-
-/**
- * The registry of action set extensions.
- */
-public class ActionSetRegistry extends Object
-{
- public static final String OTHER_CATEGORY = "org.eclipse.ui.actionSetCategory";//$NON-NLS-1$
- private ArrayList children = new ArrayList();
- private ArrayList categories = new ArrayList(1);
- private Map mapPartToActionSets = new HashMap();
-
-/**
- * Creates the action set registry.
- */
-public ActionSetRegistry() {
- super();
- readFromRegistry();
-}
-/**
- * Adds an action set.
- */
-public void addActionSet(ActionSetDescriptor desc) {
- children.add(desc);
-}
-/**
- * Adds an association between an action set an a part.
- */
-public void addAssociation(String actionSetId, String partId) {
- // get the action set ids for this part
- ArrayList actionSets = (ArrayList)mapPartToActionSets.get(partId);
- if (actionSets == null) {
- actionSets = new ArrayList();
- mapPartToActionSets.put(partId, actionSets);
- }
- // get the action set
- IActionSetDescriptor desc = findActionSet(actionSetId);
- if (desc == null) {
- WorkbenchPlugin.log("Unable to associate action set with part: " +//$NON-NLS-1$
- partId + ". Action set " + actionSetId + " not found."); //$NON-NLS-2$ //$NON-NLS-1$
- return;
- }
- // add the action set if it is not already present
- if (!actionSets.contains(desc))
- actionSets.add(desc);
-}
-/**
- * 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 enum = children.iterator();
- while (enum.hasNext()) {
- IActionSetDescriptor desc = (IActionSetDescriptor)enum.next();
- if (desc.getId().equals(id))
- return desc;
- }
- return null;
-}
-/**
- * Find a category with a given id.
- */
-public ActionSetCategory findCategory(String id) {
- Iterator enum = categories.iterator();
- while (enum.hasNext()) {
- ActionSetCategory cat = (ActionSetCategory) enum.next();
- if (id.equals(cat.getId()))
- return cat;
- }
- return null;
-}
-/**
- * Returns a list of the action sets known to the workbench.
- *
- * @return a list of action sets
- */
-public IActionSetDescriptor[] getActionSets() {
- int count = children.size();
- IActionSetDescriptor [] array = new IActionSetDescriptor[count];
- for (int nX = 0; nX < count; nX ++) {
- array[nX] = (IActionSetDescriptor)children.get(nX);
- }
- return array;
-}
-/**
- * Returns a list of the action sets associated with the given part id.
- *
- * @return a list of action sets
- */
-public IActionSetDescriptor[] getActionSetsFor(String partId) {
- // get the action set ids for this part
- ArrayList actionSets = (ArrayList)mapPartToActionSets.get(partId);
- if (actionSets == null)
- return new IActionSetDescriptor[0];
- return (IActionSetDescriptor[])actionSets.toArray(new IActionSetDescriptor[actionSets.size()]);
-}
-
-/**
- * Returns a list of action set categories.
- *
- * @return a list of action sets categories
- */
-public ActionSetCategory[] getCategories() {
- int count = categories.size();
- ActionSetCategory[] array = new ActionSetCategory[count];
- for (int i = 0; i < count; i++) {
- array[i] = (ActionSetCategory)categories.get(i);
- }
- return array;
-}
-/**
- * Adds each action set in the registry to a particular category.
- * For now, everything goes into the OTHER_CATEGORY.
- */
-public void mapActionSetsToCategories() {
- // Create "other" category.
- ActionSetCategory cat = new ActionSetCategory(OTHER_CATEGORY,
- WorkbenchMessages.getString("ActionSetRegistry.otherCategory")); //$NON-NLS-1$
- categories.add(cat);
-
- // Add everything to it.
- Iterator enum = children.iterator();
- while (enum.hasNext()) {
- IActionSetDescriptor desc = (IActionSetDescriptor) enum.next();
- cat.addActionSet(desc);
- }
-}
-/**
- * Reads the registry.
- */
-public void readFromRegistry() {
- ActionSetRegistryReader reader = new ActionSetRegistryReader();
- reader.readRegistry(Platform.getPluginRegistry(), this);
-
- ActionSetPartAssociationsReader assocReader = new ActionSetPartAssociationsReader();
- assocReader.readRegistry(Platform.getPluginRegistry(), this);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetRegistryReader.java
deleted file mode 100644
index 1466b41..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ActionSetRegistryReader.java
+++ /dev/null
@@ -1,51 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.misc.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.*;
-
-/**
- * A strategy to read view extensions from the registry.
- */
-public class ActionSetRegistryReader extends RegistryReader {
- private static final String TAG_SET="actionSet";//$NON-NLS-1$
- private ActionSetRegistry registry;
-
-/**
- * RegistryViewReader constructor comment.
- */
-public ActionSetRegistryReader() {
- super();
-}
-/**
- * readElement method comment.
- */
-protected boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(TAG_SET)) {
- try {
- ActionSetDescriptor desc = new ActionSetDescriptor(element);
- registry.addActionSet(desc);
- } 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$
- }
- return true;
- } else {
- return false;
- }
-}
-/**
- * Read the view extensions within a registry.
- */
-public void readRegistry(IPluginRegistry in, ActionSetRegistry out)
-{
- registry = out;
- readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_ACTION_SETS);
- out.mapActionSetsToCategories();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Capability.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Capability.java
deleted file mode 100644
index 9f3ec30..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Capability.java
+++ /dev/null
@@ -1,292 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IProjectNatureDescriptor;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.ui.ICapabilityInstallWizard;
-import org.eclipse.ui.ICapabilityUninstallWizard;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.model.WorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * A capability is the user interface aspect of a project's nature. There is
- * a 1-1 relationship between a capability and a nature. It is possible for
- * a nature to not have a capability, but the opposite is not true - that is,
- * a capability must represent a nature.
- * <p>
- * A capability can take control of the user interface of other capabilities. It
- * is then responsible for collecting the necessary information and adding the
- * natures represented by these capabilites.
- * </p>
- */
-public class Capability extends WorkbenchAdapter implements IAdaptable {
- private static final String ATT_ID = "id"; //$NON-NLS-1$
- private static final String ATT_ICON = "icon"; //$NON-NLS-1$
- private static final String ATT_NATURE_ID = "natureId"; //$NON-NLS-1$
- private static final String ATT_CATEGORY = "category"; //$NON-NLS-1$
- private static final String ATT_DESCRIPTION = "description"; //$NON-NLS-1$
- private static final String ATT_INSTALL_WIZARD = "installWizard"; //$NON-NLS-1$
- private static final String ATT_INSTALL_DETAILS = "installDetails"; //$NON-NLS-1$
- private static final String ATT_UNINSTALL_WIZARD = "uninstallWizard"; //$NON-NLS-1$
- private static final String ATT_UNINSTALL_DETAILS = "uninstallDetails"; //$NON-NLS-1$
-
- private String id;
- private String natureId;
- private IProjectNatureDescriptor natureDescriptor;
- private ImageDescriptor icon;
- private IConfigurationElement element;
- private ArrayList handleUIs;
- private ArrayList perspectiveChoices;
-
- /**
- * Creates an instance of <code>Capability</code> using the
- * information provided by the configuration element.
- *
- * @param configElement the <code>IConfigurationElement<code> containing
- * the attributes
- * @param reader the <code>CapabilityRegistryReader<code> used to log missing attributes
- * @throws a <code>WorkbenchException</code> if the ID, nature, or wizard is <code>null</code>
- */
- public Capability(IConfigurationElement configElement, CapabilityRegistryReader reader)
- throws WorkbenchException
- {
- super();
-
- boolean missingAttribute = false;
- String attr_id = configElement.getAttribute(ATT_ID);
- String attr_nature = configElement.getAttribute(ATT_NATURE_ID);
-
- if (attr_id == null) {
- reader.logMissingAttribute(configElement, ATT_ID);
- missingAttribute = true;
- }
- if (attr_nature == null) {
- reader.logMissingAttribute(configElement, ATT_NATURE_ID);
- missingAttribute = true;
- }
- if (configElement.getAttribute(ATT_INSTALL_WIZARD) == null) {
- reader.logMissingAttribute(configElement, ATT_INSTALL_WIZARD);
- missingAttribute = true;
- }
-
- if (missingAttribute)
- throw new WorkbenchException("Capability missing required attributes."); //$NON-NLS-1$
-
- id = attr_id;
- natureId = attr_nature;
- element = configElement;
- natureDescriptor = ResourcesPlugin.getWorkspace().getNatureDescriptor(natureId);
- }
-
- /**
- * Creates an instance of <code>Capability</code> as an unknown one
- * for a given nature id.
- *
- * @param natureId the nature id for the unknown capbility
- */
- public Capability(String natureId) {
- super();
- this.id = natureId;
- this.natureId = natureId;
- }
-
- /**
- * Adds the id of a capability for which this capability handles
- * the user interface.
- */
- public void addHandleUI(String capabilityId) {
- if (handleUIs == null)
- handleUIs = new ArrayList(4);
- handleUIs.add(capabilityId);
- }
-
- /**
- * Adds the id of a perspective for which this capability
- * wants to present as a choice in the user interface.
- */
- public void addPerspectiveChoice(String perspId) {
- if (perspectiveChoices == null)
- perspectiveChoices = new ArrayList(4);
- perspectiveChoices.add(perspId);
- }
-
- public String getId() {
- return id;
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchAdapter.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return getIconDescriptor();
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchAdapter.
- */
- public String getLabel(Object o) {
- return getName();
- }
-
- public String getName() {
- if (isValid())
- return natureDescriptor.getLabel();
- else
- return WorkbenchMessages.format("Capability.nameMissing", new Object[] {id}); //$NON-NLS-1$
- }
-
- public ImageDescriptor getIconDescriptor() {
- if (icon == null && isValid()) {
- IExtension extension = element.getDeclaringExtension();
- String location = element.getAttribute(ATT_ICON);
- if (location != null && location.length() > 0)
- icon = WorkbenchImages.getImageDescriptorFromExtension(extension, location);
- }
- return icon;
- }
-
- /**
- * Returns the nature descriptor or <code>null</code> if
- * none exist.
- */
- public IProjectNatureDescriptor getNatureDescriptor() {
- return natureDescriptor;
- }
-
- public String getNatureId() {
- return natureId;
- }
-
- /* (non-Javadoc)
- * Method declared on IAdaptable.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- else
- return null;
- }
-
- public String getCategoryPath() {
- if (element == null)
- return ""; //$NON-NLS-1$;
- else
- return element.getAttribute(ATT_CATEGORY);
- }
-
- /**
- * Returns a new instance of the capability install
- * wizard. Caller is responsible for calling the init
- * method. If the wizard cannot be created, <code>null</code>
- * is returned.
- *
- * @return the non-initialized capability wizard or
- * <code>null</code> if the wizard cannot be created.
- */
- public ICapabilityInstallWizard getInstallWizard() {
- if (!isValid())
- return null;
-
- try {
- return (ICapabilityInstallWizard)element.createExecutableExtension(ATT_INSTALL_WIZARD);
- } catch (CoreException e) {
- WorkbenchPlugin.log("Could not create capability install wizard.", e.getStatus()); //$NON-NLS-1$
- return null;
- }
- }
-
- /**
- * Returns the description for the install wizard
- * or <code>null</code> if none supplied.
- */
- public String getInstallDetails() {
- if (!isValid())
- return null;
- return element.getAttribute(ATT_INSTALL_DETAILS);
- }
-
- /**
- * Returns a new instance of the capability uninstall
- * wizard. Caller is responsible for calling the init
- * method. If the wizard cannot be created, <code>null</code>
- * is returned.
- *
- * @return the non-initialized capability wizard or
- * <code>null</code> if the wizard cannot be created.
- */
- public ICapabilityUninstallWizard getUninstallWizard() {
- if (!isValid())
- return null;
-
- try {
- return (ICapabilityUninstallWizard)element.createExecutableExtension(ATT_UNINSTALL_WIZARD);
- } catch (CoreException e) {
- WorkbenchPlugin.log("Could not create capability uninstall wizard.", e.getStatus()); //$NON-NLS-1$
- return null;
- }
- }
-
- /**
- * Returns the description for the uninstall wizard
- * or <code>null</code> if none supplied.
- */
- public String getUninstallDetails() {
- if (!isValid())
- return null;
- return element.getAttribute(ATT_UNINSTALL_DETAILS);
- }
-
- public String getDescription() {
- if (!isValid())
- return ""; //$NON-NLS-1$;
- String description = element.getAttribute(ATT_DESCRIPTION);
- if (description == null)
- description = ""; //$NON-NLS-1$
- return description;
- }
-
- /**
- * Returns a list of ids of other capabilities for which this
- * capability handles the user interface, or <code>null</code>
- * if not applicable.
- */
- public ArrayList getHandleUIs() {
- return handleUIs;
- }
-
- /**
- * Returns a list of ids of perspectives for which this
- * capability wants to present as choices, or <code>null</code>
- * if not applicable.
- */
- public ArrayList getPerspectiveChoices() {
- return perspectiveChoices;
- }
-
- /**
- * Returns whether this capability is valid
- */
- public boolean isValid() {
- return natureDescriptor != null;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CapabilityRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CapabilityRegistry.java
deleted file mode 100644
index 046ef1a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CapabilityRegistry.java
+++ /dev/null
@@ -1,416 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IProjectNatureDescriptor;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.model.WorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * This class represents a registry of project capabilities and categories of
- * capabilities.
- */
-public class CapabilityRegistry extends WorkbenchAdapter implements IAdaptable {
- private static final String[] EMPTY_ID_LIST = new String[0];
- private static final Capability[] EMPTY_CAP_LIST = new Capability[0];
-
- private HashMap natureToCapability;
- private ArrayList capabilities;
- private ArrayList categories;
- private Category miscCategory;
-
- /**
- * Creates a new instance of <code>CapabilityRegistry</code>
- */
- public CapabilityRegistry() {
- capabilities = new ArrayList(30);
- categories = new ArrayList(15);
- }
-
- /**
- * Adds the given capability to the registry. Called by
- * the CapabilityRegistryReader.
- */
- /* package */ boolean addCapability(Capability capability) {
- return capabilities.add(capability);
- }
-
- /**
- * Adds the given capability category to the registry. Called
- * by the CapabilityRegistryReader.
- */
- /* package */ boolean addCategory(ICategory category) {
- return categories.add(category);
- }
-
- /**
- * Finds the capability for the given identifier, or
- * <code>null</code> if none.
- */
- public Capability findCapability(String id) {
- Iterator enum = capabilities.iterator();
- while (enum.hasNext()) {
- Capability cap = (Capability) enum.next();
- if (id.equals(cap.getId())) {
- return cap;
- }
- }
- return null;
- }
-
- /**
- * Finds the category for the given identifier, or
- * <code>null</code> if none.
- */
- public ICategory findCategory(String id) {
- Iterator enum = categories.iterator();
- while (enum.hasNext()) {
- Category cat = (Category) enum.next();
- if (id.equals(cat.getRootPath())) {
- return cat;
- }
- }
- return null;
- }
-
- /**
- * Finds the capability for each specified identifier.
- * Any <code>null</code> entries in the resulting array
- * are for identifiers to which no capability exist.
- */
- public Capability[] findCapabilities(String[] ids) {
- int count = capabilities.size();
- Capability[] results = new Capability[ids.length];
-
- for (int i = 0; i < ids.length; i++) {
- String id = ids[i];
- for (int j = 0; j < count; j++) {
- Capability cap = (Capability) capabilities.get(j);
- if (cap.getId().equals(id)) {
- results[i] = cap;
- break;
- }
- }
- }
-
- return results;
- }
-
- /**
- * Finds the category for each specified identifier.
- * Any <code>null</code> entries in the resulting array
- * are for identifiers to which no category exist.
- *
- * @return an array of <code>ICategory</code>
- */
- public ICategory[] findCategories(String[] ids) {
- int count = categories.size();
- ICategory[] results = new Category[ids.length];
-
- for (int i = 0; i < ids.length; i++) {
- String id = ids[i];
- for (int j = 0; j < count; j++) {
- Category cat = (Category) categories.get(j);
- if (cat.getId().equals(id)) {
- results[i] = cat;
- break;
- }
- }
- }
-
- return results;
- }
-
- /* (non-Javadoc)
- * Method declared on IAdaptable.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- else
- return null;
- }
-
- /**
- * Returns the list of categories in the registry
- * which contain at least one capability. Does not
- * include the misc and unknown categories.
- */
- public ArrayList getUsedCategories() {
- ArrayList results = new ArrayList(categories.size());
- Iterator enum = categories.iterator();
- while (enum.hasNext()) {
- ICategory cat = (ICategory) enum.next();
- if (cat.hasElements())
- results.add(cat);
- }
- return results;
- }
-
- /**
- * Returns the capability for the nature id
- */
- public Capability getCapabilityForNature(String natureId) {
- return (Capability)natureToCapability.get(natureId);
- }
-
- /**
- * Returns the list of capabilities in the registry
- */
- public ArrayList getCapabilities() {
- return capabilities;
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchAdapter.
- */
- public Object[] getChildren(Object o) {
- return capabilities.toArray();
- }
-
- /**
- * Returns the membership set ids that the specified
- * capability belongs to.
- */
- public String[] getMembershipSetIds(Capability capability) {
- IProjectNatureDescriptor desc = capability.getNatureDescriptor();
- if (desc == null)
- return EMPTY_ID_LIST;
-
- return desc.getNatureSetIds();
- }
-
- /**
- * Returns the miscellaneous category, or <code>null</code>
- * if none.
- */
- public ICategory getMiscCategory() {
- return miscCategory;
- }
-
- /**
- * Returns the capability ids that are prerequisites
- * of the specified capability.
- */
- public String[] getPrerequisiteIds(Capability capability) {
- IProjectNatureDescriptor desc = capability.getNatureDescriptor();
- if (desc == null)
- return EMPTY_ID_LIST;
-
- String[] natureIds = desc.getRequiredNatureIds();
- if (natureIds.length == 0)
- return EMPTY_ID_LIST;
-
- ArrayList results = new ArrayList(natureIds.length);
- for (int i = 0; i < natureIds.length; i++) {
- Capability cap = (Capability)natureToCapability.get(natureIds[i]);
- if (cap != null)
- results.add(cap.getId());
- }
-
- if (results.size() == 0) {
- return EMPTY_ID_LIST;
- } else {
- String[] ids = new String[results.size()];
- results.toArray(ids);
- return ids;
- }
- }
-
- /**
- * Returns the capabilities assigned to the specified project
- */
- public Capability[] getProjectCapabilities(IProject project) {
- try {
- String[] natureIds = project.getDescription().getNatureIds();
- ArrayList results = new ArrayList(natureIds.length);
- for (int i = 0; i < natureIds.length; i++) {
- Capability cap = (Capability)natureToCapability.get(natureIds[i]);
- if (cap == null) {
- cap = new Capability(natureIds[i]);
- mapCapability(cap);
- }
- results.add(cap);
- }
-
- if (results.size() == 0) {
- return EMPTY_CAP_LIST;
- } else {
- Capability[] caps = new Capability[results.size()];
- results.toArray(caps);
- return caps;
- }
- }
- catch (CoreException e) {
- return EMPTY_CAP_LIST;
- }
- }
-
- /**
- * Returns the capabilities assigned to the specified project
- * that are consideed disabled by core.
- */
- public Capability[] getProjectDisabledCapabilities(IProject project) {
- try {
- String[] natureIds = project.getDescription().getNatureIds();
- ArrayList results = new ArrayList(natureIds.length);
- for (int i = 0; i < natureIds.length; i++) {
- if (!project.isNatureEnabled(natureIds[i])) {
- Capability cap = (Capability)natureToCapability.get(natureIds[i]);
- if (cap == null) {
- cap = new Capability(natureIds[i]);
- mapCapability(cap);
- }
- results.add(cap);
- }
- }
-
- if (results.size() == 0) {
- return EMPTY_CAP_LIST;
- } else {
- Capability[] caps = new Capability[results.size()];
- results.toArray(caps);
- return caps;
- }
- }
- catch (CoreException e) {
- return EMPTY_CAP_LIST;
- }
- }
-
- /**
- * Returns whether the registry contains any capabilities.
- */
- public boolean hasCapabilities() {
- return !capabilities.isEmpty();
- }
-
- /**
- * Returns whether the specified capability has any prerequisites.
- */
- public boolean hasPrerequisites(Capability capability) {
- return getPrerequisiteIds(capability).length > 0;
- }
-
- /**
- * Loads capabilities and capability categories from the platform's plugin
- * registry.
- */
- public void load() {
- CapabilityRegistryReader reader = new CapabilityRegistryReader();
- reader.read(Platform.getPluginRegistry(), this);
- mapCapabilities();
- }
-
- /**
- * Maps each capability in the registry to a particular category.
- * The category is defined in xml. If the capability's category is
- * not found, then the capability is added to the "misc" category.
- * <p>
- * Maps each capability in the registry to a particular nature
- * id.
- */
- /* package */ void mapCapabilities() {
- natureToCapability = new HashMap();
-
- Iterator enum = capabilities.iterator();
- while (enum.hasNext())
- mapCapability((Capability) enum.next());
- }
-
- private void mapCapability(Capability cap) {
- // Map to category
- if (!cap.isValid()) {
- if (miscCategory == null)
- miscCategory = new Category();
- miscCategory.addElement(cap);
- } else {
- Category cat = null;
- String catPath = cap.getCategoryPath();
- if (catPath != null)
- cat = (Category)findCategory(catPath);
- if (cat != null) {
- cat.addElement(cap);
- } else {
- if (miscCategory == null)
- miscCategory = new Category();
- miscCategory.addElement(cap);
- }
- }
-
- // Map to nature id
- natureToCapability.put(cap.getNatureId(), cap);
- }
-
- /**
- * Removes from the capability collection all capabilities
- * whose UI is handle by another capability in the collection.
- * The provided collection must be in proper prerequisite order.
- *
- * @param capabilities the capabilities to be pruned
- * @return a collection of capabilities pruned
- */
- public Capability[] pruneCapabilities(Capability[] capabilities) {
- ArrayList ids = new ArrayList(capabilities.length);
- for (int i = 0; i < capabilities.length; i++)
- ids.add(capabilities[i].getId());
-
- for (int i = 0; i < capabilities.length; i++) {
- ArrayList handleIds = capabilities[i].getHandleUIs();
- if (handleIds != null)
- ids.removeAll(handleIds);
- }
-
- String[] results = new String[ids.size()];
- ids.toArray(results);
- return findCapabilities(results);
- }
-
- /**
- * Checks that the collection is valid. If so, the collection is
- * ordered based on prerequisite.
- *
- * @param capabilities the capabilities to be checked and ordered
- * @return a status object with code <code>IStatus.OK</code> if
- * the given set of natures is valid, otherwise a status
- * object indicating what is wrong with the set. Also, the
- * collection of capabilities specified is ordered based on
- * prerequisite.
- */
- public IStatus validateCapabilities(Capability[] capabilities) {
- String natures[] = new String[capabilities.length];
- for (int i = 0; i < capabilities.length; i++)
- natures[i] = capabilities[i].getNatureId();
-
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- IStatus status = workspace.validateNatureSet(natures);
- if (status.isOK()) {
- natures = workspace.sortNatureSet(natures);
- for (int i = 0; i < natures.length; i++)
- capabilities[i] = (Capability)natureToCapability.get(natures[i]);
- }
-
- return status;
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CapabilityRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CapabilityRegistryReader.java
deleted file mode 100644
index 6c576ab..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/CapabilityRegistryReader.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/**********************************************************************
-Copyright (c) 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.util.List;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginRegistry;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * This class is used to read project capabilities and capability
- * categories from the platform's plugin registry and store the results in
- * a capability registry.
- */
-public class CapabilityRegistryReader extends RegistryReader{
- private static final String TAG_CAPABILITY = "capability"; //$NON-NLS-1$
- private static final String TAG_CATEGORY = "category"; //$NON-NLS-1$
- private static final String TAG_HANDLE_UI = "handleUI"; //$NON-NLS-1$
- private static final String TAG_PERSPECTIVE_CHOICE = "perspectiveChoice"; //$NON-NLS-1$
-
- private static final String ATT_ID = "id"; //$NON-NLS-1$
-
- private CapabilityRegistry capabilityRegistry;
- private Capability currentCapability;
-
- /**
- * Reads an element of the plugin registry and adds it to the capability
- * registry if it is a capability or category (or a handleUI element, a
- * child of a capability. A handleUI element represents another capability
- * for which this capability controls the user interface).
- */
- protected boolean readElement(IConfigurationElement element) {
- String name = element.getName();
- if (name.equals(TAG_CAPABILITY))
- return readCapability(element);
- if (name.equals(TAG_CATEGORY))
- return readCategory(element);
- if (name.equals(TAG_HANDLE_UI))
- return readHandleUI(element);
- if (name.equals(TAG_PERSPECTIVE_CHOICE))
- return readPerspectiveChoice(element);
- return false;
- }
-
- /**
- * Reads a capability and adds it to the capability registry. Reads all
- * children elements (which will be handleUI elements) as well and adds
- * them to the capability.
- */
- private boolean readCapability(IConfigurationElement element) {
- try {
- Capability capability = new Capability(element, this);
- capabilityRegistry.addCapability(capability);
- currentCapability = capability;
- readElementChildren(element);
- currentCapability = null;
- return true;
- } catch(WorkbenchException e) {
- currentCapability = null;
- return false;
- }
- }
-
- /**
- * Reads a capability category and adds it to the capability registry.
- */
- private boolean readCategory(IConfigurationElement element) {
- try {
- Category category = new Category(element);
- capabilityRegistry.addCategory(category);
- } catch (WorkbenchException e) {
- // log an error since its not safe to show a dialog here
- WorkbenchPlugin.log("Unable to create capability category. ", e.getStatus()); //$NON-NLS-1$
- }
- return true;
- }
-
- /**
- * Reads handleUI elements. These elements contain the ids of other
- * capabilities. The capability that is the parent of the handleUI element
- * controls the user interface for the capabilities whose ids are stored
- * in the handleUI element.
- */
- private boolean readHandleUI(IConfigurationElement element) {
- String capabilityId = element.getAttribute(ATT_ID);
-
- if (capabilityId == null) {
- logMissingAttribute(element, ATT_ID);
- }
-
- if (currentCapability != null)
- currentCapability.addHandleUI(capabilityId);
- return true;
- }
-
- /**
- * Reads perspectiveChoice elements. These elements contain the ids of
- * perspectives.
- */
- private boolean readPerspectiveChoice(IConfigurationElement element) {
- String perspId = element.getAttribute(ATT_ID);
-
- if (perspId == null) {
- logMissingAttribute(element, ATT_ID);
- }
-
- if (currentCapability != null)
- currentCapability.addPerspectiveChoice(perspId);
- return true;
- }
-
- /**
- * Reads project capabilities and capability categories from the provided
- * plugin registry and stores them in the provided capability registry.
- */
- public void read(IPluginRegistry registry, CapabilityRegistry out) {
- capabilityRegistry = out;
- readRegistry(registry, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_CAPABILITIES);
- }
-}
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
deleted file mode 100644
index e706f7b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/Category.java
+++ /dev/null
@@ -1,174 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import org.eclipse.ui.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import java.util.*;
-
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.model.WorkbenchAdapter;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * The default implementation of the interface <code>ICategory</code>.
- *
- * @see ICategory
- */
-public class Category extends WorkbenchAdapter implements ICategory {
- private static final String ATT_ID = "id"; //$NON-NLS-1$
- private static final String ATT_PARENT = "parentCategory"; //$NON-NLS-1$
- private static final String ATT_NAME = "name"; //$NON-NLS-1$
-
- private String id;
- private String name;
- private String[] parentPath;
- private String unparsedPath;
- private ArrayList elements;
-
- /**
- * Creates an instance of <code>Category</code> as a
- * miscellaneous category.
- */
- public Category() {
- this.id = MISC_ID;
- this.name = MISC_NAME;
- }
-
- /**
- * 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 a <code>WorkbenchException</code> if the ID or label is <code>null</code
- */
- public Category(IConfigurationElement configElement) throws WorkbenchException {
- id = configElement.getAttribute(ATT_ID);
- name = configElement.getAttribute(ATT_NAME);
- unparsedPath = configElement.getAttribute(ATT_PARENT);
-
- if (id == null || name == null)
- throw new WorkbenchException("Invalid category: " + id); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on ICategory.
- */
- public void addElement(Object element) {
- if (elements == null)
- elements = new ArrayList(5);
- elements.add(element);
- }
-
- /* (non-Javadoc)
- * Method declared on IAdaptable.
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- else
- return null;
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchAdapter.
- */
- public Object[] getChildren(Object o) {
- return getElements().toArray();
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchAdapter.
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FOLDER);
- }
-
- /* (non-Javadoc)
- * Method declared on IWorkbenchAdapter.
- */
- public String getLabel(Object o) {
- return getLabel();
- }
-
- /* (non-Javadoc)
- * Method declared on ICategory.
- */
- public String getId() {
- return id;
- }
-
- /* (non-Javadoc)
- * Method declared on ICategory.
- */
- public String getLabel() {
- return name;
- }
-
- /* (non-Javadoc)
- * Method declared on ICategory.
- */
- public String[] getParentPath() {
- 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();
- }
- unparsedPath = null;
- }
-
- return parentPath;
- }
-
- /* (non-Javadoc)
- * Method declared on ICategory.
- */
- public String getRootPath() {
- String[] path = getParentPath();
- if (path != null && path.length > 0)
- return path[0];
- else
- return id;
- }
-
- /* (non-Javadoc)
- * Method declared on ICategory.
- */
- public ArrayList getElements() {
- return elements;
- }
-
- /* (non-Javadoc)
- * Method declared on ICategory.
- */
- public boolean hasElements() {
- if (elements != null)
- return !elements.isEmpty();
- else
- return false;
- }
-}
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
deleted file mode 100644
index 895af8a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorDescriptor.java
+++ /dev/null
@@ -1,299 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.*;
-import java.io.*;
-import java.util.*;
-import org.eclipse.ui.IEditorActionBarContributor;
-
-//Work in progress
-import org.eclipse.swt.program.Program;
-
-/**
- * @see IEditorDescriptor
- */
-public class EditorDescriptor implements IEditorDescriptor, Serializable {
- private String editorName;
- private String imageFilename;
- private transient ImageDescriptor imageDesc;
- private boolean testImage = true;
- private String className;
- private String launcherName;
- private String fileName;
- private String id;
- //Work in progress for OSEditors
- private Program program;
-
- private String pluginIdentifier; //The id of the plugin which contributed this editor, null for external editors
- private boolean internal = false;
- private boolean openInPlace = false;
- private transient IConfigurationElement configurationElement;
- private static String ATT_EDITOR_CONTRIBUTOR="contributorClass";//$NON-NLS-1$
-
- // Single descriptor instance to represent the system editor
- private static EditorDescriptor systemEditorDescriptor;
-/**
- * Creates the action contributor for this editor.
- */
-public IEditorActionBarContributor createActionBarContributor() {
- // Get the contributor class name.
- String className = configurationElement.getAttribute(ATT_EDITOR_CONTRIBUTOR);
- if (className == null)
- return null;
-
- // Create the contributor object.
- IEditorActionBarContributor contributor = null;
- try {
- contributor = (IEditorActionBarContributor)WorkbenchPlugin.createExtension(
- configurationElement, ATT_EDITOR_CONTRIBUTOR);
- } catch (CoreException e) {
- WorkbenchPlugin.log("Unable to create editor contributor: " + //$NON-NLS-1$
- id, e.getStatus());
- }
- return contributor;
-}
-/**
- * Return the program called programName. Return null if it is not found.
- * @return org.eclipse.swt.program.Program
- */
-private static Program findProgram(String programName) {
-
- Program[] programs = Program.getPrograms();
- for (int i = 0; i < programs.length; i++) {
- if (programs[i].getName().equals(programName))
- return programs[i];
- }
-
- return null;
-}
-/**
- * @see IResourceEditorDescriptor
- */
-public String getClassName() {
- return className;
-}
-/**
- * @see IResourceEditorDescriptor
- */
-public IConfigurationElement getConfigurationElement() {
- return configurationElement;
-}
-/**
- * @see IResourceEditorDescriptor
- */
-public String getFileName() {
- if(program == null)
- return fileName;
- return program.getName();
-}
-/**
- * @see IResourceEditorDescriptor
- */
-public String getId() {
- if (program == null)
- return id;
- return program.getName();
-}
-/**
- * @see IResourceEditorDescriptor
- */
-public ImageDescriptor getImageDescriptor() {
- if (testImage) {
- testImage = false;
- if (imageDesc != null) {
- Image img = imageDesc.createImage(false);
- if (img == null)
- imageDesc = WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
- else
- img.dispose();
- }
- }
- return imageDesc;
-}
-/**
- * @see IResourceEditorDescriptor
- */
-public String getImageFilename() {
- return imageFilename;
-}
-/**
- * @see IResourceEditorDescriptor
- */
-public String getLabel() {
- if (program == null)
- return editorName;
- return program.getName();
-}
-/**
- * Returns the class name of the launcher.
- */
-public String getLauncher() {
- return launcherName;
-}
-/**
- * @see IResourceEditorDescriptor
- */
-public String getPluginID() {
- return pluginIdentifier;
-}
-/**
- * Get the program for the receiver if there is one.
- * @return Program
- */
-public Program getProgram() {
- return this.program;
-}
-/**
- * Return the single descriptor instance of a system editor
- */
-public static EditorDescriptor getSystemEditorDescriptor() {
- if (systemEditorDescriptor == null) {
- systemEditorDescriptor = new EditorDescriptor();
- systemEditorDescriptor.setID(IWorkbenchConstants.SYSTEM_EDITOR_ID);
- systemEditorDescriptor.setName(WorkbenchMessages.getString("SystemEditorDescription.name"));//$NON-NLS-1$
- }
- return systemEditorDescriptor;
-}
-/**
- * @see IResourceEditorDescriptor
- */
-public boolean isInternal() {
- return internal;
-}
-/**
- * @see IResourceEditorDescriptor
- */
-public boolean isOpenInPlace() {
- return openInPlace;
-}
-/**
- * Load the object properties from a IMemento.
- */
-protected void 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 = memento.getString(IWorkbenchConstants.TAG_ID);
- pluginIdentifier = memento.getString(IWorkbenchConstants.TAG_PLUGING);
- internal = new Boolean(memento.getString(IWorkbenchConstants.TAG_INTERNAL)).booleanValue();
- openInPlace = new Boolean(memento.getString(IWorkbenchConstants.TAG_OPEN_IN_PLACE)).booleanValue();
-
- String programName = memento.getString(IWorkbenchConstants.TAG_PROGRAM_NAME);
- if(programName != null)
- this.program = findProgram(programName);
-
-}
-/**
- * Save the object values in a IMemento
- */
-protected void saveValues(IMemento memento) {
- memento.putString(IWorkbenchConstants.TAG_LABEL,editorName);
- memento.putString(IWorkbenchConstants.TAG_IMAGE,imageFilename);
- memento.putString(IWorkbenchConstants.TAG_CLASS,className);
- memento.putString(IWorkbenchConstants.TAG_LAUNCHER,launcherName);
- memento.putString(IWorkbenchConstants.TAG_FILE,fileName);
- memento.putString(IWorkbenchConstants.TAG_ID,id);
- memento.putString(IWorkbenchConstants.TAG_PLUGING,pluginIdentifier);
- memento.putString(IWorkbenchConstants.TAG_INTERNAL,String.valueOf(internal));
- memento.putString(IWorkbenchConstants.TAG_OPEN_IN_PLACE,String.valueOf(openInPlace));
- if(this.program != null)
- memento.putString(IWorkbenchConstants.TAG_PROGRAM_NAME,this.program.getName());
-}
-/**
- * Set the class name of an internal editor.
- */
-public void setClassName(String newClassName) {
- className = newClassName;
-}
-/**
- * Set the configuration element which contributed this editor.
- */
-public void setConfigurationElement(IConfigurationElement newConfigurationElement) {
- configurationElement = newConfigurationElement;
-}
-/**
- * Set the filename of an external editor.
- */
-public 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
- */
-public void setID(String anID) {
- id = anID;
-}
-/**
- * The Image to use to repesent this editor
- */
-public void setImageDescriptor(ImageDescriptor desc) {
- imageDesc = desc;
- testImage = true;
-}
-/**
- * The name of the image to use for this editor.
- */
-public void setImageFilename(String aFileName) {
- imageFilename = aFileName;
-}
-/**
- * True if this editor is an interal editor.
- */
-public void setInternal(boolean newInternal) {
- internal = newInternal;
-}
-/**
- * Sets the new launcher class name
- *
- * @param newLauncher the new launcher
- */
-public void setLauncher(String newLauncher) {
- launcherName = newLauncher;
-}
-/**
- * The label to show for this editor.
- */
-public void setName(String newName) {
- editorName = newName;
-}
-/**
- * Set if this external editor should be opened inplace.
- */
-public void setOpenInPlace(boolean aBoolean) {
- openInPlace = aBoolean;
-}
-/**
- * The id of the plugin which contributed this editor, null for external editors.
- */
-public void setPluginIdentifier(String anID) {
- pluginIdentifier = anID;
-}
-/**
- * Set the receivers program.
- * @param newProgram
- */
-public void setProgram(Program newProgram) {
-
- this.program = newProgram;
- if(editorName == null)
- setName(newProgram.getName());
-}
-/**
- * For debugging purposes only.
- */
-public String toString() {
- return "ResourceEditorDescriptor(" + editorName + ")";//$NON-NLS-2$//$NON-NLS-1$
-}
-}
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
deleted file mode 100644
index c237a32..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistry.java
+++ /dev/null
@@ -1,871 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.*;
-import java.text.Collator;
-import java.util.*;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.swt.program.Program;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.*;
-
-/**
- * Provides access to the collection of defined editors for
- * resource types.
- */
-public class EditorRegistry implements IEditorRegistry {
-
- /* 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 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.
- */
- private List sortedEditorsFromPlugins = new ArrayList();
-
- // Map of EditorDescriptor - map editor id to editor.
- private Map mapIDtoEditor = initialIdToEditorMap(10);
-
- // Map of FileEditorMapping (extension to FileEditorMapping)
- private EditorMap typeEditorMappings;
-
- // List for prop changed listeners.
- private ListenerList propChangeListeners = new ListenerList();
-
- // Key for the EditorID save as a IFile persistent property
- private static final QualifiedName EDITOR_KEY = new QualifiedName("org.eclipse.ui.internal.registry.ResourceEditorRegistry","EditorProperty");//$NON-NLS-2$//$NON-NLS-1$
-/**
- * Return an instance of the receiver.
- */
-public EditorRegistry() {
- super();
- initializeFromStorage();
-}
-/**
- * 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 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 extensions, List filenames, boolean bDefault) {
-
- // record it in our quick reference list
- sortedEditorsFromPlugins.add(editor);
-
- // add it to the table of mappings
- Iterator enum = extensions.iterator();
- while(enum.hasNext()) {
- String fileExtension = (String)enum.next();
-
- 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
- enum = filenames.iterator();
- while(enum.hasNext()) {
- String filename = (String)enum.next();
-
- 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);
- }
- }
-
- // Update editor map.
- mapIDtoEditor.put(editor.getId(), editor);
-}
-/**
- * Add external editors to the editor mapping.
- */
-private void addExternalEditorsToEditorMap() {
- IEditorDescriptor desc = null;
-
- // Add registered editors (may include external editors).
- FileEditorMapping maps[] = typeEditorMappings.allMappings();
- for (int i = 0; i < maps.length; i++) {
- FileEditorMapping map = maps[i];
- IEditorDescriptor [] descArray = map.getEditors();
- for (int n = 0; n < descArray.length; n++) {
- desc = descArray[n];
- mapIDtoEditor.put(desc.getId(), desc);
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on IEditorRegistry.
- */
-public void addPropertyListener(IPropertyListener l) {
- propChangeListeners.add(l);
-}
-/* (non-Javadoc)
- * Method declared on IEditorRegistry.
- */
-public IEditorDescriptor findEditor(String id) {
- return (IEditorDescriptor)mapIDtoEditor.get(id);
-}
-/**
- * Fires a property changed event.
- */
-private void firePropertyChange(final int type) {
- Object [] array = propChangeListeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IPropertyListener l = (IPropertyListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.propertyChanged(EditorRegistry.this, type);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- propChangeListeners.remove(l);
- }
- });
- }
-}
-/* (non-Javadoc)
- * Method declared on IEditorRegistry.
- */
-public IEditorDescriptor getDefaultEditor() {
- // Find the default editor descriptor and return it.
- IEditorDescriptor desc = findEditor(IWorkbenchConstants.DEFAULT_EDITOR_ID);
- if (desc != null)
- return desc;
-
- // Panic: the default editor cannot be found.
- MessageDialog.openError((Shell)null,
- "Editor Problems", //$NON-NLS-1$
- "Unable to find default editor.");//$NON-NLS-1$
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IEditorRegistry.
- */
-public IEditorDescriptor getDefaultEditor(String filename) {
- FileEditorMapping[] mapping = getMappingForFilename(filename);
- IEditorDescriptor desc = null;
- if (mapping[0] != null)
- desc = mapping[0].getDefaultEditor();
- if (desc == null && mapping[1] != null)
- desc = mapping[1].getDefaultEditor();
- return desc;
-}
-/* (non-Javadoc)
- * Method declared on IEditorRegistry.
- */
-public IEditorDescriptor getDefaultEditor(IFile file) {
- // Try file specific editor.
- try {
- String editorID = file.getPersistentProperty(EDITOR_KEY);
- if (editorID != null) {
- IEditorDescriptor desc = findEditor(editorID);
- if (desc != null)
- return desc;
- }
- } catch (CoreException e) {
- }
-
- // Try lookup with filename
- return getDefaultEditor(file.getName());
-}
-/**
- * Returns the default file image.
- */
-private ImageDescriptor getDefaultImage() {
- return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
-}
-/* (non-Javadoc)
- * Method declared on IEditorRegistry.
- */
-public IEditorDescriptor[] getEditors(String filename) {
- IEditorDescriptor[] editors = new IEditorDescriptor[0];
- IEditorDescriptor[] filenameEditors = editors;
- IEditorDescriptor[] extensionEditors = editors;
-
- FileEditorMapping mapping[] = getMappingForFilename(filename);
- if (mapping[0] != null) {
- editors = mapping[0].getEditors();
- if (editors != null)
- filenameEditors = editors;
- }
- if (mapping[1] != null) {
- editors = mapping[1].getEditors();
- if (editors != null)
- extensionEditors = editors;
- }
-
- editors = new IEditorDescriptor[filenameEditors.length + extensionEditors.length];
- System.arraycopy(filenameEditors, 0, editors, 0, filenameEditors.length);
- System.arraycopy(extensionEditors, 0, editors, filenameEditors.length, extensionEditors.length);
- return editors;
-}
-/* (non-Javadoc)
- * Method declared on IEditorRegistry.
- */
-public IEditorDescriptor[] getEditors(IFile element) {
- return getEditors(element.getName());
-}
-/* (non-Javadoc)
- * Method declared on IEditorRegistry.
- */
-public IFileEditorMapping[] getFileEditorMappings() {
- FileEditorMapping[] array = typeEditorMappings.allMappings();
- final Collator collator = Collator.getInstance();
- Arrays.sort(array,new Comparator() {
- public int compare(Object o1, Object o2) {
- String s1 = ((FileEditorMapping)o1).getLabel();
- String s2 = ((FileEditorMapping)o2).getLabel();
- return collator.compare(s1, s2);
- }
- });
- return array;
-}
-/* (non-Javadoc)
- * Method declared on IEditorRegistry.
- */
-public ImageDescriptor getImageDescriptor(String filename) {
- if (filename == null)
- return getDefaultImage();
-
- // Lookup in the cache first...
- String key = mappingKeyFor(filename);
- ImageDescriptor anImage = (ImageDescriptor)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 = (ImageDescriptor)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;
- }
- }
- }
-
- // Nothing - time to look externally for the icon
- anImage = getSystemEditorImageDescriptor(filename);
- if (anImage == null)
- anImage = getDefaultImage();
- extensionImages.put(key, anImage);
- return anImage;
-}
-/* (non-Javadoc)
- * Method declared on IEditorRegistry.
- */
-public ImageDescriptor getImageDescriptor(IFile element) {
- return getImageDescriptor(element.getName());
-}
-/**
- * Find the file editor mapping for the type. Returns
- * null if not found.
- */
-private FileEditorMapping getMappingFor(String type) {
- if (type == null)
- return null;
- String key = mappingKeyFor(type);
- return (FileEditorMapping) typeEditorMappings.get(key);
-}
-/**
- * Find the file editor mappings for the given filename.
- *
- * 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.
- */
-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;
-}
-/*
- * 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
- */
-
-public IEditorDescriptor[] getSortedEditorsFromOS() {
- List externalEditors = new ArrayList();
- Program [] programs = Program.getPrograms();
-
- for (int i = 0; i < programs.length; i++){
- //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.setProgram(programs[i]);
-
- // determine the program icon this editor would need (do not let it be cached in the workbench registry)
- ImageDescriptor desc = new ExternalProgramImageDescriptor(programs[i]);
- editor.setImageDescriptor(desc);
- externalEditors.add(editor);
- }
-
- 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;
-}
-/**
- *
- */
-public IEditorDescriptor[] getSortedEditorsFromPlugins() {
- IEditorDescriptor[] array = new IEditorDescriptor[sortedEditorsFromPlugins.size()];
- sortedEditorsFromPlugins.toArray(array);
- return array;
-
-}
-/*
- * Return the image descriptor of the system editor
- * that is registered with the OS to edit files of
- * this type. Null if none can be found.
- */
-public ImageDescriptor getSystemEditorImageDescriptor(String filename) {
- Program externalProgram = null;
- int extensionIndex = filename.lastIndexOf('.');
- if (extensionIndex >= 0)
- externalProgram = Program.findProgram(filename.substring(extensionIndex));
- if (externalProgram == null)
- return null;
- else
- return new ExternalProgramImageDescriptor(externalProgram);
-}
-/*
- * Return the image descriptor of the system editor
- * that is registered with the OS to edit files of
- * this type. Null if none can be found.
- */
-public ImageDescriptor getSystemEditorImageDescriptor(IFile element) {
- return getSystemEditorImageDescriptor(element.getName());
-}
-/**
- * Answer an intial id to editor map.
- */
-private HashMap initialIdToEditorMap(int initialSize) {
- HashMap map = new HashMap(initialSize);
- map.put(IWorkbenchConstants.SYSTEM_EDITOR_ID, EditorDescriptor.getSystemEditorDescriptor());
- return map;
-}
-private void initializeFromStorage () {
- typeEditorMappings = new EditorMap();
- extensionImages = new HashMap();
-
- //Get editors from the registry
- EditorRegistryReader registryReader = new EditorRegistryReader();
- registryReader.addEditors(true, this);
- sortInternalEditors();
- rebuildInternalEditorMap();
-
- IWorkbench workbench = PlatformUI.getWorkbench();
- IPreferenceStore store = workbench.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.
- */
-private void setProductDefaults(String defaultEditors) {
- if(defaultEditors == null || defaultEditors.length() == 0)
- return;
-
- StringTokenizer extEditors = new StringTokenizer(defaultEditors,new Character(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$
- 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$
- continue;
- }
- EditorDescriptor editor = (EditorDescriptor)findEditor(editorId);
- if(editor == null) {
- WorkbenchPlugin.log("Error setting default editor. Could not find editor: '" + editorId + "'."); //$NON-NLS-1$
- continue;
- }
- mapping.setDefaultEditor(editor);
- }
-}
-/**
- * Load the serialized resource associations
- * Return true if the operation was successful, false otherwise
- */
-private boolean loadAssociations() {
-
- //Get the workbench plugin's working directory
- WorkbenchPlugin workbenchPlugin = WorkbenchPlugin.getDefault();
- IPath workbenchStatePath = workbenchPlugin.getStateLocation();
-
- //Get the editors and validate each one
- Map editorTable = new HashMap();
- Reader reader = null;
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
-
- try {
- String xmlString = store.getString(IPreferenceConstants.EDITORS);
- if(xmlString == null || xmlString.length() == 0) {
- FileInputStream stream = new FileInputStream(workbenchStatePath.append(IWorkbenchConstants.EDITOR_FILE_NAME).toOSString());
- reader = new InputStreamReader(stream, "utf-8"); //$NON-NLS-1$
- } else {
- reader = new StringReader(xmlString);
- }
- XMLMemento memento = XMLMemento.createReadRoot(reader);
- EditorDescriptor editor;
- IMemento[] edMementos = memento.getChildren(IWorkbenchConstants.TAG_DESCRIPTOR);
- for (int i = 0; i < edMementos.length; i++) {
- editor = new EditorDescriptor();
- editor.loadValues(edMementos[i]);
-
- 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.
- EditorDescriptor validEditorDescritor =
- (EditorDescriptor) mapIDtoEditor.get(editor.getId());
- if (validEditorDescritor != null) {
- editorTable.put(validEditorDescritor.getId(), validEditorDescritor);
- }
- } else { //This is either from a program or a user defined editor
- ImageDescriptor descriptor;
- if (editor.getProgram() == null)
- descriptor = new ProgramImageDescriptor(editor.getFileName(), 0);
- else
- descriptor = new ExternalProgramImageDescriptor(editor.getProgram());
- editor.setImageDescriptor(descriptor);
- editorTable.put(editor.getId(), editor);
- }
- }
- } catch (IOException e) {
- try {
- if (reader != null)
- reader.close();
- } catch (IOException ex) {
- }
- //Ignore this as the workbench may not yet have saved any state
- return false;
- } catch (WorkbenchException e) {
- ErrorDialog.openError(
- (Shell) null,
- WorkbenchMessages.getString("EditorRegistry.errorTitle"),//$NON-NLS-1$
- WorkbenchMessages.getString("EditorRegistry.errorMessage"), //$NON-NLS-1$
- e.getStatus());
- return false;
- }
-
- //Get the resource types
- reader = null;
- try {
- String xmlString = store.getString(IPreferenceConstants.RESOURCES);
- if(xmlString == null || xmlString.length() == 0) {
- FileInputStream stream = new FileInputStream(
- workbenchStatePath
- .append(IWorkbenchConstants.RESOURCE_TYPE_FILE_NAME)
- .toOSString());
- reader = new InputStreamReader(stream, "utf-8"); //$NON-NLS-1$
- } else {
- reader = new StringReader(xmlString);
- }
- XMLMemento memento = XMLMemento.createReadRoot(reader);
- IMemento[] extMementos = memento.getChildren(IWorkbenchConstants.TAG_INFO);
- for (int i = 0; i < extMementos.length; i++) {
- String name = extMementos[i].getString(IWorkbenchConstants.TAG_NAME);
- if (name == null)
- name = "*";//$NON-NLS-1$
- String extension = extMementos[i].getString(IWorkbenchConstants.TAG_EXTENSION);
- IMemento[] idMementos =
- extMementos[i].getChildren(IWorkbenchConstants.TAG_EDITOR);
- String[] editorIDs = new String[idMementos.length];
- for (int j = 0; j < idMementos.length; j++) {
- editorIDs[j] = idMementos[j].getString(IWorkbenchConstants.TAG_ID);
- }
- idMementos =
- extMementos[i].getChildren(IWorkbenchConstants.TAG_DELETED_EDITOR);
- String[] deletedEditorIDs = new String[idMementos.length];
- for (int j = 0; j < idMementos.length; j++) {
- deletedEditorIDs[j] = idMementos[j].getString(IWorkbenchConstants.TAG_ID);
- }
- FileEditorMapping mapping = getMappingFor(name + "." + extension);//$NON-NLS-1$
- if (mapping == null) {
- mapping = new FileEditorMapping(name, extension);
- }
- List editors = new ArrayList();
- for (int j = 0; j < editorIDs.length; j++) {
- if (editorIDs[j] != null) {
- EditorDescriptor editor = (EditorDescriptor) editorTable.get(editorIDs[j]);
- if (editor != null) {
- editors.add(editor);
- }
- }
- }
- List deletedEditors = new ArrayList();
- for (int j = 0; j < deletedEditorIDs.length; j++) {
- if (deletedEditorIDs[j] != null) {
- EditorDescriptor editor = (EditorDescriptor) editorTable.get(deletedEditorIDs[j]);
- if (editor != null) {
- deletedEditors.add(editor);
- }
- }
- }
-
- // Add any new editors that have already been read from the registry
- // which were not deleted.
- IEditorDescriptor[] editorsArray = mapping.getEditors();
- for (int j = 0; j < editorsArray.length; j++) {
- if (!editors.contains(editorsArray[j]) && !deletedEditors.contains(editorsArray[j])) {
- editors.add(editorsArray[j]);
- }
- }
-
- mapping.setEditorsList(editors);
- mapping.setDeletedEditorsList(deletedEditors);
- typeEditorMappings.put(mappingKeyFor(mapping), mapping);
- }
- } catch (IOException e) {
- try {
- if (reader != null)
- reader.close();
- } catch (IOException ex) {
- }
- MessageDialog.openError(
- (Shell) null,
- WorkbenchMessages.getString("EditorRegistry.errorTitle"),//$NON-NLS-1$
- WorkbenchMessages.getString("EditorRegistry.errorMessage")); //$NON-NLS-1$
- return false;
- } catch (WorkbenchException e) {
- ErrorDialog.openError(
- (Shell) null,
- WorkbenchMessages.getString("EditorRegistry.errorTitle"),//$NON-NLS-1$
- WorkbenchMessages.getString("EditorRegistry.errorMessage"), //$NON-NLS-1$
- e.getStatus());
- return false;
- }
- return true;
-}
-/*
- *
- */
-private String mappingKeyFor(String type) {
- //Unix issue
- return type.toLowerCase();
-}
-/**
- * Return a key that combines the file's name and extension
- * of the given mapping
- */
-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()
-{
- Iterator enum = null;
- IEditorDescriptor desc = null;
-
- // Allocate a new map.
- mapIDtoEditor = initialIdToEditorMap(mapIDtoEditor.size());
-
- // Add plugin editors.
- enum = sortedEditorsFromPlugins.iterator();
- while (enum.hasNext()) {
- desc = (IEditorDescriptor)enum.next();
- mapIDtoEditor.put(desc.getId(), desc);
- }
-}
-/* (non-Javadoc)
- * Method declared on IEditorRegistry.
- */
-public void removePropertyListener(IPropertyListener l) {
- propChangeListeners.remove(l);
-}
-/**
- * Save the registry to the filesystem by serializing
- * the current resource associations.
- */
-public void saveAssociations () {
- //Get the workbench plugin's working directory
- IPath workbenchStatePath = WorkbenchPlugin.getDefault().getStateLocation();
- //Save the resource type descriptions
- List editors = new ArrayList();
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
-
- XMLMemento memento = XMLMemento.createWriteRoot(IWorkbenchConstants.TAG_EDITORS);
- FileEditorMapping maps[] = typeEditorMappings.userMappings();
- for (int mapsIndex = 0; mapsIndex < maps.length; mapsIndex++) {
- FileEditorMapping type = (FileEditorMapping)maps[mapsIndex];
- IMemento editorMemento = memento.createChild(IWorkbenchConstants.TAG_INFO);
- editorMemento.putString(IWorkbenchConstants.TAG_NAME,type.getName());
- editorMemento.putString(IWorkbenchConstants.TAG_EXTENSION,type.getExtension());
- IEditorDescriptor[] editorArray = type.getEditors();
- for (int i = 0; i < editorArray.length; i++){
- EditorDescriptor editor = (EditorDescriptor)editorArray[i];
- if (!editors.contains(editor)) {
- editors.add(editor);
- }
- IMemento idMemento = editorMemento.createChild(IWorkbenchConstants.TAG_EDITOR);
- idMemento.putString(IWorkbenchConstants.TAG_ID,editorArray[i].getId());
- }
- editorArray = type.getDeletedEditors();
- for (int i = 0; i < editorArray.length; i++){
- EditorDescriptor editor = (EditorDescriptor)editorArray[i];
- if (!editors.contains(editor)) {
- editors.add(editor);
- }
- IMemento idMemento = editorMemento.createChild(IWorkbenchConstants.TAG_DELETED_EDITOR);
- idMemento.putString(IWorkbenchConstants.TAG_ID,editorArray[i].getId());
- }
- }
- Writer writer = null;
- try {
- writer = new StringWriter();
- memento.save(writer);
- writer.close();
- store.setValue(IPreferenceConstants.RESOURCES,writer.toString());
- } catch(IOException e) {
- try{
- if(writer != null) writer.close();
- } catch(IOException ex) {}
- MessageDialog.openError((Shell)null,
- "Saving Problems", //$NON-NLS-1$
- "Unable to save resource associations.");//$NON-NLS-1$
- return;
- }
-
-
- memento = XMLMemento.createWriteRoot(IWorkbenchConstants.TAG_EDITORS);
- Iterator enum = editors.iterator();
- while (enum.hasNext()) {
- EditorDescriptor editor = (EditorDescriptor)enum.next();
- IMemento editorMemento = memento.createChild(IWorkbenchConstants.TAG_DESCRIPTOR);
- editor.saveValues(editorMemento);
- }
- writer = null;
- try {
- writer = new StringWriter();
- memento.save(writer);
- writer.close();
- store.setValue(IPreferenceConstants.EDITORS,writer.toString());
- } catch(IOException e) {
- try{
- if(writer != null) writer.close();
- } catch(IOException ex) {}
- MessageDialog.openError((Shell)null,
- "Error",//$NON-NLS-1$
- "Unable to save resource associations.");//$NON-NLS-1$
- return;
- }
-}
-/* (non-Javadoc)
- * Method declared on IEditorRegistry.
- */
-public void setDefaultEditor(IFile file, String editorID) {
- try {
- file.setPersistentProperty(EDITOR_KEY,editorID);
- } catch (CoreException e) {}
-}
-/**
- * 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.
- */
-public void setFileEditorMappings(FileEditorMapping[] newResourceTypes) {
- typeEditorMappings = new EditorMap();
- for (int i = 0;i < newResourceTypes.length;i++) {
- FileEditorMapping mapping = newResourceTypes[i];
- typeEditorMappings.put(mappingKeyFor(mapping), mapping);
- }
- extensionImages = new HashMap();
- rebuildEditorMap();
- firePropertyChange(PROP_CONTENTS);
-}
-/* (non-Javadoc)
- * Method declared on IEditorRegistry.
- */
-public void setDefaultEditor(String fileName, String editorId) {
- EditorDescriptor desc = (EditorDescriptor)findEditor(editorId);
- FileEditorMapping[] mapping = getMappingForFilename(fileName);
- if (mapping[0] != null)
- mapping[0].setDefaultEditor(desc);
- if (mapping[1] != null)
- mapping[1].setDefaultEditor(desc);
-}
-/**
- * Alphabetically sort the internal editors
- */
-private Object[] sortEditors(List unsortedList) {
- Object[] array = new Object[unsortedList.size()];
- unsortedList.toArray(array);
-
- Sorter s = new Sorter() {
- private Collator collator = Collator.getInstance();
-
- public boolean compare(Object o1, Object o2) {
- String s1 = ((IEditorDescriptor)o1).getLabel();
- String s2 = ((IEditorDescriptor)o2).getLabel();
- //Return true if elementTwo is 'greater than' elementOne
- return collator.compare(s2, s1) > 0;
- }
- };
- return s.sort(array);
-
-}
-/**
- * Alphabetically sort the internal editors
- */
-private void sortInternalEditors() {
- Object[] array = sortEditors(sortedEditorsFromPlugins);
- sortedEditorsFromPlugins = new ArrayList();
- for (int i = 0; i < array.length; i++) {
- sortedEditorsFromPlugins.add(array[i]);
- }
-}
-
-/*
- * 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 defaultMap = new HashMap();
- HashMap map = new HashMap();
-
- public void putDefault(String key, FileEditorMapping value) {
- defaultMap.put(key,value);
- }
- public void put(String key, FileEditorMapping value) {
- Object result = defaultMap.get(key);
- if(value.equals(result))
- map.remove(key);
- else
- map.put(key,value);
- }
- public FileEditorMapping get(String key) {
- Object result = map.get(key);
- if(result == null)
- result = defaultMap.get(key);
- return (FileEditorMapping)result;
- }
- public FileEditorMapping[] allMappings() {
- HashMap merge = (HashMap)defaultMap.clone();
- merge.putAll(map);
- Collection values = merge.values();
- FileEditorMapping result[] = new FileEditorMapping[values.size()];
- return (FileEditorMapping[])values.toArray(result);
- }
- public FileEditorMapping[] userMappings() {
- Collection values = map.values();
- FileEditorMapping result[] = new FileEditorMapping[values.size()];
- return (FileEditorMapping[])values.toArray(result);
- }
-}
-
-}
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
deleted file mode 100644
index 494cc17..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/EditorRegistryReader.java
+++ /dev/null
@@ -1,141 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-import org.eclipse.ui.internal.WorkbenchImages;
-import org.eclipse.ui.internal.misc.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import java.util.*;
-
-/**
- * This class is used to read resource editor registry descriptors from
- * the platform registry.
- */
-public class EditorRegistryReader extends RegistryReader {
-
- private static final String PARAMETER_SEPARATOR = ",";//$NON-NLS-1$
- private static final String ATT_CLASS = "class";//$NON-NLS-1$
- private static final String ATT_NAME = "name";//$NON-NLS-1$
- private static final String TAG_EDITOR = "editor";//$NON-NLS-1$
- private static final String P_EXTERNAL = "external";//$NON-NLS-1$
- private static final String P_TRUE = "true";//$NON-NLS-1$
- private static final String ATT_COMMAND = "command";//$NON-NLS-1$
- private static final String ATT_LAUNCHER = "launcher";//$NON-NLS-1$
- private static final String ATT_DEFAULT = "default";//$NON-NLS-1$
- public static final String ATT_ID = "id";//$NON-NLS-1$
- private static final String ATT_ICON = "icon";//$NON-NLS-1$
- private static final String ATT_EXTENSIONS = "extensions";//$NON-NLS-1$
- private static final String ATT_FILENAMES = "filenames";//$NON-NLS-1$
- private EditorRegistry editorRegistry;
-/**
- * Get the editors that are defined in the registry
- * and add them to the ResourceEditorRegistry
- * The readAll flag indicates if we should read non modified plugins
- *
- * 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(boolean readAll, EditorRegistry registry) {
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- this.editorRegistry = registry;
- readRegistry(pluginRegistry, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_EDITOR);
-}
-/**
- * Implementation of the abstract method that
- * processes one configuration element.
- */
-protected boolean readElement(IConfigurationElement element) {
- if (!element.getName().equals(TAG_EDITOR))
- return false;
-
- EditorDescriptor editor = new EditorDescriptor();
- editor.setConfigurationElement(element);
- String id = element.getAttribute(ATT_ID);
- if (id == null) {
- logMissingAttribute(element, ATT_ID);
- return true;
- }
- editor.setID(id);
- IExtension extension = element.getDeclaringExtension();
- editor.setPluginIdentifier(extension.getDeclaringPluginDescriptor().getUniqueIdentifier());
-
- List extensionsVector = new ArrayList();
- List filenamesVector = new ArrayList();
- boolean defaultEditor = false;
-
- // Get editor name (required field).
- String name = element.getAttribute(ATT_NAME);
- if (name == null) {
- logMissingAttribute(element, ATT_NAME);
- return true;
- }
- editor.setName(name);
-
- // Get editor icon (required field for internal editors)
- String icon = element.getAttribute(ATT_ICON);
- if (icon == null) {
- if (element.getAttribute(ATT_CLASS) != null) {
- logMissingAttribute(element, ATT_ICON);
- return true;
- }
- }
- if (icon != null) {
- editor.setImageDescriptor(WorkbenchImages.getImageDescriptorFromExtension(extension, icon));
- editor.setImageFilename(icon);
- }
-
- // Get target extensions (optional field)
- String extensionsString = element.getAttribute(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(ATT_FILENAMES);
- if (filenamesString != null) {
- StringTokenizer tokenizer = new StringTokenizer(filenamesString, ",");//$NON-NLS-1$
- while (tokenizer.hasMoreTokens()) {
- filenamesVector.add(tokenizer.nextToken().trim());
- }
- }
-
- // Get launcher class or command.
- String launcher = element.getAttribute(ATT_LAUNCHER);
- String command = element.getAttribute(ATT_COMMAND);
- if (launcher != null) {
- // open using a launcer
- editor.setLauncher(launcher);
- editor.setInternal(false);
-
- } else if (command != null) {
- // open using an external editor
- editor.setFileName(command);
- if (icon == null)
- editor.setImageDescriptor(WorkbenchImages.getImageDescriptorFromProgram(command, 0));
- editor.setInternal(false);
- } else {
- // open using an internal editor
- String className = element.getAttribute(ATT_CLASS);
- editor.setClassName(className);
- editor.setInternal(true);
- }
-
- // Is this the default editor?
- String def = element.getAttribute(ATT_DEFAULT);
- if (def != null)
- defaultEditor = def.equalsIgnoreCase(P_TRUE);
-
- // Add the editor to the manager.
- editorRegistry.addEditorFromPlugin(editor, extensionsVector, filenamesVector, defaultEditor);
- return true;
-}
-}
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
deleted file mode 100644
index c79c70a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/FileEditorMapping.java
+++ /dev/null
@@ -1,210 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import java.util.*;
-
-
-/* (non-Javadoc)
- * Implementation of IFileEditorMapping.
- */
-public class FileEditorMapping extends Object
- implements IFileEditorMapping, Cloneable
-{
- private String name = "*";//$NON-NLS-1$
- private String extension;
-
- // Collection of EditorDescriptor, where the first one
- // if considered the default one.
- private List editors = new ArrayList(1);
- private List deletedEditors = new ArrayList(1);
-/**
- * Create an instance of this class.
- *
- * @param extension java.lang.String
- * @param mimeType java.lang.String
- */
-public FileEditorMapping(String extension) {
- this("*", extension);//$NON-NLS-1$
-}
-/**
- * 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("*");//$NON-NLS-1$
- else
- setName(name);
- if (extension == null)
- setExtension("");//$NON-NLS-1$
- else
- setExtension(extension);
-}
-/**
- * Add the given editor to the list of editors registered.
- */
-public void addEditor(EditorDescriptor editor) {
- editors.add(editor);
- deletedEditors.remove(editor);
-}
-/**
- * Clone the receiver.
- */
-public Object clone() {
- try {
- FileEditorMapping clone = (FileEditorMapping)super.clone();
- clone.editors = (List)((ArrayList)editors).clone();
- return clone;
- } catch (CloneNotSupportedException e) {
- return null;
- }
-}
-/**
- * @see java.lang.Object.equals(Object obj)
- */
-public boolean equals(Object obj) {
- if(this == obj)
- return true;
- if(!(obj instanceof FileEditorMapping))
- return false;
- FileEditorMapping mapping = (FileEditorMapping)obj;
- if(!this.name.equals(mapping.name))
- return false;
- if(!this.extension.equals(mapping.extension))
- return false;
-
- if(!compareList(this.editors,mapping.editors))
- return false;
- return compareList(this.deletedEditors,mapping.deletedEditors);
-}
-/**
- * Compare the editor ids from both lists and return true if they
- * are equals.
- */
-private boolean compareList(List l1,List l2) {
- if(l1.size() != l2.size())
- return false;
-
- Iterator i1 = l1.iterator();
- Iterator i2 = l2.iterator();
- 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;
-}
-
-/* (non-Javadoc)
- * Method declared on IFileEditorMapping.
- */
-public IEditorDescriptor getDefaultEditor() {
- if (editors.size() == 0)
- return null;
- else
- return (IEditorDescriptor)editors.get(0);
-}
-/* (non-Javadoc)
- * Method declared on IFileEditorMapping.
- */
-public IEditorDescriptor[] getEditors() {
- IEditorDescriptor[] array = new IEditorDescriptor[editors.size()];
- editors.toArray(array);
- return array;
-}
-/* (non-Javadoc)
- * Method declared on IFileEditorMapping.
- */
-public IEditorDescriptor[] getDeletedEditors() {
- IEditorDescriptor[] array = new IEditorDescriptor[deletedEditors.size()];
- deletedEditors.toArray(array);
- return array;
-}
-/* (non-Javadoc)
- * Method declared on IFileEditorMapping.
- */
-public String getExtension() {
- return extension;
-}
-/* (non-Javadoc)
- * Method declared on IFileEditorMapping.
- */
-public ImageDescriptor getImageDescriptor() {
- IEditorDescriptor editor = getDefaultEditor();
- if (editor == null) {
- return WorkbenchImages.getImageDescriptor(ISharedImages.IMG_OBJ_FILE);
- } else {
- return editor.getImageDescriptor();
- }
-}
-/* (non-Javadoc)
- * Method declared on IFileEditorMapping.
- */
-public String getLabel() {
- return name + (extension.length() == 0 ? "" : "." + extension);//$NON-NLS-1$ //$NON-NLS-2$
-}
-/* (non-Javadoc)
- * Method declared on IFileEditorMapping.
- */
-public String getName() {
- return name;
-}
-/**
- * Remove the given editor from the set of editors registered.
- */
-public void removeEditor(EditorDescriptor editor) {
- editors.remove(editor);
- deletedEditors.add(editor);
-}
-/**
- * Set the default editor registered for file type
- * described by this mapping.
- */
-public void setDefaultEditor(EditorDescriptor editor) {
- editors.remove(editor);
- editors.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)
- */
-public void setEditorsList(List newEditors) {
- editors = 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)
- */
-public void setDeletedEditorsList(List newDeletedEditors) {
- deletedEditors = newDeletedEditors;
-}
-/**
- * Set the file's extension.
- */
-public void setExtension(String extension) {
- this.extension = extension;
-}
-/**
- * Set the file's name.
- */
-public void setName(String name) {
- this.name = name;
-}
-}
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
deleted file mode 100644
index f776772..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSet.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
- import org.eclipse.ui.*;
-
-/**
- * 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. ]
- * </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.
- * </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>
- */
-public 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
- */
-public 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
deleted file mode 100644
index 0a4581c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IActionSetDescriptor.java
+++ /dev/null
@@ -1,71 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * 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. ]
- * </p>
- * <p>
- * This interface is not intended to be implemented by clients.
- * </p>
- * @see IActionSetRegistry
- */
-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
- */
-public IActionSet createActionSet() throws CoreException;
-/**
- * Returns the category id of this action set.
- *
- * @return a non-empty category id or <cod>null</code> if none specified
- */
-public String getCategory();
-/**
- * Returns the description of this action set.
- * This is the value of its <code>"description"</code> attribute.
- *
- * @return the description
- */
-public String getDescription();
-/**
- * Returns the id of this action set.
- * This is the value of its <code>"id"</code> attribute.
- *
- * @return the action set id
- */
-public String getId();
-/**
- * Returns the label of this action set.
- * This is the value of its <code>"label"</code> attribute.
- *
- * @return the label
- */
-public String getLabel();
-/**
- * Returns whether this action set is initially visible.
- */
-public boolean isInitiallyVisible();
-/**
- * Sets the category of this action set.
- *
- * @param cat a non-empty category id
- */
-public void setCategory(String id);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ICategory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ICategory.java
deleted file mode 100644
index 7dd6566..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ICategory.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.IAdaptable;
-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.
- * <p>
- * A category may specify its parent category in order to
- * achieve hierarchy.
- * </p><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.]
- * </p>
- */
-public interface ICategory extends IWorkbenchAdapter, IAdaptable {
- /**
- * Name of the miscellaneous category
- */
- public final static String MISC_NAME = WorkbenchMessages.getString("ICategory.other"); //$NON-NLS-1$
-
- /**
- * Identifier of the miscellaneous category
- */
- public final static String MISC_ID = "org.eclipse.ui.internal.otherCategory"; //$NON-NLS-1$
-
- /**
- * Adds an element as being part of this category
- */
- public void addElement(Object element);
-
- /**
- * Returns the element that are known to be part
- * of this category or <code>null</code>.
- */
- public ArrayList getElements();
-
- /**
- * Returns a unique category ID.
- */
- public String getId();
-
- /**
- * Returns a presentation label for this category.
- */
- public String getLabel();
-
- /**
- * Returns an array of category IDs that represent a path
- * to the parent category of this category. If this is a
- * top-level category, <code>null</code> is returned.
- */
- public String[] getParentPath();
-
- /**
- * Returns the category ID that represents the root
- * of the parent category of this category. If this is a
- * top-level category, <code>null</code> is returned.
- */
- public String getRootPath();
-
- /**
- * Returns whether the category contains any elements.
- */
- public boolean hasElements();
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IViewDescriptor.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IViewDescriptor.java
deleted file mode 100644
index a604d3b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IViewDescriptor.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * This is a view descriptor. It provides a "description" of a given
- * given view so that the view can later be constructed.
- * <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. ]
- * </p>
- * <p>
- * The view registry provides facilities to map from an extension
- * to a IViewDescriptor.
- * </p>
- *
- */
-public interface IViewDescriptor extends IWorkbenchPartDescriptor {
-/**
- * Creates an instance of the view defined in the descriptor.
- */
-public 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.
- */
-public String[] getCategoryPath();
-/**
- * Returns the configuration element which contributed this view.
- */
-public IConfigurationElement getConfigurationElement();
-/**
- * Returns the id of the view.
- */
-public String getID() ;
-/**
- * Returns the descriptor for the icon to show for this view.
- */
-public ImageDescriptor getImageDescriptor();
-/**
- * Returns the label to show for this view.
- */
-public String getLabel() ;
-
-/**
- * Returns the text of the accelerator to use for this view.
- */
-public String getAccelerator();
-
-/**
- * Returns the default fast view width ratio for this view.
- *
- * @since 2.0
- */
-public float getFastViewWidthRatio();
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IViewRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IViewRegistry.java
deleted file mode 100644
index dcfe404..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/IViewRegistry.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-/**
- * The view registry maintains a list of views explicitly registered
- * against the view extension point..
- * <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. ]
- * </p>
- * <p>
- * The description of a given view is kept in a IViewDescriptor
- * </p>
- */
-public interface IViewRegistry {
-/**
- * Return a view descriptor with the given extension ID. If no view exists
- * with the ID return null.
- */
-public IViewDescriptor find(String id);
-/**
- * Returns an enumeration of view categories, if defined.
- */
-public ICategory [] getCategories();
-/**
- * Return the view category count.
- */
-public int getCategoryCount();
-/**
- * Return the view count.
- */
-public int getViewCount();
-/**
- * Return a list of views defined in the registry.
- */
-public IViewDescriptor [] getViews();
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerHelpRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerHelpRegistry.java
deleted file mode 100644
index e8c96f9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerHelpRegistry.java
+++ /dev/null
@@ -1,231 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.IMarkerHelpRegistry;
-import org.eclipse.ui.IMarkerResolution;
-import org.eclipse.ui.IMarkerResolutionGenerator;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * This class is a registry for marker help
- * contexts and resolutions.
- */
-
-
-public class MarkerHelpRegistry implements IMarkerHelpRegistry {
- /**
- * Table of queries for marker F1 help.
- */
- private Map helpQueries = new HashMap();
- /**
- * Sorted list of help queries.
- * Used to ensure that the "most specific"
- * query is tried first
- */
- private List sortedHelpQueries;
- /**
- * Table of queries for marker resolutions
- */
- private Map resolutionQueries = new HashMap();
- /**
- * Help context id attribute in configuration element
- */
- private static final String ATT_HELP = "helpContextId"; //$NON-NLS-1$
- /**
- * Resolution class attribute name in configuration element
- */
- private static final String ATT_CLASS = "class"; //$NON-NLS-1$
-
- private class QueryComparator implements Comparator {
- /* (non-Javadoc)
- * Method declared on Object.
- */
- public boolean equals(Object o) {
- if (!(o instanceof QueryComparator))
- return false;
- return true;
- }
- /* (non-Javadoc)
- * Method declared on Comparator.
- */
- public int compare(Object o1,Object o2) {
- // more attribues come first
- MarkerQuery q1 = (MarkerQuery)o1;
- MarkerQuery q2 = (MarkerQuery)o2;
-
- int size1 = q1.getAttributes().length;
- int size2 = q2.getAttributes().length;
-
- if (size1 > size2)
- return -1;
- if (size1 == size2)
- return 0;
- return 1;
- }
- }
-
- /* (non-Javadoc)
- * Method declared on IMarkerHelpRegistry.
- */
- public String getHelp(IMarker marker) {
- if (sortedHelpQueries == null) {
- Set set = helpQueries.keySet();
- sortedHelpQueries = new ArrayList(set.size());
- sortedHelpQueries.addAll(set);
- Collections.sort(sortedHelpQueries, new QueryComparator());
- }
-
- // Return the first match (we assume there is only one)
- for (Iterator iter = sortedHelpQueries.iterator(); iter.hasNext();) {
- MarkerQuery query = (MarkerQuery)iter.next();
- MarkerQueryResult result = query.performQuery(marker);
- if (result != null) {
- // See if a matching result is registered
- Map resultsTable = (Map)helpQueries.get(query);
- IConfigurationElement element = (IConfigurationElement)resultsTable.get(result);
- if (element != null)
- // We have a match so return the help context id
- return element.getAttribute(ATT_HELP);
- }
- }
- return null;
- }
-
- /* (non-Javadoc)
- * Method declared on IMarkerHelpRegistry.
- */
- public boolean hasResolutions(IMarker marker) {
- // Detect a match
- for (Iterator iter = resolutionQueries.keySet().iterator(); iter.hasNext();) {
- MarkerQuery query = (MarkerQuery)iter.next();
- MarkerQueryResult result = query.performQuery(marker);
- if (result != null) {
- // See if a matching result is registered
- Map resultsTable = (Map)resolutionQueries.get(query);
- IConfigurationElement element = (IConfigurationElement)resultsTable.get(result);
- if (element != null) {
- IMarkerResolutionGenerator generator = null;
- if (element.getDeclaringExtension().getDeclaringPluginDescriptor().isPluginActivated()) {
- // The element's plugin is loaded so we instantiate the resolution
- try {
- generator = (IMarkerResolutionGenerator)element.createExecutableExtension(ATT_CLASS);
- } catch (CoreException e) {
- WorkbenchPlugin.log("Unable to instantiate resolution generator", e.getStatus()); //$NON-NLS-1$
- }
- if (generator != null) {
- IMarkerResolution[] resolutions = generator.getResolutions(marker);
- if (resolutions.length > 0)
- // there is at least one resolution
- return true;
- }
- } else {
- // The element's plugin in not loaded so we assume
- // the generator will produce resolutions for the marker
- return true;
- }
- }
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * Method declared on IMarkerHelpRegistry.
- */
- public IMarkerResolution[] getResolutions(IMarker marker) {
- // Collect all matches
- ArrayList resolutions = new ArrayList();
- for (Iterator iter = resolutionQueries.keySet().iterator(); iter.hasNext();) {
- MarkerQuery query = (MarkerQuery)iter.next();
- MarkerQueryResult result = query.performQuery(marker);
- if (result != null) {
- // See if a matching result is registered
- Map resultsTable = (Map)resolutionQueries.get(query);
- IConfigurationElement element = (IConfigurationElement)resultsTable.get(result);
- if (element != null) {
- IMarkerResolutionGenerator generator = null;
- try {
- generator = (IMarkerResolutionGenerator)element.createExecutableExtension(ATT_CLASS);
- } catch (CoreException e) {
- WorkbenchPlugin.log("Unable to instantiate resolution generator", e.getStatus()); //$NON-NLS-1$
- }
- if (generator != null) {
- IMarkerResolution[] generatedResolutions = generator.getResolutions(marker);
- for (int i = 0; i < generatedResolutions.length; i++) {
- resolutions.add(generatedResolutions[i]);
- }
- }
- }
- }
- }
- return (IMarkerResolution[])resolutions.toArray(new IMarkerResolution[resolutions.size()]);
- }
-
- /**
- * Adds a help query to the registry.
- *
- * @param query a marker query
- * @param result a result for the given query
- * @param element the configuration element defining the result
- */
- public void addHelpQuery(MarkerQuery query, MarkerQueryResult result,
- IConfigurationElement element) {
-
- addQuery(helpQueries, query, result, element);
- }
-
- /**
- * Adds a resolution query to the registry.
- *
- * @param query a marker query
- * @param result a result for the given query
- * @param element the configuration element defining the result
- */
- public void addResolutionQuery(MarkerQuery query, MarkerQueryResult result,
- IConfigurationElement element) {
-
- addQuery(resolutionQueries, query, result, element);
- }
-
- /**
- * Adds a query to the given table.
- *
- * @param table the table to which the query is added
- * @param query a marker query
- * @param result a result for the given query
- * @param element the configuration element defining the result
- */
- private void addQuery(Map table, MarkerQuery query, MarkerQueryResult result,
- IConfigurationElement element) {
-
- // See if the query is already in the table
- Map results = (Map)table.get(query);
- if (results == null) {
- // Create a new results table
- results = new HashMap();
-
- // Add the query to the table
- table.put(query, results);
- }
-
- // Add the new result
- results.put(result, element);
- }
-}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerHelpRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerHelpRegistryReader.java
deleted file mode 100644
index 044168a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerHelpRegistryReader.java
+++ /dev/null
@@ -1,129 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * This class is used to read marker help context ids and
- * resolutions from the platform registry.
- */
-public class MarkerHelpRegistryReader extends RegistryReader {
- private ArrayList markerQueries;
- private MarkerHelpRegistry markerHelpRegistry;
- private ArrayList currentAttributeNames;
- private ArrayList currentAttributeValues;
-
- private static final String TAG_HELP = "markerHelp";//$NON-NLS-1$
- private static final String TAG_RESOLUTION_GENERATOR = "markerResolutionGenerator";//$NON-NLS-1$
- private static final String TAG_ATTRIBUTE = "attribute";//$NON-NLS-1$
- private static final String ATT_TYPE = "markerType";//$NON-NLS-1$
- private static final String ATT_NAME = "name";//$NON-NLS-1$
- private static final String ATT_VALUE = "value";//$NON-NLS-1$
-
- /**
- * Get the marker help that is defined in the plugin registry
- * and add it to the given marker help registry.
- * <p>
- * Warning:
- * The marker help registry must be passed in because this
- * method is called during the process of setting up the
- * marker help registry and at this time it has not been
- * safely setup with the plugin.
- * </p>
- */
- public void addHelp(MarkerHelpRegistry registry) {
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- markerHelpRegistry = registry;
- markerQueries = new ArrayList();
- readRegistry(pluginRegistry, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_MARKER_HELP);
- markerQueries = new ArrayList();
- readRegistry(pluginRegistry, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_MARKER_RESOLUTION);
- }
-
- /**
- * Processes one configuration element or child element.
- */
- protected boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(TAG_HELP)) {
- readHelpElement(element);
- return true;
- }
- if (element.getName().equals(TAG_RESOLUTION_GENERATOR)) {
- readResolutionElement(element);
- return true;
- }
- if (element.getName().equals(TAG_ATTRIBUTE)) {
- readAttributeElement(element);
- return true;
- }
- return false;
- }
-
- /**
- * Processes a help configuration element.
- */
- private void readHelpElement(IConfigurationElement element) {
- // read type
- String type = element.getAttribute(ATT_TYPE);
-
- // read attributes and values
- currentAttributeNames = new ArrayList();
- currentAttributeValues = new ArrayList();
- readElementChildren(element);
- String[] attributeNames = (String[])currentAttributeNames.toArray(
- new String[currentAttributeNames.size()]);
- String[] attributeValues = (String[])currentAttributeValues.toArray(
- new String[currentAttributeValues.size()]);
-
- // add query to the registry
- MarkerQuery query = new MarkerQuery(type, attributeNames);
- MarkerQueryResult result = new MarkerQueryResult(attributeValues);
- markerHelpRegistry.addHelpQuery(query, result, element);
- }
-
- /**
- * Processes a resolution configuration element.
- */
- private void readResolutionElement(IConfigurationElement element) {
- // read type
- String type = element.getAttribute(ATT_TYPE);
-
- // read attributes and values
- currentAttributeNames = new ArrayList();
- currentAttributeValues = new ArrayList();
- readElementChildren(element);
- String[] attributeNames = (String[])currentAttributeNames.toArray(
- new String[currentAttributeNames.size()]);
- String[] attributeValues = (String[])currentAttributeValues.toArray(
- new String[currentAttributeValues.size()]);
-
- // add query to the registry
- MarkerQuery query = new MarkerQuery(type, attributeNames);
- MarkerQueryResult result = new MarkerQueryResult(attributeValues);
- markerHelpRegistry.addResolutionQuery(query, result, element);
- }
-
- /**
- * Processes an attribute sub element.
- */
- private void readAttributeElement(IConfigurationElement element) {
- String name = element.getAttribute(ATT_NAME);
- String value = element.getAttribute(ATT_VALUE);
- if (name != null && value != null) {
- currentAttributeNames.add(name);
- currentAttributeValues.add(value);
- }
- }
-}
-
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerImageProviderRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerImageProviderRegistry.java
deleted file mode 100644
index 75b3dcc..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerImageProviderRegistry.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.resources.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.*;
-import java.util.*;
-import java.net.*;
-
-/**
- * Implementation of a marker image registry which maps either
- * a marker type to a provider or to a static image.
- */
-public class MarkerImageProviderRegistry {
- private static final String ATT_PROVIDER_CLASS = "class";//$NON-NLS-1$
- private static final String ATT_ICON = "icon";//$NON-NLS-1$
- private static final String ATT_MARKER_TYPE = "markertype";//$NON-NLS-1$
- private static final String ATT_ID = "id";//$NON-NLS-1$
- private static final String MARKER_ATT_KEY = "org.eclipse.ui.internal.registry.MarkerImageProviderRegistry";//$NON-NLS-1$
- private static final String TAG_PROVIDER = "imageprovider";//$NON-NLS-1$
-
- private ArrayList descriptors = new ArrayList();
-
- class Descriptor {
- String id;
- String markerType;
- String className;
- String imagePath;
- ImageDescriptor imageDescriptor;
- IConfigurationElement element;
- IPluginDescriptor pluginDescriptor;
- IMarkerImageProvider provider;
- }
-/**
- * Initialize this new MarkerImageProviderRegistry.
- */
-public MarkerImageProviderRegistry() {
- class MarkerImageReader extends RegistryReader {
- protected boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(TAG_PROVIDER)) {
- addProvider(element);
- return true;
- }
-
- return false;
- }
- public void readRegistry() {
- readRegistry(Platform.getPluginRegistry(), PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_MARKER_IMAGE_PROVIDER);
- }
- }
-
- new MarkerImageReader().readRegistry();
-}
-/**
- * Creates a descriptor for the marker provider extension
- * and add it to the list of providers.
- */
-public void addProvider(IConfigurationElement element) {
- Descriptor desc = new Descriptor();
- desc.element = element;
- desc.pluginDescriptor = element.getDeclaringExtension().getDeclaringPluginDescriptor();
- desc.id = element.getAttribute(ATT_ID);
- desc.markerType = element.getAttribute(ATT_MARKER_TYPE);
- desc.imagePath = element.getAttribute(ATT_ICON);
- desc.className = element.getAttribute(ATT_PROVIDER_CLASS);
- if(desc.imagePath != null) {
- desc.imageDescriptor = getImageDescriptor(desc);
- }
- if(desc.className == null) {
- //Don't need to keep these references.
- desc.element = null;
- desc.pluginDescriptor = null;
- }
- descriptors.add(desc);
-}
-/**
- * @see IWorkbenchAdapter#getImageDescriptor
- */
-public ImageDescriptor getImageDescriptor(IMarker marker) {
- int size = descriptors.size();
- for (int i = 0; i < size; i++) {
- Descriptor desc = (Descriptor)descriptors.get(i);
- try {
- if(marker.isSubtypeOf(desc.markerType)) {
- if(desc.className != null) {
- if(desc.pluginDescriptor.isPluginActivated()) {
- //-- Get the image descriptor from the provider.
- //-- Save the image descriptor url as a persistable property, so a
- //image descriptor can be created without activating the plugin next
- //time the workbench is started.
- if(desc.provider == null)
- desc.provider = (IMarkerImageProvider)WorkbenchPlugin.createExtension(
- desc.element, ATT_PROVIDER_CLASS);
- String path = desc.provider.getImagePath(marker);
- if(path != desc.imagePath) {
- desc.imagePath = path;
- desc.imageDescriptor = getImageDescriptor(desc);
- return desc.imageDescriptor;
- }
- return desc.imageDescriptor;
- } else {
- if(desc.imageDescriptor == null) {
- //Create a image descriptor to be used until the plugin gets activated.
- desc.imagePath = (String)marker.getAttribute(MARKER_ATT_KEY);
- desc.imageDescriptor = getImageDescriptor(desc);
- }
- return desc.imageDescriptor;
- }
- } else if(desc.imageDescriptor != null) {
- return desc.imageDescriptor;
- }
- }
- } catch (CoreException e) {
- WorkbenchPlugin.getDefault().getLog().log(
- new Status(
- IStatus.ERROR,PlatformUI.PLUGIN_ID,0,
- "Exception creating image descriptor for: " + desc.markerType,//$NON-NLS-1$
- e));
- return null;
- }
- }
- return null;
-}
-/**
- * Returns the image descriptor with the given relative path.
- */
-ImageDescriptor getImageDescriptor(Descriptor desc) {
- try {
- URL installURL = desc.pluginDescriptor.getInstallURL();
- URL url = new URL(installURL, desc.imagePath);
- return ImageDescriptor.createFromURL(url);
- }
- catch (MalformedURLException e) {
- return null;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerQuery.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerQuery.java
deleted file mode 100644
index f4dd13e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerQuery.java
+++ /dev/null
@@ -1,163 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.misc.Assert;
-
-/**
- * Instances of this class hold a marker type id and/or
- * a series of marker attributes. This information may be used
- * to determine if a given marker is of the same marker
- * type and determine its values for the attributes.
- */
-public class MarkerQuery {
- /**
- * The marker type targetted by this query.
- * May be <code>null</code>.
- */
- private String type;
- /**
- * A sorted list of the attributes targetted by this query.
- * The list is sorted from least to greatest according to
- * <code>Sting.compare</code>
- */
- private String[] attributes;
- /**
- * Cached hash code value
- */
- private int hashCode;
-
- /**
- * Creates a new marker query with the given type
- * and attributes.
- * <p>
- * The type may be <code>null</code>. The attributes may
- * be empty, but not <code>null</code>.
- * </p>
- *
- * @param markerType the targetted marker type
- * @param attributes the targetted marker attributes
- */
- public MarkerQuery(String markerType, String[] markerAttributes) {
- Assert.isNotNull(markerAttributes);
-
- type = markerType;
- attributes = markerAttributes;
- computeHashCode();
- }
-
- /**
- * Performs a query against the given marker.
- * <p>
- * Returns a <code>MarkerQueryResult</code> if the marker
- * is appropriate for this query (correct type and has
- * all of the query attributes), otherwise <code>null</code>
- * is returned.
- *
- * @param marker the marker to perform the query against
- * @return a marker query result or <code>null</code>
- */
- public MarkerQueryResult performQuery(IMarker marker) {
- // Check type
- try {
- if (type != null && !type.equals(marker.getType()))
- return null;
- } catch (CoreException e) {
- WorkbenchPlugin.log("Error accessing marker type", e.getStatus()); //$NON-NLS-1$
- return null;
- }
-
- // Check attributes
- String[] values = new String[attributes.length];
- for (int i = 0; i < attributes.length; i++) {
- try {
- Object value = marker.getAttribute(attributes[i]);
- if (value == null)
- return null;
- values[i] = value.toString();
- } catch (CoreException e) {
- WorkbenchPlugin.log("Error accessing marker attribute", e.getStatus()); //$NON-NLS-1$
- return null;
- }
- }
-
- // Create and return the result
- return new MarkerQueryResult(values);
- }
-
- /* (non-Javadoc)
- * Method declared on Object.
- */
- public boolean equals(Object o) {
- if (!(o instanceof MarkerQuery))
- return false;
-
- if (o == this)
- return true;
-
- MarkerQuery mq = (MarkerQuery)o;
- if (!(type == null ? mq.type == null : type.equals(mq.type)))
- return false;
-
- if (attributes.length != mq.attributes.length)
- return false;
-
- for (int i = 0; i < attributes.length; i++) {
- if (!(attributes[i].equals(mq.attributes[i])))
- return false;
- }
-
- return true;
- }
-
- /* (non-Javadoc)
- * Method declared on Object.
- */
- public int hashCode() {
- return hashCode;
- }
-
- /**
- * Computes the hash code for this instance.
- */
- public void computeHashCode() {
- hashCode = 19;
-
- if (type != null)
- hashCode = hashCode * 37 + type.hashCode();
-
- for (int i = 0; i < attributes.length; i++) {
- hashCode = hashCode * 37 + attributes[i].hashCode();
- }
- }
-
- /**
- * Returns the targetted marker type. May be
- * <code>null</code>
- *
- * @return the targetted marker type
- */
- public String getType() {
- return type;
- }
-
- /**
- * Returns the targetted attributes.
- * The array may be empty.
- *
- * @return the targetted attributes
- */
- public String[] getAttributes() {
- return attributes;
- }
-}
-
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerQueryResult.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerQueryResult.java
deleted file mode 100644
index aea7e7c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/MarkerQueryResult.java
+++ /dev/null
@@ -1,81 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.internal.misc.Assert;
-
-/**
- * Instances of this class represent the result of a specific marker
- * query. Specifically they contain an ordered collection of marker
- * attribute values.
- */
-
-public class MarkerQueryResult {
- /**
- * An ordered collection of marker attribute values.
- */
- private String[] values;
- /**
- * Cached hash code value
- */
- private int hashCode;
-
- /**
- * Creates a new marker query result with the given values.
- * <p>
- * The values may not be empty.
- * </p>
- *
- * @param values the target marker's attribute values
- */
- public MarkerQueryResult(String[] markerAttributeValues) {
- Assert.isNotNull(markerAttributeValues);
-
- values = markerAttributeValues;
- computeHashCode();
- }
-
- /* (non-Javadoc)
- * Method declared on Object.
- */
- public boolean equals(Object o) {
- if (!(o instanceof MarkerQueryResult))
- return false;
-
- if (o == this)
- return true;
-
- MarkerQueryResult mqr = (MarkerQueryResult)o;
- if (values.length != mqr.values.length)
- return false;
-
- for (int i = 0; i < values.length; i++) {
- if (!(values[i].equals(mqr.values[i])))
- return false;
- }
-
- return true;
- }
-
- /* (non-Javadoc)
- * Method declared on Object.
- */
- public int hashCode() {
- return hashCode;
- }
-
- /**
- * Computes the hash code for this instance.
- */
- public void computeHashCode() {
- hashCode = 19;
-
- for (int i = 0; i < values.length; i++) {
- hashCode = hashCode * 37 + values[i].hashCode();
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/NewWizardsRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/NewWizardsRegistryReader.java
deleted file mode 100644
index 469b977..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/NewWizardsRegistryReader.java
+++ /dev/null
@@ -1,344 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.ui.internal.misc.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.ui.internal.registry.*;
-import java.text.Collator;
-import java.util.*;
-
-/**
- * Instances of this class provide a simple API to the workbench for
- * accessing of the core registry. It accepts a registry at creation
- * time and extracts workbench-related information from it as requested.
- */
-public class NewWizardsRegistryReader extends WizardsRegistryReader {
-
- private boolean projectsOnly;
- private ArrayList deferWizards = null;
- private ArrayList deferCategories = null;
-
- // constants
- public final static String BASE_CATEGORY = "Base";//$NON-NLS-1$
- public final static String EXAMPLES_WIZARD_CATEGORY = "Examples";//$NON-NLS-1$
- private final static String FULL_EXAMPLES_WIZARD_CATEGORY = "org.eclipse.ui.Examples";//$NON-NLS-1$
- private final static String TAG_CATEGORY = "category"; //$NON-NLS-1$
- private final static String UNCATEGORIZED_WIZARD_CATEGORY = "org.eclipse.ui.Other";//$NON-NLS-1$
- private final static String UNCATEGORIZED_WIZARD_CATEGORY_LABEL = WorkbenchMessages.getString("NewWizardsRegistryReader.otherCategory");//$NON-NLS-1$
- private final static String CATEGORY_SEPARATOR = "/";//$NON-NLS-1$
- private final static String ATT_CATEGORY = "category";//$NON-NLS-1$
- private final static String ATT_PROJECT = "project";//$NON-NLS-1$
- private final static String STR_TRUE = "true";//$NON-NLS-1$
-
- private class CategoryNode {
- private Category category;
- private String path;
- public CategoryNode(Category cat) {
- category = cat;
- path = ""; //$NON-NLS-1$
- String[] categoryPath = category.getParentPath();
- if (categoryPath != null) {
- for (int nX = 0; nX < categoryPath.length; nX ++) {
- path += categoryPath[nX] + '/'; //$NON-NLS-1$
- }
- }
- path += cat.getId();
- }
- public String getPath() {
- return path;
- }
- public Category getCategory() {
- return category;
- }
- }
-/**
- * Constructs a new reader. All wizards are read, including projects.
- */
-public NewWizardsRegistryReader() {
- this(false);
-}
-/**
- * Constructs a new reader.
- *
- * @param projectsOnly if true, only projects are read.
- */
-public NewWizardsRegistryReader(boolean projectsOnly) {
- super(IWorkbenchConstants.PL_NEW);
- this.projectsOnly = projectsOnly;
-}
-/* (non-Javadoc)
- * Method declared on WizardRegistryReader.
- * <p>
- * This implementation uses a defering strategy. For more info see
- * <code>readWizards</code>.
- * </p>
- */
-protected void addNewElementToResult(WorkbenchWizardElement element, IConfigurationElement config, AdaptableList result) {
- 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 childName java.lang.String
- */
-protected WizardCollectionElement createCollectionElement(WizardCollectionElement parent, String id, String label) {
- WizardCollectionElement newElement = new WizardCollectionElement(id, label, parent);
-
- parent.add(newElement);
- return newElement;
-}
-/**
- * Creates empty element collection. Overrider to fill
- * initial elements, if needed.
- */
-protected AdaptableList createEmptyWizardCollection() {
- return new WizardCollectionElement("root", "root", null);//$NON-NLS-2$//$NON-NLS-1$
-}
-/**
- * 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) {
- if (projectsOnly) {
- String flag = element.getAttribute(ATT_PROJECT);
- if (flag == null || !flag.equalsIgnoreCase(STR_TRUE))
- return null;
- }
- return super.createWizardElement(element);
-}
-/**
- * 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);
- deferCategories.add(category);
-}
-/**
- * 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)
- 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));
- }
- Sorter sorter = new Sorter() {
- private Collator collator = Collator.getInstance();
-
- public boolean compare(Object o1, Object o2) {
- String s1 = ((CategoryNode)o1).getPath();
- String s2 = ((CategoryNode)o2).getPath();
- return collator.compare(s2, s1) > 0;
- }
- };
- Object [] sortedCategories = sorter.sort(flatArray);
-
- // Add each category.
- for (int nX = 0; nX < sortedCategories.length; nX ++) {
- Category cat = ((CategoryNode)sortedCategories[nX]).getCategory();
- finishCategory(cat);
- }
-
- // Cleanup.
- deferCategories = null;
-}
-/**
- * Save new category definition.
- */
-private void finishCategory(Category category) {
- WizardCollectionElement currentResult = (WizardCollectionElement) wizards;
-
- String[] categoryPath = category.getParentPath();
- WizardCollectionElement parent = currentResult; // ie.- root
-
- // Traverse down into parent category.
- if (categoryPath != null) {
- for (int i = 0; i < categoryPath.length; i++) {
- WizardCollectionElement tempElement = getChildWithID(parent,categoryPath[i]);
- 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;
- } else
- 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)
- createCollectionElement(parent, category.getId(), category.getLabel());
-}
-/**
- * Insert the passed wizard element into the wizard collection appropriately
- * based upon its defining extension's CATEGORY tag value
- *
- * @param element WorkbenchWizardElement
- * @param extension
- * @param currentResult WizardCollectionElement
- */
-private void finishWizard(WorkbenchWizardElement element, IConfigurationElement config, AdaptableList result) {
- WizardCollectionElement currentResult = (WizardCollectionElement)result;
- 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 = currentResult; // 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;
- }
- else
- currentCollectionElement = tempCollectionElement;
- }
-
- if (moveToOther)
- moveElementToUncategorizedCategory(currentResult, element);
- else
- currentCollectionElement.add(element);
-}
-/**
- * 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, wizards);
- }
- 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(ATT_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 childName java.lang.String
- */
-protected WizardCollectionElement getChildWithID(WizardCollectionElement parent, String id) {
- Object[] children = parent.getChildren();
- for (int i = 0; i < children.length; ++i) {
- WizardCollectionElement currentChild = (WizardCollectionElement)children[i];
- 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,UNCATEGORIZED_WIZARD_CATEGORY_LABEL);
-
- otherCategory.add(element);
-}
-/**
- * Removes the empty categories from a wizard collection.
- */
-private void pruneEmptyCategories(WizardCollectionElement parent) {
- Object [] children = parent.getChildren();
- for (int nX = 0; nX < children.length; nX ++) {
- WizardCollectionElement child = (WizardCollectionElement)children[nX];
- pruneEmptyCategories(child);
- boolean shouldPrune = projectsOnly || child.getId().equals(FULL_EXAMPLES_WIZARD_CATEGORY);
- if (child.isEmpty() && shouldPrune)
- parent.remove(child);
- }
-}
-/**
- * Implement this method to read element attributes.
- */
-protected boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(TAG_CATEGORY)) {
- deferCategory(element);
- return true;
- } else {
- return super.readElement(element);
- }
-}
-/**
- * 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() {
- super.readWizards();
- finishCategories();
- finishWizards();
- if (wizards != null) {
- WizardCollectionElement parent = (WizardCollectionElement)wizards;
- pruneEmptyCategories(parent);
- }
-}
-}
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
deleted file mode 100644
index 47cb3f1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveDescriptor.java
+++ /dev/null
@@ -1,244 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.*;
-import java.io.*;
-import java.util.Properties;
-
-/**
- * PerspectiveDescriptor.
- * <p>
- * A PerspectiveDesciptor has 3 states:
- * </p>
- * <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>hasCustomFile</code>, in which case the user created a
- * new perspective.</li>
- * </ol>
- */
-public class PerspectiveDescriptor implements IPerspectiveDescriptor {
- private String id;
- private String originalId;
- private String label;
- private String className;
- private boolean singleton;
- private ImageDescriptor image;
- private IConfigurationElement configElement;
- private File customFile;
-
- private static final String ATT_ID="id";//$NON-NLS-1$
- private static final String ATT_DEFAULT = "default";//$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_CLASS="class";//$NON-NLS-1$
- private static final String ATT_SINGLETON="singleton";//$NON-NLS-1$
-
-/**
- * Create a descriptor from a file.
- */
-public PerspectiveDescriptor(File file)
- throws IOException, WorkbenchException
-{
- super();
- InputStream stream = null;
- try {
- stream = new FileInputStream(file);
- InputStreamReader reader = new InputStreamReader(stream, "utf-8"); //$NON-NLS-1$
- // Restore the layout state.
- IMemento memento = XMLMemento.createReadRoot(reader);
- IStatus status = restoreState(memento);
- reader.close();
- stream = null;
- customFile = file;
- if(status.getSeverity() == IStatus.ERROR)
- throw new WorkbenchException(status);
- } finally {
- if (stream != null)
- stream.close();
- }
-}
-/**
- * Create a new empty descriptor.
- */
-public PerspectiveDescriptor(String id, String label,PerspectiveDescriptor originalDescriptor) {
- super();
- this.id = id;
- this.label = label;
- if(originalDescriptor != null) {
- this.originalId = originalDescriptor.getOriginalId();
- this.image = originalDescriptor.image;
- }
-}
-/**
- * Create a descriptor from a config element.
- */
-public PerspectiveDescriptor(IConfigurationElement configElement)
- throws CoreException
-{
- super();
- this.configElement = configElement;
- id = configElement.getAttribute(ATT_ID);
- label = configElement.getAttribute(ATT_NAME);
- className = configElement.getAttribute(ATT_CLASS);
- singleton = (configElement.getAttributeAsIs(ATT_SINGLETON) != null);
-
- // Sanity check.
- if ((label == null) || (className == null)) {
- throw new CoreException(new Status(IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH, 0,
- "Invalid extension (missing label or class name): " + id,//$NON-NLS-1$
- null));
- }
-
- // Load icon.
- String icon = configElement.getAttribute(ATT_ICON);
- if (icon != null) {
- image = WorkbenchImages.getImageDescriptorFromExtension(
- configElement.getDeclaringExtension(), icon);
- }
-}
-/**
- * Creates a factory for a predefined perspective. If the perspective
- * is not predefined return null.
- *
- * @throws a CoreException if the object could not be instantiated.
- */
-public IPerspectiveFactory createFactory() throws CoreException {
- if (className == null)
- return null;
- Object obj = WorkbenchPlugin.createExtension(configElement, ATT_CLASS);
- return (IPerspectiveFactory) obj;
-}
-/**
- * Deletes the custom file for a perspective..
- */
-public boolean deleteCustomFile() {
- return customFile.delete();
-}
-/**
- * Returns the custom file.
- */
-public File getCustomFile() {
- return customFile;
-}
-/**
- * Returns the ID.
- */
-public String getId() {
- return id;
-}
-/**
- * Returns the descriptor of the image for this perspective.
- *
- * @return the descriptor of the image to display next to this perspective
- */
-public ImageDescriptor getImageDescriptor() {
- return image;
-}
-/**
- * Returns the label.
- */
-public String getLabel() {
- return label;
-}
-public String getOriginalId() {
- if(originalId == null)
- return id;
- return originalId;
-}
-/**
- * Returns true if this perspective has a custom file.
- */
-public boolean hasCustomFile() {
- return customFile.exists();
-}
-/**
- * Returns true if this perspective wants to be default.
- */
-public boolean hasDefaultFlag() {
- if (configElement == null)
- return false;
- String str = configElement.getAttribute(ATT_DEFAULT);
- if (str == null)
- return false;
- return str.equals("true");//$NON-NLS-1$
-}
-/**
- * Returns true if this perspective is predefined by an extension.
- */
-public boolean isPredefined() {
- return (className != null);
-}
-/**
- * Returns true if this perspective is a singleton.
- */
-public boolean isSingleton() {
- return singleton;
-}
-/**
- * @see IPersistable
- */
-public IStatus restoreState(IMemento memento) {
- IMemento childMem = memento.getChild(IWorkbenchConstants.TAG_DESCRIPTOR);
- if(childMem != null) {
- id = childMem.getString(IWorkbenchConstants.TAG_ID);
- originalId = childMem.getString(IWorkbenchConstants.TAG_DESCRIPTOR);
- label = childMem.getString(IWorkbenchConstants.TAG_LABEL);
- className = childMem.getString(IWorkbenchConstants.TAG_CLASS);
- String customFileStr = childMem.getString(IWorkbenchConstants.TAG_FILE);
- if(customFileStr != null) {
- IPath path = WorkbenchPlugin.getDefault().getStateLocation();
- path = path.append(customFileStr);
- customFile = path.toFile();
- }
- singleton = (childMem.getInteger(IWorkbenchConstants.TAG_SINGLETON) != null);
-
- //Find a descriptor in the registry.
- PerspectiveDescriptor descriptor = (PerspectiveDescriptor)WorkbenchPlugin.getDefault().
- getPerspectiveRegistry().findPerspectiveWithId(getOriginalId());
-
- if(descriptor != null)
- //Copy the state from the registred descriptor.
- image = descriptor.image;
- }
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
-}
-/**
- * Revert to the predefined extension template.
- * Does nothing if this descriptor is user defined.
- */
-public void revertToPredefined() {
- if (isPredefined())
- deleteCustomFile();
-}
-/**
- * @see IPersistable
- */
-public IStatus saveState(IMemento memento) {
- IMemento childMem = memento.createChild(IWorkbenchConstants.TAG_DESCRIPTOR);
- childMem.putString(IWorkbenchConstants.TAG_ID,id);
- if(originalId != null)
- childMem.putString(IWorkbenchConstants.TAG_DESCRIPTOR,originalId);
- childMem.putString(IWorkbenchConstants.TAG_LABEL,label);
- childMem.putString(IWorkbenchConstants.TAG_CLASS,className);
- childMem.putString(IWorkbenchConstants.TAG_FILE,customFile.getName());
- if (singleton)
- childMem.putInteger(IWorkbenchConstants.TAG_SINGLETON, 1);
- return new Status(IStatus.OK,PlatformUI.PLUGIN_ID,0,"",null);
-}
-/**
- * Sets the custom file.
- */
-public void setCustomFile(File file) {
- this.customFile = file;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveExtensionReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveExtensionReader.java
deleted file mode 100644
index 6481bc6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveExtensionReader.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
- Dan Rubel <dan_rubel@instantiations.com>
- - Fix for bug 11490 - define hidden view (placeholder for view) in plugin.xml
-**********************************************************************/
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.*;
-
-/**
- * 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 PageLayout pageLayout;
- private static final String TAG_EXTENSION="perspectiveExtension";//$NON-NLS-1$
- private static final String TAG_ACTION_SET="actionSet";//$NON-NLS-1$
- private static final String TAG_WIZARD_SHORTCUT="newWizardShortcut";//$NON-NLS-1$
- private static final String TAG_VIEW_SHORTCUT="viewShortcut";//$NON-NLS-1$
- private static final String TAG_PERSP_SHORTCUT="perspectiveShortcut";//$NON-NLS-1$
- private static final String TAG_VIEW="view";//$NON-NLS-1$
- private static final String ATT_ID="id";//$NON-NLS-1$
- private static final String ATT_TARGET_ID="targetID";//$NON-NLS-1$
- private static final String ATT_RELATIVE="relative";//$NON-NLS-1$
- private static final String ATT_RELATIONSHIP="relationship";//$NON-NLS-1$
- private static final String ATT_RATIO="ratio";//$NON-NLS-1$
- // ATT_VISIBLE added by dan_rubel@instantiations.com
- private static final String ATT_VISIBLE="visible";//$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_TOP="top";//$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_FAST="fast";//$NON-NLS-1$
- // VAL_FALSE added by dan_rubel@instantiations.com
- private static final String VAL_FALSE="false";//$NON-NLS-1$
-/**
- * RegistryViewReader constructor comment.
- */
-public PerspectiveExtensionReader() {
- super();
-}
-/**
- * Read the view extensions within a registry.
- */
-public void extendLayout(String id, PageLayout out)
-{
- targetID = id;
- pageLayout = out;
- readRegistry(Platform.getPluginRegistry(),
- PlatformUI.PLUGIN_ID,
- IWorkbenchConstants.PL_PERSPECTIVE_EXTENSIONS);
-}
-/**
- * Process an action set.
- */
-private boolean processActionSet(IConfigurationElement element) {
- String id = element.getAttribute(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 (int nX = 0; nX < children.length; nX ++) {
- IConfigurationElement child = children[nX];
- String type = child.getName();
- boolean result = false;
- if (type.equals(TAG_ACTION_SET))
- result = processActionSet(child);
- else if (type.equals(TAG_VIEW))
- result = processView(child);
- else if (type.equals(TAG_VIEW_SHORTCUT))
- result = processViewShortcut(child);
- else if (type.equals(TAG_WIZARD_SHORTCUT))
- result = processWizardShortcut(child);
- else if (type.equals(TAG_PERSP_SHORTCUT))
- result = processPerspectiveShortcut(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(ATT_ID);
- if (id != null)
- pageLayout.addPerspectiveShortcut(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(ATT_ID);
- String relative = element.getAttribute(ATT_RELATIVE);
- String relationship = element.getAttribute(ATT_RELATIONSHIP);
- String ratioString = element.getAttribute(ATT_RATIO);
- float ratio;
-
- if (id == null || relative == null || relationship == null)
- return false;
-
- // Get the ratio.
- if (ratioString == null) {
- // The ratio has not been specified.
- ratio = IPageLayout.NULL_RATIO;
- } else {
- try {
- ratio = new Float(ratioString).floatValue();
- } 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;
- boolean fast = false;
- int intRelation = 0;
- if (relationship.equals(VAL_LEFT))
- intRelation = IPageLayout.LEFT;
- else if (relationship.equals(VAL_RIGHT))
- intRelation = IPageLayout.RIGHT;
- else if (relationship.equals(VAL_TOP))
- intRelation = IPageLayout.TOP;
- else if (relationship.equals(VAL_BOTTOM))
- intRelation = IPageLayout.BOTTOM;
- else if (relationship.equals(VAL_STACK))
- stack = true;
- else if (relationship.equals(VAL_FAST))
- fast = true;
- else
- return false;
- boolean visible = !VAL_FALSE.equals(element.getAttribute(ATT_VISIBLE));
-
- // If stack ..
- if (stack) {
- if (visible)
- pageLayout.stackView(id, relative);
- else
- pageLayout.stackPlaceholder(id, relative);
- return true;
- }
-
- // If the view is a fast view...
- if (fast) {
- if (ratio == IPageLayout.NULL_RATIO) {
- // The ratio has not been specified.
- pageLayout.addFastView(id);
- } else {
- pageLayout.addFastView(id, ratio);
- }
- return true;
- }
-
- // 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)
- pageLayout.addView(id, intRelation, ratio, relative);
- else
- pageLayout.addPlaceholder(id, intRelation, ratio, relative);
- return true;
-}
-/**
- * Process a view shortcut
- */
-private boolean processViewShortcut(IConfigurationElement element) {
- String id = element.getAttribute(ATT_ID);
- if (id != null)
- pageLayout.addShowViewShortcut(id);
- return true;
-}
-/**
- * Process a wizard shortcut
- */
-private boolean processWizardShortcut(IConfigurationElement element) {
- String id = element.getAttribute(ATT_ID);
- if (id != null)
- pageLayout.addNewWizardShortcut(id);
- return true;
-}
-/**
- * readElement method comment.
- */
-protected boolean readElement(IConfigurationElement element) {
- String type = element.getName();
- if (type.equals(TAG_EXTENSION)) {
- String id = element.getAttribute(ATT_TARGET_ID);
- if (targetID.equals(id))
- return processExtension(element);
- return true;
- }
- return false;
-}
-}
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
deleted file mode 100644
index 8b17de2..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistry.java
+++ /dev/null
@@ -1,212 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.preference.IPreferenceStore;
-
-import java.io.IOException;
-import java.io.File;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import java.util.*;
-
-/**
- * Perspective registry.
- */
-public class PerspectiveRegistry implements IPerspectiveRegistry {
- private File rootFolder;
- private ArrayList children = new ArrayList(10);
- private String defPerspID;
- private static final String EXT = "_persp.xml";//$NON-NLS-1$
- private static final String ID_DEF_PERSP = "PerspectiveRegistry.DEFAULT_PERSP";//$NON-NLS-1$
-/**
- * Construct a new registry.
- *
- * @param rootFolder is the root folder for perspective files.
- */
-public PerspectiveRegistry(File rootFolder) {
- super();
- this.rootFolder = rootFolder;
-}
-/**
- * Adds a perspective. This is typically used by the reader.
- */
-public void addPerspective(PerspectiveDescriptor desc) {
- children.add(desc);
- desc.setCustomFile(new File(rootFolder, desc.getId() + EXT));
-}
-/**
- * Create a new perspective.
- * Return null if the creation failed.
- */
-public PerspectiveDescriptor createPerspective(String label,PerspectiveDescriptor originalDescriptor) {
- // Sanity check to avoid duplicate labels.
- if (!validateLabel(label))
- return null;
-
- // Calculate ID.
- String id = label.replace(' ', '_');
- id = id.trim();
-
- // Calculate storage file
- String name = id + EXT;
- File file = new File(rootFolder, name);
-
- // Create descriptor.
- PerspectiveDescriptor desc = new PerspectiveDescriptor(id, label,originalDescriptor);
- desc.setCustomFile(file);
- children.add(desc);
- return desc;
-}
-/**
- * Delete a perspective.
- * Has no effect if the perspective is defined in an extension.
- */
-public void deletePerspective(IPerspectiveDescriptor in) {
- PerspectiveDescriptor desc = (PerspectiveDescriptor)in;
- if (!desc.isPredefined()) {
- children.remove(desc);
- desc.deleteCustomFile();
- verifyDefaultPerspective();
- }
-}
-/**
- * @see IPerspectiveRegistry
- */
-public IPerspectiveDescriptor findPerspectiveWithId(String id) {
- Iterator enum = children.iterator();
- while (enum.hasNext()) {
- IPerspectiveDescriptor desc = (IPerspectiveDescriptor)enum.next();
- if (desc.getId().equals(id))
- return desc;
- }
- return null;
-}
-/**
- * @see IPerspectiveRegistry
- */
-public IPerspectiveDescriptor findPerspectiveWithLabel(String label) {
- Iterator enum = children.iterator();
- while (enum.hasNext()) {
- IPerspectiveDescriptor desc = (IPerspectiveDescriptor)enum.next();
- if (desc.getLabel().equals(label))
- return desc;
- }
- return null;
-}
-/**
- * Returns the id of the default perspective for the workbench. This identifies one
- * perspective extension within the workbench's perspective registry.
- *
- * @return the default perspective id; will never be <code>null</code>
- */
-public String getDefaultPerspective() {
- return defPerspID;
-}
-/**
- * @see IPerspectiveRegistry
- */
-public IPerspectiveDescriptor[] getPerspectives() {
- int nSize = children.size();
- IPerspectiveDescriptor [] retArray = new IPerspectiveDescriptor[nSize];
- for (int nX = 0; nX < nSize; nX ++) {
- retArray[nX] = (IPerspectiveDescriptor)children.get(nX);
- }
- return retArray;
-}
-/**
- * Loads the registry.
- */
-public void load() {
- // Load the registries.
- loadPredefined();
- loadCustom();
-
- // Get default perspective.
-
- defPerspID =
- WorkbenchPlugin.getDefault().getPreferenceStore().getString(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID);
- verifyDefaultPerspective();
-}
-/**
- * Read children from the file system.
- */
-private void loadCustom() {
- if (rootFolder.isDirectory()) {
- File [] fileList = rootFolder.listFiles();
- int nSize = fileList.length;
- for (int nX = 0; nX < nSize; nX ++) {
- File file = fileList[nX];
- if (file.getName().endsWith(EXT)) {
- try {
- PerspectiveDescriptor newPersp = new PerspectiveDescriptor(file);
- String id = newPersp.getId();
- IPerspectiveDescriptor oldPersp = findPerspectiveWithId(id);
- if (oldPersp == null)
- children.add(newPersp);
- } catch (IOException e) {
- } catch (WorkbenchException e) {
- }
- }
- }
- }
-}
-/**
- * Read children from the plugin registry.
- */
-private void loadPredefined() {
- PerspectiveRegistryReader reader = new PerspectiveRegistryReader();
- reader.readPerspectives(Platform.getPluginRegistry(), this);
-}
-/**
- * Sets the default perspective for the workbench to the given perspective id.
- * The id must correspond to one perspective extension within the workbench's
- * perspective registry.
- *
- * @param id a perspective id; must not be <code>null</code>
- */
-public void setDefaultPerspective(String id) {
- IPerspectiveDescriptor desc = findPerspectiveWithId(id);
- if (desc != null) {
- defPerspID = id;
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- store.setValue(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID, id);
- }
-}
-/**
- * Return true if a label is valid and unused.
- */
-public boolean validateLabel(String label) {
- label = label.trim();
- if (label.length() <= 0)
- return false;
- return true;
-}
-/**
- * Verifies the id of the default perspective. If the
- * default perspective is invalid use the workbench default.
- */
-private void verifyDefaultPerspective() {
- // Step 1: Try current defPerspId value.
- IPerspectiveDescriptor desc = null;
- if (defPerspID != null)
- desc = findPerspectiveWithId(defPerspID);
- if (desc != null)
- return;
-
- // Step 2. Read default value.
- defPerspID =
- WorkbenchPlugin.getDefault().getPreferenceStore().getDefaultString(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID);
- if (defPerspID != null)
- desc = findPerspectiveWithId(defPerspID);
- if (desc != null)
- return;
-
- // Step 3. Use internal workbench default.
- defPerspID = IWorkbenchConstants.DEFAULT_LAYOUT_ID;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistryReader.java
deleted file mode 100644
index c561a80..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PerspectiveRegistryReader.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.misc.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.*;
-
-/**
- * A strategy to read view extensions from the registry.
- */
-public class PerspectiveRegistryReader extends RegistryReader {
- private static final String TAG_LAYOUT="perspective";//$NON-NLS-1$
- private PerspectiveRegistry registry;
-
-/**
- * RegistryViewReader constructor comment.
- */
-public PerspectiveRegistryReader() {
- super();
-}
-/**
- * readElement method comment.
- */
-protected boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(TAG_LAYOUT)) {
- try {
- PerspectiveDescriptor desc = new PerspectiveDescriptor(element);
- registry.addPerspective(desc);
- } catch (CoreException e) {
- // log an error since its not safe to open a dialog here
- WorkbenchPlugin.log("Unable to create layout descriptor.",e.getStatus());//$NON-NLS-1$
- }
- return true;
- }
-
- return false;
-}
-/**
- * Read the view extensions within a registry.
- */
-public void readPerspectives(IPluginRegistry in, PerspectiveRegistry out)
-{
- registry = out;
- readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_PERSPECTIVES);
-}
-}
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
deleted file mode 100644
index 9442b04..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PreferencePageRegistryReader.java
+++ /dev/null
@@ -1,287 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IPluginRegistry;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.preference.*;
-import java.text.Collator;
-import java.util.*;
-import org.eclipse.ui.internal.misc.Sorter;
-
-/**
- * Instances access the registry that is provided at creation time in order
- * to determine the contributed preference pages
- */
-public class PreferencePageRegistryReader extends RegistryReader {
- public static final String ATT_CATEGORY = "category";//$NON-NLS-1$
- public static final String ATT_CLASS = "class";//$NON-NLS-1$
- public static final String ATT_NAME = "name";//$NON-NLS-1$
- public static final String ATT_ID = "id";//$NON-NLS-1$
- public static final String TAG_PAGE = "page";//$NON-NLS-1$
- public static final String ATT_ICON = "icon";//$NON-NLS-1$
- public static final String PREFERENCE_SEPARATOR = "/";//$NON-NLS-1$
- private List nodes;
- private IWorkbench workbench;
-
- /*
- * Internal class used to sort all the preference page nodes
- * based on the category.
- */
- class CategoryNode {
- private WorkbenchPreferenceNode node;
- private String flatCategory;
- /*
- * Default constructor
- */
- public CategoryNode(WorkbenchPreferenceNode node) {
- this.node = node;
- }
- /*
- * Return the preference node this category represents
- */
- public WorkbenchPreferenceNode getNode() {
- return node;
- }
- /*
- * Return the flatten category
- */
- public String getFlatCategory() {
- if (flatCategory == null) {
- initialize();
- if (flatCategory == null)
- flatCategory = node.getLabelText();
- }
- return flatCategory;
- }
- /*
- * Initialize the flat category to include the parents'
- * category names and the current node's label
- */
- private void initialize() {
- String category = node.getCategory();
- if (category == null)
- return;
-
- StringBuffer sb = new StringBuffer();
- StringTokenizer stok = new StringTokenizer(category, PREFERENCE_SEPARATOR);
- WorkbenchPreferenceNode immediateParent = null;
- while (stok.hasMoreTokens()) {
- String pathID = stok.nextToken();
- immediateParent = findNode(pathID);
- if (immediateParent == null)
- return;
- if (sb.length() > 0)
- sb.append(PREFERENCE_SEPARATOR);
- sb.append(immediateParent.getLabelText());
- }
-
- if (sb.length() > 0)
- sb.append(PREFERENCE_SEPARATOR);
- sb.append(node.getLabelText());
- flatCategory = sb.toString();
- }
- }
-/**
- * Create a new instance configured with the workbench
- */
-public PreferencePageRegistryReader(IWorkbench newWorkbench) {
- workbench = newWorkbench;
-}
-/**
- * Given the category of the node, tokenize it into
- * individual node ids and substitute these IDs
- * with node labels (if node with the matching ID
- * is found).
- */
-private String computeNamePath(WorkbenchPreferenceNode node) {
- String category = node.getCategory();
- if (category == null)
- return null;
- StringBuffer sb = new StringBuffer();
- StringTokenizer stok = new StringTokenizer(category, PREFERENCE_SEPARATOR);
- WorkbenchPreferenceNode immediateParent=null;
- while (stok.hasMoreTokens()) {
- String pathID = stok.nextToken();
- immediateParent = findNode(pathID);
- if (immediateParent == null) {
- // Cannot find the parent - ignore category
- return null;
- }
- if (sb.length() > 0) {
- sb.append(PREFERENCE_SEPARATOR);
- }
- sb.append(immediateParent.getLabelText());
- }
- return sb.toString();
-}
-/**
- * Searches for the top-level node with the given id.
- */
-private WorkbenchPreferenceNode findNode(String id) {
- for (int i = 0; i < nodes.size(); i++) {
- WorkbenchPreferenceNode node = (WorkbenchPreferenceNode) nodes.get(i);
- if (node.getId().equals(id))
- return node;
- }
- return null;
-}
-/**
- * Searches for the child node with the given ID in the provided parent node.
- * If not found, null is returned.
- */
-private WorkbenchPreferenceNode findNode(WorkbenchPreferenceNode parent, String id) {
- IPreferenceNode[] nodes = parent.getSubNodes();
- for (int i = 0; i < nodes.length; i++) {
- WorkbenchPreferenceNode node = (WorkbenchPreferenceNode) nodes[i];
- if (node.getId().equals(id))
- return node;
- }
- return null;
-}
-/**
- * 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.
- */
-public List getPreferenceContributions(IPluginRegistry registry) {
- loadNodesFromRegistry(registry); //all nodes keyed on category
- List contributions = new ArrayList(); //root nodes (which contain subnodes)
-
- //Add root nodes to the contributions vector
- StringTokenizer tokenizer;
- String currentToken;
- IPreferenceNode workbenchNode;
-
- //Make the workbench preferences the first category
- workbenchNode = findNode(IWorkbenchConstants.WORKBENCH_PREFERENCE_CATEGORY_ID);
- if (workbenchNode == null) {
- //We must create a page for the workbench node (unlikely to occur but just in case)
- workbenchNode = new WorkbenchPreferenceNode(
- IWorkbenchConstants.WORKBENCH_PREFERENCE_CATEGORY_ID,
- "Workbench",//$NON-NLS-1$
- null,
- null,
- new EmptyPreferencePage());
- nodes.add(workbenchNode);
- }
- contributions.add(workbenchNode);
-
- // Sort nodes based on flattened display path composed of
- // actual labels of nodes referenced in category attribute.
- Object [] sortedNodes = sortByCategories(nodes);
- for (int i = 0; i < sortedNodes.length; i++) {
- //Iterate through all the nodes
- CategoryNode categoryNode = (CategoryNode)sortedNodes[i];
- WorkbenchPreferenceNode node = categoryNode.getNode();
- if (node == workbenchNode) continue;
- String category = node.getCategory();
- if (category == null) {
- contributions.add(node);
- continue;
- }
- // has category
- tokenizer = new StringTokenizer(category, PREFERENCE_SEPARATOR);
- WorkbenchPreferenceNode parent = null;
- while (tokenizer.hasMoreElements()) {
- currentToken = tokenizer.nextToken();
- WorkbenchPreferenceNode child = null;
- if (parent == null)
- child = findNode(currentToken);
- else
- child = findNode(parent, currentToken);
- if (child == null) {
- parent = null;
- break;
- }
- else {
- parent = child;
- }
- }
- if (parent != null) {
- parent.add(node);
- }
- else {
- //Could not find the parent - log
- WorkbenchPlugin.log("Invalid preference page path: "+categoryNode.getFlatCategory());//$NON-NLS-1$
- contributions.add(node);
- }
- }
- return contributions;
-}
-/**
- * Get the preference nodes that are defined in the registry
- */
-protected void loadNodesFromRegistry(IPluginRegistry registry) {
- nodes = new ArrayList();
- readRegistry(registry, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_PREFERENCES);
-}
-/**
- * Read preference page element.
- */
-protected boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(TAG_PAGE) == false)
- return false;
- String name = element.getAttribute(ATT_NAME);
- String id = element.getAttribute(ATT_ID);
- String category = element.getAttribute(ATT_CATEGORY);
- String imageName = element.getAttribute(ATT_ICON);
- String className = element.getAttribute(ATT_CLASS);
- if (name==null) {
- logMissingAttribute(element, ATT_NAME);
- }
- if (id==null) {
- logMissingAttribute(element, ATT_ID);
- }
- if (className==null) {
- logMissingAttribute(element, ATT_CLASS);
- }
- if (name==null || id == null || className == null) {
- return true;
- }
- ImageDescriptor image = null;
- if (imageName != null) {
- image = WorkbenchImages.getImageDescriptorFromPlugin(element.getDeclaringExtension().getDeclaringPluginDescriptor(), imageName);
- }
- WorkbenchPreferenceNode node = new WorkbenchPreferenceNode(id, name, category, image, element, workbench);
- nodes.add(node);
- readElementChildren(element);
- return true;
-}
-/**
- * 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.
- */
-private Object[] sortByCategories(List nodes) {
- //sort by categories
- CategoryNode [] nodeArray = new CategoryNode [nodes.size()];
-
- for (int i=0; i<nodes.size(); i++) {
- nodeArray[i] = new CategoryNode((WorkbenchPreferenceNode)nodes.get(i));
- }
-
- Sorter sorter = new Sorter() {
- private Collator collator = Collator.getInstance();
-
- public boolean compare(Object o1, Object o2) {
- String s1 = ((CategoryNode)o1).getFlatCategory();
- String s2 = ((CategoryNode)o2).getFlatCategory();
- //Return true if elementTwo is 'greater than' elementOne
- return collator.compare(s2, s1) > 0;
- }
- };
- return sorter.sort(nodeArray);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ProjectImageRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ProjectImageRegistry.java
deleted file mode 100644
index 2d6f1e6..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ProjectImageRegistry.java
+++ /dev/null
@@ -1,38 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import java.util.*;
-/**
- * Registry to hold mappings from project natures to images
- */
-
-public class ProjectImageRegistry {
- private Map map = new HashMap(10);
-/**
- * Returns the image for the given nature id or
- * <code>null</code> if no image is registered for the given id
- */
-public ImageDescriptor getNatureImage(String natureId) {
- return (ImageDescriptor)map.get(natureId);
-}
-/**
- * Reads from the plugin registry.
- */
-public void load() {
- ProjectImageRegistryReader reader = new ProjectImageRegistryReader();
- reader.readProjectNatureImages(Platform.getPluginRegistry(), this);
-}
-/**
- * Sets the image for the given nature id
- */
-public void setNatureImage(String natureId, ImageDescriptor image) {
- map.put(natureId, image);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ProjectImageRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ProjectImageRegistryReader.java
deleted file mode 100644
index beb48b3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ProjectImageRegistryReader.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * A strategy to project nature image extensions from the registry.
- *
- * @deprecated Extension point no longer applicable with new project capability
- */
-public class ProjectImageRegistryReader extends RegistryReader {
- private static final String TAG_IMAGE="image";//$NON-NLS-1$
- private static final String ATT_ID="id";//$NON-NLS-1$
- private static final String ATT_NATURE_ID="natureId";//$NON-NLS-1$
- private static final String ATT_ICON="icon";//$NON-NLS-1$
- private ProjectImageRegistry registry;
-
-/**
- * Reads the contents of the given element
- */
-protected boolean readElement(IConfigurationElement element) {
- if (!element.getName().equals(TAG_IMAGE))
- return false;
-
- String id = element.getAttribute(ATT_ID);
- if (id == null) {
- logMissingAttribute(element, ATT_ID);
- return true;
- }
-
- String natureId = element.getAttribute(ATT_NATURE_ID);
- if (natureId == null) {
- logMissingAttribute(element, ATT_NATURE_ID);
- return true;
- }
-
- String icon = element.getAttribute(ATT_ICON);
- if (icon == null) {
- logMissingAttribute(element, ATT_ICON);
- return true;
- }
- ImageDescriptor image = WorkbenchImages.getImageDescriptorFromExtension(
- element.getDeclaringExtension(), icon);
-
- if (image != null)
- registry.setNatureImage(natureId, image);
-
- return true;
-}
-/**
- * Read the project nature images within a registry.
- */
-public void readProjectNatureImages(IPluginRegistry in, ProjectImageRegistry out)
-{
- registry = out;
- readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_PROJECT_NATURE_IMAGES);
-}
-}
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
deleted file mode 100644
index 980d024..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/PropertyPagesRegistryReader.java
+++ /dev/null
@@ -1,150 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.*;
-import org.eclipse.ui.internal.dialogs.*;
-import java.util.*;
-
-/**
- * This class loads property pages from the registry.
- */
-public class PropertyPagesRegistryReader extends RegistryReader {
- public static final String ATT_NAME_FILTER = "nameFilter";//$NON-NLS-1$
- public static final String ATT_FILTER_NAME = "name";//$NON-NLS-1$
- public static final String ATT_FILTER_VALUE = "value";//$NON-NLS-1$
- public static final String ATT_CLASS = "class";//$NON-NLS-1$
-
- private static final String TAG_PAGE = "page";//$NON-NLS-1$
- private static final String TAG_CONTRIBUTOR = "contributor";//$NON-NLS-1$
- private static final String TAG_FILTER="filter";//$NON-NLS-1$
- private static final String ATT_NAME = "name";//$NON-NLS-1$
- private static final String ATT_ID = "id";//$NON-NLS-1$
- private static final String ATT_ICON = "icon";//$NON-NLS-1$
- private static final String ATT_OBJECTCLASS = "objectClass";//$NON-NLS-1$
- private static final String ATT_ADAPTABLE = "adaptable";//$NON-NLS-1$
-
- private static final String P_TRUE = "true";//$NON-NLS-1$
-
- private HashMap filterProperties;
- private PropertyPageContributorManager manager;
-/**
- * The constructor.
- */
-public PropertyPagesRegistryReader(PropertyPageContributorManager manager) {
- this.manager = manager;
-}
-/**
- * Parses child element and processes it
- */
-private void processChildElement(IConfigurationElement element) {
- String tag = element.getName();
- if (tag.equals(TAG_FILTER)) {
- String key = element.getAttribute(ATT_FILTER_NAME);
- String value = element.getAttribute(ATT_FILTER_VALUE);
- if (key == null || value == null)
- return;
- if (filterProperties==null)
- filterProperties = new HashMap();
- filterProperties.put(key, value);
- }
-}
-/**
- * Reads dynamic (contributor-based) property page specification.
- */
-private void processContributorElement(IConfigurationElement element) {
- String contributorClassName = element.getAttribute(ATT_CLASS);
- String objectClassName = element.getAttribute(ATT_OBJECTCLASS);
- if (objectClassName == null || contributorClassName == null) {
- // cannot safely open dialog so log the problem
- WorkbenchPlugin.log(
- "Unable to create property page contributor. Object class or contributor class are not specified."//$NON-NLS-1$
- );
- return;
- }
- IPropertyPageContributor contributor;
- try {
- contributor = (IPropertyPageContributor)WorkbenchPlugin.createExtension(
- element, ATT_CLASS);
- } catch (CoreException e) {
- // cannot safely open dialog so log the problem
- WorkbenchPlugin.log("Unable to create property page contributor.",e.getStatus());//$NON-NLS-1$
- return;
- }
- registerContributor(objectClassName, contributor);
-}
-/**
- * Reads static property page specification.
- */
-private void processPageElement(IConfigurationElement element) {
- String pageId = element.getAttribute(ATT_ID);
- String pageName = element.getAttribute(ATT_NAME);
- String iconName = element.getAttribute(ATT_ICON);
- String pageClassName = element.getAttribute(ATT_CLASS);
- String objectClassName = element.getAttribute(ATT_OBJECTCLASS);
- String adaptable = element.getAttribute(ATT_ADAPTABLE);
-
- if (pageId==null) {
- logMissingAttribute(element, ATT_ID);
- return;
- }
- if (objectClassName == null) {
- logMissingAttribute(element, ATT_OBJECTCLASS);
- return;
- }
- if (pageClassName == null) {
- logMissingAttribute(element, ATT_CLASS);
- return;
- }
-
- filterProperties = null;
- IConfigurationElement[] children = element.getChildren();
- for (int i=0; i<children.length; i++) {
- processChildElement(children[i]);
- }
-
- IPropertyPageContributor contributor =
- new RegistryPageContributor(
- pageId,
- pageName,
- iconName,
- filterProperties,
- objectClassName,
- P_TRUE.equalsIgnoreCase(adaptable),
- element);
- registerContributor(objectClassName, contributor);
-}
-/**
- * Reads the next contribution element.
- */
-protected boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(TAG_PAGE)) {
- processPageElement(element);
- readElementChildren(element);
- return true;
- }
- if (element.getName().equals(TAG_FILTER)) {
- return true;
- }
-
- return false;
-}
-/**
- * Creates object class instance and registers the contributor with the
- * property page manager.
- */
-private void registerContributor(String objectClassName, IPropertyPageContributor contributor) {
- manager.registerContributor(contributor, objectClassName);
-}
-/**
- * Reads all occurances of propertyPages extension in the registry.
- */
-public void registerPropertyPages(IPluginRegistry registry) {
- readRegistry(registry, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_PROPERTY_PAGES);
-}
-}
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
deleted file mode 100644
index e629d14..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/RegistryReader.java
+++ /dev/null
@@ -1,143 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.misc.Sorter;
-
-/**
- * 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 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 {
- protected static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
-/**
- * The constructor.
- */
-protected RegistryReader() {
-}
-/**
- * This method extracts description as a subelement of
- * the given element.
- * @return description string if defined, or empty string
- * if not.
- */
-protected String getDescription(IConfigurationElement config) {
- IConfigurationElement [] children = config.getChildren(TAG_DESCRIPTION);
- if (children.length>=1) {
- return children[0].getValue();
- }
- return "";//$NON-NLS-1$
-}
-/**
- * Logs the error in the workbench log using the provided
- * text and the information in the configuration element.
- */
-protected void logError(IConfigurationElement element, String text) {
- IExtension extension = element.getDeclaringExtension();
- IPluginDescriptor descriptor = extension.getDeclaringPluginDescriptor();
- StringBuffer buf = new StringBuffer();
- buf.append("Plugin " + descriptor.getUniqueIdentifier() + ", extension " + extension.getExtensionPointUniqueIdentifier());//$NON-NLS-2$//$NON-NLS-1$
- buf.append("\n"+text);//$NON-NLS-1$
- WorkbenchPlugin.log(buf.toString());
-}
-/**
- * Logs a very common registry error when a required attribute is missing.
- */
-protected void logMissingAttribute(IConfigurationElement element, String attributeName) {
- logError(element, "Required attribute '"+attributeName+"' not defined");//$NON-NLS-2$//$NON-NLS-1$
-}
-/**
- * Logs a registry error when the configuration element is unknown.
- */
-protected 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.
- */
-protected IExtension[] orderExtensions(IExtension[] extensions) {
- // By default, the order is based on plugin id sorted
- // in ascending order. The order for a plugin providing
- // more than one extension for an extension point is
- // dependent in the order listed in the XML file.
- Sorter sorter = new Sorter() {
- public boolean compare(Object extension1, Object extension2) {
- String s1 = ((IExtension)extension1).getDeclaringPluginDescriptor().getUniqueIdentifier().toUpperCase();
- String s2 = ((IExtension)extension2).getDeclaringPluginDescriptor().getUniqueIdentifier().toUpperCase();
- //Return true if elementTwo is 'greater than' elementOne
- return s2.compareTo(s1) > 0;
- }
- };
-
- Object[] sorted = sorter.sort(extensions);
- IExtension[] sortedExtension = new IExtension[sorted.length];
- System.arraycopy(sorted, 0, sortedExtension, 0, sorted.length);
- return sortedExtension;
-}
-/**
- * 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.
- */
-protected void readRegistry(IPluginRegistry registry, String pluginId, String extensionPoint) {
- IExtensionPoint point = registry.getExtensionPoint(pluginId, extensionPoint);
- if (point != null) {
- IExtension[] extensions = point.getExtensions();
- extensions = orderExtensions(extensions);
- for (int i = 0; i < extensions.length; i++)
- readExtension(extensions[i]);
- }
-}
-}
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
deleted file mode 100644
index 62e459d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewDescriptor.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.StringTokenizer;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.*;
-
-/**
- * Capture the attributes of a view extension.
- */
-public class ViewDescriptor implements IViewDescriptor {
- private String id;
- private ImageDescriptor imageDescriptor;
- 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_ACCELERATOR="accelerator";//$NON-NLS-1$
- private static final String ATT_ICON="icon";//$NON-NLS-1$
- private static final String ATT_CATEGORY="category";//$NON-NLS-1$
- private static final String ATT_CLASS="class";//$NON-NLS-1$
- private static final String ATT_RATIO="fastViewWidthRatio";//$NON-NLS-1$
- private String label;
- private String accelerator;
- private String className;
- private IConfigurationElement configElement;
- private String [] categoryPath;
- private float fastViewWidthRatio;
-/**
- * Create a new ViewDescriptor for an extension.
- */
-public ViewDescriptor(IConfigurationElement e) throws CoreException {
- configElement = e;
- loadFromExtension();
-}
-/**
- * Return an instance of the declared view.
- */
-public IViewPart createView() throws CoreException
-{
- Object obj = WorkbenchPlugin.createExtension(configElement, ATT_CLASS);
- return (IViewPart) obj;
-}
-/**
- * Returns tokens for the category path or null if not defined.
- */
-public String[] getCategoryPath() {
- return categoryPath;
-}
-public IConfigurationElement getConfigurationElement() {
- return configElement;
-}
-public String getID() {
- return id;
-}
-public String getId() {
- return id;
-}
-public ImageDescriptor getImageDescriptor() {
- if (imageDescriptor != null)
- return imageDescriptor;
- String iconName = configElement.getAttribute(ATT_ICON);
- if (iconName == null)
- return null;
- imageDescriptor =
- WorkbenchImages.getImageDescriptorFromExtension(
- configElement.getDeclaringExtension(),
- iconName);
- return imageDescriptor;
-}
-
-public String getLabel() {
- return label;
-}
-
-public String getAccelerator() {
- return accelerator;
-}
-
-public float getFastViewWidthRatio() {
- return fastViewWidthRatio;
-}
-
-/**
- * load a view descriptor from the registry.
- */
-private void loadFromExtension() throws CoreException {
- id = configElement.getAttribute(ATT_ID);
- label = configElement.getAttribute(ATT_NAME);
- accelerator = configElement.getAttribute(ATT_ACCELERATOR);
- className = configElement.getAttribute(ATT_CLASS);
- String category = configElement.getAttribute(ATT_CATEGORY);
- String ratio = configElement.getAttribute(ATT_RATIO);
-
- // Sanity check.
- if ((label == null) || (className == null)) {
- throw new CoreException(
- new Status(
- IStatus.ERROR,
- configElement.getDeclaringExtension().getDeclaringPluginDescriptor().getUniqueIdentifier(),
- 0,
- "Invalid extension (missing label or class name): " + id, //$NON-NLS-1$
- null));
- }
- if (category != null) {
- StringTokenizer stok = new StringTokenizer(category, "/");//$NON-NLS-1$
- categoryPath = new String[stok.countTokens()];
- // Parse the path tokens and store them
- for (int i = 0; stok.hasMoreTokens(); i++) {
- categoryPath[i] = stok.nextToken();
- }
- }
-
- if(ratio != null) {
- try {
- fastViewWidthRatio = new Float(ratio).floatValue();
- if(fastViewWidthRatio > IPageLayout.RATIO_MAX)
- fastViewWidthRatio = IPageLayout.RATIO_MAX;
- if(fastViewWidthRatio < IPageLayout.RATIO_MIN)
- fastViewWidthRatio = IPageLayout.RATIO_MIN;
- } catch(NumberFormatException e) {
- fastViewWidthRatio = IPageLayout.DEFAULT_FASTVIEW_RATIO;
- }
- } else {
- fastViewWidthRatio = IPageLayout.DEFAULT_FASTVIEW_RATIO;
- }
-}
-/**
- * Returns a string representation of this descriptor. For
- * debugging purposes only.
- */
-public String toString() {
- return "View(" + getID() + ")";//$NON-NLS-2$//$NON-NLS-1$
-}
-}
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
deleted file mode 100644
index 1f2334a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.*;
-import java.util.*;
-
-/**
- * The central manager for view descriptors.
- */
-public class ViewRegistry implements IViewRegistry {
- private List views;
- private List categories;
- private Category miscCategory;
-/**
- * Create a new ViewRegistry.
- */
-public ViewRegistry() {
- views = new ArrayList();
- categories = new ArrayList();
-}
-/**
- * Add a category to the registry.
- */
-public void add(ICategory desc) {
- /* fix for 1877 */
- if (findCategory(desc.getId()) == null)
- categories.add(desc);
-}
-/**
- * Add a descriptor to the registry.
- */
-public void add(IViewDescriptor desc) {
- views.add(desc);
-}
-/**
- * Find a descriptor in the registry.
- */
-public IViewDescriptor find(String id) {
- Iterator enum = views.iterator();
- while (enum.hasNext()) {
- IViewDescriptor desc = (IViewDescriptor) enum.next();
- if (id.equals(desc.getID())) {
- return desc;
- }
- }
- return null;
-}
-/**
- * Find a category with a given name.
- */
-public ICategory findCategory(String id) {
- Iterator enum = categories.iterator();
- while (enum.hasNext()) {
- Category cat = (Category) enum.next();
- if (id.equals(cat.getRootPath())) {
- return cat;
- }
- }
- return null;
-}
-/**
- * Get the list of view categories.
- */
-public ICategory [] getCategories() {
- int nSize = categories.size();
- ICategory [] retArray = new ICategory[nSize];
- categories.toArray(retArray);
- return retArray;
-}
-/**
- * Return the view category count.
- */
-public int getCategoryCount() {
- return categories.size();
-}
-/**
- * Returns the Misc category.
- * This may be null if there are no miscellaneous views.
- */
-public ICategory getMiscCategory() {
- return miscCategory;
-}
-/**
- * Return the view count.
- */
-public int getViewCount() {
- return views.size();
-}
-/**
- * Get an enumeration of view descriptors.
- */
-public IViewDescriptor [] getViews() {
- int nSize = views.size();
- IViewDescriptor [] retArray = new IViewDescriptor[nSize];
- views.toArray(retArray);
- return retArray;
-}
-/**
- * Adds each view in the registry to a particular category.
- * The view category may be defined in xml. If not, the view is
- * added to the "misc" category.
- */
-public void mapViewsToCategories() {
- Iterator enum = views.iterator();
- while (enum.hasNext()) {
- IViewDescriptor desc = (IViewDescriptor) enum.next();
- Category cat = null;
- String [] catPath = desc.getCategoryPath();
- if (catPath != null) {
- String rootCat = catPath[0];
- cat = (Category)findCategory(rootCat);
- }
- if (cat != null) {
- cat.addElement(desc);
- } else {
- if (miscCategory == null) {
- miscCategory = new Category();
- categories.add(miscCategory);
- }
- miscCategory.addElement(desc);
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistryReader.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistryReader.java
deleted file mode 100644
index 5a9ecdb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistryReader.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.internal.misc.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.*;
-
-/**
- * A strategy to read view extensions from the registry.
- */
-public class ViewRegistryReader extends RegistryReader {
- private static final String TAG_VIEW="view";//$NON-NLS-1$
- private static final String TAG_CATEGORY="category";//$NON-NLS-1$
- private ViewRegistry viewRegistry;
-
-/**
- * RegistryViewReader constructor comment.
- */
-public ViewRegistryReader() {
- super();
-}
-/**
- * Reads the category element.
- */
-protected void readCategory(IConfigurationElement element) {
- try {
- Category category = new Category(element);
- viewRegistry.add(category);
- } catch (CoreException e) {
- // log an error since its not safe to show a dialog here
- WorkbenchPlugin.log("Unable to create view category.", e.getStatus());//$NON-NLS-1$
- }
-}
-/**
- * readElement method comment.
- */
-protected boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(TAG_VIEW)) {
- readView(element);
- readElementChildren(element);
- return true;
- }
- if (element.getName().equals(TAG_CATEGORY)) {
- readCategory(element);
- readElementChildren(element);
- return true;
- }
-
- return false;
-}
-/**
- * Reads the view element.
- */
-protected void readView(IConfigurationElement element) {
- try {
- ViewDescriptor desc = new ViewDescriptor(element);
- viewRegistry.add(desc);
- } catch (CoreException e) {
- // log an error since its not safe to open a dialog here
- WorkbenchPlugin.log("Unable to create view descriptor." , e.getStatus());//$NON-NLS-1$
- }
-}
-/**
- * Read the view extensions within a registry.
- */
-public void readViews(IPluginRegistry in, ViewRegistry out)
- throws CoreException {
- // this does not seem to really ever be throwing an the exception
- viewRegistry = out;
- readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_VIEWS);
- out.mapViewsToCategories();
-}
-}
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
deleted file mode 100644
index ae84ecf..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WizardsRegistryReader.java
+++ /dev/null
@@ -1,145 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.ui.internal.misc.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.ui.internal.dialogs.*;
-import java.util.*;
-
-/**
- * Instances access the registry that is provided at creation time
- * in order to determine the contained Wizards
- */
-public class WizardsRegistryReader extends RegistryReader {
- protected AdaptableList wizards;
- private String pluginPoint;
-
- protected final static String TAG_WIZARD = "wizard";//$NON-NLS-1$
-
- protected final static String ATT_NAME = "name";//$NON-NLS-1$
- public final static String ATT_CLASS = "class";//$NON-NLS-1$
- protected final static String ATT_ICON = "icon";//$NON-NLS-1$
- protected final static String ATT_ID = "id";//$NON-NLS-1$
- protected final static String trueString = "TRUE";//$NON-NLS-1$
-/**
- * Create an instance of this class.
- *
- * @param pluginPointId java.lang.String
- */
-public WizardsRegistryReader(String pluginPointId) {
- pluginPoint = pluginPointId;
-}
-/**
- * Adds new wizard to the provided collection. Override to
- * provide more logic.
- */
-protected void addNewElementToResult(WorkbenchWizardElement wizard, IConfigurationElement config, AdaptableList result) {
- result.add(wizard);
-}
-/**
- * Creates empty element collection. Overrider to fill
- * initial elements, if needed.
- */
-protected AdaptableList createEmptyWizardCollection() {
- return new AdaptableList();
-}
-/**
- * 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
- String nameString = element.getAttribute(ATT_NAME);
- if (nameString == null) {
- logMissingAttribute(element, ATT_NAME);
- return null;
- }
- WorkbenchWizardElement result = new WorkbenchWizardElement(nameString);
- if (initializeWizard(result, element))
- return result; // ie.- initialization was successful
-
- return null;
-}
-/**
- * Returns the first wizard with a given id.
- */
-public WorkbenchWizardElement findWizard(String id) {
- Object [] wizards = getWizards().getChildren();
- for (int nX = 0; nX < wizards.length; nX ++) {
- WizardCollectionElement collection = (WizardCollectionElement)wizards[nX];
- WorkbenchWizardElement element = collection.findWizard(id,true);
- if (element != null)
- return element;
- }
- return null;
-}
-/**
- * Returns a list of wizards, project and not.
- *
- * The return value for this method is cached since computing its value
- * requires non-trivial work.
- */
-public AdaptableList getWizards() {
- if (wizards == null)
- readWizards();
- return wizards;
-}
-/**
- * Initialize the passed element's properties based on the contents of
- * the passed registry. Answer a boolean indicating whether the element
- * was able to be adequately initialized.
- *
- * @return boolean
- * @param element WorkbenchWizardElement
- * @param extension Extension
- */
-protected boolean initializeWizard(WorkbenchWizardElement element, IConfigurationElement config) {
- element.setID(config.getAttribute(ATT_ID));
- element.setDescription(getDescription(config));
-
- // apply CLASS and ICON properties
- element.setConfigurationElement(config);
- String iconName = config.getAttribute(ATT_ICON);
- if (iconName != null) {
- IExtension extension = config.getDeclaringExtension();
- element.setImageDescriptor(WorkbenchImages.getImageDescriptorFromExtension(extension, iconName));
- }
- // ensure that a class was specified
- if (element.getConfigurationElement() == null) {
- logMissingAttribute(config, ATT_CLASS);
- return false;
- }
- return true;
-}
-/**
- * Implement this method to read element attributes.
- */
-protected boolean readElement(IConfigurationElement element) {
- if (!element.getName().equals(TAG_WIZARD))
- return false;
- WorkbenchWizardElement wizard = createWizardElement(element);
- if (wizard != null)
- addNewElementToResult(wizard, element, wizards);
- return true;
-}
-/**
- * Reads the wizards in a registry.
- */
-protected void readWizards() {
- if (wizards == null) {
- wizards = createEmptyWizardCollection();
- IPluginRegistry pregistry = Platform.getPluginRegistry();
- readRegistry(pregistry, PlatformUI.PLUGIN_ID, pluginPoint);
- }
-}
-}
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
deleted file mode 100644
index 57026fb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetDescriptor.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package org.eclipse.ui.internal.registry;
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.dialogs.IWorkingSetPage;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * A working set descriptor stores the plugin registry data for
- * a working set page extension.
- *
- * @since 2.0
- */
-public class WorkingSetDescriptor {
- private String id;
- private String name;
- private String icon;
- private String pageClassName;
- private IConfigurationElement configElement;
-
- 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_ICON = "icon"; //$NON-NLS-1$
- private static final String ATT_PAGE_CLASS = "pageClass"; //$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);
-
- if (name == null) {
- throw new CoreException(new Status(
- IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH,
- 0,
- "Invalid extension (missing class name): " + id, //$NON-NLS-1$
- null));
- }
- if (pageClassName == null) {
- throw new CoreException(new Status(
- IStatus.ERROR,
- WorkbenchPlugin.PI_WORKBENCH,
- 0,
- "Invalid extension (missing page class name): " + id, //$NON-NLS-1$
- null));
- }
- }
- /**
- * 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)
- return null;
- URL url;
- try {
- URL pluginInstallUrl = configElement.getDeclaringExtension().getDeclaringPluginDescriptor().getInstallURL();
- url= new URL(pluginInstallUrl, icon);
- } catch (MalformedURLException exception) {
- WorkbenchPlugin.log("Unable to load working set icon"); //$NON-NLS-1$
- return null;
- }
- return ImageDescriptor.createFromURL(url);
- }
- /**
- * 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
- */
- 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;
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 0039965..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistry.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.eclipse.ui.internal.registry;
-/*
- * (c) Copyright IBM Corp. 2002.
- * All Rights Reserved.
- */
-
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.ui.dialogs.IWorkingSetPage;
-
-/**
- * Stores working set descriptors for working set extensions.
- */
-public class WorkingSetRegistry {
- // used in Workbench plugin.xml for default workingSet extension
- private static final String DEFAULT_PAGE_ID = "org.eclipse.ui.resourceWorkingSetPage"; //$NON-NLS-1$
-
- private HashMap workingSetDescriptors = new HashMap();
-
- /**
- * 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$
- workingSetDescriptors.put(descriptor.getId(), descriptor);
- }
- /**
- * Returns the default, resource based, working set page
- *
- * @return the default working set page.
- */
- public IWorkingSetPage getDefaultWorkingSetPage() {
- WorkingSetDescriptor descriptor = (WorkingSetDescriptor) 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) {
- return (WorkingSetDescriptor) workingSetDescriptors.get(pageId);
- }
- /**
- * Returns an array of all working set descriptors.
- *
- * @return an array of all working set descriptors.
- */
- public WorkingSetDescriptor[] getWorkingSetDescriptors() {
- return (WorkingSetDescriptor[]) workingSetDescriptors.values().toArray(new WorkingSetDescriptor[workingSetDescriptors.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) {
- WorkingSetDescriptor descriptor = (WorkingSetDescriptor) workingSetDescriptors.get(pageId);
-
- if (descriptor == null) {
- return null;
- }
- return descriptor.createWorkingSetPage();
- }
- /**
- * Loads the working set registry.
- */
- public void load() {
- WorkingSetRegistryReader reader = new WorkingSetRegistryReader();
- reader.readWorkingSets(Platform.getPluginRegistry(), this);
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 107eebe5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/WorkingSetRegistryReader.java
+++ /dev/null
@@ -1,48 +0,0 @@
-package org.eclipse.ui.internal.registry;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * A strategy to read working set extensions from the registry.
- */
-public class WorkingSetRegistryReader extends RegistryReader {
- private static final String TAG="workingSet"; //$NON-NLS-1$
- private WorkingSetRegistry registry;
-
-/**
- * Overrides method in RegistryReader.
- *
- * @see RegistryReader#readElement(IConfigurationElement)
- */
-protected boolean readElement(IConfigurationElement element) {
- if (element.getName().equals(TAG)) {
- 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;
-}
-/**
- * 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(IPluginRegistry in, WorkingSetRegistry out) {
- registry = out;
- readRegistry(in, PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_WORKINGSETS);
-}
-}
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
deleted file mode 100644
index e9fa13f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/IWorkbenchAdapter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.eclipse.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.resource.ImageDescriptor;
-import java.util.Iterator;
-
-/**
- * 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 WorkbenchContentProvider
- */
-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 object The object to get the children for.
- */
-public 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.
- */
-public 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 object The object to get a label for.
- */
-public 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 object The object to get the parent for.
- */
-public Object getParent(Object o);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchContentProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchContentProvider.java
deleted file mode 100644
index 7ab023b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchContentProvider.java
+++ /dev/null
@@ -1,194 +0,0 @@
-package org.eclipse.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.*;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.*;
-
-/**
- * Provides tree contents for objects that have the IWorkbenchAdapter
- * adapter registered.
- */
-public class WorkbenchContentProvider implements ITreeContentProvider, IResourceChangeListener {
- protected Viewer viewer;
-/* (non-Javadoc)
- * Method declared on IContentProvider.
- */
-public void dispose() {
- if (viewer != null) {
- Object obj = viewer.getInput();
- if (obj instanceof IWorkspace) {
- IWorkspace workspace = (IWorkspace) obj;
- workspace.removeResourceChangeListener(this);
- } else
- if (obj instanceof IContainer) {
- IWorkspace workspace = ((IContainer) obj).getWorkspace();
- workspace.removeResourceChangeListener(this);
- }
- }
-}
-/**
- * Returns the implementation of IWorkbenchAdapter for the given
- * object. Returns null if the adapter is not defined or the
- * object is not adaptable.
- */
-protected IWorkbenchAdapter getAdapter(Object o) {
- if (!(o instanceof IAdaptable)) {
- return null;
- }
- return (IWorkbenchAdapter)((IAdaptable)o).getAdapter(IWorkbenchAdapter.class);
-}
-/* (non-Javadoc)
- * Method declared on ITreeContentProvider.
- */
-public Object[] getChildren(Object element) {
- IWorkbenchAdapter adapter = getAdapter(element);
- if (adapter != null) {
- return adapter.getChildren(element);
- }
- return new Object[0];
-}
-/* (non-Javadoc)
- * Method declared on IStructuredContentProvider.
- */
-public Object[] getElements(Object element) {
- return getChildren(element);
-}
-/* (non-Javadoc)
- * Method declared on ITreeContentProvider.
- */
-public Object getParent(Object element) {
- IWorkbenchAdapter adapter = getAdapter(element);
- if (adapter != null) {
- return adapter.getParent(element);
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on ITreeContentProvider.
- */
-public boolean hasChildren(Object element) {
- return getChildren(element).length > 0;
-}
-/* (non-Javadoc)
- * Method declared on IContentProvider.
- */
-public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- this.viewer = viewer;
- IWorkspace oldWorkspace = null;
- IWorkspace newWorkspace = null;
- if (oldInput instanceof IWorkspace) {
- oldWorkspace = (IWorkspace) oldInput;
- }
- else if (oldInput instanceof IContainer) {
- oldWorkspace = ((IContainer) oldInput).getWorkspace();
- }
- if (newInput instanceof IWorkspace) {
- newWorkspace = (IWorkspace) newInput;
- } else if (newInput instanceof IContainer) {
- newWorkspace = ((IContainer) newInput).getWorkspace();
- }
- if (oldWorkspace != newWorkspace) {
- if (oldWorkspace != null) {
- oldWorkspace.removeResourceChangeListener(this);
- }
- if (newWorkspace != null) {
- newWorkspace.addResourceChangeListener(this, IResourceChangeEvent.POST_CHANGE);
- }
- }
-}
-/**
- * Process a resource delta.
- */
-protected void processDelta(IResourceDelta delta) {
- // This method runs inside a syncExec. The widget may have been destroyed
- // by the time this is run. Check for this and do nothing if so.
- Control ctrl = viewer.getControl();
- if (ctrl == null || ctrl.isDisposed())
- return;
-
- // Get the affected resource
- IResource resource = delta.getResource();
-
- // If any children have changed type, just do a full refresh of this parent,
- // since a simple update on such children won't work,
- // and trying to map the change to a remove and add is too dicey.
- // The case is: folder A renamed to existing file B, answering yes to overwrite B.
- IResourceDelta[] affectedChildren =
- delta.getAffectedChildren(IResourceDelta.CHANGED);
- for (int i = 0; i < affectedChildren.length; i++) {
- if ((affectedChildren[i].getFlags() & IResourceDelta.TYPE) != 0) {
- ((StructuredViewer) viewer).refresh(resource);
- return;
- }
- }
-
- // Check the flags for changes the Navigator cares about.
- // See ResourceLabelProvider for the aspects it cares about.
- // Notice we don't care about F_CONTENT or F_MARKERS currently.
- int changeFlags = delta.getFlags();
- if ((changeFlags
- & (IResourceDelta.OPEN | IResourceDelta.SYNC))
- != 0) {
- ((StructuredViewer) viewer).update(resource, null);
- }
-
- // Handle changed children .
- for (int i = 0; i < affectedChildren.length; i++) {
- processDelta(affectedChildren[i]);
- }
-
- // Process removals before additions, to avoid multiple equal elements in the viewer.
-
- // Handle removed children. Issue one update for all removals.
- affectedChildren = delta.getAffectedChildren(IResourceDelta.REMOVED);
- if (affectedChildren.length > 0) {
- Object[] affected = new Object[affectedChildren.length];
- for (int i = 0; i < affectedChildren.length; i++)
- affected[i] = affectedChildren[i].getResource();
- if (viewer instanceof AbstractTreeViewer) {
- ((AbstractTreeViewer) viewer).remove(affected);
- } else {
- ((StructuredViewer) viewer).refresh(resource);
- }
- }
-
- // Handle added children. Issue one update for all insertions.
- affectedChildren = delta.getAffectedChildren(IResourceDelta.ADDED);
- if (affectedChildren.length > 0) {
- Object[] affected = new Object[affectedChildren.length];
- for (int i = 0; i < affectedChildren.length; i++)
- affected[i] = affectedChildren[i].getResource();
- if (viewer instanceof AbstractTreeViewer) {
- ((AbstractTreeViewer) viewer).add(resource, affected);
- }
- else {
- ((StructuredViewer) viewer).refresh(resource);
- }
- }
-}
-/**
- * The workbench has changed. Process the delta and issue updates to the viewer,
- * inside the UI thread.
- *
- * @see IResourceChangeListener#resourceChanged
- */
-public void resourceChanged(final IResourceChangeEvent event) {
- final IResourceDelta delta = event.getDelta();
- Control ctrl = viewer.getControl();
- if (ctrl != null && !ctrl.isDisposed()) {
- // Do a sync exec, not an async exec, since the resource delta
- // must be traversed in this method. It is destroyed
- // when this method returns.
- ctrl.getDisplay().syncExec(new Runnable() {
- public void run() {
- processDelta(delta);
- }
- });
- }
-}
-}
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
deleted file mode 100644
index 46a197e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchLabelProvider.java
+++ /dev/null
@@ -1,121 +0,0 @@
-package org.eclipse.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * 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.
- */
-public class WorkbenchLabelProvider extends LabelProvider {
- /**
- * The cache of images that have been dispensed by this provider.
- * Maps ImageDescriptor->Image.
- */
- private Map imageTable;
-/**
- * Creates a new workbench label provider.
- */
-public WorkbenchLabelProvider() {
-}
-/**
- * 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.
- * @see org.eclipse.jface.resource.CompositeImage
- */
-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.
- */
-protected String decorateText(String input, Object element) {
- return input;
-}
-/* (non-Javadoc)
- * Method declared on IBaseLabelProvider
- */
-/**
- * Disposes of all allocated images.
- */
-public final void dispose() {
- if (imageTable != null) {
- for (Iterator i = imageTable.values().iterator(); i.hasNext();) {
- ((Image) i.next()).dispose();
- }
- imageTable = null;
- }
-}
-/**
- * Returns the implementation of IWorkbenchAdapter for the given
- * object. Returns <code>null</code> if the adapter is not defined or the
- * object is not adaptable.
- */
-protected final IWorkbenchAdapter getAdapter(Object o) {
- if (!(o instanceof IAdaptable)) {
- return null;
- }
- return (IWorkbenchAdapter)((IAdaptable)o).getAdapter(IWorkbenchAdapter.class);
-}
-/* (non-Javadoc)
- * Method declared on ILabelProvider
- */
-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;
-
- //add any annotations to the image descriptor
- descriptor = decorateImage(descriptor, element);
-
- //obtain the cached image corresponding to the descriptor
- if (imageTable == null) {
- imageTable = new Hashtable(40);
- }
- Image image = (Image) imageTable.get(descriptor);
- if (image == null) {
- image = descriptor.createImage();
- imageTable.put(descriptor, image);
- }
- return image;
-}
-/* (non-Javadoc)
- * Method declared on ILabelProvider
- */
-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);
-
- //return the decorated label
- return decorateText(label, element);
-}
-
-
-}
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
deleted file mode 100644
index e5b70f3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/WorkbenchViewerSorter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-package org.eclipse.ui.model;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.*;
-import java.text.Collator;
-
-/**
- * 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 < B < c
- *
- * @see IWorkbenchAdapter
- */
-public class WorkbenchViewerSorter extends ViewerSorter {
-
-/**
- * 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);
-}
-/* (non-Javadoc)
- * Method declared on ViewerSorter.
- */
-public boolean isSorterProperty(Object element,String propertyId) {
- return propertyId.equals(IBasicPropertyConstants.P_TEXT);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/package.html b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/package.html
deleted file mode 100644
index 2c6d5b4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/model/package.html
+++ /dev/null
@@ -1,16 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides a workbench adapter for displaying workbench
-elements in the UI without having to know the concrete type of the element.
-<h2>
-Package Specification</h2>
-[To be supplied.]
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/package.html b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/package.html
deleted file mode 100644
index 9b87210..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/package.html
+++ /dev/null
@@ -1,39 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (WinNT; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Application programming interfaces for interaction
-with and extension of the Eclipse Platform User Interface.
-<h2>
-Package Specification</h2>
-This package provides application programming interfaces for interaction
-with and extension of the Eclipse Platform User Interface.
-<p>The <b>PlatformUI</b> class provides access to a single <b>workbench</b>.
-A workbench is the root object for the UI and has one or more <b>workbench
-windows</b>. Each workbench window has a collection of <b>workbench
-pages</b>, only one of which is active and visible to the end user.
-Each workbench page has a collection of <b>workbench parts. </b>A
-page's parts are arranged (tiled or stacked) for presentation on the screen.
-Within a page and its parts the user can interact with and modify a model
-(typically resources in a workspace). There are two kinds of
-workbench parts: views and editors. An editor is typically used to
-edit or browse a document or input object. A view is typically used
-to navigate a hierarchy of information (like the workspace), open an editor,
-or display properties for the active editor.
-<p>The platform creates a workbench when the workbench plug-in is activated.
-Since this happens at most once during the life of the running platform,
-there is only one workbench instance. Due to its singular nature, it is
-commonly referred to as <i>the</i> workbench.
-<p>Within a workbench the user will interact with many different resource
-types. Because different tools are required for each, the workbench
-defines a number of extension points which allow for the integration of
-new tools. There are extension points for views, editors, action
-sets, import wzards, export wizards, etc.
-<br>
-</body>
-</html>
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
deleted file mode 100644
index 52bc9ff..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CellEditorActionHandler.java
+++ /dev/null
@@ -1,664 +0,0 @@
-package org.eclipse.ui.part;
-
-/**********************************************************************
-Copyright (c) 2000, 2002 IBM Corp. and others.
-All rights reserved. This program and the accompanying materials
-are made available under the terms of the Common Public License v0.5
-which accompanies this distribution, and is available at
-http://www.eclipse.org/legal/cpl-v05.html
-
-Contributors:
-**********************************************************************/
-import java.util.*;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-
-/**
- * Handles the redirection of the global actions Cut, Copy, Paste,
- * Delete, Select All, Find, Undo and Redo to either the current
- * inline cell editor or the part's supplied action handler.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p><p>
- * Example usage:
- * <pre>
- * actionHandler = new CellEditorActionHandler(this.getViewSite().getActionBars());
- * actionHandler.addCellEditor(textCellEditor1);
- * actionHandler.addCellEditor(textCellEditor2);
- * actionHandler.setSelectAllAction(selectAllAction);
- * </pre>
- * </p>
- */
-public class CellEditorActionHandler {
- private CutActionHandler cellCutAction = new CutActionHandler();
- private CopyActionHandler cellCopyAction = new CopyActionHandler();
- private PasteActionHandler cellPasteAction = new PasteActionHandler();
- private DeleteActionHandler cellDeleteAction = new DeleteActionHandler();
- private SelectAllActionHandler cellSelectAllAction = new SelectAllActionHandler();
- private FindActionHandler cellFindAction = new FindActionHandler();
- private UndoActionHandler cellUndoAction = new UndoActionHandler();
- private RedoActionHandler cellRedoAction = new RedoActionHandler();
-
- private IAction cutAction;
- private IAction copyAction;
- private IAction pasteAction;
- private IAction deleteAction;
- private IAction selectAllAction;
- private IAction findAction;
- private IAction undoAction;
- private IAction redoAction;
-
- private IPropertyChangeListener cutActionListener = new ActionEnabledChangeListener(cellCutAction);
- private IPropertyChangeListener copyActionListener = new ActionEnabledChangeListener(cellCopyAction);
- private IPropertyChangeListener pasteActionListener = new ActionEnabledChangeListener(cellPasteAction);
- private IPropertyChangeListener deleteActionListener = new ActionEnabledChangeListener(cellDeleteAction);
- private IPropertyChangeListener selectAllActionListener = new ActionEnabledChangeListener(cellSelectAllAction);
- private IPropertyChangeListener findActionListener = new ActionEnabledChangeListener(cellFindAction);
- private IPropertyChangeListener undoActionListener = new ActionEnabledChangeListener(cellRedoAction);
- private IPropertyChangeListener redoActionListener = new ActionEnabledChangeListener(cellUndoAction);
-
- private CellEditor activeEditor;
- private IPropertyChangeListener cellListener = new CellChangeListener();
- private Listener controlListener = new ControlListener();
- private HashMap controlToEditor = new HashMap();
-
-
- private class ControlListener implements Listener {
- public void handleEvent(Event event) {
- 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)
- 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;
- }
- 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;
- }
- }
- };
-
- private class CellChangeListener implements IPropertyChangeListener {
- 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);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CELL_CUT_ACTION);
- }
- 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);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CELL_COPY_ACTION);
- }
- 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);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CELL_PASTE_ACTION);
- }
- 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);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CELL_DELETE_ACTION);
- }
- 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);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CELL_SELECT_ALL_ACTION);
- }
- 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);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CELL_FIND_ACTION);
- }
- 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);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CELL_UNDO_ACTION);
- }
- 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());
- return;
- }
- if (undoAction != null) {
- setEnabled(undoAction.isEnabled());
- return;
- }
- setEnabled(false);
- }
- }
-
- private class RedoActionHandler extends Action {
- protected RedoActionHandler() {
- setId("CellEditorRedoActionHandler");//$NON-NLS-1$
- setEnabled(false);
- WorkbenchHelp.setHelp(this, IHelpContextIds.CELL_REDO_ACTION);
- }
- 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());
- return;
- }
- if (redoAction != null) {
- setEnabled(redoAction.isEnabled());
- 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(IWorkbenchActionConstants.CUT, cellCutAction);
- actionBar.setGlobalActionHandler(IWorkbenchActionConstants.COPY, cellCopyAction);
- actionBar.setGlobalActionHandler(IWorkbenchActionConstants.PASTE, cellPasteAction);
- actionBar.setGlobalActionHandler(IWorkbenchActionConstants.DELETE, cellDeleteAction);
- actionBar.setGlobalActionHandler(IWorkbenchActionConstants.SELECT_ALL, cellSelectAllAction);
- actionBar.setGlobalActionHandler(IWorkbenchActionConstants.FIND, cellFindAction);
- actionBar.setGlobalActionHandler(IWorkbenchActionConstants.UNDO, cellUndoAction);
- actionBar.setGlobalActionHandler(IWorkbenchActionConstants.REDO, 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();
- 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 enum = controlToEditor.keySet().iterator();
- while (enum.hasNext()) {
- Control control = (Control)enum.next();
- if (!control.isDisposed()) {
- control.removeListener(SWT.Activate, controlListener);
- control.removeListener(SWT.Deactivate, controlListener);
- }
- }
- controlToEditor.clear();
-
- 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();
- 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</null> if not interested.
- */
-public void setCopyAction(IAction action) {
- if (copyAction == action)
- return;
-
- if (copyAction != null)
- copyAction.removePropertyChangeListener(copyActionListener);
-
- copyAction = action;
-
- 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</null> if not interested.
- */
-public void setCutAction(IAction action) {
- if (cutAction == action)
- return;
-
- if (cutAction != null)
- cutAction.removePropertyChangeListener(cutActionListener);
-
- cutAction = action;
-
- 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</null> if not interested.
- */
-public void setDeleteAction(IAction action) {
- if (deleteAction == action)
- return;
-
- if (deleteAction != null)
- deleteAction.removePropertyChangeListener(deleteActionListener);
-
- deleteAction = action;
-
- 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</null> if not interested.
- */
-public void setFindAction(IAction action) {
- if (findAction == action)
- return;
-
- if (findAction != null)
- findAction.removePropertyChangeListener(findActionListener);
-
- findAction = action;
-
- 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</null> if not interested.
- */
-public void setPasteAction(IAction action) {
- if (pasteAction == action)
- return;
-
- if (pasteAction != null)
- pasteAction.removePropertyChangeListener(pasteActionListener);
-
- pasteAction = action;
-
- 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</null> if not interested.
- */
-public void setRedoAction(IAction action) {
- if (redoAction == action)
- return;
-
- if (redoAction != null)
- redoAction.removePropertyChangeListener(redoActionListener);
-
- redoAction = action;
-
- 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</null> if not interested.
- */
-public void setSelectAllAction(IAction action) {
- if (selectAllAction == action)
- return;
-
- if (selectAllAction != null)
- selectAllAction.removePropertyChangeListener(selectAllActionListener);
-
- selectAllAction = action;
-
- 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</null> if not interested.
- */
-public void setUndoAction(IAction action) {
- if (undoAction == action)
- return;
-
- if (undoAction != null)
- undoAction.removePropertyChangeListener(undoActionListener);
-
- undoAction = action;
-
- 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();
-}
-}
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
deleted file mode 100644
index 91070fa..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/CoolItemGroupMarker.java
+++ /dev/null
@@ -1,34 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-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.
- *
- * Note that this class was introduced to address [Bug 17477], is experimental,
- * and may change.
- *
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-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);
-}
-}
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
deleted file mode 100644
index b6dba82..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownAdapter.java
+++ /dev/null
@@ -1,303 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.resource.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-import java.util.List;
-
-/**
- * Implements a simple web style navigation metaphor for a <code>TreeViewer</code>.
- * Home, back, and "drill into" functions are supported for the viewer,
- * <p>
- * To use the <code>DrillDownAdapter</code> ..
- * </p>
- * <ul>
- * <li>Create an instance of <code>TreeViewer</code>. </li>
- * <li>Create a <code>DrillDownAdapter</code> for the viewer. </li>
- * <li>Create a container for your viewer with a toolbar or a popup menu.
- * Add actions for "goBack", "goHome", and "goInto" to either one by calling
- * </code>addNavigationActions</code> with the popup menu or toolbar.</li>
- * </ol>
- * <p>
- * If the input for the underlying viewer is changed by something other than the
- * adapter the <code>reset</code> method should be called. This will clear
- * the drill stack and update the navigation buttons to reflect the new
- * state of the underlying viewer.
- * </p>
- * </p>
- */
-public class DrillDownAdapter implements ISelectionChangedListener
-{
- private TreeViewer fChildTree;
- private DrillStack fDrillStack;
- private Action homeAction;
- private Action backAction;
- private Action forwardAction;
-/**
- * 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 tool bar manager.
- *
- * @param manager 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.
- *
- * @param element the object to test for expansion
- * @return <code>true</code> if expansion is possible; otherwise
- * return <code>false</code
- */
-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 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() {
- IStructuredSelection oSelection = (IStructuredSelection) fChildTree.getSelection();
- if (oSelection == null || oSelection.size() != 1)
- return false;
- Object anElement = oSelection.getFirstElement();
- return canExpand(anElement);
-}
-/**
- * Create the actions for navigation.
- *
- * @param tree the target tree for refocusing
- */
-private void createActions() {
- // Only do this once.
- if (homeAction != null)
- return;
-
- // Home.
- homeAction = new Action(WorkbenchMessages.getString("GoHome.text")) { //$NON-NLS-1$
- public void run() {
- goHome();
- }
- };
- homeAction.setToolTipText(WorkbenchMessages.getString("GoHome.toolTip")); //$NON-NLS-1$
- ImageDescriptor image = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_HOME_NAV);
- homeAction.setImageDescriptor(image);
- homeAction.setHoverImageDescriptor(image);
-
- // Back.
- backAction = new Action(WorkbenchMessages.getString("GoBack.text")) { //$NON-NLS-1$
- public void run() {
- goBack();
- }
- };
- backAction.setToolTipText(WorkbenchMessages.getString("GoBack.toolTip")); //$NON-NLS-1$
- image = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_BACKWARD_NAV);
- backAction.setImageDescriptor(image);
- backAction.setHoverImageDescriptor(image);
-
- // Forward.
- forwardAction = new Action(WorkbenchMessages.getString("GoInto.text")) { //$NON-NLS-1$
- public void run() {
- goInto();
- }
- };
- forwardAction.setToolTipText(WorkbenchMessages.getString("GoInto.toolTip")); //$NON-NLS-1$
- image = WorkbenchImages.getImageDescriptor(IWorkbenchGraphicConstants.IMG_CTOOL_FORWARD_NAV);
- forwardAction.setImageDescriptor(image);
- forwardAction.setHoverImageDescriptor(image);
-
- // 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());
-}
-/**
- * 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);
- 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);
- 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() {
- IStructuredSelection sel = (IStructuredSelection) fChildTree.getSelection();
- 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$
-
- // 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();
-}
-/**
- * Updates the navigation buttons when a selection change occurs
- * in the tree.
- */
-public void selectionChanged(SelectionChangedEvent event) {
- updateNavigationButtons();
-}
-/**
- * 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
deleted file mode 100644
index 79c504e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillDownComposite.java
+++ /dev/null
@@ -1,86 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-
-/**
- * Class <code>DrillDownComposite</code> implements a simple web
- * style navigation metaphor. Home, back, and "drill into" buttons are
- * added to a tree viewer for easier navigation.
- * <p>
- * To use the DrillDownComposite..
- * </p>
- * <ul>
- * <li>Create an instance of <code>DrillDownComposite</code>.</li>
- * <li>Create a tree viewer. </li>
- * <li>Pass the second tree viewer into the composite by
- * calling <code>setChildTree</code>.</li>
- * </ol>
- */
-public class DrillDownComposite extends Composite
-{
- private ToolBarManager toolBarMgr;
- private TreeViewer fChildTree;
- 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();
-}
-/**
- * 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);
-
- // 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;
-
- // Create adapter.
- adapter = new DrillDownAdapter(fChildTree);
- adapter.addNavigationActions(toolBarMgr);
- toolBarMgr.update(true);
-
- // Set tree layout.
- GridData gid = new GridData();
- gid.grabExcessHorizontalSpace = gid.grabExcessVerticalSpace = true;
- gid.horizontalAlignment = gid.verticalAlignment = GridData.FILL;
- fChildTree.getTree().setLayoutData(gid);
- 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
deleted file mode 100644
index 56d3ea1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillFrame.java
+++ /dev/null
@@ -1,77 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.List;
-import org.eclipse.core.runtime.IAdaptable;
-
-/* (non-Javadoc)
- * A <code>DrillFrame</code> is used to record the input element and
- * selection state for one frame in a <code>DrillDownTreeViewer</code>.
- * This class is not intended for use beyond the package.
- */
-/* package */ class DrillFrame {
- Object fElement;
- Object fPropertyName;
- 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;
-}
- /**
- * 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.
- */
- public boolean equals(Object obj) {
- // Compare handles.
- if (this == obj)
- return true;
-
- // Compare class.
- if (!(obj instanceof DrillFrame))
- return false;
-
- // 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 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;
-}
-}
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
deleted file mode 100644
index 1a42ca7..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/DrillStack.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Stack;
-
-/* (non-Javadoc)
- * A <code>DrillStack</code> manages a stack of DrillFrames.
- * This class is not intended for use beyond the package.
- */
-/* package */ class DrillStack {
- Stack fStack = null;
-/**
- * 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;
-}
-/**
- * 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);
-}
-/**
- * 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;
-}
-/**
- * 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 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
deleted file mode 100644
index 02de499..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorActionBarContributor.java
+++ /dev/null
@@ -1,155 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.CoolItemMultiToolBarManager;
-
-/**
- * Standard implementation of <code>IEditorActionBarContributor</code>.
- * <p>
- * If instantiated and used as-is, nothing is contribututed. Clients should
- * subclass in order to contribute to some or all of the action bars.
- * <p>
- * Subclasses may reimplement the following methods:
- * <ul>
- * <li><code>contributeToMenu</code> - reimplement to contribute to menu</li>
- * <li><code>contributeToToolBar</code> - reimplement to contribute to tool
- * bar</li>
- * <li><code>contributeToStatusLine</code> - reimplement to contribute to
- * status line</li>
- * <li><code>setActiveEditor</code> - reimplement to react to editor changes</li>
- * </ul>
- * </p>
- */
-public class EditorActionBarContributor
- implements IEditorActionBarContributor
-{
- /**
- * 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;
-/**
- * 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 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) {
-}
-/**
- * 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;
-}
-/**
- * The <code>EditorActionBarContributor</code> implementation of this
- * <code>IEditorActionBarContributor</code> method does nothing,
- * subclasses may 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
- */
-public void init(IActionBars bars, IWorkbenchPage page) {
- 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>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());
- contributeToStatusLine(bars.getStatusLineManager());
- // If the editor action bar supports multiple CoolItems, create
- // those cool items. Workaround for [Bug 17477].
- IToolBarManager tBarMgr = bars.getToolBarManager();
- if (tBarMgr instanceof CoolItemMultiToolBarManager) {
- ((CoolItemMultiToolBarManager)tBarMgr).createCoolBarContributionItems();
- }
-
-}
-/**
- * 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
- */
-public void setActiveEditor(IEditorPart targetEditor) {
-}
-}
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
deleted file mode 100644
index 5d4c73d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/EditorPart.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.*;
-import org.eclipse.jface.util.Assert;
-
-/**
- * Abstract base implementation of all workbench editors.
- * <p>
- * This class should be subclassed by clients wishing to define new editors.
- * The name of the subclass should be given as the <code>"class"</code>
- * attribute in a <code>editor</code> extension contributed to the workbench's
- * view extension point (named <code>"org.eclipse.ui.editors"</code>).
- * For example, the plug-in's XML markup might contain:
- * <pre>
- * <extension point="org.eclipse.ui.editors">
- * <editor id="com.example.myplugin.ed"
- * name="My Editor"
- * icon="./images/cedit.gif"
- * extensions="foo"
- * class="com.example.myplugin.MyFooEditor"
- * contributorClass="com.example.myplugin.MyFooEditorContributor"
- * />
- * </extension>
- * </pre>
- * where <code>com.example.myplugin.MyEditor</code> is the name of the
- * <code>EditorPart</code> subclass.
- * </p>
- * <p>
- * Subclasses must implement the following methods:
- * <ul>
- * <li><code>IEditorPart.init</code> - to initialize editor when assigned its site</li>
- * <li><code>IWorkbenchPart.createPartControl</code> - to create the editor's controls </li>
- * <li><code>IWorkbenchPart.setFocus</code> - to accept focus</li>
- * <li><code>IEditorPart.isDirty</code> - to decide whether a significant change has
- * occurred</li>
- * <li><code>IEditorPart.doSave</code> - to save contents of editor</li>
- * <li><code>IEditorPart.doSaveAs</code> - to save contents of editor</li>
- * <li><code>IEditorPart.isSaveAsAllowed</code> - to control Save As</li>
- * <li><code>IEditorPart.gotoMarker</code> - to make selections based on markers</li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may extend or reimplement the following methods as required:
- * <ul>
- * <li><code>IExecutableExtension.setInitializationData</code> - extend to provide additional
- * initialization when editor extension is instantiated</li>
- * <li><code>IWorkbenchPart.dispose</code> - extend to provide additional cleanup</li>
- * <li><code>IAdaptable.getAdapter</code> - reimplement to make the editor
- * adaptable</li>
- * </ul>
- * </p>
- */
-public abstract class EditorPart extends WorkbenchPart implements IEditorPart {
-
- /**
- * Editor input, or <code>null</code> if none.
- */
- private IEditorInput editorInput = null;
-/**
- * Creates a new workbench editor.
- */
-protected EditorPart() {
- super();
-}
-/* (non-Javadoc)
- * 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
- */
-public abstract void doSave(IProgressMonitor monitor);
-/* (non-Javadoc)
- * 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
- */
-public abstract void doSaveAs();
-/* (non-Javadoc)
- * Method declared on IEditorPart.
- */
-public IEditorInput getEditorInput() {
- return editorInput;
-}
-/* (non-Javadoc)
- * Method declared on IEditorPart.
- */
-public IEditorSite getEditorSite() {
- return (IEditorSite)getSite();
-}
-/* (non-Javadoc)
- * Gets the title tool tip text of this part.
- *
- * @return the tool tip text
- */
-public String getTitleToolTip() {
- if (editorInput == null)
- return super.getTitleToolTip();
- else
- return editorInput.getToolTipText();
-}
-/* (non-Javadoc)
- * Sets the cursor and selection state for this editor to the passage defined
- * by the given marker.
- * <p>
- * Subclasses may override. For greater details, see <code>IEditorPart</code>
- * </p>
- *
- * @see IEditorPart
- */
-public abstract void gotoMarker(IMarker marker);
-/* (non-Javadoc)
- * 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(editorInput);
- * </pre>
- */
-public abstract void init(IEditorSite site, IEditorInput input) throws PartInitException;
-/* (non-Javadoc)
- * 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
- */
-public abstract boolean isDirty();
-/* (non-Javadoc)
- * 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>
- * </p>
- *
- * @see IEditorPart
- */
-public abstract boolean isSaveAsAllowed();
-/* (non-Javadoc)
- * 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>
- */
-public boolean isSaveOnCloseNeeded() {
- return isDirty();
-}
-/**
- * Sets the input to this editor.
- *
- * @param input the editor input
- */
-protected void setInput(IEditorInput input) {
- editorInput = input;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/FileEditorInput.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/FileEditorInput.java
deleted file mode 100644
index 188d0e3..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/FileEditorInput.java
+++ /dev/null
@@ -1,120 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IStorage;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * Adapter for making a file resource a suitable input for an editor.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class FileEditorInput implements IFileEditorInput, IPersistableElement {
- private IFile file;
-/**
- * Creates an editor input based of the given file resource.
- *
- * @param file the file resource
- */
-public FileEditorInput(IFile file) {
- this.file = file;
-}
-/**
- * The <code>FileEditorInput</code> implementation of this <code>Object</code>
- * method bases the equality of two <code>FileEditorInput</code> objects on the
- * equality of their underlying <code>IFile</code> resources.
- */
-public boolean equals(Object obj) {
- if (this == obj)
- return true;
- if (!(obj instanceof FileEditorInput))
- return false;
- FileEditorInput other = (FileEditorInput)obj;
- return file.equals(other.file);
-}
-/**
- * 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.
- *
- * @return <code>true</code> if the editor input exists; <code>false</code>
- * otherwise
- */
-public boolean exists() {
- return file.exists();
-}
-/* (non-Javadoc)
- * Method declared on IAdaptable.
- */
-public Object getAdapter(Class adapter) {
- if (adapter == IFile.class)
- return file;
- return file.getAdapter(adapter);
-}
-/* (non-Javadoc)
- * Method declared on IPersistableElement.
- */
-public String getFactoryId() {
- return FileEditorInputFactory.getFactoryId();
-}
-/* (non-Javadoc)
- * Method declared on IFileEditorInput.
- */
-public IFile getFile() {
- return file;
-}
-/* (non-Javadoc)
- * Returns the image descriptor for this input.
- *
- * @return the image descriptor for this input
- */
-public ImageDescriptor getImageDescriptor() {
- return PlatformUI.getWorkbench().getEditorRegistry().getImageDescriptor(file);
-}
-/* (non-Javadoc)
- * Method declared on IEditorInput.
- */
-public String getName() {
- return file.getName();
-}
-/* (non-Javadoc)
- * Method declared on IEditorInput.
- */
-public IPersistableElement getPersistable() {
- return this;
-}
-/* (non-Javadoc)
- * Method declared on IStorageEditorInput.
- */
-public IStorage getStorage() throws CoreException {
- return file;
-}
-/* (non-Javadoc)
- * Method declared on IEditorInput.
- */
-public String getToolTipText() {
- return file.getFullPath().makeRelative().toString();
-}
-/* (non-Javadoc)
- * Method declared on Object.
- */
-public int hashCode() {
- return file.hashCode();
-}
-/* (non-Javadoc)
- * Method declared on IPersistableElement.
- */
-public void saveState(IMemento memento) {
- FileEditorInputFactory.saveState(memento, this);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/FileEditorInputFactory.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/FileEditorInputFactory.java
deleted file mode 100644
index 1715dfe..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/FileEditorInputFactory.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.ui.*;
-
-/**
- * Factory for saving and restoring a <code>FileEditorInput</code>.
- * The stored representation of a <code>FileEditorInput</code> remembers
- * the full path of the file (that is, <code>IFile.getFullPath</code>).
- * <p>
- * The workbench will automatically create instances of this class as required.
- * It is not intended to be instantiated or subclassed by the client.
- * </p>
- */
-public class FileEditorInputFactory implements IElementFactory {
- /**
- * Factory id. The workbench plug-in registers a factory by this name
- * with the "org.eclipse.ui.elementFactories" extension point.
- */
- private static final String ID_FACTORY =
- "org.eclipse.ui.part.FileEditorInputFactory";//$NON-NLS-1$
-
- /**
- * Tag for the IFile.fullPath of the file resource.
- */
- private static final String TAG_PATH = "path";//$NON-NLS-1$
-/**
- * Creates a new factory.
- */
-public FileEditorInputFactory() {
-}
-/* (non-Javadoc)
- * Method declared on IElementFactory.
- */
-public IAdaptable createElement(IMemento memento) {
- // Get the file name.
- String fileName = memento.getString(TAG_PATH);
- if (fileName == null)
- return null;
-
- // Create an IResource.
- IResource res = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(fileName));
- if (res instanceof IFile)
- return new FileEditorInput((IFile)res);
- else
- return null;
-}
-/**
- * Returns the element factory id for this class.
- *
- * @return the element factory id
- */
-public static String getFactoryId() {
- return ID_FACTORY;
-}
-/**
- * Saves the state of the given file editor input into the given memento.
- *
- * @param memento the storage area for element state
- * @param input the file editor input
- */
-public static void saveState(IMemento memento, FileEditorInput input) {
- IFile file = input.getFile();
- memento.putString(TAG_PATH, file.getFullPath().toString());
-}
-}
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
deleted file mode 100644
index 01c1133..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IContributedContentsView.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-/**
- * This interface is used to identify workbench views which
- * allow other parts (typically the active part) to supply
- * their contents.
- * The interface allows access tho 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
- */
-public 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
deleted file mode 100644
index 3f31e49..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IDropActionDelegate.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * Interface for actions supplied by extensions to the
- * 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.
- */
-public 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
deleted file mode 100644
index b347289..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPage.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.*;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * 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>.
- * </p>
- *
- * @see PageBookView
- * @see Page
- */
-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
- */
-public void createControl(Composite parent);
-/**
- * Disposes of this page.
- * <p>
- * This is the last method called on the <code>IPage</code>. Implementors should
- * clean up any resources associated with the page.
- * </p>
- * Callers of this method should ensure that the page's control (if it exists)
- * has been disposed before calling this method. However, for backward compatibilty,
- * implementors must also ensure that the page's control has been disposed before
- * this method returns.
- * </p>
- * <p>
- * Note that there is no guarantee that createControl() has been called,
- * so the control may never have been created.
- * </p>
- */
-public 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
- */
-public 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
- */
-public void setActionBars(IActionBars actionBars);
-/**
- * Asks this page to take focus within its pagebook view.
- */
-public 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
deleted file mode 100644
index f489a1a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageBookViewPage.java
+++ /dev/null
@@ -1,41 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.*;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Interface for a page in a pagebook view.
- * <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>
- */
- public 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
- */
- public 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
deleted file mode 100644
index 2b20b79..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/IPageSite.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchSite;
-import org.eclipse.ui.IWorkbenchWindow;
-
-/**
- * The primary interface between a page and the outside world.
- * <p>
- * The workbench exposes its implemention of page sites via this interface,
- * which is not intended to be implemented or extended by clients.
- * </p>
- */
-
-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
- */
- public 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
- */
- public 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
deleted file mode 100644
index 780fbc5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ISetSelectionTarget.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.ISelection;
-
-/**
- * Interface for views which support reveal and select.
- * <p>
- * This interface may be implemented by subclasses of <code>ViewPart</code>.
- * This interface is commonly used by a New wizard to reveal and select a
- * resource in a workbench part which it has just created.
- * </p>
- *
- * @see IView
- * @see ViewPart
- */
-public interface ISetSelectionTarget {
-/**
- * Reveals and selects the given element within this target view.
- *
- * @param selection the new element to select
- */
-public void selectReveal(ISelection selection);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MarkerTransfer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MarkerTransfer.java
deleted file mode 100644
index 8f78ae9..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MarkerTransfer.java
+++ /dev/null
@@ -1,201 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.swt.dnd.ByteArrayTransfer;
-import org.eclipse.swt.dnd.TransferData;
-import java.io.*;
-
-/**
- * A <code>MarkerTransfer</code> is used to transfer an array of
- * <code>IMarker</code>s from one part to another in a drag and drop
- * operation.
- * <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.
- * </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>).
- * It is not intended to be subclassed.
- * </p>
- *
- * @see StructuredViewer
- * @see DropTarget
- * @see DragSource
- */
-public class MarkerTransfer extends ByteArrayTransfer {
-
- /**
- * Singleton instance.
- */
- private static final MarkerTransfer instance = new MarkerTransfer();
-
- // Create a unique ID to make sure that different Eclipse
- // applications use different "types" of <code>MarkerTransfer</code>
- private static final String TYPE_NAME = "marker-transfer-format" + System.currentTimeMillis() + ":" + instance.hashCode();//$NON-NLS-2$//$NON-NLS-1$
- private static final int TYPEID = registerType(TYPE_NAME);
-
- private static final String rootString = Path.ROOT.toString();
- private IWorkspace workspace;
-
-/**
- * Creates a new transfer object.
- */
-private MarkerTransfer() {
-}
-/**
- * Locates and returns the marker associated with the given attributes.
- *
- * @param pathString the resource path
- * @param id the id of the marker to get (as per {@link IResource#getMarker
- * IResource.getMarker})
- * @return the specified marker
- */
-private IMarker findMarker(String pathString, long id) {
- IPath path = new Path(pathString);
- IResource resource = workspace.getRoot().findMember(path);
- if (resource != null) {
- return resource.getMarker(id);
- }
- return null;
-}
-/**
- * Returns the singleton instance.
- *
- * @return the singleton instance
- */
-public static MarkerTransfer getInstance() {
- return instance;
-}
-/* (non-Javadoc)
- * Method declared on Transfer.
- */
-protected int[] getTypeIds() {
- return new int[] {TYPEID};
-}
-/* (non-Javadoc)
- * Returns the type names.
- *
- * @return the list of type names
- */
-protected String[] getTypeNames() {
- return new String[] {TYPE_NAME};
-}
-/* (non-Javadoc)
- * Method declared on Transfer.
- * On a successful conversion, the transferData.result field will be set to
- * OLE.S_OK. If this transfer agent is unable to perform the conversion, the
- * transferData.result field will be set to the failure value of OLE.DV_E_TYMED.
- */
-protected void javaToNative(Object object, TransferData transferData) {
- /**
- * Transfer data is an array of markers. Serialized version is:
- * (int) number of markers
- * (Marker) marker 1
- * (Marker) marker 2
- * ... repeat last four for each subsequent marker
- * see writeMarker for the (Marker) format.
- */
- IMarker[] markers = (IMarker[]) object;
- lazyInit(markers);
-
- ByteArrayOutputStream byteOut = new ByteArrayOutputStream();
- DataOutputStream out = new DataOutputStream(byteOut);
-
- byte[] bytes = null;
-
- try {
- /* write number of markers */
- out.writeInt(markers.length);
-
- /* write markers */
- for (int i = 0; i < markers.length; i++) {
- writeMarker(markers[i], out);
- }
- out.close();
- bytes = byteOut.toByteArray();
- } catch (IOException e) {
- //when in doubt send nothing
- }
-
- if (bytes != null) {
- super.javaToNative(bytes, transferData);
- }
-}
-/**
- * Initializes the transfer mechanism if necessary.
- */
-private void lazyInit(IMarker[] markers) {
- if (workspace == null) {
- if (markers != null && markers.length > 0) {
- this.workspace = markers[0].getResource().getWorkspace();
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on Transfer.
- */
-protected Object nativeToJava(TransferData transferData) {
- byte[] bytes = (byte[]) super.nativeToJava(transferData);
- DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
-
- try {
- /* read number of markers */
- int n = in.readInt();
-
- /* read markers */
- IMarker[] markers = new IMarker[n];
- for (int i = 0; i < n; i++) {
- IMarker marker = readMarker(in);
- if (marker == null) {
- return null;
- }
- markers[i] = marker;
- }
- return markers;
- } catch (IOException e) {
- return null;
- }
-}
-/**
- * Reads and returns a single marker from the given stream.
- *
- * @param dataIn the input stream
- * @return the marker
- * @exception IOException if there is a problem reading from the stream
- */
-private IMarker readMarker(DataInputStream dataIn) throws IOException {
- /**
- * Marker serialization format is as follows:
- * (String) path of resource for marker
- * (int) marker ID
- */
- String path = dataIn.readUTF();
- long id = dataIn.readLong();
- return findMarker(path, id);
-}
-/**
- * Writes the given marker to the given stream.
- *
- * @param marker the marker
- * @param dataOut the output stream
- * @exception IOException if there is a problem writing to the stream
- */
-private void writeMarker(IMarker marker, DataOutputStream dataOut) throws IOException {
- /**
- * Marker serialization format is as follows:
- * (String) path of resource for marker
- * (int) marker ID
- */
-
- dataOut.writeUTF(marker.getResource().getFullPath().toString());
- dataOut.writeLong(marker.getId());
-}
-}
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
deleted file mode 100644
index dc43ebe..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MessagePage.java
+++ /dev/null
@@ -1,64 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A message page display a message in a pagebook view.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- *
- * @see PageBookView
- */
-public class MessagePage extends Page {
- private Composite pgComp;
- private Label msgLabel;
- private String message = "";//$NON-NLS-1$
-/**
- * Creates a new page. The message is the empty string.
- */
-public MessagePage() {
-}
-/* (non-Javadoc)
- * Method declared on IPage.
- */
-public void createControl(Composite parent) {
- // Message in default page of Outline should have margins
- pgComp = new Composite(parent, SWT.NULL);
- pgComp.setLayout(new GridLayout());
-
- msgLabel = new Label(pgComp, SWT.LEFT | SWT.WRAP);
- msgLabel.setText(message);
-
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- msgLabel.setLayoutData(gridData);
-}
-/* (non-Javadoc)
- * Method declared on IPage.
- */
-public Control getControl() {
- return pgComp;
-}
-/**
- * Sets focus to a part in the page.
- */
-public void setFocus() {
- msgLabel.setFocus();
-}
-/**
- * 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
deleted file mode 100644
index 279f555..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditor.java
+++ /dev/null
@@ -1,231 +0,0 @@
-package org.eclipse.ui.part;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.EditorSite;
-import org.eclipse.ui.internal.WorkbenchPage;
-import org.eclipse.ui.internal.WorkbenchWindow;
-
-/**
- * A MultiEditor is a composite of editors.
- *
- * This class is intended to be supclassed.
- *
- */
-public abstract class MultiEditor extends EditorPart {
-
- private int activeEditorIndex;
- private IEditorPart innerEditors[];
-
- private static final int INACTIVE = 0;
- private static final int ACTIVE_FOCUS = 1;
- private static final int ACTIVE_NOFOCUS = 2;
-
- /**
- * Constructor for TileEditor.
- */
- public MultiEditor() {
- super();
- }
- /*
- * @see IEditorPart#doSave(IProgressMonitor)
- */
- public void doSave(IProgressMonitor monitor) {
- for (int i = 0; i < innerEditors.length; i++) {
- IEditorPart e = innerEditors[i];
- e.doSave(monitor);
- }
- }
- /**
- * 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, new Listener() {
- public void handleEvent(Event event) {
- if (event.type == SWT.Activate)
- activateEditor(e);
- }
- });
- return content;
- }
-
- /*
- * @see IEditorPart#doSaveAs()
- */
- public void doSaveAs() {
- }
-
- /*
- * @see IEditorPart#gotoMarker(IMarker)
- */
- public void gotoMarker(IMarker marker) {
- }
-
- /*
- * @see IEditorPart#init(IEditorSite, IEditorInput)
- */
- public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- init(site, (MultiEditorInput) input);
- }
- /*
- * @see IEditorPart#init(IEditorSite, IEditorInput)
- */
- public void init(IEditorSite site, MultiEditorInput input) throws PartInitException {
- setInput(input);
- setSite(site);
- setTitle(input.getName());
- setTitleToolTip(input.getToolTipText());
- }
- /*
- * @see IEditorPart#isDirty()
- */
- public boolean isDirty() {
- for (int i = 0; i < innerEditors.length; i++) {
- IEditorPart e = innerEditors[i];
- if (e.isDirty())
- return true;
- }
- return false;
- }
-
- /*
- * @see IEditorPart#isSaveAsAllowed()
- */
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- /*
- * @see IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- innerEditors[activeEditorIndex].setFocus();
- updateGradient(innerEditors[activeEditorIndex]);
- }
- /**
- * Returns the active inner editor.
- */
- public final IEditorPart getActiveEditor() {
- return innerEditors[activeEditorIndex];
- }
- /**
- * Returns an array with all inner editors.
- */
- public final IEditorPart[] getInnerEditors() {
- return innerEditors;
- }
- /**
- * Set the inner editors.
- *
- * Should not be called by clients.
- */
- public final void setChildren(IEditorPart[] children) {
- innerEditors = children;
- activeEditorIndex = 0;
- }
- /**
- * Set the active editor.
- */
- private void activateEditor(IEditorPart part) {
- IEditorPart oldEditor = getActiveEditor();
- activeEditorIndex = getIndex(part);
- IEditorPart e = getActiveEditor();
- EditorSite innerSite = (EditorSite) e.getEditorSite();
- ((WorkbenchPage) innerSite.getPage()).requestActivation(e);
- updateGradient(oldEditor);
- }
- /*
- * Return the index of the specified editor
- */
- private int getIndex(IEditorPart editor) {
- for (int i = 0; i < innerEditors.length; i++) {
- if (innerEditors[i] == editor)
- return i;
- }
- return -1;
- }
- /**
- * Update the gradient in the title bar.
- */
- public void updateGradient(IEditorPart editor) {
- boolean activeEditor = editor == getSite().getPage().getActiveEditor();
- boolean activePart = editor == getSite().getPage().getActivePart();
-
- Gradient g;
-
- if (activePart) {
- if (getShellActivated())
- g = Gradient.BLUE;
- else
- g = Gradient.BLACK;
- } else {
- if (activeEditor)
- g = Gradient.WHITE;
- else
- g = Gradient.GRAY;
- }
- drawGradient(editor, g);
- }
- /**
- * Draw the gradient in the title bar.
- */
- protected abstract void drawGradient(IEditorPart innerEditor,Gradient g);
-
- /**
- * Return true if the shell is activated.
- */
- protected boolean getShellActivated() {
- WorkbenchWindow window = (WorkbenchWindow) getSite().getPage().getWorkbenchWindow();
- return window.getShellActivated();
- }
- /*
- * The colors used to draw the title bar of the inner editors
- */
- public static class Gradient {
- public Color fgColor;
- public Color[] bgColors;
- public int[] bgPercents;
-
- private static Gradient BLUE = new Gradient();
- private static Gradient BLACK = new Gradient();
- private static Gradient GRAY = new Gradient();
- private static Gradient WHITE = new Gradient();
-
- static {
- BLUE.fgColor = WorkbenchColors.getSystemColor(SWT.COLOR_TITLE_FOREGROUND);
- BLUE.bgColors = WorkbenchColors.getActiveEditorGradient();
- BLUE.bgPercents = WorkbenchColors.getActiveEditorGradientPercents();
-
- BLACK.fgColor = WorkbenchColors.getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND);
- BLACK.bgColors = WorkbenchColors.getDeactivatedEditorGradient();
- BLACK.bgPercents = WorkbenchColors.getDeactivatedEditorGradientPercents();
-
- WHITE.fgColor = WorkbenchColors.getSystemColor(SWT.COLOR_BLACK);
- WHITE.bgColors = WorkbenchColors.getActiveNoFocusEditorGradient();
- WHITE.bgPercents = WorkbenchColors.getActiveNoFocusEditorGradientPercents();
-
- GRAY.fgColor = null;
- GRAY.bgColors = null;
- GRAY.bgPercents = null;
- }
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index 83fe8b1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiEditorInput.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * Copyright (c) 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * Implements a input for a MultiEditor
- *
- * This class is intended to be instanciated by clients but its is
- * not intented to be subclassed.
- */
-public class MultiEditorInput implements IEditorInput {
-
- IEditorInput input[];
- String editors[];
-
- /**
- * Constructor for MultiEditorInput.
- */
- public MultiEditorInput(String[] editorIDs, IEditorInput[] innerEditors) {
- super();
- editors = editorIDs;
- input = innerEditors;
- }
- /**
- * 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;
- }
- /*
- * @see IEditorInput#exists()
- */
- public boolean exists() {
- return true;
- }
- /*
- * @see IEditorInput#getImageDescriptor()
- */
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
- /*
- * @see IEditorInput#getName()
- */
- public String getName() {
- String name = ""; //$NON-NLS-1$
- for (int i = 0; i < (input.length - 1); i++) {
- name = name + input[i].getName() + "/"; //$NON-NLS-1$
- }
- name = name + input[input.length - 1].getName();
- return name;
- }
- /*
- * @see IEditorInput#getPersistable()
- */
- public IPersistableElement getPersistable() {
- return null;
- }
- /*
- * @see IEditorInput#getToolTipText()
- */
- public String getToolTipText() {
- return getName();
- }
- /*
- * @see IAdaptable#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- return null;
- }
-}
\ No newline at end of file
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
deleted file mode 100644
index efcd12d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditor.java
+++ /dev/null
@@ -1,151 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.*;
-import java.util.Iterator;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * Abstract superclass of all multi-page workbench editors.
- * <p>
- * This class should be subclassed by clients wishing to define new
- * multi-page editor.
- * </p>
- * <p>
- * Subclasses must implement the following methods:
- * <ul>
- * <li><code>createPartControl</code> - to create the view's controls </li>
- * <li><code>setFocus</code> - to accept focus</li>
- * <li><code>isDirty</code> - to decide whether a significant change has
- * occurred</li>
- * <li><code>doSave</code> - to save contents of editor</li>
- * <li><code>doSaveAs</code> - to save contents of editor</li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may extend or reimplement the following methods as required:
- * <ul>
- * <li><code>setInitializationData</code> - extend to provide additional
- * initialization when editor extension is instantiated</li>
- * <li><code>init(IEditorSite,IEditorInput)</code> - extend to provide
- * additional initialization when editor is assigned its site</li>
- * <li><code>isSaveOnCloseNeeded</code> - override to control saving</li>
- * <li><code>isSaveAsAllowed</code> - override to control saving</li>
- * <li><code>gotoMarker</code> - reimplement to make selections based on
- * markers</li>
- * <li><code>dispose</code> - extend to provide additional cleanup</li>
- * <li><code>getAdapter</code> - reimplement to make their editor
- * adaptable</li>
- * </ul>
- * </p>
- * <p>
- * [Issue: Review not complete - class still in flux.]
- * </p>
- *
- * @deprecated Use the class <code>MultiPageEditorPart</code> instead
- */
-public abstract class MultiPageEditor extends EditorPart {
- private List syncVector;
- private TabFolder tabFolder;
-/**
- * Creates a new multi-page editor.
- *
- * @deprecated Use the class <code>MultiPageEditorPart</code> instead
- */
-public MultiPageEditor() {
- 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)
- syncVector = new ArrayList(1);
- syncVector.add(pageBook);
-
- // Set the visible page.
- syncPageBook(pageBook);
-}
-/**
- * The <code>MultiPageEditor</code> implementation of this <code>IWorkbenchPart</code>
- * method creates a <code>TabFolder</code> control.
- */
-public void createPartControl(Composite parent) {
- tabFolder = new TabFolder(parent, SWT.NONE);
- tabFolder.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- sync();
- }
- });
-}
-/**
- * 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 enum = syncVector.iterator();
- while (enum.hasNext()) {
- PageBook pageBook = (PageBook)enum.next();
- syncPageBook(pageBook);
- }
- }
-}
-/**
- * Removes a synchronized pagebook from this editor.
- *
- * @param pageBook the pagebook to remove
- * @see addSyncroPageBook
- */
-protected void removeSyncroPageBook(PageBook pageBook) {
- if (syncVector != null)
- syncVector.remove(pageBook);
- pageBook.dispose();
-}
-/**
- * Synchronizes each registered pagebook with the editor page.
- */
-protected void sync() {
- if (syncVector != null) {
- Iterator enum = syncVector.iterator();
- while (enum.hasNext()) {
- PageBook pageBook = (PageBook)enum.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)
- 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
deleted file mode 100644
index ff6870f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorActionBarContributor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.part.EditorActionBarContributor;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * Abstract base class for managing the installation/deinstallation of global
- * actions for multi-page editors.
- * <p>
- * Subclasses must implement <code>setActivePage</code>, and may reimplement
- * any of the following methods:
- * <ul>
- * <li><code>contributeToMenu</code> - reimplement to contribute to menu</li>
- * <li><code>contributeToToolBar</code> - reimplement to contribute to tool
- * bar</li>
- * <li><code>contributeToStatusLine</code> - reimplement to contribute to
- * status line</li>
- * </ul>
- * </p>
- */
-public abstract class MultiPageEditorActionBarContributor extends EditorActionBarContributor {
-/**
- * Creates a multi-page editor action contributor.
- */
-protected MultiPageEditorActionBarContributor() {
- super();
-}
-/* (non-JavaDoc)
- * Method declared on EditorActionBarContributor
- * Registers the contributor with the multi-page editor for future
- * editor action redirection when the active page is changed, and sets
- * the active page.
- */
-public void setActiveEditor(IEditorPart part) {
- 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);
-}
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
deleted file mode 100644
index c76731c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorPart.java
+++ /dev/null
@@ -1,519 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CTabFolder;
-import org.eclipse.swt.custom.CTabItem;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.*;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-
-import org.eclipse.ui.*;
-
-/**
- * A multi-page editor is an editor with multiple pages, each of which may
- * contain an editor or an arbitrary SWT control.
- * <p>
- * Subclasses must implement the following methods:
- * <ul>
- * <li><code>createPages</code> - to create the required pages by calling one
- * of the <code>addPage</code> methods</li>
- * <li><code>IEditorPart.doSave</code> - to save contents of editor</li>
- * <li><code>IEditorPart.doSaveAs</code> - to save contents of editor</li>
- * <li><code>IEditorPart.isSaveAsAllowed</code> - to enable Save As</li>
- * <li><code>IEditorPart.gotoMarker</code> - to scroll to a marker</li>
- * </ul>
- * </p>
- * <p>
- * Multi-page editors have a single action bar contributor, which manages
- * contributions for all the pages. The contributor must be a subclass of
- * <code>AbstractMultiPageEditorActionBarContributor</code>.
- * Note that since any nested editors are created directly in code by callers of
- * <code>addPage(IEditorPart,IEditorInput)</code>, nested editors do not have
- * their own contributors.
- * </p>
- *
- * @see AbstractMultiPageEditorActionBarContributor
- */
-public abstract class MultiPageEditorPart extends EditorPart {
- /**
- * The container widget.
- */
- private CTabFolder container;
-
- /**
- * 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.
- */
- private ArrayList nestedEditors = new ArrayList(3);
-/**
- * Creates an empty multi-page editor with no pages.
- */
-protected MultiPageEditorPart() {
- super();
-}
-/**
- * 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>
- * @return the index of the new page
- *
- * @see #setControl
- */
-public int addPage(Control control) {
- createItem(control);
- return getPageCount() - 1;
-}
-/**
- * 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
- * @return the index of the new page
- * @exception PartInitException if a new page could not be created
- *
- * @see #handlePropertyChange the handler for property change events from the nested editor
- */
-public int addPage(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(), SWT.NONE);
- parent2.setLayout(new FillLayout());
- editor.createPartControl(parent2);
- editor.addPropertyListener(
- new IPropertyListener() {
- public void propertyChanged(Object source, int propertyId) {
- MultiPageEditorPart.this.handlePropertyChange(propertyId);
- }
- });
- // create item for page only after createPartControl has succeeded
- Item item = createItem(parent2);
- // remember the editor, as both data on the item, and in the list of editors (see field comment)
- item.setData(editor);
- nestedEditors.add(editor);
- return getPageCount() - 1;
-}
-/**
- * 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.
- *
- * @return a new container
- */
-private CTabFolder createContainer(Composite parent) {
- final CTabFolder container = new CTabFolder(parent, SWT.BOTTOM);
- container.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int newPageIndex = container.indexOf((CTabItem) e.item);
- pageChange(newPageIndex);
- }
- });
- return container;
-}
-/**
- * Creates a tab item and places control in the new item.
- * The item is a CTabItem with no style bits set.
- *
- * @param control is the control to be placed in an item
- * @return a new item
- */
-private CTabItem createItem(Control control) {
- CTabItem item = new CTabItem(getTabFolder(), SWT.NONE);
- item.setControl(control);
- return item;
-}
-/**
- * Creates the pages of this multi-page editor.
- * <p>
- * Subclasses must implement this method.
- * </p>
- */
-protected abstract void createPages();
-/**
- * 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>createPages</code>.
- * Subclasses should implement <code>createPages</code> rather than overriding
- * this method.
- */
-public final void createPartControl(Composite parent) {
- this.container = createContainer(parent);
- createPages();
- // set the active page (page 0 by default), unless it has already been done
- if (getTabFolder().getSelectionIndex() == -1)
- setActivePage(0);
-}
-/**
- * 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.
- *
- * @param editor the nested editor
- * @return the editor site
- */
-protected IEditorSite createSite(IEditorPart editor){
- return new MultiPageEditorSite(this, editor);
-}
-/**
- * The <code>MultiPageEditorPart</code> implementation of this
- * <code>IWorkbenchPart</code> method disposes all nested editors.
- * Subclasses may extend.
- */
-public void dispose() {
- for (int i = 0; i < nestedEditors.size(); ++i) {
- IEditorPart editor = (IEditorPart) nestedEditors.get(i);
- disposePart(editor);
- }
- nestedEditors.clear();
-}
-/**
- * Returns the active nested editor if there is one.
- * <p>
- * Subclasses should not override this method
- * </p>
- *
- * @return the active nested editor, or <code>null</code> if none
- */
-protected IEditorPart getActiveEditor() {
- /* fix for 21988 */
- if (container.isDisposed())
- return null;
- int index = getActivePage();
- if (index != -1)
- return getEditor(index);
- return null;
-}
-/**
- * Returns the index of the currently active page,
- * or -1 if there is no active page.
- * <p>
- * Subclasses should not override this method
- * </p>
- *
- * @return the index of the active page, or -1 if there is no active page
- */
-protected int getActivePage() {
- // May not have been created yet.
- if (getTabFolder() != null)
- return getTabFolder().getSelectionIndex();
- return -1;
-}
-/**
- * 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.
- * </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
- */
-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.
- * <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
- */
-protected Control getControl(int pageIndex) {
- return getItem(pageIndex).getControl();
-}
-/**
- * Returns the editor for the given page index.
- * The page index must be valid.
- *
- * @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>
- */
-protected IEditorPart getEditor(int pageIndex) {
- Item item = getItem(pageIndex);
- if (item != null) {
- Object data = item.getData();
- if (data instanceof IEditorPart) {
- return (IEditorPart) data;
- }
- }
- return null;
-}
-/**
- * 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
- * @return the tab item for the given page index
- */
-private CTabItem getItem(int pageIndex) {
- return getTabFolder().getItem(pageIndex);
-}
-/**
- * Returns the number of pages in this multi-page editor.
- *
- * @return the number of pages
- */
-protected int getPageCount() {
- CTabFolder folder = getTabFolder();
- // May not have been created yet, or may have been disposed.
- if (folder != null && !folder.isDisposed())
- return folder.getItemCount();
- return 0;
-}
-/**
- * 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
- * @return the image, or <code>null</code> if none
- */
-protected Image getPageImage(int pageIndex) {
- return getItem(pageIndex).getImage();
-}
-/**
- * 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
- * @return the text label for the page
- */
-protected String getPageText(int pageIndex) {
- return getItem(pageIndex).getText();
-}
-/**
- * Returns the tab folder containing this multi-page editor's pages.
- *
- * @return the tab folder, or <code>null</code> if <code>createPartControl</code>
- * has not been called yet
- */
-private CTabFolder getTabFolder() {
- return container;
-}
-/**
- * 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.
- * <p>
- * Subclasses may extend or reimplement this method.
- * </p>
- *
- * @param propertyId the id of the property that changed
- */
-protected void handlePropertyChange (int propertyId) {
- firePropertyChange(propertyId);
-}
-/**
- * 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.
- */
-public void init(IEditorSite site, IEditorInput input) throws PartInitException {
- setSite(site);
- setInput(input);
- site.setSelectionProvider(new MultiPageSelectionProvider(this));
-}
-/**
- * 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.
- * <p>
- * Subclasses may extend or reimplement this method.
- * </p>
- */
-public boolean isDirty() {
- // use nestedEditors to avoid SWT requests; see bug 12996
- for (Iterator i = nestedEditors.iterator(); i.hasNext();) {
- IEditorPart editor = (IEditorPart) i.next();
- if (editor.isDirty()) {
- return true;
- }
- }
- return false;
-}
-/**
- * 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
- * <code>MultiPageEditorActionBarContributor</code>, and, if so,
- * calls <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
- */
-protected void pageChange(int newPageIndex) {
- // XXX: Workaround for 1GCN531: SWT:WIN2000 - CTabFolder child's visibility is false on notification
- Control control = getControl(newPageIndex);
- if (control != null) {
- control.setVisible(true);
- }
- // XXX: End workaround
- setFocus();
- IEditorPart activeEditor = getEditor(newPageIndex);
- IEditorActionBarContributor contributor = getEditorSite().getActionBarContributor();
- if (contributor != null && contributor instanceof MultiPageEditorActionBarContributor) {
- ((MultiPageEditorActionBarContributor) contributor).setActivePage(activeEditor);
- }
- if (activeEditor != null) {
- //Workaround for 1GAUS7C: ITPUI:ALL - Editor not activated when restored from previous session
- //do not need second if once fixed
- ISelectionProvider selectionProvider = activeEditor.getSite().getSelectionProvider();
- if (selectionProvider != null) {
- SelectionChangedEvent event = new SelectionChangedEvent(selectionProvider, selectionProvider.getSelection());
- ((MultiPageSelectionProvider) getSite().getSelectionProvider()).fireSelectionChanged(event);
- }
- }
-}
-private void disposePart(final IWorkbenchPart part) {
- Platform.run(new SafeRunnable() {
- public void run() {
- part.dispose();
- }
- public void handleException(Throwable e) {
- //Exception has already being logged by Core. Do nothing.
- }
- });
-}
-/**
- * Removes the page with the given index from this multi-page editor.
- * The 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
- * @see #addPage
- */
-public void removePage(int pageIndex) {
- Assert.isTrue(pageIndex >= 0 && pageIndex < getPageCount());
- // get editor (if any) before disposing item
- IEditorPart editor = getEditor(pageIndex);
- // dispose item before disposing editor, in case there's an exception in editor's dispose
- getItem(pageIndex).dispose();
- // dispose editor (if any)
- if (editor != null) {
- nestedEditors.remove(editor);
- disposePart(editor);
- }
-}
-/**
- * Sets the currently active page.
- *
- * @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());
- getTabFolder().setSelection(pageIndex);
-}
-/**
- * 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
- */
-protected void setControl(int pageIndex, Control control) {
- getItem(pageIndex).setControl(control);
-}
-/**
- * The <code>MultiPageEditor</code> implementation of this
- * <code>IWorkbenchPart</code> method sets focus on the active nested editor,
- * if there is one.
- * <p>
- * Subclasses may extend or reimplement.
- * </p>
- */
-public void setFocus() {
- int index = getActivePage();
- if (index != -1)
- setFocus(index);
-}
-/**
- * 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.
- *
- * @pageIndex the index of the page
- */
-private void setFocus(int pageIndex) {
- if (pageIndex < 0 || pageIndex >= getPageCount())
- return;
- IEditorPart editor = getEditor(pageIndex);
- if (editor != null) {
- editor.setFocus();
- } else {
- Control control = getControl(pageIndex);
- if (control != null) {
- control.setFocus();
- }
- }
-}
-/**
- * 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>
- */
-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.
- *
- * @param pageIndex the index of the page
- * @param text the text label
- */
-protected void setPageText(int pageIndex, String text) {
- getItem(pageIndex).setText(text);
-}
-}
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
deleted file mode 100644
index be7eaf1..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageEditorSite.java
+++ /dev/null
@@ -1,231 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.*;
-
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.Workbench;
-import org.eclipse.ui.internal.WorkbenchWindow;
-
-/**
- * Site for a nested editor within a multi-page editor.
- * Selection is handled by 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.
- * </p>
- */
-public class MultiPageEditorSite implements IEditorSite {
-
- /**
- * The nested editor.
- */
- private IEditorPart editor;
-
- /**
- * The multi-page editor.
- */
- private MultiPageEditorPart multiPageEditor;
-
- /**
- * The selection provider; <code>null</code> if none.
- * @see #setSelectionProvider
- */
- private ISelectionProvider selectionProvider = null;
-
- /**
- * The selection change listener, initialized lazily; <code>null</code>
- * if not yet created.
- */
- private ISelectionChangedListener selectionChangedListener = null;
-/**
- * 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
- */
-public MultiPageEditorSite(MultiPageEditorPart multiPageEditor, IEditorPart editor) {
- Assert.isNotNull(multiPageEditor);
- Assert.isNotNull(editor);
- this.multiPageEditor = multiPageEditor;
- this.editor = editor;
-}
-/**
- * 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.
- */
-public IEditorActionBarContributor getActionBarContributor() {
- return null;
-}
-
-/**
- * The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method forwards to the multi-page editor to
- * return the decorator manager.
- *
- * @deprecated use IWorkbench.getDecoratorManager()
- */
-public ILabelDecorator getDecoratorManager() {
- return getWorkbenchWindow().getWorkbench().getDecoratorManager().getLabelDecorator();
-}
-
-/**
- * Returns the nested editor.
- *
- * @return the nested editor
- */
-public IEditorPart getEditor() {
- return editor;
-}
-/**
- * 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.
- */
-public String getId() {
- return "";//$NON-NLS-1$
-}
-
-/* (non-Javadoc)
- * Method declared on IEditorSite.
- */
-public IKeyBindingService getKeyBindingService() {
- return getMultiPageEditor().getEditorSite().getKeyBindingService();
-}
-
-/**
- * Returns the multi-page editor.
- *
- * @return the multi-page editor
- */
-public MultiPageEditorPart getMultiPageEditor() {
- return multiPageEditor;
-}
-/**
- * The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method forwards to the multi-page editor to
- * return the workbench page.
- */
-public IWorkbenchPage getPage() {
- return getMultiPageEditor().getSite().getPage();
-}
-/**
- * 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.
- */
-public String getPluginId() {
- return "";//$NON-NLS-1$
-}
-/**
- * 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.
- */
-public String getRegisteredName() {
- return "";//$NON-NLS-1$
-}
-/**
- * Returns the selection changed listener which listens to the nested editor's selection
- * changes, and calls <code>handleSelectionChanged</code>.
- *
- * @return the selection changed listener
- */
-private ISelectionChangedListener getSelectionChangedListener() {
- if (selectionChangedListener == null) {
- selectionChangedListener = new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- MultiPageEditorSite.this.handleSelectionChanged(event);
- }
- };
- }
- return selectionChangedListener;
-}
-/**
- * The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method returns the selection provider
- * set by <code>setSelectionProvider</code>.
- */
-public ISelectionProvider getSelectionProvider() {
- return selectionProvider;
-}
-/**
- * The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method forwards to the multi-page editor to
- * return the shell.
- */
-public Shell getShell() {
- return getMultiPageEditor().getSite().getShell();
-}
-/**
- * The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method forwards to the multi-page editor to
- * return the workbench window.
- */
-public IWorkbenchWindow getWorkbenchWindow() {
- return getMultiPageEditor().getSite().getWorkbenchWindow();
-}
-/**
- * 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.
- * <p>
- * Subclasses may extend or reimplement this method.
- * </p>
- *
- * @param event the event
- */
-protected void handleSelectionChanged(SelectionChangedEvent event) {
- ISelectionProvider parentProvider = getMultiPageEditor().getSite().getSelectionProvider();
- if (parentProvider instanceof MultiPageSelectionProvider) {
- SelectionChangedEvent newEvent = new SelectionChangedEvent(parentProvider, event.getSelection());
- ((MultiPageSelectionProvider) parentProvider).fireSelectionChanged(newEvent);
- }
-}
-/**
- * The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method forwards to the multi-page editor for
- * registration.
- */
-public void registerContextMenu(String menuID, MenuManager menuMgr, ISelectionProvider selProvider) {
- getMultiPageEditor().getSite().registerContextMenu(menuID, menuMgr, selProvider);
-}
-/**
- * The <code>MultiPageEditorSite</code> implementation of this
- * <code>IWorkbenchPartSite</code> method forwards to the multi-page editor for
- * registration.
- */
-public void registerContextMenu(MenuManager menuManager, ISelectionProvider selectionProvider) {
- getMultiPageEditor().getSite().registerContextMenu(menuManager, selectionProvider);
-}
-/**
- * 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.
- *
- * @see #handleSelectionChanged
- */
-public void setSelectionProvider(ISelectionProvider provider) {
- ISelectionProvider oldSelectionProvider = selectionProvider;
- selectionProvider = provider;
- if (oldSelectionProvider != null) {
- oldSelectionProvider.removeSelectionChangedListener(getSelectionChangedListener());
- }
- if (selectionProvider != null) {
- selectionProvider.addSelectionChangedListener(getSelectionChangedListener());
- }
-}
-}
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
deleted file mode 100644
index 64babd2..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/MultiPageSelectionProvider.java
+++ /dev/null
@@ -1,97 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.viewers.*;
-
-/**
- * Manages the current selection in a multi-page editor by tracking the active
- * 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.
- * </p>
- */
-public class MultiPageSelectionProvider implements ISelectionProvider {
-
- /**
- * Registered selection changed listeners (element type:
- * <code>ISelectionChangedListener</code>).
- */
- private ListenerList listeners = 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;
-}
-/* (non-Javadoc)
- * Method declared on <code>ISelectionProvider</code>.
- */
-public void addSelectionChangedListener(ISelectionChangedListener listener) {
- listeners.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(SelectionChangedEvent event) {
- Object[] listeners = this.listeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ((ISelectionChangedListener) listeners[i]).selectionChanged(event);
- }
-}
-/**
- * Returns the multi-page editor.
- */
-public MultiPageEditorPart getMultiPageEditor(){
- return multiPageEditor;
-}
-/* (non-Javadoc)
- * Method declared on <code>ISelectionProvider</code>.
- */
-public ISelection getSelection() {
- IEditorPart activeEditor = multiPageEditor.getActiveEditor();
- if (activeEditor != null) {
- ISelectionProvider selectionProvider = activeEditor.getSite().getSelectionProvider();
- if (selectionProvider != null)
- return selectionProvider.getSelection();
- }
- return null;
-}
-/* (non-JavaDoc)
- * Method declaed on <code>ISelectionProvider</code>.
- */
-public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- listeners.remove(listener);
-}
-/* (non-Javadoc)
- * Method declared on <code>ISelectionProvider</code>.
- */
-public void setSelection(ISelection selection) {
- 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
deleted file mode 100644
index 1953aeb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/Page.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Abstract base superclass for pages in a pagebook view.
- * <p>
- * This class should be subclassed by clients wishing to define new types
- * of pages for multi-page views.
- * </p>
- * <p>
- * Subclasses must implement the following methods:
- * <ul>
- * <li><code>createControl</code> - to create the page's control</li>
- * <li><code>getControl</code> - to retrieve the page's control</li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may extend or reimplement the following methods as required:
- * <ul>
- * <li><code>dispose</code> - extend to provide additional cleanup</li>
- * <li><code>setFocus</code> - reimplement to accept focus</li>
- * <li><code>setActionBars</code> - reimplement to make contributions</li>
- * <li><code>makeContributions</code> - this method exists to support previous versions</li>
- * <li><code>setActionBars</code> - this method exists to support previous versions</li>
- * <li><code>init</code> - extend to provide additional setup</li>
- * </ul>
- * </p>
- *
- * @see PageBookView
- */
-public abstract class Page implements IPageBookViewPage {
-/**
-* The site which contains this page
-*/
-private IPageSite site;
-/*
- * Creates a new page for a pagebook view.
- */
-protected Page(){
-}
-/* (non-Javadoc)
- * Method declared on IPage.
- */
-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.
- */
-public void dispose() {
- Control ctrl = getControl();
- if (ctrl != null && !ctrl.isDisposed())
- ctrl.dispose();
-}
-/**
- * The <code>Page</code> implementation of this <code>IPage</code> method returns
- * <code>null</code>. Subclasses must reimplement.
- */
-public abstract Control getControl();
-/* (non-Javadoc)
- * This method exists for backward compatibility.
- * Subclasses should reimplement <code>init</code>.
- */
-public void makeContributions(
- IMenuManager menuManager,
- IToolBarManager toolBarManager,
- IStatusLineManager statusLineManager) {
-}
-/* (non-Javadoc)
- * This method exists for backward compatibility.
- * Subclasses should reimplement <code>init</code>.
- */
-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
- */
-public void init(IPageSite pageSite) {
- site = pageSite;
-}
-/**
- * Returns the site which contains this page.
- *
- * @return the site which contains this page
- */
-public IPageSite getSite() {
- return site;
-}
-
-/**
- * The <code>Page</code> implementation of this <code>IPage</code> method
- * does nothing. Subclasses may reimplement.
- */
-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
deleted file mode 100644
index 6cdf922..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBook.java
+++ /dev/null
@@ -1,103 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.graphics.Point;
-
-/**
- * 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>
- *
- * @see PageBookView
- */
-public class PageBook extends Composite {
-
- /**
- * <p>
- * [Issue: This class should be declared private.]
- * </p>
- */
- public class PageBookLayout extends Layout {
-
- 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;
- if (currentPage != null) {
- 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)
- result.y = hHint;
- return result;
- }
-
- protected void layout(Composite composite, boolean flushCache) {
- if (currentPage != null) {
- currentPage.setBounds(composite.getClientArea());
- }
- }
- }
-
- /**
- * 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());
-}
-/**
- * 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 == currentPage)
- return;
- if (page.getParent() != this)
- return;
-
- Control oldPage = currentPage;
- currentPage = page;
-
- // show new page
- if (page != null) {
- if (!page.isDisposed()) {
- page.setVisible(true);
- layout(true);
- // if (fRequestFocusOnShowPage)
- // page.setFocus();
- }
- }
-
- // hide old *after* new page has been made visible in order to avoid flashing
- if (oldPage != null && !oldPage.isDisposed())
- oldPage.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
deleted file mode 100644
index 98d7ddb..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageBookView.java
+++ /dev/null
@@ -1,682 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.SubActionBars;
-import org.eclipse.ui.part.PageSite;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.util.*;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.FocusEvent;
-import java.util.*;
-
-/**
- * Abstract superclass of all multi-page workbench views.
- * <p>
- * Within the workbench there are many views which track the active part. If a
- * part is activated these views display some properties for the active part. A
- * simple example is the <code>Outline View</code>, which displays the outline for the
- * active editor. To avoid loss of context when part activation changes, these
- * views may implement a multi-page approach. A separate page is maintained within
- * the view for each source view. If a part is activated the associated page for the
- * part is brought to top. If a part is closed the associated page is disposed.
- * <code>PageBookView</code> is a base implementation for multi page views.
- * </p>
- * <p>
- * <code>PageBookView</code>s provide an <code>IPageSite</code> for each of
- * their pages. This site is supplied during the page's initialization. The page
- * may supply a selection provider for this site. <code>PageBookView</code>s deal
- * with these selection providers in a similar way to a workbench page's
- * <code>SelectionService</code>. When a page is made visible, if its site
- * has a selection provider, then changes in the selection are listened for
- * and the current selection is obtained and fired as a selection change event.
- * Selection changes are no longer listened for when a page is made invisible.
- * </p>
- * <p>
- * This class should be subclassed by clients wishing to define new
- * multi-page views.
- * </p>
- * <p>
- * When a <code>PageBookView</code> is created the following methods are
- * invoked. Subclasses must implement these.
- * <ul>
- * <li><code>createDefaultPage</code> - called to create a default page for the
- * view. This page is displayed when the active part in the workbench does not
- * have a page.</li>
- * <li><code>getBootstrapPart</code> - called to determine the active part in the
- * workbench. A page will be created for this part</li>
- * </ul>
- * </p>
- * <p>
- * When a part is activated the base implementation does not know if a page should
- * be created for the part. Therefore, it delegates creation to the subclass.
- * <ul>
- * <li><code>isImportant</code> - called when a workbench part is activated.
- * Subclasses return whether a page should be created for the new part.</li>
- * <li><code>doCreatePage</code> - called to create a page for a particular part
- * in the workbench. This is only invoked when <code>isImportant</code> returns
- * </code>true</code>.</li>
- * </ul>
- * </p>
- * <p>
- * When a part is closed the base implementation will destroy the page associated with
- * the particular part. The page was created by a subclass, so the subclass must also
- * destroy it. Subclasses must implement these.
- * <ul>
- * <li><code>doDestroyPage</code> - called to destroy a page for a particular
- * part in the workbench.</li>
- * </ul>
- * </p>
- */
-public abstract class PageBookView extends ViewPart implements IPartListener {
- /**
- * The pagebook control, or <code>null</code> if not initialized.
- */
- private PageBook book;
-
- /**
- * The page record for the default page.
- */
- private PageRec defaultPageRec;
-
- /**
- * Map from parts to part records (key type: <code>IWorkbenchPart</code>;
- * value type: <code>PartRec</code>).
- */
- private Map 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
- */
- private Map mapPageToSite = new HashMap();
-
- /**
- * The page rec which provided the current page or
- * <code>null</code>
- */
- private PageRec activeRec;
-
- /**
- * The action bar property listener.
- */
- private IPropertyChangeListener actionBarPropListener =
- new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (event.getProperty().equals(SubActionBars.P_ACTION_HANDLERS)
- && activeRec != null
- && event.getSource() == activeRec.subActionBars) {
- refreshGlobalActionHandlers();
- }
- }
- };
-
- /**
- * Selection change listener to listen for page selection changes
- */
- private ISelectionChangedListener selectionChangedListener =
- new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- pageSelectionChanged(event);
- }
- };
-
- /**
- * Selection provider for this view's site
- */
- private SelectionProvider selectionProvider = new SelectionProvider();
-
- /**
- * A data structure used to store the information about a single page
- * within a pagebook view.
- */
- protected static class PageRec {
-
- /**
- * The part.
- */
- public IWorkbenchPart part;
-
- /**
- * The page.
- */
- public IPage page;
-
- /**
- * The page's action bars
- */
- public SubActionBars subActionBars;
-
- /**
- * Creates a new page record initialized to the given part and page.
- */
- public PageRec(IWorkbenchPart part, IPage page) {
- this.part = part;
- this.page = page;
- }
- /**
- * Disposes of this page record by <code>null</code>ing its fields.
- */
- public void dispose() {
- part = null;
- page = null;
- }
- }
-
- /**
- * A selection provider/listener for this view.
- * It is a selection provider fo this view's site.
- */
- protected class SelectionProvider implements ISelectionProvider {
- /**
- * Selection change listeners.
- */
- private ListenerList selectionChangedListeners = new ListenerList();
-
- /* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- selectionChangedListeners.add(listener);
- }
- /* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
- public ISelection getSelection() {
- // get the selection provider from the current page
- IPage currentPage = getCurrentPage();
- // during workbench startup we may be in a state when
- // there is no current page
- if (currentPage == null)
- return StructuredSelection.EMPTY;
- IPageSite site = getPageSite(currentPage);
- if (site == null)
- return StructuredSelection.EMPTY;
- ISelectionProvider selProvider = site.getSelectionProvider();
- if (selProvider != null)
- return selProvider.getSelection();
- else
- return StructuredSelection.EMPTY;
- }
- /* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- selectionChangedListeners.remove(listener);
- }
- /* (non-Javadoc)
- * Method declared on ISelectionChangedListener.
- */
- public void selectionChanged(SelectionChangedEvent event) {
- // pass on the notification to listeners
- Object[] listeners = selectionChangedListeners.getListeners();
- for (int i = 0; i < listeners.length; i++) {
- ((ISelectionChangedListener) listeners[i]).selectionChanged(event);
- }
- }
- /* (non-Javadoc)
- * Method declared on ISelectionProvider.
- */
- public void setSelection(ISelection selection) {
- // get the selection provider from the current page
- IPage currentPage = getCurrentPage();
- // during workbench startup we may be in a state when
- // there is no current page
- if (currentPage == null)
- return;
- IPageSite site = getPageSite(currentPage);
- if (site == null)
- return;
- ISelectionProvider selProvider = site.getSelectionProvider();
- // and set its selection
- if (selProvider != null)
- selProvider.setSelection(selection);
- }
- }
-/**
- * Creates a new pagebook view.
- */
-protected PageBookView() {
- super();
-}
-/**
- * Creates and returns the default page for this view.
- * <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.
- * </p>
- *
- * @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.
- */
-private PageRec createPage(IWorkbenchPart part) {
- PageRec rec = doCreatePage(part);
- if (rec != null) {
- mapPartToRec.put(part, rec);
- preparePage(rec);
- }
- return rec;
-}
-/**
- * Prepares the page in the given page rec for use
- * in this view.
- */
-private void preparePage(PageRec rec) {
- IPageSite site = null;
- if (rec.page instanceof IPageBookViewPage) {
- site = ((IPageBookViewPage)rec.page).getSite();
- }
- if (site == null) {
- // We will create a site for our use
- site = new PageSite(getViewSite());
- }
- mapPageToSite.put(rec.page, site);
- rec.subActionBars = (SubActionBars)site.getActionBars();
- rec.subActionBars.addPropertyChangeListener(actionBarPropListener);
- // for backward compability with IPage
- rec.page.setActionBars(rec.subActionBars);
-}
-/**
- * Initializes the given page with a page site.
- * <p>
- * Subclasses should call this method after
- * the page is created but before creating its
- * controls.
- * </p>
- * <p>
- * Subclasses may override
- * </p>
- * @param the page to initialize
- */
-protected void initPage(IPageBookViewPage page) {
- try {
- page.init(new PageSite(getViewSite()));
- } catch (PartInitException e) {
- WorkbenchPlugin.log(e.getMessage());
- }
-}
-/**
- * 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.
- */
-public void createPartControl(Composite parent) {
-
- // Create the page book.
- book = new PageBook(parent, SWT.NONE);
-
- // Create the default page rec.
- IPage defaultPage = createDefaultPage(book);
- defaultPageRec = new PageRec(null, defaultPage);
- preparePage(defaultPageRec);
-
- // Show the default page
- showPageRec(defaultPageRec);
-
- // Listen to part activation events.
- getSite().getPage().addPartListener(this);
- showBootstrapPart();
-}
-/**
- * The <code>PageBookView</code> implementation of this
- * <code>IWorkbenchPart</code> method cleans up all the pages.
- * Subclasses may extend.
- */
-public void dispose() {
- // stop listening to part activation
- getSite().getPage().removePartListener(this);
-
- // Deref all of the pages.
- activeRec = null;
- if (defaultPageRec != null) {
- // check for null since the default page may not have
- // been created (ex. perspective never visible)
- defaultPageRec.page.dispose();
- defaultPageRec = null;
- }
- Map clone = (Map)((HashMap)mapPartToRec).clone();
- Iterator enum = clone.values().iterator();
- while (enum.hasNext()) {
- PageRec rec = (PageRec) enum.next();
- removePage(rec);
- }
-
- // Run super.
- super.dispose();
-}
-/**
- * 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.
- * </p>
- * @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>.
- * <p>
- * Subclasses must implement this method.
- * </p>
- *
- * @param part the input part
- * @param pageRecord a page record for the part
- * @see #doCreatePage
- */
-protected abstract void doDestroyPage(IWorkbenchPart part, PageRec pageRecord);
-/**
- * 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>.
- * </p><p>
- * 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.
- * </p>
- *
- * @return the active important part, or <code>null</code> if none
- */
-protected abstract IWorkbenchPart getBootstrapPart();
-/**
- * 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
- */
-protected IWorkbenchPart getCurrentContributingPart() {
- if (activeRec == null)
- return null;
- return activeRec.part;
-}
-/**
- * Returns the currently visible page for this view or
- * <code>null</code> if no page is currently visible.
- *
- * @return the currently visible page
- */
-public IPage getCurrentPage() {
- if (activeRec == null)
- return null;
- return activeRec.page;
-}
-/**
- * Returns the view site for the given page of this view.
- *
- * @param page the page
- * @return the corresponding site, or <code>null</code> if not found
- */
-protected PageSite getPageSite(IPage page) {
- return (PageSite)mapPageToSite.get(page);
-}
-/**
- * Returns the default page for this view.
- *
- * @return the default page
- */
-public IPage getDefaultPage() {
- return defaultPageRec.page;
-}
-/**
- * Returns the pagebook control for this view.
- *
- * @return the pagebook control, or <code>null</code> if not initialized
- */
-protected PageBook getPageBook() {
- return book;
-}
-/**
- * Returns the page record for the given part.
- *
- * @param part the part
- * @return the corresponding page record, or <code>null</code> if not found
- */
-protected PageRec getPageRec(IWorkbenchPart part) {
- return (PageRec) mapPartToRec.get(part);
-}
-/**
- * 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
- */
-protected PageRec getPageRec(IPage page) {
- Iterator enum = mapPartToRec.values().iterator();
- while (enum.hasNext()) {
- PageRec rec = (PageRec)enum.next();
- if (rec.page == page)
- return rec;
- }
- return null;
-}
-/**
- * Returns whether the given part should be added to this view.
- * <p>
- * 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
- */
-protected abstract boolean isImportant(IWorkbenchPart part);
-/* (non-Javadoc)
- * Method declared on IViewPart.
- */
-public void init(IViewSite site) throws PartInitException {
- site.setSelectionProvider(selectionProvider);
- super.init(site);
-}
-/**
- * The <code>PageBookView</code> implementation of this <code>IPartListener</code>
- * method shows the page when the given part is activated. Subclasses may extend.
- */
-public void partActivated(IWorkbenchPart part) {
- // Is this an important part? If not just return.
- if (!isImportant(part))
- return;
-
- // Create a page for the part.
- PageRec rec = getPageRec(part);
- if (rec == null)
- rec = createPage(part);
-
- // Show the page.
- if (rec != null) {
- showPageRec(rec);
- } else {
- showPageRec(defaultPageRec);
- }
-}
-/**
- * The <code>PageBookView</code> implementation of this <code>IPartListener</code>
- * method does nothing. Subclasses may extend.
- */
-public void partBroughtToTop(IWorkbenchPart part) {
-}
-/**
- * The <code>PageBookView</code> implementation of this <code>IPartListener</code>
- * method deal with the closing of the active part. Subclasses may extend.
- */
-public void partClosed(IWorkbenchPart part) {
- // Update the active part.
- if (activeRec != null && activeRec.part == part) {
- activeRec.subActionBars.dispose();
- // remove our selection listener
- ISelectionProvider provider = ((PageSite)mapPageToSite.get(activeRec.page)).getSelectionProvider();
- if (provider != null)
- provider.removeSelectionChangedListener(selectionChangedListener);
-
- activeRec = null;
- showPageRec(defaultPageRec);
- }
-
- // Find and remove the part page.
- PageRec rec = getPageRec(part);
- if (rec != null)
- removePage(rec);
-}
-/**
- * The <code>PageBookView</code> implementation of this <code>IPartListener</code>
- * method does nothing. Subclasses may extend.
- */
-public void partDeactivated(IWorkbenchPart part) {
- // Do nothing.
-}
-/**
- * The <code>PageBookView</code> implementation of this <code>IPartListener</code>
- * method does nothing. Subclasses may extend.
- */
-public void partOpened(IWorkbenchPart part) {
-}
-/* (non-Javadoc)
- * Refreshes the global actions for the active page.
- */
-private void refreshGlobalActionHandlers() {
- // Clear old actions.
- IActionBars bars = getViewSite().getActionBars();
- bars.clearGlobalActionHandlers();
-
- // Set new actions.
- Map newActionHandlers = activeRec.subActionBars.getGlobalActionHandlers();
- if (newActionHandlers != null) {
- Set keys = newActionHandlers.entrySet();
- Iterator iter = keys.iterator();
- while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry)iter.next();
- bars.setGlobalActionHandler((String)entry.getKey(),
- (IAction)entry.getValue());
- }
- }
-}
-/**
- * Removes a page.
- */
-private void removePage(PageRec rec) {
- mapPageToSite.remove(rec.page);
- mapPartToRec.remove(rec.part);
-
- Control control = rec.page.getControl();
- if (control != null && !control.isDisposed()) {
- // Dispose the page's control so pages don't have to do this in their
- // dispose method.
- // The page's control is a child of this view's control so if this view
- // is closed, the page's control will already be disposed.
- control.dispose();
- }
-
- // free the page
- doDestroyPage(rec.part, rec);
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
-public void setFocus() {
- if (activeRec == null)
- book.setFocus();
- else
- activeRec.page.getControl().setFocus();
-}
-
-/**
- * Handle page selection changes.
- */
-private void pageSelectionChanged(SelectionChangedEvent event) {
- // forward this change from a page to our site's selection provider
- SelectionProvider provider = (SelectionProvider)getSite().getSelectionProvider();
- if (provider != null)
- provider.selectionChanged(event);
-}
-/**
- * Shows a page for the active workbench part.
- */
-private void showBootstrapPart() {
- IWorkbenchPart part = getBootstrapPart();
- if (part != null)
- partActivated(part);
-}
-/**
- * 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.
- * </p>
- *
- * @param pageRec the page record containing the page to show
- */
-protected void showPageRec(PageRec pageRec) {
- // If already showing do nothing
- if (activeRec == pageRec)
- return;
-
- // Hide old page.
- if (activeRec != null) {
- activeRec.subActionBars.deactivate();
- // remove our selection listener
- ISelectionProvider provider = ((PageSite)mapPageToSite.get(activeRec.page)).getSelectionProvider();
- if (provider != null)
- provider.removeSelectionChangedListener(selectionChangedListener);
- }
- // Show new page.
- activeRec = pageRec;
- Control pageControl = activeRec.page.getControl();
- if (pageControl != null && !pageControl.isDisposed()) {
- // Verify that the page control is not disposed
- // If we are closing, it may have already been disposed
- book.showPage(pageControl);
- activeRec.subActionBars.activate();
- refreshGlobalActionHandlers();
- // add our selection listener
- ISelectionProvider provider =
- ((PageSite)mapPageToSite.get(activeRec.page)).getSelectionProvider();
- if (provider != null)
- provider.addSelectionChangedListener(selectionChangedListener);
- // Update action bars.
- getViewSite().getActionBars().updateActionBars();
- }
-}
-/**
- * Returns the selectionProvider for this page book view.
- *
- * @return a SelectionProvider
- */
-protected SelectionProvider getSelectionProvider() {
- return selectionProvider;
-}
-}
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
deleted file mode 100644
index a7e0852..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PageSite.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.part.PageBookView;
-import org.eclipse.ui.internal.*;
-/**
- * This implemetation of <code>IPageSite</code> provides
- * a site for a page within a <code>PageBookView</code>.
- * Most methods are forwarded to the view's site.
- */
-public class PageSite implements IPageSite {
- /**
- * The "parent" view site
- */
- private IViewSite parentSite;
- /**
- * A selection provider set by the page.
- * Value is <code>null</code> until set.
- */
- private ISelectionProvider selectionProvider;
- /**
- * The action bars for this site
- */
- private SubActionBars subActionBars;
- /**
- * Creates a new sub view site of the given parent
- * view site.
- *
- * @param parentViewSite the parent view site
- */
- public PageSite(IViewSite parentViewSite) {
- Assert.isNotNull(parentViewSite);
- parentSite = parentViewSite;
- subActionBars = new SubActionBars(parentViewSite.getActionBars());
- }
- /**
- * The PageSite implementation of this <code>IPageSite</code>
- * method returns the <code>SubActionBars</code> for this site.
- *
- * @return the subactionbars for this site
- */
- public IActionBars getActionBars() {
- return subActionBars;
- }
- /* (non-Javadoc)
- * Method declared on IPageSite.
- */
- public IWorkbenchPage getPage() {
- return parentSite.getPage();
- }
- /* (non-Javadoc)
- * Method declared on IPageSite.
- */
- public ISelectionProvider getSelectionProvider() {
- return selectionProvider;
- }
- /* (non-Javadoc)
- * Method declared on IPageSite.
- */
- public Shell getShell() {
- return parentSite.getShell();
- }
- /* (non-Javadoc)
- * Method declared on IPageSite.
- */
- public IWorkbenchWindow getWorkbenchWindow() {
- return parentSite.getWorkbenchWindow();
- }
- /* (non-Javadoc)
- * Method declared on IPageSite.
- */
- public void registerContextMenu(String menuID, MenuManager menuMgr, ISelectionProvider selProvider) {
- parentSite.registerContextMenu(menuID, menuMgr, selProvider);
- }
- /* (non-Javadoc)
- * Method declared on IPageSite.
- */
- public void setSelectionProvider(ISelectionProvider provider) {
- selectionProvider = provider;
- }
-}
-
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
deleted file mode 100644
index 5d6ee26..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginDropAdapter.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.ViewerDropAdapter;
-import org.eclipse.swt.dnd.*;
-
-/**
- * Adapter for adding handling of the <code>PluginTransfer</code> drag and drop
- * transfer type to a drop action.
- * <p>
- * This class may be instantiated or subclassed.
- * </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 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);
-}
-/* (non-Javadoc)
- * Method declared on DropTargetAdapter.
- * The user has dropped something on the desktop viewer.
- */
-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$
- }
-}
-/**
- * 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 {
-
- IPluginRegistry registry = Platform.getPluginRegistry();
- String adapterName = data.getExtensionId();
- IExtensionPoint xpt =
- registry.getExtensionPoint(PlatformUI.PLUGIN_ID, IWorkbenchConstants.PL_DROP_ACTIONS);
- IExtension[] extensions = xpt.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IConfigurationElement[] configs = extensions[i].getConfigurationElements();
- if (configs != null && configs.length > 0) {
- String id = configs[0].getAttribute("id");//$NON-NLS-1$
- if (id != null && id.equals(adapterName)) {
- return (IDropActionDelegate)WorkbenchPlugin.createExtension(
- configs[0], ATT_CLASS);
- }
- }
- }
- return null;
-}
-/**
- * @see ViewerDropAdapter#performDrop
- */
-public boolean performDrop(Object data) {
- //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.
- */
-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
deleted file mode 100644
index 7719e64..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransfer.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.dnd.ByteArrayTransfer;
-import org.eclipse.swt.dnd.TransferData;
-import java.io.*;
-
-/**
- * This class can be used to transfer an instance of <code>PluginTransferData</code>
- * between two parts in a workbench in a drop and drop operation.
- * <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.
- * </p><p>
- * A <code>PluginTransferData</code> contains the id of a drop action extension.
- * If a drop occurs the extension is invoked to perform a drop action. As a benefit,
- * the destination viewer doesn't need to have any knowledge of the items being
- * dropped into it.
- * </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>).
- * It is not intended to be subclassed.
- * </p>
- *
- * @see StructuredViewer
- * @see DropTarget
- * @see DragSource
- */
-public class PluginTransfer extends ByteArrayTransfer {
-
- private static final String TYPE_NAME = "pluggable-transfer-format";//$NON-NLS-1$
- private static final int TYPEID = registerType(TYPE_NAME);
-
- /**
- * Singleton instance.
- */
- private static PluginTransfer instance = new PluginTransfer();
-/**
- * Creates a new transfer object.
- */
-private PluginTransfer() {
- super();
-}
-/**
- * Returns the singleton instance.
- *
- * @return the singleton instance
- */
-public static PluginTransfer getInstance () {
- return instance;
-}
-/* (non-Javadoc)
- * Method declared on Transfer.
- */
-protected int[] getTypeIds() {
- return new int[] {TYPEID};
-}
-/* (non-Javadoc)
- * Returns the type names.
- *
- * @return the list of type names
- */
-protected String[] getTypeNames() {
- return new String[] {TYPE_NAME};
-}
-/* (non-Javadoc)
- * Method declared on Transfer.
- */
-protected void javaToNative (Object data, TransferData transferData){
- 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) {
- e.printStackTrace();
- }
-}
-/* (non-Javadoc)
- * Method declared on Transfer.
- */
-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) {
- e.printStackTrace();
- }
- //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
deleted file mode 100644
index 85cae5a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/PluginTransferData.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * Record for transferring data during a drag and drop operation between
- * different plug-ins. This object contains an extension identifier and a block
- * of bytes. When the drop occurs, the data is interpreted by an action defined
- * in the specified extension.
- * <p>
- * The workbench will automatically create instances of this class as required.
- * It is not intended to be instantiated or subclassed by clients.
- * </p>
- */
-public class PluginTransferData {
- String extensionName;
- 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;
-}
-/**
- * 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;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ResourceTransfer.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ResourceTransfer.java
deleted file mode 100644
index 5663ef5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ResourceTransfer.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.dnd.ByteArrayTransfer;
-import org.eclipse.swt.dnd.TransferData;
-import java.io.*;
-
-/**
- * The <code>ResourceTransfer</code> class is used to transfer an
- * array of <code>IResources</code>s from one part to another in a
- * drag and drop operation or a cut, copy, paste action.
- * <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.
- * </p>
- * <p>
- * When a <code>CutAction</code> or a <code>CopyAction</code> is performed,
- * this transfer is used to place references to the selected resources
- * on the <code>Clipboard</code>. When a <code>PasteAction</code> is performed, the
- * references on the clipboard are used to move or copy the resources
- * to the selected destination.
- * </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>).
- * It is not intended to be subclassed.
- * </p>
- *
- * @see StructuredViewer
- * @see DropTarget
- * @see DragSource
- * @see CopyAction
- * @see PasteAction
- */
-public class ResourceTransfer extends ByteArrayTransfer {
-
- /**
- * Singleton instance.
- */
- private static final ResourceTransfer instance = new ResourceTransfer();
-
- // Create a unique ID to make sure that different Eclipse
- // applications use different "types" of <code>ResourceTransfer</code>
- private static final String TYPE_NAME = "resource-transfer-format:" + System.currentTimeMillis() + ":" + instance.hashCode();//$NON-NLS-2$//$NON-NLS-1$
-
- private static final int TYPEID = registerType(TYPE_NAME);
-
- private IWorkspace workspace = ResourcesPlugin.getWorkspace();
-/**
- * Creates a new transfer object.
- */
-private ResourceTransfer() {
-}
-/**
- * Returns the singleton instance.
- *
- * @return the singleton instance
- */
-public static ResourceTransfer getInstance() {
- return instance;
-}
-/* (non-Javadoc)
- * Method declared on Transfer.
- */
-protected int[] getTypeIds() {
- return new int[] {TYPEID};
-}
-/* (non-Javadoc)
- * Returns the type names.
- *
- * @return the list of type names
- */
-protected String[] getTypeNames() {
- return new String[] {TYPE_NAME};
-}
-/* (non-Javadoc)
- * Method declared on Transfer.
- */
-protected void javaToNative(Object data, TransferData transferData) {
- if (!(data instanceof IResource[])) {
- return;
- }
-
- IResource[] resources = (IResource[]) data;
- /**
- * The resource serialization format is:
- * (int) number of resources
- * Then, the following for each resource:
- * (int) resource type
- * (String) path of resource
- */
-
- int resourceCount = resources.length;
-
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- DataOutputStream dataOut = new DataOutputStream(out);
-
- //write the number of resources
- dataOut.writeInt(resourceCount);
-
- //write each resource
- for (int i = 0; i < resources.length; i++) {
- writeResource(dataOut, resources[i]);
- }
-
- //cleanup
- dataOut.close();
- out.close();
- byte[] bytes = out.toByteArray();
- super.javaToNative(bytes, transferData);
- } catch (IOException e) {
- //it's best to send nothing if there were problems
- }
-}
-/* (non-Javadoc)
- * Method declared on Transfer.
- */
-protected Object nativeToJava(TransferData transferData) {
- /**
- * The resource serialization format is:
- * (int) number of resources
- * Then, the following for each resource:
- * (int) resource type
- * (String) path of resource
- */
-
- byte[] bytes = (byte[]) super.nativeToJava(transferData);
- if (bytes == null)
- return null;
- DataInputStream in = new DataInputStream(new ByteArrayInputStream(bytes));
- try {
- int count = in.readInt();
- IResource[] results = new IResource[count];
- for (int i = 0; i < count; i++) {
- results[i] = readResource(in);
- }
- return results;
- } catch (IOException e) {
- return null;
- }
-}
-/**
- * Reads a resource from the given stream.
- *
- * @param dataIn the input stream
- * @return the resource
- * @exception IOException if there is a problem reading from the stream
- */
-private IResource readResource(DataInputStream dataIn) throws IOException {
- int type = dataIn.readInt();
- String path = dataIn.readUTF();
- switch (type) {
- case IResource.FOLDER :
- return workspace.getRoot().getFolder(new Path(path));
- case IResource.FILE :
- return workspace.getRoot().getFile(new Path(path));
- case IResource.PROJECT :
- return workspace.getRoot().getProject(path);
- }
- Assert.isTrue(false, "Unknown resource type in ResourceTransfer.readResource");//$NON-NLS-1$
- return null;
-}
-/**
- * Writes the given resource to the given stream.
- *
- * @param dataOut the output stream
- * @param resource the resource
- * @exception IOException if there is a problem writing to the stream
- */
-private void writeResource(DataOutputStream dataOut, IResource resource) throws IOException {
- dataOut.writeInt(resource.getType());
- dataOut.writeUTF(resource.getFullPath().toString());
-}
-}
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
deleted file mode 100644
index ce4c24c..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/ViewPart.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-
-/**
- * Abstract base implementation of all workbench views.
- * <p>
- * This class should be subclassed by clients wishing to define new views.
- * The name of the subclass should be given as the <code>"class"</code>
- * attribute in a <code>view</code> extension contributed to the workbench's
- * view extension point (named <code>"org.eclipse.ui.views"</code>).
- * For example, the plug-in's XML markup might contain:
- * <pre>
- * <extension point="org.eclipse.ui.views">
- * <view id="com.example.myplugin.view"
- * name="My View"
- * class="com.example.myplugin.MyView"
- * icon="images/cview.gif"
- * />
- * </extension>
- * </pre>
- * where <code>com.example.myplugin.MyView</code> is the name of the
- * <code>ViewPart</code> subclass.
- * </p>
- * <p>
- * Subclasses must implement the following methods:
- * <ul>
- * <li><code>createPartControl</code> - to create the view's controls </li>
- * <li><code>setFocus</code> - to accept focus</li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may extend or reimplement the following methods as required:
- * <ul>
- * <li><code>setInitializationData</code> - extend to provide additional
- * initialization when view extension is instantiated</li>
- * <li><code>init(IWorkbenchPartSite)</code> - extend to provide additional
- * initialization when view is assigned its site</li>
- * <li><code>dispose</code> - extend to provide additional cleanup</li>
- * <li><code>getAdapter</code> - reimplement to make their view adaptable</li>
- * </ul>
- * </p>
- */
-public abstract class ViewPart extends WorkbenchPart implements IViewPart {
-/**
- * Creates a new view.
- */
-protected ViewPart() {
- super();
-}
-/* (non-Javadoc)
- * Method declared on IViewPart.
- */
-public IViewSite getViewSite() {
- return (IViewSite)getSite();
-}
-/* (non-Javadoc)
- * Initializes this view at the given view site.
- */
-public void init(IViewSite site) throws PartInitException {
- setSite(site);
-}
-/* (non-Javadoc)
- * 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.
- */
-public void init(IViewSite site,IMemento memento) throws PartInitException {
- init(site);
-}
-/* (non-Javadoc)
- * Method declared on IViewPart.
- */
-public void saveState(IMemento memento){
-}
-}
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
deleted file mode 100644
index c30692d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/WorkbenchPart.java
+++ /dev/null
@@ -1,259 +0,0 @@
-package org.eclipse.ui.part;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.ReferenceCounter;
-import org.eclipse.ui.internal.WorkbenchImages;
-
-/**
- * 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
- * <code>EditorPart</code>.
- * </p>
- *
- * @see ViewPart
- * @see EditorPart
- */
-public abstract class WorkbenchPart implements IWorkbenchPart, IExecutableExtension {
- private String title;
- private ImageDescriptor imageDescriptor;
- private Image titleImage;
- private String toolTip;
- private IConfigurationElement configElement;
- private IWorkbenchPartSite partSite;
- private ListenerList propChangeListeners = new ListenerList(2);
-
-/**
- * Creates a new workbench part.
- */
-protected WorkbenchPart() {
- super();
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
-public void addPropertyListener(IPropertyListener l) {
- propChangeListeners.add(l);
-}
-/* (non-Javadoc)
- * Creates the SWT controls for this workbench part.
- * <p>
- * Subclasses must implement this method. For a detailed description of the
- * requirements see <code>IWorkbenchPart</code>
- * </p>
- *
- * @param parent the parent control
- * @see IWorkbenchPart
- */
-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.
- */
-public void dispose() {
- ReferenceCounter imageCache = WorkbenchImages.getImageCache();
- Image image = (Image)imageCache.get(imageDescriptor);
- if (image != null) {
- int count = imageCache.removeRef(imageDescriptor);
- if(count <= 0)
- image.dispose();
- }
-
- // Clear out the property change listeners as we
- // should not be notifying anyone after the part
- // has been disposed.
- if (!propChangeListeners.isEmpty()) {
- propChangeListeners = new ListenerList(1);
- }
-}
-/**
- * Fires a property changed event.
- *
- * @param propertyId the id of the property that changed
- */
-protected void firePropertyChange(final int propertyId) {
- Object [] array = propChangeListeners.getListeners();
- for (int nX = 0; nX < array.length; nX ++) {
- final IPropertyListener l = (IPropertyListener)array[nX];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.propertyChanged(WorkbenchPart.this, propertyId);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- propChangeListeners.remove(l);
- }
- });
- }
-}
-/**
- * The <code>WorkbenchPart</code> implementation of this <code>IAdaptable</code>
- * method returns <code>null</code>. Subclasses may reimplement.
- */
-public Object getAdapter(Class key) {
- return null;
-}
-/**
- * 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);
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
-public IWorkbenchPartSite getSite() {
- return partSite;
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
-public String getTitle() {
- return title;
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
-public Image getTitleImage() {
- if (titleImage != null) {
- return titleImage;
- }
- return getDefaultImage();
-}
-/* (non-Javadoc)
- * Gets the title tool tip text of this part.
- *
- * @return the tool tip text
- */
-public String getTitleToolTip() {
- return toolTip;
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
-public void removePropertyListener(IPropertyListener l) {
- propChangeListeners.remove(l);
-}
-/* (non-Javadoc)
- * Asks this part to take focus within the workbench.
- * <p>
- * Subclasses must implement this method. For a detailed description of the
- * requirements see <code>IWorkbenchPart</code>
- * </p>
- *
- * @see IWorkbenchPart
- */
-public abstract void setFocus();
-/**
- * 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.
- */
-public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) {
-
- // Save config element.
- configElement = cfig;
-
- // Title.
- title = cfig.getAttribute("name");//$NON-NLS-1$
- if (title == null) {
- title = "Unknown";//$NON-NLS-1$
- }
-
- // Icon.
- String strIcon = cfig.getAttribute("icon");//$NON-NLS-1$
- if (strIcon != null) {
- try {
- IPluginDescriptor pd = cfig.getDeclaringExtension()
- .getDeclaringPluginDescriptor();
- URL fullPathString = new URL(pd.getInstallURL(), strIcon);
- imageDescriptor = ImageDescriptor.createFromURL(fullPathString);
- /* remember the image in a separatly from titleImage,
- * since it must be disposed even if the titleImage is changed
- * to something else*/
- ReferenceCounter imageCache = WorkbenchImages.getImageCache();
- Image image = (Image)imageCache.get(imageDescriptor);
- if(image != null) {
- imageCache.addRef(imageDescriptor);
- } else {
- image = imageDescriptor.createImage();
- imageCache.put(imageDescriptor,image);
- }
- titleImage = image;
- } catch (MalformedURLException e) {
- }
- }
-}
-/**
- * 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) {
- this.partSite = site;
-}
-/**
- * Sets or clears the title of this part.
- *
- * @param title the title, or <code>null</code> to clear
- */
-protected void setTitle(String title) {
- 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) {
- this.titleImage = titleImage;
- firePropertyChange(IWorkbenchPart.PROP_TITLE);
-}
-/**
- * Sets or clears the title tool tip text of this part.
- *
- * @param text the new tool tip text
- */
-protected void setTitleToolTip(String text) {
- this.toolTip = text;
- firePropertyChange(IWorkbenchPart.PROP_TITLE);
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/package.html b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/package.html
deleted file mode 100644
index f75d662..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/part/package.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (WinNT; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Classes for the creation of workbench parts that integrate
-with the Eclipse Platform User Interface.
-<h2>
-Package Specification</h2>
-A <b>workbench part</b> is a visual component within a <b>workbench page</b>.
-There are two types: <b>view</b> and <b>editor</b>, as defined by <tt>IViewPart</tt>
-and <tt>IEditorPart</tt>. An editor is typically used to edit
-or browse a document or input object. A view is typically used to
-navigate a hierarchy of information (like the workspace), open an editor,
-or display properties for the active editor. This package provides
-a base implementation for the definition of views and editors.
-<br>
-</body>
-</html>
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
deleted file mode 100644
index 8016c8d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/plugin/AbstractUIPlugin.java
+++ /dev/null
@@ -1,802 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2002 International Business Machines Corp. and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Common Public License v0.5
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-package org.eclipse.ui.plugin;
-
-import java.io.*;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.Iterator;
-
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.core.runtime.*;
-
-import org.eclipse.jface.dialogs.DialogSettings;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.*;
-
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.Workbench;
-
-/**
- * Abstract base class for plug-ins that integrate with the Eclipse platform UI.
- * <p>
- * Subclasses obtain the following capabilities:
- * </p>
- * <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>
- * </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>
- * </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.
- * </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>
- * method.
- * </p>
- */
-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$
-
- /**
- * Storage for dialog and wizard data; <code>null</code> if not yet
- * initialized.
- */
- private DialogSettings dialogSettings = null;
-
- /**
- * Storage for preferences.
- */
- private CompatibilityPreferenceStore preferenceStore;
-
- /**
- * The registry for all graphic images; <code>null</code> if not yet
- * initialized.
- */
- private ImageRegistry imageRegistry = null;
-
- /**
- * Internal implementation of a JFace preference store atop a core runtime
- * preference store.
- *
- * @since 2.0
- */
- private class CompatibilityPreferenceStore implements IPreferenceStore {
-
- /**
- * Flag to indicate that the listener has been added.
- */
- private boolean listenerAdded = false;
-
- /**
- * The underlying core runtime preference store; <code>null</code> if it
- * has not been initialized yet.
- */
- private Preferences prefs = null;
-
- /**
- * Identity list of old listeners (element type:
- * <code>org.eclipse.jface.util.IPropertyChangeListener</code>).
- */
- private ListenerList listeners = new ListenerList();
-
- /**
- * Indicates whether property change events should be suppressed
- * (used in implementation of <code>putValue</code>). Initially
- * and usually <code>false</code>.
- *
- * @see IPreferenceStore#putValue
- */
- private boolean silentRunning = false;
-
- /**
- * Creates a new instance for the this plug-in.
- */
- public CompatibilityPreferenceStore() {
- // Important: do not call initialize() here
- // due to heinous reentrancy problems.
- }
-
- /**
- * Initializes this preference store.
- */
- void initialize() {
- // ensure initialization is only done once.
- if (this.prefs != null) {
- return;
- }
- // here's where we first ask for the plug-in's core runtime
- // preferences;
- // note that this causes this method to be reentered
- this.prefs = getPluginPreferences();
- // avoid adding the listener a second time when reentered
- if (!this.listenerAdded) {
- // register listener that funnels everything to firePropertyChangeEvent
- this
- .prefs
- .addPropertyChangeListener(new Preferences.IPropertyChangeListener() {
- public void propertyChange(Preferences.PropertyChangeEvent event) {
- if (!silentRunning) {
- firePropertyChangeEvent(
- event.getProperty(),
- event.getOldValue(),
- event.getNewValue());
- }
- }
- });
- this.listenerAdded = true;
- }
- }
-
- /**
- * Returns the underlying preference store.
- *
- * @return the underlying preference store
- */
- private Preferences getPrefs() {
- if (prefs == null) {
- // although we try to ensure initialization is done eagerly,
- // this cannot be guaranteed, so ensure it is done here
- initialize();
- }
- return prefs;
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void addPropertyChangeListener(final IPropertyChangeListener listener) {
- listeners.add(listener);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void removePropertyChangeListener(IPropertyChangeListener listener) {
- listeners.remove(listener);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void firePropertyChangeEvent(
- String name,
- Object oldValue,
- Object newValue) {
-
- // efficiently handle case of 0 listeners
- if (listeners.isEmpty()) {
- // no one interested
- return;
- }
-
- // important: create intermediate array to protect against listeners
- // being added/removed during the notification
- final Object[] list = listeners.getListeners();
- final PropertyChangeEvent event =
- new PropertyChangeEvent(this, name, oldValue, newValue);
- Platform.run(new SafeRunnable(JFaceResources.getString("PreferenceStore.changeError")) { //$NON-NLS-1$
- public void run() {
- for (int i = 0; i < list.length; i++) {
- ((IPropertyChangeListener) list[i]).propertyChange(event);
- }
- }
- });
-
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public boolean contains(String name) {
- return getPrefs().contains(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public boolean getBoolean(String name) {
- return getPrefs().getBoolean(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public boolean getDefaultBoolean(String name) {
- return getPrefs().getDefaultBoolean(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public double getDefaultDouble(String name) {
- return getPrefs().getDefaultDouble(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public float getDefaultFloat(String name) {
- return getPrefs().getDefaultFloat(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public int getDefaultInt(String name) {
- return getPrefs().getDefaultInt(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public long getDefaultLong(String name) {
- return getPrefs().getDefaultLong(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public String getDefaultString(String name) {
- return getPrefs().getDefaultString(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public double getDouble(String name) {
- return getPrefs().getDouble(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public float getFloat(String name) {
- return getPrefs().getFloat(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public int getInt(String name) {
- return getPrefs().getInt(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public long getLong(String name) {
- return getPrefs().getLong(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public String getString(String name) {
- return getPrefs().getString(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public boolean isDefault(String name) {
- return getPrefs().isDefault(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public boolean needsSaving() {
- return getPrefs().needsSaving();
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void putValue(String name, String value) {
- try {
- // temporarily suppress event notification while setting value
- silentRunning = true;
- getPrefs().setValue(name, value);
- } finally {
- silentRunning = false;
- }
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void setDefault(String name, double value) {
- getPrefs().setDefault(name, value);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void setDefault(String name, float value) {
- getPrefs().setDefault(name, value);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void setDefault(String name, int value) {
- getPrefs().setDefault(name, value);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void setDefault(String name, long value) {
- getPrefs().setDefault(name, value);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void setDefault(String name, String value) {
- getPrefs().setDefault(name, value);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void setDefault(String name, boolean value) {
- getPrefs().setDefault(name, value);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void setToDefault(String name) {
- getPrefs().setToDefault(name);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void setValue(String name, double value) {
- getPrefs().setValue(name, value);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void setValue(String name, float value) {
- getPrefs().setValue(name, value);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void setValue(String name, int value) {
- getPrefs().setValue(name, value);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void setValue(String name, long value) {
- getPrefs().setValue(name, value);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void setValue(String name, String value) {
- getPrefs().setValue(name, value);
- }
-
- /* (non-javadoc)
- * Method declared on IPreferenceStore
- */
- public void setValue(String name, boolean value) {
- getPrefs().setValue(name, value);
- }
- }
-
-/**
- * Creates an abstract UI plug-in runtime object for the given plug-in descriptor.
- * <p>
- * Note that instances of plug-in runtime classes are automatically created
- * by the platform in the course of plug-in activation.
- * </p>
- *
- * @param descriptor the plug-in descriptor
- */
-public AbstractUIPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
-}
-
-/**
- * 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() {
- return new ImageRegistry();
-}
-/**
- * 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>
- * Subclasses should reimplement <code>initializeDefaultPreferences</code> if
- * they have custom graphic images to load.
- * </p>
- *
- * @return the preference store
- */
-public IPreferenceStore getPreferenceStore() {
- // Create the preference store lazily.
- if (preferenceStore == null) {
- // must assign field before calling initialize(), since
- // this method can be reentered during initialization
- preferenceStore = new CompatibilityPreferenceStore();
- // force initialization
- preferenceStore.initialize();
- }
- 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>
- */
-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
- */
-protected void initializeDefaultPreferences(IPreferenceStore store) {
-}
-
-/**
- * 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>
- *
- * @see #initializeDefaultPreferences
- * @since 2.0
- */
-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>
- *
- * @see #getImageRegistry
- */
-protected void initializeImageRegistry(ImageRegistry reg) {
-}
-
-/**
- * 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, the plug-in's
- * install directory is checked to see if one was installed with some default
- * settings; if no file is found in either place, a new empty dialog settings
- * is created. If a problem occurs, an empty settings is silently used.
- * <p>
- * This framework method may be overridden, although this is typically
- * unnecessary.
- * </p>
- */
-protected void loadDialogSettings() {
- dialogSettings = new DialogSettings("Workbench"); //$NON-NLS-1$
-
- // try r/w state area in the local file system
- String readWritePath =
- getStateLocation().append(FN_DIALOG_SETTINGS).toOSString();
- File settingsFile = new File(readWritePath);
- if (settingsFile.exists()) {
- try {
- dialogSettings.load(readWritePath);
- } catch (IOException e) {
- // load failed so ensure we have an empty settings
- dialogSettings = new DialogSettings("Workbench"); //$NON-NLS-1$
- }
- } else {
- // not found - use installed defaults if available
- URL baseURL = getDescriptor().getInstallURL();
-
- URL dsURL = null;
- try {
- dsURL = new URL(baseURL, FN_DIALOG_SETTINGS);
- } catch (MalformedURLException e) {
- return;
- }
- InputStream is = null;
- try {
- is = dsURL.openStream();
- InputStreamReader reader = new InputStreamReader(is, "utf-8"); //$NON-NLS-1$
- dialogSettings.load(reader);
- } catch (IOException e) {
- // load failed so ensure we have an empty settings
- dialogSettings = new DialogSettings("Workbench"); //$NON-NLS-1$
- } finally {
- try {
- if (is != null)
- is.close();
- } catch (IOException e) {
- }
- }
- }
-}
-
-/**
- * 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.
- */
-protected void loadPreferenceStore() {
-}
-
-/**
- * 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() {
- final Workbench wb = (Workbench)PlatformUI.getWorkbench();
- if (wb != null) {
- // 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(
- new Runnable() {
- public void run() {
- wb.refreshPluginActions(getDescriptor().getUniqueIdentifier());
- }
- }
- );
- }
-}
-/**
- * Saves this plug-in's dialog settings.
- * Any problems which arise are silently ignored.
- */
-protected void saveDialogSettings() {
- if (dialogSettings == null) {
- return;
- }
-
- try {
- String readWritePath = getStateLocation().append(FN_DIALOG_SETTINGS).toOSString();
- dialogSettings.save(readWritePath);
- }
- catch (IOException e) {
- }
-}
-
-/**
- * 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.
- */
-protected void savePreferenceStore() {
- savePluginPreferences();
-}
-
-/**
- * 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 first.
- * <p>
- * WARNING: Plug-ins may not be started in the UI thread.
- * The <code>startup()</code> method should not assume that its code runs in
- * the UI thread, otherwise SWT thread exceptions may occur on startup.
- */
-public void startup() throws CoreException {
- refreshPluginActions();
-}
-/**
- * The <code>AbstractUIPlugin</code> implementation of this <code>Plugin</code>
- * 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 first.
- */
-public void shutdown() throws CoreException {
- super.shutdown();
- saveDialogSettings();
- savePreferenceStore();
- preferenceStore = null;
- imageRegistry = null;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/plugin/package.html b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/plugin/package.html
deleted file mode 100644
index be60615..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/plugin/package.html
+++ /dev/null
@@ -1,19 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (WinNT; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Class hierarchies for plug-ins that integrate with
-the Eclipse Platform UI.
-<h2>
-Package Specification</h2>
-A <b>Plug-in</b> is a bundle of extensions for the Platform. This
-package contains support for the creation of User Interface Plug-ins, plug-ins
-which define extension points for the Platform User Interface.
-<br>
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/Base64Encoder.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/Base64Encoder.java
deleted file mode 100644
index db0e876..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/Base64Encoder.java
+++ /dev/null
@@ -1,61 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-/**
- * This utility class converts a passed byte array into a Base 64 encoded
- * String according to the specification in RFC1521 section 5.2
- */
-/*package*/ class Base64Encoder {
- private static final String mappings = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";//$NON-NLS-1$
- private static final String filler = "=";//$NON-NLS-1$
-/**
- * Answer a string representing the Base 64 encoded form of the passed
- * byte array
- *
- * @return java.lang.String
- * @param contents byte[]
- */
-public static String encode(byte[] contents) {
- StringBuffer result = new StringBuffer();
-
- for (int i = 0; i < contents.length; i = i + 3) {
- if (result.length() == 76)
- result.append("\n\r");//$NON-NLS-1$
-
- // output character 1
- result.append(mappings.charAt((contents[i] & 0xFC) >> 2));
-
- // output character 2
- int c2 = (contents[i] & 0x03) << 4;
- if (i + 1 >= contents.length) {
- result.append(mappings.charAt(c2));
- result.append(filler);
- result.append(filler);
- return result.toString();
- }
-
- c2 |= ((contents[i + 1] & 0xF0) >> 4);
- result.append(mappings.charAt(c2));
-
- // output character 3
- int c3 = (contents[i + 1] & 0x0F) << 2;
- if (i + 2 >= contents.length) {
- result.append(mappings.charAt(c3));
- result.append(filler);
- return result.toString();
- }
-
- c3 |= ((contents[i + 2] & 0xC0) >> 6);
- result.append(mappings.charAt(c3));
-
- // output character 4
- result.append(mappings.charAt(contents[i + 2] & 0x3F));
- }
-
- return result.toString();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/DataTransferMessages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/DataTransferMessages.java
deleted file mode 100644
index 3182a53..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/DataTransferMessages.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps managing messages
- */
-class DataTransferMessages {
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.wizards.datatransfer.messages";//$NON-NLS-1$
- private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-private DataTransferMessages(){
- // prevent instantiation of class
-}
-/**
- * Returns the formatted message for the given key in
- * the resource bundle.
- *
- * @param key the resource name
- * @param args the message arguments
- * @return the string
- */
-public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key),args);
-}
-/**
- * Returns the resource object with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the key is returned.
- *
- * @param key the resource name
- * @return the string
- */
-public static String getString(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ExternalProjectImportWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ExternalProjectImportWizard.java
deleted file mode 100644
index fd72c47..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ExternalProjectImportWizard.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.ui.*;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * Standard workbench wizard for importing projects defined
- * outside of the currently defined projects into Eclipse.
- * <p>
- * 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 ExternalProjectImportWizard();
- * 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, a project is created with the location
- * specified by the user.
- * </p>
- */
-
-public class ExternalProjectImportWizard
- extends Wizard
- implements IImportWizard {
- private WizardExternalProjectImportPage mainPage;
- private IWorkbench workbench;
-
- /**
- * Constructor for ExternalProjectImportWizard.
- */
- public ExternalProjectImportWizard() {
- super();
- }
-
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public void addPages() {
- super.addPages();
- mainPage = new WizardExternalProjectImportPage();
- addPage(mainPage);
- }
- /**
- * Returns the image descriptor with the given relative path.
- */
- private ImageDescriptor getImageDescriptor(String relativePath) {
- String iconPath = "icons/full/"; //$NON-NLS-1$
- try {
- AbstractUIPlugin plugin =
- (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- URL installURL = plugin.getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + relativePath);
- return ImageDescriptor.createFromURL(url);
- } catch (MalformedURLException e) {
- // Should not happen
- return null;
- }
- }
- /* (non-Javadoc)
- * Method declared on IWorkbenchWizard.
- */
- public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- this.workbench = workbench;
- setWindowTitle(DataTransferMessages.getString("DataTransfer.importTitle")); //$NON-NLS-1$
- setDefaultPageImageDescriptor(getImageDescriptor("wizban/importdir_wiz.gif")); //$NON-NLS-1$
-
- }
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean performCancel() {
- return true;
- }
- /* (non-Javadoc)
- * Method declared on IWizard.
- */
- public boolean performFinish() {
- return (mainPage.createExistingProject() != null);
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemExportOperation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemExportOperation.java
deleted file mode 100644
index ed52c48..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemExportOperation.java
+++ /dev/null
@@ -1,402 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.resources.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
-import org.eclipse.jface.operation.*;
-import org.eclipse.swt.*;
-import java.io.*;
-import java.util.*;
-
-/**
- * Operation for exporting the contents of a resource to the local file system.
- */
-/*package*/ class FileSystemExportOperation implements IRunnableWithProgress {
- private IPath path;
- private IProgressMonitor monitor;
- private FileSystemExporter exporter = new FileSystemExporter();
- private List resourcesToExport;
- private IOverwriteQuery overwriteCallback;
- private IResource resource;
- private List errorTable = new ArrayList(1);
-
- private boolean overwriteFiles = false;
- private boolean createLeadupStructure = true;
- private boolean createContainerDirectories = true;
-/**
- * Create an instance of this class. Use this constructor if you wish to
- * export specific resources without a common parent resource
- */
-public FileSystemExportOperation(List resources,String destinationPath,IOverwriteQuery overwriteImplementor) {
- super();
-
- // Eliminate redundancies in list of resources being exported
- Iterator elementsEnum = resources.iterator();
- while (elementsEnum.hasNext()) {
- IResource currentResource = (IResource) elementsEnum.next();
- if (isDescendent(resources, currentResource))
- elementsEnum.remove(); //Remove currentResource
- }
-
- resourcesToExport = resources;
- path = new Path(destinationPath);
- overwriteCallback = overwriteImplementor;
-}
-/**
- * Create an instance of this class. Use this constructor if you wish to
- * recursively export a single resource
- */
-public FileSystemExportOperation(IResource res,String destinationPath,IOverwriteQuery overwriteImplementor) {
- super();
- resource = res;
- path = new Path(destinationPath);
- overwriteCallback = overwriteImplementor;
-}
-/**
- * Create an instance of this class. Use this constructor if you wish to
- * export specific resources with a common parent resource (affects container
- * directory creation)
- */
-public FileSystemExportOperation(IResource res, List resources, String destinationPath, IOverwriteQuery overwriteImplementor) {
- this(res,destinationPath,overwriteImplementor);
- resourcesToExport = resources;
-}
-/**
- * Add a new entry to the error table with the passed information
- */
-protected void addError(String message,Throwable e) {
- errorTable.add(
- new Status(
- IStatus.ERROR,
- PlatformUI.PLUGIN_ID,
- 0,
- message,
- e));
-}
-/**
- * Answer the total number of file resources that exist at or below self in the
- * resources hierarchy.
- *
- * @return int
- * @param resource org.eclipse.core.resources.IResource
- */
-protected int countChildrenOf(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE)
- return 1;
-
- int count = 0;
- if (resource.isAccessible()) {
- IResource[] children = ((IContainer) resource).members();
- for (int i = 0; i<children.length; i++)
- count += countChildrenOf(children[i]);
- }
-
- return count;
-}
-/**
- * Answer a boolean indicating the number of file resources that were
- * specified for export
- *
- * @return int
- */
-protected int countSelectedResources() throws CoreException {
- int result = 0;
- Iterator resources = resourcesToExport.iterator();
-
- while (resources.hasNext())
- result += countChildrenOf((IResource)resources.next());
-
- return result;
-}
-/**
- * Create the directories required for exporting the passed resource,
- * based upon its container hierarchy
- *
- * @param resource org.eclipse.core.resources.IResource
- */
-protected void createLeadupDirectoriesFor(IResource resource) {
- IPath resourcePath = resource.getFullPath().removeLastSegments(1);
-
- for (int i = 0; i < resourcePath.segmentCount(); i++) {
- path = path.append(resourcePath.segment(i));
- exporter.createFolder(path);
- }
-}
-/**
- * Recursively export the previously-specified resource
- */
-protected void exportAllResources() throws InterruptedException {
- if (resource.getType() == IResource.FILE)
- exportFile((IFile)resource,path);
- else {
- try {
- exportChildren(((IContainer)resource).members(),path);
- } catch (CoreException e) {
- // not safe to show a dialog
- // should never happen because the file system export wizard ensures that the
- // single resource chosen for export is both existent and accessible
- errorTable.add(e);
- }
- }
-}
-/**
- * Export all of the resources contained in the passed collection
- *
- * @param children java.util.Enumeration
- * @param currentPath IPath
- */
-protected void exportChildren(IResource[] children,IPath currentPath) throws InterruptedException {
- for (int i = 0; i<children.length; i++) {
- IResource child = children[i];
- if (!child.isAccessible())
- continue;
-
- if (child.getType() == IResource.FILE)
- exportFile((IFile)child,currentPath);
- else {
- IPath destination = currentPath.append(child.getName());
- exporter.createFolder(destination);
- try {
- exportChildren(((IContainer)child).members(),destination);
- } catch (CoreException e) {
- // not safe to show a dialog
- // should never happen because:
- // i. this method is called recursively iterating over the result of #members,
- // which only answers existing children
- // ii. there is an #isAccessible check done before #members is invoked
- errorTable.add(e.getStatus());
- }
- }
- }
-}
-/**
- * Export the passed file to the specified location
- *
- * @param file org.eclipse.core.resources.IFile
- * @param location org.eclipse.core.runtime.IPath
- */
-protected void exportFile(IFile file, IPath location)
- throws InterruptedException {
- IPath fullPath = location.append(file.getName());
- monitor.subTask(file.getFullPath().toString());
- String properPathString = fullPath.toOSString();
- File targetFile = new File(properPathString);
-
- if (targetFile.exists()) {
- if (!targetFile.canWrite()) {
- errorTable
- .add(new Status(
- IStatus.ERROR,
- PlatformUI.PLUGIN_ID,
- 0,
- DataTransferMessages.format("DataTransfer.cannotOverwrite", //$NON-NLS-1$
- new Object[] { targetFile.getAbsolutePath()}), null));
- monitor.worked(1);
- return;
- }
-
- if (!overwriteFiles) {
- String overwriteAnswer = overwriteCallback.queryOverwrite(properPathString);
-
- if (overwriteAnswer.equals(IOverwriteQuery.CANCEL))
- throw new InterruptedException();
-
- if (overwriteAnswer.equals(IOverwriteQuery.NO)) {
- monitor.worked(1);
- return;
- }
-
- if (overwriteAnswer.equals(IOverwriteQuery.ALL))
- overwriteFiles = true;
- }
- }
-
- try {
- exporter.write(file, fullPath);
- } catch (IOException e) {
- errorTable
- .add(new Status(
- IStatus.ERROR,
- PlatformUI.PLUGIN_ID,
- 0,
- DataTransferMessages.format(
- "DataTransfer.errorExporting", //$NON-NLS-1$
- new Object[] { fullPath, e.getMessage() }),
- e));
- } catch (CoreException e) {
- errorTable
- .add(new Status(
- IStatus.ERROR,
- PlatformUI.PLUGIN_ID,
- 0,
- DataTransferMessages.format(
- "DataTransfer.errorExporting", //$NON-NLS-1$
- new Object[] { fullPath, e.getMessage() }),
- e));
- }
-
- monitor.worked(1);
- ModalContext.checkCanceled(monitor);
-}
-/**
- * Export the resources contained in the previously-defined
- * resourcesToExport collection
- */
-protected void exportSpecifiedResources() throws InterruptedException {
- Iterator resources = resourcesToExport.iterator();
- IPath initPath = (IPath)path.clone();
-
- while (resources.hasNext()) {
- IResource currentResource = (IResource)resources.next();
- if (!currentResource.isAccessible())
- continue;
-
- path = initPath;
-
- if (resource == null) {
- // No root resource specified and creation of containment directories
- // is required. Create containers from depth 2 onwards (ie.- project's
- // child inclusive) for each resource being exported.
- if (createLeadupStructure)
- createLeadupDirectoriesFor(currentResource);
-
- } else {
- // Root resource specified. Must create containment directories
- // from this point onwards for each resource being exported
- IPath containersToCreate =
- currentResource.getFullPath().removeFirstSegments(
- resource.getFullPath().segmentCount()).removeLastSegments(1);
-
- for (int i = 0; i < containersToCreate.segmentCount(); i++) {
- path = path.append(containersToCreate.segment(i));
- exporter.createFolder(path);
- }
- }
-
- if (currentResource.getType() == IResource.FILE)
- exportFile((IFile)currentResource,path);
- else {
- if (createContainerDirectories) {
- path = path.append(currentResource.getName());
- exporter.createFolder(path);
- }
-
- try {
- exportChildren(((IContainer)currentResource).members(),path);
- } catch (CoreException e) {
- // should never happen because #isAccessible is called before #members is invoked,
- // which implicitly does an existence check
- errorTable.add(e.getStatus());
- }
- }
- }
-}
-/**
- * Returns the status of the export operation.
- * If there were any errors, the result is a status object containing
- * individual status objects for each error.
- * If there were no errors, the result is a status object with error code <code>OK</code>.
- *
- * @return the status
- */
-public IStatus getStatus() {
- IStatus[] errors = new IStatus[errorTable.size()];
- errorTable.toArray(errors);
- return new MultiStatus(
- PlatformUI.PLUGIN_ID,
- IStatus.OK,
- errors,
- DataTransferMessages.getString("FileSystemExportOperation.problemsExporting"), //$NON-NLS-1$
- null);
-}
-/**
- * Answer a boolean indicating whether the passed child is a descendent
- * of one or more members of the passed resources collection
- *
- * @return boolean
- * @param resources java.util.List
- * @param child org.eclipse.core.resources.IResource
- */
-protected boolean isDescendent(List resources, IResource child) {
- if (child.getType() == IResource.PROJECT)
- return false;
-
- IResource parent = child.getParent();
- if (resources.contains(parent))
- return true;
-
- return isDescendent(resources,parent);
-}
-/**
- * Export the resources that were previously specified for export
- * (or if a single resource was specified then export it recursively)
- */
-public void run(IProgressMonitor monitor) throws InterruptedException {
- this.monitor = monitor;
-
- if (resource != null) {
- if (createLeadupStructure)
- createLeadupDirectoriesFor(resource);
-
- if (createContainerDirectories &&
- resource.getType() != IResource.FILE) { // ensure it's a container
- path = path.append(resource.getName());
- exporter.createFolder(path);
- }
- }
-
- try {
- int totalWork = IProgressMonitor.UNKNOWN;
- try {
- if (resourcesToExport == null)
- totalWork = countChildrenOf(resource);
- else
- totalWork = countSelectedResources();
- }
- catch (CoreException e) {
- // Should not happen
- errorTable.add(e.getStatus());
- }
- monitor.beginTask(DataTransferMessages.getString("DataTransfer.exportingTitle"), totalWork); //$NON-NLS-1$
- if (resourcesToExport == null) {
- exportAllResources();
- } else {
- exportSpecifiedResources();
- }
- } finally {
- monitor.done();
- }
-}
-/**
- * Set this boolean indicating whether a directory should be created for
- * Folder resources that are explicitly passed for export
- *
- * @param value boolean
- */
-public void setCreateContainerDirectories(boolean value) {
- createContainerDirectories = value;
-}
-/**
- * Set this boolean indicating whether each exported resource's complete path should
- * include containment hierarchies as dictated by its parents
- *
- * @param value boolean
- */
-public void setCreateLeadupStructure(boolean value) {
- createLeadupStructure = value;
-}
-/**
- * Set this boolean indicating whether exported resources should automatically
- * overwrite existing files when a conflict occurs
- *
- * @param value boolean
- */
-public void setOverwriteFiles(boolean value) {
- overwriteFiles = value;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemExportWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemExportWizard.java
deleted file mode 100644
index 8b7eed5..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemExportWizard.java
+++ /dev/null
@@ -1,114 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.*;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-
-/**
- * Standard workbench wizard for exporting resources 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.
- * </p>
- * <p>
- * Example:
- * <pre>
- * IWizard wizard = new FileSystemExportWizard();
- * 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 resources
- * are exported to the user-specified location in the local file system,
- * the dialog closes, and the call to <code>open</code> returns.
- * </p>
- */
-public class FileSystemExportWizard extends Wizard implements IExportWizard {
- private IWorkbench workbench;
- private IStructuredSelection selection;
- private WizardFileSystemResourceExportPage1 mainPage;
-/**
- * Creates a wizard for exporting workspace resources to the local file system.
- */
-public FileSystemExportWizard() {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("FileSystemExportWizard");//$NON-NLS-1$
- if(section == null)
- section = workbenchSettings.addNewSection("FileSystemExportWizard");//$NON-NLS-1$
- setDialogSettings(section);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public void addPages() {
- super.addPages();
- mainPage = new WizardFileSystemResourceExportPage1(selection);
- addPage(mainPage);
-}
-/**
- * Returns the image descriptor with the given relative path.
- */
-private ImageDescriptor getImageDescriptor(String relativePath) {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- URL installURL = plugin.getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + relativePath);
- return ImageDescriptor.createFromURL(url);
- }
- catch (MalformedURLException e) {
- // Should not happen
- return null;
- }
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchWizard.
- */
-public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- this.workbench = workbench;
-
-
- //Make it the current selection by default but look it up otherwise
-
- selection = currentSelection;
-
- if(currentSelection.isEmpty() && workbench.getActiveWorkbenchWindow() != null){
- IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
- if(page != null){
- IEditorPart currentEditor = page.getActiveEditor();
- if(currentEditor != null){
- Object selectedResource = currentEditor.getEditorInput().getAdapter(IResource.class);
- if(selectedResource != null)
- selection = new StructuredSelection(selectedResource);
- }
- }
- }
-
- setWindowTitle(DataTransferMessages.getString("DataTransfer.export")); //$NON-NLS-1$
- setDefaultPageImageDescriptor(getImageDescriptor("wizban/exportdir_wiz.gif"));//$NON-NLS-1$
- setNeedsProgressMonitor(true);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public boolean performFinish() {
- return mainPage.finish();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemExporter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemExporter.java
deleted file mode 100644
index a73f23b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemExporter.java
+++ /dev/null
@@ -1,84 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.resources.*;
-import java.io.*;
-import java.util.*;
-
-/**
- * Helper class for exporting resources to the file system.
- */
-/*package*/ class FileSystemExporter {
-/**
- * Creates the specified file system directory at <code>destinationPath</code>.
- * This creates a new file system directory.
- */
-public void createFolder(IPath destinationPath) {
- new File(destinationPath.toOSString()).mkdir();
-}
-/**
- * Writes the passed resource to the specified location recursively
- */
-public void write(IResource resource,IPath destinationPath) throws CoreException, IOException {
- if (resource.getType() == IResource.FILE)
- writeFile((IFile)resource,destinationPath);
- else
- writeChildren((IContainer)resource,destinationPath);
-}
-/**
- * Exports the passed container's children
- */
-protected void writeChildren(IContainer folder, IPath destinationPath) throws CoreException, IOException {
- if (folder.isAccessible()) {
- IResource[] children = folder.members();
- for (int i = 0; i<children.length; i++) {
- IResource child = children[i];
- writeResource(
- child,
- destinationPath.append(child.getName()));
- }
- }
-}
-/**
- * Writes the passed file resource to the specified destination on the local
- * file system
- */
-protected void writeFile(IFile file, IPath destinationPath) throws IOException, CoreException {
- FileOutputStream output = null;
- InputStream contentStream = null;
-
- try {
- output = new FileOutputStream(destinationPath.toOSString());
- contentStream = file.getContents(false);
- int chunkSize = contentStream.available();
- byte[] readBuffer = new byte[chunkSize];
- int n = contentStream.read(readBuffer);
-
- while (n > 0) {
- output.write(readBuffer);
- n = contentStream.read(readBuffer);
- }
- } finally {
- if (output != null)
- output.close();
- if (contentStream != null)
- contentStream.close();
- }
-}
-/**
- * Writes the passed resource to the specified location recursively
- */
-protected void writeResource(IResource resource,IPath destinationPath) throws CoreException, IOException {
- if (resource.getType() == IResource.FILE)
- writeFile((IFile)resource,destinationPath);
- else {
- createFolder(destinationPath);
- writeChildren((IContainer)resource,destinationPath);
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemImportWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemImportWizard.java
deleted file mode 100644
index 5bc42ed..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemImportWizard.java
+++ /dev/null
@@ -1,99 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Display;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-
-/**
- * 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.
- * </p>
- * <p>
- * Example:
- * <pre>
- * IWizard wizard = new FileSystemImportWizard();
- * 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.
- * </p>
- */
-public class FileSystemImportWizard extends Wizard implements IImportWizard {
- private IWorkbench workbench;
- private IStructuredSelection selection;
- private WizardFileSystemResourceImportPage1 mainPage;
-/**
- * Creates a wizard for importing resources into the workspace from
- * the file system.
- */
-public FileSystemImportWizard() {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("FileSystemImportWizard");//$NON-NLS-1$
- if(section == null)
- section = workbenchSettings.addNewSection("FileSystemImportWizard");//$NON-NLS-1$
- setDialogSettings(section);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public void addPages() {
- super.addPages();
- mainPage = new WizardFileSystemResourceImportPage1(workbench,selection);
- addPage(mainPage);
-}
-/**
- * Returns the image descriptor with the given relative path.
- */
-private ImageDescriptor getImageDescriptor(String relativePath) {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- URL installURL = plugin.getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + relativePath);
- return ImageDescriptor.createFromURL(url);
- }
- catch (MalformedURLException e) {
- // Should not happen
- return null;
- }
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchWizard.
- */
-public void init(IWorkbench workbench,IStructuredSelection currentSelection) {
- this.workbench = workbench;
- selection = currentSelection;
-
- setWindowTitle(DataTransferMessages.getString("DataTransfer.importTitle")); //$NON-NLS-1$
- setDefaultPageImageDescriptor(getImageDescriptor("wizban/importdir_wiz.gif"));//$NON-NLS-1$
- setNeedsProgressMonitor(true);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public boolean performFinish() {
- return mainPage.finish();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemStructureProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemStructureProvider.java
deleted file mode 100644
index 3155d07..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/FileSystemStructureProvider.java
+++ /dev/null
@@ -1,75 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.*;
-import java.util.*;
-
-/**
- * This class provides information regarding the structure and
- * content of specified file system File objects.
- */
-public class FileSystemStructureProvider implements IImportStructureProvider {
-
- /**
- * Holds a singleton instance of this class.
- */
- public final static FileSystemStructureProvider INSTANCE = new FileSystemStructureProvider();
-/**
- * Creates an instance of <code>FileSystemStructureProvider</code>.
- */
-private FileSystemStructureProvider() {
- super();
-}
-/* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
-public List getChildren(Object element) {
- File folder = (File) element;
- String[] children = folder.list();
- int childrenLength = children == null ? 0 : children.length;
- List result = new ArrayList(childrenLength);
-
- for (int i = 0; i < childrenLength; i++)
- result.add(new File(folder, children[i]));
-
- return result;
-}
-/* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
-public InputStream getContents(Object element) {
- try {
- return new FileInputStream((File)element);
- } catch (FileNotFoundException e) {
- return null;
- }
-}
-/* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
-public String getFullPath(Object element) {
- return ((File)element).getPath();
-}
-/* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
-public String getLabel(Object element) {
-
- //Get the name - if it is empty then return the path as it is a file root
- File file = (File) element;
- String name = file.getName();
- if (name.length() == 0)
- return file.getPath();
- else
- return name;
-}
-/* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
-public boolean isFolder(Object element) {
- return ((File)element).isDirectory();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/IDataTransferHelpContextIds.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/IDataTransferHelpContextIds.java
deleted file mode 100644
index 168bab4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/IDataTransferHelpContextIds.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Help context ids for the data transfer wizards.
- * <p>
- * This interface contains constants only; it is not intended to be implemented
- * or extended.
- * </p>
- *
- */
-/*package*/ interface IDataTransferHelpContextIds {
- public static final String PREFIX = PlatformUI.PLUGIN_ID + "."; //$NON-NLS-1$
-
- // Wizard pages
- public static final String FILE_SYSTEM_EXPORT_WIZARD_PAGE = PREFIX + "file_system_export_wizard_page"; //$NON-NLS-1$
- public static final String FILE_SYSTEM_IMPORT_WIZARD_PAGE = PREFIX + "file_system_import_wizard_page"; //$NON-NLS-1$
- public static final String ZIP_FILE_EXPORT_WIZARD_PAGE = PREFIX + "zip_file_export_wizard_page"; //$NON-NLS-1$
- public static final String ZIP_FILE_IMPORT_WIZARD_PAGE = PREFIX + "zip_file_import_wizard_page"; //$NON-NLS-1$
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/IImportStructureProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/IImportStructureProvider.java
deleted file mode 100644
index 8105f71..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/IImportStructureProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.*;
-import java.util.*;
-
-/**
- * Interface which can provide structure and content information
- * for an element (for example, a file system element).
- * Used by the import wizards to abstract the commonalities
- * between importing from the file system and importing from an archive.
- */
-public interface IImportStructureProvider {
-/**
- * Returns a collection with the children of the specified structured element.
- */
-List getChildren(Object element);
-/**
- * Returns the contents of the specified structured element, or
- * <code>null</code> if there is a problem determining the element's
- * contents.
- *
- * @param element a structured element
- * @return the contents of the structured element, or <code>null</code>
- */
-InputStream getContents(Object element);
-/**
- * Returns the full path of the specified structured element.
- *
- * @param element a structured element
- * @return the display label of the structured element
- */
-String getFullPath(Object element);
-/**
- * Returns the display label of the specified structured element.
- *
- * @param element a structured element
- * @return the display label of the structured element
- */
-String getLabel(Object element);
-/**
- * Returns a boolean indicating whether the passed structured element represents
- * a container element (as opposed to a leaf element).
- *
- * @return boolean
- * @param element java.lang.Object
- */
-boolean isFolder(Object element);
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ImportOperation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ImportOperation.java
deleted file mode 100644
index 422a833..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ImportOperation.java
+++ /dev/null
@@ -1,571 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.ContainerGenerator;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
-import java.io.*;
-import java.util.*;
-
-/**
- * An operation which does the actual work of copying objects from the local file
- * system into the workspace.
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- */
-public class ImportOperation extends WorkspaceModifyOperation {
- private static final int POLICY_DEFAULT = 0;
- private static final int POLICY_SKIP_CHILDREN = 1;
- private static final int POLICY_FORCE_OVERWRITE = 2;
-
- private Object source;
- private IPath destinationPath;
- private IContainer destinationContainer;
- private List selectedFiles;
- private IImportStructureProvider provider;
- private IProgressMonitor monitor;
- protected IOverwriteQuery overwriteCallback;
- private List errorTable = new ArrayList();
- private boolean createContainerStructure = true;
-
- //The constants for the overwrite 3 state
- private static final int OVERWRITE_NOT_SET = 0;
- private static final int OVERWRITE_NONE = 1;
- private static final int OVERWRITE_ALL = 2;
- private int overwriteState = OVERWRITE_NOT_SET;
-/**
- * Creates a new operation that recursively imports the entire contents of the
- * specified root file system object.
- * <p>
- * The <code>source</code> parameter represents the root file system object to
- * import. All contents of this object are imported. Valid types for this parameter
- * are determined by the supplied <code>IImportStructureProvider</code>.
- * </p>
- * <p>
- * The <code>provider</code> parameter allows this operation to deal with the
- * source object in an abstract way. This operation calls methods on the provider
- * and the provider in turn calls specific methods on the source object.
- * </p>
- * <p>
- * The default import behavior is to recreate the complete container structure
- * for the contents of the root file system object in their destination.
- * If <code>setCreateContainerStructure</code> is set to false then the container
- * structure created is relative to the root file system object.
- * </p>
- *
- * @param containerPath the full path of the destination container within the
- * workspace
- * @param source the root file system object to import
- * @param provider the file system structure provider to use
- * @param overwriteImplementor the overwrite strategy to use
- */
-public ImportOperation(IPath containerPath, Object source, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor) {
- super();
- this.destinationPath = containerPath;
- this.source = source;
- this.provider = provider;
- overwriteCallback = overwriteImplementor;
-}
-/**
- * Creates a new operation that imports specific file system objects.
- * In this usage context, the specified source file system object is used by the
- * operation solely to determine the destination container structure of the file system
- * objects being imported.
- * <p>
- * The <code>source</code> parameter represents the root file system object to
- * import. Valid types for this parameter are determined by the supplied
- * <code>IImportStructureProvider</code>. The contents of the source which
- * are to be imported are specified in the <code>filesToImport</code>
- * parameter.
- * </p>
- * <p>
- * The <code>provider</code> parameter allows this operation to deal with the
- * source object in an abstract way. This operation calls methods on the provider
- * and the provider in turn calls specific methods on the source object.
- * </p>
- * <p>
- * The <code>filesToImport</code> parameter specifies what contents of the root
- * file system object are to be imported.
- * </p>
- * <p>
- * The default import behavior is to recreate the complete container structure
- * for the file system objects in their destination. If <code>setCreateContainerStructure</code>
- * is set to <code>false</code>, then the container structure created for each of
- * the file system objects is relative to the supplied root file system object.
- * </p>
- *
- * @param containerPath the full path of the destination container within the
- * workspace
- * @param source the root file system object to import from
- * @param provider the file system structure provider to use
- * @param overwriteImplementor the overwrite strategy to use
- * @param filesToImport the list of file system objects to be imported
- * (element type: <code>Object</code>)
- */
-public ImportOperation(IPath containerPath, Object source, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor, List filesToImport) {
- this(containerPath, source, provider, overwriteImplementor);
- setFilesToImport(filesToImport);
-}
-/**
- * Creates a new operation that imports specific file system objects.
- * <p>
- * The <code>provider</code> parameter allows this operation to deal with the
- * source object in an abstract way. This operation calls methods on the provider
- * and the provider in turn calls specific methods on the source object.
- * </p>
- * <p>
- * The <code>filesToImport</code> parameter specifies what file system objects
- * are to be imported.
- * </p>
- * <p>
- * The default import behavior is to recreate the complete container structure
- * for the file system objects in their destination. If <code>setCreateContainerStructure</code>
- * is set to <code>false</code>, then no container structure is created for each of
- * the file system objects.
- * </p>
- *
- * @param containerPath the full path of the destination container within the
- * workspace
- * @param provider the file system structure provider to use
- * @param overwriteImplementor the overwrite strategy to use
- * @param filesToImport the list of file system objects to be imported
- * (element type: <code>Object</code>)
- */
-public ImportOperation(IPath containerPath, IImportStructureProvider provider, IOverwriteQuery overwriteImplementor, List filesToImport) {
- this(containerPath, null, provider, overwriteImplementor);
- setFilesToImport(filesToImport);
-}
-/**
- * Creates the folders that appear in the specified resource path.
- * These folders are created relative to the destination container.
- *
- * @param path the relative path of the resource
- * @return the container resource coresponding to the given path
- * @exception CoreException if this method failed
- */
-IContainer createContainersFor(IPath path) throws CoreException {
-
- IContainer currentFolder = (IContainer) destinationContainer;
-
- int segmentCount = path.segmentCount();
-
- //No containers to create
- if(segmentCount == 0)
- return currentFolder;
-
- //Needs to be handles differently at the root
- if(currentFolder.getType() == IResource.ROOT)
- return createFromRoot(path);
-
-
- for (int i = 0; i < segmentCount; i++) {
- currentFolder = currentFolder.getFolder(new Path(path.segment(i)));
- if (!currentFolder.exists())
- ((IFolder) currentFolder).create(false,true,null);
- }
-
- return currentFolder;
-}
-
-/**
- * Creates the folders that appear in the specified resource path
- * assuming that the destinationContainer begins at the root. Do not create projects.
- *
- * @param path the relative path of the resource
- * @return the container resource coresponding to the given path
- * @exception CoreException if this method failed
- */
-private IContainer createFromRoot(IPath path) throws CoreException {
-
- int segmentCount = path.segmentCount();
-
- //Assume the project exists
- IContainer currentFolder =
- ((IWorkspaceRoot) destinationContainer).getProject(path.segment(0));
-
- for (int i = 1; i < segmentCount; i++) {
- currentFolder = currentFolder.getFolder(new Path(path.segment(i)));
- if (!currentFolder.exists())
- ((IFolder) currentFolder).create(false,true,null);
- }
-
- return currentFolder;
-}
-
-
-/**
- * Deletes the given resource. If the resource fails to be deleted, adds a
- * status object to the list to be returned by <code>getResult</code>.
- *
- * @param resource the resource
- */
-void deleteResource(IResource resource) {
- try {
- resource.delete(IResource.KEEP_HISTORY, null);
- } catch (CoreException e) {
- errorTable.add(e.getStatus());
- }
-}
-/**
- * Attempts to ensure that the given resource does not already exist in the
- * workspace. The resource will be deleted if required, perhaps after asking
- * the user's permission.
- *
- * @param targetResource the resource that should not exist
- * @param policy determines how the resource is imported
- * @return <code>true</code> if the resource does not exist, and
- * <code>false</code> if it does exist
- */
-boolean ensureTargetDoesNotExist(IResource targetResource, int policy) {
- if (targetResource.exists()) {
-
- //If force overwrite is on don't bother
- if (policy != POLICY_FORCE_OVERWRITE){
- if(this.overwriteState == OVERWRITE_NOT_SET &&
- !queryOverwrite(targetResource.getFullPath()))
- return false;
- if(this.overwriteState == OVERWRITE_NONE)
- return false;
- }
- deleteResource(targetResource);
- }
-
- return true;
-}
-/* (non-Javadoc)
- * Method declared on WorkbenchModifyOperation.
- * Imports the specified file system objects from the file system.
- */
-protected void execute(IProgressMonitor progressMonitor) {
-
- monitor = progressMonitor;
-
- try {
- if (selectedFiles == null) {
- //Set the amount to 1000 as we have no idea of how long this will take
- monitor.beginTask(DataTransferMessages.getString("DataTransfer.importTask"),1000); //$NON-NLS-1$
- ContainerGenerator generator = new ContainerGenerator(destinationPath);
- monitor.worked(50);
- destinationContainer = generator.generateContainer(new SubProgressMonitor(monitor, 50));
- importRecursivelyFrom(source, POLICY_DEFAULT);
- //Be sure it finishes
- monitor.worked(90);
- } else {
- // Choose twice the selected files size to take folders into account
- int creationCount = selectedFiles.size();
- monitor.beginTask(DataTransferMessages.getString("DataTransfer.importTask"),creationCount + 100); //$NON-NLS-1$
- ContainerGenerator generator = new ContainerGenerator(destinationPath);
- monitor.worked(50);
- destinationContainer = generator.generateContainer(new SubProgressMonitor(monitor, 50));
- importFileSystemObjects(selectedFiles);
- monitor.done();
- }
- }
- catch (CoreException e) {
- errorTable.add(e.getStatus());
- }
- finally {
- monitor.done();
- }
-}
-/**
- * Returns the container resource that the passed file system object should be
- * imported into.
- *
- * @param fileSystemObject the file system object being imported
- * @return the container resource that the passed file system object should be
- * imported into
- * @exception CoreException if this method failed
- */
-IContainer getDestinationContainerFor(Object fileSystemObject) throws CoreException {
- IPath pathname = new Path(provider.getFullPath(fileSystemObject));
-
- if (createContainerStructure)
- return createContainersFor(pathname.removeLastSegments(1));
- else {
- if (source == fileSystemObject)
- return null;
- IPath sourcePath = new Path(provider.getFullPath(source));
- IPath destContainerPath = pathname.removeLastSegments(1);
- IPath relativePath = destContainerPath.removeFirstSegments(sourcePath.segmentCount()).setDevice(null);
- return createContainersFor(relativePath);
- }
-}
-/**
- * Returns the status of the import operation.
- * If there were any errors, the result is a status object containing
- * individual status objects for each error.
- * If there were no errors, the result is a status object with error code <code>OK</code>.
- *
- * @return the status
- */
-public IStatus getStatus() {
- IStatus[] errors = new IStatus[errorTable.size()];
- errorTable.toArray(errors);
- return new MultiStatus(
- PlatformUI.PLUGIN_ID,
- IStatus.OK,
- errors,
- DataTransferMessages.getString("ImportOperation.importProblems"), //$NON-NLS-1$
- null);
-}
-/**
- * Imports the specified file system object into the workspace.
- * If the import fails, adds a status object to the list to be returned by
- * <code>getResult</code>.
- *
- * @param fileObject the file system object to be imported
- * @param policy determines how the file object is imported
- */
-void importFile(Object fileObject, int policy) {
- IContainer containerResource;
- try {
- containerResource = getDestinationContainerFor(fileObject);
- } catch (CoreException e) {
- IStatus coreStatus = e.getStatus();
- String newMessage = DataTransferMessages.format("ImportOperation.coreImportError", new Object [] {fileObject, coreStatus.getMessage()}); //$NON-NLS-1$
- IStatus status = new Status(coreStatus.getSeverity(), coreStatus.getPlugin(), coreStatus.getCode(), newMessage, null);
- errorTable.add(status);
- return;
- }
-
- String fileObjectPath = provider.getFullPath(fileObject);
- monitor.subTask(fileObjectPath);
- IFile targetResource = containerResource.getFile(new Path(provider.getLabel(fileObject)));
- monitor.worked(1);
-
- // ensure that the source and target are not the same
- IPath targetPath = targetResource.getLocation();
- // Use Files for comparison to avoid platform specific case issues
- if (targetPath != null &&
- (targetPath.toFile().equals(new File(fileObjectPath)))) {
- errorTable.add(
- new Status(
- IStatus.ERROR,
- PlatformUI.PLUGIN_ID,
- 0,
- DataTransferMessages.format(
- "ImportOperation.targetSameAsSourceError", //$NON-NLS-1$
- new Object [] {fileObjectPath}),
- null));
- return;
- }
-
- if (!ensureTargetDoesNotExist(targetResource, policy)) {
- // Do not add an error status because the user
- // has explicitely said no overwrite. Do not
- // update the monitor as it was done in queryOverwrite.
- return;
- }
-
- InputStream contentStream = provider.getContents(fileObject);
- if (contentStream == null) {
- errorTable.add(
- new Status(
- IStatus.ERROR,
- PlatformUI.PLUGIN_ID,
- 0,
- DataTransferMessages.format("ImportOperation.openStreamError", new Object [] {fileObjectPath}), //$NON-NLS-1$
- null));
- return;
- }
-
- try {
- targetResource.create(
- contentStream,
- false,
- null);
- } catch (CoreException e) {
- errorTable.add(e.getStatus());
- } finally {
- try {
- contentStream.close();
- } catch (IOException e) {
- errorTable.add(
- new Status(
- IStatus.ERROR,
- PlatformUI.PLUGIN_ID,
- 0,
- DataTransferMessages.format("ImportOperation.closeStreamError", new Object [] {fileObjectPath}), //$NON-NLS-1$
- e));
- }
- }
-}
-/**
- * Imports the specified file system objects into the workspace.
- * If the import fails, adds a status object to the list to be returned by
- * <code>getStatus</code>.
- *
- * @param filesToImport the list of file system objects to import
- * (element type: <code>Object</code>)
- * @exception OperationCanceledException if canceled
- */
-void importFileSystemObjects(List filesToImport) {
- Iterator filesEnum = filesToImport.iterator();
- while (filesEnum.hasNext()) {
- Object fileSystemObject = filesEnum.next();
- if (source == null) {
- // We just import what we are given into the destination
- IPath sourcePath = new Path(provider.getFullPath(fileSystemObject)).removeLastSegments(1);
- if (provider.isFolder(fileSystemObject) && sourcePath.isEmpty()) {
- // If we don't have a parent then we have selected the
- // file systems root. Roots can't copied (at least not
- // under windows).
- errorTable.add(
- new Status(
- IStatus.INFO,
- PlatformUI.PLUGIN_ID,
- 0,
- DataTransferMessages.getString("ImportOperation.cannotCopy"), //$NON-NLS-1$
- null));
- continue;
- }
- source = sourcePath.toFile();
- }
- importRecursivelyFrom(fileSystemObject, POLICY_DEFAULT);
- }
-}
-/**
- * Imports the specified file system container object into the workspace.
- * If the import fails, adds a status object to the list to be returned by
- * <code>getResult</code>.
- *
- * @param fileObject the file system container object to be imported
- * @param policy determines how the folder object and children are imported
- * @return the policy to use to import the folder's children
- */
-int importFolder(Object folderObject, int policy) {
- IContainer containerResource;
- try {
- containerResource = getDestinationContainerFor(folderObject);
- } catch (CoreException e) {
- errorTable.add(e.getStatus());
- return policy;
- }
-
- if (containerResource == null)
- return policy;
-
- monitor.subTask(provider.getFullPath(folderObject));
- IWorkspace workspace = destinationContainer.getWorkspace();
- IPath containerPath = containerResource.getFullPath();
- IPath resourcePath = containerPath.append(provider.getLabel(folderObject));
-
- // Do not attempt the import if the resource path is unchanged. This may happen
- // when importing from a zip file.
- if (resourcePath.equals(containerPath))
- return policy;
-
- if (workspace.getRoot().exists(resourcePath)) {
- if (policy != POLICY_FORCE_OVERWRITE){
- if(this.overwriteState == OVERWRITE_NONE || !queryOverwrite(resourcePath))
- // Do not add an error status because the user
- // has explicitely said no overwrite. Do not
- // update the monitor as it was done in queryOverwrite.
- return POLICY_SKIP_CHILDREN;
- }
- return POLICY_FORCE_OVERWRITE;
- }
-
- try {
- workspace.getRoot().getFolder(resourcePath).create(
- false,
- true,
- null);
- } catch (CoreException e) {
- errorTable.add(e.getStatus());
- }
-
- return policy;
-}
-/**
- * Imports the specified file system object recursively into the workspace.
- * If the import fails, adds a status object to the list to be returned by
- * <code>getStatus</code>.
- *
- * @param fileSystemObject the file system object to be imported
- * @param policy determines how the file system object and children are imported
- * @exception OperationCanceledException if canceled
- */
-void importRecursivelyFrom(Object fileSystemObject, int policy) {
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- if (!provider.isFolder(fileSystemObject)) {
- importFile(fileSystemObject, policy);
- return;
- }
-
- int childPolicy = importFolder(fileSystemObject, policy);
- if (childPolicy != POLICY_SKIP_CHILDREN) {
- Iterator children = provider.getChildren(fileSystemObject).iterator();
- while (children.hasNext())
- importRecursivelyFrom(children.next(), childPolicy);
- }
-}
-/**
- * Queries the user whether the resource with the specified path should be
- * overwritten by a file system object that is being imported.
- *
- * @param path the workspace path of the resource that needs to be overwritten
- * @return <code>true</code> to overwrite, <code>false</code> to not overwrite
- * @exception OperationCanceledException if canceled
- */
-boolean queryOverwrite(IPath resourcePath) throws OperationCanceledException {
- String overwriteAnswer = overwriteCallback.queryOverwrite(resourcePath.makeRelative().toString());
-
- if (overwriteAnswer.equals(IOverwriteQuery.CANCEL))
- throw new OperationCanceledException(DataTransferMessages.getString("DataTransfer.emptyString")); //$NON-NLS-1$
-
- if (overwriteAnswer.equals(IOverwriteQuery.NO)) {
- return false;
- }
-
- if (overwriteAnswer.equals(IOverwriteQuery.NO_ALL)){
- this.overwriteState = OVERWRITE_NONE;
- return false;
- }
-
- if (overwriteAnswer.equals(IOverwriteQuery.ALL))
- this.overwriteState = OVERWRITE_ALL;
-
- return true;
-}
-/**
- * Sets whether the containment structures that are implied from the full paths
- * of file system objects being imported should be duplicated in the workbench.
- *
- * @param value <code>true</code> if containers should be created, and
- * <code>false</code> otherwise
- */
-public void setCreateContainerStructure(boolean value) {
- createContainerStructure = value;
-}
-/**
- * Sets the file system objects to import.
- *
- * @param filesToImport the list of file system objects to be imported
- * (element type: <code>Object</code>)
- */
-public void setFilesToImport(List filesToImport) {
- this.selectedFiles = filesToImport;
-}
-/**
- * Sets whether imported file system objects should automatically overwrite
- * existing workbench resources when a conflict occurs.
- *
- * @param value <code>true</code> to automatically overwrite, and
- * <code>false</code> otherwise
- */
-public void setOverwriteResources(boolean value) {
- if(value)
- this.overwriteState = OVERWRITE_ALL;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/MinimizedFileSystemElement.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/MinimizedFileSystemElement.java
deleted file mode 100644
index 3b174f4..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/MinimizedFileSystemElement.java
+++ /dev/null
@@ -1,91 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.ui.dialogs.FileSystemElement;
-
-/**
- * The <code>MinimizedFileSystemElement</code> is a <code>FileSystemElement</code> that knows
- * if it has been populated or not.
- */
-class MinimizedFileSystemElement extends FileSystemElement {
- private boolean populated = false;
-/**
- * Create a <code>MinimizedFileSystemElement</code> with the supplied name and parent.
- * @param name the name of the file element this represents
- * @param parent the containing parent
- * @param isDirectory indicated if this could have children or not
- */
-MinimizedFileSystemElement(String name, org.eclipse.ui.dialogs.FileSystemElement parent, boolean isDirectory) {
- super(name, parent, isDirectory);
-}
-/**
- * Returns a list of the files that are immediate children. Use the supplied provider
- * if it needs to be populated.
- * of this folder.
- */
-public AdaptableList getFiles(IImportStructureProvider provider) {
- if(!populated)
- populate(provider);
-
- return super.getFiles();
-
-}
-/**
- * Returns a list of the folders that are immediate children. Use the supplied provider
- * if it needs to be populated.
- * of this folder.
- */
-public AdaptableList getFolders(IImportStructureProvider provider) {
- if(!populated)
- populate(provider);
-
- return super.getFolders();
-
-}
-/**
- * Return whether or not population has happened for the receiver.
- */
-boolean isPopulated() {
- return this.populated;
-}
-/**
- * Return whether or not population has not happened for the receiver.
- */
-boolean notPopulated() {
- return !this.populated;
-}
-/**
- * Populate the files and folders of the receiver using the suppliec structure provider.
- * @param provider org.eclipse.ui.wizards.datatransfer.IImportStructureProvider
- */
-private void populate(IImportStructureProvider provider) {
-
- Object fileSystemObject = getFileSystemObject();
-
- List children = provider.getChildren(fileSystemObject);
- if (children == null)
- children = new ArrayList(1);
- Iterator childrenEnum = children.iterator();
- while (childrenEnum.hasNext()) {
- Object child = childrenEnum.next();
-
- String elementLabel = provider.getLabel(child);
- //Create one level below
- MinimizedFileSystemElement result =
- new MinimizedFileSystemElement(elementLabel, this, provider.isFolder(child));
- result.setFileSystemObject(child);
- }
- setPopulated();
-}
-/**
- * Set whether or not population has happened for the receiver to true.
- */
-void setPopulated() {
- this.populated = true;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/PopulateElementOperation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/PopulateElementOperation.java
deleted file mode 100644
index a6b5ac8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/PopulateElementOperation.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.*;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.operation.ModalContext;
-import org.eclipse.ui.dialogs.FileSystemElement;
-
-/**
- * The PopulateElementOperation has a MinimizedFileSystemElement as an object as this is
- * just filled in.
- */
-class PopulateElementOperation extends PopulateRootOperation {
-/**
- * Create a new <code>PopulateElementsOperation</code>.
- * @param rootObject the object to be populated
- * @param structureProvider the object that defines how we are to populate it.
- */
-public PopulateElementOperation(
- MinimizedFileSystemElement rootObject,
- IImportStructureProvider structureProvider) {
- super(rootObject, structureProvider);
-}
-/**
- * Populates the children of element down to level depth
- */
-private void populateElement(
- MinimizedFileSystemElement element,
- IProgressMonitor monitor)
- throws InterruptedException {
-
- Object fileSystemObject = element.getFileSystemObject();
- ModalContext.checkCanceled(monitor);
-
-
- List children = provider.getChildren(fileSystemObject);
- if (children == null)
- children = new ArrayList(1);
- Iterator childrenEnum = children.iterator();
- while (childrenEnum.hasNext()) {
- //Create one level below
- createElement(element, childrenEnum.next(), 1);
- }
- element.setPopulated();
-}
-/**
- * Runs the operation. The result of this operation is always the elemen provided.
- */
-public void run(IProgressMonitor monitor) throws InterruptedException {
- try {
- this.monitor = monitor;
- monitor.beginTask(DataTransferMessages.getString("DataTransfer.scanningChildren"),IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- MinimizedFileSystemElement element = (MinimizedFileSystemElement) root;
- populateElement(element,monitor);
-
- } finally {
- monitor.done();
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/PopulateRootOperation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/PopulateRootOperation.java
deleted file mode 100644
index 803125b..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/PopulateRootOperation.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.dialogs.FileSystemElement;
-import org.eclipse.jface.operation.*;
-import java.io.*;
-import java.util.*;
-
-/**
- * The PopulateFilesOperation is an operation used to populate a FileSystemElement one
- * level deep rather than the whole way.
- */
-public class PopulateRootOperation extends SelectFilesOperation {
-/**
- * Create a new <code>PopulateFilesOperation</code>.
- * @param rootObject the object to be populated
- * @param structureProvider the object that defines how we are to populate it.
- */
-public PopulateRootOperation(Object rootObject, IImportStructureProvider structureProvider) {
- super(rootObject, structureProvider);
-}
-/**
- * Creates and returns a <code>FileSystemElement</code> if the specified
- * file system object merits one. The criteria for this are:
- * - if the file system object is a container then it must have either a
- * child container or an associated file
- * - if the file system object is a file then it must have an extension
- * suitable for selection
- */
-protected FileSystemElement createElement(
- FileSystemElement parent,
- Object fileSystemObject)
- throws InterruptedException {
-
- //Iterate on level deep
- return createElement(parent, fileSystemObject, 2);
-
-}
-/**
- * Creates and returns a <code>FileSystemElement</code> if the specified
- * file system object merits one. The criteria for this are:
- * - if the file system object is a container then it must have either a
- * child container or an associated file
- * - if the file system object is a file then it must have an extension
- * suitable for selection
- * recurse down for depth to populate children
- */
-protected FileSystemElement createElement(
- FileSystemElement parent,
- Object fileSystemObject,
- int depth)
- throws InterruptedException {
- ModalContext.checkCanceled(monitor);
- boolean isContainer = provider.isFolder(fileSystemObject);
- String elementLabel =
- parent == null
- ? provider.getFullPath(fileSystemObject)
- : provider.getLabel(fileSystemObject);
-
- MinimizedFileSystemElement result =
- new MinimizedFileSystemElement(elementLabel, parent, isContainer);
- result.setFileSystemObject(fileSystemObject);
-
- if (isContainer) {
- if (depth > 0) {
- List children = provider.getChildren(fileSystemObject);
- if (children == null)
- children = new ArrayList(1);
- Iterator childrenEnum = children.iterator();
- while (childrenEnum.hasNext()) {
- createElement(result, childrenEnum.next(), depth - 1);
- }
- result.setPopulated();
- }
-
- }
-
- return result;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/SelectFilesOperation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/SelectFilesOperation.java
deleted file mode 100644
index 74f95a8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/SelectFilesOperation.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.dialogs.FileSystemElement;
-import org.eclipse.jface.operation.*;
-import java.io.*;
-import java.util.*;
-
-/**
- * Operation responsible for traversing a specified file system position
- * recursively and building
- * - a tree that represents the container structure
- * - a collection containing all files meeting a specified extension criteria
- *
- * This is implemented as an Operation in order to provide an escape to the user
- * (the Cancel button) if the operation drags on for too long
- */
-public class SelectFilesOperation implements IRunnableWithProgress {
- IProgressMonitor monitor;
- Object root;
- IImportStructureProvider provider;
- String desiredExtensions[];
- FileSystemElement result;
-/**
- * Creates a new <code>SelectFilesOperation</code>.
- */
-public SelectFilesOperation(Object rootObject,IImportStructureProvider structureProvider) {
- super();
- root = rootObject;
- provider = structureProvider;
-}
-/**
- * Creates and returns a <code>FileSystemElement</code> if the specified
- * file system object merits one. The criteria for this are:
- * - if the file system object is a container then it must have either a
- * child container or an associated file
- * - if the file system object is a file then it must have an extension
- * suitable for selection
- */
-protected FileSystemElement createElement(FileSystemElement parent,Object fileSystemObject) throws InterruptedException {
- ModalContext.checkCanceled(monitor);
- boolean isContainer = provider.isFolder(fileSystemObject);
- String elementLabel = parent == null ? provider.getFullPath(fileSystemObject) : provider.getLabel(fileSystemObject);
-
- if (!isContainer && !hasDesiredExtension(elementLabel))
- return null;
-
- FileSystemElement result =
- new FileSystemElement(elementLabel,parent,isContainer);
- result.setFileSystemObject(fileSystemObject);
-
- if (isContainer) {
- boolean haveChildOrFile = false;
- List children = provider.getChildren(fileSystemObject);
- if (children == null)
- children = new ArrayList(1);
- Iterator childrenEnum = children.iterator();
- while (childrenEnum.hasNext()) {
- if (createElement(result,childrenEnum.next()) != null)
- haveChildOrFile = true;
- }
-
- if (!haveChildOrFile && parent != null) {
- parent.removeFolder(result);
- result = null;
- }
- }
-
- return result;
-}
-/**
- * Returns the extension portion of the passed filename string.
- */
-protected String getExtensionFor(String filename) {
- int nIndex = filename.lastIndexOf('.');
-
- if (nIndex >= 0)
- return filename.substring(nIndex + 1);
-
- return "";//$NON-NLS-1$
-
-}
-/**
- * Returns the resulting root file system element.
- */
-public FileSystemElement getResult() {
- return result;
-}
-/**
- * Returns a boolean indicating whether the extension of the passed filename
- * is one of the extensions specified as desired by the filter.
- */
-protected boolean hasDesiredExtension(String filename) {
- if (desiredExtensions == null) // ie.- all extensions are fine
- return true;
-
- int extensionsSize = desiredExtensions.length;
- for (int i = 0; i < extensionsSize; i++) {
- if (getExtensionFor(filename).equalsIgnoreCase(desiredExtensions[i]))
- return true;
- }
-
- return false;
-}
-/**
- * Runs the operation.
- */
-public void run(IProgressMonitor monitor) throws InterruptedException {
- try {
- this.monitor = monitor;
- monitor.beginTask(DataTransferMessages.getString("DataTransfer.scanningMatching"),IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- result = createElement(null,root);
- if (result == null) {
- result = new FileSystemElement(provider.getLabel(root),null,provider.isFolder(root));
- result.setFileSystemObject(root);
- }
- } finally {
- monitor.done();
- }
-}
-/**
- * Sets the file extensions which are desired. A value of <code>null</code>
- * indicates that all files should be kept regardless of extension.
- */
-public void setDesiredExtensions(String[] extensions) {
- desiredExtensions = extensions;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardExternalProjectImportPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardExternalProjectImportPage.java
deleted file mode 100644
index 623d611..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardExternalProjectImportPage.java
+++ /dev/null
@@ -1,502 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2002.
- * All Rights Reserved.
- */
-import java.io.*;
-import java.io.File;
-import java.io.FileFilter;
-import java.lang.reflect.InvocationTargetException;
-
-import org.apache.xerces.parsers.SAXParser;
-import org.eclipse.core.internal.resources.Workspace;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.xml.sax.InputSource;
-import org.xml.sax.XMLReader;
-
-/**
- * Standard main page for a wizard that creates a project resource from
- * whose location already contains a project.
- * <p>
- * This page may be used by clients as-is; it may be also be subclassed to suit.
- * </p>
- * <p>
- * Example useage:
- * <pre>
- * mainPage = new WizardExternalProjectImportPage("basicNewProjectPage");
- * mainPage.setTitle("Project");
- * mainPage.setDescription("Create a new project resource.");
- * </pre>
- * </p>
- */
-public class WizardExternalProjectImportPage extends WizardPage {
-
- private FileFilter projectFilter = new FileFilter() {
- //Only accept those files that are .project
- public boolean accept(File pathName) {
- return pathName.getName().equals(IProjectDescription.DESCRIPTION_FILE_NAME);
- }
- };
-
- //Keep track of the directory that we browsed to last time
- //the wizard was invoked.
- private static String previouslyBrowsedDirectory = "";
-
- // widgets
- private Text projectNameField;
- private Text locationPathField;
- private Label locationLabel;
- private Button browseButton;
- private IProjectDescription description;
-
- private Listener locationModifyListener = new Listener() {
- public void handleEvent(Event e) {
- setPageComplete(validatePage());
- }
- };
-
- // constants
- private static final int SIZING_TEXT_FIELD_WIDTH = 250;
- private static final int SIZING_INDENTATION_WIDTH = 10;
- /**
- * Creates a new project creation wizard page.
- *
- * @param pageName the name of this page
- */
- public WizardExternalProjectImportPage() {
- super("wizardExternalProjectPage"); //$NON-NLS-1$
- setPageComplete(false);
- setTitle(
- DataTransferMessages.getString("WizardExternalProjectImportPage.title")); //$NON-NLS-1$
- setDescription(
- DataTransferMessages.getString("WizardExternalProjectImportPage.description")); //$NON-NLS-1$
-
- }
- /** (non-Javadoc)
- * Method declared on IDialogPage.
- */
- public void createControl(Composite parent) {
- Composite composite = new Composite(parent, SWT.NULL);
-
- WorkbenchHelp.setHelp(composite, IHelpContextIds.NEW_PROJECT_WIZARD_PAGE);
-
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createProjectNameGroup(composite);
- createProjectLocationGroup(composite);
- validatePage();
- // Show description on opening
- setErrorMessage(null);
- setMessage(null);
- setControl(composite);
- }
-
- private Listener nameModifyListener = new Listener() {
- public void handleEvent(Event e) {
- setPageComplete(validatePage());
- }
- };
-
- /**
- * Creates the project location specification controls.
- *
- * @param parent the parent composite
- */
- private final void createProjectLocationGroup(Composite parent) {
-
- // project specification group
- Composite projectGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // new project label
- Label projectContentsLabel = new Label(projectGroup, SWT.NONE);
- projectContentsLabel.setText(
- DataTransferMessages.getString(
- "WizardExternalProjectImportPage.projectContentsLabel")); //$NON-NLS-1$
-
- createUserSpecifiedProjectLocationGroup(projectGroup);
- }
- /**
- * Creates the project name specification controls.
- *
- * @param parent the parent composite
- */
- private final void createProjectNameGroup(Composite parent) {
- // project specification group
- Composite projectGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- projectGroup.setLayout(layout);
- projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // new project label
- Label projectLabel = new Label(projectGroup, SWT.NONE);
- projectLabel.setText(DataTransferMessages.getString("WizardExternalProjectImportPage.nameLabel")); //$NON-NLS-1$
-
- // new project name entry field
- projectNameField = new Text(projectGroup, SWT.BORDER | SWT.READ_ONLY);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- projectNameField.setLayoutData(data);
-
- projectNameField.addListener(SWT.Modify, nameModifyListener);
- }
- /**
- * Creates the project location specification controls.
- *
- * @param projectGroup the parent composite
- * @param boolean - the initial enabled state of the widgets created
- */
- private void createUserSpecifiedProjectLocationGroup(Composite projectGroup) {
-
- // project location entry field
- this.locationPathField = new Text(projectGroup, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- this.locationPathField.setLayoutData(data);
-
- // browse button
- this.browseButton = new Button(projectGroup, SWT.PUSH);
- this.browseButton.setText(
- DataTransferMessages.getString("WizardExternalProjectImportPage.browseLabel")); //$NON-NLS-1$
- this.browseButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- handleLocationBrowseButtonPressed();
- }
- });
-
- locationPathField.addListener(SWT.Modify, locationModifyListener);
- }
- /**
- * Returns the current project location path as entered by
- * the user, or its anticipated initial value.
- *
- * @return the project location path, its anticipated initial value, or <code>null</code>
- * if no project location path is known
- */
- public IPath getLocationPath() {
-
- return new Path(getProjectLocationFieldValue());
- }
- /**
- * Creates a project resource handle for the current project name field value.
- * <p>
- * This method does not create the project resource; this is the responsibility
- * of <code>IProject::create</code> invoked by the new project resource wizard.
- * </p>
- *
- * @return the new project resource handle
- */
- public IProject getProjectHandle() {
- return ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName());
- }
- /**
- * Returns the current project name as entered by the user, or its anticipated
- * initial value.
- *
- * @return the project name, its anticipated initial value, or <code>null</code>
- * if no project name is known
- */
- public String getProjectName() {
- return getProjectNameFieldValue();
- }
- /**
- * Returns the value of the project name field
- * with leading and trailing spaces removed.
- *
- * @return the project name in the field
- */
- private String getProjectNameFieldValue() {
- if (projectNameField == null)
- return ""; //$NON-NLS-1$
- else
- return projectNameField.getText().trim();
- }
- /**
- * Returns the value of the project location field
- * with leading and trailing spaces removed.
- *
- * @return the project location directory in the field
- */
- private String getProjectLocationFieldValue() {
- return locationPathField.getText().trim();
- }
- /**
- * Open an appropriate directory browser
- */
- private void handleLocationBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(locationPathField.getShell());
- dialog.setMessage(
- DataTransferMessages.getString(
- "WizardExternalProjectImportPage.directoryLabel")); //$NON-NLS-1$
-
- String dirName = getProjectLocationFieldValue();
- if (dirName.equals(""))
- dirName = previouslyBrowsedDirectory;
-
- if (!dirName.equals("")) { //$NON-NLS-1$
- File path = new File(dirName);
- if (path.exists())
- dialog.setFilterPath(new Path(dirName).toOSString());
- }
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null) {
- previouslyBrowsedDirectory = selectedDirectory;
- locationPathField.setText(previouslyBrowsedDirectory);
- setProjectName(projectFile(previouslyBrowsedDirectory));
- }
- }
-
- /**
- * Returns whether this page's controls currently all contain valid
- * values.
- *
- * @return <code>true</code> if all controls are valid, and
- * <code>false</code> if at least one is invalid
- */
- private boolean validatePage() {
- IWorkspace workspace = getWorkspace();
-
- //If it is empty try to give something meaningful
- if (getProjectNameFieldValue().equals("")) //$NON-NLS-1$
- setProjectName(projectFile(locationPathField.getText()));
-
- String projectFieldContents = getProjectNameFieldValue();
-
- //If it is still empty show the error
- if (projectFieldContents.equals("")) { //$NON-NLS-1$
- setErrorMessage(null);
- setMessage(
- DataTransferMessages.getString(
- "WizardExternalProjectImportPage.projectNameEmpty")); //$NON-NLS-1$
- return false;
- }
-
- IStatus nameStatus =
- workspace.validateName(projectFieldContents, IResource.PROJECT);
- if (!nameStatus.isOK()) {
- setErrorMessage(nameStatus.getMessage());
- return false;
- }
-
- String locationFieldContents = getProjectLocationFieldValue();
-
- if (locationFieldContents.equals("")) { //$NON-NLS-1$
- setErrorMessage(null);
- setMessage(
- DataTransferMessages.getString(
- "WizardExternalProjectImportPage.projectLocationEmpty")); //$NON-NLS-1$
- return false;
- }
-
- IPath path = new Path(""); //$NON-NLS-1$
- if (!path.isValidPath(locationFieldContents)) {
- setErrorMessage(
- DataTransferMessages.getString(
- "WizardExternalProjectImportPage.locationError")); //$NON-NLS-1$
- return false;
- }
- if (isPrefixOfRoot(getLocationPath())) {
-
- //If the name does not match the last segment stop it
- if(!checkDefaultProjectValue(locationFieldContents)){
- setErrorMessage(
- DataTransferMessages.getString(
- "WizardExternalProjectImportPage.defaultLocationError")); //$NON-NLS-1$
- return false;
- }
- }
- else // Outside of the prefix so this is enabled
- locationPathField.setEditable(true);
-
- if (getProjectHandle().exists()) {
- setErrorMessage(
- DataTransferMessages.getString(
- "WizardExternalProjectImportPage.projectExistsMessage")); //$NON-NLS-1$
- return false;
- }
-
- if (projectFile(locationFieldContents) == null) {
- setErrorMessage(
- DataTransferMessages.format(
- "WizardExternalProjectImportPage.notAProject", //$NON-NLS-1$
- new String[] { locationFieldContents }));
- return false;
- }
-
- setErrorMessage(null);
- setMessage(null);
- return true;
- }
- private IWorkspace getWorkspace() {
- IWorkspace workspace = WorkbenchPlugin.getPluginWorkspace();
- return workspace;
- }
-
- /**
- * Check that the name of the project equals the last segment
- * of the location path - i.e. it is the default value.
- * If it is disable the name field and return true.
- * If not return false
- */
- private boolean checkDefaultProjectValue(String locationFieldContents){
- IPath locationPath = new Path(locationFieldContents);
- if(locationPath.lastSegment().equals(getProjectNameFieldValue())){
- projectNameField.setEditable(false);
- return true;
- }
- projectNameField.setEditable(true);
- return false;
- }
-
- /**
- * Return whether or not the specifed location is a prefix
- * of the root.
- */
- private boolean isPrefixOfRoot(IPath locationPath) {
- return Platform.getLocation().isPrefixOf(locationPath);
- }
-
- /**
- * Set the project name using either the name of the
- * parent of the file or the name entry in the xml for
- * the file
- */
- private void setProjectName(File projectFile) {
-
- //If there is no file or the user has already specified forget it
- if (projectFile == null || projectNameField.getText().length() > 0)
- return;
-
- IPath path = new Path(projectFile.getPath());
-
- IProjectDescription newDescription = null;
-
- try {
- newDescription = getWorkspace().loadProjectDescription(path);
- } catch (CoreException exception) {
- //no good couldn't get the name
- }
-
- if (newDescription == null) {
- this.description = null;
- this.projectNameField.setText("");
- }
- else{
- this.description = newDescription;
- this.projectNameField.setText(this.description.getName());
- }
- }
-
- /**
- * Return a.project file from the specified location.
- * If there isn't one return null.
- */
- private File projectFile(String locationFieldContents) {
- File directory = new File(locationFieldContents);
- if (directory.isFile())
- return null;
-
- File[] files = directory.listFiles(this.projectFilter);
- if (files != null && files.length == 1)
- return files[0];
- else
- return null;
- }
-
- /**
- * Creates a new project resource with the selected name.
- * <p>
- * In normal usage, this method is invoked after the user has pressed Finish on
- * the wizard; the enablement of the Finish button implies that all controls
- * on the pages currently contain valid values.
- * </p>
- *
- * @return the created project resource, or <code>null</code> if the project
- * was not created
- */
- IProject createExistingProject() {
-
- String projectName = projectNameField.getText();
- final IWorkspace workspace = ResourcesPlugin.getWorkspace();
- final IProject project = workspace.getRoot().getProject(projectName);
- if(this.description == null){
- this.description = workspace.newProjectDescription(projectName);
- IPath locationPath = getLocationPath();
- //If it is under the root use the default location
- if (isPrefixOfRoot(locationPath))
- this.description.setLocation(null);
- else
- this.description.setLocation(locationPath);
- }
- else
- this.description.setName(projectName);
-
- // create the new project operation
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- monitor.beginTask("", 2000); //$NON-NLS-1$
- project.create(description, new SubProgressMonitor(monitor, 1000));
- if (monitor.isCanceled())
- throw new OperationCanceledException();
- project.open(new SubProgressMonitor(monitor, 1000));
-
- }
- };
-
- // run the new project creation operation
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return null;
- } catch (InvocationTargetException e) {
- // ie.- one of the steps resulted in a core exception
- Throwable t = e.getTargetException();
- if (t instanceof CoreException) {
- if (((CoreException) t).getStatus().getCode()
- == IResourceStatus.CASE_VARIANT_EXISTS) {
- MessageDialog.openError(getShell(), DataTransferMessages.getString("WizardExternalProjectImportPage.errorMessage"), //$NON-NLS-1$
- DataTransferMessages.getString("WizardExternalProjectImportPage.caseVariantExistsError") //$NON-NLS-1$,
- );
- } else {
- ErrorDialog.openError(getShell(), DataTransferMessages.getString("WizardExternalProjectImportPage.errorMessage"), //$NON-NLS-1$
- null, ((CoreException) t).getStatus());
- }
- }
- return null;
- }
-
- return project;
- }
-
- /*
- * see @DialogPage.setVisible(boolean)
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if(visible)
- this.locationPathField.setFocus();
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemExportPage1.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemExportPage1.java
deleted file mode 100644
index c89815a..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemExportPage1.java
+++ /dev/null
@@ -1,356 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-import java.util.List;
-
-/**
- * Page 1 of the base resource export-to-file-system Wizard
- * @deprecated use WizardFileSystemResourceExportPage1
- */
-/*package*/ class WizardFileSystemExportPage1 extends WizardExportPage implements Listener {
-
- // widgets
- private Combo destinationNameField;
- private Button destinationBrowseButton;
- private Button overwriteExistingFilesCheckbox;
- private Button createDirectoryStructureCheckbox;
- private Button createDirectoriesForSelectedContainersCheckbox;
-
- // constants
- private static final int SIZING_TEXT_FIELD_WIDTH = 250;
- private static final int COMBO_HISTORY_LENGTH = 5;
-
- // dialog store id constants
- private static final String STORE_DESTINATION_NAMES_ID = "WizardFileSystemExportPage1.STORE_DESTINATION_NAMES_ID";//$NON-NLS-1$
- private static final String STORE_OVERWRITE_EXISTING_FILES_ID = "WizardFileSystemExportPage1.STORE_OVERWRITE_EXISTING_FILES_ID";//$NON-NLS-1$
- private static final String STORE_CREATE_STRUCTURE_ID = "WizardFileSystemExportPage1.STORE_CREATE_STRUCTURE_ID";//$NON-NLS-1$
- private static final String STORE_CREATE_DIRECTORIES_FOR_SPECIFIED_CONTAINER_ID = "WizardFileSystemExportPage1.STORE_CREATE_DIRECTORIES_FOR_SPECIFIED_CONTAINER_ID";//$NON-NLS-1$
-/**
- * Create an instance of this class
- */
-protected WizardFileSystemExportPage1(String name, IStructuredSelection selection) {
- super(name, selection);
-}
-/**
- * Create an instance of this class
- */
-public WizardFileSystemExportPage1(IStructuredSelection selection) {
- this("fileSystemExportPage1", selection);//$NON-NLS-1$
- setTitle(DataTransferMessages.getString("DataTransfer.fileSystemTitle")); //$NON-NLS-1$
- setDescription(DataTransferMessages.getString("FileExport.exportLocalFileSystem")); //$NON-NLS-1$
-}
-/**
- * Add the passed value to self's destination widget's history
- *
- * @param value java.lang.String
- */
-protected void addDestinationItem(String value) {
- destinationNameField.add(value);
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
- super.createControl(parent);
- giveFocusToDestination();
-}
-/**
- * Create the export destination specification widgets
- *
- * @param parent org.eclipse.swt.widgets.Composite
- */
-protected void createDestinationGroup(Composite parent) {
- // destination specification group
- Composite destinationSelectionGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- destinationSelectionGroup.setLayout(layout);
- destinationSelectionGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
-
- new Label(destinationSelectionGroup, SWT.NONE).setText(getDestinationLabel());
-
- // destination name entry field
- 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);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- destinationNameField.setLayoutData(data);
-
- // destination browse button
- destinationBrowseButton = new Button(destinationSelectionGroup, SWT.PUSH);
- destinationBrowseButton.setText(DataTransferMessages.getString("DataTransfer.browse")); //$NON-NLS-1$
- destinationBrowseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- destinationBrowseButton.addListener(SWT.Selection, this);
-
- new Label(parent, SWT.NONE); // vertical spacer
-}
-/**
- * Create the export options specification widgets.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- */
-protected void createOptionsGroup(Composite parent) {
- // options group
- Composite optionsGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- optionsGroup.setLayout(layout);
- optionsGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- // overwrite... checkbox
- overwriteExistingFilesCheckbox = new Button(optionsGroup,SWT.CHECK|SWT.LEFT);
- overwriteExistingFilesCheckbox.setText(DataTransferMessages.getString("ExportFile.overwriteExisting")); //$NON-NLS-1$
-
- // create directory structure checkbox
- createDirectoryStructureCheckbox = new Button(optionsGroup,SWT.CHECK|SWT.LEFT);
- createDirectoryStructureCheckbox.setText(DataTransferMessages.getString("ExportFile.createDirectoryStructure")); //$NON-NLS-1$
- createDirectoryStructureCheckbox.addListener(SWT.Selection,this);
-
- // create directory for container checkbox
- createDirectoriesForSelectedContainersCheckbox = new Button(optionsGroup,SWT.CHECK|SWT.LEFT);
- createDirectoriesForSelectedContainersCheckbox.setText(DataTransferMessages.getString("ExportFile.createDirectoriesForSelected")); //$NON-NLS-1$
-
- // initial setup
- createDirectoryStructureCheckbox.setSelection(true);
-}
-/**
- * Attempts to ensure that the specified directory exists on the local file system.
- * Answers a boolean indicating success.
- *
- * @return boolean
- * @param directory java.io.File
- */
-protected boolean ensureDirectoryExists(File directory) {
- if (!directory.exists()) {
- if (!queryYesNoQuestion(DataTransferMessages.getString("DataTransfer.createTargetDirectory"))) //$NON-NLS-1$
- return false;
-
- if (!directory.mkdirs()) {
- displayErrorDialog(DataTransferMessages.getString("DataTransfer.directoryCreationError")); //$NON-NLS-1$
- giveFocusToDestination();
- return false;
- }
- }
-
- return true;
-}
-/**
- * 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 targetDirectory) {
- if (targetDirectory.exists() && !targetDirectory.isDirectory()) {
- displayErrorDialog(DataTransferMessages.getString("FileExport.directoryExists")); //$NON-NLS-1$
- giveFocusToDestination();
- return false;
- }
-
- return ensureDirectoryExists(targetDirectory);
-}
-/**
- * Set up and execute the passed Operation. Answer a boolean indicating success.
- *
- * @return boolean
- */
-protected boolean executeExportOperation(FileSystemExportOperation op) {
- op.setCreateContainerDirectories(createDirectoriesForSelectedContainersCheckbox.getSelection());
- op.setCreateLeadupStructure(createDirectoryStructureCheckbox.getSelection());
- op.setOverwriteFiles(overwriteExistingFilesCheckbox.getSelection());
-
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- displayErrorDialog(e.getTargetException().getMessage());
- return false;
- }
-
- IStatus status = op.getStatus();
- if (!status.isOK()) {
- ErrorDialog.openError(getContainer().getShell(),
- DataTransferMessages.getString("DataTransfer.exportProblems"), //$NON-NLS-1$
- null, // no special message
- status);
- return false;
- }
-
- return true;
-}
-/**
- * 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
- */
-public boolean finish() {
- if (!ensureTargetIsValid(new File(getDestinationValue())))
- return false;
-
- List resourcesToExport = getSelectedResources();
-
- // about to invoke the operation so save our state
- saveWidgetValues();
-
- if (resourcesToExport.size() > 0)
- return executeExportOperation(
- new FileSystemExportOperation(
- getSourceResource(),
- resourcesToExport,
- getDestinationValue(),
- this));
-
- MessageDialog.openInformation(
- getContainer().getShell(),
- DataTransferMessages.getString("DataTransfer.information"), //$NON-NLS-1$
- DataTransferMessages.getString("FileExport.noneSelected")); //$NON-NLS-1$
-
- return false;
-}
-/**
- * Answer the string to display in self as the destination type
- *
- * @return java.lang.String
- */
-protected String getDestinationLabel() {
- return DataTransferMessages.getString("DataTransfer.directory"); //$NON-NLS-1$
-}
-/**
- * Answer the contents of self's destination specification widget
- *
- * @return java.lang.String
- */
-protected String getDestinationValue() {
- return destinationNameField.getText().trim();
-}
-/**
- * Set the current input focus to self's destination entry field
- */
-protected void giveFocusToDestination() {
- destinationNameField.setFocus();
-}
-/**
- * Open an appropriate destination browser so that the user can specify a source
- * to import from
- */
-protected void handleDestinationBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(getContainer().getShell(),SWT.SAVE);
- dialog.setMessage(DataTransferMessages.getString("DataTransfer.selectDestination")); //$NON-NLS-1$
- dialog.setFilterPath(getDestinationValue());
- String selectedDirectoryName = dialog.open();
-
- if (selectedDirectoryName != null)
- setDestinationValue(selectedDirectoryName);
-}
-/**
- * Handle all events and enablements for widgets in this page
- *
- * @param e org.eclipse.swt.widgets.Event
- */
-public void handleEvent(Event e) {
- Widget source = e.widget;
-
- if (source == destinationBrowseButton)
- handleDestinationBrowseButtonPressed();
-
- super.handleEvent(e);
-}
-/**
- * Hook method for saving widget values for restoration by the next instance
- * of this class.
- */
-protected void internalSaveWidgetValues() {
- // update directory names history
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
- if (directoryNames == null)
- directoryNames = new String[0];
-
- directoryNames = addToHistory(directoryNames,getDestinationValue());
- settings.put(
- STORE_DESTINATION_NAMES_ID,
- directoryNames);
-
- // options
- settings.put(
- STORE_OVERWRITE_EXISTING_FILES_ID,
- overwriteExistingFilesCheckbox.getSelection());
-
- settings.put(
- STORE_CREATE_STRUCTURE_ID,
- createDirectoryStructureCheckbox.getSelection());
-
- settings.put(
- STORE_CREATE_DIRECTORIES_FOR_SPECIFIED_CONTAINER_ID,
- createDirectoriesForSelectedContainersCheckbox.getSelection());
-
- }
-}
-/**
- * Hook method for restoring widget values to the values that they held
- * last time this wizard was used to completion.
- */
-protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
- if (directoryNames == null)
- return; // ie.- no settings stored
-
- // destination
- setDestinationValue(directoryNames[0]);
- for (int i = 0; i < directoryNames.length; i++)
- addDestinationItem(directoryNames[i]);
-
- // options
- overwriteExistingFilesCheckbox.setSelection(
- settings.getBoolean(STORE_OVERWRITE_EXISTING_FILES_ID));
-
- createDirectoryStructureCheckbox.setSelection(
- settings.getBoolean(STORE_CREATE_STRUCTURE_ID));
-
- createDirectoriesForSelectedContainersCheckbox.setSelection(
- settings.getBoolean(STORE_CREATE_DIRECTORIES_FOR_SPECIFIED_CONTAINER_ID));
- }
-}
-/**
- * Set the contents of self's destination specification widget to
- * the passed value
- *
- * @param value java.lang.String
- */
-protected void setDestinationValue(String value) {
- destinationNameField.setText(value);
-}
-/**
- * Answer a boolean indicating whether self's destination specification
- * widgets currently all contain valid values.
- *
- * @return boolean
- */
-protected boolean validateDestinationGroup() {
- return !getDestinationValue().equals("");//$NON-NLS-1$
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemImportPage1.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemImportPage1.java
deleted file mode 100644
index 1a1046d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemImportPage1.java
+++ /dev/null
@@ -1,680 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-import java.util.List;
-
-/**
- * Page 1 of the base resource import-from-file-system Wizard
- * @deprecated use WizardFileSystemResourceImportPage1
- */
-/*package*/ class WizardFileSystemImportPage1 extends WizardImportPage implements ISelectionChangedListener, Listener {
- private List selectedResources;
- private FileSystemElement root;
- private IWorkbench workbench;
-
- // widgets
- protected Combo typesToImportField;
- protected Button typesToImportEditButton;
- protected Combo sourceNameField;
- protected Button sourceBrowseButton;
- protected Button importAllResourcesRadio;
- protected Button importTypedResourcesRadio;
- protected Button detailsButton;
- protected Label detailsDescriptionLabel;
- protected Button overwriteExistingResourcesCheckbox;
- protected Button createContainerStructureCheckbox;
-
- // constants
- private static final int SIZING_TEXT_FIELD_WIDTH = 250;
- private static final int SIZING_LIST_HEIGHT = 150;
- private static final int COMBO_HISTORY_LENGTH = 5;
- private static final String TYPE_DELIMITER = DataTransferMessages.getString("DataTransfer.typeDelimiter"); //$NON-NLS-1$
-
- // dialog store id constants
- private final static String STORE_SOURCE_NAMES_ID = "WizardFileSystemImportPage1.STORE_SOURCE_NAMES_ID";//$NON-NLS-1$
- private final static String STORE_IMPORT_ALL_RESOURCES_ID = "WizardFileSystemImportPage1.STORE_IMPORT_ALL_FILES_ID";//$NON-NLS-1$
- private final static String STORE_OVERWRITE_EXISTING_RESOURCES_ID = "WizardFileSystemImportPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID";//$NON-NLS-1$
- private final static String STORE_CREATE_CONTAINER_STRUCTURE_ID = "WizardFileSystemImportPage1.STORE_CREATE_CONTAINER_STRUCTURE_ID";//$NON-NLS-1$
- private final static String STORE_SELECTED_TYPES_ID = "WizardFileSystemImportPage1.STORE_SELECTED_TYPES_ID";//$NON-NLS-1$
-/**
- * Creates an instance of this class
- */
-protected WizardFileSystemImportPage1(String name, IWorkbench aWorkbench, IStructuredSelection selection) {
- super(name,selection);
- this.workbench = aWorkbench;
-}
-/**
- * Creates an instance of this class
- */
-public WizardFileSystemImportPage1(IWorkbench aWorkbench, IStructuredSelection selection) {
- this("fileSystemImportPage1", aWorkbench, selection);//$NON-NLS-1$
- setTitle(DataTransferMessages.getString("DataTransfer.fileSystemTitle")); //$NON-NLS-1$
- setDescription(DataTransferMessages.getString("FileImport.importFileSystem")); //$NON-NLS-1$
-}
-/**
- * Adds the recursive contents of the passed file system element to this
- * page's collection of selected resources.
- */
-protected void addToSelectedResources(FileSystemElement element) {
- if (element.isDirectory()) {
- Object[] children = element.getFolders().getChildren(element);
- for (int i = 0; i < children.length; ++i) {
- addToSelectedResources((FileSystemElement) children[i]);
- }
- children = element.getFiles().getChildren(element);
- for (int i = 0; i < children.length; ++i) {
- addToSelectedResources((FileSystemElement) children[i]);
- }
- } else
- selectedResources.add(element);
-}
-/**
- * Create the import options specification widgets.
- */
-protected void createOptionsGroup(Composite parent) {
- // options group
- Composite optionsGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- optionsGroup.setLayout(layout);
- optionsGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- // overwrite... checkbox
- overwriteExistingResourcesCheckbox = new Button(optionsGroup,SWT.CHECK);
- overwriteExistingResourcesCheckbox.setText(DataTransferMessages.getString("FileImport.overwriteExisting")); //$NON-NLS-1$
-
- // create containers checkbox
- createContainerStructureCheckbox = new Button(optionsGroup,SWT.CHECK);
- createContainerStructureCheckbox.setText(DataTransferMessages.getString("FileImport.createComplete")); //$NON-NLS-1$
-}
-/**
- * Create the import source specification widgets
- */
-protected void createSourceGroup(Composite parent) {
- Composite sourceContainerGroup = new Composite(parent,SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- sourceContainerGroup.setLayout(layout);
- sourceContainerGroup.setLayoutData(
- new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- new Label(sourceContainerGroup,SWT.NONE).setText(getSourceLabel());
-
- // source name entry field
- sourceNameField = new Combo(sourceContainerGroup,SWT.BORDER);
- sourceNameField.addListener(SWT.Modify,this);
- sourceNameField.addListener(SWT.Selection,this);
- GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- sourceNameField.setLayoutData(data);
-
- // source browse button
- sourceBrowseButton = new Button(sourceContainerGroup,SWT.PUSH);
- sourceBrowseButton.setText(DataTransferMessages.getString("DataTransfer.browse")); //$NON-NLS-1$
- sourceBrowseButton.addListener(SWT.Selection,this);
- sourceBrowseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
-
- createSpacer(parent);
- createBoldLabel(parent,DataTransferMessages.getString("FileImport.whichTypesImport")); //$NON-NLS-1$
-
- // source types group
- Composite sourceTypesGroup = new Composite(parent,SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 3;
- sourceTypesGroup.setLayout(layout);
- sourceTypesGroup.setLayoutData(
- new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- // all types radio
- importAllResourcesRadio = new Button(sourceTypesGroup,SWT.RADIO);
- importAllResourcesRadio.setText(DataTransferMessages.getString("DataTransfer.allTypes")); //$NON-NLS-1$
- importAllResourcesRadio.addListener(SWT.Selection,this);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.horizontalSpan = 3;
- importAllResourcesRadio.setLayoutData(data);
-
- // import specific types radio
- importTypedResourcesRadio = new Button(sourceTypesGroup,SWT.RADIO);
- importTypedResourcesRadio.setText(DataTransferMessages.getString("FileImport.filesofType")); //$NON-NLS-1$
- importTypedResourcesRadio.addListener(SWT.Selection,this);
-
- // types combo
- typesToImportField = new Combo(sourceTypesGroup, SWT.NONE);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- typesToImportField.setLayoutData(data);
- typesToImportField.addListener(SWT.Modify, this);
-
- // types edit button
- typesToImportEditButton = new Button(sourceTypesGroup, SWT.PUSH);
- typesToImportEditButton.setText(DataTransferMessages.getString("FileImport.edit")); //$NON-NLS-1$
- typesToImportEditButton.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_END));
- typesToImportEditButton.addListener(SWT.Selection, this);
-
- // details of files to import group
- Composite fileDetailsGroup = new Composite(parent, SWT.NONE);
- layout = new GridLayout();
- layout.numColumns = 2;
- fileDetailsGroup.setLayout(layout);
- fileDetailsGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- // details button
- detailsButton = new Button(fileDetailsGroup,SWT.PUSH);
- detailsButton.setText(DataTransferMessages.getString("DataTransfer.details")); //$NON-NLS-1$
- detailsButton.addListener(SWT.Selection,this);
-
- // details label
- detailsDescriptionLabel = new Label(fileDetailsGroup,SWT.NONE);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- detailsDescriptionLabel.setLayoutData(data);
-
- // initial setup
- typesToImportField.setEnabled(false);
- typesToImportEditButton.setEnabled(false);
- importAllResourcesRadio.setSelection(true);
- resetSelection();
- sourceNameField.setFocus();
-}
-/**
- * Display the appropriate string representing a selection of the
- * passed size.
- */
-protected void displaySelectedCount(int selectedFileCount) {
- if (selectedFileCount == 1)
- detailsDescriptionLabel.setText(
- DataTransferMessages.getString("DataTransfer.oneSelected")); //$NON-NLS-1$
- else
- detailsDescriptionLabel.setText(DataTransferMessages.format("FileImport.filesSelected",new Object[] {String.valueOf(selectedFileCount)})); //$NON-NLS-1$
-}
-/**
- * Answer a boolean indicating whether the specified source currently exists
- * and is valid
- */
-protected boolean ensureSourceIsValid() {
- if (new File(getSourceDirectoryName()).isDirectory())
- return true;
-
- displayErrorDialog(DataTransferMessages.getString("FileImport.invalidSource")); //$NON-NLS-1$
- sourceNameField.setFocus();
- return false;
-}
-/**
- * Execute the passed import operation. Answer a boolean indicating success.
- */
-protected boolean executeImportOperation(ImportOperation op) {
- initializeOperation(op);
-
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- displayErrorDialog(e.getTargetException().getMessage());
- return false;
- }
-
- IStatus status = op.getStatus();
- if (!status.isOK()) {
- ErrorDialog.openError(getContainer().getShell(),
- DataTransferMessages.getString("FileImport.importProblems"), //$NON-NLS-1$
- null, // no special message
- status);
- return false;
- }
-
- return true;
-}
-/**
- * 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.
- */
-public boolean finish() {
- if (!ensureSourceIsValid())
- return false;
-
- if (selectedResources == null && importAllResourcesRadio.getSelection()) {
- // about to invoke the operation so save our state
- saveWidgetValues();
-
- return importAllResources();
- } else {
- // ensure that files of appropriate extension will be marked as selected
- if (selectedResources == null) {
- if (getFileSystemTree() == null)
- return false;
- }
-
- // about to invoke the operation so save our state
- saveWidgetValues();
-
- if (selectedResources.size() > 0) {
- List fileSystemObjects = new ArrayList(selectedResources.size());
- Iterator resourcesEnum = selectedResources.iterator();
- while (resourcesEnum.hasNext())
- fileSystemObjects.add(
- ((FileSystemElement)resourcesEnum.next()).getFileSystemObject());
-
- return importResources(fileSystemObjects);
- }
-
- MessageDialog.openInformation(
- getContainer().getShell(),
- DataTransferMessages.getString("DataTransfer.information"), //$NON-NLS-1$
- DataTransferMessages.getString("FileImport.noneSelected")); //$NON-NLS-1$
-
- return false;
- }
-}
-/**
- * Answer the root FileSystemElement that represents the contents of
- * the currently-specified source. If this FileSystemElement is not
- * currently defined then create and return it.
- */
-protected FileSystemElement getFileSystemTree() {
- if (root != null)
- return root;
-
- File sourceDirectory = getSourceDirectory();
- if (sourceDirectory == null)
- return null;
-
- return selectFiles(sourceDirectory, FileSystemStructureProvider.INSTANCE);
-}
-/**
- * Answer self's import source root element
- */
-protected FileSystemElement getRoot() {
- return root;
-}
-/**
- * Answer self's current collection of selected resources
- */
-protected List getSelectedResources() {
- return selectedResources;
-}
-/**
- * Returns a File object representing the currently-named source directory iff
- * it exists as a valid directory, or <code>null</code> otherwise.
- */
-protected File getSourceDirectory() {
- File sourceDirectory = new File(getSourceDirectoryName());
- if (!sourceDirectory.exists() || !sourceDirectory.isDirectory()) {
- displayErrorDialog(DataTransferMessages.getString("FileImport.invalidSource")); //$NON-NLS-1$
- sourceNameField.setFocus();
- return null;
- }
-
- return sourceDirectory;
-}
-/**
- * Answer the directory name specified as being the import source.
- * Note that if it ends with a separator then the separator is first
- * removed so that java treats it as a proper directory
- */
-private String getSourceDirectoryName() {
- IPath result = new Path(sourceNameField.getText().trim());
-
- if (result.getDevice() != null && result.segmentCount() == 0) // something like "c:"
- result = result.addTrailingSeparator();
- else
- result = result.removeTrailingSeparator();
-
- return result.toOSString();
-}
-/**
- * Answer the string to display as the label for the source specification field
- */
-protected String getSourceLabel() {
- return DataTransferMessages.getString("FileImport.sourceTitle"); //$NON-NLS-1$
-}
-/**
- * Returns a collection of the currently-specified resource types,
- * or <code>null</code> to indicate that all types should be imported.
- */
-protected List getTypesToImport() {
- if (importAllResourcesRadio.getSelection())
- return null;
-
- List result = new ArrayList();
- StringTokenizer tokenizer = new StringTokenizer(typesToImportField.getText(),TYPE_DELIMITER);
-
- while (tokenizer.hasMoreTokens()) {
- String currentExtension = tokenizer.nextToken().trim();
- if (!currentExtension.equals(""))//$NON-NLS-1$
- result.add(currentExtension);
- }
-
- return result;
-}
-/**
- * Returns an array of the currently-specified resource types,
- * or <code>null</code> to indicate that all types should be imported.
- */
-protected String[] getTypesToImportArray() {
- List typesToImport = getTypesToImport();
- if (typesToImport == null)
- return null;
-
- String result[] = new String[typesToImport.size()];
- typesToImport.toArray(result);
-
- return result;
-}
-/**
- * Open a selection dialog and note the selections
- */
-protected void handleDetailsButtonPressed() {
- FileSystemElement rootElement = getFileSystemTree();
-
- if (rootElement != null) {
- List newSelections = queryResourcesToImport(rootElement);
-
- if (newSelections != null) {
- selectedResources = newSelections;
- displaySelectedCount(selectedResources.size());
- }
- }
-}
-/**
- * Handle all events and enablements for widgets in this dialog
- */
-public void handleEvent(Event e) {
- Widget source = e.widget;
-
- if (source == sourceNameField)
- resetSelection();
- else if (source == sourceBrowseButton)
- handleSourceBrowseButtonPressed();
- else if (source == importAllResourcesRadio)
- resetSelection();
- else if (source == importTypedResourcesRadio) {
- resetSelection();
- typesToImportField.setFocus();
- } else if (source == detailsButton)
- handleDetailsButtonPressed();
- else if (source == typesToImportField)
- resetSelection();
- else if (source == typesToImportEditButton)
- handleTypesEditButtonPressed();
-
- super.handleEvent(e);
-}
-/**
- * Open an appropriate source browser so that the user can specify a source
- * to import from
- */
-protected void handleSourceBrowseButtonPressed() {
- DirectoryDialog dialog = new DirectoryDialog(sourceNameField.getShell(),SWT.SAVE);
- dialog.setMessage(DataTransferMessages.getString("FileImport.selectSource")); //$NON-NLS-1$
- dialog.setFilterPath(getSourceDirectoryName());
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null) {
- if (!selectedDirectory.equals(getSourceDirectoryName())) {
- resetSelection();
- sourceNameField.setText(selectedDirectory);
- }
- }
-}
-/**
- * Open a registered type selection dialog and note the selections
- * in self's types-to-export field
- */
-protected void handleTypesEditButtonPressed() {
- IFileEditorMapping editorMappings[] =
- PlatformUI.getWorkbench().getEditorRegistry().getFileEditorMappings();
-
- List selectedTypes = getTypesToImport();
- List initialSelections = new ArrayList();
- for (int i = 0; i < editorMappings.length; i++) {
- IFileEditorMapping mapping = editorMappings[i];
- if (selectedTypes.contains(mapping.getExtension()))
- initialSelections.add(mapping);
- }
-
- ListSelectionDialog dialog =
- new ListSelectionDialog(
- getContainer().getShell(),
- editorMappings,
- FileEditorMappingContentProvider.INSTANCE,
- FileEditorMappingLabelProvider.INSTANCE,
- DataTransferMessages.getString("FileImport.selectTypes")); //$NON-NLS-1$
-
- dialog.setInitialSelections(initialSelections.toArray());
- dialog.setTitle(DataTransferMessages.getString("FileImport.typeSelectionTitle")); //$NON-NLS-1$
- dialog.open();
-
- Object[] newSelectedTypes = dialog.getResult();
- if (newSelectedTypes != null) { // ie.- did not press Cancel
- List result = new ArrayList(newSelectedTypes.length);
- for (int i = 0; i < newSelectedTypes.length; i++)
- result.add(((IFileEditorMapping)newSelectedTypes[i]).getExtension());
- setTypesToImport(result);
- }
-}
-/**
- * Recursively import all resources starting at the user-specified source location.
- * Answer a boolean indicating success.
- */
-protected boolean importAllResources() {
- return executeImportOperation(
- new ImportOperation(
- getContainerFullPath(),
- getSourceDirectory(),
- FileSystemStructureProvider.INSTANCE,
- this));
-}
-/**
- * Import the resources with extensions as specified by the user
- */
-protected boolean importResources(List fileSystemObjects) {
- return executeImportOperation(
- new ImportOperation(
- getContainerFullPath(),
- getSourceDirectory(),
- FileSystemStructureProvider.INSTANCE,
- this,
- fileSystemObjects));
-}
-/**
- * Initializes the specified operation appropriately.
- */
-protected void initializeOperation(ImportOperation op) {
- op.setCreateContainerStructure(createContainerStructureCheckbox.getSelection());
- op.setOverwriteResources(overwriteExistingResourcesCheckbox.getSelection());
-}
-/**
- * Opens a resource selection dialog with the passed root as input, and returns
- * a collection with the resources that were subsequently specified for import
- * by the user, or <code>null</code> if the dialog was canceled.
- */
-protected List queryResourcesToImport(FileSystemElement rootElement) {
- FileSelectionDialog dialog = new FileSelectionDialog(getContainer().getShell(), rootElement, DataTransferMessages.getString("FileImport.selectResources")); //$NON-NLS-1$
- dialog.setInitialSelections(selectedResources.toArray());
- dialog.setExpandAllOnOpen(true);
- dialog.open();
- if (dialog.getResult() == null)
- return null;
- return Arrays.asList(dialog.getResult());
-
-}
-/**
- * Reset the selected resources collection and update the ui appropriately
- */
-protected void resetSelection() {
- detailsDescriptionLabel.setText(DataTransferMessages.getString("DataTransfer.allFiles")); //$NON-NLS-1$
- selectedResources = null;
- root = null;
-}
-/**
- * Use the dialog store to restore widget values to the values that they held
- * last time this wizard was used to completion
- */
-protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- String[] sourceNames = settings.getArray(STORE_SOURCE_NAMES_ID);
- if (sourceNames == null)
- return; // ie.- no values stored, so stop
-
- // set all/specific types radios and related enablements
- boolean importAll = settings.getBoolean(STORE_IMPORT_ALL_RESOURCES_ID);
- importAllResourcesRadio.setSelection(importAll);
- importTypedResourcesRadio.setSelection(!importAll);
-
- // set filenames history
- sourceNameField.setText(sourceNames[0]);
- for (int i = 0; i < sourceNames.length; i++)
- sourceNameField.add(sourceNames[i]);
-
- // set selected types
- String[] selectedTypes = settings.getArray(STORE_SELECTED_TYPES_ID);
- if (selectedTypes.length > 0)
- typesToImportField.setText(selectedTypes[0]);
- for (int i = 0; i < selectedTypes.length; i++)
- typesToImportField.add(selectedTypes[i]);
-
- // radio buttons and checkboxes
- overwriteExistingResourcesCheckbox.setSelection(
- settings.getBoolean(STORE_OVERWRITE_EXISTING_RESOURCES_ID));
-
- createContainerStructureCheckbox.setSelection(
- settings.getBoolean(STORE_CREATE_CONTAINER_STRUCTURE_ID));
-
- }
-}
-/**
- * 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() {
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- // update source names history
- String[] sourceNames = settings.getArray(STORE_SOURCE_NAMES_ID);
- if (sourceNames == null)
- sourceNames = new String[0];
-
- sourceNames = addToHistory(sourceNames,getSourceDirectoryName());
- settings.put(
- STORE_SOURCE_NAMES_ID,
- sourceNames);
-
- // update specific types to import history
- String[] selectedTypesNames = settings.getArray(STORE_SELECTED_TYPES_ID);
- if (selectedTypesNames == null)
- selectedTypesNames = new String[0];
-
- if (importTypedResourcesRadio.getSelection())
- selectedTypesNames = addToHistory(selectedTypesNames,typesToImportField.getText());
-
- settings.put(
- STORE_SELECTED_TYPES_ID,
- selectedTypesNames);
-
- // radio buttons and checkboxes
- settings.put(
- STORE_IMPORT_ALL_RESOURCES_ID,
- importAllResourcesRadio.getSelection());
-
- settings.put(
- STORE_OVERWRITE_EXISTING_RESOURCES_ID,
- overwriteExistingResourcesCheckbox.getSelection());
-
- settings.put(
- STORE_CREATE_CONTAINER_STRUCTURE_ID,
- createContainerStructureCheckbox.getSelection());
-
- }
-}
-/**
- * Invokes a file selection operation using the specified file system and
- * structure provider. If the user specifies files to be imported then
- * this selection is cached for later retrieval and is returned.
- */
-protected FileSystemElement selectFiles(Object rootFileSystemObject,IImportStructureProvider structureProvider) {
- try {
- SelectFilesOperation op =
- new SelectFilesOperation(rootFileSystemObject,structureProvider);
- op.setDesiredExtensions(getTypesToImportArray());
- getContainer().run(true, true, op);
- root = op.getResult();
- setSelectedResources(new ArrayList());
- addToSelectedResources(root);
- } catch (InterruptedException e) {
- return null;
- } catch (InvocationTargetException e) {
- displayErrorDialog(e.getTargetException().getMessage());
- return null;
- }
-
- return root;
-}
-/**
- * Respond to the user selecting/deselecting items in the
- * extensions list
- */
-public void selectionChanged(SelectionChangedEvent event) {
- if (importTypedResourcesRadio.getSelection())
- resetSelection();
-}
-/**
- * Set self's import source root element
- */
-protected void setRoot(FileSystemElement value) {
- root = value;
-}
-/**
- * Set self's current collection of selected resources
- */
-protected void setSelectedResources(List value) {
- selectedResources = value;
-}
-/**
- * Populate self's import types field based upon the passed types collection
- */
-protected void setTypesToImport(List types) {
- StringBuffer result = new StringBuffer();
- for (int i = 0; i < types.size(); ++i) {
- if (i != 0) {
- result.append(TYPE_DELIMITER);
- result.append(" ");//$NON-NLS-1$
- }
- result.append(types.get(i));
- }
- typesToImportField.setText(result.toString());
-}
-/**
- * Set the enablements of self's widgets
- */
-protected void updateWidgetEnablements() {
- typesToImportField.setEnabled(importTypedResourcesRadio.getSelection());
- typesToImportEditButton.setEnabled(importTypedResourcesRadio.getSelection());
-}
-/**
- * Answer a boolean indicating whether self's source specification
- * widgets currently all contain valid values.
- */
-protected boolean validateSourceGroup() {
- return !getSourceDirectoryName().equals("");//$NON-NLS-1$
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemResourceExportPage1.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemResourceExportPage1.java
deleted file mode 100644
index c45be13..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemResourceExportPage1.java
+++ /dev/null
@@ -1,411 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.dialogs.WizardExportResourcesPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.EditorManager;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * Page 1 of the base resource export-to-file-system Wizard
- */
-/*package*/ class WizardFileSystemResourceExportPage1 extends WizardExportResourcesPage implements Listener {
-
- // widgets
- private Combo destinationNameField;
- private Button destinationBrowseButton;
- protected Button overwriteExistingFilesCheckbox;
- protected Button createDirectoryStructureButton;
- protected Button createSelectionOnlyButton;
-
- // constants
- private static final int SIZING_TEXT_FIELD_WIDTH = 250;
- private static final int COMBO_HISTORY_LENGTH = 5;
-
- // dialog store id constants
- private static final String STORE_DESTINATION_NAMES_ID =
- "WizardFileSystemResourceExportPage1.STORE_DESTINATION_NAMES_ID";//$NON-NLS-1$
- private static final String STORE_OVERWRITE_EXISTING_FILES_ID =
- "WizardFileSystemResourceExportPage1.STORE_OVERWRITE_EXISTING_FILES_ID";//$NON-NLS-1$
- private static final String STORE_CREATE_STRUCTURE_ID =
- "WizardFileSystemResourceExportPage1.STORE_CREATE_STRUCTURE_ID";//$NON-NLS-1$
- private static final String STORE_CREATE_DIRECTORIES_FOR_SPECIFIED_CONTAINER_ID =
- "WizardFileSystemResourceExportPage1.STORE_CREATE_DIRECTORIES_FOR_SPECIFIED_CONTAINER_ID";//$NON-NLS-1$
- //messages
- private static final String DESTINATION_EMPTY_MESSAGE = DataTransferMessages.getString("FileExport.destinationEmpty"); //$NON-NLS-1$
- private static final String SELECT_DESTINATION_MESSAGE = DataTransferMessages.getString("DataTransfer.selectDestination"); //$NON-NLS-1$
-/**
- * Create an instance of this class
- */
-protected WizardFileSystemResourceExportPage1(String name, IStructuredSelection selection) {
- super(name, selection);
-}
-/**
- * Create an instance of this class
- */
-public WizardFileSystemResourceExportPage1(IStructuredSelection selection) {
- this("fileSystemExportPage1", selection);//$NON-NLS-1$
- setTitle(DataTransferMessages.getString("DataTransfer.fileSystemTitle")); //$NON-NLS-1$
- setDescription(DataTransferMessages.getString("FileExport.exportLocalFileSystem")); //$NON-NLS-1$
-}
-/**
- * Add the passed value to self's destination widget's history
- *
- * @param value java.lang.String
- */
-protected void addDestinationItem(String value) {
- destinationNameField.add(value);
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
- super.createControl(parent);
- giveFocusToDestination();
- WorkbenchHelp.setHelp(getControl(), IDataTransferHelpContextIds.FILE_SYSTEM_EXPORT_WIZARD_PAGE);
-}
-/**
- * Create the export destination specification widgets
- *
- * @param parent org.eclipse.swt.widgets.Composite
- */
-protected void createDestinationGroup(Composite parent) {
-
- Font font = parent.getFont();
- // destination specification group
- Composite destinationSelectionGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- destinationSelectionGroup.setLayout(layout);
- destinationSelectionGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));
- destinationSelectionGroup.setFont(font);
-
- Label destinationLabel = new Label(destinationSelectionGroup, SWT.NONE);
- destinationLabel.setText(getDestinationLabel());
- destinationLabel.setFont(font);
-
- // destination name entry field
- 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);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- destinationNameField.setLayoutData(data);
- destinationNameField.setFont(font);
-
- // destination browse button
- destinationBrowseButton = new Button(destinationSelectionGroup, SWT.PUSH);
- destinationBrowseButton.setText(DataTransferMessages.getString("DataTransfer.browse")); //$NON-NLS-1$
- destinationBrowseButton.addListener(SWT.Selection, this);
- destinationBrowseButton.setFont(font);
- setButtonLayoutData(destinationBrowseButton);
-
- new Label(parent, SWT.NONE); // vertical spacer
-}
-
-/**
- * Create the buttons in the options group.
- */
-
-protected void createOptionsGroupButtons(Group optionsGroup) {
-
- Font font = optionsGroup.getFont();
- // overwrite... checkbox
- overwriteExistingFilesCheckbox = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
- overwriteExistingFilesCheckbox.setText(
- DataTransferMessages.getString("ExportFile.overwriteExisting")); //$NON-NLS-1$
- overwriteExistingFilesCheckbox.setFont(font);
-
- // create directory structure radios
- createDirectoryStructureButton = new Button(optionsGroup, SWT.RADIO | SWT.LEFT);
- createDirectoryStructureButton.setText(
- DataTransferMessages.getString("FileExport.createDirectoryStructure")); //$NON-NLS-1$
- createDirectoryStructureButton.setSelection(false);
- createDirectoryStructureButton.setFont(font);
-
-
- // create directory structure radios
- createSelectionOnlyButton = new Button(optionsGroup, SWT.RADIO | SWT.LEFT);
- createSelectionOnlyButton.setText(
- DataTransferMessages.getString("FileExport.createSelectedDirectories"));//$NON-NLS-1$}
- createSelectionOnlyButton.setSelection(true);
- createSelectionOnlyButton.setFont(font);
-}
-
-/**
- * Attempts to ensure that the specified directory exists on the local file system.
- * Answers a boolean indicating success.
- *
- * @return boolean
- * @param directory java.io.File
- */
-protected boolean ensureDirectoryExists(File directory) {
- if (!directory.exists()) {
- if (!queryYesNoQuestion(DataTransferMessages.getString("DataTransfer.createTargetDirectory"))) //$NON-NLS-1$
- return false;
-
- if (!directory.mkdirs()) {
- displayErrorDialog(DataTransferMessages.getString("DataTransfer.directoryCreationError")); //$NON-NLS-1$
- giveFocusToDestination();
- return false;
- }
- }
-
- return true;
-}
-/**
- * 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 targetDirectory) {
- if (targetDirectory.exists() && !targetDirectory.isDirectory()) {
- displayErrorDialog(DataTransferMessages.getString("FileExport.directoryExists")); //$NON-NLS-1$
- giveFocusToDestination();
- return false;
- }
-
- return ensureDirectoryExists(targetDirectory);
-}
-/**
- * Set up and execute the passed Operation. Answer a boolean indicating success.
- *
- * @return boolean
- */
-protected boolean executeExportOperation(FileSystemExportOperation op) {
- op.setCreateLeadupStructure(createDirectoryStructureButton.getSelection());
- op.setOverwriteFiles(overwriteExistingFilesCheckbox.getSelection());
-
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- displayErrorDialog(e.getTargetException());
- return false;
- }
-
- IStatus status = op.getStatus();
- if (!status.isOK()) {
- ErrorDialog.openError(getContainer().getShell(),
- DataTransferMessages.getString("DataTransfer.exportProblems"), //$NON-NLS-1$
- null, // no special message
- status);
- return false;
- }
-
- return true;
-}
-/**
- * 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
- */
-public boolean finish() {
- if (!ensureTargetIsValid(new File(getDestinationValue())))
- return false;
-
- List resourcesToExport = getWhiteCheckedResources();
-
- //Save dirty editors if possible but do not stop if not all are saved
- saveDirtyEditors();
- // about to invoke the operation so save our state
- saveWidgetValues();
-
- if (resourcesToExport.size() > 0)
- return executeExportOperation(
- new FileSystemExportOperation(
- null,
- resourcesToExport,
- getDestinationValue(),
- this));
-
- MessageDialog.openInformation(
- getContainer().getShell(),
- DataTransferMessages.getString("DataTransfer.information"), //$NON-NLS-1$
- DataTransferMessages.getString("FileExport.noneSelected")); //$NON-NLS-1$
-
- return false;
-}
-/**
- * Answer the string to display in self as the destination type
- *
- * @return java.lang.String
- */
-protected String getDestinationLabel() {
- return DataTransferMessages.getString("DataTransfer.directory"); //$NON-NLS-1$
-}
-/**
- * Answer the contents of self's destination specification widget
- *
- * @return java.lang.String
- */
-protected String getDestinationValue() {
- return destinationNameField.getText().trim();
-}
-/**
- * Set the current input focus to self's destination entry field
- */
-protected void giveFocusToDestination() {
- destinationNameField.setFocus();
-}
-/**
- * Open an appropriate destination browser so that the user can specify a source
- * to import from
- */
-protected void handleDestinationBrowseButtonPressed() {
- DirectoryDialog dialog =
- new DirectoryDialog(getContainer().getShell(), SWT.SAVE);
- dialog.setMessage(SELECT_DESTINATION_MESSAGE);
- dialog.setFilterPath(getDestinationValue());
- String selectedDirectoryName = dialog.open();
-
- if (selectedDirectoryName != null) {
- setErrorMessage(null);
- setDestinationValue(selectedDirectoryName);
- }
-}
-/**
- * Handle all events and enablements for widgets in this page
- * @param e Event
- */
-public void handleEvent(Event e) {
- Widget source = e.widget;
-
- if (source == destinationBrowseButton)
- handleDestinationBrowseButtonPressed();
-
- updatePageCompletion();
-}
-/**
- * Hook method for saving widget values for restoration by the next instance
- * of this class.
- */
-protected void internalSaveWidgetValues() {
- // update directory names history
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
- if (directoryNames == null)
- directoryNames = new String[0];
-
- directoryNames = addToHistory(directoryNames, getDestinationValue());
- settings.put(STORE_DESTINATION_NAMES_ID, directoryNames);
-
- // options
- settings.put(
- STORE_OVERWRITE_EXISTING_FILES_ID,
- overwriteExistingFilesCheckbox.getSelection());
-
- settings.put(
- STORE_CREATE_STRUCTURE_ID,
- createDirectoryStructureButton.getSelection());
-
- }
-}
-/**
- * Hook method for restoring widget values to the values that they held
- * last time this wizard was used to completion.
- */
-protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
- if (directoryNames == null)
- return; // ie.- no settings stored
-
- // destination
- setDestinationValue(directoryNames[0]);
- for (int i = 0; i < directoryNames.length; i++)
- addDestinationItem(directoryNames[i]);
-
- // options
- overwriteExistingFilesCheckbox.setSelection(
- settings.getBoolean(STORE_OVERWRITE_EXISTING_FILES_ID));
-
- boolean createDirectories = settings.getBoolean(STORE_CREATE_STRUCTURE_ID);
- createDirectoryStructureButton.setSelection(createDirectories);
- createSelectionOnlyButton.setSelection(!createDirectories);
- }
-}
-/**
- * Set the contents of the receivers destination specification widget to
- * the passed value
- *
- */
-protected void setDestinationValue(String value) {
- destinationNameField.setText(value);
-}
-/**
- * Answer a boolean indicating whether the receivers destination specification
- * widgets currently all contain valid values.
- */
-protected boolean validateDestinationGroup() {
- String destinationValue = getDestinationValue();
- if (destinationValue.length() == 0) {
- setMessage(DESTINATION_EMPTY_MESSAGE);
- return false;
- }
-
- String conflictingContainer = getConflictingContainerNameFor(destinationValue);
- if(conflictingContainer == null)
- setErrorMessage(""); //$NON-NLS-1$
- else {
- setErrorMessage(
- DataTransferMessages.format(
- "FileExport.conflictingContainer", //$NON-NLS-1$
- new Object[] {conflictingContainer}));
- giveFocusToDestination();
- return false;
- }
-
- return true;
-}
-
-/**
- * Returns the name of a container with a location that encompasses targetDirectory.
- * Returns null if there is no conflict.
- *
- * @param targetDirectory the path of the directory to check.
- * @return the conflicting container name or <code>null</code>
- */
-protected String getConflictingContainerNameFor(String targetDirectory){
-
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IPath testPath = new Path(targetDirectory);
-
- if(root.getLocation().isPrefixOf(testPath))
- return DataTransferMessages.getString("FileExport.rootName"); //$NON-NLS-1$
-
- IProject[] projects = root.getProjects();
-
- for(int i = 0; i < projects.length; i++){
- if(projects[i].getLocation().isPrefixOf(testPath))
- return projects[i].getName();
- }
-
- return null;
-
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemResourceImportPage1.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemResourceImportPage1.java
deleted file mode 100644
index e8d8538..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardFileSystemResourceImportPage1.java
+++ /dev/null
@@ -1,888 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.FileSystemElement;
-import org.eclipse.ui.dialogs.WizardResourceImportPage;
-import org.eclipse.ui.internal.dialogs.IElementFilter;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-
-/**
- * Page 1 of the base resource import-from-file-system Wizard
- */
-/*package*/
-class WizardFileSystemResourceImportPage1
- extends WizardResourceImportPage
- implements Listener {
-
-
- private IWorkbench workbench;
- // widgets
- protected Combo sourceNameField;
- protected Button overwriteExistingResourcesCheckbox;
- protected Button createContainerStructureButton;
- protected Button createOnlySelectedButton;
- protected Button sourceBrowseButton;
- protected Button selectTypesButton;
- protected Button selectAllButton;
- protected Button deselectAllButton;
- //A boolean to indicate if the user has typed anything
- private boolean entryChanged = false;
-
- // dialog store id constants
- private final static String STORE_SOURCE_NAMES_ID =
- "WizardFileSystemResourceImportPage1.STORE_SOURCE_NAMES_ID";//$NON-NLS-1$
- private final static String STORE_OVERWRITE_EXISTING_RESOURCES_ID =
- "WizardFileSystemResourceImportPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID";//$NON-NLS-1$
- private final static String STORE_CREATE_CONTAINER_STRUCTURE_ID =
- "WizardFileSystemResourceImportPage1.STORE_CREATE_CONTAINER_STRUCTURE_ID";//$NON-NLS-1$
-
- private static final String SELECT_TYPES_TITLE = DataTransferMessages.getString("DataTransfer.selectTypes"); //$NON-NLS-1$
- private static final String SELECT_ALL_TITLE = DataTransferMessages.getString("DataTransfer.selectAll"); //$NON-NLS-1$
- private static final String DESELECT_ALL_TITLE = DataTransferMessages.getString("DataTransfer.deselectAll"); //$NON-NLS-1$
- private static final String SELECT_SOURCE_MESSAGE =
- DataTransferMessages.getString("FileImport.selectSource"); //$NON-NLS-1$
- protected static final String SOURCE_EMPTY_MESSAGE = DataTransferMessages.getString("FileImport.sourceEmpty"); //$NON-NLS-1$
-/**
- * Creates an instance of this class
- */
-protected WizardFileSystemResourceImportPage1(String name, IWorkbench aWorkbench, IStructuredSelection selection) {
- super(name,selection);
- this.workbench = aWorkbench;
-}
-/**
- * Creates an instance of this class
- *
- * @param aWorkbench IWorkbench
- * @param selection IStructuredSelection
- */
-public WizardFileSystemResourceImportPage1(IWorkbench aWorkbench, IStructuredSelection selection) {
- this("fileSystemImportPage1", aWorkbench, selection);//$NON-NLS-1$
- setTitle(DataTransferMessages.getString("DataTransfer.fileSystemTitle")); //$NON-NLS-1$
- setDescription(DataTransferMessages.getString("FileImport.importFileSystem")); //$NON-NLS-1$
-}
-/**
- * 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.
- * </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) {
- // increment the number of columns in the button bar
- ((GridLayout)parent.getLayout()).numColumns++;
-
- Button button = new Button(parent, SWT.PUSH );
- button.setFont(parent.getFont());
-
- GridData buttonData = new GridData(GridData.FILL_HORIZONTAL);
- button.setLayoutData(buttonData);
-
- button.setData(new Integer(id));
- button.setText(label);
-
- if (defaultButton) {
- Shell shell = parent.getShell();
- if (shell != null) {
- shell.setDefaultButton(button);
- }
- button.setFocus();
- }
- return button;
-}
-/**
- * Creates the buttons for selecting specific types or selecting all or none of the
- * elements.
- *
- * @param parent the parent control
- */
-protected final void createButtonsGroup(Composite parent) {
- // top level group
- Composite buttonComposite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- layout.makeColumnsEqualWidth = true;
- buttonComposite.setLayout(layout);
- buttonComposite.setFont(parent.getFont());
- buttonComposite.setLayoutData(
- new GridData(GridData.VERTICAL_ALIGN_FILL | GridData.HORIZONTAL_ALIGN_FILL));
-
- // types edit button
- selectTypesButton =
- createButton(
- buttonComposite,
- IDialogConstants.SELECT_TYPES_ID,
- SELECT_TYPES_TITLE,
- false);
-
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- handleTypesEditButtonPressed();
- }
- };
- selectTypesButton.addSelectionListener(listener);
-
- selectAllButton =
- createButton(
- buttonComposite,
- IDialogConstants.SELECT_ALL_ID,
- SELECT_ALL_TITLE,
- false);
-
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setAllSelections(true);
- }
- };
- selectAllButton.addSelectionListener(listener);
-
- deselectAllButton =
- createButton(
- buttonComposite,
- IDialogConstants.DESELECT_ALL_ID,
- DESELECT_ALL_TITLE,
- false);
-
- listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setAllSelections(false);
- }
- };
- deselectAllButton.addSelectionListener(listener);
-
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
- super.createControl(parent);
- validateSourceGroup();
- WorkbenchHelp.setHelp(getControl(), IDataTransferHelpContextIds.FILE_SYSTEM_IMPORT_WIZARD_PAGE);
-}
-/**
- * Create the import options specification widgets.
- */
-protected void createOptionsGroupButtons(Group optionsGroup) {
-
- // overwrite... checkbox
- overwriteExistingResourcesCheckbox = new Button(optionsGroup, SWT.CHECK);
- overwriteExistingResourcesCheckbox.setFont(optionsGroup.getFont());
- overwriteExistingResourcesCheckbox.setText(
- DataTransferMessages.getString("FileImport.overwriteExisting")); //$NON-NLS-1$
-
- // create containers radio
- createContainerStructureButton = new Button(optionsGroup, SWT.RADIO);
- createContainerStructureButton.setFont(optionsGroup.getFont());
- createContainerStructureButton.setText(
- DataTransferMessages.getString("FileImport.createComplete")); //$NON-NLS-1$
- createContainerStructureButton.setSelection(false);
-
- // create selection only radio
- createOnlySelectedButton = new Button(optionsGroup, SWT.RADIO);
- createOnlySelectedButton.setFont(optionsGroup.getFont());
- createOnlySelectedButton.setText(
- DataTransferMessages.getString("FileImport.createSelectedFolders")); //$NON-NLS-1$
- createOnlySelectedButton.setSelection(true);
-
-
- }
-/**
- * Create the group for creating the root directory
- */
-protected void createRootDirectoryGroup(Composite parent) {
- Composite sourceContainerGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- sourceContainerGroup.setLayout(layout);
- sourceContainerGroup.setFont(parent.getFont());
- sourceContainerGroup.setLayoutData(
- new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- Label groupLabel = new Label(sourceContainerGroup, SWT.NONE);
- groupLabel.setText(getSourceLabel());
- groupLabel.setFont(parent.getFont());
-
- // source name entry field
- sourceNameField = new Combo(sourceContainerGroup, SWT.BORDER);
- GridData data =
- new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
- data.widthHint = SIZING_TEXT_FIELD_WIDTH;
- sourceNameField.setLayoutData(data);
- sourceNameField.setFont(parent.getFont());
-
- sourceNameField.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateFromSourceField();
- }
- });
-
-
- sourceNameField.addKeyListener(new KeyListener(){
- /*
- * @see KeyListener.keyPressed
- */
- public void keyPressed(KeyEvent e){
- //If there has been a key pressed then mark as dirty
- entryChanged = true;
- }
-
- /*
- * @see KeyListener.keyReleased
- */
- public void keyReleased(KeyEvent e){}
- });
-
- sourceNameField.addFocusListener(new FocusListener(){
- /*
- * @see FocusListener.focusGained(FocusEvent)
- */
- public void focusGained(FocusEvent e){
- //Do nothing when getting focus
- }
-
- /*
- * @see FocusListener.focusLost(FocusEvent)
- */
- public void focusLost(FocusEvent e){
- //Clear the flag to prevent constant update
- if(entryChanged){
- entryChanged = false;
- updateFromSourceField();
- }
-
- }
- });
-
- // source browse button
- sourceBrowseButton = new Button(sourceContainerGroup, SWT.PUSH);
- sourceBrowseButton.setText(DataTransferMessages.getString("DataTransfer.browse")); //$NON-NLS-1$
- sourceBrowseButton.addListener(SWT.Selection, this);
- sourceBrowseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
- sourceBrowseButton.setFont(parent.getFont());
-}
-
-/**
- * Update the receiver from the source name field.
- */
-
-private void updateFromSourceField(){
-
- setSourceName(sourceNameField.getText());
- //Update enablements when this is selected
- updateWidgetEnablements();
-}
-
-/**
- * Creates and returns a <code>FileSystemElement</code> if the specified
- * file system object merits one. The criteria for this are:
- * Also create the children.
- */
-protected MinimizedFileSystemElement createRootElement(
- Object fileSystemObject,
- IImportStructureProvider provider) {
- boolean isContainer = provider.isFolder(fileSystemObject);
- String elementLabel = provider.getLabel(fileSystemObject);
-
- // Use an empty label so that display of the element's full name
- // doesn't include a confusing label
- MinimizedFileSystemElement dummyParent =
- new MinimizedFileSystemElement("", null, true);//$NON-NLS-1$
- dummyParent.setPopulated();
- MinimizedFileSystemElement result =
- new MinimizedFileSystemElement(elementLabel, dummyParent, isContainer);
- result.setFileSystemObject(fileSystemObject);
-
- //Get the files for the element so as to build the first level
- result.getFiles(provider);
-
- return dummyParent;
-}
-/**
- * Create the import source specification widgets
- */
-protected void createSourceGroup(Composite parent) {
-
- createRootDirectoryGroup(parent);
- createFileSelectionGroup(parent);
- createButtonsGroup(parent);
-}
-/**
- * Enable or disable the button group.
- */
-protected void enableButtonGroup(boolean enable) {
- selectTypesButton.setEnabled(enable);
- selectAllButton.setEnabled(enable);
- deselectAllButton.setEnabled(enable);
-}
-/**
- * Answer a boolean indicating whether the specified source currently exists
- * and is valid
- */
-protected boolean ensureSourceIsValid() {
- if (new File(getSourceDirectoryName()).isDirectory())
- return true;
-
- displayErrorDialog(DataTransferMessages.getString("FileImport.invalidSource")); //$NON-NLS-1$
- sourceNameField.setFocus();
- return false;
-}
-/**
- * Execute the passed import operation. Answer a boolean indicating success.
- */
-protected boolean executeImportOperation(ImportOperation op) {
- initializeOperation(op);
-
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- displayErrorDialog(e.getTargetException());
- return false;
- }
-
- IStatus status = op.getStatus();
- if (!status.isOK()) {
- ErrorDialog.openError(getContainer().getShell(),
- DataTransferMessages.getString("FileImport.importProblems"), //$NON-NLS-1$
- null, // no special message
- status);
- return false;
- }
-
- return true;
-}
-/**
- * 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
- */
-public boolean finish() {
- if (!ensureSourceIsValid())
- return false;
-
- saveWidgetValues();
-
- Iterator resourcesEnum = getSelectedResources().iterator();
- List fileSystemObjects = new ArrayList();
- while (resourcesEnum.hasNext()) {
- fileSystemObjects.add(
- ((FileSystemElement) resourcesEnum.next()).getFileSystemObject());
- }
-
- if (fileSystemObjects.size() > 0)
- return importResources(fileSystemObjects);
-
- MessageDialog
- .openInformation(
- getContainer().getShell(),
- DataTransferMessages.getString("DataTransfer.information"), //$NON-NLS-1$
- DataTransferMessages.getString("FileImport.noneSelected")); //$NON-NLS-1$
-
- return false;
-}
-/**
- * Returns a content provider for <code>FileSystemElement</code>s that returns
- * only files as children.
- */
-protected ITreeContentProvider getFileProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof MinimizedFileSystemElement) {
- MinimizedFileSystemElement element = (MinimizedFileSystemElement) o;
- return element.getFiles(FileSystemStructureProvider.INSTANCE).getChildren(
- element);
- }
- return new Object[0];
- }
- };
-}
-/**
- * Answer the root FileSystemElement that represents the contents of
- * the currently-specified source. If this FileSystemElement is not
- * currently defined then create and return it.
- */
-protected MinimizedFileSystemElement getFileSystemTree() {
-
- File sourceDirectory = getSourceDirectory();
- if (sourceDirectory == null)
- return null;
-
- return selectFiles(sourceDirectory, FileSystemStructureProvider.INSTANCE);
-}
-/**
- * Returns a content provider for <code>FileSystemElement</code>s that returns
- * only folders as children.
- */
-protected ITreeContentProvider getFolderProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof MinimizedFileSystemElement) {
- MinimizedFileSystemElement element = (MinimizedFileSystemElement) o;
- return element.getFolders(FileSystemStructureProvider.INSTANCE).getChildren(
- element);
- }
- return new Object[0];
- }
- public boolean hasChildren(Object o) {
- if (o instanceof MinimizedFileSystemElement) {
- MinimizedFileSystemElement element = (MinimizedFileSystemElement) o;
- if (element.isPopulated())
- return getChildren(element).length > 0;
- else {
- //If we have not populated then wait until asked
- return true;
- }
- }
- return false;
- }
- };
-}
-
-/**
- * Returns a File object representing the currently-named source directory iff
- * it exists as a valid directory, or <code>null</code> otherwise.
- */
-protected File getSourceDirectory() {
- return getSourceDirectory(this.sourceNameField.getText());
-}
-/**
- * Returns a File object representing the currently-named source directory iff
- * it exists as a valid directory, or <code>null</code> otherwise.
- *
- * @param path a String not yet formatted for java.io.File compatability
- */
-private File getSourceDirectory(String path) {
- File sourceDirectory = new File(getSourceDirectoryName(path));
- if (!sourceDirectory.exists() || !sourceDirectory.isDirectory()) {
- return null;
- }
-
- return sourceDirectory;
-}
-/**
- * Answer the directory name specified as being the import source.
- * Note that if it ends with a separator then the separator is first
- * removed so that java treats it as a proper directory
- */
-private String getSourceDirectoryName() {
- return getSourceDirectoryName(this.sourceNameField.getText());
-}
-/**
- * Answer the directory name specified as being the import source.
- * Note that if it ends with a separator then the separator is first
- * removed so that java treats it as a proper directory
- */
-private String getSourceDirectoryName(String sourceName) {
- IPath result = new Path(sourceName.trim());
-
- if (result.getDevice() != null && result.segmentCount() == 0) // something like "c:"
- result = result.addTrailingSeparator();
- else
- result = result.removeTrailingSeparator();
-
- return result.toOSString();
-}
-/**
- * Answer the string to display as the label for the source specification field
- */
-protected String getSourceLabel() {
- return DataTransferMessages.getString("DataTransfer.directory"); //$NON-NLS-1$
-}
-/**
- * Handle all events and enablements for widgets in this dialog
- *
- * @param event Event
- */
-public void handleEvent(Event event) {
- if (event.widget == sourceBrowseButton)
- handleSourceBrowseButtonPressed();
-
- super.handleEvent(event);
-}
-/**
- * Open an appropriate source browser so that the user can specify a source
- * to import from
- */
-protected void handleSourceBrowseButtonPressed() {
-
- String currentSource = this.sourceNameField.getText();
- DirectoryDialog dialog =
- new DirectoryDialog(sourceNameField.getShell(), SWT.SAVE);
- dialog.setMessage(SELECT_SOURCE_MESSAGE);
- dialog.setFilterPath(getSourceDirectoryName(currentSource));
-
- String selectedDirectory = dialog.open();
- if (selectedDirectory != null) {
- //Just quit if the directory is not valid
- if ((getSourceDirectory(selectedDirectory) == null)
- || selectedDirectory.equals(currentSource))
- return;
- else { //If it is valid then proceed to populate
- setErrorMessage(null);
- setSourceName(selectedDirectory);
- selectionGroup.setFocus();
- }
- }
-}
-/**
- * Open a registered type selection dialog and note the selections
- * in the receivers types-to-export field.,
- * Added here so that inner classes can have access
- */
-protected void handleTypesEditButtonPressed() {
-
- super.handleTypesEditButtonPressed();
-}
-/**
- * Import the resources with extensions as specified by the user
- */
-protected boolean importResources(List fileSystemObjects) {
- return executeImportOperation(
- new ImportOperation(
- getContainerFullPath(),
- getSourceDirectory(),
- FileSystemStructureProvider.INSTANCE,
- this,
- fileSystemObjects));
-}
-/**
- * Initializes the specified operation appropriately.
- */
-protected void initializeOperation(ImportOperation op) {
- op.setCreateContainerStructure(createContainerStructureButton.getSelection());
- op.setOverwriteResources(overwriteExistingResourcesCheckbox.getSelection());
-}
-/**
- * Returns whether the extension provided is an extension that
- * has been specified for export by the user.
- *
- * @param extension the resource name
- * @return <code>true</code> if the resource name is suitable for export based
- * upon its extension
- */
-protected boolean isExportableExtension(String extension) {
- if (selectedTypes == null) // ie.- all extensions are acceptable
- return true;
-
- Iterator enum = selectedTypes.iterator();
- while (enum.hasNext()) {
- if (extension.equalsIgnoreCase((String)enum.next()))
- return true;
- }
-
- return false;
-}
-/**
- * Repopulate the view based on the currently entered directory.
- */
-protected void resetSelection() {
-
- MinimizedFileSystemElement currentRoot = getFileSystemTree();
- this.selectionGroup.setRoot(currentRoot);
-
-
-}
-/**
- * Use the dialog store to restore widget values to the values that they held
- * last time this wizard was used to completion
- */
-protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] sourceNames = settings.getArray(STORE_SOURCE_NAMES_ID);
- if (sourceNames == null)
- return; // ie.- no values stored, so stop
-
- // set filenames history
- for (int i = 0; i < sourceNames.length; i++)
- sourceNameField.add(sourceNames[i]);
-
- // radio buttons and checkboxes
- overwriteExistingResourcesCheckbox.setSelection(
- settings.getBoolean(STORE_OVERWRITE_EXISTING_RESOURCES_ID));
-
- boolean createStructure =
- settings.getBoolean(STORE_CREATE_CONTAINER_STRUCTURE_ID);
- createContainerStructureButton.setSelection(createStructure);
- createOnlySelectedButton.setSelection(!createStructure);
-
- }
-}
-/**
- * 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() {
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- // update source names history
- String[] sourceNames = settings.getArray(STORE_SOURCE_NAMES_ID);
- if (sourceNames == null)
- sourceNames = new String[0];
-
- sourceNames = addToHistory(sourceNames, getSourceDirectoryName());
- settings.put(STORE_SOURCE_NAMES_ID, sourceNames);
-
- // radio buttons and checkboxes
- settings.put(
- STORE_OVERWRITE_EXISTING_RESOURCES_ID,
- overwriteExistingResourcesCheckbox.getSelection());
-
- settings.put(
- STORE_CREATE_CONTAINER_STRUCTURE_ID,
- createContainerStructureButton.getSelection());
-
- }
-}
-/**
- * Invokes a file selection operation using the specified file system and
- * structure provider. If the user specifies files to be imported then
- * this selection is cached for later retrieval and is returned.
- */
-protected MinimizedFileSystemElement selectFiles(
- final Object rootFileSystemObject,
- final IImportStructureProvider structureProvider) {
-
- final MinimizedFileSystemElement[] results = new MinimizedFileSystemElement[1];
-
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- //Create the root element from the supplied file system object
- results[0] = createRootElement(rootFileSystemObject, structureProvider);
- }
- });
-
- return results[0];
-}
-/**
- * Set all of the selections in the selection group to value. Implemented here
- * to provide access for inner classes.
- * @param value boolean
- */
-protected void setAllSelections(boolean value) {
- super.setAllSelections(value);
-}
-/**
- * Sets the source name of the import to be the supplied path.
- * Adds the name of the path to the list of items in the
- * source combo and selects it.
- *
- * @param path the path to be added
- */
-protected void setSourceName(String path) {
-
- if (path.length() > 0) {
-
- String[] currentItems = this.sourceNameField.getItems();
- int selectionIndex = -1;
- for (int i = 0; i < currentItems.length; i++) {
- if (currentItems[i].equals(path))
- selectionIndex = i;
- }
- if (selectionIndex < 0) {
- int oldLength = currentItems.length;
- String[] newItems = new String[oldLength + 1];
- System.arraycopy(currentItems, 0, newItems, 0, oldLength);
- newItems[oldLength] = path;
- this.sourceNameField.setItems(newItems);
- selectionIndex = oldLength;
- }
- this.sourceNameField.select(selectionIndex);
-
- resetSelection();
- }
-}
-/**
- * Update the tree to only select those elements that match the selected types
- */
-protected void setupSelectionsBasedOnSelectedTypes() {
- ProgressMonitorDialog dialog = new ProgressMonitorDialog(getContainer().getShell());
- final Map selectionMap = new Hashtable();
-
- final IElementFilter filter = new IElementFilter() {
-
- public void filterElements(Collection files,IProgressMonitor monitor) throws InterruptedException{
- if(files == null){
- throw new InterruptedException();
- }
- Iterator filesList = files.iterator();
- while (filesList.hasNext()) {
- if(monitor.isCanceled())
- throw new InterruptedException();
- checkFile(filesList.next());
- }
- }
-
- public void filterElements(Object[] files,IProgressMonitor monitor) throws InterruptedException{
- if(files == null){
- throw new InterruptedException();
- }
- for(int i =0; i < files.length; i ++){
- if(monitor.isCanceled())
- throw new InterruptedException();
- checkFile(files[i]);
- }
- }
-
- private void checkFile(Object fileElement){
- MinimizedFileSystemElement file = (MinimizedFileSystemElement) fileElement;
- if (isExportableExtension(file.getFileNameExtension())) {
- List elements = new ArrayList();
- FileSystemElement parent = file.getParent();
- if (selectionMap.containsKey(parent))
- elements = (List) selectionMap.get(parent);
- elements.add(file);
- selectionMap.put(parent, elements);
- }
- }
-
- };
-
- IRunnableWithProgress runnable = new IRunnableWithProgress() {
- public void run(final IProgressMonitor monitor) throws InterruptedException{
- monitor.beginTask(DataTransferMessages.getString("ImportPage.filterSelections"), IProgressMonitor.UNKNOWN); //$NON-NLS-1$
- getSelectedResources(filter,monitor);
- }
- };
-
- try{
- dialog.run(true,true,runnable);
- }
- catch (InvocationTargetException exception){
- //Couldn't start. Do nothing.
- return;
- }
- catch (InterruptedException exception){
- //Got interrupted. Do nothing.
- return;
- }
- // make sure that all paint operations caused by closing the progress
- // dialog get flushed, otherwise extra pixels will remain on the screen until
- // updateSelections is completed
- getShell().update();
- // The updateSelections method accesses SWT widgets so cannot be executed
- // as part of the above progress dialog operation since the operation forks
- // a new process.
- if (selectionMap != null) {
- updateSelections(selectionMap);
- }
-}
-/* (non-Javadoc)
- * Method declared on IDialogPage. Set the selection up when it becomes visible.
- */
-public void setVisible(boolean visible) {
- super.setVisible(visible);
- resetSelection();
- if(visible)
- this.sourceNameField.setFocus();
-}
-/**
- * Update the selections with those in map . Implemented here to give inner class
- * visibility
- * @param map Map - key tree elements, values Lists of list elements
- */
-protected void updateSelections(Map map) {
- super.updateSelections(map);
-}
-/**
- * Check if widgets are enabled or disabled by a change in the dialog.
- * Provided here to give access to inner classes.
- * @param event Event
- */
-protected void updateWidgetEnablements() {
-
- super.updateWidgetEnablements();
-}
-/**
- * Answer a boolean indicating whether self's source specification
- * widgets currently all contain valid values.
- */
-protected boolean validateSourceGroup() {
- File sourceDirectory = getSourceDirectory();
- if (sourceDirectory == null) {
- setMessage(SOURCE_EMPTY_MESSAGE);
- enableButtonGroup(false);
- return false;
- }
-
- if(sourceConflictsWithDestination(new Path(sourceDirectory.getPath()))){
- setErrorMessage(getSourceConflictMessage()); //$NON-NLS-1$
- enableButtonGroup(false);
- return false;
- }
-
- enableButtonGroup(true);
- return true;
-}
-
-/**
- * Returns whether the source location conflicts
- * with the destination resource. This will occur if
- * the source is already under the destination.
- *
- * @param sourcePath the path to check
- * @return <code>true</code> if there is a conflict, <code>false</code> if not
- */
-protected boolean sourceConflictsWithDestination(IPath sourcePath){
-
- IContainer container = getSpecifiedContainer();
- if(container == null)
- return false;
- else
- return getSpecifiedContainer().getLocation().isPrefixOf(sourcePath);
-}
-
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileExportPage1.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileExportPage1.java
deleted file mode 100644
index 7aed33f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileExportPage1.java
+++ /dev/null
@@ -1,319 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.jface.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.*;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-import java.util.List;
-
-/**
- * Page 1 of the base resource export-to-zip Wizard
- * WizardFileSystemExportPage1
- * @deprecated use WizardZipFileResourceExportPage1
- */
-/*package*/ class WizardZipFileExportPage1 extends WizardFileSystemExportPage1 {
-
- // widgets
- protected Button overwriteExistingFileCheckbox;
- protected Button createDirectoryStructureCheckbox;
- protected Button compressContentsCheckbox;
-
- // constants
- protected static final int COMBO_HISTORY_LENGTH = 5;
-
- // dialog store id constants
- private final static String STORE_DESTINATION_NAMES_ID = "WizardZipFileExportPage1.STORE_DESTINATION_NAMES_ID";//$NON-NLS-1$
- private final static String STORE_OVERWRITE_EXISTING_FILE_ID = "WizardZipFileExportPage1.STORE_OVERWRITE_EXISTING_FILE_ID";//$NON-NLS-1$
- private final static String STORE_CREATE_STRUCTURE_ID = "WizardZipFileExportPage1.STORE_CREATE_STRUCTURE_ID";//$NON-NLS-1$
- private final static String STORE_COMPRESS_CONTENTS_ID = "WizardZipFileExportPage1.STORE_COMPRESS_CONTENTS_ID";//$NON-NLS-1$
-/**
- * Create an instance of this class. Note that this constructor
- * is here primarily to keep the JarFileExportPage1 subclass happy
- *
- * @param name java.lang.String
- */
-protected WizardZipFileExportPage1(String name, IStructuredSelection selection) {
- super(name, selection);
-}
-/**
- * Create an instance of this class
- */
-public WizardZipFileExportPage1(IStructuredSelection selection) {
- this("zipFileExportPage1", selection);//$NON-NLS-1$
- setTitle(DataTransferMessages.getString("ZipExport.exportTitle")); //$NON-NLS-1$
- setDescription(DataTransferMessages.getString("ZipExport.description")); //$NON-NLS-1$
-}
-/**
- * Create the export options specification widgets.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- */
-protected void createOptionsGroup(Composite parent) {
- // options group
- Composite optionsGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- optionsGroup.setLayout(layout);
- optionsGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- // overwrite... checkbox
- overwriteExistingFileCheckbox = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
- overwriteExistingFileCheckbox.setText(DataTransferMessages.getString("ZipExport.overwriteFile")); //$NON-NLS-1$
-
- // create directory structure checkbox
- createDirectoryStructureCheckbox = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
- createDirectoryStructureCheckbox.setText(DataTransferMessages.getString("ExportFile.createDirectoryStructure")); //$NON-NLS-1$
-
- // compress... checkbox
- compressContentsCheckbox = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
- compressContentsCheckbox.setText(DataTransferMessages.getString("ZipExport.compressContents")); //$NON-NLS-1$
-
- // initial setup
- createDirectoryStructureCheckbox.setSelection(true);
- compressContentsCheckbox.setSelection(true);
-}
-/**
- * Returns a boolean indicating whether the directory portion of the
- * passed pathname is valid and available for use.
- *
- * @return boolean
- */
-protected boolean ensureTargetDirectoryIsValid(String fullPathname) {
- int separatorIndex = fullPathname.lastIndexOf(File.separator);
-
- if (separatorIndex == -1) // ie.- default dir, which is fine
- return true;
-
- return ensureTargetIsValid(new File(fullPathname.substring(0,separatorIndex)));
-}
-/**
- * Returns a boolean indicating whether the passed File handle is
- * is valid and available for use.
- *
- * @return boolean
- */
-protected boolean ensureTargetFileIsValid(File targetFile) {
- if (targetFile.exists() && targetFile.isDirectory()) {
- displayErrorDialog(DataTransferMessages.getString("ZipExport.mustBeFile")); //$NON-NLS-1$
- giveFocusToDestination();
- return false;
- }
-
- if (targetFile.exists()) {
- if (!overwriteExistingFileCheckbox.getSelection() && targetFile.canWrite()) {
- if (!queryYesNoQuestion(DataTransferMessages.getString("ZipExport.alreadyExists"))) //$NON-NLS-1$
- return false;
- }
-
- if (!targetFile.canWrite()) {
- displayErrorDialog(DataTransferMessages.getString("ZipExport.alreadyExistsError")); //$NON-NLS-1$
- giveFocusToDestination();
- return false;
- }
- }
-
- return true;
-}
-/**
- * Ensures that the target output file and its containing directory are
- * both valid and able to be used. Answer a boolean indicating these.
- *
- * @return boolean
- */
-protected boolean ensureTargetIsValid() {
- String targetPath = getDestinationValue();
-
- if (!ensureTargetDirectoryIsValid(targetPath))
- return false;
-
- if (!ensureTargetFileIsValid(new File(targetPath)))
- return false;
-
- return true;
-}
-/**
- * Export the passed resource and recursively export all of its child resources
- * (iff it's a container). Answer a boolean indicating success.
- *
- * @return boolean
- */
-protected boolean executeExportOperation(ZipFileExportOperation op) {
- op.setCreateLeadupStructure(createDirectoryStructureCheckbox.getSelection());
- op.setUseCompression(compressContentsCheckbox.getSelection());
-
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- displayErrorDialog(e.getTargetException().getMessage());
- return false;
- }
-
- IStatus status = op.getStatus();
- if (!status.isOK()) {
- ErrorDialog.openError(getContainer().getShell(),
- DataTransferMessages.getString("DataTransfer.exportProblems"), //$NON-NLS-1$
- null, // no special message
- status);
- return false;
- }
-
- return true;
-}
-/**
- * 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
- */
-public boolean finish() {
- if (!ensureTargetIsValid())
- return false;
-
- List resourcesToExport = getSelectedResources();
-
- // about to invoke the operation so save our state
- saveWidgetValues();
-
- if (resourcesToExport.size() > 0)
- return executeExportOperation(
- new ZipFileExportOperation(
- null,
- resourcesToExport,
- getDestinationValue()));
-
- MessageDialog.openInformation(
- getContainer().getShell(),
- DataTransferMessages.getString("DataTransfer.information"), //$NON-NLS-1$
- DataTransferMessages.getString("FileExport.noneSelected")); //$NON-NLS-1$
-
- return false;
-}
-/**
- * Answer the string to display in self as the destination type
- *
- * @return java.lang.String
- */
-protected String getDestinationLabel() {
- return DataTransferMessages.getString("ZipExport.destinationLabel"); //$NON-NLS-1$
-}
-/**
- * Answer the contents of self's destination specification widget. If this
- * value does not have the required suffix then add it first.
- *
- * @return java.lang.String
- */
-protected String getDestinationValue() {
- String requiredSuffix = getOutputSuffix();
- String destinationText = super.getDestinationValue();
-
- if (!destinationText.toLowerCase().endsWith(requiredSuffix.toLowerCase()))
- destinationText += requiredSuffix;
-
- return destinationText;
-}
-/**
- * Answer the suffix that files exported from this wizard must have.
- * If this suffix is a file extension (which is typically the case)
- * then it must include the leading period character.
- *
- * @return java.lang.String
- */
-protected String getOutputSuffix() {
- return ".zip";//$NON-NLS-1$
-}
-/**
- * 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(),SWT.SAVE);
- dialog.setFilterExtensions(new String[] {"*.jar;*.zip"});//$NON-NLS-1$
-
- String currentSourceString = getDestinationValue();
- int lastSeparatorIndex = currentSourceString.lastIndexOf(File.separator);
- if (lastSeparatorIndex != -1)
- dialog.setFilterPath(currentSourceString.substring(0,lastSeparatorIndex));
- String selectedFileName = dialog.open();
-
- if (selectedFileName != null)
- setDestinationValue(selectedFileName);
-}
-/**
- * Hook method for saving widget values for restoration by the next instance
- * of this class.
- */
-protected void internalSaveWidgetValues() {
- // update directory names history
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
- if (directoryNames == null)
- directoryNames = new String[0];
- String[] newDirectoryNames = new String[directoryNames.length + 1];
- System.arraycopy(directoryNames,0,newDirectoryNames,1,directoryNames.length);
- newDirectoryNames[0] = getDestinationValue();
-
- settings.put(
- STORE_DESTINATION_NAMES_ID,
- directoryNames);
-
- // options
- settings.put(
- STORE_OVERWRITE_EXISTING_FILE_ID,
- overwriteExistingFileCheckbox.getSelection());
-
- settings.put(
- STORE_CREATE_STRUCTURE_ID,
- createDirectoryStructureCheckbox.getSelection());
-
- settings.put(
- STORE_COMPRESS_CONTENTS_ID,
- compressContentsCheckbox.getSelection());
- }
-}
-/**
- * Hook method for restoring widget values to the values that they held
- * last time this wizard was used to completion.
- */
-protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
- if (directoryNames == null || directoryNames.length == 0)
- return; // ie.- no settings stored
-
- // destination
- setDestinationValue(directoryNames[0]);
- for (int i = 0; i < directoryNames.length; i++)
- addDestinationItem(directoryNames[i]);
-
- // options
- overwriteExistingFileCheckbox.setSelection(
- settings.getBoolean(STORE_OVERWRITE_EXISTING_FILE_ID));
-
- createDirectoryStructureCheckbox.setSelection(
- settings.getBoolean(STORE_CREATE_STRUCTURE_ID));
-
- compressContentsCheckbox.setSelection(
- settings.getBoolean(STORE_COMPRESS_CONTENTS_ID));
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileImportPage1.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileImportPage1.java
deleted file mode 100644
index 7012a54..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileImportPage1.java
+++ /dev/null
@@ -1,322 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-import java.util.*;
-import java.util.List;
-import java.util.zip.*;
-
-/**
- * Page 1 of the base resource import-from-zip Wizard.
- *
- * Note that importing from .jar is identical to importing from .zip, so
- * all references to .zip in this class are equally applicable to .jar
- * references.
- * @deprecated use WizardZipFileResourceImportPage1
- */
-/*package*/ class WizardZipFileImportPage1 extends WizardFileSystemImportPage1 implements ISelectionChangedListener, Listener {
- private ZipFileStructureProvider providerCache;
-
- // constants
- private static final int COMBO_HISTORY_LENGTH = 5;
- private static final String FILE_IMPORT_MASK = "*.jar;*.zip";//$NON-NLS-1$
-
- // dialog store id constants
- private final static String STORE_SOURCE_NAMES_ID = "WizardZipFileImportPage1.STORE_SOURCE_NAMES_ID";//$NON-NLS-1$
- private final static String STORE_IMPORT_ALL_RESOURCES_ID = "WizardZipFileImportPage1.STORE_IMPORT_ALL_ENTRIES_ID";//$NON-NLS-1$
- private final static String STORE_OVERWRITE_EXISTING_RESOURCES_ID = "WizardZipFileImportPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID";//$NON-NLS-1$
- private final static String STORE_SELECTED_TYPES_ID = "WizardZipFileImportPage1.STORE_SELECTED_TYPES_ID";//$NON-NLS-1$
-/**
- * Creates an instance of this class
- */
-public WizardZipFileImportPage1(IWorkbench aWorkbench, IStructuredSelection selection) {
- super("zipFileImportPage1", aWorkbench, selection);//$NON-NLS-1$
- setTitle(DataTransferMessages.getString("ZipExport.exportTitle")); //$NON-NLS-1$
- setDescription(DataTransferMessages.getString("ZipImport.description")); //$NON-NLS-1$
-}
-/**
- * Called when the user presses the Cancel button. Return a boolean
- * indicating permission to close the wizard.
- */
-public boolean cancel() {
- clearProviderCache();
- return true;
-}
-/**
- * Clears the cached structure provider after first finalizing
- * it properly.
- */
-protected void clearProviderCache() {
- if (providerCache != null) {
- closeZipFile(providerCache.getZipFile());
- providerCache = null;
- }
-}
-/**
- * Attempts to close the passed zip file, and answers a boolean indicating success.
- */
-protected boolean closeZipFile(ZipFile file) {
- try {
- file.close();
- } catch (IOException e) {
- displayErrorDialog(DataTransferMessages.format("ZipImport.couldNotClose", new Object [] {file.getName()})); //$NON-NLS-1$
- return false;
- }
-
- return true;
-}
-/**
- * Create the import options specification widgets.
- */
-protected void createOptionsGroup(Composite parent) {
- // options group
- Composite optionsGroup = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = 0;
- optionsGroup.setLayout(layout);
- optionsGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
-
- // overwrite... checkbox
- overwriteExistingResourcesCheckbox = new Button(optionsGroup,SWT.CHECK);
- overwriteExistingResourcesCheckbox.setText(DataTransferMessages.getString("FileImport.overwriteExisting")); //$NON-NLS-1$
-}
-/**
- * Display the appropriate string representing a selection of the
- * passed size.
- */
-protected void displaySelectedCount(int selectedEntryCount) {
- if (selectedEntryCount == 1)
- detailsDescriptionLabel.setText(DataTransferMessages.getString("ImportPage.oneSelected")); //$NON-NLS-1$
- else
- detailsDescriptionLabel.setText(DataTransferMessages.format("ZipImport.entriesSelected",new Object[] {String.valueOf(selectedEntryCount)})); //$NON-NLS-1$
-}
-/**
- * Answer a boolean indicating whether the specified source currently exists
- * and is valid (ie.- proper format)
- */
-protected boolean ensureSourceIsValid() {
- ZipFile specifiedFile = getSpecifiedSourceFile();
-
- if (specifiedFile == null)
- return false;
-
- return closeZipFile(specifiedFile);
-}
-/**
- * The Finish button was pressed. Try to do the required work now and answer
- * a boolean indicating success. If <code>false</code> is returned then the
- * wizard will not close.
- */
-public boolean finish() {
- if (!super.finish())
- return false;
-
- clearProviderCache();
- return true;
-}
-/**
- * Answer the root FileSystemElement that represents the contents of the
- * currently-specified .zip file. If this FileSystemElement is not
- * currently defined then create and return it.
- */
-protected FileSystemElement getFileSystemTree() {
- if (getRoot() != null)
- return getRoot();
-
- ZipFile sourceFile = getSpecifiedSourceFile();
- if (sourceFile == null)
- return null;
-
- ZipFileStructureProvider provider = getStructureProvider(sourceFile);
- return selectFiles(provider.getRoot(),provider);
-}
-/**
- * Answer the string to display as the label for the source specification field
- */
-protected String getSourceLabel() {
- return DataTransferMessages.getString("ZipExport.destinationLabel"); //$NON-NLS-1$
-}
-/**
- * Answer a handle to the zip file currently specified as being the source.
- * Return null if this file does not exist or is not of valid format.
- */
-protected ZipFile getSpecifiedSourceFile() {
- try {
- return new ZipFile(sourceNameField.getText());
- } catch (ZipException e) {
- displayErrorDialog(DataTransferMessages.getString("ZipImport.badFormat")); //$NON-NLS-1$
- } catch (IOException e) {
- displayErrorDialog(DataTransferMessages.getString("ZipImport.couldNotRead")); //$NON-NLS-1$
- }
-
- sourceNameField.setFocus();
- return null;
-}
-/**
- * Returns a structure provider for the specified zip file.
- */
-protected ZipFileStructureProvider getStructureProvider(ZipFile targetZip) {
- if (providerCache == null)
- providerCache = new ZipFileStructureProvider(targetZip);
- else if (!providerCache.getZipFile().getName().equals(targetZip.getName())) {
- clearProviderCache(); // ie.- new value, so finalize&remove old value
- providerCache = new ZipFileStructureProvider(targetZip);
- } else if (!providerCache.getZipFile().equals(targetZip))
- closeZipFile(targetZip); // ie.- duplicate handle to same .zip
-
- return providerCache;
-}
-/**
- * Open a FileDialog so that the user can specify the source
- * file to import from
- */
-protected void handleSourceBrowseButtonPressed() {
- String selectedFile = queryZipFileToImport();
-
- if (selectedFile != null) {
- if (!selectedFile.equals(sourceNameField.getText())) {
- resetSelection();
- sourceNameField.setText(selectedFile);
- }
- }
-}
-/**
- * Recursively import all resources starting at the user-specified source location.
- * Answer a boolean indicating success.
- */
-protected boolean importAllResources() {
- ZipFileStructureProvider structureProvider = getStructureProvider(getSpecifiedSourceFile());
-
- return executeImportOperation(
- new ImportOperation(
- getContainerFullPath(),
- structureProvider.getRoot(),
- structureProvider,
- this));
-}
-/**
- * Import the resources with extensions as specified by the user
- */
-protected boolean importResources(List fileSystemObjects) {
- ZipFileStructureProvider structureProvider = getStructureProvider(getSpecifiedSourceFile());
-
- return executeImportOperation(
- new ImportOperation(
- getContainerFullPath(),
- structureProvider.getRoot(),
- structureProvider,
- this,
- fileSystemObjects));
-}
-/**
- * Initializes the specified operation appropriately.
- */
-protected void initializeOperation(ImportOperation op) {
- op.setOverwriteResources(overwriteExistingResourcesCheckbox.getSelection());
-}
-/**
- * Opens a file selection dialog and returns a string representing the
- * selected file, or <code>null</code> if the dialog was canceled.
- */
-protected String queryZipFileToImport() {
- FileDialog dialog = new FileDialog(sourceNameField.getShell(),SWT.OPEN);
- dialog.setFilterExtensions(new String[] {FILE_IMPORT_MASK});
-
- String currentSourceString = sourceNameField.getText();
- int lastSeparatorIndex = currentSourceString.lastIndexOf(File.separator);
- if (lastSeparatorIndex != -1)
- dialog.setFilterPath(currentSourceString.substring(0,lastSeparatorIndex));
-
- return dialog.open();
-}
-/**
- * Use the dialog store to restore widget values to the values that they held
- * last time this wizard was used to completion
- */
-protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- String[] sourceNames = settings.getArray(STORE_SOURCE_NAMES_ID);
- if (sourceNames == null)
- return; // ie.- no settings stored
-
- // set all/specific types radios and related enablements
- if (settings.getBoolean(STORE_IMPORT_ALL_RESOURCES_ID)) {
- importAllResourcesRadio.setSelection(true);
- importTypedResourcesRadio.setSelection(false);
- } else {
- importTypedResourcesRadio.setSelection(true);
- importAllResourcesRadio.setSelection(false);
- }
-
- // set filenames history
- sourceNameField.setText(sourceNames[0]);
- for (int i = 0; i < sourceNames.length; i++)
- sourceNameField.add(sourceNames[i]);
-
- // set selected types
- String[] selectedTypes = settings.getArray(STORE_SELECTED_TYPES_ID);
- if (selectedTypes.length > 0)
- typesToImportField.setText((String)selectedTypes[0]);
- for (int i = 0; i < selectedTypes.length; i++)
- typesToImportField.add((String)selectedTypes[i]);
-
- // radio buttons and checkboxes
- overwriteExistingResourcesCheckbox.setSelection(
- settings.getBoolean(STORE_OVERWRITE_EXISTING_RESOURCES_ID));
- }
-}
-/**
- * Since Finish was pressed, write widget values to the dialog store so that they
- * will persist into the next invocation of this wizard page.
- *
- * Note that this method is identical to the one that appears in the superclass.
- * This is necessary because proper overriding of instance variables is not occurring.
- */
-protected void saveWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- // update source names history
- String[] sourceNames = settings.getArray(STORE_SOURCE_NAMES_ID);
- if (sourceNames == null)
- sourceNames = new String[0];
-
- sourceNames = addToHistory(sourceNames,sourceNameField.getText());
- settings.put(
- STORE_SOURCE_NAMES_ID,
- sourceNames);
-
- // update specific types to import history
- String[] selectedTypesNames = settings.getArray(STORE_SELECTED_TYPES_ID);
- if (selectedTypesNames == null)
- selectedTypesNames = new String[0];
-
- if (importTypedResourcesRadio.getSelection())
- selectedTypesNames = addToHistory(selectedTypesNames,typesToImportField.getText());
- settings.put(
- STORE_SELECTED_TYPES_ID,
- selectedTypesNames);
-
- // radio buttons and checkboxes
- settings.put(
- STORE_IMPORT_ALL_RESOURCES_ID,
- importAllResourcesRadio.getSelection());
-
- settings.put(
- STORE_OVERWRITE_EXISTING_RESOURCES_ID,
- overwriteExistingResourcesCheckbox.getSelection());
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileResourceExportPage1.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileResourceExportPage1.java
deleted file mode 100644
index 365fd37..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileResourceExportPage1.java
+++ /dev/null
@@ -1,311 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.jface.*;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.operation.*;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-import java.util.List;
-
-/**
- * Page 1 of the base resource export-to-zip Wizard
- */
-/*package*/
-class WizardZipFileResourceExportPage1
- extends WizardFileSystemResourceExportPage1 {
-
- // widgets
- protected Button compressContentsCheckbox;
-
- // constants
- protected static final int COMBO_HISTORY_LENGTH = 5;
-
- // dialog store id constants
- private final static String STORE_DESTINATION_NAMES_ID =
- "WizardZipFileResourceExportPage1.STORE_DESTINATION_NAMES_ID";//$NON-NLS-1$
- private final static String STORE_OVERWRITE_EXISTING_FILE_ID =
- "WizardZipFileResourceExportPage1.STORE_OVERWRITE_EXISTING_FILE_ID";//$NON-NLS-1$
- private final static String STORE_CREATE_STRUCTURE_ID =
- "WizardZipFileResourceExportPage1.STORE_CREATE_STRUCTURE_ID";//$NON-NLS-1$
- private final static String STORE_COMPRESS_CONTENTS_ID =
- "WizardZipFileResourceExportPage1.STORE_COMPRESS_CONTENTS_ID";//$NON-NLS-1$
-/**
- * Create an instance of this class.
- *
- * @param name java.lang.String
- */
-protected WizardZipFileResourceExportPage1(String name, IStructuredSelection selection) {
- super(name, selection);
-}
-/**
- * Create an instance of this class
- * @param IStructuredSelection selection
- */
-public WizardZipFileResourceExportPage1(IStructuredSelection selection) {
- this("zipFileExportPage1", selection);//$NON-NLS-1$
- setTitle(DataTransferMessages.getString("ZipExport.exportTitle")); //$NON-NLS-1$
- setDescription(DataTransferMessages.getString("ZipExport.description")); //$NON-NLS-1$
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
- super.createControl(parent);
- WorkbenchHelp.setHelp(getControl(), IDataTransferHelpContextIds.ZIP_FILE_EXPORT_WIZARD_PAGE);
-}
-/**
- * Create the export options specification widgets.
- *
- */
-protected void createOptionsGroupButtons(Group optionsGroup) {
-
- // compress... checkbox
- compressContentsCheckbox = new Button(optionsGroup, SWT.CHECK | SWT.LEFT);
- compressContentsCheckbox.setText(DataTransferMessages.getString("ZipExport.compressContents")); //$NON-NLS-1$
- compressContentsCheckbox.setFont(optionsGroup.getFont());
-
- super.createOptionsGroupButtons(optionsGroup);
-
- // initial setup
- createDirectoryStructureButton.setSelection(true);
- createSelectionOnlyButton.setSelection(false);
- compressContentsCheckbox.setSelection(true);
-}
-/**
- * Returns a boolean indicating whether the directory portion of the
- * passed pathname is valid and available for use.
- */
-protected boolean ensureTargetDirectoryIsValid(String fullPathname) {
- int separatorIndex = fullPathname.lastIndexOf(File.separator);
-
- if (separatorIndex == -1) // ie.- default dir, which is fine
- return true;
-
- return ensureTargetIsValid(new File(fullPathname.substring(0,separatorIndex)));
-}
-/**
- * Returns a boolean indicating whether the passed File handle is
- * is valid and available for use.
- */
-protected boolean ensureTargetFileIsValid(File targetFile) {
- if (targetFile.exists() && targetFile.isDirectory()) {
- displayErrorDialog(DataTransferMessages.getString("ZipExport.mustBeFile")); //$NON-NLS-1$
- giveFocusToDestination();
- return false;
- }
-
- if (targetFile.exists()) {
- if (!overwriteExistingFilesCheckbox.getSelection() && targetFile.canWrite()) {
- if (!queryYesNoQuestion(DataTransferMessages.getString("ZipExport.alreadyExists"))) //$NON-NLS-1$
- return false;
- }
-
- if (!targetFile.canWrite()) {
- displayErrorDialog(DataTransferMessages.getString("ZipExport.alreadyExistsError")); //$NON-NLS-1$
- giveFocusToDestination();
- return false;
- }
- }
-
- return true;
-}
-/**
- * Ensures that the target output file and its containing directory are
- * both valid and able to be used. Answer a boolean indicating validity.
- */
-protected boolean ensureTargetIsValid() {
- String targetPath = getDestinationValue();
-
- if (!ensureTargetDirectoryIsValid(targetPath))
- return false;
-
- if (!ensureTargetFileIsValid(new File(targetPath)))
- return false;
-
- return true;
-}
-/**
- * Export the passed resource and recursively export all of its child resources
- * (iff it's a container). Answer a boolean indicating success.
- */
-protected boolean executeExportOperation(ZipFileExportOperation op) {
- op.setCreateLeadupStructure(createDirectoryStructureButton.getSelection());
- op.setUseCompression(compressContentsCheckbox.getSelection());
-
- try {
- getContainer().run(true, true, op);
- } catch (InterruptedException e) {
- return false;
- } catch (InvocationTargetException e) {
- displayErrorDialog(e.getTargetException());
- return false;
- }
-
- IStatus status = op.getStatus();
- if (!status.isOK()) {
- ErrorDialog.openError(getContainer().getShell(),
- DataTransferMessages.getString("DataTransfer.exportProblems"), //$NON-NLS-1$
- null, // no special message
- status);
- return false;
- }
-
- return true;
-}
-/**
- * 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.
- * @returns boolean
- */
-public boolean finish() {
- if (!ensureTargetIsValid())
- return false;
-
- List resourcesToExport = getWhiteCheckedResources();
-
- //Save dirty editors if possible but do not stop if not all are saved
- saveDirtyEditors();
- // about to invoke the operation so save our state
- saveWidgetValues();
-
- if (resourcesToExport.size() > 0)
- return executeExportOperation(
- new ZipFileExportOperation(
- null,
- resourcesToExport,
- getDestinationValue()));
-
- MessageDialog.openInformation(
- getContainer().getShell(),
- DataTransferMessages.getString("DataTransfer.information"), //$NON-NLS-1$
- DataTransferMessages.getString("FileExport.noneSelected")); //$NON-NLS-1$
-
- return false;
-}
-/**
- * Answer the string to display in the receiver as the destination type
- */
-protected String getDestinationLabel() {
- return DataTransferMessages.getString("ZipExport.destinationLabel"); //$NON-NLS-1$
-}
-/**
- * Answer the contents of self's destination specification widget. If this
- * value does not have the required suffix then add it first.
- */
-protected String getDestinationValue() {
- String requiredSuffix = getOutputSuffix();
- String destinationText = super.getDestinationValue();
-
- if (destinationText.length() != 0) {
- // only append a suffix if a value has been specified for the destination
- if (!destinationText.toLowerCase().endsWith(requiredSuffix.toLowerCase()))
- destinationText += requiredSuffix;
- }
-
- return destinationText;
-}
-/**
- * Answer the suffix that files exported from this wizard must have.
- * If this suffix is a file extension (which is typically the case)
- * then it must include the leading period character.
- *
- */
-protected String getOutputSuffix() {
- return ".zip";//$NON-NLS-1$
-}
-/**
- * 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(),SWT.SAVE);
- dialog.setFilterExtensions(new String[] {"*.zip"});//$NON-NLS-1$
-
- String currentSourceString = getDestinationValue();
- int lastSeparatorIndex = currentSourceString.lastIndexOf(File.separator);
- if (lastSeparatorIndex != -1)
- dialog.setFilterPath(currentSourceString.substring(0,lastSeparatorIndex));
- String selectedFileName = dialog.open();
-
- if (selectedFileName != null){
- setErrorMessage(null);
- setDestinationValue(selectedFileName);
- }
-}
-/**
- * Hook method for saving widget values for restoration by the next instance
- * of this class.
- */
-protected void internalSaveWidgetValues() {
- // update directory names history
- IDialogSettings settings = getDialogSettings();
- if (settings != null) {
- String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
- if (directoryNames == null)
- directoryNames = new String[0];
-
- directoryNames = addToHistory(directoryNames, getDestinationValue());
- settings.put(STORE_DESTINATION_NAMES_ID, directoryNames);
-
- // options
- settings.put(
- STORE_OVERWRITE_EXISTING_FILE_ID,
- overwriteExistingFilesCheckbox.getSelection());
-
- settings.put(
- STORE_CREATE_STRUCTURE_ID,
- createDirectoryStructureButton.getSelection());
-
- settings.put(
- STORE_COMPRESS_CONTENTS_ID,
- compressContentsCheckbox.getSelection());
- }
-}
-/**
- * Hook method for restoring widget values to the values that they held
- * last time this wizard was used to completion.
- */
-protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- String[] directoryNames = settings.getArray(STORE_DESTINATION_NAMES_ID);
- if (directoryNames == null || directoryNames.length == 0)
- return; // ie.- no settings stored
-
- // destination
- setDestinationValue(directoryNames[0]);
- for (int i = 0; i < directoryNames.length; i++)
- addDestinationItem(directoryNames[i]);
-
- // options
- overwriteExistingFilesCheckbox.setSelection(
- settings.getBoolean(STORE_OVERWRITE_EXISTING_FILE_ID));
-
- boolean setStructure =
- settings.getBoolean(STORE_CREATE_STRUCTURE_ID);
-
- createDirectoryStructureButton.setSelection(setStructure);
- createSelectionOnlyButton.setSelection(!setStructure);
-
- compressContentsCheckbox.setSelection(
- settings.getBoolean(STORE_COMPRESS_CONTENTS_ID));
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileResourceImportPage1.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileResourceImportPage1.java
deleted file mode 100644
index ffaf24e..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/WizardZipFileResourceImportPage1.java
+++ /dev/null
@@ -1,387 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.wizards.datatransfer.*;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-import java.util.*;
-import java.util.List;
-import java.util.zip.*;
-
-/**
- * Page 1 of the base resource import-from-zip Wizard.
- *
- * Note that importing from .jar is identical to importing from .zip, so
- * all references to .zip in this class are equally applicable to .jar
- * references.
- */
-/*package*/
-class WizardZipFileResourceImportPage1
- extends WizardFileSystemResourceImportPage1
- implements Listener {
- private ZipFileStructureProvider providerCache;
- ZipFileStructureProvider currentProvider;
-
- // constants
- private static final int COMBO_HISTORY_LENGTH = 5;
- private static final String FILE_IMPORT_MASK = "*.jar;*.zip";//$NON-NLS-1$
-
- // dialog store id constants
- private final static String STORE_SOURCE_NAMES_ID =
- "WizardZipFileResourceImportPage1.STORE_SOURCE_NAMES_ID";//$NON-NLS-1$
- private final static String STORE_IMPORT_ALL_RESOURCES_ID =
- "WizardZipFileResourceImportPage1.STORE_IMPORT_ALL_ENTRIES_ID";//$NON-NLS-1$
- private final static String STORE_OVERWRITE_EXISTING_RESOURCES_ID =
- "WizardZipFileResourceImportPage1.STORE_OVERWRITE_EXISTING_RESOURCES_ID";//$NON-NLS-1$
- private final static String STORE_SELECTED_TYPES_ID =
- "WizardZipFileResourceImportPage1.STORE_SELECTED_TYPES_ID";//$NON-NLS-1$
-/**
- * Creates an instance of this class
- * @param aWorkbench IWorkbench
- * @param selection IStructuredSelection
- */
-public WizardZipFileResourceImportPage1(IWorkbench aWorkbench, IStructuredSelection selection) {
- super("zipFileImportPage1", aWorkbench, selection);//$NON-NLS-1$
- setTitle(DataTransferMessages.getString("ZipExport.exportTitle")); //$NON-NLS-1$
- setDescription(DataTransferMessages.getString("ZipImport.description")); //$NON-NLS-1$
-}
-/**
- * Called when the user presses the Cancel button. Return a boolean
- * indicating permission to close the wizard.
- *
- * @return boolean
- */
-public boolean cancel() {
- clearProviderCache();
- return true;
-}
-/**
- * Clears the cached structure provider after first finalizing
- * it properly.
- */
-protected void clearProviderCache() {
- if (providerCache != null) {
- closeZipFile(providerCache.getZipFile());
- providerCache = null;
- }
-}
-/**
- * Attempts to close the passed zip file, and answers a boolean indicating success.
- */
-protected boolean closeZipFile(ZipFile file) {
- try {
- file.close();
- } catch (IOException e) {
- displayErrorDialog(DataTransferMessages.format("ZipImport.couldNotClose", new Object[] {file.getName()})); //$NON-NLS-1$
- return false;
- }
-
- return true;
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
- super.createControl(parent);
- WorkbenchHelp.setHelp(getControl(), IDataTransferHelpContextIds.ZIP_FILE_IMPORT_WIZARD_PAGE);
-}
-/**
- * Create the options specification widgets. There is only one
- * in this case so create no group.
- *
- * @param parent org.eclipse.swt.widgets.Composite
- */
-protected void createOptionsGroup(Composite parent) {
-
- //create a spacer first
-
- createSpacer(parent);
-
- // overwrite... checkbox
- overwriteExistingResourcesCheckbox = new Button(parent,SWT.CHECK);
- overwriteExistingResourcesCheckbox.setText(DataTransferMessages.getString("FileImport.overwriteExisting")); //$NON-NLS-1$
- overwriteExistingResourcesCheckbox.setFont(parent.getFont());
-}
-/**
- * Answer a boolean indicating whether the specified source currently exists
- * and is valid (ie.- proper format)
- */
-protected boolean ensureSourceIsValid() {
- ZipFile specifiedFile = getSpecifiedSourceFile();
-
- if (specifiedFile == null)
- return false;
-
- return closeZipFile(specifiedFile);
-}
-/**
- * The Finish button was pressed. Try to do the required work now and answer
- * a boolean indicating success. If <code>false</code> is returned then the
- * wizard will not close.
- *
- * @return boolean
- */
-public boolean finish() {
- if (!super.finish())
- return false;
-
- clearProviderCache();
- return true;
-}
-/**
- * Returns a content provider for <code>FileSystemElement</code>s that returns
- * only files as children.
- */
-protected ITreeContentProvider getFileProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof MinimizedFileSystemElement) {
- MinimizedFileSystemElement element = (MinimizedFileSystemElement) o;
- return element.getFiles(currentProvider).getChildren(
- element);
- }
- return new Object[0];
- }
- };
-}
-/**
- * Answer the root FileSystemElement that represents the contents of the
- * currently-specified .zip file. If this FileSystemElement is not
- * currently defined then create and return it.
- */
-protected MinimizedFileSystemElement getFileSystemTree() {
-
- ZipFile sourceFile = getSpecifiedSourceFile();
- if (sourceFile == null) {
- //Clear out the provider as well
- this.currentProvider = null;
- return null;
- }
-
- ZipFileStructureProvider provider = getStructureProvider(sourceFile);
- this.currentProvider = provider;
- return selectFiles(provider.getRoot(), provider);
-}
-/**
- * Returns a content provider for <code>FileSystemElement</code>s that returns
- * only folders as children.
- */
-protected ITreeContentProvider getFolderProvider() {
- return new WorkbenchContentProvider() {
- public Object[] getChildren(Object o) {
- if (o instanceof MinimizedFileSystemElement) {
- MinimizedFileSystemElement element = (MinimizedFileSystemElement) o;
- return element.getFolders(currentProvider).getChildren(
- element);
- }
- return new Object[0];
- }
- public boolean hasChildren(Object o) {
- if (o instanceof MinimizedFileSystemElement) {
- MinimizedFileSystemElement element = (MinimizedFileSystemElement) o;
- if (element.isPopulated())
- return getChildren(element).length > 0;
- else {
- //If we have not populated then wait until asked
- return true;
- }
- }
- return false;
- }
- };
-}
-/**
- * Answer the string to display as the label for the source specification field
- */
-protected String getSourceLabel() {
- return DataTransferMessages.getString("ZipExport.destinationLabel"); //$NON-NLS-1$
-}
-/**
- * Answer a handle to the zip file currently specified as being the source.
- * Return null if this file does not exist or is not of valid format.
- */
-protected ZipFile getSpecifiedSourceFile() {
- return getSpecifiedSourceFile(sourceNameField.getText());
-}
-/**
- * Answer a handle to the zip file currently specified as being the source.
- * Return null if this file does not exist or is not of valid format.
- */
-private ZipFile getSpecifiedSourceFile(String fileName) {
- if(fileName.length() == 0)
- return null;
-
- try {
- return new ZipFile(fileName);
- } catch (ZipException e) {
- displayErrorDialog(DataTransferMessages.getString("ZipImport.badFormat")); //$NON-NLS-1$
- } catch (IOException e) {
- displayErrorDialog(DataTransferMessages.getString("ZipImport.couldNotRead")); //$NON-NLS-1$
- }
-
- sourceNameField.setFocus();
- return null;
-}
-/**
- * Returns a structure provider for the specified zip file.
- */
-protected ZipFileStructureProvider getStructureProvider(ZipFile targetZip) {
- if (providerCache == null)
- providerCache = new ZipFileStructureProvider(targetZip);
- else if (!providerCache.getZipFile().getName().equals(targetZip.getName())) {
- clearProviderCache(); // ie.- new value, so finalize&remove old value
- providerCache = new ZipFileStructureProvider(targetZip);
- } else if (!providerCache.getZipFile().equals(targetZip))
- closeZipFile(targetZip); // ie.- duplicate handle to same .zip
-
- return providerCache;
-}
-/**
- * Open a FileDialog so that the user can specify the source
- * file to import from
- */
-protected void handleSourceBrowseButtonPressed() {
- String selectedFile = queryZipFileToImport();
-
- if (selectedFile != null) {
- if (!selectedFile.equals(sourceNameField.getText())) {
- //Be sure it is valid before we go setting any names
- ZipFile sourceFile = getSpecifiedSourceFile(selectedFile);
- if (sourceFile != null) {
- closeZipFile(sourceFile);
- setSourceName(selectedFile);
- selectionGroup.setFocus();
- }
- }
- }
-}
-/**
- * Import the resources with extensions as specified by the user
- */
-protected boolean importResources(List fileSystemObjects) {
-
- ZipFile zipFile = getSpecifiedSourceFile();
- ZipFileStructureProvider structureProvider = getStructureProvider(zipFile);
-
- boolean result =
- executeImportOperation(
- new ImportOperation(
- getContainerFullPath(),
- structureProvider.getRoot(),
- structureProvider,
- this,
- fileSystemObjects));
-
- closeZipFile(zipFile);
-
- return result;
-}
-/**
- * Initializes the specified operation appropriately.
- */
-protected void initializeOperation(ImportOperation op) {
- op.setOverwriteResources(overwriteExistingResourcesCheckbox.getSelection());
-}
-/**
- * Opens a file selection dialog and returns a string representing the
- * selected file, or <code>null</code> if the dialog was canceled.
- */
-protected String queryZipFileToImport() {
- FileDialog dialog = new FileDialog(sourceNameField.getShell(),SWT.OPEN);
- dialog.setFilterExtensions(new String[] {FILE_IMPORT_MASK});
-
- String currentSourceString = sourceNameField.getText();
- int lastSeparatorIndex = currentSourceString.lastIndexOf(File.separator);
- if (lastSeparatorIndex != -1)
- dialog.setFilterPath(currentSourceString.substring(0,lastSeparatorIndex));
-
- return dialog.open();
-}
-/**
- * Repopulate the view based on the currently entered directory.
- */
-protected void resetSelection() {
-
- super.resetSelection();
- setAllSelections(true);
-}
-/**
- * Use the dialog store to restore widget values to the values that they held
- * last time this wizard was used to completion
- */
-protected void restoreWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- String[] sourceNames = settings.getArray(STORE_SOURCE_NAMES_ID);
- if (sourceNames == null)
- return; // ie.- no settings stored
-
- // set filenames history
- for (int i = 0; i < sourceNames.length; i++)
- sourceNameField.add(sourceNames[i]);
-
- // radio buttons and checkboxes
- overwriteExistingResourcesCheckbox.setSelection(
- settings.getBoolean(STORE_OVERWRITE_EXISTING_RESOURCES_ID));
- }
-}
-/**
- * Since Finish was pressed, write widget values to the dialog store so that they
- * will persist into the next invocation of this wizard page.
- *
- * Note that this method is identical to the one that appears in the superclass.
- * This is necessary because proper overriding of instance variables is not occurring.
- */
-protected void saveWidgetValues() {
- IDialogSettings settings = getDialogSettings();
- if(settings != null) {
- // update source names history
- String[] sourceNames = settings.getArray(STORE_SOURCE_NAMES_ID);
- if (sourceNames == null)
- sourceNames = new String[0];
-
- sourceNames = addToHistory(sourceNames,sourceNameField.getText());
- settings.put(
- STORE_SOURCE_NAMES_ID,
- sourceNames);
-
- // update specific types to import history
- String[] selectedTypesNames = settings.getArray(STORE_SELECTED_TYPES_ID);
- if (selectedTypesNames == null)
- selectedTypesNames = new String[0];
-
- settings.put(
- STORE_OVERWRITE_EXISTING_RESOURCES_ID,
- overwriteExistingResourcesCheckbox.getSelection());
- }
-}
-/**
- * Answer a boolean indicating whether self's source specification
- * widgets currently all contain valid values.
- */
-protected boolean validateSourceGroup() {
-
- //If there is nothing being provided to the input then there is a problem
- if (this.currentProvider == null) {
- setMessage(SOURCE_EMPTY_MESSAGE);
- enableButtonGroup(false);
- return false;
- } else {
- enableButtonGroup(true);
- return true;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileExportOperation.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileExportOperation.java
deleted file mode 100644
index d3305cf..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileExportOperation.java
+++ /dev/null
@@ -1,327 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.jface.operation.*;
-import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-/**
- * Operation for exporting a resource and its children to a new .zip file
- */
-/*package*/ class ZipFileExportOperation implements IRunnableWithProgress {
- private ZipFileExporter exporter;
- private String destinationFilename;
- private IProgressMonitor monitor;
-
- private List resourcesToExport;
- private IResource resource;
- private List errorTable = new ArrayList(1); //IStatus
-
- private boolean useCompression = true;
- private boolean createLeadupStructure = true;
- private boolean generateManifestFile = false;
-/**
- * Create an instance of this class. Use this constructor if you wish to
- * export specific resources without a common parent resource
- *
- * @param resources java.util.Vector
- * @param filename java.lang.String
- */
-public ZipFileExportOperation(List resources,String filename) {
- super();
-
- // Eliminate redundancies in list of resources being exported
- Iterator elementsEnum = resources.iterator();
- while (elementsEnum.hasNext()) {
- IResource currentResource = (IResource) elementsEnum.next();
- if (isDescendent(resources, currentResource))
- elementsEnum.remove(); //Removes currentResource;
- }
-
- resourcesToExport = resources;
- destinationFilename = filename;
-}
-/**
- * Create an instance of this class. Use this constructor if you wish
- * to recursively export a single resource.
- *
- * @param res org.eclipse.core.resources.IResource;
- * @param filename java.lang.String
- */
-public ZipFileExportOperation(IResource res,String filename) {
- super();
- resource = res;
- destinationFilename = filename;
-}
-/**
- * Create an instance of this class. Use this constructor if you wish to
- * export specific resources with a common parent resource (affects container
- * directory creation)
- *
- * @param res org.eclipse.core.resources.IResource
- * @param resources java.util.Vector
- * @param filename java.lang.String
- */
-public ZipFileExportOperation(IResource res, List resources, String filename) {
- this(res,filename);
- resourcesToExport = resources;
-}
-/**
- * Add a new entry to the error table with the passed information
- */
-protected void addError(String message,Throwable e) {
- errorTable.add(
- new Status(
- IStatus.ERROR,
- PlatformUI.PLUGIN_ID,
- 0,
- message,
- e));
-}
-/**
- * Answer the total number of file resources that exist at or below self
- * in the resources hierarchy.
- *
- * @return int
- * @param resource org.eclipse.core.resources.IResource
- */
-protected int countChildrenOf(IResource resource) throws CoreException {
- if (resource.getType() == IResource.FILE)
- return 1;
-
- int count = 0;
- if (resource.isAccessible()) {
- IResource[] children = ((IContainer) resource).members();
- for (int i = 0; i<children.length; i++)
- count += countChildrenOf(children[i]);
- }
-
- return count;
-}
-/**
- * Answer a boolean indicating the number of file resources that were
- * specified for export
- *
- * @return int
- */
-protected int countSelectedResources() throws CoreException {
- int result = 0;
- Iterator resources = resourcesToExport.iterator();
- while (resources.hasNext())
- result += countChildrenOf((IResource)resources.next());
-
- return result;
-}
-
-/**
- * Export the passed resource to the destination .zip. Export with
- * no path leadup
- *
- * @param resource org.eclipse.core.resources.IResource
- */
-protected void exportResource(IResource resource) throws InterruptedException{
- exportResource(resource,1);
-}
-
-
-/**
- * Export the passed resource to the destination .zip
- *
- * @param resource org.eclipse.core.resources.IResource
- * @param depth - the number of resource levels to be included in
- * the path including the resourse itself.
- */
-protected void exportResource(IResource resource, int leadupDepth) throws InterruptedException {
- if (!resource.isAccessible())
- return;
-
- if (resource.getType() == IResource.FILE) {
- String destinationName;
- IPath fullPath = resource.getFullPath();
- if(createLeadupStructure)
- destinationName = fullPath.makeRelative().toString();
- else
- destinationName = fullPath.removeFirstSegments(fullPath.segmentCount() - leadupDepth).toString();
- monitor.subTask(destinationName);
-
- try {
- exporter.write((IFile) resource, destinationName);
- } catch (IOException e) {
- addError(
- DataTransferMessages.format(
- "DataTransfer.errorExporting", //$NON-NLS-1$
- new Object[] {resource.getFullPath().makeRelative(), e.getMessage()}),
- e);
- } catch (CoreException e) {
- addError(
- DataTransferMessages.format(
- "DataTransfer.errorExporting", //$NON-NLS-1$
- new Object[] {resource.getFullPath().makeRelative(), e.getMessage()}),
- e);
- }
-
- monitor.worked(1);
- ModalContext.checkCanceled(monitor);
- } else {
- IResource[] children = null;
-
- try {
- children = ((IContainer) resource).members();
- } catch (CoreException e) {
- // this should never happen because an #isAccessible check is done before #members is invoked
- addError(DataTransferMessages.format("DataTransfer.errorExporting", new Object[] {resource.getFullPath()}), e); //$NON-NLS-1$
- }
-
- for (int i = 0; i<children.length; i++)
- exportResource(children[i],leadupDepth + 1);
-
- }
-}
-/**
- * Export the resources contained in the previously-defined
- * resourcesToExport collection
- */
-protected void exportSpecifiedResources() throws InterruptedException {
- Iterator resources = resourcesToExport.iterator();
-
- while (resources.hasNext()) {
- IResource currentResource = (IResource)resources.next();
- exportResource(currentResource);
- }
-}
-/**
- * Answer the error table
- *
- * @return Vector of IStatus
- */
-public List getResult() {
- return errorTable;
-}
-/**
- * Returns the status of the operation.
- * If there were any errors, the result is a status object containing
- * individual status objects for each error.
- * If there were no errors, the result is a status object with error code <code>OK</code>.
- *
- * @return the status
- */
-public IStatus getStatus() {
- IStatus[] errors = new IStatus[errorTable.size()];
- errorTable.toArray(errors);
- return new MultiStatus(
- PlatformUI.PLUGIN_ID,
- IStatus.OK,
- errors,
- DataTransferMessages.getString("FileSystemExportOperation.problemsExporting"), //$NON-NLS-1$
- null);
-}
-/**
- * Initialize this operation
- *
- * @exception java.io.IOException
- */
-protected void initialize() throws IOException {
- exporter = new ZipFileExporter(destinationFilename,useCompression,generateManifestFile);
-
-}
-/**
- * Answer a boolean indicating whether the passed child is a descendent
- * of one or more members of the passed resources collection
- *
- * @return boolean
- * @param resources java.util.Vector
- * @param child org.eclipse.core.resources.IResource
- */
-protected boolean isDescendent(List resources, IResource child) {
- if (child.getType() == IResource.PROJECT)
- return false;
-
- IResource parent = child.getParent();
- if (resources.contains(parent))
- return true;
-
- return isDescendent(resources,parent);
-}
-/**
- * Export the resources that were previously specified for export
- * (or if a single resource was specified then export it recursively)
- */
-public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
- this.monitor = monitor;
-
- try {
- initialize();
- } catch (IOException e) {
- throw new InvocationTargetException(
- e,
- DataTransferMessages.format("ZipExport.cannotOpen", new Object[] { e.getMessage()})); //$NON-NLS-1$
- }
-
- try {
- // ie.- a single resource for recursive export was specified
- int totalWork = IProgressMonitor.UNKNOWN;
- try {
- if (resourcesToExport == null)
- totalWork = countChildrenOf(resource);
- else
- totalWork = countSelectedResources();
- }
- catch (CoreException e) {
- // Should not happen
- }
- monitor.beginTask(DataTransferMessages.getString("DataTransfer.exportingTitle"), totalWork); //$NON-NLS-1$
- if (resourcesToExport == null) {
- exportResource(resource);
- }
- else {
- // ie.- a list of specific resources to export was specified
- exportSpecifiedResources();
- }
-
- try {
- exporter.finished();
- } catch (IOException e) {
- throw new InvocationTargetException(
- e,
- DataTransferMessages.format("ZipExport.cannotClose", new Object[] {e.getMessage()})); //$NON-NLS-1$
- }
- } finally {
- monitor.done();
- }
-}
-/**
- * Set this boolean indicating whether each exported resource's path should
- * include containment hierarchies as dictated by its parents
- *
- * @param value boolean
- */
-public void setCreateLeadupStructure(boolean value) {
- createLeadupStructure = value;
-}
-/**
- * Set this boolean indicating whether a manifest.mf file based upon
- * the exported contents should be created and included in the final
- * archive
- *
- * @param value boolean
- */
-public void setGenerateManifestFile(boolean value) {
- generateManifestFile = value;
-}
-/**
- * Set this boolean indicating whether exported resources should
- * be compressed (as opposed to simply being stored)
- *
- * @param value boolean
- */
-public void setUseCompression(boolean value) {
- useCompression = value;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileExportWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileExportWizard.java
deleted file mode 100644
index 9de5d68..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileExportWizard.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IExportWizard;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Display;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-
-/**
- * Standard workbench wizard for exporting resources from the workspace
- * to a zip file.
- * <p>
- * 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 ZipFileExportWizard();
- * 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 resources
- * are exported to the user-specified zip file, the dialog closes, and the call
- * to <code>open</code> returns.
- * </p>
- */
-public class ZipFileExportWizard extends Wizard implements IExportWizard {
- private IWorkbench workbench;
- private IStructuredSelection selection;
- private WizardZipFileResourceExportPage1 mainPage;
-/**
- * Creates a wizard for exporting workspace resources to a zip file.
- */
-public ZipFileExportWizard() {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("ZipFileExportWizard");//$NON-NLS-1$
- if(section == null)
- section = workbenchSettings.addNewSection("ZipFileExportWizard");//$NON-NLS-1$
- setDialogSettings(section);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public void addPages() {
- super.addPages();
- mainPage = new WizardZipFileResourceExportPage1(selection);
- addPage(mainPage);
-}
-/**
- * Returns the image descriptor with the given relative path.
- */
-private ImageDescriptor getImageDescriptor(String relativePath) {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- URL installURL = plugin.getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + relativePath);
- return ImageDescriptor.createFromURL(url);
- }
- catch (MalformedURLException e) {
- // Should not happen
- return null;
- }
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchWizard.
- */
-public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- this.workbench = workbench;
- selection = currentSelection;
-
- setWindowTitle(DataTransferMessages.getString("DataTransfer.export")); //$NON-NLS-1$
- setDefaultPageImageDescriptor(getImageDescriptor("wizban/exportzip_wiz.gif"));//$NON-NLS-1$
- setNeedsProgressMonitor(true);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public boolean performFinish() {
- return mainPage.finish();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileExporter.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileExporter.java
deleted file mode 100644
index ee53179..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileExporter.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.dialogs.*;
-import java.io.*;
-import java.security.*;
-import java.util.zip.*;
-
-/**
- * Exports resources to a .zip file
- */
-/*package*/ class ZipFileExporter {
- private ZipOutputStream outputStream;
- private StringBuffer manifestContents;
-
- private boolean generateManifestFile = false;
- private boolean useCompression = true;
-
- // constants
- private static final String newline = "\r\n"; // is this platform dependent?//$NON-NLS-1$
- private static final String manifestMagic = "Manifest-Version: 1.0" + newline + newline;//$NON-NLS-1$
- private static final String nameLabel = "Name: ";//$NON-NLS-1$
- private static final String digestsLabel = "Digest-Algorithms: SHA MD5" + newline;//$NON-NLS-1$
- private static final String shaLabel = "SHA-Digest: ";//$NON-NLS-1$
- private static final String md5Label = "MD5-Digest: ";//$NON-NLS-1$
- private static final String manifestPath = "meta-inf/Manifest.mf";//$NON-NLS-1$
-/**
- * Create an instance of this class.
- *
- * @param filename java.lang.String
- * @param compress boolean
- * @param includeManifestFile boolean
- * @exception java.io.IOException
- */
-public ZipFileExporter(String filename,boolean compress,boolean includeManifestFile) throws IOException {
- outputStream = new ZipOutputStream(new FileOutputStream(filename));
- useCompression = compress;
- generateManifestFile = includeManifestFile;
-
- if (generateManifestFile)
- manifestContents = new StringBuffer(manifestMagic);
-}
-/**
- * Create a new entry in the manifest file being constructed.
- *
- * @param pathname java.lang.String
- * @param file org.eclipse.core.resources.IFile
- * @exception java.io.IOException
- * @exception org.eclipse.core.runtime.CoreException
- */
-protected void appendToManifest(String pathname, IFile file) throws IOException, CoreException {
- StringBuffer manifestEntry = new StringBuffer();
- manifestEntry.append(nameLabel);
- manifestEntry.append(pathname);
- manifestEntry.append(newline);
- manifestEntry.append(digestsLabel);
- manifestEntry.append(shaLabel);
-
- byte[] fileContents = null;
-
- // we don't have to EnsureLocal because it was already done in #write
- InputStream contentStream = file.getContents(false);
- Reader in = new InputStreamReader(contentStream);
- int chunkSize = contentStream.available();
- StringBuffer buffer = new StringBuffer(chunkSize);
- char[] readBuffer = new char[chunkSize];
- int n = in.read(readBuffer);
- while (n > 0) {
- buffer.append(readBuffer);
- n = in.read(readBuffer);
- }
- contentStream.close();
- fileContents = buffer.toString().getBytes();
-
- try {
- byte[] hashValue = MessageDigest.getInstance("SHA").digest(fileContents);//$NON-NLS-1$
- manifestEntry.append(Base64Encoder.encode(hashValue));
- manifestEntry.append(newline);
- manifestEntry.append(md5Label);
- hashValue = MessageDigest.getInstance("MD5").digest(fileContents);//$NON-NLS-1$
- manifestEntry.append(Base64Encoder.encode(hashValue));
- manifestEntry.append(newline + newline);
- } catch (NoSuchAlgorithmException e) {
- // should never happen
- return;
- }
- manifestContents.append(manifestEntry.toString());
-}
-/**
- * Do all required cleanup now that we're finished with the
- * currently-open .zip
- *
- * @exception java.io.IOException
- */
-public void finished() throws IOException {
- if (generateManifestFile)
- writeManifestFile();
-
- outputStream.close();
-}
-/**
- * Create a new ZipEntry with the passed pathname and contents, and write it
- * to the current archive
- *
- * @param pathname java.lang.String
- * @param contents byte[]
- * @exception java.io.IOException
- */
-protected void write(String pathname, byte[] contents) throws IOException {
- ZipEntry newEntry = new ZipEntry(pathname);
-
- // if the contents are being compressed then we get the below for free.
- if (!useCompression) {
- newEntry.setMethod(ZipEntry.STORED);
- newEntry.setSize(contents.length);
- CRC32 checksumCalculator = new CRC32();
- checksumCalculator.update(contents);
- newEntry.setCrc(checksumCalculator.getValue());
- }
-
- outputStream.putNextEntry(newEntry);
- outputStream.write(contents);
- outputStream.closeEntry();
-}
-/**
- * Write the passed resource to the current archive
- *
- * @param resource org.eclipse.core.resources.IFile
- * @param destinationPath java.lang.String
- * @exception java.io.IOException
- * @exception org.eclipse.core.runtime.CoreException
- */
-public void write(IFile resource, String destinationPath) throws IOException, CoreException {
- ByteArrayOutputStream output = null;
- InputStream contentStream = null;
-
- try {
- output = new ByteArrayOutputStream();
- contentStream = resource.getContents(false);
- int chunkSize = contentStream.available();
- byte[] readBuffer = new byte[chunkSize];
- int n = contentStream.read(readBuffer);
-
- while (n > 0) {
- output.write(readBuffer);
- n = contentStream.read(readBuffer);
- }
- } finally {
- if (output != null)
- output.close();
- if (contentStream != null)
- contentStream.close();
- }
-
- write(destinationPath,output.toByteArray());
- if (generateManifestFile)
- appendToManifest(destinationPath, resource);
-}
-/**
- * Write the constructed manifest.mf file to the current archive
- *
- * @exception java.io.IOException
- */
-protected void writeManifestFile() throws IOException {
- write(manifestPath,manifestContents.toString().getBytes());
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileImportWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileImportWizard.java
deleted file mode 100644
index 68e2c1f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileImportWizard.java
+++ /dev/null
@@ -1,104 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IImportWizard;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Display;
-import java.net.MalformedURLException;
-import java.net.URL;
-
-/**
- * Standard workbench wizard for importing resources from a zip file
- * into the workspace.
- * <p>
- * 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 ZipFileImportWizard();
- * 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 zip file is imported
- * into the workspace, the dialog closes, and the call to <code>open</code>
- * returns.
- * </p>
- */
-public class ZipFileImportWizard extends Wizard implements IImportWizard {
- private IWorkbench workbench;
- private IStructuredSelection selection;
- private WizardZipFileResourceImportPage1 mainPage;
-/**
- * Creates a wizard for importing resources into the workspace from
- * a zip file.
- */
-public ZipFileImportWizard() {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("ZipFileImportWizard");//$NON-NLS-1$
- if(section == null)
- section = workbenchSettings.addNewSection("ZipFileImportWizard");//$NON-NLS-1$
- setDialogSettings(section);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public void addPages() {
- super.addPages();
- mainPage = new WizardZipFileResourceImportPage1(workbench,selection);
- addPage(mainPage);
-}
-/**
- * Returns the image descriptor with the given relative path.
- */
-private ImageDescriptor getImageDescriptor(String relativePath) {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- URL installURL = plugin.getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + relativePath);
- return ImageDescriptor.createFromURL(url);
- }
- catch (MalformedURLException e) {
- // Should not happen
- return null;
- }
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchWizard.
- */
-public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- this.workbench = workbench;
- selection = currentSelection;
-
- setWindowTitle(DataTransferMessages.getString("DataTransfer.importTitle")); //$NON-NLS-1$
- setDefaultPageImageDescriptor(getImageDescriptor("wizban/importzip_wiz.gif"));//$NON-NLS-1$
- setNeedsProgressMonitor(true);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public boolean performCancel() {
- return mainPage.cancel();
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public boolean performFinish() {
- return mainPage.finish();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileStructureProvider.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileStructureProvider.java
deleted file mode 100644
index 528eb02..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/ZipFileStructureProvider.java
+++ /dev/null
@@ -1,147 +0,0 @@
-package org.eclipse.ui.wizards.datatransfer;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import java.io.*;
-import java.util.*;
-import java.util.zip.*;
-
-/**
- * This class provides information regarding the context structure and
- * content of specified zip file entry objects.
- */
-public class ZipFileStructureProvider implements IImportStructureProvider {
- private ZipFile zipFile;
- private ZipEntry root = new ZipEntry("/");//$NON-NLS-1$
- private Map children;
- private Map directoryEntryCache = new HashMap();
-/**
- * Creates a <code>ZipFileStructureProvider</code>, which will operate
- * on the passed zip file.
- */
-public ZipFileStructureProvider(ZipFile sourceFile) {
- super();
- zipFile = sourceFile;
-}
-/**
- * Adds the specified child to the internal collection of the parent's children.
- */
-protected void addToChildren(ZipEntry parent, ZipEntry child) {
- List childList = (List)children.get(parent);
- if (childList == null) {
- childList = new ArrayList();
- children.put(parent,childList);
- }
-
- childList.add(child);
-}
-/**
- * Creates a new container zip entry with the specified name, iff
- * it has not already been created.
- */
-protected void createContainer(IPath pathname) {
- if (directoryEntryCache.containsKey(pathname))
- return;
-
- ZipEntry parent;
- if (pathname.segmentCount() == 1)
- parent = root;
- else
- parent = (ZipEntry)directoryEntryCache.get(pathname.removeLastSegments(1));
-
- ZipEntry newEntry = new ZipEntry(pathname.toString());
- directoryEntryCache.put(pathname,newEntry);
- addToChildren(parent,newEntry);
-}
-/**
- * Creates a new file zip entry with the specified name.
- */
-protected void createFile(ZipEntry entry) {
- IPath pathname = new Path(entry.getName());
- ZipEntry parent;
- if (pathname.segmentCount() == 1)
- parent = root;
- else
- parent = (ZipEntry) directoryEntryCache.get(pathname.removeLastSegments(1));
-
- addToChildren(parent, entry);
-}
-/* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
-public List getChildren(Object element) {
- if (children == null)
- initialize();
-
- return ((List)children.get(element));
-}
-/* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
-public InputStream getContents(Object element) {
- try {
- return zipFile.getInputStream((ZipEntry)element);
- } catch (IOException e) {
- return null;
- }
-}
-/* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
-public String getFullPath(Object element) {
- return ((ZipEntry)element).getName();
-}
-/* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
-public String getLabel(Object element) {
- if (element.equals(root))
- return ((ZipEntry)element).getName();
-
- return new Path(((ZipEntry)element).getName()).lastSegment();
-}
-/**
- * Returns the entry that this importer uses as the root sentinel.
- *
- * @return java.util.zip.ZipEntry
- */
-public ZipEntry getRoot() {
- return root;
-}
-/**
- * Returns the zip file that this provider provides structure for.
- */
-public ZipFile getZipFile() {
- return zipFile;
-}
-/**
- * Initializes this object's children table based on the contents of
- * the specified source file.
- */
-protected void initialize() {
- children = new HashMap(1000);
-
- Enumeration entries = zipFile.entries();
- while (entries.hasMoreElements()) {
- ZipEntry entry = (ZipEntry)entries.nextElement();
- if (!entry.isDirectory()) {
- IPath path = new Path(entry.getName()).addTrailingSeparator();
- int pathSegmentCount = path.segmentCount();
-
- for (int i = 1; i < pathSegmentCount; i++)
- createContainer(path.uptoSegment(i));
- createFile(entry);
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on IImportStructureProvider
- */
-public boolean isFolder(Object element) {
- return ((ZipEntry)element).isDirectory();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/messages.properties b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/messages.properties
deleted file mode 100644
index 119250f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/messages.properties
+++ /dev/null
@@ -1,120 +0,0 @@
-# ==============================================================================
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-# ==============================================================================
-
-# package: org.eclipse.ui.wizards.datatransfer
-
-
-# ==============================================================================
-# Data Transfer Wizards
-# ==============================================================================
-DataTransfer.fileSystemTitle = File system
-ZipExport.exportTitle = Zip file
-
-DataTransfer.browse = B&rowse...
-DataTransfer.selectTypes = Filter &Types...
-DataTransfer.selectAll = &Select All
-DataTransfer.deselectAll = &Deselect All
-
-DataTransfer.typeDelimiter = ,
-DataTransfer.allFiles = All files matching this criteria
-DataTransfer.oneSelected = 1 file selected
-DataTransfer.details = Details...
-DataTransfer.allTypes = All types
-
-DataTransfer.cannotOverwrite = Cannot overwrite file: {0}
-DataTransfer.emptyString =
-DataTransfer.scanningChildren = Scanning for children...
-DataTransfer.scanningMatching = Scanning for matching files...
-DataTransfer.information = Information
-
-# --- Import Wizards ---
-DataTransfer.importTitle = Import
-
-DataTransfer.importTask = Importing:
-ImportOperation.creatingFolder = Creating folder:
-ImportOperation.cannotCopy = Cannot copy root file system.
-ImportOperation.importProblems = Problems were encountered during import:
-ImportOperation.openStreamError = Error opening input stream for {0}
-ImportOperation.closeStreamError = Could not close input stream for {0}
-ImportOperation.coreImportError = Unable to import {0}. Reason: {1}
-ImportOperation.targetSameAsSourceError = Unable to import {0}. The file cannot be copied onto itself
-ImportPage.oneSelected = 1 entry selected
-ImportPage.filterSelections = Filtering selection
-
-FileImport.selectSource = Select the source directory.
-FileImport.sourceTitle = Directory:
-FileImport.selectResources = Select the resources to import.
-FileImport.importFileSystem = Import resources from the local file system.
-FileImport.overwriteExisting = &Overwrite existing resources without warning
-FileImport.createComplete = &Create complete folder structure
-FileImport.createSelectedFolders = Create s&elected folders only
-FileImport.selectTypes = Select the types to import.
-FileImport.typeSelectionTitle = Type Selection
-FileImport.noneSelected = There are no resources currently selected for import.
-FileImport.filesofType = Files of type:
-FileImport.edit = Edit...
-FileImport.filesSelected = {0} files selected
-FileImport.invalidSource = Source directory is not valid or has not been specified.
-FileImport.sourceEmpty = Source must not be empty.
-FileImport.importProblems = Import Problems
-FileImport.whichTypesImport = What types of files do you wish to import?
-
-ZipImport.description = Import the contents of a Zip file from the local file system.
-ZipImport.entriesSelected = {0} entries selected
-ZipImport.couldNotClose = Could not close file {0}
-ZipImport.badFormat = Source file is not of proper format.
-ZipImport.couldNotRead = Source file could not be read.
-
-WizardExternalProjectImportPage.locationError = Invalid project contents directory
-WizardExternalProjectImportPage.projectNameEmpty = A valid project name must be specified in the .project file at the Project contents location.
-WizardExternalProjectImportPage.projectLocationEmpty = Project contents directory must be specified
-WizardExternalProjectImportPage.projectExistsMessage = Project already exists.
-WizardExternalProjectImportPage.projectContentsLabel = Project &contents:
-WizardExternalProjectImportPage.nameLabel = &Project name:
-WizardExternalProjectImportPage.browseLabel = B&rowse...
-WizardExternalProjectImportPage.title = Import Project From File System
-WizardExternalProjectImportPage.description = Create a new Project resource from an existing Eclipse project located in the file system.
-WizardExternalProjectImportPage.notAProject = {0} does not have a .project file.
-WizardExternalProjectImportPage.errorMessage = Creation Problems
-WizardExternalProjectImportPage.internalError = Internal error: {0}
-WizardExternalProjectImportPage.caseVariantExistsError = The project contents directory specified is being used by another project. Please enter a new project contents directory.
-WizardExternalProjectImportPage.directoryLabel = Select the Project location.
-WizardExternalProjectImportPage.defaultLocationError = Projects under the workspace root must have a matching name and location
-
-
-# --- Export Wizards ---
-DataTransfer.export = Export
-
-DataTransfer.exportingTitle = Exporting:
-DataTransfer.selectDestination = Select the destination directory.
-DataTransfer.directory = Director&y:
-DataTransfer.createTargetDirectory = Target directory does not exist. Would you like to create it?
-DataTransfer.directoryCreationError = Target directory could not be created.
-DataTransfer.errorExporting = Error exporting {0}: {1}
-DataTransfer.exportProblems = Export Problems
-
-ExportFile.overwriteExisting = &Overwrite existing files without warning
-ExportFile.createDirectoriesForSelected = Create directories for selected folders
-ExportFile.createDirectoryStructure = &Create directory structure
-
-FileExport.exportLocalFileSystem = Export resources to the local file system.
-FileExport.destinationEmpty = Please enter a destination.
-FileExport.createDirectoryStructure = &Create directory structure for files
-FileExport.createSelectedDirectories = Create on&ly selected directories
-FileExport.noneSelected = There are no resources currently selected for export.
-FileExport.directoryExists = Target directory already exists as a file.
-FileExport.conflictingContainer = Destination directory conflicts with location of {0}.
-FileExport.rootName = workspace root
-FileSystemExportOperation.problemsExporting = Problems were encountered during export:
-
-ZipExport.overwriteFile = &Overwrite existing file without warning
-ZipExport.compressContents = Co&mpress the contents of the file
-ZipExport.description = Export resources to a Zip file on the local file system.
-ZipExport.destinationLabel = &Zip file:
-ZipExport.mustBeFile = Export destination must be a file, not a directory.
-ZipExport.alreadyExists = Target file already exists. Would you like to overwrite it?
-ZipExport.alreadyExistsError = Export destination already exists and cannot be overwritten.
-ZipExport.cannotOpen = Unable to open destination file: {0}
-ZipExport.cannotClose = Unable to close destination file: {0}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/package.html b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/package.html
deleted file mode 100644
index 83c410f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/datatransfer/package.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides the standard Import and Export wizards for
-moving resources into and out of the workspace.
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewFileResourceWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewFileResourceWizard.java
deleted file mode 100644
index 4f818b8..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewFileResourceWizard.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package org.eclipse.ui.wizards.newresource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.internal.dialogs.DialogUtil;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-import org.eclipse.ui.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Display;
-import java.net.*;
-
-/**
- * Standard workbench wizard that create a new file resource in the workspace.
- * <p>
- * This class may be instantiated and used without further configuration;
- * this class is not intended to be subclassed.
- * </p>
- * <p>
- * Example:
- * <pre>
- * IWorkbenchWizard wizard = new BasicNewFileResourceWizard();
- * 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, a file resource at the user-specified
- * workspace path is created, the dialog closes, and the call to
- * <code>open</code> returns.
- * </p>
- */
-public class BasicNewFileResourceWizard extends BasicNewResourceWizard {
- private WizardNewFileCreationPage mainPage;
-/**
- * Creates a wizard for creating a new file resource in the workspace.
- */
-public BasicNewFileResourceWizard() {
- super();
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public void addPages() {
- super.addPages();
- mainPage = new WizardNewFileCreationPage("newFilePage1", getSelection());//$NON-NLS-1$
- mainPage.setTitle(ResourceMessages.getString("FileResource.pageTitle")); //$NON-NLS-1$
- mainPage.setDescription(ResourceMessages.getString("FileResource.description")); //$NON-NLS-1$
- addPage(mainPage);
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchWizard.
- */
-public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- super.init(workbench, currentSelection);
- setWindowTitle(ResourceMessages.getString("FileResource.shellTitle")); //$NON-NLS-1$
- setNeedsProgressMonitor(true);
-}
-/* (non-Javadoc)
- * Method declared on BasicNewResourceWizard.
- */
-protected void initializeDefaultPageImageDescriptor() {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- URL installURL = Platform.getPlugin(PlatformUI.PLUGIN_ID).getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + "wizban/newfile_wiz.gif");//$NON-NLS-1$
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- setDefaultPageImageDescriptor(desc);
- }
- catch (MalformedURLException e) {
- // Should not happen. Ignore.
- }
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public boolean performFinish() {
- IFile file = mainPage.createNewFile();
- if (file == null)
- return false;
-
- selectAndReveal(file);
-
- // Open editor on new file.
- IWorkbenchWindow dw = getWorkbench().getActiveWorkbenchWindow();
- try {
- IWorkbenchPage page = dw.getActivePage();
- if (page != null)
- page.openEditor(file);
- } catch (PartInitException e) {
- DialogUtil.openError(
- dw.getShell(),
- ResourceMessages.getString("FileResource.errorMessage"), //$NON-NLS-1$
- e.getMessage(),
- e);
- }
-
- return true;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewFolderResourceWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewFolderResourceWizard.java
deleted file mode 100644
index 21b6026..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewFolderResourceWizard.java
+++ /dev/null
@@ -1,90 +0,0 @@
-package org.eclipse.ui.wizards.newresource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.dialogs.WizardNewFolderMainPage;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Display;
-import java.net.*;
-
-/**
- * Standard workbench wizard that create a new folder resource in the workspace.
- * <p>
- * This class may be instantiated and used without further configuration;
- * this class is not intended to be subclassed.
- * </p>
- * <p>
- * Example:
- * <pre>
- * IWorkbenchWizard wizard = new BasicNewFolderResourceWizard();
- * 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, a folder resource at the user-specified
- * workspace path is created, the dialog closes, and the call to
- * <code>open</code> returns.
- * </p>
- */
-public class BasicNewFolderResourceWizard extends BasicNewResourceWizard {
- private WizardNewFolderMainPage mainPage;
-/**
- * Creates a wizard for creating a new folder resource in the workspace.
- */
-public BasicNewFolderResourceWizard() {
- super();
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public void addPages() {
- super.addPages();
- mainPage = new WizardNewFolderMainPage(ResourceMessages.getString("NewFolder.text"), getSelection()); //$NON-NLS-1$
- addPage(mainPage);
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchWizard.
- */
-public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- super.init(workbench, currentSelection);
- setWindowTitle(ResourceMessages.getString("NewFolder.title")); //$NON-NLS-1$
- setNeedsProgressMonitor(true);
-}
-/* (non-Javadoc)
- * Method declared on BasicNewResourceWizard.
- */
-protected void initializeDefaultPageImageDescriptor() {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- URL installURL = Platform.getPlugin(PlatformUI.PLUGIN_ID).getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + "wizban/newfolder_wiz.gif");//$NON-NLS-1$
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- setDefaultPageImageDescriptor(desc);
- }
- catch (MalformedURLException e) {
- // Should not happen. Ignore.
- }
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public boolean performFinish() {
- IFolder folder = mainPage.createNewFolder();
- if (folder == null)
- return false;
-
- selectAndReveal(folder);
-
- return true;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewProjectResourceWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewProjectResourceWizard.java
deleted file mode 100644
index ef1219f..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewProjectResourceWizard.java
+++ /dev/null
@@ -1,394 +0,0 @@
-package org.eclipse.ui.wizards.newresource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.WizardNewProjectCreationPage;
-import org.eclipse.ui.dialogs.WizardNewProjectReferencePage;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Display;
-import java.lang.reflect.InvocationTargetException;
-import java.net.*;
-
-
-/**
- * Standard workbench wizard that creates a new project resource in
- * the workspace.
- * <p>
- * This class may be instantiated and used without further configuration;
- * this class is not intended to be subclassed.
- * </p>
- * <p>
- * Example:
- * <pre>
- * IWorkbenchWizard wizard = new BasicNewProjectResourceWizard();
- * 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, a project resource with the user-specified
- * name is created, the dialog closes, and the call to <code>open</code> returns.
- * </p>
- */
-public class BasicNewProjectResourceWizard extends BasicNewResourceWizard
- implements IExecutableExtension
-{
- private WizardNewProjectCreationPage mainPage;
- private WizardNewProjectReferencePage referencePage;
-
- // cache of newly-created project
- private IProject newProject;
-
- /**
- * The config element which declares this wizard.
- */
- private IConfigurationElement configElement;
-
- private static String PAGE_PROBLEMS_TITLE = ResourceMessages.getString("NewProject.errorOpeningPage"); //$NON-NLS-1$
- private static String WINDOW_PROBLEMS_TITLE = ResourceMessages.getString("NewProject.errorOpeningWindow"); //$NON-NLS-1$
-/**
- * Creates a wizard for creating a new project resource in the workspace.
- */
-public BasicNewProjectResourceWizard() {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
- IDialogSettings section = workbenchSettings.getSection("BasicNewProjectResourceWizard");//$NON-NLS-1$
- if(section == null)
- section = workbenchSettings.addNewSection("BasicNewProjectResourceWizard");//$NON-NLS-1$
- setDialogSettings(section);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public void addPages() {
- super.addPages();
-
- mainPage = new WizardNewProjectCreationPage("basicNewProjectPage");//$NON-NLS-1$
- mainPage.setTitle(ResourceMessages.getString("NewProject.title")); //$NON-NLS-1$
- mainPage.setDescription(ResourceMessages.getString("NewProject.description")); //$NON-NLS-1$
- this.addPage(mainPage);
-
- // only add page if there are already projects in the workspace
- if (ResourcesPlugin.getWorkspace().getRoot().getProjects().length > 0) {
- referencePage = new WizardNewProjectReferencePage("basicReferenceProjectPage");//$NON-NLS-1$
- referencePage.setTitle(ResourceMessages.getString("NewProject.referenceTitle")); //$NON-NLS-1$
- referencePage.setDescription(ResourceMessages.getString("NewProject.referenceDescription")); //$NON-NLS-1$
- this.addPage(referencePage);
- }
-}
-/**
- * Creates a new project resource with the selected name.
- * <p>
- * In normal usage, this method is invoked after the user has pressed Finish on
- * the wizard; the enablement of the Finish button implies that all controls
- * on the pages currently contain valid values.
- * </p>
- * <p>
- * Note that this wizard caches the new project once it has been successfully
- * created; subsequent invocations of this method will answer the same
- * project resource without attempting to create it again.
- * </p>
- *
- * @return the created project resource, or <code>null</code> if the project
- * was not created
- */
-private IProject createNewProject() {
- if (newProject != null)
- return newProject;
-
- // get a project handle
- final IProject newProjectHandle = mainPage.getProjectHandle();
-
- // get a project descriptor
- IPath newPath = null;
- if (!mainPage.useDefaults())
- newPath = mainPage.getLocationPath();
-
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- final IProjectDescription description = workspace.newProjectDescription(newProjectHandle.getName());
- description.setLocation(newPath);
-
- // update the referenced project if provided
- if (referencePage != null) {
- IProject[] refProjects = referencePage.getReferencedProjects();
- if (refProjects.length > 0)
- description.setReferencedProjects(refProjects);
- }
-
- // create the new project operation
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- protected void execute(IProgressMonitor monitor) throws CoreException {
- createProject(description, newProjectHandle, monitor);
- }
- };
-
- // run the new project creation operation
- try {
- getContainer().run(true, true, op);
- }
- catch (InterruptedException e) {
- return null;
- }
- catch (InvocationTargetException e) {
- // ie.- one of the steps resulted in a core exception
- Throwable t = e.getTargetException();
- if (t instanceof CoreException) {
- if (((CoreException)t).getStatus().getCode() == IResourceStatus.CASE_VARIANT_EXISTS) {
- MessageDialog.openError(
- getShell(),
- ResourceMessages.getString("NewProject.errorMessage"), //$NON-NLS-1$
- ResourceMessages.format("NewProject.caseVariantExistsError", new String[] { newProjectHandle.getName()} ) //$NON-NLS-1$,
- );
- } else {
- ErrorDialog.openError(
- getShell(),
- ResourceMessages.getString("NewProject.errorMessage"), //$NON-NLS-1$
- null, // no special message
- ((CoreException) t).getStatus());
- }
- } else {
- // CoreExceptions are handled above, but unexpected runtime exceptions and errors may still occur.
- Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog().log(
- new Status(
- Status.ERROR,
- PlatformUI.PLUGIN_ID,
- 0,
- t.toString(),
- t));
- MessageDialog.openError(
- getShell(),
- ResourceMessages.getString("NewProject.errorMessage"), //$NON-NLS-1$
- ResourceMessages.format("NewProject.internalError", new Object[] {t.getMessage()})); //$NON-NLS-1$
- }
- return null;
- }
-
- newProject = newProjectHandle;
-
- return newProject;
-}
-/**
- * Creates a project resource given the project handle and description.
- *
- * @param description the project description to create a project resource for
- * @param projectHandle the project handle to create a project resource for
- * @param monitor the progress monitor to show visual progress with
- *
- * @exception CoreException if the operation fails
- * @exception OperationCanceledException if the operation is canceled
- */
-private void createProject(IProjectDescription description, IProject projectHandle, IProgressMonitor monitor) throws CoreException, OperationCanceledException {
- try {
- monitor.beginTask("",2000);//$NON-NLS-1$
-
- projectHandle.create(description, new SubProgressMonitor(monitor,1000));
-
- if (monitor.isCanceled())
- throw new OperationCanceledException();
-
- projectHandle.open(new SubProgressMonitor(monitor,1000));
-
- } finally {
- monitor.done();
- }
-}
-/**
- * Returns the newly created project.
- *
- * @return the created project, or <code>null</code>
- * if project not created
- */
-public IProject getNewProject() {
- return newProject;
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchWizard.
- */
-public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- super.init(workbench, currentSelection);
- setNeedsProgressMonitor(true);
- setWindowTitle(ResourceMessages.getString("NewProject.windowTitle")); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on BasicNewResourceWizard.
- */
-protected void initializeDefaultPageImageDescriptor() {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- URL installURL = Platform.getPlugin(PlatformUI.PLUGIN_ID).getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + "wizban/newprj_wiz.gif");//$NON-NLS-1$
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- setDefaultPageImageDescriptor(desc);
- }
- catch (MalformedURLException e) {
- // Should not happen. Ignore.
- }
-}
-/* (non-Javadoc)
- * Opens a new page with a particular perspective and input.
- */
-private static void openInNewPage(IPerspectiveDescriptor desc) {
-
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null)
- return;
-
- // If the active perspective is the same, then reuse it
- IWorkbenchPage page = window.getActivePage();
- if (page != null) {
- IPerspectiveDescriptor persp = page.getPerspective();
- if (persp != null && persp.getId().equals(desc.getId()))
- return;
- }
-
- // If the perspective is already open, then reuse it.
- IWorkbenchPage[] pages = window.getPages();
- for (int i = 0; i < pages.length; i++) {
- IPerspectiveDescriptor persp = pages[i].getPerspective();
- if (persp != null && persp.getId().equals(desc.getId())) {
- window.setActivePage(pages[i]);
- return;
- }
- }
-
- // Open the page.
- try {
- window.openPage(desc.getId(), ResourcesPlugin.getWorkspace().getRoot());
- } catch (WorkbenchException e) {
- ErrorDialog.openError(window.getShell(), PAGE_PROBLEMS_TITLE, e.getMessage(), e.getStatus());
- }
-}
-/* (non-Javadoc)
- * Opens a new window with a particular perspective and input.
- */
-private static void openInNewWindow(IPerspectiveDescriptor desc) {
-
- // Open the page.
- try {
- PlatformUI.getWorkbench().openWorkbenchWindow(
- desc.getId(),
- ResourcesPlugin.getWorkspace().getRoot());
- } catch (WorkbenchException e) {
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- ErrorDialog.openError(
- window.getShell(),
- WINDOW_PROBLEMS_TITLE,
- e.getMessage(),
- e.getStatus());
- }
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public boolean performFinish() {
- createNewProject();
-
- if (newProject == null)
- return false;
-
- updatePerspective();
- selectAndReveal(newProject);
-
- return true;
-}
-/* (non-Javadoc)
- * Replaces the current perspective with the new one.
- */
-private static void replaceCurrentPerspective(IPerspectiveDescriptor persp) {
-
- //Get the active page.
- IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (window == null)
- return;
- IWorkbenchPage page = window.getActivePage();
- if (page == null)
- return;
-
- // Set the perspective.
- page.setPerspective(persp);
-}
-/**
- * Stores the configuration element for the wizard. The config element will be used
- * in <code>performFinish</code> to set the result perspective.
- */
-public void setInitializationData(IConfigurationElement cfig, String propertyName, Object data) {
- configElement = cfig;
-}
-/**
- * Updates the perspective for the active page within the window.
- */
-protected void updatePerspective() {
- updatePerspective(configElement);
-}
-/**
- * Update the perspective based on the current setting
- * in the workbench preference page.
- * <p>
- * A new project wizard class will need to implement the
- * <code>IExecutableExtension</code> interface so as to gain
- * access to the wizard's <code>IConfigurationElement</code>.
- * That is the configuration element to pass into this method.
- * </p>
- *
- * @see @IWorkbenchPreferenceConstants#OPEN_PERSPECTIVE_WINDOW
- * @see @IWorkbenchPreferenceConstants#OPEN_PERSPECTIVE_PAGE
- * @see @IWorkbenchPreferenceConstants#OPEN_PERSPECTIVE_REPLACE
- * @see @IWorkbenchPreferenceConstants#NO_NEW_PERSPECTIVE
- */
-public static void updatePerspective(IConfigurationElement configElement) {
- // Do not change perspective if the configuration element is
- // not specified.
- if (configElement == null)
- return;
-
- // Retrieve the new project open perspective preference setting
- String perspSetting =
- WorkbenchPlugin.getDefault().getPreferenceStore().getString(
- IWorkbenchPreferenceConstants.PROJECT_OPEN_NEW_PERSPECTIVE);
-
- // Return if do not switch perspective setting
- if (perspSetting.equals(IWorkbenchPreferenceConstants.NO_NEW_PERSPECTIVE))
- return;
-
- // Read the requested perspective id to be opened.
- String perspID = configElement.getAttribute("finalPerspective");//$NON-NLS-1$
- if (perspID == null)
- return;
-
- // Map perspective id to descriptor.
- IPerspectiveRegistry reg = PlatformUI.getWorkbench().getPerspectiveRegistry();
- IPerspectiveDescriptor persp = reg.findPerspectiveWithId(perspID);
- if (persp == null)
- return;
-
- // Open perspective in new window setting
- if (perspSetting.equals(IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_WINDOW)) {
- openInNewWindow(persp);
- return;
- }
-
- // Open perspective in same window setting
- if (perspSetting.equals(IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_PAGE)) {
- openInNewPage(persp);
- return;
- }
-
- // Replace active perspective setting
- if (perspSetting.equals(IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE)) {
- replaceCurrentPerspective(persp);
- return;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewResourceWizard.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewResourceWizard.java
deleted file mode 100644
index 39ed576..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/BasicNewResourceWizard.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package org.eclipse.ui.wizards.newresource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.ISetSelectionTarget;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.swt.widgets.Display;
-import java.net.*;
-import java.util.*;
-
-/**
- * Abstract base implementation of the standard workbench wizards
- * that create new resources in the workspace.
- * <p>
- * This class is not intended to be subclassed outside this package.
- * </p>
- */
-public abstract class BasicNewResourceWizard extends Wizard implements INewWizard {
-
- /**
- * The workbench.
- */
- private IWorkbench workbench;
-
- /**
- * The current selection.
- */
- protected IStructuredSelection selection;
-/**
- * Creates an empty wizard for creating a new resource in the workspace.
- */
-protected BasicNewResourceWizard() {
- super();
-}
-/**
- * Returns the selection which was passed to <code>init</code>.
- *
- * @return the selection
- */
-public IStructuredSelection getSelection() {
- return selection;
-}
-/**
- * Returns the workbench which was passed to <code>init</code>.
- *
- * @return the workbench
- */
-public IWorkbench getWorkbench() {
- return workbench;
-}
-/**
- * The <code>BasicNewResourceWizard</code> implementation of this
- * <code>IWorkbenchWizard</code> method records the given workbench and
- * selection, and initializes the default banner image for the pages
- * by calling <code>initializeDefaultPageImageDescriptor</code>.
- * Subclasses may extend.
- */
-public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
- this.workbench = workbench;
- this.selection = currentSelection;
-
- initializeDefaultPageImageDescriptor();
-}
-/**
- * Initializes the default page image descriptor to an appropriate banner.
- * By calling <code>setDefaultPageImageDescriptor</code>.
- * The default implementation of this method uses a generic new wizard image.
- * <p>
- * Subclasses may reimplement.
- * </p>
- */
-protected void initializeDefaultPageImageDescriptor() {
- String iconPath = "icons/full/";//$NON-NLS-1$
- try {
- URL installURL = Platform.getPlugin(PlatformUI.PLUGIN_ID).getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + "wizban/new_wiz.gif");//$NON-NLS-1$
- ImageDescriptor desc = ImageDescriptor.createFromURL(url);
- setDefaultPageImageDescriptor(desc);
- }
- catch (MalformedURLException e) {
- // Should not happen. Ignore.
- }
-}
-/**
- * Selects and reveals the newly added resource in all parts
- * of the active workbench window's active page.
- *
- * @see ISetSelectionTarget
- */
-protected void selectAndReveal(IResource newResource) {
- selectAndReveal(newResource, getWorkbench().getActiveWorkbenchWindow());
-}
-/**
- * Attempts to select and reveal the specified resource in all
- * parts within the supplied workbench window's active page.
- * <p>
- * Checks all parts in the active page to see if they implement <code>ISetSelectionTarget</code>,
- * either directly or as an adapter. If so, tells the part to select and reveal the
- * specified resource.
- * </p>
- *
- * @param resource the resource to be selected and revealed
- * @param window the workbench window to select and reveal the resource
- *
- * @see ISetSelectionTarget
- */
-public static void selectAndReveal(IResource resource, IWorkbenchWindow window) {
- // validate the input
- if (window == null || resource == null)
- return;
- IWorkbenchPage page = window.getActivePage();
- if (page == null)
- return;
-
- // get all the view and editor parts
- List parts = new ArrayList();
- IWorkbenchPartReference refs[] = page.getViewReferences();
- for (int i = 0; i < refs.length; i++) {
- if(refs[i].getPart(false) != null)
- parts.add(refs[i].getPart(false));
- }
- refs = page.getEditorReferences();
- for (int i = 0; i < refs.length; i++) {
- if(refs[i].getPart(false) != null)
- parts.add(refs[i].getPart(false));
- }
-
- final ISelection selection = new StructuredSelection(resource);
- Iterator enum = parts.iterator();
- while (enum.hasNext()) {
- IWorkbenchPart part = (IWorkbenchPart) enum.next();
-
- // get the part's ISetSelectionTarget implementation
- ISetSelectionTarget target = null;
- if (part instanceof ISetSelectionTarget)
- target = (ISetSelectionTarget) part;
- else
- target = (ISetSelectionTarget) part.getAdapter(ISetSelectionTarget.class);
-
- if (target != null) {
- // select and reveal resource
- final ISetSelectionTarget finalTarget = target;
- window.getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- finalTarget.selectReveal(selection);
- }
- });
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/ResourceMessages.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/ResourceMessages.java
deleted file mode 100644
index a402de0..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/ResourceMessages.java
+++ /dev/null
@@ -1,47 +0,0 @@
-package org.eclipse.ui.wizards.newresource;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps managing messages
- */
-class ResourceMessages {
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.wizards.newresource.messages";//$NON-NLS-1$
- private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
-private ResourceMessages(){
- // prevent instantiation of class
-}
-/**
- * Returns the formatted message for the given key in
- * the resource bundle.
- *
- * @param key the resource name
- * @param args the message arguments
- * @return the string
- */
-public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key),args);
-}
-/**
- * Returns the resource object with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the key is returned.
- *
- * @param key the resource name
- * @return the string
- */
-public static String getString(String key) {
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/messages.properties b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/messages.properties
deleted file mode 100644
index 62bff0d..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/messages.properties
+++ /dev/null
@@ -1,30 +0,0 @@
-# ==============================================================================
-# (c) Copyright IBM Corp. 2000, 2001.
-# All Rights Reserved.
-# ==============================================================================
-
-# package: org.eclipse.ui.wizards.newresource
-
-
-# ==============================================================================
-# New Resource Wizards
-# ==============================================================================
-FileResource.shellTitle = New File
-FileResource.pageTitle = File
-FileResource.description = Create a new file resource.
-FileResource.errorMessage = Problems Opening Editor
-
-NewFolder.title = New Folder
-NewFolder.text = Folder
-
-NewProject.windowTitle = New Project
-NewProject.title = Project
-NewProject.description = Create a new project resource.
-NewProject.referenceTitle = Project References
-NewProject.refeerenceTitle = Project
-NewProject.referenceDescription = Select referenced projects.
-NewProject.errorOpeningPage = Problems Opening Page
-NewProject.errorOpeningWindow = Problems Opening Window
-NewProject.errorMessage = Creation Problems
-NewProject.internalError = Internal error: {0}
-NewProject.caseVariantExistsError = The underlying file system is case insensitive. There is an existing project which conflicts with ''{0}''.
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/package.html b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/package.html
deleted file mode 100644
index e7bcb60..0000000
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/wizards/newresource/package.html
+++ /dev/null
@@ -1,13 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides the standard wizards for creating files,
-folders, and projects in the workspace.
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.workbench/build.properties b/bundles/org.eclipse.ui.workbench/build.properties
deleted file mode 100644
index 6ca1d29..0000000
--- a/bundles/org.eclipse.ui.workbench/build.properties
+++ /dev/null
@@ -1,7 +0,0 @@
-source.workbench.jar = extensions/,\
- Eclipse UI/,\
- Eclipse UI Editor Support/
-bin.includes = icons/,\
- plugin.properties,\
- plugin.xml,\
- *.jar
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/IStatusLineManager.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/IStatusLineManager.java
deleted file mode 100644
index 724b5a0..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/IStatusLineManager.java
+++ /dev/null
@@ -1,93 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * The <code>IStatusLineManager</code> interface provides protocol
- * for displaying messages on a status line, for monitoring progress,
- * and for managing contributions to the status line.
- * <p>
- * <b>Note:</b> An error message overrides the current message until
- * the error message is cleared.
- * </p><p>
- * This package also provides a concrete status line manager implementation,
- * {@link StatusLineManager <code>StatusLineManager</code>}.
- * </p>
- */
-public interface IStatusLineManager extends IContributionManager {
-/**
- * Returns a progress monitor which reports progress
- * in the status line.
- *
- * @return the progress monitor
- */
-public IProgressMonitor getProgressMonitor();
-/**
- * Returns whether the cancel button on the status line's progress monitor
- * is enabled.
- *
- * @return <code>true</code> if the cancel button is enabled, or <code>false</code> if not
- */
-public boolean isCancelEnabled();
-/**
- * Sets whether the cancel button on the status line's progress monitor
- * is enabled.
- *
- * @param enabled<code>true</code> if the cancel button is enabled, or <code>false</code> if not
- */
-public void setCancelEnabled(boolean enabled);
-/**
- * Sets the error message text to be displayed on the status line.
- * The image on the status line is cleared.
- * <p>
- * An error message overrides the current message until the error
- * message is cleared (set to <code>null</code>).
- * </p>
- *
- * @param message the error message, or <code>null</code> to clear
- * the current error message.
- */
-public void setErrorMessage(String message);
-/**
- * Sets the image and error message to be displayed on the status line.
- * <p>
- * An error message overrides the current message until the error
- * message is cleared (set to <code>null</code>).
- * </p>
- *
- * @param image the image to use, or <code>null</code> for no image
- * @param message the error message, or <code>null</code> to clear
- * the current error message.
- */
-public void setErrorMessage(Image image, String message);
-/**
- * Sets the message text to be displayed on the status line.
- * The image on the status line is cleared.
- * <p>
- * This method replaces the current message but does not affect the
- * error message. That is, the error message, if set, will continue
- * to be displayed until it is cleared (set to <code>null</code>).
- * </p>
- *
- * @param message the message, or <code>null</code> for no message
- */
-public void setMessage(String message);
-/**
- * Sets the image and message to be displayed on the status line.
- * <p>
- * This method replaces the current message but does not affect the
- * error message. That is, the error message, if set, will continue
- * to be displayed until it is cleared (set to <code>null</code>).
- * </p>
- *
- * @param image the image to use, or <code>null</code> for no image
- * @param message the message, or <code>null</code> for no message
- */
-public void setMessage(Image image, String message);
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/StatusLine.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/StatusLine.java
deleted file mode 100644
index 674f43d..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/StatusLine.java
+++ /dev/null
@@ -1,518 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ProgressIndicator;
-import org.eclipse.jface.resource.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A StatusLine control is a SWT Composite with a horizontal layout which hosts
- * a number of status indication controls.
- * Typically it is situated below the content area of the window.
- * <p>
- * By default a StatusLine has two predefined status controls: a MessageLine and a
- * ProgressIndicator and it provides API for easy access.
- * </p>
- * <p>
- * This is an internal class, not intended to be used outside the JFace framework.
- * </p>
- */
-/* package */ class StatusLine extends Composite implements IProgressMonitor {
-
- /** Horizontal gaps between items. */
- public static final int GAP= 3;
- /** Progress bar creation is delayed by this ms */
- public static final int DELAY_PROGRESS= 500;
-
- // state
- protected boolean fProgressIsVisible= false;
- protected boolean fCancelButtonIsVisible= false;
- protected boolean fCancelEnabled= false;
- protected String fTaskName;
- protected boolean fIsCanceled;
- protected long fStartTime;
- private Cursor fStopButtonCursor;
- protected String fMessageText;
- protected Image fMessageImage;
- protected String fErrorText;
- protected Image fErrorImage;
-
- // SWT widgets
- protected CLabel fMessageLabel;
- protected ProgressIndicator fProgressBar;
- protected ToolBar fToolBar;
- protected ToolItem fCancelButton;
-
- protected static ImageDescriptor fgStopImage= ImageDescriptor.createFromFile(StatusLine.class, "images/stop.gif");//$NON-NLS-1$
- static {
- JFaceResources.getImageRegistry().put("org.eclipse.jface.parts.StatusLine.stopImage", fgStopImage);//$NON-NLS-1$
- }
-
- /**
- * @private
- */
- public class StatusLineLayout extends Layout {
-
- public Point computeSize(Composite composite, int wHint, int hHint, boolean changed) {
-
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- return new Point(wHint, hHint);
-
- Control[] children= composite.getChildren();
- int totalWidth= 0;
- int maxHeight= 0;
- int totalCnt= 0;
- for (int i= 0; i < children.length; i++) {
- boolean useWidth= true;
- Control w= children[i];
- if (w == fProgressBar && !fProgressIsVisible)
- useWidth= false;
- else if (w == fToolBar && !fCancelButtonIsVisible)
- useWidth= false;
- Point e= w.computeSize(SWT.DEFAULT, SWT.DEFAULT, changed);
- if (useWidth) {
- totalWidth+= e.x;
- totalCnt++;
- }
- maxHeight= Math.max(maxHeight, e.y);
- }
- if (totalCnt > 0)
- totalWidth+= (totalCnt-1) * GAP;
- if (totalWidth <= 0)
- totalWidth= maxHeight*4;
- return new Point(totalWidth, maxHeight);
- }
-
- public void layout(Composite composite, boolean flushCache) {
-
- if (composite == null)
- return;
-
- // StatusLineManager skips over the standard status line widgets
- // in its update method. There is thus a dependency
- // between the layout of the standard widgets and the update method.
-
- // Make sure cancel button and progress bar are before contributions.
- fMessageLabel.moveAbove(null);
- fToolBar.moveBelow(fMessageLabel);
- fProgressBar.moveBelow(fToolBar);
-
- Rectangle rect= composite.getClientArea();
- Control[] children= composite.getChildren();
- int count= children.length;
-
- int ws[]= new int[count];
-
- int totalWidth= -GAP;
- for (int i= 0; i < count; i++) {
- Control w= children[i];
- if (w == fProgressBar && !fProgressIsVisible)
- continue;
- if (w == fToolBar && !fCancelButtonIsVisible)
- continue;
- int width= w.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache).x;
- ws[i]= width;
- totalWidth+= width + GAP;
- }
-
- int diff= rect.width-totalWidth;
- ws[0]+= diff; // make the first StatusLabel wider
-
- // Check against minimum recommended width
- final int msgMinWidth = rect.width/3;
- if (ws[0] < msgMinWidth) {
- diff = ws[0] - msgMinWidth;
- ws[0] = msgMinWidth;
- } else {
- diff = 0;
- }
-
- // Take space away from the contributions first.
- for (int i = count -1; i >= 0 && diff < 0; --i) {
- int min = Math.min(ws[i], -diff);
- ws[i] -= min;
- diff += min + GAP;
- }
-
- int x= rect.x;
- int y= rect.y;
- int h= rect.height;
- for (int i= 0; i < count; i++) {
- Control w= children[i];
- /*
- * Workaround for Linux Motif:
- * Even if the progress bar and cancel button are
- * not set to be visible ad of width 0, they still
- * draw over the first pixel of the editor
- * contributions.
- *
- * The fix here is to draw the progress bar and
- * cancel button off screen if they are not visible.
- */
- if (w == fProgressBar && !fProgressIsVisible ||
- w == fToolBar && !fCancelButtonIsVisible) {
- w.setBounds(x + rect.width, y, ws[i], h);
- continue;
- }
- w.setBounds(x, y, ws[i], h);
- if (ws[i] > 0) x+= ws[i] + GAP;
- }
- }
- }
-
-
- /**
- * Create a new StatusLine as a child of the given parent.
- */
- public StatusLine(Composite parent) {
- super(parent, SWT.NONE);
-
- addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- handleDispose();
- }
- });
-
- // StatusLineManager skips over the standard status line widgets
- // in its update method. There is thus a dependency
- // between this code defining the creation and layout of the standard
- // widgets and the update method.
-
- setLayout(new StatusLineLayout());
-
- fMessageLabel= new CLabel(this, SWT.SHADOW_IN);
-
- fProgressIsVisible= false;
- fCancelEnabled= false;
-
- fToolBar= new ToolBar(this, SWT.FLAT);
- fCancelButton= new ToolItem(fToolBar, SWT.PUSH);
- fCancelButton.setImage(fgStopImage.createImage());
- fCancelButton.setToolTipText(JFaceResources.getString("Cancel_Current_Operation")); //$NON-NLS-1$
- fCancelButton.addSelectionListener(
- new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- setCanceled(true);
- }
- }
- );
- fCancelButton.addDisposeListener(new DisposeListener(){
- public void widgetDisposed(DisposeEvent e) {
- Image i = fCancelButton.getImage();
- if((i != null) && (!i.isDisposed()))
- i.dispose();
- }
- });
-
- fProgressBar= new ProgressIndicator(this);
- fProgressBar.setSize(200, 10);
-
- fStopButtonCursor= new Cursor(getDisplay(), SWT.CURSOR_ARROW);
- }
- /**
- * Notifies that the main task is beginning.
- *
- * @param name the name (or description) of the main task
- * @param totalWork the total number of work units into which
- * the main task is been subdivided. If the value is 0 or UNKNOWN the
- * implemenation is free to indicate progress in a way which doesn't
- * require the total number of work units in advance. In general users
- * should use the UNKNOWN value if they don't know the total amount of
- * work units.
- */
- public void beginTask(String name, int totalWork) {
-
- fStartTime= System.currentTimeMillis();
- if (totalWork == UNKNOWN || totalWork == 0) {
-
- final long timestamp= fStartTime;
- Thread t= new Thread() {
- public void run() {
- try {
- sleep(DELAY_PROGRESS);
- StatusLine.this.startAnimatedTask(timestamp);
- } catch (InterruptedException e) {
- }
- }
- };
- t.start();
-
- } else {
- fProgressBar.beginTask(totalWork);
- }
-
- if (name == null)
- fTaskName= "";//$NON-NLS-1$
- else
- fTaskName= name;
- setMessage(fTaskName);
- }
- /**
- * Notifies that the work is done; that is, either the main task is completed or the
- * user cancelled it.
- * Done() can be called more than once; an implementation should be prepared to handle
- * this case.
- */
- public void done() {
-
- fStartTime= 0;
-
- if (fProgressBar != null) {
- fProgressBar.sendRemainingWork();
- fProgressBar.done();
- }
- setMessage("");//$NON-NLS-1$
-
- hideProgress();
- }
- /**
- * Returns the status line's progress monitor
- */
- public IProgressMonitor getProgressMonitor() {
- return this;
- }
- /**
- * @private
- */
- protected void handleDispose() {
- fStopButtonCursor.dispose();
- fStopButtonCursor= null;
- }
-/**
- * Hides the Cancel button and ProgressIndicator.
- * @private
- */
-protected void hideProgress() {
-
- if (fProgressIsVisible && !isDisposed()) {
- fProgressIsVisible = false;
- fCancelEnabled = false;
- fCancelButtonIsVisible = false;
- if (fToolBar != null && !fToolBar.isDisposed())
- fToolBar.setVisible(false);
- if (fProgressBar != null && !fProgressBar.isDisposed())
- fProgressBar.setVisible(false);
- layout();
- }
-}
- /**
- * @see IProgressMonitor#internalWorked(double)
- */
- public void internalWorked(double work) {
- if (! fProgressIsVisible) {
- if (System.currentTimeMillis() - fStartTime > DELAY_PROGRESS)
- showProgress();
- }
-
- if (fProgressBar != null) {
- fProgressBar.worked(work);
- }
- }
- /**
- * Returns true if the user does some UI action to cancel this operation.
- * (like hitting the Cancel button on the progress dialog).
- * The long running operation typically polls isCanceled().
- */
- public boolean isCanceled() {
- return fIsCanceled;
- }
- /**
- * Returns <code>true</true> if the ProgressIndication provides UI for canceling
- * a long running operation.
- */
- public boolean isCancelEnabled() {
- return fCancelEnabled;
- }
- /**
- * Sets the cancel status. This method is usually called with the
- * argument false if a client wants to abort a cancel action.
- */
- public void setCanceled(boolean b) {
- fIsCanceled = b;
- if (fCancelButton != null)
- fCancelButton.setEnabled(!b);
- }
- /**
- * Controls whether the ProgressIndication provides UI for canceling
- * a long running operation.
- * If the ProgressIndication is currently visible calling this method may have
- * a direct effect on the layout because it will make a cancel button visible.
- */
- public void setCancelEnabled(boolean enabled) {
- fCancelEnabled= enabled;
- if (fProgressIsVisible && !fCancelButtonIsVisible && enabled) {
- showButton();
- layout();
- }
- if (fCancelButton != null && !fCancelButton.isDisposed())
- fCancelButton.setEnabled(enabled);
- }
-/**
- * Sets the error message text to be displayed on the status line.
- * The image on the status line is cleared.
- *
- * @param message the error message, or <code>null</code> for no error message
- */
-public void setErrorMessage(String message) {
- setErrorMessage(null, message);
-}
-/**
- * Sets an image and error message text to be displayed on the status line.
- *
- * @param image the image to use, or <code>null</code> for no image
- * @param message the error message, or <code>null</code> for no error message
- */
-public void setErrorMessage(Image image, String message) {
- fErrorText = trim(message);
- fErrorImage = image;
- updateMessageLabel();
-}
- /**
- * Applies the given font to this status line.
- */
- public void setFont(Font font) {
- super.setFont(font);
- Control[] children= getChildren();
- for (int i= 0; i < children.length; i++) {
- children[i].setFont(font);
- }
- }
-/**
- * Sets the message text to be displayed on the status line.
- * The image on the status line is cleared.
- *
- * @param message the error message, or <code>null</code> for no error message
- */
-public void setMessage(String message) {
- setMessage(null, message);
-}
-/**
- * Sets an image and a message text to be displayed on the status line.
- *
- * @param image the image to use, or <code>null</code> for no image
- * @param message the message, or <code>null</code> for no message
- */
-public void setMessage(Image image, String message) {
- fMessageText = trim(message);
- fMessageImage = image;
- updateMessageLabel();
-}
- /**
- * @see IProgressMonitor#setTaskName(java.lang.String)
- */
- public void setTaskName(String name) {
- fTaskName= name;
- }
- /**
- * Makes the Cancel button visible.
- * @private
- */
- protected void showButton() {
- if (fToolBar != null) {
- fToolBar.setVisible(true);
- fToolBar.setEnabled(true);
- fToolBar.setCursor(fStopButtonCursor);
- fCancelButtonIsVisible= true;
- }
- }
- /**
- * Shows the Cancel button and ProgressIndicator.
- * @private
- */
- protected void showProgress() {
- if (! fProgressIsVisible) {
- fProgressIsVisible= true;
- if (fCancelEnabled)
- showButton();
- if (fProgressBar != null)
- fProgressBar.setVisible(true);
- layout();
- }
- }
- /**
- * @private
- */
- void startAnimatedTask(final long timestamp) {
- if (fProgressBar != null) {
- fProgressBar.getDisplay().asyncExec(
- new Runnable() {
- public void run() {
- if (fStartTime == timestamp) {
- showProgress();
- fProgressBar.beginAnimatedTask();
- }
- }
- }
- );
- }
- }
- /**
- * Notifies that a subtask of the main task is beginning.
- * Subtasks are optional; the main task might not have subtasks.
- * @param name the name (or description) of the subtask
- * @see IProgressMonitor#subTask(String)
- */
- public void subTask(String name) {
- String text;
- if (fTaskName.length() == 0)
- text= name;
- else
- text = JFaceResources.format("Set_SubTask", new Object[] {fTaskName, name});//$NON-NLS-1$
- setMessage(text);
- }
-
- /**
- * Trims the message to be displayable in the status line.
- * This just pulls out the first line of the message.
- * Allows null.
- */
- String trim(String message) {
- if (message == null)
- return null;
- int cr = message.indexOf('\r');
- int lf = message.indexOf('\n');
- if (cr == -1 && lf == -1)
- return message;
- int len;
- if (cr == -1)
- len = lf;
- else if (lf == -1)
- len = cr;
- else
- len = Math.min(cr, lf);
- return message.substring(0, len);
- }
-
-/**
- * Updates the message label widget.
- */
-protected void updateMessageLabel() {
- if (fMessageLabel != null && !fMessageLabel.isDisposed()) {
- Display display = fMessageLabel.getDisplay();
- if ((fErrorText != null && fErrorText.length() > 0) || fErrorImage != null) {
- fMessageLabel.setForeground(JFaceColors.getErrorText(display));
- fMessageLabel.setText(fErrorText);
- fMessageLabel.setImage(fErrorImage);
- }
- else {
- fMessageLabel.setForeground(display.getSystemColor(SWT.COLOR_WIDGET_FOREGROUND));
- fMessageLabel.setText(fMessageText == null ? "" : fMessageText); //$NON-NLS-1$
- fMessageLabel.setImage(fMessageImage);
- }
- }
-}
- /**
- * @see IProgressMonitor#worked(int)
- */
- public void worked(int work) {
- internalWorked(work);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/StatusLineManager.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/StatusLineManager.java
deleted file mode 100644
index 4a59c93..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/StatusLineManager.java
+++ /dev/null
@@ -1,238 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.util.*;
-
-/**
- * A status line manager is a contribution manager which realizes itself and its items
- * in a status line control.
- * <p>
- * This class may be instantiated; it may also be subclassed if a more
- * sophisticated layout is required.
- * </p>
- */
-public class StatusLineManager extends ContributionManager implements IStatusLineManager {
-
- /**
- * The status line control; <code>null</code> before
- * creation and after disposal.
- */
- private StatusLine statusLine = null;
-/**
- * Creates a new status line manager.
- * Use the <code>createControl</code> method to create the
- * status line control.
- */
-public StatusLineManager() {
-}
-/**
- * Creates and returns this manager's status line control.
- * Does not create a new control if one already exists.
- *
- * @param parent the parent control
- * @return the status line control
- */
-public StatusLine createControl(Composite parent) {
- if (!statusLineExist() && parent != null) {
- statusLine= new StatusLine(parent);
- update(false);
- }
- return statusLine;
-}
-/**
- * Disposes of this status line manager and frees all allocated SWT resources.
- * Note that this method does not clean up references between this status line
- * manager and its associated contribution items.
- * Use <code>removeAll</code> for that purpose.
- */
-public void dispose() {
- if (statusLineExist())
- statusLine.dispose();
- statusLine = null;
-}
-/**
- * Internal -- returns the StatusLine control.
- * <p>
- * This method is not intended to be used outside of the JFace framework.
- * </p>
- */
-public Control getControl() {
- return statusLine;
-}
-/*
- * (non-Javadoc)
- * Method declared on IStatusLineManager
- */
-public IProgressMonitor getProgressMonitor() {
- return statusLine;
-}
-/* (non-Javadoc)
- * Method declared on IStatueLineManager
- */
-public boolean isCancelEnabled() {
- return statusLineExist() && statusLine.isCancelEnabled();
-}
-/* (non-Javadoc)
- * Method declared on IStatueLineManager
- */
-public void setCancelEnabled(boolean enabled) {
- if (statusLineExist())
- statusLine.setCancelEnabled(enabled);
-}
-/* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
-public void setErrorMessage(String message) {
- if (statusLineExist())
- statusLine.setErrorMessage(message);
-}
-/* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
-public void setErrorMessage(Image image, String message) {
- if (statusLineExist())
- statusLine.setErrorMessage(image, message);
-}
-/* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
-public void setMessage(String message) {
- if (statusLineExist())
- statusLine.setMessage(message);
-}
-/* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
-public void setMessage(Image image, String message) {
- if (statusLineExist())
- statusLine.setMessage(image, message);
-}
-
-/**
- * Returns whether the status line control is created
- * and not disposed.
- *
- * @return <code>true</code> if the control is created
- * and not disposed, <code>false</code> otherwise
- */
-private boolean statusLineExist() {
- return statusLine != null && !statusLine.isDisposed();
-}
-/* (non-Javadoc)
- * Method declared on IContributionManager.
- */
-public void update(boolean force) {
-
- //boolean DEBUG= false;
-
- if (isDirty() || force) {
-
- if (statusLineExist()) {
- statusLine.setRedraw(false);
-
-// if (DEBUG) System.out.println("update:");
- if (false) { // non-incremental update
- Control ws[]= statusLine.getChildren();
- for (int i= 0; i < ws.length; i++) {
- Control w= ws[i];
- Object data= w.getData();
- if (data instanceof IContributionItem) {
-// if (DEBUG) System.out.println(" disposing item: " + data);
- w.dispose();
- }
- }
-
- int oldChildCount = statusLine.getChildren().length;
- IContributionItem[] items= getItems();
- for (int i = 0; i < items.length; ++i) {
- IContributionItem ci= items[i];
- if (ci.isVisible()) {
- ci.fill(statusLine);
-// if (DEBUG) System.out.println(" added item: " + ci);
- // associate controls with contribution item
- Control[] newChildren = statusLine.getChildren();
- for (int j = oldChildCount; j < newChildren.length; j++) {
- newChildren[j].setData(ci);
- }
- oldChildCount = newChildren.length;
- }
- }
-
- } else { // incremental update
- // copy all active items into set
- IContributionItem[] items= getItems();
- HashMap ht= new HashMap(items.length*2);
- for (int i = 0; i < items.length; ++i) {
- IContributionItem ci= items[i];
- if (ci.isVisible())
- ht.put(ci, ci);
- }
- // remove obsolete (removed or non active)
- Control ws[]= statusLine.getChildren();
- for (int i= 0; i < ws.length; i++) {
- Object data= ws[i].getData();
- if (data instanceof IContributionItem) {
- IContributionItem item= (IContributionItem) data;
- if (ht.get(item) == null) { // not found
- // if (DEBUG) System.out.println(" disposing item: " + data);
- ws[i].dispose();
- }
- }
- }
- // add new
- IContributionItem src, dest;
- ws= statusLine.getChildren();
-
- // scrIx is used to skip over the standard status line widgets
- // (label, stop button and progress bar). There is thus a dependency
- // between this code and the creation and layout of the standard widgets
- // in the StatusLine constructor and in StatusLineLayout.layout
-
- int srcIx= 3;
- int destIx= 0;
- int oldChildCount = ws.length;
- for (int i = 0; i < items.length; ++i) {
- src= (IContributionItem) items[i];
-
- if (! src.isVisible()) // if not active skip this one
- continue; // we don't bounce the destIx!
- // get corresponding item in SWT widget
- if (srcIx < ws.length)
- dest= (IContributionItem) ws[srcIx].getData();
- else
- dest= null;
-
- if (dest != null && src.equals(dest)) { // no change
- //if (DEBUG) System.out.println(" no change: ");
- srcIx++;
- } else {
- // src is a new one: insert it at next position
- src.fill(statusLine);
- // if (DEBUG) System.out.println(" added at " + destIx + ": ");
- // associate controls with contribution item
- Control[] newChildren = statusLine.getChildren();
- for (int j = oldChildCount; j < newChildren.length; j++) {
- newChildren[j].setData(src);
- }
- oldChildCount = newChildren.length;
- }
- destIx++;
- }
- }
- setDirty(false);
-
- statusLine.layout();
- statusLine.setRedraw(true);
- }
- }
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/SubStatusLineManager.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/SubStatusLineManager.java
deleted file mode 100644
index 39ed352..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/action/SubStatusLineManager.java
+++ /dev/null
@@ -1,124 +0,0 @@
-package org.eclipse.jface.action;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.swt.graphics.*;
-
-/**
- * A <code>SubStatusLineManager</code> is used to define a set of contribution
- * items within a parent manager. Once defined, the visibility of the entire set can
- * be changed as a unit.
- */
-public class SubStatusLineManager extends SubContributionManager
- implements IStatusLineManager
-{
- /**
- * The parent status line manager.
- */
- private IStatusLineManager parentMgr;
-
- /**
- * Current status line message.
- */
- private String message;
-
- /**
- * Current status line error message.
- */
- private String errorMessage;
-
- /**
- * Current status line image.
- */
- private Image image;
-/**
- * Constructs a new manager.
- *
- * @param mgr the parent manager. All contributions made to the
- * <code>SubStatusLineManager</code> are forwarded and appear in the
- * parent manager.
- */
-public SubStatusLineManager(IStatusLineManager mgr) {
- super(mgr);
- parentMgr = mgr;
-}
-/* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
-public IProgressMonitor getProgressMonitor() {
- return parentMgr.getProgressMonitor();
-}
-/* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
-public boolean isCancelEnabled() {
- return parentMgr.isCancelEnabled();
-}
-/* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
-public void setCancelEnabled(boolean enabled) {
- parentMgr.setCancelEnabled(enabled);
-}
-/* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
-public void setErrorMessage(String message) {
- this.image = null;
- this.errorMessage = message;
- if (isVisible())
- parentMgr.setErrorMessage(errorMessage);
-}
-/* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
-public void setErrorMessage(Image image, String message) {
- this.image = image;
- this.errorMessage = message;
- if (isVisible())
- parentMgr.setErrorMessage(image, errorMessage);
-}
-/* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
-public void setMessage(String message) {
- this.image = null;
- this.message = message;
- if (isVisible())
- parentMgr.setMessage(message);
-}
-/* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
-public void setMessage(Image image, String message) {
- this.image = image;
- this.message = message;
- if (isVisible())
- parentMgr.setMessage(image, message);
-}
-/* (non-Javadoc)
- * Method declared on SubContributionManager.
- */
-public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- parentMgr.setErrorMessage(image, errorMessage);
- parentMgr.setMessage(image, message);
- } else {
- parentMgr.setMessage(null, (String)null);
- parentMgr.setErrorMessage(null, null);
- }
-}
-/* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
-public void update(boolean force) {
- // This method is not governed by visibility. The client may
- // call <code>setVisible</code> and then force an update. At that
- // point we need to update the parent.
- parentMgr.update(force);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/dialogs/ErrorDialog.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/dialogs/ErrorDialog.java
deleted file mode 100644
index b58af86..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/dialogs/ErrorDialog.java
+++ /dev/null
@@ -1,328 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.widgets.List; // disambiguate between swt and java util
-import org.eclipse.swt.events.*;
-import java.util.*;
-
-/**
- * A dialog to display one or more errors to the user, as contained in an
- * <code>IStatus</code> object. If an error contains additional detailed
- * information then a Details button is automatically supplied, which shows
- * or hides an error details viewer when pressed by the user.
- *
- * @see org.eclipse.core.runtime.IStatus
- */
-public class ErrorDialog extends IconAndMessageDialog {
-
- /**
- * Reserve room for this many list items.
- */
- private static final int LIST_ITEM_COUNT = 7;
-
- /**
- * The Details button.
- */
- private Button detailsButton;
-
- /**
- * The title of the dialog.
- */
- private String title;
-
- /**
- * The SWT list control that displays the error details.
- */
- private List list;
-
- /**
- * Indicates whether the error details viewer is currently created.
- */
- private boolean listCreated = false;
-
- /**
- * Filter mask for determining which status items to display.
- */
- private int displayMask = 0xFFFF;
-
- /**
- * The main status object.
- */
- private IStatus status;
-
- /**
- * List of the main error object's detailed errors
- * (element type: <code>IStatus</code>).
- */
- private java.util.List statusList;
-/**
- * Creates an error dialog.
- * Note that the dialog will have no visual representation (no widgets)
- * until it is told to open.
- * <p>
- * Normally one should use <code>openError</code> to create and open one of these.
- * This constructor is useful only if the error object being displayed contains child
- * items <it>and</it> you need to specify a mask which will be used to filter the
- * displaying of these children.
- * </p>
- *
- * @param parentShell the shell under which to create this dialog
- * @param dialogTitle the title to use for this dialog,
- * or <code>null</code> to indicate that the default title should be used
- * @param message the message to show in this dialog,
- * or <code>null</code> to indicate that the error's message should be shown
- * as the primary message
- * @param status the error to show to the user
- * @param displayMask the mask to use to filter the displaying of child items,
- * as per <code>IStatus.matches</code>
- * @see org.eclipse.core.runtime.IStatus#matches
- */
-public ErrorDialog(Shell parentShell, String dialogTitle, String message, IStatus status, int displayMask) {
- super(parentShell);
- this.title = dialogTitle == null ?
- JFaceResources.getString("Problem_Occurred"): //$NON-NLS-1$
- dialogTitle;
- this.message = message == null ?
- status.getMessage():
- JFaceResources.format("Reason", new Object[] {message, status.getMessage()}); //$NON-NLS-1$
- this.status = status;
- statusList = Arrays.asList(status.getChildren());
- this.displayMask = displayMask;
- setShellStyle(SWT.DIALOG_TRIM | SWT.RESIZE | SWT.APPLICATION_MODAL);
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- * Handles the pressing of the Ok or Details button in this dialog.
- * If the Ok button was pressed then close this dialog. If the Details
- * button was pressed then toggle the displaying of the error details area.
- * Note that the Details button will only be visible if the error being
- * displayed specifies child details.
- */
-protected void buttonPressed(int id) {
- if (id == IDialogConstants.DETAILS_ID) { // was the details button pressed?
- toggleDetailsArea();
- } else {
- super.buttonPressed(id);
- }
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(title);
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void createButtonsForButtonBar(Composite parent) {
- // create OK and Details buttons
- createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
- if (status.isMultiStatus()) {
- detailsButton = createButton(parent, IDialogConstants.DETAILS_ID, IDialogConstants.SHOW_DETAILS_LABEL, false);
- }
-}
-
-
-/**
- * This implementation of the <code>Dialog</code> framework
- * method creates and lays out a composite and calls
- * <code>createMessageArea</code> and <code>createCustomArea</code>
- * to populate it. Subclasses should override <code>createCustomArea</code>
- * to add contents below the message.
- */
-protected Control createDialogArea(Composite parent) {
-
- createMessageArea(parent);
-
- // create a composite with standard margins and spacing
- Composite composite = new Composite(parent, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.numColumns = 2;
- composite.setLayout(layout);
- GridData childData = new GridData(GridData.FILL_BOTH);
- childData.horizontalSpan = 2;
- composite.setLayoutData(childData);
- composite.setFont(parent.getFont());
- return composite;
-
-}
-
-/*
- * @see IconAndMessageDialog#getImage()
- */
-protected Image getImage() {
- return JFaceResources.getImageRegistry().get(DLG_IMG_ERROR);
-}
-
-/**
- * Create this dialog's drop-down list component.
- *
- * @param parent the parent composite
- * @return the drop-down list component
- */
-protected List createDropDownList(Composite parent) {
- // create the list
- list = new List(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI);
-
- // fill the list
- populateList(list);
-
- GridData data = new GridData(
- GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL |
- GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_VERTICAL);
- data.heightHint = list.getItemHeight() * LIST_ITEM_COUNT;
- data.horizontalSpan = 2;
- list.setLayoutData(data);
- listCreated = true;
- return list;
-}
-/* (non-Javadoc)
- * Method declared on Window.
- */
-/**
- * Extends <code>Window.open()</code>.
- * Opens an error dialog to display the error.
- * If you specified a mask to filter the displaying of these
- * children, the error dialog will only be displayed if there is at
- * least one child status matching the mask.
- */
-public int open() {
- if (shouldDisplay(status, displayMask)) {
- return super.open();
- }
- return 0;
-}
-/**
- * Opens an error dialog to display the given error. Use this method if the
- * error object being displayed does not contain child items, or if you
- * wish to display all such items without filtering.
- *
- * @param parent the parent shell of the dialog, or <code>null</code> if none
- * @param dialogTitle the title to use for this dialog,
- * or <code>null</code> to indicate that the default title should be used
- * @param message the message to show in this dialog,
- * or <code>null</code> to indicate that the error's message should be shown
- * as the primary message
- * @param status the error to show to the user
- * @return the code of the button that was pressed that resulted in this dialog
- * closing. This will be <code>Dialog.OK</code> if the OK button was
- * pressed, or <code>Dialog.CANCEL</code> if this dialog's close window
- * decoration or the ESC key was used.
- */
-public static int openError(Shell parent, String dialogTitle, String message, IStatus status) {
- return openError(parent, dialogTitle, message, status, IStatus.OK | IStatus.INFO | IStatus.WARNING | IStatus.ERROR);
-}
-/**
- * Opens an error dialog to display the given error. Use this method if the
- * error object being displayed contains child items <it>and</it> you wish to
- * specify a mask which will be used to filter the displaying of these
- * children. The error dialog will only be displayed if there is at
- * least one child status matching the mask.
- *
- * @param parentShell the parent shell of the dialog, or <code>null</code> if none
- * @param dialogTitle the title to use for this dialog,
- * or <code>null</code> to indicate that the default title should be used
- * @param message the message to show in this dialog,
- * or <code>null</code> to indicate that the error's message should be shown
- * as the primary message
- * @param status the error to show to the user
- * @param displayMask the mask to use to filter the displaying of child items,
- * as per <code>IStatus.matches</code>
- * @return the code of the button that was pressed that resulted in this dialog
- * closing. This will be <code>Dialog.OK</code> if the OK button was
- * pressed, or <code>Dialog.CANCEL</code> if this dialog's close window
- * decoration or the ESC key was used.
- * @see org.eclipse.core.runtime.IStatus#matches
- */
-public static int openError(Shell parentShell, String title, String message, IStatus status, int displayMask) {
- ErrorDialog dialog = new ErrorDialog(parentShell, title, message, status, displayMask);
- return dialog.open();
-}
-/**
- * Populates the list using this error dialog's status object.
- * This walks the child stati of the status object and
- * displays them in a list. The format for each entry is
- * status_path : status_message
- * If the status's path was null then it (and the colon)
- * are omitted.
- */
-private void populateList(List list) {
- Iterator enum = statusList.iterator();
- while (enum.hasNext()) {
- IStatus childStatus = (IStatus) enum.next();
- populateList(list, childStatus, 0);
- }
-}
-private void populateList(List list, IStatus status, int nesting) {
- if (!status.matches(displayMask)) {
- return;
- }
- StringBuffer sb = new StringBuffer();
- for (int i = 0; i < nesting; i++) {
- sb.append(" "); //$NON-NLS-1$
- }
- sb.append(status.getMessage());
- list.add(sb.toString());
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- populateList(list, children[i], nesting + 1);
- }
-}
-/**
- * Returns whether the given status object should be displayed.
- *
- * @param status a status object
- * @param mask a mask as per <code>IStatus.matches</code>
- * @return <code>true</code> if the given status should be displayed,
- * and <code>false</code> otherwise
- * @see org.eclipse.core.runtime.IStatus#matches
- */
-protected static boolean shouldDisplay(IStatus status, int mask) {
- IStatus[] children = status.getChildren();
- if (children == null || children.length == 0) {
- return status.matches(mask);
- }
- for (int i = 0; i<children.length; i++) {
- if (children[i].matches(mask))
- return true;
- }
- return false;
-}
-/**
- * Toggles the unfolding of the details area. This is triggered by
- * the user pressing the details button.
- */
-private void toggleDetailsArea() {
- Point windowSize = getShell().getSize();
- Point oldSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- if (listCreated) {
- list.dispose();
- listCreated = false;
- detailsButton.setText(IDialogConstants.SHOW_DETAILS_LABEL);
- } else {
- list = createDropDownList((Composite)getContents());
- detailsButton.setText(IDialogConstants.HIDE_DETAILS_LABEL);
- }
-
- Point newSize = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT);
-
- getShell().setSize(new Point(windowSize.x, windowSize.y + (newSize.y - oldSize.y)));
-
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/dialogs/ProgressMonitorDialog.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/dialogs/ProgressMonitorDialog.java
deleted file mode 100644
index b5fed32..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/dialogs/ProgressMonitorDialog.java
+++ /dev/null
@@ -1,421 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.operation.*;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.events.*;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * A modal dialog that displays progress during a long running operation.
- * <p>
- * This concete dialog class can be instantiated as is,
- * or further subclassed as required.
- * </p>
- * <p>
- * Typical usage is:
- * <pre>
- * try {
- * IRunnableWithProgress op = ...;
- * new ProgressMonitorDialog(activeShell).run(true, true, op);
- * } catch (InvocationTargetException e) {
- * // handle exception
- * } catch (InterruptedException e) {
- * // handle cancelation
- * }
- * </pre>
- * </p>
- * <p>
- * Note that the ProgressMonitorDialog is not intended to be used
- * with multiple runnables - this dialog should be discarded
- * after completion of one IRunnableWithProgress and a new one instantiated
- * for use by a second or sebsequent IRunnableWithProgress to ensure
- * proper initialization.
- * </p>
- */
-public class ProgressMonitorDialog extends Dialog implements IRunnableContext {
-
- /**
- * Name to use for task when normal task name is empty string.
- */
- private static String DEFAULT_TASKNAME= JFaceResources.getString("ProgressMonitorDialog.message"); //$NON-NLS-1$
-
- /**
- * Constants for label and monitor size
- */
- private static int LABEL_DLUS = 21;
- private static int BAR_DLUS = 9;
-
-
- /**
- * The progress indicator control.
- */
- protected ProgressIndicator progressIndicator;
-
- /**
- * The label control for the task.
- */
- protected Label taskLabel;
-
- /**
- * The label control for the subtask.
- */
- protected Label subTaskLabel;
-
- /**
- * The Cancel button control.
- */
- protected Button cancel;
-
- /**
- * Indicates whether the Cancel button is to be shown.
- */
- protected boolean operationCancelableState = false;
-
- /**
- * Indicates whether the Cancel button is to be enabled.
- */
- protected boolean enableCancelButton;
-
- /**
- * The progress monitor.
- */
- private ProgressMonitor progressMonitor = new ProgressMonitor();
-
- /**
- * The name of the current task (used by ProgressMonitor).
- */
- private String task;
-
- /**
- * The number of currently running runnables.
- */
- private int runningRunnables;
-
- /**
- * The cursor used in the cancel button;
- */
- private Cursor arrowCursor;
-
- /**
- * The cursor used in the shell;
- */
- private Cursor waitCursor;
-
- /**
- * Internal progress monitor implementation.
- */
- private class ProgressMonitor implements IProgressMonitor {
-
- private String fSubTask= "";//$NON-NLS-1$
- private boolean fIsCanceled;
- protected boolean forked = false;
-
- public void beginTask(String name, int totalWork) {
- //System.out.println("beginTask: " + name + " " + totalWork);
- if (progressIndicator.isDisposed())
- return;
-
- if (name == null)
- task= "";//$NON-NLS-1$
- else
- task= name;
-
- String s= task;
- if (s.length() <= 0)
- s= DEFAULT_TASKNAME;
- taskLabel.setText(s);
- if(!forked)
- taskLabel.update();
-
- if (totalWork == UNKNOWN) {
- progressIndicator.beginAnimatedTask();
- } else {
- progressIndicator.beginTask(totalWork);
- }
- }
-
- public void done() {
- //System.out.println("done");
- if (!progressIndicator.isDisposed()) {
- progressIndicator.sendRemainingWork();
- progressIndicator.done();
- }
- }
-
- public void setTaskName(String name) {
- //System.out.println("setTaskName " + name);
- if (taskLabel.isDisposed())
- return;
- if (name == null)
- task= "";//$NON-NLS-1$
- else
- task= name;
-
- String s= task;
- if (s.length() <= 0)
- s= DEFAULT_TASKNAME;
- taskLabel.setText(s);
- if(!forked)
- taskLabel.update();
- }
-
- public boolean isCanceled() {
- return fIsCanceled;
- }
-
- public void setCanceled(boolean b) {
- fIsCanceled= b;
- }
-
- public void subTask(String name) {
- //System.out.println("subTask " + name);
- if (subTaskLabel.isDisposed())
- return;
-
- if (name == null)
- fSubTask= "";//$NON-NLS-1$
- else
- fSubTask= name;
-
- subTaskLabel.setText(fSubTask);
- if(!forked)
- subTaskLabel.update();
- }
-
- public void worked(int work) {
- //System.out.println("worked " + work);
- internalWorked(work);
- }
-
- public void internalWorked(double work) {
- //System.out.println("internalWorked " + work);
- if (!progressIndicator.isDisposed())
- progressIndicator.worked(work);
- }
- }
-/**
- * Creates a progress monitor dialog under the given shell.
- * The dialog has a standard title and no image.
- * <code>open</code> is non-blocking.
- *
- * @param parent the parent shell
- */
-public ProgressMonitorDialog(Shell parent) {
- super(parent);
- setShellStyle(SWT.BORDER | SWT.TITLE | SWT.APPLICATION_MODAL); // no close button
- setBlockOnOpen(false);
-}
-/**
- * Enables the cancel button (asynchronously).
- */
-private void asyncSetOperationCancelButtonEnabled(final boolean b) {
- if (getShell() != null) {
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- setOperationCancelButtonEnabled(b);
- }
- });
- }
-}
-/* (non-Javadoc)
- * Method declared on Window.
- */
-/**
- * The <code>ProgressMonitorDialog</code> implementation of this method
- * only closes the dialog if there are no currently running runnables.
- */
-public boolean close() {
- if (runningRunnables <= 0) {
- if (cancel != null && !cancel.isDisposed()) {
- cancel.setCursor(null);
- }
- Shell shell = getShell();
- if (shell != null && !shell.isDisposed()) {
- shell.setCursor(null);
- }
- if (arrowCursor != null)
- arrowCursor.dispose();
- if (waitCursor != null)
- waitCursor.dispose();
- arrowCursor = null;
- waitCursor = null;
- return super.close();
- }
- return false;
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(JFaceResources.getString("ProgressMonitorDialog.title")); //$NON-NLS-1$
- if(waitCursor == null)
- waitCursor = new Cursor(shell.getDisplay(),SWT.CURSOR_WAIT);
- shell.setCursor(waitCursor);
-}
-
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void createButtonsForButtonBar(Composite parent) {
- // cancel button
- cancel = createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
- if(arrowCursor == null)
- arrowCursor = new Cursor(cancel.getDisplay(),SWT.CURSOR_ARROW);
- cancel.setCursor(arrowCursor);
- cancel.addListener(SWT.Selection,
- new Listener() {
- public void handleEvent(Event e) {
- cancel.setEnabled(false);
- progressMonitor.setCanceled(true);
- }
- }
- );
- setOperationCancelButtonEnabled(enableCancelButton);
-}
-/*
- * @see Dialog.createContents(Composite)
- */
-protected Control createContents(Composite parent) {
-
- // initialize the dialog units
- initializeDialogUnits(parent);
-
- GridLayout layout = new GridLayout();
- layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
- layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
- layout.makeColumnsEqualWidth = false;
- layout.numColumns = 2;
- parent.setLayout(layout);
- parent.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // create the dialog area and button bar
- dialogArea = createDialogArea(parent);
- buttonBar = createButtonBar(parent);
-
- GridData barData = (GridData) buttonBar.getLayoutData();
- barData.horizontalSpan = 2;
- buttonBar.setLayoutData(barData);
-
- return parent;
-}
-
-
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
-
- // icon
- Label iconLabel= new Label(parent, SWT.LEFT);
- iconLabel.setLayoutData(new GridData(
- GridData.HORIZONTAL_ALIGN_CENTER |
- GridData.VERTICAL_ALIGN_BEGINNING));
- Image i= JFaceResources.getImageRegistry().get(Dialog.DLG_IMG_INFO);
- if (i != null)
- iconLabel.setImage(i);
- else {
- iconLabel.setText(JFaceResources.getString("Image_not_found")); //$NON-NLS-1$
- }
-
- // label on right hand side of icon
- taskLabel = new Label(parent, SWT.LEFT | SWT.WRAP);
- GridData gd = new GridData(
- GridData.GRAB_HORIZONTAL |
- GridData.GRAB_VERTICAL |
- GridData.HORIZONTAL_ALIGN_FILL |
- GridData.VERTICAL_ALIGN_CENTER);
- gd.heightHint= convertVerticalDLUsToPixels(LABEL_DLUS);
- taskLabel.setLayoutData(gd);
- taskLabel.setText(DEFAULT_TASKNAME);
- taskLabel.setFont(parent.getFont());
-
- // progress indicator
- progressIndicator= new ProgressIndicator(parent);
- gd= new GridData();
- gd.heightHint= convertVerticalDLUsToPixels(BAR_DLUS);
- gd.horizontalAlignment= GridData.FILL;
- gd.grabExcessHorizontalSpace= true;
- gd.horizontalSpan= 2;
- progressIndicator.setLayoutData(gd);
-
- // label showing current task
- subTaskLabel= new Label(parent, SWT.LEFT | SWT.WRAP);
- gd= new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint= convertVerticalDLUsToPixels(LABEL_DLUS);
- gd.horizontalSpan= 2;
- subTaskLabel.setLayoutData(gd);
- subTaskLabel.setFont(parent.getFont());
-
- return parent;
-}
-
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected Point getInitialSize() {
- return getShell().computeSize(450, SWT.DEFAULT);
-}
-/**
- * Returns the progress monitor to use for operations run in
- * this progress dialog.
- *
- * @return the progress monitor
- */
-public IProgressMonitor getProgressMonitor() {
- return progressMonitor;
-}
-/* (non-Javadoc)
- * Method declared on IRunnableContext.
- * Runs the given <code>IRunnableWithProgress</code> with the progress monitor for this
- * progress dialog. The dialog is opened before it is run, and closed after it completes.
- */
-public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- setCancelable(cancelable);
- open();
- try {
- runningRunnables++;
-
- //Let the progress monitor know if they need to update in UI Thread
- progressMonitor.forked = fork;
- ModalContext.run(runnable, fork, getProgressMonitor(), getShell().getDisplay());
- } finally {
- runningRunnables--;
- close();
- }
-}
-/**
- * Sets whether the progress dialog is cancelable or not.
- *
- * @param cancelable <code>true</code> if the end user can cancel
- * this progress dialog, and <code>false</code> if it cannot be canceled
- */
-public void setCancelable(boolean cancelable) {
- if (cancel == null)
- enableCancelButton = cancelable;
- else
- asyncSetOperationCancelButtonEnabled(cancelable);
-}
-/**
- * Helper to enable/disable Cancel button for this dialog.
- *
- * @param b <code>true</code> to enable the cancel button,
- * and <code>false</code> to disable it
- */
-private void setOperationCancelButtonEnabled(boolean b) {
- operationCancelableState = b;
- cancel.setEnabled(b);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/images/preference.gif b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/images/preference.gif
deleted file mode 100644
index 2b8c0bb..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/images/preference.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/images/wizard.gif b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/images/wizard.gif
deleted file mode 100644
index 2b8c0bb..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/images/wizard.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/AccumulatingProgressMonitor.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/AccumulatingProgressMonitor.java
deleted file mode 100644
index 9a5e309..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/AccumulatingProgressMonitor.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package org.eclipse.jface.operation;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.ProgressMonitorWrapper;
-
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.util.Assert;
-
-/**
- * A progress monitor that accumulates <code>worked</code> and <code>subtask</code>
- * calls in the following way by wrapping a standard progress monitor:
- * <ul>
- * <li> When a <code>worked</code> or <code>subtask</code> call occurs the first time,
- * the progress monitor posts a runnable into the asynchronous SWT event queue.
- * </li>
- * <li> Subsequent calls to <code>worked</code> or <code>subtask</code> do not post
- * a new runnable as long as a previous runnable still exists in the SWT event
- * queue. In this case, the progress monitor just updates the internal state of
- * the runnable that waits in the SWT event queue for its execution. If no runnable
- * exists, a new one is created and posted into the event queue.
- * </ul>
- * <p>
- * This class is internal to the framework; clients outside JFace should not
- * use this class.
- * </p>
- */
-/* package */ class AccumulatingProgressMonitor extends ProgressMonitorWrapper {
-
- /**
- * The display.
- */
- private Display display;
-
- /**
- * The collector, or <code>null</code> if none.
- */
- private Collector collector;
-
- private class Collector implements Runnable {
- private String subTask;
- private double worked;
- private IProgressMonitor monitor;
-
- public Collector(String subTask, double work, IProgressMonitor monitor) {
- this.subTask = subTask;
- this.worked = work;
- this.monitor = monitor;
- }
-
- public void worked(double worked) {
- this.worked = this.worked + worked;
- }
-
- public void subTask(String subTask) {
- this.subTask = subTask;
- }
-
- public void run() {
- clearCollector(this);
- if (subTask != null)
- monitor.subTask(subTask);
- if (worked > 0)
- monitor.internalWorked(worked);
- }
- }
-/**
- * Creates an accumulating progress monitor wrapping the given one
- * that uses the given display.
- *
- * @param monitor the actual progress monitor to be wrapped
- * @param display the SWT display used to forward the calls
- * to the wrapped progress monitor
- */
-public AccumulatingProgressMonitor(IProgressMonitor monitor, Display display) {
- super(monitor);
- Assert.isNotNull(display);
- this.display = display;
-}
-/* (non-Javadoc)
- * Method declared on IProgressMonitor.
- */
-public void beginTask(final String name, final int totalWork) {
- synchronized(this) {
- collector = null;
- }
- display.syncExec(new Runnable() {
- public void run() {
- getWrappedProgressMonitor().beginTask(name, totalWork);
- }
- });
-}
-/**
- * Clears the collector object used to accumulate work and subtask calls
- * if it matches the given one.
- */
-private synchronized void clearCollector(Collector collector) {
- // Check if the accumulator is still using the given collector.
- // If not, don't clear it.
- if (this.collector == collector)
- this.collector = null;
-}
-/**
- * Creates a collector object to accumulate work and subtask calls.
- */
-private void createCollector(String subTask, double work) {
- collector = new Collector(subTask, work, getWrappedProgressMonitor());
- display.asyncExec(collector);
-}
-/* (non-Javadoc)
- * Method declared on IProgressMonitor.
- */
-public void done() {
- synchronized(this) {
- collector= null;
- }
- display.syncExec(new Runnable() {
- public void run() {
- getWrappedProgressMonitor().done();
- }
- });
-}
-/* (non-Javadoc)
- * Method declared on IProgressMonitor.
- */
-public synchronized void internalWorked(final double work) {
- if (collector == null) {
- createCollector(null, work);
- } else {
- collector.worked(work);
- }
-}
-/* (non-Javadoc)
- * Method declared on IProgressMonitor.
- */
-public void setTaskName(final String name) {
- synchronized(this) {
- collector= null;
- }
- display.syncExec(new Runnable() {
- public void run() {
- getWrappedProgressMonitor().setTaskName(name);
- }
- });
-}
-/* (non-Javadoc)
- * Method declared on IProgressMonitor.
- */
-public synchronized void subTask(final String name) {
- if (collector == null) {
- createCollector(name, 0);
- } else {
- collector.subTask(name);
- }
-}
-/* (non-Javadoc)
- * Method declared on IProgressMonitor.
- */
-public synchronized void worked(int work) {
- internalWorked(work);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/IRunnableContext.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/IRunnableContext.java
deleted file mode 100644
index 7bae079..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/IRunnableContext.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.eclipse.jface.operation;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * Interface for UI components which can execute a long-running operation
- * in the form of an <code>IRunnableWithProgress</code>.
- * The context is responsible for displaying a progress indicator and Cancel
- * button to the end user while the operation is in progress; the context
- * supplies a progress monitor to be used from code running inside the operation.
- * Note that an <code>IRunnableContext</code> is not a runnable itself.
- * <p>
- * For examples of UI components which implement this interface,
- * see <code>ApplicationWindow</code>, <code>ProgressMonitorDialog</code>,
- * and <code>WizardDialog</code>.
- * </p>
- *
- * @see IRunnableWithProgress
- * @see org.eclipse.jface.window.ApplicationWindow
- * @see org.eclipse.jface.dialogs.ProgressMonitorDialog
- * @see org.eclipse.jface.wizard.WizardDialog
- */
-public interface IRunnableContext {
-/**
- * Runs the given <code>IRunnableWithProgress</code> in this context.
- * For example, if this is a <code>ProgressMonitorDialog</code> then the runnable
- * is run using this dialog's progress monitor.
- *
- * @param fork <code>true</code> if the runnable should be run in a separate thread,
- * and <code>false</code> to run in the same thread
- * @param cancelable <code>true</code> to enable the cancelation, and
- * <code>false</code> to make the operation uncancellable
- * @param runnable the runnable to run
- *
- * @exception InvocationTargetException wraps any exception or error which occurs
- * while running the runnable
- * @exception InterruptedException propagated by the context if the runnable
- * acknowledges cancelation by throwing this exception. This should not be thrown
- * if cancelable is <code>false</code>.
- */
-public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException;
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/IRunnableWithProgress.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/IRunnableWithProgress.java
deleted file mode 100644
index 7fa1887..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/IRunnableWithProgress.java
+++ /dev/null
@@ -1,43 +0,0 @@
-package org.eclipse.jface.operation;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IProgressMonitor;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * The <code>IRunnableWithProgress</code> interface should be implemented by any
- * class whose instances are intended to be executed as a long-running operation.
- * Long-running operations are typically presented at the UI via a modal dialog
- * showing a progress indicator and a Cancel button.
- * The class must define a <code>run</code> method that takes a progress monitor.
- * The <code>run</code> method is usually not invoked directly, but rather by
- * passing the <code>IRunnableWithProgress</code> to the <code>run</code> method of
- * an <code>IRunnableContext</code>, which provides the UI for the progress monitor
- * and Cancel button.
- *
- * @see IRunnableContext
- */
-public interface IRunnableWithProgress {
-/**
- * Runs this operation. Progress should be reported to the given progress monitor.
- * This method is usually invoked by an <code>IRunnableContext</code>'s <code>run</code> method,
- * which supplies the progress monitor.
- * A request to cancel the operation should be honored and acknowledged
- * by throwing <code>InterruptedException</code>.
- *
- * @param monitor the progress monitor to use to display progress and receive
- * requests for cancelation
- * @exception InvocationTargetException if the run method must propagate a checked exception,
- * it should wrap it inside an <code>InvocationTargetException</code>; runtime exceptions are automatically
- * wrapped in an <code>InvocationTargetException</code> by the calling context
- * @exception InterruptedException if the operation detects a request to cancel,
- * using <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing
- * <code>InterruptedException</code>
- *
- * @see IRunnableContext#run
- */
-public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException;
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/ModalContext.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/ModalContext.java
deleted file mode 100644
index 39f9091..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/ModalContext.java
+++ /dev/null
@@ -1,324 +0,0 @@
-package org.eclipse.jface.operation;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.ProgressMonitorWrapper;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * Utility class for supporting modal operations.
- * The runnable passed to the <code>run</code> method is executed in a
- * separate thread, depending on the value of the passed fork argument.
- * If the runnable is executed in a separate thread then the current thread
- * either waits until the new thread ends or, if the current thread is the
- * UI thread, it polls the SWT event queue and dispatches each event.
- * <p>
- * This class is not intended to be subclassed.
- * </p>
- */
-public class ModalContext {
-
- /**
- * Indicated whether ModalContext is in debug mode;
- * <code>false</code> by default.
- */
- private static boolean debug = false;
-
- /**
- * The number of nested modal runs, or 0 if not inside a modal run.
- * This is global state.
- */
- private static int modalLevel = 0;
-
- /**
- * Indicates whether operations should be run in a separate thread.
- * Defaults to true.
- * For internal debugging use, set to false to run operations in the calling thread.
- */
- private static boolean runInSeparateThread = true;
-
- /**
- * Thread which runs the modal context.
- */
- private static class ModalContextThread extends Thread {
- /**
- * The operation to be run.
- */
- private IRunnableWithProgress runnable;
-
- /**
- * The exception thrown by the operation starter.
- */
- private Throwable throwable;
-
- /**
- * The progress monitor used for progress and cancelation.
- */
- private IProgressMonitor progressMonitor;
-
- /**
- * The display used for event dispatching.
- */
- private Display display;
-
- /**
- * Indicates whether to continue event queue dispatching.
- */
- private volatile boolean continueEventDispatching = true;
-
- /**
- * Creates a new modal context.
- *
- * @param operation the runnable to run
- * @param monitor the progress monitor to use to display progress and receive
- * requests for cancelation
- * @param display the display to be used to read and dispatch events
- */
- private ModalContextThread(IRunnableWithProgress operation, IProgressMonitor monitor, Display display) {
- super("ModalContext"); //$NON-NLS-1$
- Assert.isTrue(monitor != null && display != null);
- runnable = operation;
- progressMonitor = new AccumulatingProgressMonitor(monitor, display);
- this.display = display;
- }
- /* (non-Javadoc)
- * Method declared on Thread.
- */
- public void run() {
- try {
- if (runnable != null)
- runnable.run(progressMonitor);
- } catch (InvocationTargetException e) {
- throwable= e;
- } catch (InterruptedException e) {
- throwable= e;
- } catch (RuntimeException e) {
- throwable= e;
- } catch (ThreadDeath e) {
- // Make sure to propagate ThreadDeath, or threads will never fully terminate
- throw e;
- } catch (Error e) {
- throwable= e;
- } finally {
- // Make sure that all events in the asynchronous event queue
- // are dispatched.
- display.syncExec(new Runnable() {
- public void run() {
- // do nothing
- }
- });
-
- // Stop event dispatching
- continueEventDispatching= false;
-
- // Force the event loop to return from sleep () so that
- // it stops event dispatching.
- display.asyncExec(null);
- }
- }
- /**
- * Processes events or waits until this modal context thread terminates.
- */
- public void block() {
- if (display == Display.getCurrent()) {
- while (continueEventDispatching) {
- if (!display.readAndDispatch())
- display.sleep();
- }
- } else {
- try {
- join();
- } catch (InterruptedException e) {
- }
- }
- }
- }
-/**
- * Returns whether the first progress monitor is the same as, or
- * a wrapper around, the second progress monitor.
- *
- * @param monitor1 the first progress monitor
- * @param monitor2 the second progress monitor
- * @return <code>true</code> if the first is the same as, or
- * a wrapper around, the second
- * @see ProgressMonitorWrapper
- */
-public static boolean canProgressMonitorBeUsed(IProgressMonitor monitor1, IProgressMonitor monitor2) {
- if (monitor1 == monitor2)
- return true;
-
- while (monitor1 instanceof ProgressMonitorWrapper) {
- monitor1= ((ProgressMonitorWrapper)monitor1).getWrappedProgressMonitor();
- if (monitor1 == monitor2)
- return true;
- }
- return false;
-}
-/**
- * Checks with the given progress monitor and throws
- * <code>InterruptedException</code> if it has been canceled.
- * <p>
- * Code in a long-running operation should call this method
- * regularly so that a request to cancel will be honored.
- * </p>
- * <p>
- * Convenience for:
- * <pre>
- * if (monitor.isCanceled())
- * throw new InterruptedException();
- * </pre>
- * </p>
- *
- * @param monitor the progress monitor
- * @exception InterruptedException if cancelling the operation has been requested
- * @see IProgressMonitor#isCanceled
- */
-public static void checkCanceled(IProgressMonitor monitor) throws InterruptedException {
- if (monitor.isCanceled())
- throw new InterruptedException();
-}
-/**
- * Returns the currently active modal context thread, or null if no modal context is active.
- */
-private static ModalContextThread getCurrentModalContextThread() {
- Thread t = Thread.currentThread();
- if (t instanceof ModalContextThread)
- return (ModalContextThread) t;
- return null;
-}
-/**
- * Returns the modal nesting level.
- * <p>
- * The modal nesting level increases by one each time the
- * <code>ModalContext.run</code> method is called within the
- * dynamic scope of another call to <code>ModalContext.run</code>.
- * </p>
- *
- * @return the modal nesting level, or <code>0</code> if
- * this method is called outside the dynamic scope of any
- * invocation of <code>ModalContext.run</code>
- */
-public static int getModalLevel() {
- return modalLevel;
-}
-/**
- * Returns whether the given thread is running a modal context.
- *
- * @return <code>true</code> if the given thread is running a modal context, <code>false</code> if not
- */
-public static boolean isModalContextThread(Thread thread) {
- return thread instanceof ModalContextThread;
-}
-/**
- * Runs the given runnable in a modal context, passing it a progress monitor.
- * <p>
- * The modal nesting level is increased by one from the perspective
- * of the given runnable.
- * </p>
- *
- * @param operation the runnable to run
- * @param fork <code>true</code> if the runnable should run in a separate thread,
- * and <code>false</code> if in the same thread
- * @param monitor the progress monitor to use to display progress and receive
- * requests for cancelation
- * @param display the display to be used to read and dispatch events
- * @exception InvocationTargetException if the run method must propagate a checked exception,
- * it should wrap it inside an <code>InvocationTargetException</code>; runtime exceptions and errors are automatically
- * wrapped in an <code>InvocationTargetException</code> by this method
- * @exception InterruptedException if the operation detects a request to cancel,
- * using <code>IProgressMonitor.isCanceled()</code>, it should exit by throwing
- * <code>InterruptedException</code>; this method propagates the exception
- */
-public static void run(IRunnableWithProgress operation, boolean fork, IProgressMonitor monitor, Display display) throws InvocationTargetException, InterruptedException {
- Assert.isTrue(operation != null && monitor != null);
-
- modalLevel++;
- try {
- if (monitor != null)
- monitor.setCanceled(false);
- // Is the runnable supposed to be execute in the same thread.
- if (!fork || !runInSeparateThread) {
- runInCurrentThread(operation, monitor);
- } else {
- ModalContextThread t = getCurrentModalContextThread();
- if (t != null) {
- Assert.isTrue(canProgressMonitorBeUsed(monitor, t.progressMonitor));
- runInCurrentThread(operation, monitor);
- } else {
- t = new ModalContextThread(operation, monitor, display);
- t.start();
- t.block();
- Throwable throwable= t.throwable;
- if (throwable != null) {
- if (debug
- && !(throwable instanceof InterruptedException)
- && !(throwable instanceof OperationCanceledException)) {
- System.err.println("Exception in modal context operation:"); //$NON-NLS-1$
- throwable.printStackTrace();
- System.err.println("Called from:"); //$NON-NLS-1$
- // Don't create the InvocationTargetException on the throwable,
- // otherwise it will print its stack trace (from the other thread).
- new InvocationTargetException(null).printStackTrace();
- }
- if (throwable instanceof InvocationTargetException) {
- throw (InvocationTargetException) throwable;
- } else if (throwable instanceof InterruptedException) {
- throw (InterruptedException) throwable;
- } else if (
- throwable instanceof OperationCanceledException) {
- // See 1GAN3L5: ITPUI:WIN2000 - ModalContext converts OperationCancelException into InvocationTargetException
- throw new InterruptedException(throwable.getMessage());
- } else {
- throw new InvocationTargetException(throwable);
- }
- }
- }
- }
- }
- finally {
- modalLevel--;
- }
-}
-/**
- * Run a runnable. Convert all thrown exceptions to
- * either InterruptedException or InvocationTargetException
- */
-private static void runInCurrentThread(IRunnableWithProgress runnable, IProgressMonitor progressMonitor)
- throws InterruptedException, InvocationTargetException
-{
- try {
- if (runnable != null)
- runnable.run(progressMonitor);
- } catch (InvocationTargetException e) {
- throw e;
- } catch (InterruptedException e) {
- throw e;
- } catch (OperationCanceledException e) {
- throw new InterruptedException();
- } catch (ThreadDeath e) {
- // Make sure to propagate ThreadDeath, or threads will never fully terminate
- throw e;
- } catch (RuntimeException e) {
- throw new InvocationTargetException(e);
- } catch (Error e) {
- throw new InvocationTargetException(e);
- }
-}
-/**
- * Sets whether ModalContext is running in debug mode.
- *
- * @param debugMode <code>true</code> for debug mode,
- * and <code>false</code> for normal mode (the default)
- */
-public static void setDebugMode(boolean debugMode) {
- debug = debugMode;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/package.html b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/package.html
deleted file mode 100644
index d5828a6..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/operation/package.html
+++ /dev/null
@@ -1,26 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides JFace support for long-running operations.
-<h2>
-Package Specification</h2>
-Long-running operations must be dealt with specially in order to keep the
-UI helpful and responsive. Typically this involves temporarily disabling
-most controls and displaying a busy cursor and progress indicator; while
-the operation is in progress, the only requests that will be accepted will
-be ones to cancel the operation.
-<p>The <tt>IRunnableWithProgress</tt> interface should be implemented by
-any class whose instances are intended to be executed as long-running operations.
-These objects can then be run in any runnable context (<tt>IRunnableContext</tt>),
-including such standard JFace UI components as application windows (<tt>ApplicationWindow</tt>),
-wizard dialogs (<tt>WizardDialog</tt>), and progress monitor dialogs (<tt>ProgressMonitorDialog</tt>).
-The utility class <tt>ModalContext</tt> defines the basic mechanism and
-UI event loop for modal operations.
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/util/SafeRunnable.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/util/SafeRunnable.java
deleted file mode 100644
index 4fafe4e..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/util/SafeRunnable.java
+++ /dev/null
@@ -1,59 +0,0 @@
-package org.eclipse.jface.util;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.JFaceResources;
-
-/**
- * Implements a default implementation of ISafeRunnable.
- * The default implementation of <code>handleException</code>
- * opens a message dialog.
- */
-public abstract class SafeRunnable implements ISafeRunnable {
- private String message;
- private static boolean ignoreErrors = false;
-
-/**
- * Creates a new instance of SafeRunnable with a default error message.
- */
-public SafeRunnable() {}
-
-/**
- * Creates a new instance of SafeRunnable with the given error message.
- *
- * @param message the error message to use
- */
-public SafeRunnable(String message) {
- this.message = message;
-}
-
-/* (non-Javadoc)
- * Method declared on ISafeRunnable.
- */
-public void handleException(Throwable e) {
- // Workaround to avoid interactive error dialogs during automated testing
- if (!ignoreErrors) {
- if(message == null)
- message = JFaceResources.getString("SafeRunnable.errorMessage"); //$NON-NLS-1$
- MessageDialog.openError(null, JFaceResources.getString("Error"), message); //$NON-NLS-1$
- }
-}
-
-/**
- * Flag to avoid interactive error dialogs during automated testing.
- */
-public static boolean getIgnoreErrors(boolean flag) {
- return ignoreErrors;
-}
-
-/**
- * Flag to avoid interactive error dialogs during automated testing.
- */
-public static void setIgnoreErrors(boolean flag) {
- ignoreErrors = flag;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/window/ApplicationWindow.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/window/ApplicationWindow.java
deleted file mode 100644
index df4569c..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/window/ApplicationWindow.java
+++ /dev/null
@@ -1,454 +0,0 @@
-package org.eclipse.jface.window;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.operation.*;
-import org.eclipse.jface.resource.*;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import java.lang.reflect.InvocationTargetException;
-
-/**
- * An application window is a high-level "main window", with built-in
- * support for an optional menu bar with standard menus, an optional toolbar,
- * and an optional status line.
- * <p>
- * Creating an application window involves the following steps:
- * <ul>
- * <li>creating an instance of <code>ApplicationWindow</code>
- * </li>
- * <li>assigning the window to a window manager (optional)
- * </li>
- * <li>opening the window by calling <code>open</code>
- * </li>
- * </ul>
- * Only on the last step, when the window is told to open, are
- * the window's shell and widget tree created. When the window is
- * closed, the shell and widget tree are disposed of and are no longer
- * referenced, and the window is automatically removed from its window
- * manager. Like all windows, an application window may be reopened.
- * </p>
- * <p>
- * An application window is also a suitable context in which to perform
- * long-running operations (that is, it implements <code>IRunnableContext</code>).
- * </p>
- */
-public class ApplicationWindow extends Window implements IRunnableContext {
-
- /**
- * Menu bar manager, or <code>null</code> if none (default).
- *
- * @see #addMenuBar
- */
- private MenuManager menuBarManager = null;
-
- /**
- * Tool bar manager, or <code>null</code> if none (default).
- *
- * @see #addToolBar
- */
- private ToolBarManager toolBarManager = null;
-
- /**
- * Status line manager, or <code>null</code> if none (default).
- *
- * @see #addStatusLine
- */
- private StatusLineManager statusLineManager = null;
-
- /**
- * Internal application window layout class.
- * This vertical layout supports a tool bar area (fixed size),
- * a separator line, the content area (variable size), and a
- * status line (fixed size).
- */
- /*package*/ class ApplicationWindowLayout extends Layout {
-
- static final int VGAP = 2;
-
- 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= new Point(0, 0);
- Control[] ws= composite.getChildren();
- for (int i= 0; i < ws.length; i++) {
- Control w= ws[i];
-
- boolean hide= false;
- if (getToolBarControl() == w) {
- if (!toolBarChildrenExist()) {
- hide= true;
- result.y+= 23; // REVISIT
- }
- } else if (statusLineManager != null && statusLineManager.getControl() == w) {
- } else if (i > 0) { /* we assume this window is contents */
- hide= false;
- }
-
- if (! hide) {
- Point e= w.computeSize(wHint, hHint, flushCache);
- result.x= Math.max(result.x, e.x);
- result.y+= e.y + VGAP;
- }
- }
-
- if (wHint != SWT.DEFAULT)
- result.x= wHint;
- if (hHint != SWT.DEFAULT)
- result.y= hHint;
- return result;
- }
-
- protected void layout(Composite composite, boolean flushCache) {
- Rectangle clientArea= composite.getClientArea();
-
- Control[] ws= composite.getChildren();
-
- for (int i= 0; i < ws.length; i++) {
- Control w= ws[i];
-
- if (i == 0) { // Separator
- Point e= w.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
- w.setBounds(clientArea.x, clientArea.y, clientArea.width, e.y);
- clientArea.y+= e.y;
- clientArea.height-= e.y;
- } else if (getToolBarControl() == w) {
- if (toolBarChildrenExist()) {
- Point e= w.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
- w.setBounds(clientArea.x, clientArea.y, clientArea.width, e.y);
- clientArea.y+= e.y + VGAP;
- clientArea.height-= e.y + VGAP;
- }
- } else if (statusLineManager != null && statusLineManager.getControl() == w) {
- Point e= w.computeSize(SWT.DEFAULT, SWT.DEFAULT, flushCache);
- w.setBounds(clientArea.x, clientArea.y+clientArea.height-e.y, clientArea.width, e.y);
- clientArea.height-= e.y + VGAP;
- } else {
- w.setBounds(clientArea.x, clientArea.y + VGAP, clientArea.width, clientArea.height - VGAP);
- }
- }
- }
- }
-
-/**
- * Create an application window instance, whose shell will be created under the
- * given parent shell.
- * Note that the window will have no visual representation (no widgets)
- * until it is told to open. By default, <code>open</code> does not block.
- *
- * @param parentShell the parent shell, or <code>null</code> to create a top-level shell
- */
-public ApplicationWindow(Shell parentShell) {
- super(parentShell);
-}
-/**
- * Configures this window to have a menu bar.
- * Does nothing if it already has one.
- * This method must be called before this window's shell is created.
- */
-protected void addMenuBar() {
- if ((getShell() == null) && (menuBarManager == null)) {
- menuBarManager = createMenuManager();
- }
-}
-/**
- * Configures this window to have a status line.
- * Does nothing if it already has one.
- * This method must be called before this window's shell is created.
- */
-protected void addStatusLine() {
- if ((getShell() == null) && (statusLineManager == null)) {
- statusLineManager = createStatusLineManager();
- }
-}
-/**
- * Configures this window to have a tool bar.
- * Does nothing if it already has one.
- * This method must be called before this window's shell is created.
- */
-protected void addToolBar(int style) {
- if ((getShell() == null) && (toolBarManager == null)) {
- toolBarManager = createToolBarManager(style);
- }
-}
-/* (non-Javadoc)
- * Method declared on Window.
- */
-public boolean close() {
- if (super.close()) {
- menuBarManager = null;
- toolBarManager = null;
- statusLineManager = null;
- return true;
- }
- return false;
-}
-/* (non-Javadoc)
- * Method declared on Window.
- * Sets the ApplicationWindows's content layout.
- * This vertical layout supports a fixed size Toolbar area, a separator line,
- * the variable size content area,
- * and a fixed size status line.
- */
-protected void configureShell(Shell shell) {
-
- super.configureShell(shell);
-
- if (menuBarManager != null) {
- menuBarManager.updateAll(true);
- shell.setMenuBar(menuBarManager.createMenuBar(shell));
- }
-
- // we need a special layout
- shell.setLayout(new ApplicationWindowLayout());
-
- new Label(shell, SWT.SEPARATOR | SWT.HORIZONTAL);
-
- createToolBarControl(shell);
-
- if (statusLineManager != null) {
- statusLineManager.createControl(shell);
- }
-}
-/**
- * Returns a new menu manager for the window.
- * <p>
- * Subclasses may override this method to customize the menu manager.
- * </p>
- * @return a menu manager
- */
-protected MenuManager createMenuManager() {
- return new MenuManager();
-}
-/**
- * Returns a new status line manager for the window.
- * <p>
- * Subclasses may override this method to customize the status line manager.
- * </p>
- * @return a status line manager
- */
-protected StatusLineManager createStatusLineManager() {
- return new StatusLineManager();
-}
-/**
- * Returns a new tool bar manager for the window.
- * <p>
- * Subclasses may override this method to customize the tool bar manager.
- * </p>
- * @return a tool bar manager
- */
-protected ToolBarManager createToolBarManager(int style) {
- return new ToolBarManager(style);
-}
-/**
- * Creates the control for the tool bar manager.
- * <p>
- * Subclasses may override this method to customize the tool bar manager.
- * </p>
- * @return a Control
- */
-protected Control createToolBarControl(Shell shell) {
- if (toolBarManager instanceof ToolBarManager) {
- return ((ToolBarManager)toolBarManager).createControl(shell);
- }
- return null;
-}
-/**
- * Returns the default font used for this window.
- * <p>
- * The default implementation of this framework method
- * obtains the symbolic name of the font from the
- * <code>getSymbolicFontName</code> framework method
- * and retrieves this font from JFace's font
- * registry using <code>JFaceResources.getFont</code>.
- * Subclasses may override to use a different registry,
- * etc.
- * </p>
- *
- * @return the default font, or <code>null</code> if none
- */
-protected Font getFont() {
- return JFaceResources.getFont(getSymbolicFontName());
-}
-/**
- * Returns the menu bar manager for this window (if it has one).
- *
- * @return the menu bar manager, or <code>null</code> if
- * this window does not have a menu bar
- * @see #addMenuBar
- */
-public MenuManager getMenuBarManager() {
- return menuBarManager;
-}
-/**
- * Returns the status line manager for this window (if it has one).
- *
- * @return the status line manager, or <code>null</code> if
- * this window does not have a status line
- * @see #addStatusLine
- */
-protected StatusLineManager getStatusLineManager() {
- return statusLineManager;
-}
-
-/**
- * Returns the symbolic font name of the font to be
- * used to display text in this window.
- * This is not recommended and is included for backwards
- * compatability.
- * It is recommended to use the default font provided by
- * SWT (that is, do not set the font).
- *
- * @return the symbolic font name
- */
-public String getSymbolicFontName() {
- return JFaceResources.TEXT_FONT;
-}
-/**
- * Returns the tool bar manager for this window (if it has one).
- *
- * @return the tool bar manager, or <code>null</code> if
- * this window does not have a tool bar
- * @see #addToolBar
- */
-public ToolBarManager getToolBarManager() {
- return toolBarManager;
-}
-/**
- * Returns the control for the window's toolbar.
- * <p>
- * Subclasses may override this method to customize the tool bar manager.
- * </p>
- * @return a Control
- */
-protected Control getToolBarControl() {
- if (toolBarManager == null) return null;
- if (toolBarManager instanceof ToolBarManager) {
- return ((ToolBarManager)toolBarManager).getControl();
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IRunnableContext.
- */
-public void run(final boolean fork, boolean cancelable, final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- final StatusLineManager mgr = getStatusLineManager();
- if (mgr == null) {
- runnable.run(new NullProgressMonitor());
- return;
- }
- boolean cancelWasEnabled = mgr.isCancelEnabled();
-
- final Control contents = getContents();
- final Display display = contents.getDisplay();
- Shell shell = getShell();
- boolean contentsWasEnabled = contents.isEnabled();
- MenuManager manager = getMenuBarManager();
- Menu menuBar = null;
- if (manager != null) {
- menuBar = manager.getMenu();
- manager = null;
- }
- boolean menuBarWasEnabled = false;
- if (menuBar != null)
- menuBarWasEnabled = menuBar.isEnabled();
-
- Control toolbarControl = getToolBarControl();
- boolean toolbarWasEnabled = false;
- if (toolbarControl != null)
- toolbarWasEnabled = toolbarControl.isEnabled();
-
- // Disable the rest of the shells on the current display
- Shell[] shells = display.getShells();
- boolean[] enabled = new boolean[shells.length];
- for (int i = 0; i < shells.length; i++) {
- Shell current = shells[i];
- if (current == shell) continue;
- if (current != null && !current.isDisposed()) {
- enabled[i] = current.isEnabled();
- current.setEnabled(false);
- }
- }
-
- Control currentFocus = display.getFocusControl();
- try {
- contents.setEnabled(false);
- if (menuBar != null) menuBar.setEnabled(false);
- if (toolbarControl != null) toolbarControl.setEnabled(false);
- mgr.setCancelEnabled(cancelable);
- final Exception[] holder = new Exception[1];
- BusyIndicator.showWhile(display, new Runnable() {
- public void run() {
- try {
- ModalContext.run(runnable, fork, mgr.getProgressMonitor(), display);
- } catch (InvocationTargetException ite) {
- holder[0] = ite;
- } catch (InterruptedException ie) {
- holder[0] = ie;
- }
- }});
-
- if (holder[0] != null) {
- if (holder[0] instanceof InvocationTargetException) {
- throw (InvocationTargetException) holder[0];
- } else if (holder[0] instanceof InterruptedException) {
- throw (InterruptedException) holder[0];
- }
- }
- } finally {
- // Enable the rest of the shells on the current display
- for (int i = 0; i < shells.length; i++) {
- Shell current = shells[i];
- if (current == shell) continue;
- if (current != null && !current.isDisposed()) {
- current.setEnabled(enabled[i]);
- }
- }
- if (!contents.isDisposed())
- contents.setEnabled(contentsWasEnabled);
- if (menuBar != null && !menuBar.isDisposed())
- menuBar.setEnabled(menuBarWasEnabled);
- if (toolbarControl != null && !toolbarControl.isDisposed())
- toolbarControl.setEnabled(toolbarWasEnabled);
- mgr.setCancelEnabled(cancelWasEnabled);
- if (currentFocus != null) currentFocus.setFocus();
- }
-}
-/**
- * Sets or clears the message displayed in this window's status
- * line (if it has one). This method has no effect if the
- * window does not have a status line.
- *
- * @param message the status message, or <code>null</code> to clear it
- */
-public void setStatus(String message) {
- if (statusLineManager != null) {
- statusLineManager.setMessage(message);
- }
-}
-/**
- * Returns whether or not children exist for the Application Window's
- * toolbar control.
- * <p>
- * @return boolean true if children exist, false otherwise
- */
-protected boolean toolBarChildrenExist() {
- Control toolControl = getToolBarControl();
- if (toolControl instanceof ToolBar) {
- return ((ToolBar)toolControl).getItemCount() > 0;
- }
- return false;
-}
-
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizard.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizard.java
deleted file mode 100644
index ed36e3f..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizard.java
+++ /dev/null
@@ -1,209 +0,0 @@
-package org.eclipse.jface.wizard;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Interface for a wizard. A wizard maintains a list of wizard pages,
- * stacked on top of each other in card layout fashion.
- * <p>
- * The class <code>Wizard</code> provides an abstract implementation
- * of this interface. However, clients are also free to implement this
- * interface if <code>Wizard</code> does not suit their needs.
- * </p>
- * @see Wizard
- */
-public interface IWizard {
-/**
- * Adds any last-minute pages to this wizard.
- * <p>
- * This method is called just before the wizard becomes visible, to give the
- * wizard the opportunity to add any lazily created pages.
- * </p>
- */
-public void addPages();
-/**
- * Returns whether this wizard could be finished without further user
- * interaction.
- * <p>
- * The result of this method is typically used by the wizard container to enable
- * or disable the Finish button.
- * </p>
- *
- * @return <code>true</code> if the wizard could be finished,
- * and <code>false</code> otherwise
- */
-public boolean canFinish();
-/**
- * Creates this wizard's controls in the given parent control.
- * <p>
- * The wizard container calls this method to create the controls
- * for the wizard's pages before the wizard is opened. This allows
- * the wizard to size correctly; otherwise a resize may occur when
- * moving to a new page.
- * </p>
- *
- * @param pageContainer the parent control
- */
-public void createPageControls(Composite pageContainer);
-/**
- * Disposes of this wizard and frees all SWT resources.
- */
-public void dispose();
-/**
- * Returns the container of this wizard.
- *
- * @return the wizard container, or <code>null</code> if this
- * wizard has yet to be added to a container
- */
-public IWizardContainer getContainer();
-/**
- * Returns the default page image for this wizard.
- * <p>
- * This image can be used for pages which do not
- * supply their own image.
- * </p>
- *
- * @return the default page image
- */
-public Image getDefaultPageImage();
-/**
- * Returns the dialog settings for this wizard.
- * <p>
- * The dialog store is used to record state between
- * wizard invocations (for example, radio button selections,
- * last directory, etc.).
- * </p>
- *
- * @return the dialog settings, or <code>null</code> if none
- */
-public IDialogSettings getDialogSettings();
-/**
- * Returns the successor of the given page.
- * <p>
- * This method is typically called by a wizard page
- * </p>
- *
- * @param page the page
- * @return the next page, or <code>null</code> if none
- */
-public IWizardPage getNextPage(IWizardPage page);
-/**
- * Returns the wizard page with the given name belonging to this wizard.
- *
- * @param pageName the name of the wizard page
- * @return the wizard page with the given name, or <code>null</code> if none
- */
-public IWizardPage getPage(String pageName);
-/**
- * Returns the number of pages in this wizard.
- *
- * @return the number of wizard pages
- */
-public int getPageCount();
-/**
- * Returns all the pages in this wizard.
- *
- * @return a list of pages
- */
-public IWizardPage[] getPages();
-/**
- * Returns the predecessor of the given page.
- * <p>
- * This method is typically called by a wizard page
- * </p>
- *
- * @param page the page
- * @return the previous page, or <code>null</code> if none
- */
-public IWizardPage getPreviousPage(IWizardPage page);
-/**
- * Returns the first page to be shown in this wizard.
- *
- * @return the first wizard page
- */
-public IWizardPage getStartingPage();
-/**
- * Returns the title bar color for this wizard.
- *
- * @return the title bar color
- */
-public RGB getTitleBarColor();
-/**
- * Returns the window title string for this wizard.
- *
- * @return the window title string, or <code>null</code> for no title
- */
-public String getWindowTitle();
-/**
- * Returns whether help is available for this wizard.
- * <p>
- * The result of this method is typically used by the container to
- * show or hide the Help button.
- * </p>
- *
- * @return <code>true</code> if help is available,
- * and <code>false</code> if this wizard is helpless
- */
-public boolean isHelpAvailable();
-/**
- * Returns whether this wizard needs Previous and Next buttons.
- * <p>
- * The result of this method is typically used by the container.
- * </p>
- *
- * @return <code>true</code> if Previous and Next buttons are required,
- * and <code>false</code> if none are needed
- */
-public boolean needsPreviousAndNextButtons();
-/**
- * Returns whether this wizard needs a progress monitor.
- * <p>
- * The result of this method is typically used by the container.
- * </p>
- *
- * @return <code>true</code> if a progress monitor is required,
- * and <code>false</code> if none is needed
- */
-public boolean needsProgressMonitor();
-/**
- * Performs any actions appropriate in response to the user
- * having pressed the Cancel button, or refuse if canceling
- * now is not permitted.
- *
- * @return <code>true</code> to indicate the cancel request
- * was accepted, and <code>false</code> to indicate
- * that the cancel request was refused
- */
-public boolean performCancel();
-/**
- * Performs any actions appropriate in response to the user
- * having pressed the Finish button, or refuse if finishing
- * now is not permitted.
- *
- * Normally this method is only called on the container's
- * current wizard. However if the current wizard is a nested wizard
- * this method will also be called on all wizards in its parent chain.
- * Such parents may use this notification to save state etc. However,
- * the value the parents return from this method is ignored.
- *
- * @return <code>true</code> to indicate the finish request
- * was accepted, and <code>false</code> to indicate
- * that the finish request was refused
- */
-public boolean performFinish();
-/**
- * Sets or clears the container of this wizard.
- *
- * @param wizardContainer the wizard container, or <code>null</code>
- */
-public void setContainer(IWizardContainer wizardContainer);
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizardContainer.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizardContainer.java
deleted file mode 100644
index e97740b..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizardContainer.java
+++ /dev/null
@@ -1,102 +0,0 @@
-package org.eclipse.jface.wizard;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.jface.operation.IRunnableContext;
-
-/**
- * Interface for containers that can host a wizard. It displays
- * wizard pages, at most one of which is considered
- * the current page. <code>getCurrentPage</code> returns the
- * current page; <code>showPage</code> programmatically changes the
- * the current page. Note that the pages need not all belong
- * to the same wizard.
- * <p>
- * The class <code>WizardDialog</code> provides a fully functional
- * implementation of this interface which will meet the needs of
- * most clients. However, clients are also free to implement this
- * interface if <code>WizardDialog</code> does not suit their needs.
- * </p>
- * <p>
- * Implementors are responsible for disposing of their wizards.
- * </p>
- */
-public interface IWizardContainer extends IRunnableContext {
-/**
- * Returns the current wizard page for this container.
- *
- * @return the current wizard page, or <code>null</code> if the container
- * is not yet showing the wizard
- * @see #showPage
- */
-public IWizardPage getCurrentPage();
-/**
- * Returns the shell for this wizard container.
- *
- * @return the shell, or <code>null</code> if this wizard
- * container does not have a shell
- */
-public Shell getShell();
-/**
- * Makes the given page visible.
- * <p>
- * This method should not be use for normal page
- * sequencing (back, next) which is handled by the
- * container itself. It may, however, be used to
- * move to another page in response to some custom
- * action such as double clicking in a list.
- * </p>
- *
- * @param page the page to show
- * @see #getCurrentPage
- */
-public void showPage(IWizardPage page);
-/**
- * Adjusts the enable state of the Back, Next, and Finish
- * buttons to reflect the state of the currently active
- * page in this container.
- * <p>
- * This method is called by the container itself
- * when its wizard page changes and may be called
- * by the page at other times to force a button state
- * update.
- * </p>
- */
-public void updateButtons();
-/**
- * Updates the message (or error message) shown in the message line to
- * reflect the state of the currently active page in this container.
- * <p>
- * This method is called by the container itself
- * when its wizard page changes and may be called
- * by the page at other times to force a message
- * update.
- * </p>
- */
-public void updateMessage();
-/**
- * Updates the title bar (title, description, and image) to
- * reflect the state of the currently active page in this container.
- * <p>
- * This method is called by the container itself
- * when its wizard page changes and may be called
- * by the page at other times to force a title bar
- * update.
- * </p>
- */
-public void updateTitleBar();
-/**
- * Updates the window title to reflect the state of the current wizard.
- * <p>
- * This method is called by the container itself
- * when its wizard changes and may be called
- * by the wizard at other times to force a window
- * title change.
- * </p>
- */
-public void updateWindowTitle();
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizardNode.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizardNode.java
deleted file mode 100644
index da74e1c..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizardNode.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.jface.wizard;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.swt.graphics.Point;
-
-/**
- * A wizard node acts a placeholder for a real wizard in a wizard
- * selection page. It is done in such a way that the actual creation
- * of a wizard can be deferred until the wizard is really needed.
- * <p>
- * When a wizard node comes into existence, its wizard may or may
- * not have been created yet; <code>isContentCreated</code> can
- * be used to determine which. A node may be asked for its wizard
- * using <code>getWizard</code>, which will force it to be created
- * if required. Once the client is done with a wizard node, its
- * <code>dispose</code>method must be called to free up the wizard;
- * once disposes, the node should no longer be used.
- * </p>
- * <p>
- * This interface should be implemented by clients wishing to
- * support this kind of wizard placeholder in a wizard selection page.
- * </p>
- *
- * @see WizardSelectionPage
- */
-public interface IWizardNode {
-/**
- * Disposes the wizard managed by this node. Does nothing
- * if the wizard has not been created.
- * <p>
- * This is the last message that should ever be sent to this node.
- * </p>
- */
-public void dispose();
-/**
- * Returns the extent of the wizard for this node.
- * <p>
- * If the content has not yet been created, calling this method
- * does not trigger the creation of the wizard. This allows
- * this node to suggest an extent in advance of actually creating
- * the wizard.
- * </p>
- *
- * @return the extent, or <code>(-1, -1)</code> extent is not known
- */
-public Point getExtent();
-/**
- * Returns the wizard this node stands for.
- * <p>
- * If the content has not been created beforehand, calling this
- * method triggers the creation of the wizard and caches it so that
- * the identical wizard object is returned on subsequent calls.
- * </p>
- *
- * @return the wizard
- */
-public IWizard getWizard();
-/**
- * Returns whether a wizard has been created for this node.
- *
- * @return <code>true</code> if a wizard has been created,
- * and <code>false</code> otherwise
- */
-public boolean isContentCreated();
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizardPage.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizardPage.java
deleted file mode 100644
index 6a7563f..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/IWizardPage.java
+++ /dev/null
@@ -1,83 +0,0 @@
-package org.eclipse.jface.wizard;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.dialogs.IDialogPage;
-
-/**
- * Interface for a wizard page.
- * <p>
- * The class <code>WizardPage</code> provides an abstract implementation
- * of this interface. However, clients are also free to implement this
- * interface if <code>WizardPage</code> does not suit their needs.
- * </p>
- */
-public interface IWizardPage extends IDialogPage {
-/**
- * Returns whether the next page could be displayed.
- *
- * @return <code>true</code> if the next page could be displayed,
- * and <code>false</code> otherwise
- */
-public boolean canFlipToNextPage();
-/**
- * Returns this page's name.
- *
- * @return the name of this page
- */
-public String getName();
-/**
- * Returns the wizard page that would to be shown if the user was to
- * press the Next button.
- *
- * @return the next wizard page, or <code>null</code> if none
- */
-public IWizardPage getNextPage();
-/**
- * Returns the wizard page that would to be shown if the user was to
- * press the Back button.
- *
- * @return the previous wizard page, or <code>null</code> if none
- */
-public IWizardPage getPreviousPage();
-/**
- * Returns the wizard that hosts this wizard page.
- *
- * @return the wizard, or <code>null</code> if this page has not been
- * added to any wizard
- * @see #setWizard
- */
-public IWizard getWizard();
-/**
- * Returns whether this page is complete or not.
- * <p>
- * This information is typically used by the wizard to decide
- * when it is okay to finish.
- * </p>
- *
- * @return <code>true</code> if this page is complete, and
- * <code>false</code> otherwise
- */
-public boolean isPageComplete();
-/**
- * Sets the wizard page that would typically be shown
- * if the user was to press the Back button.
- * <p>
- * This method is called by the container.
- * </p>
- *
- * @param page the previous wizard page
- */
-public void setPreviousPage(IWizardPage page);
-/**
- * Sets the wizard that hosts this wizard page.
- * Once established, a page's wizard cannot be changed
- * to a different wizard.
- *
- * @param newWizard the wizard
- * @see #getWizard
- */
-public void setWizard(IWizard newWizard);
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/ProgressMonitorPart.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/ProgressMonitorPart.java
deleted file mode 100644
index e9ed8ba..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/ProgressMonitorPart.java
+++ /dev/null
@@ -1,217 +0,0 @@
-package org.eclipse.jface.wizard;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ProgressIndicator;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A standard implementation of an IProgressMonitor. It consists
- * of a label displaying the task and subtask name, and a
- * progress indicator to show progress. In contrast to
- * <code>ProgressMonitorDialog</code> this class only implements
- * <code>IProgressMonitor</code>.
- */
-public class ProgressMonitorPart extends Composite implements IProgressMonitor {
-
- protected Label fLabel;
- protected String fTaskName;
- protected String fSubTaskName;
- protected ProgressIndicator fProgressIndicator;
- protected Control fCancelComponent;
- protected boolean fIsCanceled;
-
- protected Listener fCancelListener= new Listener() {
- public void handleEvent(Event e) {
- setCanceled(true);
- if (fCancelComponent != null)
- fCancelComponent.setEnabled(false);
- }
- };
-
- /**
- * Creates a ProgressMonitorPart.
- * @param parent The SWT parent of the part.
- * @param layout The SWT grid bag layout used by the part. A client
- * can supply the layout to control how the progress monitor part
- * is layed out. If null is passed the part uses its default layout.
- */
- public ProgressMonitorPart(Composite parent, Layout layout) {
- this(parent, layout, SWT.DEFAULT);
- }
- /**
- * Creates a ProgressMonitorPart.
- * @param parent The SWT parent of the part.
- * @param layout The SWT grid bag layout used by the part. A client
- * can supply the layout to control how the progress monitor part
- * is layed out. If null is passed the part uses its default layout.
- * @param progressIndicatorHeight The height of the progress indicator in pixel.
- */
- public ProgressMonitorPart(Composite parent, Layout layout, int progressIndicatorHeight) {
- super(parent, SWT.NONE);
- initialize(layout, progressIndicatorHeight);
- }
- /**
- * Attaches the progress monitor part to the given cancel
- * component.
- */
- public void attachToCancelComponent(Control cancelComponent) {
- Assert.isNotNull(cancelComponent);
- fCancelComponent= cancelComponent;
- fCancelComponent.addListener(SWT.Selection, fCancelListener);
- }
- /**
- * Implements <code>IProgressMonitor.beginTask</code>.
- * @see IProgressMonitor#beginTask(java.lang.String, int)
- */
- public void beginTask(String name, int totalWork) {
- fTaskName= name;
- updateLabel();
- if (totalWork == IProgressMonitor.UNKNOWN || totalWork == 0) {
- fProgressIndicator.beginAnimatedTask();
- } else {
- fProgressIndicator.beginTask(totalWork);
- }
- }
- /**
- * Implements <code>IProgressMonitor.done</code>.
- * @see IProgressMonitor#done()
- */
- public void done() {
- fLabel.setText("");//$NON-NLS-1$
- fProgressIndicator.sendRemainingWork();
- fProgressIndicator.done();
- }
- /**
- * Escapes any occurrence of '&' in the given String so that
- * it is not considered as a mnemonic
- * character in SWT ToolItems, MenuItems, Button and Labels.
- */
- protected static String escapeMetaCharacters(String in) {
- if (in == null || in.indexOf('&') < 0)
- return in;
- int length= in.length();
- StringBuffer out= new StringBuffer(length+1);
- for (int i= 0; i < length; i++) {
- char c= in.charAt(i);
- if (c == '&')
- out.append("&&");//$NON-NLS-1$
- else
- out.append(c);
- }
- return out.toString();
- }
- /**
- * Creates the progress monitor's UI parts and layouts them
- * according to the given layout. If the layou is <code>null</code>
- * the part's default layout is used.
- */
- protected void initialize(Layout layout, int progressIndicatorHeight) {
- if (layout == null) {
- GridLayout l= new GridLayout();
- l.marginWidth= 0;
- l.marginHeight= 0;
- l.numColumns= 1;
- layout= l;
- }
- setLayout(layout);
-
- fLabel= new Label(this, SWT.LEFT);
- fLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- if (progressIndicatorHeight == SWT.DEFAULT) {
- GC gc= new GC(fLabel);
- FontMetrics fm= gc.getFontMetrics();
- gc.dispose();
- progressIndicatorHeight= fm.getHeight();
- }
-
- fProgressIndicator= new ProgressIndicator(this);
- GridData gd= new GridData();
- gd.horizontalAlignment= GridData.FILL;
- gd.grabExcessHorizontalSpace= true;
- gd.verticalAlignment= GridData.CENTER;
- gd.heightHint= progressIndicatorHeight;
- fProgressIndicator.setLayoutData(gd);
- }
- /**
- * Implements <code>IProgressMonitor.internalWorked</code>.
- * @see IProgressMonitor#internalWorked(double)
- */
- public void internalWorked(double work) {
- fProgressIndicator.worked(work);
- }
- /**
- * Implements <code>IProgressMonitor.isCanceled</code>.
- * @see IProgressMonitor#isCanceled()
- */
- public boolean isCanceled() {
- return fIsCanceled;
- }
- /**
- * Detached the progress monitor part to the given cancel
- * component
- */
- public void removeFromCancelComponent(Control cc) {
- Assert.isTrue(fCancelComponent == cc && fCancelComponent != null);
- fCancelComponent.removeListener(SWT.Selection, fCancelListener);
- fCancelComponent= null;
- }
- /**
- * Implements <code>IProgressMonitor.setCanceled</code>.
- * @see IProgressMonitor#setCanceled(boolean)
- */
- public void setCanceled(boolean b) {
- fIsCanceled= b;
- }
- /**
- * Sets the progress monitor part's font.
- */
- public void setFont(Font font) {
- super.setFont(font);
- fLabel.setFont(font);
- fProgressIndicator.setFont(font);
- }
- /**
- * @see IProgressMonitor#setTaskName(java.lang.String)
- */
- public void setTaskName(String name) {
- fTaskName= name;
- updateLabel();
- }
- /**
- * Implements <code>IProgressMonitor.subTask</code>.
- * @see IProgressMonitor#subTask(java.lang.String)
- */
- public void subTask(String name) {
- fSubTaskName= name;
- updateLabel();
- }
-
- /**
- * Updates the label with the current task and subtask names.
- */
- protected void updateLabel() {
- String text = fSubTaskName == null ? "" : fSubTaskName; //$NON-NLS-1$
- if (fTaskName != null && fTaskName.length() > 0) {
- text = JFaceResources.format("Set_SubTask", new Object[] {fTaskName, text});//$NON-NLS-1$
- }
- fLabel.setText(escapeMetaCharacters(text));
- }
-
- /**
- * Implements <code>IProgressMonitor.worked</code>.
- * @see IProgressMonitor#worked(int)
- */
- public void worked(int work) {
- internalWorked(work);
- }
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/Wizard.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/Wizard.java
deleted file mode 100644
index 1134bd9..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/Wizard.java
+++ /dev/null
@@ -1,421 +0,0 @@
-package org.eclipse.jface.wizard;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-import java.util.List; // disambiguate from SWT List
-
-/**
- * An abstract base implementation of a wizard. A typical client subclasses
- * both <code>Wizard</code> to implement a particular wizard.
- * <p>
- * Subclasses may call the following methods to configure the wizard:
- * <ul>
- * <li><code>addPage</code></li>
- * <li><code>setHelpAvailable</code></li>
- * <li><code>setDefaultPageImageDescriptor</code></li>
- * <li><code>setDialogSettings</code></li>
- * <li><code>setNeedsProgressMonitor</code></li>
- * <li><code>setTitleBarColor</code></li>
- * <li><code>setWindowTitle</code></li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may override these methods if required:
- * <ul>
- * <li>reimplement <code>createPageControls</code></li>
- * <li>reimplement <code>performCancel</code></li>
- * <li>extend <code>addPages</code></li>
- * <li>reimplement <code>performFinish</code></li>
- * <li>extend <code>dispose</code></li>
- * </ul>
- * </p>
- * <p>
- * Note that clients are free to implement <code>IWizard</code> from scratch
- * instead of subclassing <code>Wizard</code>. Correct implementations of
- * <code>IWizard</code> will work with any correct implementation of
- * <code>IWizardPage</code>.
- * </p>
- */
-public abstract class Wizard implements IWizard {
- /**
- * Image registry key of the default image for wizard pages
- * (value <code>"org.eclipse.jface.wizard.Wizard.pageImage"</code>).
- */
- public static final String DEFAULT_IMAGE= "org.eclipse.jface.wizard.Wizard.pageImage";//$NON-NLS-1$
-
- /*
- * Register the default page image
- */
- static {
- JFaceResources.getImageRegistry().put(
- DEFAULT_IMAGE,
- ImageDescriptor.createFromFile(Wizard.class, "images/page.gif"));//$NON-NLS-1$
- }
-
- /**
- * The wizard container this wizard belongs to; <code>null</code>
- * if none.
- */
- private IWizardContainer container = null;
-
- /**
- * This wizard's list of pages (element type: <code>IWizardPage</code>).
- */
- private List pages = new ArrayList();
-
- /**
- * Indicates whether this wizard needs a progress monitor.
- */
- private boolean needsProgressMonitor = false;
-
- /**
- * Indicates whether this wizard needs previous and next buttons
- * even if the wizard has only one page.
- */
- private boolean forcePreviousAndNextButtons = false;
-
- /**
- * Indicates whether this wizard supports help.
- */
- private boolean isHelpAvailable = false;
-
- /**
- * The default page image for pages without one of their one;
- * <code>null</code> if none.
- */
- private Image defaultImage = null;
-
- /**
- * The default page image descriptor, used for creating a default page
- * image if required; <code>null</code> if none.
- */
- private ImageDescriptor defaultImageDescriptor = null;
-
- /**
- * The color of the wizard title bar; <code>null</code> if none.
- */
- private RGB titleBarColor = null;
-
- /**
- * The window title string for this wizard; <code>null</code> if none.
- */
- private String windowTitle = null;
-
- /**
- * The dialog settings for this wizard; <code>null</code> if none.
- */
- private IDialogSettings dialogSettings = null;
-/**
- * Creates a new empty wizard.
- */
-protected Wizard() {
- super();
-}
-/**
- * Adds a new page to this wizard. The page is inserted at the
- * end of the page list.
- *
- * @param page the new page
- */
-public void addPage(IWizardPage page) {
- pages.add(page);
- page.setWizard(this);
-}
-/**
- * The <code>Wizard</code> implementation of this <code>IWizard</code>
- * method does nothing.
- * Subclasses should extend if extra pages need to be added before
- * the wizard opens. New pages should be added by calling <code>addPage</code>.
- */
-public void addPages() {
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public boolean canFinish() {
- // Default implementation is to check if all pages are complete.
- for (int i= 0; i < pages.size(); i++) {
- if (!((IWizardPage)pages.get(i)).isPageComplete())
- return false;
- }
- return true;
-}
-/**
- * The <code>Wizard</code> implementation of this <code>IWizard</code>
- * method creates all the pages controls using <code>IDialogPage.createControl</code>.
- * Subclasses should reimplement this method if they want to delay creating
- * one or more of the pages lazily. The framework ensures that the contents
- * of a page will be created before attempting to show it.
- */
-public void createPageControls(Composite pageContainer) {
- // the default behavior is to create all the pages controls
- for (int i = 0; i < pages.size(); i++){
- IWizardPage page = (IWizardPage)pages.get(i);
- page.createControl(pageContainer);
- // page is responsible for ensuring the created control is accessable
- // via getControl.
- Assert.isNotNull(page.getControl());
- }
-}
-/**
- * The <code>Wizard</code> implementation of this <code>IWizard</code>
- * method disposes all the pages controls using <code>DialogPage.dispose</code>.
- * Subclasses should extend this method if the wizard instance maintains
- * addition SWT resource that need to be disposed.
- */
-public void dispose() {
- // notify pages
- for (int i = 0; i < pages.size(); i++){
- ((IWizardPage)pages.get(i)).dispose();
- }
-
- // dispose of image
- if (defaultImage != null) {
- defaultImage.dispose();
- defaultImage = null;
- }
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public IWizardContainer getContainer() {
- return container;
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public Image getDefaultPageImage() {
- if (defaultImage != null)
- return defaultImage;
-
- if (defaultImageDescriptor != null) {
- defaultImage = defaultImageDescriptor.createImage();
- return defaultImage;
- }
-
- return JFaceResources.getImageRegistry().get(DEFAULT_IMAGE);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public IDialogSettings getDialogSettings() {
- return dialogSettings;
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- * The default behavior is to return the page that
- * was added to this wizard after the given page.
- */
-public IWizardPage getNextPage(IWizardPage page) {
- int index = pages.indexOf(page);
- if (index == pages.size() - 1 || index == -1)
- // last page or page not found
- return null;
-
- return (IWizardPage)pages.get(index + 1);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public IWizardPage getPage(String name) {
- for (int i= 0; i < pages.size(); i++) {
- IWizardPage page = (IWizardPage)pages.get(i);
- String pageName = page.getName();
- if (pageName.equals(name))
- return page;
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public int getPageCount() {
- return pages.size();
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public IWizardPage[] getPages() {
- return (IWizardPage[])pages.toArray(new IWizardPage[pages.size()]);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- * The default behavior is to return the page that
- * was added to this wizard before the given page.
- */
-public IWizardPage getPreviousPage(IWizardPage page) {
- int index = pages.indexOf(page);
- if (index == 0 || index == -1)
- // first page or page not found
- return null;
- else
- return (IWizardPage)pages.get(index - 1);
-}
-/**
- * Returns the wizard's shell if the wizard is visible. Otherwise
- * <code>null</code> is returned.
- */
-public Shell getShell() {
- if (container == null)
- return null;
-
- return container.getShell();
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- * By default this is the first page inserted into the wizard.
- */
-public IWizardPage getStartingPage() {
- if (pages.size() == 0)
- return null;
-
- return (IWizardPage)pages.get(0);
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public RGB getTitleBarColor() {
- return titleBarColor;
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public String getWindowTitle() {
- return windowTitle;
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public boolean isHelpAvailable() {
- return isHelpAvailable;
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public boolean needsPreviousAndNextButtons() {
- return forcePreviousAndNextButtons || pages.size() > 1;
-}
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public boolean needsProgressMonitor() {
- return needsProgressMonitor;
-}
-/**
- * The <code>Wizard</code> implementation of this <code>IWizard</code>
- * method does nothing and returns <code>true</code>.
- * Subclasses should reimplement this method if they need to perform
- * any special cancel processing for their wizard.
- */
-public boolean performCancel() {
- return true;
-}
-/**
- * Subclasses must implement this <code>IWizard</code> method
- * to perform any special finish processing for their wizard.
- */
-public abstract boolean performFinish();
-/* (non-Javadoc)
- * Method declared on IWizard.
- */
-public void setContainer(IWizardContainer wizardContainer) {
- container = wizardContainer;
-}
-/**
- * Sets the default page image descriptor for this wizard.
- * <p>
- * This image descriptor will be used to generate an image for a page
- * with no image of its own; the image will be computed once and cached.
- * </p>
- *
- * @param imageDescriptor the default page image descriptor
- */
-public void setDefaultPageImageDescriptor(ImageDescriptor imageDescriptor) {
- defaultImageDescriptor = imageDescriptor;
-}
-/**
- * Sets the dialog settings for this wizard.
- * <p>
- * The dialog settings is used to record state between
- * wizard invocations (for example, radio button selection,
- * last import directory, etc.)
- * </p>
- *
- * @param settings the dialog settings, or <code>null</code> if none
- * @see #getDialogSettings
- *
- */
-public void setDialogSettings(IDialogSettings settings) {
- dialogSettings = settings;
-}
-/**
- * Controls whether the wizard needs Previous and Next
- * buttons even if it currently contains only one page.
- * <p>
- * This flag should be set on wizards where the first wizard page
- * adds follow-on wizard pages based on user input.
- * </p>
- *
- * @param b <code>true</code> to always show Next and Previous
- * buttons, and <code>false</code> to suppress Next and Previous
- * buttons for single page wizards
- */
-public void setForcePreviousAndNextButtons(boolean b) {
- forcePreviousAndNextButtons = b;
-}
-/**
- * Sets whether help is available for this wizard.
- * <p>
- * The result of this method is typically used by the container to
- * show or hide the Help button.
- * </p>
- *
- * @param b <code>true</code> if help is available,
- * and <code>false</code> if this wizard is helpless
- * @see #isHelpAvailable
- */
-public void setHelpAvailable(boolean b) {
- isHelpAvailable = b;
-}
-/**
- * Sets whether this wizard needs a progress monitor.
- *
- * @param b <code>true</code> if a progress monitor is required,
- * and <code>false</code> if none is needed
- * @see #getNeedsProgressMonitor
- */
-public void setNeedsProgressMonitor(boolean b) {
- needsProgressMonitor = b;
-}
-/**
- * Sets the title bar color for this wizard.
- *
- * @param color the title bar color
- */
-public void setTitleBarColor(RGB color) {
- titleBarColor = color;
-}
-/**
- * Sets the window title for the container that hosts this page to
- * the given string.
- *
- * @param newTitle the window title for the container
- */
-public void setWindowTitle(String newTitle) {
- windowTitle = newTitle;
- if (container != null)
- container.updateWindowTitle();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/WizardDialog.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/WizardDialog.java
deleted file mode 100644
index 54bce53..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/WizardDialog.java
+++ /dev/null
@@ -1,1117 +0,0 @@
-package org.eclipse.jface.wizard;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog; // disambiguate from SWT Dialog
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.operation.ModalContext;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.*;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-import java.util.List; // disabiguate from SWT List
-
-/**
- * A dialog to show a wizard to the end user.
- * <p>
- * In typical usage, the client instantiates this class with
- * a particular wizard. The dialog serves as the wizard container
- * and orchestrates the presentation of its pages.
- * <p>
- * The standard layout is roughly as follows:
- * it has an area at the top containing both the
- * wizard's title, description, and image; the actual wizard page
- * appears in the middle; below that is a progress indicator
- * (which is made visible if needed); and at the bottom
- * of the page is message line and a button bar containing
- * Help, Next, Back, Finish, and Cancel buttons (or some subset).
- * </p>
- * <p>
- * Clients may subclass <code>WizardDialog</code>, although this
- * is rarely required.
- * </p>
- */
-public class WizardDialog extends TitleAreaDialog implements IWizardContainer {
-
- /**
- * Image registry key for error message image (value <code>"dialog_title_error_image"</code>).
- */
- public static final String WIZ_IMG_ERROR = "dialog_title_error_image";//$NON-NLS-1$
-
- // The wizard the dialog is currently showing.
- private IWizard wizard;
-
- // Wizards to dispose
- private ArrayList createdWizards = new ArrayList();
-
- // Current nested wizards
- private ArrayList nestedWizards = new ArrayList();
-
- // The currently displayed page.
- private IWizardPage currentPage = null;
-
- // The number of long running operation executed from the dialog.
- private long activeRunningOperations = 0;
- private boolean operationCancelableState;
-
- // Do I have a help button or not
- private boolean isHelpAvailable = true;
-
- // The current page message and description
- private String pageMessage;
- private int pageMessageType = IMessageProvider.NONE;
- private String pageDescription;
-
- // The progress monitor
- private ProgressMonitorPart progressMonitorPart;
- private Cursor waitCursor;
- private Cursor arrowCursor;
- private MessageDialog windowClosingDialog;
-
- // Navigation buttons
- private Button backButton;
- private Button nextButton;
- private Button finishButton;
- private Button cancelButton;
- private Button helpButton;
-
- private SelectionAdapter cancelListener;
- private boolean isMovingToPreviousPage = false;
- private Composite pageContainer;
- private PageContainerFillLayout pageContainerLayout = new PageContainerFillLayout(5, 5, 300, 225);
- private int pageWidth = SWT.DEFAULT;
- private int pageHeight = SWT.DEFAULT;
-
- private static int PROGRESS_INDICATOR_HEIGHT = 12;
- private static final String FOCUS_CONTROL = "focusControl";//$NON-NLS-1$
-
-
- /**
- * A layout for a container which includes several pages, like
- * a notebook, wizard, or preference dialog. The size computed by
- * this layout is the maximum width and height of all pages currently
- * inserted into the container.
- */
- protected class PageContainerFillLayout extends Layout {
-
- /**
- * The margin width; <code>5</code> pixels by default.
- */
- public int marginWidth = 5;
-
- /**
- * The margin height; <code>5</code> pixels by default.
- */
- public int marginHeight = 5;
-
- /**
- * The minimum width; <code>0</code> pixels by default.
- */
- public int minimumWidth = 0;
-
- /**
- * The minimum height; <code>0</code> pixels by default.
- */
- public int minimumHeight = 0;
-
- /**
- * Creates new layout object.
- *
- * @param mw the margin width
- * @param mh the margin height
- * @param minW the minimum width
- * @param minH the minimum height
- */
- public PageContainerFillLayout(int mw, int mh, int minW, int minH) {
- marginWidth = mw;
- marginHeight = mh;
- minimumWidth = minW;
- minimumHeight = minH;
- }
- /* (non-Javadoc)
- * Method declared on Layout.
- */
- public Point computeSize(Composite composite, int wHint, int hHint, boolean force) {
- if (wHint != SWT.DEFAULT && hHint != SWT.DEFAULT)
- return new Point(wHint, hHint);
-
- Point result = null;
- Control[] children = composite.getChildren();
- if (children.length > 0) {
- result = new Point(0, 0);
- for (int i = 0; i < children.length; i++) {
- Point cp = children[i].computeSize(wHint, hHint, force);
- result.x = Math.max(result.x, cp.x);
- result.y = Math.max(result.y, cp.y);
- }
- result.x = result.x + 2 * marginWidth;
- result.y = result.y + 2 * marginHeight;
- } else {
- Rectangle rect = composite.getClientArea();
- result = new Point(rect.width, rect.height);
- }
- result.x = Math.max(result.x, minimumWidth);
- result.y = Math.max(result.y, minimumHeight);
-
- if (wHint != SWT.DEFAULT)
- result.x = wHint;
- if (hHint != SWT.DEFAULT)
- result.y = hHint;
- return result;
- }
- /**
- * Returns the client area for the given composite according to this layout.
- *
- * @param c the composite
- * @return the client area rectangle
- */
- public Rectangle getClientArea(Composite c) {
- Rectangle rect = c.getClientArea();
- rect.x = rect.x + marginWidth;
- rect.y = rect.y + marginHeight;
- rect.width = rect.width - 2 * marginWidth;
- rect.height = rect.height - 2 * marginHeight;
- return rect;
- }
- /* (non-Javadoc)
- * Method declared on Layout.
- */
- public void layout(Composite composite, boolean force) {
- Rectangle rect = getClientArea(composite);
- Control[] children = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- children[i].setBounds(rect);
- }
- }
- /**
- * Lays outs the page according to this layout.
- *
- * @param w the control
- */
- public void layoutPage(Control w) {
- w.setBounds(getClientArea((Composite) w.getParent()));
- }
- /**
- * Sets the location of the page so that its origin is in the
- * upper left corner.
- *
- * @param w the control
- */
- public void setPageLocation(Control w) {
- w.setLocation(marginWidth, marginHeight);
- }
- }
-/**
- * Creates a new wizard dialog for the given wizard.
- *
- * @param parentShell the parent shell
- * @param newWizard the wizard this dialog is working on
- */
-public WizardDialog(Shell parentShell, IWizard newWizard) {
- super(parentShell);
- setShellStyle(SWT.CLOSE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL);
- setWizard(newWizard);
-
- // since VAJava can't initialize an instance var with an anonymous
- // class outside a constructor we do it here:
- cancelListener= new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- cancelPressed();
- }
- };
-}
-/**
- * About to start a long running operation tiggered through
- * the wizard. Shows the progress monitor and disables the wizard's
- * buttons and controls.
- *
- * @param enableCancelButton <code>true</code> if the Cancel button should
- * be enabled, and <code>false</code> if it should be disabled
- * @return the saved UI state
- */
-private Object aboutToStart(boolean enableCancelButton) {
- Map savedState = null;
- operationCancelableState = enableCancelButton;
- if (getShell() != null) {
- // Save focus control
- Control focusControl = getShell().getDisplay().getFocusControl();
- if (focusControl != null && focusControl.getShell() != getShell())
- focusControl = null;
-
- boolean needsProgressMonitor = wizard.needsProgressMonitor();
-
- cancelButton.removeSelectionListener(cancelListener);
-
- // Set the busy cursor to all shells.
- Display d = getShell().getDisplay();
- waitCursor = new Cursor(d, SWT.CURSOR_WAIT);
- setDisplayCursor(waitCursor);
-
- // Set the arrow cursor to the cancel component.
- arrowCursor= new Cursor(d, SWT.CURSOR_ARROW);
- cancelButton.setCursor(arrowCursor);
-
- // Deactivate shell
- savedState = saveUIState(needsProgressMonitor && enableCancelButton);
- if (focusControl != null)
- savedState.put(FOCUS_CONTROL, focusControl);
-
- // Attach the progress monitor part to the cancel button
- if (needsProgressMonitor) {
- progressMonitorPart.attachToCancelComponent(cancelButton);
- progressMonitorPart.setVisible(true);
- }
- }
- return savedState;
-}
-/**
- * The Back button has been pressed.
- */
-protected void backPressed() {
- IWizardPage page = currentPage.getPreviousPage();
- if (page == null)
- // should never happen since we have already visited the page
- return;
-
- // set flag to indicate that we are moving back
- isMovingToPreviousPage = true;
-
- // show the page
- showPage(page);
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void buttonPressed(int buttonId) {
- switch (buttonId) {
- case IDialogConstants.HELP_ID : {
- helpPressed();
- break;
- }
- case IDialogConstants.BACK_ID : {
- backPressed();
- break;
- }
- case IDialogConstants.NEXT_ID : {
- nextPressed();
- break;
- }
- case IDialogConstants.FINISH_ID : {
- finishPressed();
- break;
- }
- // The Cancel button has a listener which calls cancelPressed directly
- }
-}
-/**
- * Calculates the difference in size between the given
- * page and the page container. A larger page results
- * in a positive delta.
- *
- * @param page the page
- * @return the size difference encoded
- * as a <code>new Point(deltaWidth,deltaHeight)</code>
- */
-private Point calculatePageSizeDelta(IWizardPage page) {
- Control pageControl = page.getControl();
-
- if (pageControl == null)
- // control not created yet
- return new Point(0,0);
-
- Point contentSize = pageControl.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
- Rectangle rect = pageContainerLayout.getClientArea(pageContainer);
- Point containerSize = new Point(rect.width, rect.height);
-
- return new Point(
- Math.max(0, contentSize.x - containerSize.x),
- Math.max(0, contentSize.y - containerSize.y));
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void cancelPressed() {
- if (activeRunningOperations <= 0) {
- // Close the dialog. The check whether the dialog can be
- // closed or not is done in <code>okToClose</code>.
- // This ensures that the check is also evaluated when the user
- // presses the window's close button.
- setReturnCode(CANCEL);
- close();
- } else {
- cancelButton.setEnabled(false);
- }
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-public boolean close() {
- if (okToClose())
- return hardClose();
- else
- return false;
-}
-/* (non-Javadoc)
- * Method declared on Window.
- */
-protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
-
- // Register help listener on the shell
- newShell.addHelpListener(new HelpListener() {
- public void helpRequested(HelpEvent event) {
- // call perform help on the current page
- if (currentPage != null) {
- currentPage.performHelp();
- }
- }
- });
-}
-/**
- * Creates and returns the contents of this dialog's
- * button bar.
- * <p>
- * The <code>WizardDialog</code> implementation of this framework method
- * prevents the composite's columns from being made equal width in order
- * to remove the margin between the Back and Next buttons.
- * </p>
- *
- * @param parent the parent composite to contain the button bar
- * @return the button bar control
- */
-protected Control createButtonBar(Composite parent) {
- Composite composite = (Composite)super.createButtonBar(parent);
- ((GridLayout)composite.getLayout()).makeColumnsEqualWidth = false;
- return composite;
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void createButtonsForButtonBar(Composite parent) {
- if (wizard.isHelpAvailable()) {
- helpButton = createButton(parent, IDialogConstants.HELP_ID, IDialogConstants.HELP_LABEL, false);
- }
- if (wizard.needsPreviousAndNextButtons())
- createPreviousAndNextButtons(parent);
- finishButton = createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.FINISH_LABEL, true);
- cancelButton = createCancelButton(parent);
-}
-/**
- * Creates the Cancel button for this wizard dialog.
- * Creates a standard (<code>SWT.PUSH</code>) button and registers for its
- * selection events. Note that the number of columns in the button bar composite
- * is incremented. The Cancel button is created specially to give it a
- * removeable listener.
- *
- * @param parent the parent button bar
- * @return the new Cancel button
- */
-private Button createCancelButton(Composite parent) {
- // increment the number of columns in the button bar
- ((GridLayout)parent.getLayout()).numColumns++;
-
- Button button = new Button(parent, SWT.PUSH);
-
- button.setText(IDialogConstants.CANCEL_LABEL);
- setButtonLayoutData(button);
- button.setFont(parent.getFont());
-
- button.setData(new Integer(IDialogConstants.CANCEL_ID));
- button.addSelectionListener(cancelListener);
- return button;
-}
-/**
- * The <code>WizardDialog</code> implementation of this <code>Window</code>
- * method calls call <code>IWizard.addPages</code> to allow the current
- * wizard to add extra pages, then <code>super.createContents</code> to create
- * the controls. It then calls <code>IWizard.createPageControls</code>
- * to allow the wizard to pre-create their page controls prior to opening,
- * so that the wizard opens to the correct size. And finally it
- * shows the first page.
- */
-protected Control createContents(Composite parent) {
- // Allow the wizard to add pages to itself
- // Need to call this now so page count is correct
- // for determining if next/previous buttons are needed
- wizard.addPages();
-
- Control contents = super.createContents(parent);
-
- // Allow the wizard pages to precreate their page controls
- createPageControls();
-
- // Show the first page
- showStartingPage();
-
- return contents;
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite)super.createDialogArea(parent);
-
- // Build the Page container
- pageContainer = createPageContainer(composite);
- GridData gd = new GridData(GridData.FILL_BOTH);
- gd.widthHint = pageWidth;
- gd.heightHint = pageHeight;
- pageContainer.setLayoutData(gd);
- pageContainer.setFont(parent.getFont());
-
- // Insert a progress monitor
- GridLayout pmlayout= new GridLayout();
- pmlayout.numColumns= 1;
- progressMonitorPart= new ProgressMonitorPart(composite, pmlayout, SWT.DEFAULT);
- progressMonitorPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- progressMonitorPart.setVisible(false);
-
- // Build the separator line
- Label separator= new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
- separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- return composite;
-}
-/**
- * Creates the container that holds all pages.
- */
-private Composite createPageContainer(Composite parent) {
- Composite result= new Composite(parent, SWT.NULL);
- result.setLayout(pageContainerLayout);
- return result;
-}
-/**
- * Allow the wizard's pages to pre-create their page controls.
- * This allows the wizard dialog to open to the correct size.
- */
-private void createPageControls() {
- // Allow the wizard pages to precreate their page controls
- // This allows the wizard to open to the correct size
- wizard.createPageControls(pageContainer);
-
- // Ensure that all of the created pages are initially not visible
- IWizardPage[] pages = wizard.getPages();
- for (int i = 0; i < pages.length; i++) {
- IWizardPage page = (IWizardPage)pages[i];
- if (page.getControl() != null)
- page.getControl().setVisible(false);
- }
-}
-/**
- * Creates the Previous and Next buttons for this wizard dialog.
- * Creates standard (<code>SWT.PUSH</code>) buttons and registers for their
- * selection events. Note that the number of columns in the button bar composite
- * is incremented. These buttons are created specially to prevent any space
- * between them.
- *
- * @param parent the parent button bar
- * @return a composite containing the new buttons
- */
-private Composite createPreviousAndNextButtons(Composite parent) {
- // increment the number of columns in the button bar
- ((GridLayout)parent.getLayout()).numColumns++;
-
- 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 = 0; // will be incremented by createButton
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
-
- composite.setLayout(layout);
-
- GridData data = new GridData(
- GridData.HORIZONTAL_ALIGN_CENTER |
- GridData.VERTICAL_ALIGN_CENTER);
- composite.setLayoutData(data);
-
- composite.setFont(parent.getFont());
-
- backButton = createButton(composite, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false);
- nextButton = createButton(composite, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false);
-
- return composite;
-}
-/**
- * Creates and return a new wizard closing dialog without openiong it.
- */
-private MessageDialog createWizardClosingDialog() {
- MessageDialog result= new MessageDialog(
- getShell(),
- JFaceResources.getString("WizardClosingDialog.title"),//$NON-NLS-1$
- null,
- JFaceResources.getString("WizardClosingDialog.message"),//$NON-NLS-1$
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL},
- 0 );
- return result;
-}
-/**
- * The Finish button has been pressed.
- */
-protected void finishPressed() {
- // Wizards are added to the nested wizards list in setWizard.
- // This means that the current wizard is always the last wizard in the list.
- // Note that we first call the current wizard directly (to give it a chance to
- // abort, do work, and save state) then call the remaining n-1 wizards in the
- // list (to save state).
-
- if (wizard.performFinish()) {
- // Call perform finish on outer wizards in the nested chain
- // (to allow them to save state for example)
- for (int i = 0; i < nestedWizards.size() - 1; i++) {
- ((IWizard)nestedWizards.get(i)).performFinish();
- }
-
- // Hard close the dialog.
- setReturnCode(OK);
- hardClose();
- }
-}
-/* (non-Javadoc)
- * Method declared on IWizardContainer.
- */
-public IWizardPage getCurrentPage() {
- return currentPage;
-}
-/**
- * Returns the progress monitor for this wizard dialog (if it has one).
- *
- * @return the progress monitor, or <code>null</code> if
- * this wizard dialog does not have one
- */
-protected IProgressMonitor getProgressMonitor() {
- return progressMonitorPart;
-}
-/**
- * Returns the wizard this dialog is currently displaying.
- *
- * @return the current wizard
- */
-protected IWizard getWizard() {
- return wizard;
-}
-/**
- * Closes this window.
- *
- * @return <code>true</code> if the window is (or was already) closed,
- * and <code>false</code> if it is still open
- */
-private boolean hardClose() {
- // inform wizards
- for (int i = 0; i < createdWizards.size(); i++) {
- IWizard createdWizard = (IWizard)createdWizards.get(i);
-
- createdWizard.dispose();
-
- // Remove this dialog as a parent from the managed wizard.
- // Note that we do this after calling dispose as the wizard or
- // its pages may need access to the container during
- // dispose code
- createdWizard.setContainer(null);
- }
-
- return super.close();
-}
-/**
- * The Help button has been pressed.
- */
-protected void helpPressed() {
- if (currentPage != null) {
- currentPage.performHelp();
- }
-}
-/**
- * The Next button has been pressed.
- */
-protected void nextPressed() {
- IWizardPage page = currentPage.getNextPage();
- if (page == null) {
- // something must have happend getting the next page
- return;
- }
-
- // show the next page
- showPage(page);
-}
-/**
- * Checks whether it is alright to close this wizard dialog
- * and performed standard cancel processing. If there is a
- * long running operation in progress, this method posts an
- * alert message saying that the wizard cannot be closed.
- *
- * @return <code>true</code> if it is alright to close this dialog, and
- * <code>false</code> if it is not
- */
-private boolean okToClose() {
- if (activeRunningOperations > 0) {
- synchronized (this) {
- windowClosingDialog = createWizardClosingDialog();
- }
- windowClosingDialog.open();
- synchronized (this) {
- windowClosingDialog = null;
- }
- return false;
- }
-
- return wizard.performCancel();
-}
-/**
- * Restores the enabled/disabled state of the given control.
- *
- * @param w the control
- * @param h the map (key type: <code>String</code>, element type:
- * <code>Boolean</code>)
- * @param key the key
- * @see #saveEnableStateAndSet
- */
-private void restoreEnableState(Control w, Map h, String key) {
- if (w != null) {
- Boolean b = (Boolean) h.get(key);
- if (b != null)
- w.setEnabled(b.booleanValue());
- }
-}
-/**
- * Restores the enabled/disabled state of the wizard dialog's
- * buttons and the tree of controls for the currently showing page.
- *
- * @param state a map containing the saved state as returned by
- * <code>saveUIState</code>
- * @see #saveUIState
- */
-private void restoreUIState(Map state) {
- restoreEnableState(backButton, state, "back");//$NON-NLS-1$
- restoreEnableState(nextButton, state, "next");//$NON-NLS-1$
- restoreEnableState(finishButton, state, "finish");//$NON-NLS-1$
- restoreEnableState(cancelButton, state, "cancel");//$NON-NLS-1$
- restoreEnableState(helpButton, state, "help");//$NON-NLS-1$
- ControlEnableState pageState = (ControlEnableState) state.get("page");//$NON-NLS-1$
- pageState.restore();
-}
-/* (non-Javadoc)
- * Method declared on IRunnableContext.
- */
-public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException {
- // The operation can only be canceled if it is executed in a separate thread.
- // Otherwise the UI is blocked anyway.
- Object state = null;
- if(activeRunningOperations == 0)
- state = aboutToStart(fork && cancelable);
-
- activeRunningOperations++;
- try {
- ModalContext.run(runnable, fork, getProgressMonitor(), getShell().getDisplay());
- } finally {
- activeRunningOperations--;
- //Stop if this is the last one
- if(state!= null)
- stopped(state);
- }
-}
-/**
- * Saves the enabled/disabled state of the given control in the
- * given map, which must be modifiable.
- *
- * @param w the control, or <code>null</code> if none
- * @param h the map (key type: <code>String</code>, element type:
- * <code>Boolean</code>)
- * @param key the key
- * @param enabled <code>true</code> to enable the control,
- * and <code>false</code> to disable it
- * @see #restoreEnableStateAndSet
- */
-private void saveEnableStateAndSet(Control w, Map h, String key, boolean enabled) {
- if (w != null) {
- h.put(key, new Boolean(w.isEnabled()));
- w.setEnabled(enabled);
- }
-}
-/**
- * Captures and returns the enabled/disabled state of the wizard dialog's
- * buttons and the tree of controls for the currently showing page. All
- * these controls are disabled in the process, with the possible excepton of
- * the Cancel button.
- *
- * @param keepCancelEnabled <code>true</code> if the Cancel button should
- * remain enabled, and <code>false</code> if it should be disabled
- * @return a map containing the saved state suitable for restoring later
- * with <code>restoreUIState</code>
- * @see #restoreUIState
- */
-private Map saveUIState(boolean keepCancelEnabled) {
- Map savedState= new HashMap(10);
- saveEnableStateAndSet(backButton, savedState, "back", false);//$NON-NLS-1$
- saveEnableStateAndSet(nextButton, savedState, "next", false);//$NON-NLS-1$
- saveEnableStateAndSet(finishButton, savedState, "finish", false);//$NON-NLS-1$
- saveEnableStateAndSet(cancelButton, savedState, "cancel", keepCancelEnabled);//$NON-NLS-1$
- saveEnableStateAndSet(helpButton, savedState, "help", false);//$NON-NLS-1$
- savedState.put("page", ControlEnableState.disable(currentPage.getControl()));//$NON-NLS-1$
- return savedState;
-}
-/**
- * Sets the given cursor for all shells currently active
- * for this window's display.
- *
- * @param c the cursor
- */
-private void setDisplayCursor(Cursor c) {
- Shell[] shells = getShell().getDisplay().getShells();
- for (int i = 0; i < shells.length; i++)
- shells[i].setCursor(c);
-}
-/**
- * Sets the minimum page size used for the pages.
- *
- * @param minWidth the minimum page width
- * @param minHeight the minimum page height
- * @see #setMinimumPageSize(org.eclipse.swt.graphics.Point)
- */
-public void setMinimumPageSize(int minWidth, int minHeight) {
- Assert.isTrue(minWidth >= 0 && minHeight >= 0);
- pageContainerLayout.minimumWidth= minWidth;
- pageContainerLayout.minimumHeight= minHeight;
-}
-/**
- * Sets the minimum page size used for the pages.
- *
- * @param size the page size encoded as
- * <code>new Point(width,height)</code>
- * @see #setMinimumPageSize(int,int)
- */
-public void setMinimumPageSize(Point size) {
- setMinimumPageSize(size.x, size.y);
-}
-/**
- * Sets the size of all pages.
- * The given size takes precedence over computed sizes.
- *
- * @param width the page width
- * @param height the page height
- * @see #setPageSize(org.eclipse.swt.graphics.Point)
- */
-public void setPageSize(int width, int height) {
- pageWidth = width;
- pageHeight = height;
-}
-/**
- * Sets the size of all pages.
- * The given size takes precedence over computed sizes.
- *
- * @param size the page size encoded as
- * <code>new Point(width,height)</code>
- * @see #setPageSize(int,int)
- */
-public void setPageSize(Point size) {
- setPageSize(size.x, size.y);
-}
-/**
- * Sets the wizard this dialog is currently displaying.
- *
- * @param newWizard the wizard
- */
-protected void setWizard(IWizard newWizard) {
- wizard = newWizard;
- wizard.setContainer(this);
- if (!createdWizards.contains(wizard)) {
- createdWizards.add(wizard);
-
- // New wizard so just add it to the end of our nested list
- nestedWizards.add(wizard);
-
- if (pageContainer != null) {
- // Dialog is already open
-
- // Allow the wizard pages to precreate their page controls
- // This allows the wizard to open to the correct size
- createPageControls();
-
- // Ensure the dialog is large enough for the wizard
- updateSizeForWizard(wizard);
- pageContainer.layout(true);
- }
- } else {
- // We have already seen this wizard, if it is the previous wizard
- // on the nested list then we assume we have gone back and remove
- // the last wizard from the list
- int size = nestedWizards.size();
- if (size >= 2 && nestedWizards.get(size - 2) == wizard)
- nestedWizards.remove(size - 1);
- else
- // Assume we are going forward to revisit a wizard
- nestedWizards.add(wizard);
- }
-}
-/* (non-Javadoc)
- * Method declared on IWizardContainer.
- */
-public void showPage(IWizardPage page) {
- if (page == null || page == currentPage) {
- return;
- }
-
- if (!isMovingToPreviousPage)
- // remember my previous page.
- page.setPreviousPage(currentPage);
- else
- isMovingToPreviousPage = false;
-
- // ensure this page belongs to the current wizard
- if (wizard != page.getWizard())
- setWizard(page.getWizard());
-
- // ensure that page control has been created
- // (this allows lazy page control creation)
- if (page.getControl() == null) {
- page.createControl(pageContainer);
- // the page is responsible for ensuring the created control is accessable
- // via getControl.
- Assert.isNotNull(page.getControl());
- // ensure the dialog is large enough for this page
- updateSize(page);
- }
-
- // make the new page visible
- IWizardPage oldPage = currentPage;
- currentPage = page;
- currentPage.setVisible(true);
- oldPage.setVisible(false);
-
- // update the dialog controls
- update();
-}
-/**
- * Shows the starting page of the wizard.
- */
-private void showStartingPage() {
- currentPage = wizard.getStartingPage();
- if (currentPage == null) {
- // something must have happend getting the page
- return;
- }
-
- // ensure the page control has been created
- if (currentPage.getControl() == null) {
- currentPage.createControl(pageContainer);
- // the page is responsible for ensuring the created control is accessable
- // via getControl.
- Assert.isNotNull(currentPage.getControl());
- // we do not need to update the size since the call
- // to initialize bounds has not been made yet.
- }
-
- // make the new page visible
- currentPage.setVisible(true);
-
- // update the dialog controls
- update();
-}
-/**
- * A long running operation triggered through the wizard
- * was stopped either by user input or by normal end.
- * Hides the progress monitor and restores the enable state
- * wizard's buttons and controls.
- *
- * @param savedState the saved UI state as returned by <code>aboutToStart</code>
- * @see #aboutToStart
- */
-private void stopped(Object savedState) {
- if (getShell() != null) {
- if (wizard.needsProgressMonitor()) {
- progressMonitorPart.setVisible(false);
- progressMonitorPart.removeFromCancelComponent(cancelButton);
- }
- Map state = (Map)savedState;
- restoreUIState(state);
- cancelButton.addSelectionListener(cancelListener);
-
- setDisplayCursor(null);
- cancelButton.setCursor(null);
- waitCursor.dispose();
- waitCursor = null;
- arrowCursor.dispose();
- arrowCursor = null;
- Control focusControl = (Control)state.get(FOCUS_CONTROL);
- if (focusControl != null)
- focusControl.setFocus();
- }
-}
-/**
- * Updates this dialog's controls to reflect the current page.
- */
-protected void update(){
- // Update the window title
- updateWindowTitle();
-
- // Update the title bar
- updateTitleBar();
-
- // Update the buttons
- updateButtons();
-}
-/* (non-Javadoc)
- * Method declared on IWizardContainer.
- */
-public void updateButtons() {
- boolean canFlipToNextPage = false;
- boolean canFinish = wizard.canFinish();
-
- if (backButton != null)
- backButton.setEnabled(currentPage.getPreviousPage() != null);
- if (nextButton != null) {
- canFlipToNextPage = currentPage.canFlipToNextPage();
- nextButton.setEnabled(canFlipToNextPage);
- }
- finishButton.setEnabled(canFinish);
-
- // finish is default unless it is diabled and next is enabled
- if (canFlipToNextPage && !canFinish)
- getShell().setDefaultButton(nextButton);
- else
- getShell().setDefaultButton(finishButton);
-}
-/**
- * Update the message line with the page's description.
- * <p>
- * A discription is shown only if there is no message or error message.
- * </p>
- */
-private void updateDescriptionMessage() {
- pageDescription = currentPage.getDescription();
- if (pageMessage == null)
- setMessage(currentPage.getDescription());
-}
-/* (non-Javadoc)
- * Method declared on IWizardContainer.
- */
-public void updateMessage() {
- if (getTitleArea() == null)
- return;
-
- pageMessage = currentPage.getMessage();
- if (pageMessage != null && currentPage instanceof IMessageProvider)
- pageMessageType = ((IMessageProvider)currentPage).getMessageType();
- else
- pageMessageType = IMessageProvider.NONE;
-
- if (pageMessage == null)
- setMessage(pageDescription);
- else
- setMessage(pageMessage, pageMessageType);
- setErrorMessage(currentPage.getErrorMessage());
-}
-/**
- * Changes the shell size to the given size, ensuring that
- * it is no larger than the display bounds.
- *
- * @param width the shell width
- * @param height the shell height
- */
-private void setShellSize(int width, int height) {
- getShell().setSize(width, height);
- constrainShellSize();
-}
-/**
- * Computes the correct dialog size for the current page and resizes
- * its shell if nessessary. Also causes the container to refresh its
- * layout.
- *
- * @param page the wizard page to use to resize the dialog
- * @since 2.0
- */
-protected void updateSize(IWizardPage page) {
- if (page == null || page.getControl() == null)
- return;
-
- updateSizeForPage(page);
- pageContainerLayout.layoutPage(page.getControl());
-}
-/**
- * Computes the correct dialog size for the given page and resizes
- * its shell if nessessary.
- *
- * @param page the wizard page
- */
-private void updateSizeForPage(IWizardPage page) {
- // ensure the page container is large enough
- Point delta = calculatePageSizeDelta(page);
-
- if (delta.x > 0 || delta.y > 0) {
- // increase the size of the shell
- Shell shell = getShell();
- Point shellSize = shell.getSize();
- setShellSize(shellSize.x + delta.x, shellSize.y + delta.y);
- constrainShellSize();
- }
-}
-/**
- * Computes the correct dialog size for the given wizard and resizes
- * its shell if nessessary.
- *
- * @param wizard the wizard
- */
-private void updateSizeForWizard(IWizard wizard) {
- Point delta = new Point(0,0);
- IWizardPage[] pages = wizard.getPages();
- for (int i = 0; i < pages.length; i++){
- // ensure the page container is large enough
- Point pageDelta = calculatePageSizeDelta(pages[i]);
-
- delta.x = Math.max(delta.x, pageDelta.x);
- delta.y = Math.max(delta.y, pageDelta.y);
- }
-
- if (delta.x > 0 || delta.y > 0) {
- // increase the size of the shell
- Shell shell = getShell();
- Point shellSize = shell.getSize();
- setShellSize(shellSize.x + delta.x, shellSize.y + delta.y);
- }
-}
-/* (non-Javadoc)
- * Method declared on IWizardContainer.
- */
-public void updateTitleBar() {
- if (getTitleArea() == null)
- return;
-
- String s = currentPage.getTitle();
- if (s == null)
- s = "";//$NON-NLS-1$
- setTitle(s);
-
- setTitleImage(currentPage.getImage());
- updateDescriptionMessage();
- updateMessage();
-}
-/* (non-Javadoc)
- * Method declared on IWizardContainer.
- */
-public void updateWindowTitle() {
- if (getShell() == null)
- // Not created yet
- return;
-
- String title = wizard.getWindowTitle();
- if (title == null)
- title = "";//$NON-NLS-1$
-
- getShell().setText(title);
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/WizardPage.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/WizardPage.java
deleted file mode 100644
index 9b9a7dd..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/WizardPage.java
+++ /dev/null
@@ -1,299 +0,0 @@
-package org.eclipse.jface.wizard;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.resource.*;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * An abstract base implementation of a wizard page.
- * <p>
- * Subclasses must implement the <code>createControl</code> method
- * to create the specific controls for the wizard page.
- * </p>
- * <p>
- * Subclasses may call the following methods to configure the wizard page:
- * <ul>
- * <li><code>setDescription</code></li>
- * <li><code>setErrorMessage</code></li>
- * <li><code>setImageDescriptor</code></li>
- * <li><code>setMessage</code></li>
- * <li><code>setPageComplete</code></li>
- * <li><code>setPreviousPage</code></li>
- * <li><code>setTitle</code></li>
- * </ul>
- * </p>
- * <p>
- * Subclasses may override these methods if required:
- * <ul>
- * <li><code>performHelp</code> - may be reimplemented to display help for the page</li>
- * <li><code>canFlipToNextPage</code> - may be extended or reimplemented</li>
- * <li><code>isPageComplete</code> - may be extended </li>
- * <li><code>setDescription</code> - may be extended </li>
- * <li><code>setTitle</code> - may be extended </li>
- * <li><code>dispose</code> - may be extended to dispose additional allocated SWT resources</li>
- * </ul>
- * </p>
- * <p>
- * Note that clients are free to implement <code>IWizardPage</code> from scratch
- * instead of subclassing <code>WizardPage</code>. Correct implementations of
- * <code>IWizardPage</code> will work with any correct implementation of
- * <code>IWizard</code>.
- * </p>
- */
-public abstract class WizardPage extends DialogPage implements IWizardPage {
-
- /**
- * This page's name.
- */
- private String name;
-
- /**
- * The wizard to which this page belongs; <code>null</code>
- * if this page has yet to be added to a wizard.
- */
- private IWizard wizard = null;
-
- /**
- * Indicates whether this page is complete.
- */
- private boolean isPageComplete = true;
-
- /**
- * The page that was shown right before this page became visible;
- * <code>null</code> if none.
- */
- private IWizardPage previousPage = null;
-
-/**
- * Creates a new wizard page with the given name, and
- * with no title or image.
- *
- * @param pageName the name of the page
- */
-protected WizardPage(String pageName) {
- this(pageName, null, (ImageDescriptor)null);
-}
-/**
- * Creates a new wizard page with the given name, title, and image.
- *
- * @param pageName the name of the page
- * @param title the title for this wizard page,
- * or <code>null</code> if none
- * @param titleImage the image descriptor for the title of this wizard page,
- * or <code>null</code> if none
- */
-protected WizardPage(String pageName, String title, ImageDescriptor titleImage) {
- super(title, titleImage);
- Assert.isNotNull(pageName); // page name must not be null
- name = pageName;
-}
-/**
- * The <code>WizardPage</code> implementation of this <code>IWizardPage</code>
- * method returns <code>true</code> if this page is complete (<code>isPageComplete</code>)
- * and there is a next page to flip to. Subclasses may override (extend or reimplement).
- *
- * @see #getNextPage
- * @see #isPageComplete
- */
-public boolean canFlipToNextPage() {
- return isPageComplete() && getNextPage() != null;
-}
-/**
- * Returns the wizard container for this wizard page.
- *
- * @return the wizard container, or <code>null</code> if this
- * wizard page has yet to be added to a wizard, or the
- * wizard has yet to be added to a container
- */
-protected IWizardContainer getContainer() {
- if (wizard == null)
- return null;
- return wizard.getContainer();
-}
-/**
- * Returns the dialog settings for this wizard page.
- *
- * @return the dialog settings, or <code>null</code> if none
- */
-protected IDialogSettings getDialogSettings() {
- if (wizard == null)
- return null;
- return wizard.getDialogSettings();
-}
-/* (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public Image getImage() {
- Image result = super.getImage();
-
- if (result == null && wizard != null)
- return wizard.getDefaultPageImage();
-
- return result;
-}
-/* (non-Javadoc)
- * Method declared on IWizardPage.
- */
-public String getName() {
- return name;
-}
-/* (non-Javadoc)
- * Method declared on IWizardPage.
- * The default behavior is to ask the wizard for the next page.
- */
-public IWizardPage getNextPage() {
- if (wizard == null)
- return null;
- return wizard.getNextPage(this);
-}
-/* (non-Javadoc)
- * Method declared on IWizardPage.
- * The default behavior is return the cached previous back or,
- * lacking that, to ask the wizard for the previous page.
- */
-public IWizardPage getPreviousPage() {
- if (previousPage != null)
- return previousPage;
-
- if (wizard == null)
- return null;
-
- return wizard.getPreviousPage(this);
-}
-/**
- * The <code>WizardPage</code> implementation of this method declared on
- * <code>DialogPage</code> returns the shell of the container.
- * The advantage of this implementation is that the shell is accessable
- * once the container is created even though this page's control may not
- * yet be created.
- */
-public Shell getShell() {
-
- IWizardContainer container = getContainer();
- if(container == null)
- return null;
-
- // Ask the wizard since our contents may not have been created.
- return container.getShell();
-}
-/* (non-Javadoc)
- * Method declared on IWizardPage.
- */
-public IWizard getWizard() {
- return wizard;
-}
-/**
- * Returns whether this page is the current one in the wizard's container.
- *
- * @return <code>true</code> if the page is active,
- * and <code>false</code> otherwise
- */
-protected boolean isCurrentPage() {
- return (getContainer() != null && this == getContainer().getCurrentPage());
-}
-/**
- * The <code>WizardPage</code> implementation of this <code>IWizard</code> method
- * returns the value of an internal state variable set by
- * <code>setPageComplete</code>. Subclasses may extend.
- */
-public boolean isPageComplete() {
- return isPageComplete;
-}
-/**
- * The <code>WizardPage</code> implementation of this <code>IDialogPage</code>
- * method extends the <code>DialogPage</code> implementation to update
- * the wizard container title bar. Subclasses may extend.
- */
-public void setDescription(String description) {
- super.setDescription(description);
- if (isCurrentPage())
- getContainer().updateTitleBar();
-}
-/**
- * The <code>WizardPage</code> implementation of this method
- * declared on <code>DialogPage</code> updates the container
- * if this is the current page.
- */
-public void setErrorMessage(String newMessage) {
- super.setErrorMessage(newMessage);
- if (isCurrentPage()) {
- getContainer().updateMessage();
- }
-}
-/**
- * The <code>WizardPage</code> implementation of this method
- * declared on <code>DialogPage</code> updates the container
- * if this page is the current page.
- */
-public void setImageDescriptor(ImageDescriptor image) {
- super.setImageDescriptor(image);
- if (isCurrentPage())
- getContainer().updateTitleBar();
-}
-/**
- * The <code>WizardPage</code> implementation of this method
- * declared on <code>DialogPage</code> updates the container
- * if this is the current page.
- */
-public void setMessage(String newMessage, int newType) {
- super.setMessage(newMessage, newType);
- if (isCurrentPage())
- getContainer().updateMessage();
-}
-/**
- * Sets whether this page is complete.
- * <p>
- * This information is typically used by the wizard to decide
- * when it is okay to move on to the next page or finish up.
- * </p>
- *
- * @param complete <code>true</code> if this page is complete, and
- * and <code>false</code> otherwise
- * @see #isPageComplete
- */
-public void setPageComplete(boolean complete) {
- isPageComplete = complete;
- if (isCurrentPage())
- getContainer().updateButtons();
-}
-/* (non-Javadoc)
- * Method declared on IWizardPage.
- */
-public void setPreviousPage(IWizardPage page) {
- previousPage = page;
-}
-/**
- * The <code>WizardPage</code> implementation of this <code>IDialogPage</code>
- * method extends the <code>DialogPage</code> implementation to update
- * the wizard container title bar. Subclasses may extend.
- */
-public void setTitle(String title) {
- super.setTitle(title);
- if (isCurrentPage()) {
- getContainer().updateTitleBar();
- }
-}
-/* (non-Javadoc)
- * Method declared on IWizardPage.
- */
-public void setWizard(IWizard newWizard) {
- wizard = newWizard;
-}
-/**
- * Returns a printable representation of this wizard page suitable
- * only for debug purposes.
- */
-public String toString() {
- return name;
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/WizardSelectionPage.java b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/WizardSelectionPage.java
deleted file mode 100644
index b5716d2..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/WizardSelectionPage.java
+++ /dev/null
@@ -1,123 +0,0 @@
-package org.eclipse.jface.wizard;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.util.Assert;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * An abstract implementation of a wizard page that manages a
- * set of embedded wizards.
- * <p>
- * A wizard selection page should present a list of wizard nodes
- * corresponding to other wizards. When the end user selects one of
- * them from the list, the first page of the selected wizard becomes
- * the next page. The only new methods introduced by this class are
- * <code>getSelectedNode</code> and <code>setSelectedNode</code>.
- * Otherwise, the subclass contract is the same as <code>WizardPage</code>.
- * </p>
- */
-public abstract class WizardSelectionPage extends WizardPage {
-
- /**
- * The selected node; <code>null</code> if none.
- */
- private IWizardNode selectedNode = null;
-
- /**
- * List of wizard nodes that have cropped up in the past
- * (element type: <code>IWizardNode</code>).
- */
- private List selectedWizardNodes = new ArrayList();
-/**
- * Creates a new wizard selection page with the given name, and
- * with no title or image.
- *
- * @param pageName the name of the page
- */
-protected WizardSelectionPage(String pageName) {
- super(pageName);
- // Cannot finish from this page
- setPageComplete(false);
-}
-/**
- * Adds the given wizard node to the list of selected nodes if
- * it is not already in the list.
- *
- * @param node the wizard node, or <code>null</code>
- */
-private void addSelectedNode(IWizardNode node) {
- if (node == null)
- return;
-
- if (selectedWizardNodes.contains(node))
- return;
-
- selectedWizardNodes.add(node);
-}
-/**
- * The <code>WizardSelectionPage</code> implementation of
- * this <code>IWizardPage</code> method returns <code>true</code>
- * if there is a selected node.
- */
-public boolean canFlipToNextPage() {
- return selectedNode != null;
-}
-/**
- * The <code>WizardSelectionPage</code> implementation of an <code>IDialogPage</code>
- * method disposes of all nested wizards. Subclasses may extend.
- */
-public void dispose() {
- super.dispose();
- // notify nested wizards
- for (int i = 0; i < selectedWizardNodes.size(); i++) {
- ((IWizardNode) selectedWizardNodes.get(i)).dispose();
- }
-}
-/**
- * The <code>WizardSelectionPage</code> implementation of
- * this <code>IWizardPage</code> method returns the first page
- * of the currently selected wizard if there is one.
- */
-public IWizardPage getNextPage() {
- if (selectedNode == null)
- return null;
-
- boolean isCreated = selectedNode.isContentCreated();
-
- IWizard wizard = selectedNode.getWizard();
-
- if (wizard == null) {
- setSelectedNode(null);
- return null;
- }
-
- if (!isCreated)
- // Allow the wizard to create its pages
- wizard.addPages();
-
- return wizard.getStartingPage();
-}
-/**
- * Returns the currently selected wizard node within this page.
- *
- * @return the wizard node, or <code>null</code> if no node is selected
- */
-protected IWizardNode getSelectedNode() {
- return selectedNode;
-}
-/**
- * Sets or clears the currently selected wizard node within this page.
- *
- * @param node the wizard node, or <code>null</code> to clear
- */
-protected void setSelectedNode(IWizardNode node) {
- addSelectedNode(node);
- selectedNode = node;
- if (isCurrentPage())
- getContainer().updateButtons();
-}
-}
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/images/error.gif b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/images/error.gif
deleted file mode 100644
index def995e..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/images/error.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/images/page.gif b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/images/page.gif
deleted file mode 100644
index befca65..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/images/page.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/package.html b/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/package.html
deleted file mode 100644
index f0e7c52..0000000
--- a/bundles/org.eclipse.ui.workbench/extensions/org/eclipse/jface/wizard/package.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="Author" content="IBM">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (Win98; I) [Netscape]">
- <title>Package-level Javadoc</title>
-</head>
-<body>
-Provides a framework for wizards.
-<h2>
-Package Specification</h2>
-A wizard dialog is a specialized window for walking the end user through
-a sequence of steps; each step is presented on a separate page.
-<p>At the most abstract level, the protocol is given by 3 interfaces:
-<ul>
-<li>
-<tt>IWizard</tt> - a wizard consisting of several wizard pages</li>
-
-<li>
-<tt>IWizardPage</tt> - an individual wizard page</li>
-
-<li>
-<tt>IWizardContainer</tt> - the outside world from the point of view of
-a wizard</li>
-</ul>
-A wizard is any object implementing <tt>IWizard</tt>. The abstract base
-class <tt>Wizard</tt> is provided as a starting point; it is simpler to
-subclass <tt>Wizard</tt> than to implement <tt>IWizard</tt> from scratch.
-The main responsibility of a <tt>Wizard</tt> subclass is doing the real
-work when the wizard finishes.
-<p>Similarly, a wizard page is any object implementing <tt>IWizardPage</tt>.
-The abstract base class <tt>WizardPage</tt> is provided as a starting point.
-The main responsibility of a <tt>WizardPage</tt> subclass is providing
-the SWT controls and the backing logic for a single wizard page.
-<p><tt>WizardDialog</tt> is a ready-to-use JFace dialog that is instantiated
-with a wizard and acts as the wizard's container. This dialog has a standard
-layout: an area at the top containing the wizard's title, description,
-and image; the actual wizard page appears in the middle; below it is a
-progress indicator; and at the bottom is an area with a message line and
-a button bar containing Next, Back, Finish, Cancel, and Help buttons.
-<p><tt>WizardSelectionPage</tt>, a special abstract subclass of <tt>WizardPage</tt>,
-allows whole other wizards to be connected to a root page.
-<p>Note: None of the classes in this package maintain global state.
-<br>
-</body>
-</html>
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/addbkmrk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/addbkmrk_tsk.gif
deleted file mode 100644
index dad7260..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/addbkmrk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/addtsk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/addtsk_tsk.gif
deleted file mode 100644
index dad7260..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/addtsk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/alpha_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/alpha_mode.gif
deleted file mode 100644
index 6d77244..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/alpha_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/apply_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/apply_ps.gif
deleted file mode 100644
index 136235e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/apply_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/backward_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/backward_nav.gif
deleted file mode 100644
index 740419b..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/backward_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/close_view.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/close_view.gif
deleted file mode 100644
index 1aca259..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/close_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/defaults_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/defaults_ps.gif
deleted file mode 100644
index 5e1e78a..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/defaults_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/edittsk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/edittsk_tsk.gif
deleted file mode 100644
index a1ca3e7..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/edittsk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/filter_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/filter_ps.gif
deleted file mode 100644
index 1492b4e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/filter_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/filter_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/filter_tsk.gif
deleted file mode 100644
index 1492b4e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/filter_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/forward_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/forward_nav.gif
deleted file mode 100644
index 7a1511d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/forward_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/gotoobj_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/gotoobj_tsk.gif
deleted file mode 100644
index 082e49f..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/gotoobj_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/graph_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/graph_mode.gif
deleted file mode 100644
index d889d88..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/graph_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/home_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/home_nav.gif
deleted file mode 100644
index 949c2db..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/home_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/list_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/list_mode.gif
deleted file mode 100644
index 3d1c062..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/list_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/min_view.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/min_view.gif
deleted file mode 100644
index 7402dc9..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/min_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/pin_view.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/pin_view.gif
deleted file mode 100644
index 1b80441..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/pin_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/popup_menu.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/popup_menu.gif
deleted file mode 100644
index 61ede73..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/popup_menu.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/refresh_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/refresh_nav.gif
deleted file mode 100644
index a063c23..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/refresh_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/rembkmrk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/rembkmrk_tsk.gif
deleted file mode 100644
index 6f64766..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/rembkmrk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/remtsk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/remtsk_tsk.gif
deleted file mode 100644
index 6f64766..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/remtsk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/scroll_lft.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/scroll_lft.gif
deleted file mode 100644
index 912e077..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/scroll_lft.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/scroll_rt.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/scroll_rt.gif
deleted file mode 100644
index f34eb71..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/scroll_rt.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/scrollend.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/scrollend.gif
deleted file mode 100644
index 6de69bf..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/scrollend.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/scrollhome.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/scrollhome.gif
deleted file mode 100644
index 06d95bb..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/scrollhome.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/selected_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/selected_mode.gif
deleted file mode 100644
index 72e07fa..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/selected_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showbasic_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showbasic_ps.gif
deleted file mode 100644
index f302d8c..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showbasic_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showcategory_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showcategory_ps.gif
deleted file mode 100644
index 1b3a991..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showcategory_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showchild_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showchild_mode.gif
deleted file mode 100644
index dfab3c6..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showchild_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showcomplete_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showcomplete_tsk.gif
deleted file mode 100644
index 00da14e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showcomplete_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showerr_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showerr_tsk.gif
deleted file mode 100644
index c2bfdd6..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showerr_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showexpert_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showexpert_ps.gif
deleted file mode 100644
index f6c14eb..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showexpert_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showparents_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showparents_mode.gif
deleted file mode 100644
index 6c23051..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showparents_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showsync_rn.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showsync_rn.gif
deleted file mode 100644
index 8411bc2..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showsync_rn.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showtsk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showtsk_tsk.gif
deleted file mode 100644
index 6ccbb60..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showtsk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showwarn_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showwarn_tsk.gif
deleted file mode 100644
index cf4fdf9..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/showwarn_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/step_current.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/step_current.gif
deleted file mode 100644
index 7a1511d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/step_current.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/step_done.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/step_done.gif
deleted file mode 100644
index 00da14e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/step_done.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/stop_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/stop_nav.gif
deleted file mode 100644
index 4eb53ec..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/stop_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/tree_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/tree_mode.gif
deleted file mode 100644
index 852dc81..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/tree_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/up_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/up_nav.gif
deleted file mode 100644
index 6877784..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/up_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/view_menu.gif b/bundles/org.eclipse.ui.workbench/icons/full/clcl16/view_menu.gif
deleted file mode 100644
index a492838..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/clcl16/view_menu.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/build_exec.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/build_exec.gif
deleted file mode 100644
index 20e7bae..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/build_exec.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/copy_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/copy_edit.gif
deleted file mode 100644
index 4274b07..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/copy_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/cut_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/cut_edit.gif
deleted file mode 100644
index eb948b9..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/cut_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/debug_exec.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/debug_exec.gif
deleted file mode 100644
index 8b4f234..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/debug_exec.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/delete_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/delete_edit.gif
deleted file mode 100644
index 6f64766..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/delete_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/export_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/export_wiz.gif
deleted file mode 100644
index 5a01b75..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/export_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/exportdir_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/exportdir_wiz.gif
deleted file mode 100644
index 168c6ee..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/exportdir_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/exportzip_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/exportzip_wiz.gif
deleted file mode 100644
index 51e6b11..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/exportzip_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/import_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/import_wiz.gif
deleted file mode 100644
index 6152fd7..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/import_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/importdir_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/importdir_wiz.gif
deleted file mode 100644
index 188c920..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/importdir_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/importzip_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/importzip_wiz.gif
deleted file mode 100644
index c41c5c8..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/importzip_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/move_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/move_edit.gif
deleted file mode 100644
index ec72889..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/move_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/new_page.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/new_page.gif
deleted file mode 100644
index 41c3958..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/new_page.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/new_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/new_wiz.gif
deleted file mode 100644
index bf683ca..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/new_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/newfile_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/newfile_wiz.gif
deleted file mode 100644
index 6baa037..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/newfile_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/newfolder_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/newfolder_wiz.gif
deleted file mode 100644
index a0b98ff..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/newfolder_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/newprj_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/newprj_wiz.gif
deleted file mode 100644
index ca7ef1b..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/newprj_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/next_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/next_nav.gif
deleted file mode 100644
index 8392f33..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/next_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/paste_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/paste_edit.gif
deleted file mode 100644
index 75e0ab2..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/paste_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/pin_editor.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/pin_editor.gif
deleted file mode 100644
index 9997124..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/pin_editor.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/prefs_misc.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/prefs_misc.gif
deleted file mode 100644
index 5d74b2b..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/prefs_misc.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/prev_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/prev_nav.gif
deleted file mode 100644
index 9b278e6..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/prev_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/print_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/print_edit.gif
deleted file mode 100644
index 4dfa8cd..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/print_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/redo_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/redo_edit.gif
deleted file mode 100644
index 01ce578..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/redo_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/rename_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/rename_edit.gif
deleted file mode 100644
index 25b1325..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/rename_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/run_exec.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/run_exec.gif
deleted file mode 100644
index 9a4db0d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/run_exec.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/save_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/save_edit.gif
deleted file mode 100644
index 698d9a2..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/save_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/saveall_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/saveall_edit.gif
deleted file mode 100644
index b77773a..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/saveall_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/saveas_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/saveas_edit.gif
deleted file mode 100644
index 76549a1..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/saveas_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/search_src.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/search_src.gif
deleted file mode 100644
index 6dc3ebe..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/search_src.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/undo_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/ctool16/undo_edit.gif
deleted file mode 100644
index 570c61c..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/ctool16/undo_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/cview16/bkmrk_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/cview16/bkmrk_nav.gif
deleted file mode 100644
index 27abe3a..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/cview16/bkmrk_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/cview16/default_persp.gif b/bundles/org.eclipse.ui.workbench/icons/full/cview16/default_persp.gif
deleted file mode 100644
index e159862..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/cview16/default_persp.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/cview16/defaultview_misc.gif b/bundles/org.eclipse.ui.workbench/icons/full/cview16/defaultview_misc.gif
deleted file mode 100644
index e159862..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/cview16/defaultview_misc.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/cview16/filenav_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/cview16/filenav_nav.gif
deleted file mode 100644
index 91b9d5a..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/cview16/filenav_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/cview16/new_persp.gif b/bundles/org.eclipse.ui.workbench/icons/full/cview16/new_persp.gif
deleted file mode 100644
index ccc29c5..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/cview16/new_persp.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/cview16/opensame_persp.gif b/bundles/org.eclipse.ui.workbench/icons/full/cview16/opensame_persp.gif
deleted file mode 100644
index d32f767..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/cview16/opensame_persp.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/cview16/outline_co.gif b/bundles/org.eclipse.ui.workbench/icons/full/cview16/outline_co.gif
deleted file mode 100644
index 16a065d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/cview16/outline_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/cview16/prop_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/cview16/prop_ps.gif
deleted file mode 100644
index ec0cba1..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/cview16/prop_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/cview16/replace_persp.gif b/bundles/org.eclipse.ui.workbench/icons/full/cview16/replace_persp.gif
deleted file mode 100644
index e8910d6..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/cview16/replace_persp.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/cview16/resource_persp.gif b/bundles/org.eclipse.ui.workbench/icons/full/cview16/resource_persp.gif
deleted file mode 100644
index 04c31bd..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/cview16/resource_persp.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/cview16/tasks_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/cview16/tasks_tsk.gif
deleted file mode 100644
index bc0639e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/cview16/tasks_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/addbkmrk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/addbkmrk_tsk.gif
deleted file mode 100644
index 813cb2f..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/addbkmrk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/addtsk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/addtsk_tsk.gif
deleted file mode 100644
index 813cb2f..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/addtsk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/alpha_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/alpha_mode.gif
deleted file mode 100644
index 73c6265..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/alpha_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/apply_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/apply_ps.gif
deleted file mode 100644
index 43274be..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/apply_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/backward_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/backward_nav.gif
deleted file mode 100644
index e2179ad..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/backward_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/close_view.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/close_view.gif
deleted file mode 100644
index 44d5488..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/close_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/defaults_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/defaults_ps.gif
deleted file mode 100644
index 0c0c2fb..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/defaults_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/edittsk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/edittsk_tsk.gif
deleted file mode 100644
index ed10eef..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/edittsk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/filter_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/filter_ps.gif
deleted file mode 100644
index 2b6285b..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/filter_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/filter_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/filter_tsk.gif
deleted file mode 100644
index 2b6285b..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/filter_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/forward_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/forward_nav.gif
deleted file mode 100644
index 0c5af08..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/forward_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/gotoobj_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/gotoobj_tsk.gif
deleted file mode 100644
index efcfc90..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/gotoobj_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/graph_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/graph_mode.gif
deleted file mode 100644
index 7e64a83..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/graph_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/home_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/home_nav.gif
deleted file mode 100644
index 3c80080..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/home_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/list_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/list_mode.gif
deleted file mode 100644
index 6d09167..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/list_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/min_view.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/min_view.gif
deleted file mode 100644
index eb3e66b..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/min_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/pin_view.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/pin_view.gif
deleted file mode 100644
index 98a8100..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/pin_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/popup_menu.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/popup_menu.gif
deleted file mode 100644
index 17ed1a2..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/popup_menu.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/refresh_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/refresh_nav.gif
deleted file mode 100644
index b2281b4..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/refresh_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/rembkmrk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/rembkmrk_tsk.gif
deleted file mode 100644
index a6bfcfd..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/rembkmrk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/remtsk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/remtsk_tsk.gif
deleted file mode 100644
index a6bfcfd..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/remtsk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scroll_lft.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scroll_lft.gif
deleted file mode 100644
index 7b46bdb..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scroll_lft.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scroll_rt.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scroll_rt.gif
deleted file mode 100644
index 84efd55..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scroll_rt.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scrollend.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scrollend.gif
deleted file mode 100644
index 3731819..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scrollend.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scrollhome.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scrollhome.gif
deleted file mode 100644
index 62e0e4e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/scrollhome.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/selected_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/selected_mode.gif
deleted file mode 100644
index 109378c..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/selected_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showbasic_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showbasic_ps.gif
deleted file mode 100644
index a0f8006..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showbasic_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showcategory_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showcategory_ps.gif
deleted file mode 100644
index 9ec1d31..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showcategory_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showchild_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showchild_mode.gif
deleted file mode 100644
index 2f9e6d2..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showchild_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showcomplete_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showcomplete_tsk.gif
deleted file mode 100644
index 872b853..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showcomplete_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showerr_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showerr_tsk.gif
deleted file mode 100644
index 28350b7..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showerr_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showexpert_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showexpert_ps.gif
deleted file mode 100644
index 5771022..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showexpert_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showparents_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showparents_mode.gif
deleted file mode 100644
index e928437..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showparents_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showsync_rn.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showsync_rn.gif
deleted file mode 100644
index 3dcccb3..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showsync_rn.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showtsk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showtsk_tsk.gif
deleted file mode 100644
index d6d15ff..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showtsk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showwarn_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showwarn_tsk.gif
deleted file mode 100644
index 666f9a6..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/showwarn_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/stop_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/stop_nav.gif
deleted file mode 100644
index 7f0f9b9..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/stop_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/tree_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/tree_mode.gif
deleted file mode 100644
index 27f71ea..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/tree_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/up_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/up_nav.gif
deleted file mode 100644
index 71654ee..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/up_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/view_menu.gif b/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/view_menu.gif
deleted file mode 100644
index 267ee21..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dlcl16/view_menu.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/bottom_mask.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/bottom_mask.bmp
deleted file mode 100644
index 22eb40d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/bottom_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/bottom_source.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/bottom_source.bmp
deleted file mode 100644
index 4d243c6..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/bottom_source.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/invalid_mask.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/invalid_mask.bmp
deleted file mode 100644
index 22eb40d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/invalid_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/invalid_source.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/invalid_source.bmp
deleted file mode 100644
index b53df6f..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/invalid_source.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/left_mask.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/left_mask.bmp
deleted file mode 100644
index 22eb40d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/left_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/left_source.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/left_source.bmp
deleted file mode 100644
index 48d3098..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/left_source.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/offscreen_mask.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/offscreen_mask.bmp
deleted file mode 100644
index 8fa7b96..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/offscreen_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/offscreen_source.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/offscreen_source.bmp
deleted file mode 100644
index 85de577..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/offscreen_source.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/right_mask.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/right_mask.bmp
deleted file mode 100644
index 22eb40d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/right_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/right_source.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/right_source.bmp
deleted file mode 100644
index 8bc50f4..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/right_source.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/stack_mask.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/stack_mask.bmp
deleted file mode 100644
index 5bad51c..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/stack_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/stack_source.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/stack_source.bmp
deleted file mode 100644
index 7a8fc84..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/stack_source.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/tofastview_mask.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/tofastview_mask.bmp
deleted file mode 100644
index 44768d6..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/tofastview_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/tofastview_source.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/tofastview_source.bmp
deleted file mode 100644
index e1afb4e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/tofastview_source.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/top_mask.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/top_mask.bmp
deleted file mode 100644
index 22eb40d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/top_mask.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dnd/top_source.bmp b/bundles/org.eclipse.ui.workbench/icons/full/dnd/top_source.bmp
deleted file mode 100644
index 5255241..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dnd/top_source.bmp
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/build_exec.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/build_exec.gif
deleted file mode 100644
index d2ac89c..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/build_exec.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/copy_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/copy_edit.gif
deleted file mode 100644
index c7a98e8..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/copy_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/cut_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/cut_edit.gif
deleted file mode 100644
index 9cec774..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/cut_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/debug_exec.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/debug_exec.gif
deleted file mode 100644
index 23dfce0..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/debug_exec.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/delete_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/delete_edit.gif
deleted file mode 100644
index a6bfcfd..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/delete_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/export_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/export_wiz.gif
deleted file mode 100644
index 13959f3..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/export_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/exportdir_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/exportdir_wiz.gif
deleted file mode 100644
index 706e3a2..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/exportdir_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/exportzip_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/exportzip_wiz.gif
deleted file mode 100644
index b712331..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/exportzip_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/import_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/import_wiz.gif
deleted file mode 100644
index a3934cb..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/import_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/importdir_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/importdir_wiz.gif
deleted file mode 100644
index 70ec116..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/importdir_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/importzip_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/importzip_wiz.gif
deleted file mode 100644
index 9ca597b..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/importzip_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/move_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/move_edit.gif
deleted file mode 100644
index a381599..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/move_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/new_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/new_wiz.gif
deleted file mode 100644
index 578fa07..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/new_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/newfile_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/newfile_wiz.gif
deleted file mode 100644
index c931715..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/newfile_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/newfolder_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/newfolder_wiz.gif
deleted file mode 100644
index 3279891..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/newfolder_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/newprj_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/newprj_wiz.gif
deleted file mode 100644
index bd5772a..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/newprj_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/paste_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/paste_edit.gif
deleted file mode 100644
index 0dd5d21..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/paste_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/pin_editor.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/pin_editor.gif
deleted file mode 100644
index e2e1b46..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/pin_editor.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/prefs_misc.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/prefs_misc.gif
deleted file mode 100644
index d9d9b24..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/prefs_misc.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/print_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/print_edit.gif
deleted file mode 100644
index 56e688a..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/print_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/quick_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/quick_wiz.gif
deleted file mode 100644
index 24233df..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/quick_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/redo_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/redo_edit.gif
deleted file mode 100644
index 429f638..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/redo_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/rename_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/rename_edit.gif
deleted file mode 100644
index 99f3092..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/rename_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/run_exec.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/run_exec.gif
deleted file mode 100644
index 087dd57..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/run_exec.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/save_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/save_edit.gif
deleted file mode 100644
index fd3f62e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/save_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/saveall_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/saveall_edit.gif
deleted file mode 100644
index 3946f78..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/saveall_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/saveas_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/saveas_edit.gif
deleted file mode 100644
index 29bf5da..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/saveas_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/search_src.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/search_src.gif
deleted file mode 100644
index 5fe80f3..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/search_src.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/undo_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/dtool16/undo_edit.gif
deleted file mode 100644
index 65a414a..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/dtool16/undo_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/addbkmrk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/addbkmrk_tsk.gif
deleted file mode 100644
index 234594a..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/addbkmrk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/addtsk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/addtsk_tsk.gif
deleted file mode 100644
index 234594a..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/addtsk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/alpha_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/alpha_mode.gif
deleted file mode 100644
index 9d38f6d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/alpha_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/apply_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/apply_ps.gif
deleted file mode 100644
index 14f2706..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/apply_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/backward_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/backward_nav.gif
deleted file mode 100644
index 85188b7..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/backward_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/close_view.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/close_view.gif
deleted file mode 100644
index 5e5ad91..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/close_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/defaults_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/defaults_ps.gif
deleted file mode 100644
index d1c213a..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/defaults_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/edittsk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/edittsk_tsk.gif
deleted file mode 100644
index 1945e08..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/edittsk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/filter_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/filter_ps.gif
deleted file mode 100644
index 5372656..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/filter_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/filter_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/filter_tsk.gif
deleted file mode 100644
index 5372656..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/filter_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/forward_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/forward_nav.gif
deleted file mode 100644
index dc28ee1..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/forward_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/gotoobj_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/gotoobj_tsk.gif
deleted file mode 100644
index b562f52..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/gotoobj_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/graph_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/graph_mode.gif
deleted file mode 100644
index 5189dd9..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/graph_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/home_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/home_nav.gif
deleted file mode 100644
index bf2ba86..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/home_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/list_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/list_mode.gif
deleted file mode 100644
index eda01fa..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/list_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/min_view.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/min_view.gif
deleted file mode 100644
index b72a507..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/min_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/pin_view.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/pin_view.gif
deleted file mode 100644
index 1ad12b4..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/pin_view.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/popup_menu.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/popup_menu.gif
deleted file mode 100644
index 91aeb63..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/popup_menu.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/refresh_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/refresh_nav.gif
deleted file mode 100644
index 919423d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/refresh_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/rembkmrk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/rembkmrk_tsk.gif
deleted file mode 100644
index 34643b8..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/rembkmrk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/remtsk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/remtsk_tsk.gif
deleted file mode 100644
index 34643b8..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/remtsk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/scroll_lft.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/scroll_lft.gif
deleted file mode 100644
index 912e077..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/scroll_lft.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/scroll_rt.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/scroll_rt.gif
deleted file mode 100644
index f34eb71..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/scroll_rt.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/scrollend.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/scrollend.gif
deleted file mode 100644
index 6de69bf..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/scrollend.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/scrollhome.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/scrollhome.gif
deleted file mode 100644
index 06d95bb..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/scrollhome.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/selected_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/selected_mode.gif
deleted file mode 100644
index 5eca2d1..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/selected_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showbasic_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showbasic_ps.gif
deleted file mode 100644
index 2fddc3ea..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showbasic_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showcategory_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showcategory_ps.gif
deleted file mode 100644
index eb94d5a..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showcategory_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showchild_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showchild_mode.gif
deleted file mode 100644
index 8eb4d58..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showchild_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showcomplete_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showcomplete_tsk.gif
deleted file mode 100644
index 651d634..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showcomplete_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showerr_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showerr_tsk.gif
deleted file mode 100644
index 9883a7e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showerr_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showexpert_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showexpert_ps.gif
deleted file mode 100644
index 1710f18..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showexpert_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showparents_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showparents_mode.gif
deleted file mode 100644
index 7cd61d0..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showparents_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showsync_rn.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showsync_rn.gif
deleted file mode 100644
index 4410b22..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showsync_rn.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showtsk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showtsk_tsk.gif
deleted file mode 100644
index f183137..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showtsk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showwarn_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showwarn_tsk.gif
deleted file mode 100644
index c328627..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/showwarn_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/stop_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/stop_nav.gif
deleted file mode 100644
index a519f44..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/stop_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/tree_mode.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/tree_mode.gif
deleted file mode 100644
index 582010f..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/tree_mode.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/up_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/up_nav.gif
deleted file mode 100644
index 4c10912..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/up_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/view_menu.gif b/bundles/org.eclipse.ui.workbench/icons/full/elcl16/view_menu.gif
deleted file mode 100644
index dea5419..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/elcl16/view_menu.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/build_exec.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/build_exec.gif
deleted file mode 100644
index 9c910c8..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/build_exec.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/copy_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/copy_edit.gif
deleted file mode 100644
index 41bf445..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/copy_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/cut_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/cut_edit.gif
deleted file mode 100644
index 0d961dd..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/cut_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/debug_exec.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/debug_exec.gif
deleted file mode 100644
index 6ce0532..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/debug_exec.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/delete_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/delete_edit.gif
deleted file mode 100644
index 34643b8..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/delete_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/export_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/export_wiz.gif
deleted file mode 100644
index dc6292d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/export_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/exportdir_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/exportdir_wiz.gif
deleted file mode 100644
index 6dec1ce..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/exportdir_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/exportzip_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/exportzip_wiz.gif
deleted file mode 100644
index 1bb3a1d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/exportzip_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/import_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/import_wiz.gif
deleted file mode 100644
index 74dc174..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/import_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/importdir_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/importdir_wiz.gif
deleted file mode 100644
index 86b35e4..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/importdir_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/importzip_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/importzip_wiz.gif
deleted file mode 100644
index e9c6649..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/importzip_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/move_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/move_edit.gif
deleted file mode 100644
index f9e622f..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/move_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/new_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/new_wiz.gif
deleted file mode 100644
index 0342288..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/new_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/newfile_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/newfile_wiz.gif
deleted file mode 100644
index f2fe6e1..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/newfile_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/newfolder_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/newfolder_wiz.gif
deleted file mode 100644
index 2b49c1b..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/newfolder_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/newprj_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/newprj_wiz.gif
deleted file mode 100644
index 617b5a6..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/newprj_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/paste_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/paste_edit.gif
deleted file mode 100644
index 6e76152..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/paste_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/pin_editor.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/pin_editor.gif
deleted file mode 100644
index 9d24775..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/pin_editor.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/prefs_misc.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/prefs_misc.gif
deleted file mode 100644
index 346a10d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/prefs_misc.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/print_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/print_edit.gif
deleted file mode 100644
index e869b2e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/print_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/quick_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/quick_wiz.gif
deleted file mode 100644
index 24233df..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/quick_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/redo_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/redo_edit.gif
deleted file mode 100644
index 38aef82..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/redo_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/rename_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/rename_edit.gif
deleted file mode 100644
index 8337ba9..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/rename_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/run_exec.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/run_exec.gif
deleted file mode 100644
index 95f87ea..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/run_exec.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/save_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/save_edit.gif
deleted file mode 100644
index c1752cc..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/save_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/saveall_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/saveall_edit.gif
deleted file mode 100644
index 63b32d0..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/saveall_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/saveas_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/saveas_edit.gif
deleted file mode 100644
index 69f4b6f..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/saveas_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/search_src.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/search_src.gif
deleted file mode 100644
index 57ed3b4..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/search_src.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/etool16/undo_edit.gif b/bundles/org.eclipse.ui.workbench/icons/full/etool16/undo_edit.gif
deleted file mode 100644
index 322a24d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/etool16/undo_edit.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/eview16/bkmrk_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/eview16/bkmrk_nav.gif
deleted file mode 100644
index 69877bc..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/eview16/bkmrk_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/eview16/default_persp.gif b/bundles/org.eclipse.ui.workbench/icons/full/eview16/default_persp.gif
deleted file mode 100644
index 4cbddd0..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/eview16/default_persp.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/eview16/defaultview_misc.gif b/bundles/org.eclipse.ui.workbench/icons/full/eview16/defaultview_misc.gif
deleted file mode 100644
index 4cbddd0..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/eview16/defaultview_misc.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/eview16/filenav_nav.gif b/bundles/org.eclipse.ui.workbench/icons/full/eview16/filenav_nav.gif
deleted file mode 100644
index 386ee1f..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/eview16/filenav_nav.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/eview16/new_persp.gif b/bundles/org.eclipse.ui.workbench/icons/full/eview16/new_persp.gif
deleted file mode 100644
index 712b48f..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/eview16/new_persp.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/eview16/opensame_persp.gif b/bundles/org.eclipse.ui.workbench/icons/full/eview16/opensame_persp.gif
deleted file mode 100644
index b2a3d2c..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/eview16/opensame_persp.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/eview16/outline_co.gif b/bundles/org.eclipse.ui.workbench/icons/full/eview16/outline_co.gif
deleted file mode 100644
index 562fc2d..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/eview16/outline_co.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/eview16/prop_ps.gif b/bundles/org.eclipse.ui.workbench/icons/full/eview16/prop_ps.gif
deleted file mode 100644
index eb165ff..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/eview16/prop_ps.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/eview16/replace_persp.gif b/bundles/org.eclipse.ui.workbench/icons/full/eview16/replace_persp.gif
deleted file mode 100644
index bf2d0a5..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/eview16/replace_persp.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/eview16/resource_persp.gif b/bundles/org.eclipse.ui.workbench/icons/full/eview16/resource_persp.gif
deleted file mode 100644
index 304e55c..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/eview16/resource_persp.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/eview16/tasks_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/eview16/tasks_tsk.gif
deleted file mode 100644
index 51ae2bc..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/eview16/tasks_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/bkmrk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/bkmrk_tsk.gif
deleted file mode 100644
index 4f1a3ac..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/bkmrk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/cfldr_obj.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/cfldr_obj.gif
deleted file mode 100644
index beb6ed1..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/cfldr_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/complete_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/complete_tsk.gif
deleted file mode 100644
index 00da14e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/complete_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/cprj_obj.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/cprj_obj.gif
deleted file mode 100644
index 04e530e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/cprj_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/dots_button.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/dots_button.gif
deleted file mode 100644
index dea5098..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/dots_button.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/element_obj.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/element_obj.gif
deleted file mode 100644
index d945dde..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/element_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/elements_obj.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/elements_obj.gif
deleted file mode 100644
index 76b351e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/elements_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/error_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/error_tsk.gif
deleted file mode 100644
index 20afc6c..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/error_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/file_obj.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/file_obj.gif
deleted file mode 100644
index 6b86d07..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/file_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/fldr_obj.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/fldr_obj.gif
deleted file mode 100644
index a9c7773..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/fldr_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/hprio_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/hprio_tsk.gif
deleted file mode 100644
index 586ed8e9..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/hprio_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/incomplete_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/incomplete_tsk.gif
deleted file mode 100644
index 7aa131a..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/incomplete_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/info_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/info_tsk.gif
deleted file mode 100644
index 0c5f208..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/info_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/lprio_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/lprio_tsk.gif
deleted file mode 100644
index 19df9ae..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/lprio_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/prj_obj.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/prj_obj.gif
deleted file mode 100644
index 7b2b633..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/prj_obj.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/probmrk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/probmrk_tsk.gif
deleted file mode 100644
index 9592bc1..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/probmrk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/system_summary_editor.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/system_summary_editor.gif
deleted file mode 100644
index 6b86d07..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/system_summary_editor.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/taskmrk_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/taskmrk_tsk.gif
deleted file mode 100644
index 2eb001b..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/taskmrk_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/warn_tsk.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/warn_tsk.gif
deleted file mode 100644
index 70f7ad7..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/warn_tsk.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/welcome_banner.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/welcome_banner.gif
deleted file mode 100644
index 8ea6294..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/welcome_banner.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/welcome_editor.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/welcome_editor.gif
deleted file mode 100644
index 6b86d07..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/welcome_editor.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/welcome_item.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/welcome_item.gif
deleted file mode 100644
index 311f57f..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/welcome_item.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/obj16/workset.gif b/bundles/org.eclipse.ui.workbench/icons/full/obj16/workset.gif
deleted file mode 100644
index 04c31bd..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/obj16/workset.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/wizban/export_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/wizban/export_wiz.gif
deleted file mode 100644
index da6f70f..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/wizban/export_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/wizban/exportdir_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/wizban/exportdir_wiz.gif
deleted file mode 100644
index bfc0b70..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/wizban/exportdir_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/wizban/exportzip_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/wizban/exportzip_wiz.gif
deleted file mode 100644
index 3d363dd..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/wizban/exportzip_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/wizban/import_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/wizban/import_wiz.gif
deleted file mode 100644
index ce86a3e..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/wizban/import_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/wizban/importdir_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/wizban/importdir_wiz.gif
deleted file mode 100644
index 47bcb45..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/wizban/importdir_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/wizban/importzip_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/wizban/importzip_wiz.gif
deleted file mode 100644
index 8765892..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/wizban/importzip_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/wizban/new_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/wizban/new_wiz.gif
deleted file mode 100644
index b084ad9..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/wizban/new_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/wizban/newfile_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/wizban/newfile_wiz.gif
deleted file mode 100644
index 67e1456..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/wizban/newfile_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/wizban/newfolder_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/wizban/newfolder_wiz.gif
deleted file mode 100644
index 93b86bd..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/wizban/newfolder_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/wizban/newprj_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/wizban/newprj_wiz.gif
deleted file mode 100644
index fdb64a8..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/wizban/newprj_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/wizban/saveas_dlg.gif b/bundles/org.eclipse.ui.workbench/icons/full/wizban/saveas_dlg.gif
deleted file mode 100644
index ebd5650..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/wizban/saveas_dlg.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/icons/full/wizban/workset_wiz.gif b/bundles/org.eclipse.ui.workbench/icons/full/wizban/workset_wiz.gif
deleted file mode 100644
index 3d005f8..0000000
--- a/bundles/org.eclipse.ui.workbench/icons/full/wizban/workset_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.ui.workbench/plugin.properties b/bundles/org.eclipse.ui.workbench/plugin.properties
deleted file mode 100644
index bff279d..0000000
--- a/bundles/org.eclipse.ui.workbench/plugin.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-pluginName= Workbench
-providerName= Eclipse.org
diff --git a/bundles/org.eclipse.ui.workbench/plugin.xml b/bundles/org.eclipse.ui.workbench/plugin.xml
deleted file mode 100644
index 4707c21..0000000
--- a/bundles/org.eclipse.ui.workbench/plugin.xml
+++ /dev/null
@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.ui.workbench"
- name="%pluginName"
- version="2.1.0"
- provider-name="%providerName"
- class="org.eclipse.ui.internal.WorkbenchPlugin">
-
- <runtime>
- <library name="workbench.jar">
- <export name="*"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.apache.xerces"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.update.core"/>
- <import plugin="org.eclipse.help"/>
- <import plugin="org.eclipse.jface"/>
- <import plugin="org.eclipse.jface.text"/>
- </requires>
-
-
-</plugin>
diff --git a/bundles/org.eclipse.ui.workbench/scripts/exportplugin.xml b/bundles/org.eclipse.ui.workbench/scripts/exportplugin.xml
deleted file mode 100644
index 07f060b..0000000
--- a/bundles/org.eclipse.ui.workbench/scripts/exportplugin.xml
+++ /dev/null
@@ -1,34 +0,0 @@
-<project name="Export Workbench" default="export" basedir="..">
- <target name="init">
- <tstamp/>
- <property name="destdir" value="../../plugin-export" />
- <property name="plugin" value="org.eclipse.ui.workbench" />
- <property name="version" value="_2.1.0" />
- <property name="dest" value="${destdir}/${plugin}${version}" />
- </target>
-
- <target name="build" depends="init">
- <eclipse.incrementalBuild project="${plugin}" kind="incr"/>
- </target>
-
- <target name="export" depends="build">
- <mkdir dir="${destdir}" />
- <delete dir="${dest}" />
- <mkdir dir="${dest}" />
- <jar
- jarfile="${dest}/workbench.jar"
- basedir="bin"
- />
- <copy file="plugin.xml" todir="${dest}"/>
- <copy file="plugin.properties" todir="${dest}"/>
- <copy todir="${dest}/icons">
- <fileset dir="icons" />
- </copy>
- <zip zipfile="${dest}/workbenchsrc.zip">
- <fileset dir="Eclipse UI" />
- <fileset dir="extensions" />
- <fileset dir="Eclipse UI Editor Support" />
- </zip>
- </target>
-
-</project>
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui/buildnotes_workbench.html b/bundles/org.eclipse.ui/buildnotes_workbench.html
index 41aa225..049f68c 100644
--- a/bundles/org.eclipse.ui/buildnotes_workbench.html
+++ b/bundles/org.eclipse.ui/buildnotes_workbench.html
@@ -11,26 +11,6 @@
<h1>
Eclipse Platform Build Notes<br>
Workbench</h1>
-Eclipse Integration Build 200201016
-<h2>
-What's new in this drop</h2>
-
-<h3>
-Other highlights</h3>
-
-<h2>
-Known deficiencies</h2>
-
-<h2>
-Problem reports fixed</h2>
-<a href="http://dev.eclipse.org/bugs/buglist.cgi?bug_status=RESOLVED&bug_status=VERIFIED&bug_status=CLOSED&chfield=bug_status&chfieldfrom=2002%2F10%2F14&chfieldto=2002%2F10%2F16&product=Platform&component=UI&cmdtype=doit&&order=Bug+Number">Click
-here</a> to see PRs which have been marked as RESOLVED, VERIFIED or CLOSED
-between 2002/10/14 and 2002/10/16.
-<p>
-<hr SIZE=0 WIDTH="100%">
-
-<p>
- </p>
Eclipse Integration Build 200201014
<h2>
What's new in this drop</h2>
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/.classpath b/examples/org.eclipse.ui.examples.multipageeditor/.classpath
deleted file mode 100644
index 4845f2d..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="Eclipse UI Examples MultiPageEditor"/>
- <classpathentry kind="src" path="/org.eclipse.ui"/>
- <classpathentry kind="src" path="/org.eclipse.swt"/>
- <classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/.cvsignore b/examples/org.eclipse.ui.examples.multipageeditor/.cvsignore
deleted file mode 100644
index c5e82d7..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
\ No newline at end of file
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/.project b/examples/org.eclipse.ui.examples.multipageeditor/.project
deleted file mode 100644
index 2354b63..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/.project
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.examples.multipageeditor</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.ui</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MessageUtil.java b/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MessageUtil.java
deleted file mode 100644
index dd14ee4..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MessageUtil.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.examples.multipageeditor;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps with managing messages.
- */
-/* package */ class MessageUtil {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.examples.multipageeditor.messages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private MessageUtil() {
- // prevent instantiation of class
- }
-
- /**
- * Returns the formatted message for the given key in
- * the resource bundle.
- *
- * @param key the resource name
- * @param args the message arguments
- * @return the string
- */
- public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key),args);
- }
-
- /**
- * Returns the resource object with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the key is returned, surrounded by '!'s.
- *
- * @param key the resource name
- * @return the string
- */
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-}
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MultiPageContributor.java b/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MultiPageContributor.java
deleted file mode 100644
index d78f61a..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MultiPageContributor.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.ui.examples.multipageeditor;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.jface.action.IAction;
-
-/**
- * Manages the installation/deinstallation of global actions for multi-page editors.
- * Responsible for the redirection of global actions to the active editor.
- * Multi-page contributor replaces the contributors for the individual editors in the multi-page editor.
- */
-public class MultiPageContributor extends MultiPageEditorActionBarContributor {
- private IEditorPart activeEditorPart;
-/**
- * Creates a multi-page contributor.
- */
-public MultiPageContributor() {
- super();
-}
-/**
- * Returns the action registed with the given text editor.
- * @return IAction or null if editor is null.
- */
-protected IAction getAction(ITextEditor editor, String actionID) {
- return (editor == null ? null : editor.getAction(actionID));
-}
-/* (non-JavaDoc)
- * Method declared in AbstractMultiPageEditorActionBarContributor.
- */
-
-public void setActivePage(IEditorPart part) {
- if (activeEditorPart == part)
- return;
-
- activeEditorPart = part;
-
- IActionBars actionBars = getActionBars();
- if (actionBars != null) {
-
- ITextEditor editor = (part instanceof ITextEditor) ? (ITextEditor) part : null;
-
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.DELETE, getAction(editor, ITextEditorActionConstants.DELETE));
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.UNDO, getAction(editor, ITextEditorActionConstants.UNDO));
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.REDO, getAction(editor, ITextEditorActionConstants.REDO));
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.CUT, getAction(editor, ITextEditorActionConstants.CUT));
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.COPY, getAction(editor, ITextEditorActionConstants.COPY));
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.PASTE, getAction(editor, ITextEditorActionConstants.PASTE));
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.SELECT_ALL, getAction(editor, ITextEditorActionConstants.SELECT_ALL));
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.FIND, getAction(editor, ITextEditorActionConstants.FIND));
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.BOOKMARK, getAction(editor, ITextEditorActionConstants.BOOKMARK));
- actionBars.updateActionBars();
- }
-}
-}
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MultiPageEditorExample.java b/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MultiPageEditorExample.java
deleted file mode 100644
index e9074d2..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MultiPageEditorExample.java
+++ /dev/null
@@ -1,202 +0,0 @@
-package org.eclipse.ui.examples.multipageeditor;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.*;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.part.MultiPageEditorPart;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FontDialog;
-import java.io.StringWriter;
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.StringTokenizer;
-
-/**
- * An example showing how to create a multi-page editor.
- * This example has 3 pages:
- * <ul>
- * <li>page 0 contains a nested text editor.
- * <li>page 1 allows you to change the font used in page 2
- * <li>page 2 shows the words in page 0 in sorted order
- * </ul>
- */
-public class MultiPageEditorExample extends MultiPageEditorPart {
-
- /** The text editor used in page 0. */
- private TextEditor editor;
-
- /** The font chosen in page 1. */
- private Font font;
-
- /** The text widget used in page 2. */
- private StyledText text;
-/**
- * Creates a multi-page editor example.
- */
-public MultiPageEditorExample() {
- super();
-}
-/**
- * Creates page 0 of the multi-page editor,
- * which contains a text editor.
- */
-void createPage0() {
- try {
- editor = new TextEditor();
- int index = addPage(editor, getEditorInput());
- setPageText(index, MessageUtil.getString("Source")); //$NON-NLS-1$
- }
- catch (PartInitException e) {
- ErrorDialog.openError(getSite().getShell(), MessageUtil.getString("ErrorCreatingNestedEditor"), null, e.getStatus()); //$NON-NLS-1$
- }
-}
-/**
- * Creates page 1 of the multi-page editor,
- * which allows you to change the font used in page 2.
- */
-void createPage1() {
-
- Composite composite = new Composite(getContainer(), SWT.NONE);
- GridLayout layout = new GridLayout();
- composite.setLayout(layout);
- layout.numColumns = 2;
-
- Button fontButton = new Button(composite, SWT.NONE);
- GridData gd = new GridData(GridData.BEGINNING);
- gd.horizontalSpan = 2;
- fontButton.setLayoutData(gd);
- fontButton.setText(MessageUtil.getString("ChangeFont")); //$NON-NLS-1$
-
- fontButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- setFont();
- }
- });
-
- int index = addPage(composite);
- setPageText(index, MessageUtil.getString("Properties")); //$NON-NLS-1$
-}
-/**
- * Creates page 2 of the multi-page editor,
- * which shows the sorted text.
- */
-void createPage2() {
- Composite composite = new Composite(getContainer(), SWT.NONE);
- FillLayout layout = new FillLayout();
- composite.setLayout(layout);
- text = new StyledText(composite, SWT.H_SCROLL | SWT.V_SCROLL);
- text.setEditable(false);
-
- int index = addPage(composite);
- setPageText(index, MessageUtil.getString("Preview")); //$NON-NLS-1$
-}
-/**
- * Creates the pages of the multi-page editor.
- */
-protected void createPages() {
- createPage0();
- createPage1();
- createPage2();
-}
-/**
- * Saves the multi-page editor's document.
- */
-public void doSave(IProgressMonitor monitor) {
- getEditor(0).doSave(monitor);
-}
-/**
- * Saves the multi-page editor's document as another file.
- * Also updates the text for page 0's tab, and updates this multi-page editor's input
- * to correspond to the nested editor's.
- */
-public void doSaveAs() {
- IEditorPart editor = getEditor(0);
- editor.doSaveAs();
- setPageText(0, editor.getTitle());
- setInput(editor.getEditorInput());
-}
-/* (non-Javadoc)
- * Method declared on IEditorPart
- */
-public void gotoMarker(IMarker marker) {
- setActivePage(0);
- getEditor(0).gotoMarker(marker);
-}
-/**
- * The <code>MultiPageEditorExample</code> implementation of this method
- * checks that the input is an instance of <code>IFileEditorInput</code>.
- */
-public void init(IEditorSite site, IEditorInput editorInput) throws PartInitException {
- if (!(editorInput instanceof IFileEditorInput))
- throw new PartInitException(MessageUtil.getString("InvalidInput")); //$NON-NLS-1$
- super.init(site, editorInput);
-}
-/* (non-Javadoc)
- * Method declared on IEditorPart.
- */
-public boolean isSaveAsAllowed() {
- return true;
-}
-/**
- * Calculates the contents of page 2 when the it is activated.
- */
-protected void pageChange(int newPageIndex) {
- super.pageChange(newPageIndex);
- if (newPageIndex == 2) {
- sortWords();
- }
-}
-/**
- * Sets the font related data to be applied to the text in page 2.
- */
-void setFont() {
- FontDialog fontDialog = new FontDialog(getSite().getShell());
- fontDialog.setFontData(text.getFont().getFontData()[0]);
- FontData fontData = fontDialog.open();
- if (fontData != null) {
- if (font != null)
- font.dispose();
- font = new Font(text.getDisplay(), fontData);
- text.setFont(font);
- }
-}
-/**
- * Sorts the words in page 0, and shows them in page 2.
- */
-void sortWords() {
-
- String editorText = editor.getDocumentProvider().getDocument(editor.getEditorInput()).get();
-
- StringTokenizer tokenizer = new StringTokenizer(editorText, " \t\n\r\f!@#$%^&*()-_=+`~[]{};:'\",.<>/?|\\"); //$NON-NLS-1$
- ArrayList editorWords = new ArrayList();
- while (tokenizer.hasMoreTokens()) {
- editorWords.add(tokenizer.nextToken());
- }
-
- Collections.sort(editorWords, Collator.getInstance());
- StringWriter displayText = new StringWriter();
- for (int i = 0; i < editorWords.size(); i++) {
- displayText.write(((String) editorWords.get(i)));
- displayText.write("\n"); //$NON-NLS-1$
- }
- text.setText(displayText.toString());
-}
-}
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/messages.properties b/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/messages.properties
deleted file mode 100644
index 7950e00..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/messages.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-ErrorCreatingNestedEditor=Error creating nested text editor
-ChangeFont=Change Font...
-InvalidInput=Invalid Input: Must be IFileEditorInput
-Preview=Preview
-Properties=Properties
-Source=Source
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/about.html b/examples/org.eclipse.ui.examples.multipageeditor/about.html
deleted file mode 100644
index 9db411a..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, "Program" will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/build.properties b/examples/org.eclipse.ui.examples.multipageeditor/build.properties
deleted file mode 100644
index afa232c..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/build.properties
+++ /dev/null
@@ -1,11 +0,0 @@
-source.multipageeditor.jar = Eclipse UI Examples MultiPageEditor/
-
-bin.includes = doc-html/,\
- icons/,\
- .options,\
- about.html,\
- plugin.properties,\
- plugin.xml,\
- *.jar
-
-src.includes = about.html
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/doc-html/hglegal.htm b/examples/org.eclipse.ui.examples.multipageeditor/doc-html/hglegal.htm
deleted file mode 100644
index b071dbd..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/doc-html/hglegal.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/doc-html/ngibmcpy.gif b/examples/org.eclipse.ui.examples.multipageeditor/doc-html/ngibmcpy.gif
deleted file mode 100644
index 360f8e9..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/doc-html/ui_multipageeditor_ex.html b/examples/org.eclipse.ui.examples.multipageeditor/doc-html/ui_multipageeditor_ex.html
deleted file mode 100644
index a610d18..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/doc-html/ui_multipageeditor_ex.html
+++ /dev/null
@@ -1,50 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Desktop - Multi-page Editor Example</title>
-</head>
-<body>
-
-<h2>
-<b>Example - Multi-page Editor</b></h2>
-
-<h3>
-Introduction</h3>
-The Multi Page Editor Example adds an editor for files with the .mpe
-extension. It shows how to create an editor that uses multiple pages by
-defining both an editor and a page contributor that can add entries to
-an action bar.
-<h3>
-Running the example</h3>
-To start using the Multi-page Editor Example, create a new file with .mpe
-extension. Select the file, bring up the popup menu, select the Open
-With menu and from the sub-menu select the Multi Page Editor Example menu
-item. You can then select the different editors by selecting the different
-tabs.
-<h4>
-<b>Creating a new mpe file</b></h4>
-Create a new file with file extension .mpe. From the File menu, select
-New and then select Other... from the sub-menu. Click on Simple in
-the wizard, then select
-<br>File in the list on the left. Click on Next to supply the file
-name (make sure the extension is .mpe) and the folder in which the file
-should be contained.
-<br>
-<h3>
-Details</h3>
-The Multi Page Editor Example demonstrates how to create an multi
-page editor with a custom page contributor.
-<p>The Multi Page Editor Example is constructed with two extensions - a
-document contributor (MultiPageContributor) and an editor (MultiPageEditor).
-The document contributor is a subclass of <tt>org.eclipse.ui.part.MultiPageEditorActionBarContributor</tt>
-and defines the actions that are added to an editor when the <tt>setActivePage</tt>
-method is called. The editor is an <tt>org.eclipse.ui.part.MultiPageEditorPart</tt>
-that creates 3 pages whose activation is handled by the <tt>pageChange</tt>
-method that in turn sends <tt>setActivePage</tt>
-to the contributor. These two classes do not refer to each other directly
-- the contributor for the editor is set using the contributorClass tag
-in the plugin.xml
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corp. 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a>
-</body>
-</html>
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/icons/copy.gif b/examples/org.eclipse.ui.examples.multipageeditor/icons/copy.gif
deleted file mode 100644
index f962255..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/icons/copy.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/plugin.properties b/examples/org.eclipse.ui.examples.multipageeditor/plugin.properties
deleted file mode 100644
index 6d46d27..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/plugin.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-Plugin.name = MultiPage Editor Example
-Plugin.providerName = Eclipse.org
-Editors.MultiPageEditorExample = Multi-Page Editor Example
diff --git a/examples/org.eclipse.ui.examples.multipageeditor/plugin.xml b/examples/org.eclipse.ui.examples.multipageeditor/plugin.xml
deleted file mode 100644
index 328714a..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/plugin.xml
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ======================================================================= -->
-<!-- The MultiPage Editor Example is a sample plugin which demonstrates the -->
-<!-- implementation of a multi-page editor. -->
-<!-- ======================================================================= -->
-<plugin
- name = "%Plugin.name"
- id = "org.eclipse.ui.examples.multipageeditor"
- version = "2.1.0"
- provider-name = "%Plugin.providerName">
-
- <requires>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.core.resources"/>
- </requires>
-
- <runtime>
- <library name="multipageeditor.jar">
- <export name="*"/>
- </library>
- </runtime>
-
- <extension
- point = "org.eclipse.ui.editors">
- <editor
- id = "org.eclipse.ui.examples.multipageeditor.MultiPageEditorExample"
- name="%Editors.MultiPageEditorExample"
- icon="icons/copy.gif"
- extensions="mpe"
- class="org.eclipse.ui.examples.multipageeditor.MultiPageEditorExample"
- contributorClass="org.eclipse.ui.examples.multipageeditor.MultiPageContributor" >
- </editor>
- </extension>
-</plugin>
diff --git a/examples/org.eclipse.ui.examples.propertysheet/.classpath b/examples/org.eclipse.ui.examples.propertysheet/.classpath
deleted file mode 100644
index 912219c..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="Eclipse UI Examples PropertySheet"/>
- <classpathentry kind="src" path="/org.eclipse.ui"/>
- <classpathentry kind="src" path="/org.eclipse.swt"/>
- <classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/examples/org.eclipse.ui.examples.propertysheet/.cvsignore b/examples/org.eclipse.ui.examples.propertysheet/.cvsignore
deleted file mode 100644
index c5e82d7..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
\ No newline at end of file
diff --git a/examples/org.eclipse.ui.examples.propertysheet/.project b/examples/org.eclipse.ui.examples.propertysheet/.project
deleted file mode 100644
index 1fab398..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/.project
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.examples.propertysheet</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.swt</project>
- <project>org.eclipse.ui</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Address.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Address.java
deleted file mode 100644
index 0cd1806..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Address.java
+++ /dev/null
@@ -1,323 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Vector;
-
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.ui.views.properties.*;
-
-/**
- * Example IPropertySource who itself is NOT editable, but whose children are.
- * The values of the children determine the value of the address.
- */
-public class Address implements IPropertySource {
-
- //properties
- private String city;
- private Integer province;
- private String postalCode;
- private StreetAddress street;
-
- //Property unique keys
- public static final String P_ID_STREET = "Address.Street"; //$NON-NLS-1$
- public static final String P_ID_CITY = "Address.City"; //$NON-NLS-1$
- public static final String P_ID_PROVINCE = "Address.Province"; //$NON-NLS-1$
- public static final String P_ID_POSTALCODE = "Address.PostalCode"; //$NON-NLS-1$
-
- //Property display keys
- public static final String P_STREET = MessageUtil.getString("Street"); //$NON-NLS-1$
- public static final String P_CITY = MessageUtil.getString("City"); //$NON-NLS-1$
- public static final String P_PROVINCE = MessageUtil.getString("Province"); //$NON-NLS-1$
- public static final String P_POSTALCODE = MessageUtil.getString("PostalCode"); //$NON-NLS-1$
- public static final String P_DESCRIPTORS = "properties"; //$NON-NLS-1$
-
-
- //default values
- private static final StreetAddress STREET_DEFAULT = new StreetAddress();
- private static final String CITY_DEFAULT = MessageUtil.getString("unspecified_city"); //$NON-NLS-1$
- private static final Integer PROVINCE_DEFAULT = new Integer(0);
- private static final String POSTALCODE_DEFAULT = "A1B2C3"; //$NON-NLS-1$
-
- //
- static private class ProvinceLabelProvider extends LabelProvider {
- public String getText(Object element) {
- String[] provinceValues = new String[] {MessageUtil.getString("British_Columbia"), MessageUtil.getString("Alberta"), MessageUtil.getString("Saskatchewan"), MessageUtil.getString("Manitoba"), MessageUtil.getString("Ontario"), MessageUtil.getString("Quebec"), MessageUtil.getString("Newfoundland"), MessageUtil.getString("Prince_Edward_Island"), MessageUtil.getString("Nova_Scotia"), MessageUtil.getString("New_Brunswick"), MessageUtil.getString("Yukon"), MessageUtil.getString("North_West_Territories"), MessageUtil.getString("Nunavut")}; //$NON-NLS-13$ //$NON-NLS-12$ //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- return provinceValues[((Integer)element).intValue()];
- }
- }
-
- //
- private static Vector descriptors;
- private static String[] provinceValues;
- static {
- descriptors = new Vector();
- provinceValues = new String[] {MessageUtil.getString("British_Columbia"), MessageUtil.getString("Alberta"), MessageUtil.getString("Saskatchewan"), MessageUtil.getString("Manitoba"), MessageUtil.getString("Ontario"), MessageUtil.getString("Quebec"), MessageUtil.getString("Newfoundland"), MessageUtil.getString("Prince_Edward_Island"), MessageUtil.getString("Nova_Scotia"), MessageUtil.getString("New_Brunswick"), MessageUtil.getString("Yukon"), MessageUtil.getString("North_West_Territories"), MessageUtil.getString("Nunavut")}; //$NON-NLS-13$ //$NON-NLS-12$ //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- descriptors.addElement(new PropertyDescriptor(P_ID_STREET, P_STREET));
- descriptors.addElement(new TextPropertyDescriptor(P_ID_CITY, P_CITY));
-
-
- //PostalCode
- PropertyDescriptor propertyDescriptor = new TextPropertyDescriptor(P_ID_POSTALCODE, P_POSTALCODE);
- //add custom validator to propertyDescriptor limiting postalcode
- //values to XYXYXY, where X is a letter and Y is a digit
- propertyDescriptor.setValidator(new ICellEditorValidator() {
- public String isValid(Object value) {
- if (value == null)
- return MessageUtil.getString("postal_code_is_incomplete"); //$NON-NLS-1$
-
- //
- String testPostalCode = ((String) value).toUpperCase();
- final int length = testPostalCode.length();
- final char space = ' ';
-
- //removes white space
- StringBuffer postalCodeBuffer = new StringBuffer(6);
- char current;
- for (int i = 0; i < length; i++) {
- current = testPostalCode.charAt(i);
- if (current != space)
- postalCodeBuffer.append(current);
- }
- testPostalCode = postalCodeBuffer.toString();
-
- //check for proper length
- if (testPostalCode.length() != 6) {
- return MessageUtil.getString("postal_code_is_incomplete"); //$NON-NLS-1$
- }
-
- //check for proper format
- if (
- testPostalCode.charAt(1) < '0' || testPostalCode.charAt(1) > '9' ||
- testPostalCode.charAt(3) < '0' || testPostalCode.charAt(3) > '9' ||
- testPostalCode.charAt(5) < '0' || testPostalCode.charAt(5) > '9' ||
- testPostalCode.charAt(0) < 'A' || testPostalCode.charAt(0) > 'Z' ||
- testPostalCode.charAt(2) < 'A' || testPostalCode.charAt(2) > 'Z' ||
- testPostalCode.charAt(4) < 'A' || testPostalCode.charAt(4) > 'Z'
- ) {
- //fail
- return MessageUtil.format("_is_an_invalid_format_for_a_postal_code", new Object[] {testPostalCode}); //$NON-NLS-1$
- }
-
- //all pass
- return null;
- }
- });
- descriptors.addElement(propertyDescriptor);
-
- //
- ComboBoxPropertyDescriptor desc = new ComboBoxPropertyDescriptor(P_ID_PROVINCE, P_PROVINCE, provinceValues);
- desc.setLabelProvider(new ProvinceLabelProvider());
- descriptors.addElement(desc);
- }
-/**
- * Address Default Constructor
- */
-Address() {
- super();
-}
-/**
- * Creates a new address.
- *
- * @param street the street
- * @param city the city
- * @param province the province
- * @param postalCode has the form XYXYXY: where X is a letter and Y is a digit
- * @exception IllegalArgumentException, if postalcode not in above form
- */
-public Address(StreetAddress street, String city, Integer province, String postalCode) {
- super();
- setStreet(street);
- setCity(city);
- setPostalCode(postalCode);
- setProvince(province);
-}
-/**
- * Returns the city
- */
-private String getCity() {
- if(city == null)
- city = CITY_DEFAULT;
- return city;
-}
-/*
- * Standard Accessor
- */
-private static Vector getDescriptors() {
- return descriptors;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public Object getEditableValue() {
- return this.toString();
-}
-/**
- * Returns the postal code
- */
-private String getPostalCode() {
- if(postalCode == null)
- postalCode = POSTALCODE_DEFAULT;
- return postalCode;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public IPropertyDescriptor[] getPropertyDescriptors() {
- return (IPropertyDescriptor[])getDescriptors().toArray(new IPropertyDescriptor[getDescriptors().size()]);
-}
-/**
- * The <code>Address</code> implementation of this
- * <code>IPropertySource</code> method returns the following properties
- *
- * 1) P_CITY returns java.lang.String
- * 2) P_POSTALCODE returns java.lang.String
- * 3) P_PROVINCE returns java.lang.String
- * 4) P_STREET returns StreetAddress
- */
-public Object getPropertyValue(Object propKey) {
- if (propKey.equals(P_ID_PROVINCE))
- return getProvince();
- if (propKey.equals(P_ID_STREET))
- return getStreet();
- if (propKey.equals(P_ID_CITY))
- return getCity();
- if (propKey.equals(P_ID_POSTALCODE))
- return getPostalCode();
- return null;
-}
-/**
- * Returns the province
- */
-private Integer getProvince() {
- if(province == null)
- province = PROVINCE_DEFAULT;
- return province;
-}
-/**
- * Returns the street
- */
-public StreetAddress getStreet() {
- if(street == null)
- street = new StreetAddress();
- return street;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public boolean isPropertySet(Object property) {
- if (property.equals(P_ID_PROVINCE))
- return getProvince() != PROVINCE_DEFAULT;
- if (property.equals(P_ID_STREET))
- return !STREET_DEFAULT.equals(getStreet());
- if (property.equals(P_ID_CITY))
- return getCity() != CITY_DEFAULT;
- if (property.equals(P_ID_POSTALCODE))
- return getPostalCode() != POSTALCODE_DEFAULT;
- return false;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public void resetPropertyValue(Object property) {
- if (P_ID_POSTALCODE.equals(property)) {
- setPostalCode(POSTALCODE_DEFAULT);
- return;
- }
- if (P_ID_CITY.equals(property)) {
- setCity(CITY_DEFAULT);
- return;
- }
- if (P_ID_PROVINCE.equals(property)) {
- setProvince(PROVINCE_DEFAULT);
- return;
- };
- if (P_ID_STREET.equals(property)) {
- setStreet(new StreetAddress());
- return;
- }
-}
-/**
- * Sets the city
- */
-private void setCity(String newCity) {
- city = newCity;
-}
-/**
- * Sets the postal code
- */
-private void setPostalCode(String newPostalCode) {
- //validation in ICellEditorValidator registered in PropertyDescriptor
- this.postalCode = newPostalCode.toUpperCase();
-}
-/**
- * The <code>Address</code> implementation of this
- * <code>IPropertySource</code> method
- * defines the following Setable properties
- *
- * 1) P_CITY expects java.lang.String
- * 2) P_POSTALCODE expects java.lang.String
- * 3) P_PROVINCE expects java.lang.String
- *
- * <p>P_ID_STREET is not set here since it is referenced
- * and set directly in StreetAddress.
- * According to IPropertySource, StreetAddress.getEditableValue
- * should return a String which will be passed to this method
- * as the value. A new StreetAddress object should then be
- * created from the string.
- * An alternative would be to return the StreetAddress
- * directly in StreetAddress.getEditableValue and define a
- * cell editor for the StreetAddress property.
- * This was ommitted for the sake of simplicity.
- */
-public void setPropertyValue(Object name, Object value) {
- if (P_ID_POSTALCODE.equals(name)) {
- setPostalCode((String) value);
- return;
- }
- if (P_ID_CITY.equals(name)) {
- setCity((String) value);
- return;
- }
- if (P_ID_PROVINCE.equals(name)) {
- setProvince((Integer) value);
- return;
- }
-}
-/**
- * Sets the province
- */
-private void setProvince(Integer newProvince) {
- province = newProvince;
-}
-/**
- * Sets the street
- */
-private void setStreet(StreetAddress newStreet) {
- street = newStreet;
-}
-/**
- * The value as displayed in the Property Sheet.
- * @return java.lang.String
- */
-public String toString() {
- StringBuffer outStringBuffer = new StringBuffer();
- final String comma_space = ", "; //$NON-NLS-1$
- final String space = " "; //$NON-NLS-1$
- if (!getStreet().equals(STREET_DEFAULT)) {
- outStringBuffer.append(getStreet());
- outStringBuffer.append(comma_space);
- }
-
- outStringBuffer.append(getCity());
- outStringBuffer.append(space);
- outStringBuffer.append(provinceValues[getProvince().intValue()]);
- outStringBuffer.append(comma_space);
- outStringBuffer.append(getPostalCode());
-
- return outStringBuffer.toString();
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Birthday.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Birthday.java
deleted file mode 100644
index 2ef84b5..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Birthday.java
+++ /dev/null
@@ -1,232 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.*;
-
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.ui.views.properties.*;
-
-/**
- * Example IPropertySource who itself is NOT editable, but whose children are.
- * The values of the children determine the value of the birthday.
- */
-public class Birthday implements IPropertySource {
-
- //Properties
- private Integer day, month, year;
-
- //Property unique keys
- public static final String P_ID_DAY = "Birthday.day"; //$NON-NLS-1$
- public static final String P_ID_MONTH = "Birthday.month"; //$NON-NLS-1$
- public static final String P_ID_YEAR = "Birthday.year"; //$NON-NLS-1$
-
- //Property display keys
- public static final String P_DAY = MessageUtil.getString("day"); //$NON-NLS-1$
- public static final String P_MONTH = MessageUtil.getString("month"); //$NON-NLS-1$
- public static final String P_YEAR = MessageUtil.getString("year"); //$NON-NLS-1$
-
- //default values
- private static final Integer DAY_DEFAULT = new Integer(1);
- private static final Integer MONTH_DEFAULT = new Integer(1);
- private static final Integer YEAR_DEFAULT = new Integer(2000);
-
- //static date formater
- private static final DateFormat formatter = new SimpleDateFormat("EEEE, MMMM d, yyyy"); //$NON-NLS-1$
-
- static private class DayLabelProvider extends LabelProvider {
- public String getText(Object element) {
- String[] dayValues = new String[] {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"}; //$NON-NLS-31$ //$NON-NLS-30$ //$NON-NLS-29$ //$NON-NLS-28$ //$NON-NLS-27$ //$NON-NLS-26$ //$NON-NLS-25$ //$NON-NLS-24$ //$NON-NLS-23$ //$NON-NLS-22$ //$NON-NLS-21$ //$NON-NLS-20$ //$NON-NLS-19$ //$NON-NLS-18$ //$NON-NLS-17$ //$NON-NLS-16$ //$NON-NLS-15$ //$NON-NLS-14$ //$NON-NLS-13$ //$NON-NLS-12$ //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- return dayValues[((Integer)element).intValue()];
- }
- }
-
- static private class MonthLabelProvider extends LabelProvider {
- public String getText(Object element) {
- String[] monthValues = new String[] {MessageUtil.getString("January"), MessageUtil.getString("February"), MessageUtil.getString("March"), MessageUtil.getString("April"), MessageUtil.getString("May"), MessageUtil.getString("June"), MessageUtil.getString("July"), MessageUtil.getString("August"), MessageUtil.getString("September"), MessageUtil.getString("October"), MessageUtil.getString("November"), MessageUtil.getString("December")}; //$NON-NLS-12$ //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- return monthValues[((Integer)element).intValue()];
- }
- }
-
- //
- private static Vector descriptors;
- static {
- descriptors = new Vector();
-
- ///
- String[] dayValues = new String[] {"1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31"}; //$NON-NLS-31$ //$NON-NLS-30$ //$NON-NLS-29$ //$NON-NLS-28$ //$NON-NLS-27$ //$NON-NLS-26$ //$NON-NLS-25$ //$NON-NLS-24$ //$NON-NLS-23$ //$NON-NLS-22$ //$NON-NLS-21$ //$NON-NLS-20$ //$NON-NLS-19$ //$NON-NLS-18$ //$NON-NLS-17$ //$NON-NLS-16$ //$NON-NLS-15$ //$NON-NLS-14$ //$NON-NLS-13$ //$NON-NLS-12$ //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- ComboBoxPropertyDescriptor days = new ComboBoxPropertyDescriptor(P_ID_DAY, P_DAY, dayValues);
- days.setLabelProvider(new DayLabelProvider());
- descriptors.addElement(days);
-
- ///
- String[] monthValues = new String[] {MessageUtil.getString("January"), MessageUtil.getString("February"), MessageUtil.getString("March"), MessageUtil.getString("April"), MessageUtil.getString("May"), MessageUtil.getString("June"), MessageUtil.getString("July"), MessageUtil.getString("August"), MessageUtil.getString("September"), MessageUtil.getString("October"), MessageUtil.getString("November"), MessageUtil.getString("December")}; //$NON-NLS-12$ //$NON-NLS-11$ //$NON-NLS-10$ //$NON-NLS-9$ //$NON-NLS-8$ //$NON-NLS-7$ //$NON-NLS-6$ //$NON-NLS-5$ //$NON-NLS-4$ //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- ComboBoxPropertyDescriptor months = new ComboBoxPropertyDescriptor(P_ID_MONTH, P_MONTH, monthValues);
- months.setLabelProvider(new MonthLabelProvider());
- descriptors.addElement(months);
-
- ///
- descriptors.addElement(new TextPropertyDescriptor(P_ID_YEAR, P_YEAR));
- }
-/**
- * Address Default Constructor
- */
-Birthday() {
- super();
-}
-/**
- * Convenience Address Constructor
- */
-public Birthday(int day, int month, int year) {
- super();
- setDay(new Integer(day));
- setMonth(new Integer(month));
- setYear(new Integer(year));
-}
-/**
- * Returns the day
- */
-private Integer getDay() {
- if(day == null)
- day = DAY_DEFAULT;
- return day;
-}
-/**
- * Standard Accessor
- */
-private static Vector getDescriptors() {
- return descriptors;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public Object getEditableValue() {
- return this.toString();
-}
-/**
- * Returns the month
- */
-private Integer getMonth() {
- if(month == null)
- month = MONTH_DEFAULT;
- return month;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public IPropertyDescriptor[] getPropertyDescriptors() {
- return (IPropertyDescriptor[])getDescriptors().toArray(new IPropertyDescriptor[getDescriptors().size()]);
-}
-/**
- * The <code>Birthday</code> implementation of this
- * <code>IPropertySource</code> method returns the following properties
- *
- * 1) P_DAY returns java.lang.Integer
- * 2) P_MONTH returns java.lang.Integer
- * 3) P_YEAR returns java.lang.Integer
- * 4) P_STREET returns java.lang.String
- */
-public Object getPropertyValue(Object propKey) {
- if (propKey.equals(P_ID_DAY))
- return new Integer(getDay().intValue() - 1);
- if (propKey.equals(P_ID_MONTH))
- return new Integer(getMonth().intValue() - 1);
- if (propKey.equals(P_ID_YEAR))
- return getYear().toString();
- return null;
-}
-/**
- * Returns the year
- */
-private Integer getYear() {
- if(year == null)
- year = YEAR_DEFAULT;
- return year;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public boolean isPropertySet(Object property) {
- if (P_ID_DAY.equals(property))
- return getDay() != DAY_DEFAULT;
- if (P_ID_MONTH.equals(property))
- return getMonth() != MONTH_DEFAULT;
- if (P_ID_YEAR.equals(property))
- return getYear() != YEAR_DEFAULT;
- return false;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public void resetPropertyValue(Object property) {
- if (P_ID_DAY.equals(property)) {
- setDay(DAY_DEFAULT);
- return;
- }
- if (P_ID_MONTH.equals(property)) {
- setMonth(MONTH_DEFAULT);
- return;
- }
- if (P_ID_YEAR.equals(property)) {
- setYear(YEAR_DEFAULT);
- return;
- };
-}
-/**
- * Sets the day
- */
-private void setDay(Integer newDay) {
- day = newDay;
-}
-/**
- * Sets the month
- */
-private void setMonth(Integer newMonth) {
- month = newMonth;
-}
-/**
- * The <code>Birthday</code> implementation of this
- * <code>IPropertySource</code> method
- * defines the following Setable properties
- *
- * 1) P_DAY expects java.lang.Integer
- * 2) P_MONTH expects java.lang.Integer
- * 3) P_YEAR expects java.lang.Integer
- */
-public void setPropertyValue(Object name, Object value) {
- if (P_ID_DAY.equals(name)) {
- setDay(new Integer(((Integer)value).intValue() + 1));
- return;
- }
- if (P_ID_MONTH.equals(name)) {
- setMonth(new Integer(((Integer)value).intValue() + 1));
- return;
- }
- if (P_ID_YEAR.equals(name)) {
- try {
- setYear(new Integer((String)value));
- } catch (NumberFormatException e) {
- setYear(YEAR_DEFAULT);
- }
- return;
- }
-}
-/**
- * Sets the year
- */
-private void setYear(Integer newYear) {
- year = newYear;
-}
-/**
- * The value as displayed in the Property Sheet.
- * @return java.lang.String
- */
-public String toString() {
- Date bday =(new GregorianCalendar(getYear().intValue(), getMonth().intValue() - 1, getDay().intValue())).getTime();
- return formatter.format(bday);
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddress.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddress.java
deleted file mode 100644
index f219f52..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddress.java
+++ /dev/null
@@ -1,181 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Vector;
-
-import org.eclipse.ui.views.properties.*;
-
-/**
- * Example IPropertySource is editable and whose childern properties are itself not editable.
- * The values of "userid" and "mailserver" are parsed from setting "email"
- */
-public class EmailAddress implements IPropertySource {
-
- //Property-Value
- private String userid;
- private String domain;
-
- //Default Property-Value
- private static final String USERID_DEFAULT = MessageUtil.getString("unknownUser"); //$NON-NLS-1$
- private static final String DOMAIN_DEFAULT = MessageUtil.getString("unknownDomain"); //$NON-NLS-1$
-
- //Property unique keys
- public static final String P_ID_USERID = "EmailAddress.userid"; //$NON-NLS-1$
- public static final String P_ID_DOMAIN = "EmailAddress.domain"; //$NON-NLS-1$
-
- //Property display keys
- public static final String P_USERID = MessageUtil.getString("userid"); //$NON-NLS-1$
- public static final String P_DOMAIN = MessageUtil.getString("domain"); //$NON-NLS-1$
-
- //Property-Descriptors
- private static Vector descriptors;
-
- static{
- descriptors = new Vector(2,2);
- //non-editable child properties --> provide no editors
- descriptors.addElement(new PropertyDescriptor(P_ID_USERID, P_USERID));
- descriptors.addElement(new PropertyDescriptor(P_ID_DOMAIN, P_DOMAIN));
- }
-/**
- * EmailAddress Default Constructor
- */
-public EmailAddress() {
- super();
-}
-/**
- * Convience EmailAddress constructor.
- * Calls setEmailAddress() to parse emailAddress
- * @param emailAddress java.lang.String, in the form userid@domain
- * @throws java.lang.IllegalArgumentException, if does not subscribe to form
- */
-public EmailAddress(String emailAddress) throws IllegalArgumentException{
- super();
- setEmailAddress(emailAddress);
-
-}
-/**
- * Returns the descriptors
- */
-private static Vector getDescriptors() {
- return descriptors;
-}
-/**
- * Returns the domain
- */
-private String getDomain() {
- if(domain == null)
- domain = DOMAIN_DEFAULT;
- return domain;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public Object getEditableValue() {
- return this.toString();
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public IPropertyDescriptor[] getPropertyDescriptors() {
- return (IPropertyDescriptor[])getDescriptors().toArray(new IPropertyDescriptor[getDescriptors().size()]);
-}
-/**
- * The <code>EmailAddress</code> implementation of this
- * <code>IPropertySource</code> method returns the following properties
- *
- * 1) P_USERID returns String, values before "@"
- * 2) P_DOMAIN returns String, values after "@"
- *
- * Observe the available properties must always equal those listed
- * in the property descriptors
- */
-public Object getPropertyValue(Object propKey) {
- if (propKey.equals(P_ID_USERID))
- return getUserid();
- if (propKey.equals(P_ID_DOMAIN))
- return getDomain();
- return null;
-}
-/**
- * Returns the userid
- */
-private String getUserid() {
- if(userid == null)
- userid = USERID_DEFAULT;
- return userid;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public boolean isPropertySet(Object property) {
- return false;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public void resetPropertyValue(Object property) {
- return;
-}
-/**
- * Sets the domain
- */
-private void setDomain(java.lang.String newDomain) {
- domain = newDomain;
-}
-/**
- * Parses emailAddress into domain and userid. Throws SetPropertyVetoException
- * if emailAddress does not contain an userid and domain seperated by '@'.
- *
- * @param emailAddress the email address
- * @throws IllegalArgumentException
- */
-private void setEmailAddress(String emailAddress) throws IllegalArgumentException {
- if(emailAddress == null)
- throw new IllegalArgumentException(MessageUtil.getString("emailaddress_cannot_be_set_to_null")); //$NON-NLS-1$
- int index = emailAddress.indexOf('@');
- int length = emailAddress.length();
- if (index > 0 && index < length) {
- setUserid(emailAddress.substring(0, index));
- setDomain(emailAddress.substring(index + 1));
- return;
- }
- throw new IllegalArgumentException(MessageUtil.getString("invalid_email_address_format_should_have_been_validated")); //$NON-NLS-1$
-}
-/**
- * The <code>Address</code> implementation of this
- * <code>IPropertySource</code> method
- * defines the following Setable properties
- *
- * 1) P_USERID, expects String
- * 2) P_DOMAIN, expects String
- */
-public void setPropertyValue(Object name, Object value) {
- if (name.equals(P_ID_USERID)) {
- setUserid((String) value);
- return;
- }
- if (name.equals(P_ID_DOMAIN)) {
- setDomain((String) value);
- return;
- }
-}
-/**
- * Sets the userid
- */
-private void setUserid(String newUserid) {
- userid = newUserid;
-}
-/**
- * The value as displayed in the Property Sheet.
- * @return java.lang.String
- */
-public String toString() {
- StringBuffer strbuffer = new StringBuffer(getUserid());
- strbuffer.append('@');
- strbuffer.append(getDomain());
- return strbuffer.toString();
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddressValidator.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddressValidator.java
deleted file mode 100644
index f91d8c6..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddressValidator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.viewers.ICellEditorValidator;
-/**
- * Validator for email addresses
- */
-public class EmailAddressValidator implements ICellEditorValidator {
-/**
- * The <code>EmailAddressValidator</code> implementation of this
- * <code>ICellEditorValidator</code> method
- * determines if the value is a valid email address.
- * (check to see if it is non-null and contains an @)
- */
-public String isValid(Object value) {
- if (value == null) {
- return MessageUtil.getString("email_address_is_incomplete"); //$NON-NLS-1$
- }
- String emailAddress = (String)value;
- int index = emailAddress.indexOf('@');
- int length = emailAddress.length();
- if (index > 0 && index < length) {
- return null;
- }
- return MessageUtil.getString("email_address_does_not_have_a_valid_format"); //$NON-NLS-1$
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/GroupElement.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/GroupElement.java
deleted file mode 100644
index 4ac0544..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/GroupElement.java
+++ /dev/null
@@ -1,139 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Vector;
-
-/**
- * A Group Element
- */
-public class GroupElement extends OrganizationElement {
- public static String P_USERS = "users"; //$NON-NLS-1$
- public static String P_SUBGROUPS = "subgroups"; //$NON-NLS-1$
- public static String P_CONTENTS = "contents"; //$NON-NLS-1$
- private Vector subGroups;
- private Vector users;
- // must be synchronized to contain both the references of subGroups and users
- private Vector contents;
-/**
- * Constructor.
- * Creates a new GroupElement within the passed parent GroupElement,
- * gives it the passed name property, sets Icon.
- *
- * @param name the name
- * @param parent the parent
- */
-public GroupElement(String name, GroupElement parent) {
- super(name, parent);
-}
-/**
- * Adds an OrganizationElement to this GroupElement.
- *
- * @param userGroup The Organization Element
- */
-public void add(OrganizationElement userGroup) {
- if (userGroup.isUser() || userGroup.isGroup()) {
- getContents().add(userGroup);
- }
- if (userGroup.isGroup()) {
- getSubGroups().add(userGroup);
- // synchronizes backpointer of userGroup: defensive
- userGroup.setParent(this);
- }
- if (userGroup.isUser()) {
- getUsers().add(userGroup);
- // synchronizes backpointer of userGroup: defensive
- userGroup.setParent(this);
- }
-
-}
-/**
- * Creates a new <code>GroupElement</code>
- * nested in this <code>GroupElement<code>
- *
- * @param name the name of the sub group
- */
-public GroupElement createSubGroup(String name) {
- GroupElement newGroup = new GroupElement(name, this);
- add(newGroup);
- return newGroup;
-}
-/**
- * Creates a new <code>UserElement</code>
- *
- * @param the name of the user element
- */
-public UserElement createUser(String name) {
- UserElement newUser = new UserElement(name, this);
- add(newUser);
- return newUser;
-}
-/**
- * Deletes an OrganizationElement from this GroupElement.
- *
- * @param userGroup the Organization Element
- */
-public void delete(OrganizationElement userGroup) {
- if (userGroup.isUser() || userGroup.isGroup()) {
- getContents().remove(userGroup);
- }
- if (userGroup.isGroup()) {
- getSubGroups().remove(userGroup);
- // synchronizes backpointer of userGroup: defensive
- }
- if (userGroup.isUser()) {
- getUsers().remove(userGroup);
- // synchronizes backpointer of userGroup: defensive
- }
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchAdapter
- */
-public Object[] getChildren(Object o) {
- return getContents().toArray();
-}
-/**
- * Returns the content
- */
-private Vector getContents() {
- if (contents == null)
- contents = new Vector();
- return contents;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public Object getEditableValue() {
- return this.toString();
-}
-/**
- * Returns the error message
- */
-public String getErrorMessage() {
- return null;
-}
-/**
- * Returns the subgroups
- */
-private Vector getSubGroups() {
- if (subGroups == null)
- subGroups = new Vector();
- return subGroups;
-}
-/**
- * Returns the users
- */
-private Vector getUsers() {
- if (users == null)
- users = new Vector();
- return users;
-}
-/* (non-Javadoc)
- * Method declared on OrganizationElement
- */
-public boolean isGroup() {
- return true;
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/IUserConstants.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/IUserConstants.java
deleted file mode 100644
index 6484841..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/IUserConstants.java
+++ /dev/null
@@ -1,17 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * This interface contains constants for use only within the
- * property sheet example.
- */
-public interface IUserConstants {
- public static final String PLUGIN_ID = "org.eclipse.ui.examples.propertysheet"; //$NON-NLS-1$
- public static final String PREFIX = PLUGIN_ID + "."; //$NON-NLS-1$
- public static final String P_CONTENT_OUTLINE = PREFIX + "content_outline"; //$NON-NLS-1$
- public static final String EXTENSION = "usr"; //$NON-NLS-1$
- public static final String ATT_CLASS = "class"; //$NON-NLS-1$
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/MessageUtil.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/MessageUtil.java
deleted file mode 100644
index 034b0ce..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/MessageUtil.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.examples.propertysheet;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps with managing messages.
- */
-/* package */ class MessageUtil {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.examples.propertysheet.messages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private MessageUtil() {
- }
-
- /**
- * Returns the formatted message for the given key in
- * the resource bundle.
- *
- * @param key the resource name
- * @param args the message arguments
- * @return the string
- */
- public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key),args);
- }
-
- /**
- * Returns the resource object with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the key is returned, surrounded by '!'s.
- *
- * @param key the resource name
- * @return the string
- */
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Name.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Name.java
deleted file mode 100644
index f3acba1..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Name.java
+++ /dev/null
@@ -1,215 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Vector;
-
-import org.eclipse.ui.views.properties.*;
-
-/**
- * Example IPropertySource whose value as well as its children are editable.
- */
-public class Name implements IPropertySource
-{
- private String firstName = ""; //$NON-NLS-1$
- private String lastName = ""; //$NON-NLS-1$
- private String initial = ""; //$NON-NLS-1$
-
- // property unique keys
- public static String P_ID_FIRSTNAME = "Name.FirstName"; //$NON-NLS-1$
- public static String P_ID_LASTNAME = "Name.LastName"; //$NON-NLS-1$
- public static String P_ID_MIDDLENAME = "Name.Middle"; //$NON-NLS-1$
-
- // property display keys
- public static String P_FIRSTNAME = MessageUtil.getString("FirstName"); //$NON-NLS-1$
- public static String P_LASTNAME = MessageUtil.getString("LastName"); //$NON-NLS-1$
- public static String P_MIDDLENAME = MessageUtil.getString("Middle"); //$NON-NLS-1$
-
- // default values
- //
- private static final String FIRSTNAME_DEFAULT = null;
- private static final String LASTNAME_DEFAULT = null;
- private static final String MIDDLENAME_DEFAULT = null;
-
- public static final String P_DESCRIPTORS = "properties"; //$NON-NLS-1$
- static private Vector descriptors;
- static
- {
- descriptors = new Vector();
- descriptors.addElement(new TextPropertyDescriptor(P_ID_FIRSTNAME, P_FIRSTNAME));
- descriptors.addElement(new TextPropertyDescriptor(P_ID_LASTNAME, P_LASTNAME));
- descriptors.addElement(new TextPropertyDescriptor(P_ID_MIDDLENAME, P_MIDDLENAME));
- }
-/**
- * Creates a new Name.
- * @param name String in the form "firstname initial lastname"
- */
-public Name(String name) {
- int index1, index2, length;
- index1 = name.indexOf(' ');
- if (index1 < 0)
- index1 = name.length();
- index2 = name.lastIndexOf(' ');
- length = name.length();
- if (index2 > 0)
- lastName = name.substring(index2 + 1);
- firstName = name.substring(0, index1);
- if (index1 < index2)
- initial = name.substring(index1 + 1, index2);
-}
-/**
- * Returns the descriptors
- */
-private static Vector getDescriptors() {
- return descriptors;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public Object getEditableValue() {
- return this.toString();
-}
-/**
- * Returns the first name
- */
-private String getFirstName()
-{
- return firstName;
-}
-/**
- * Returns the initial
- */
-private String getInitial()
-{
- return initial;
-}
-/**
- * Returns the last name
- */
-private String getLastName()
-{
- return lastName;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public IPropertyDescriptor[] getPropertyDescriptors() {
- return (IPropertyDescriptor[])getDescriptors().toArray(new IPropertyDescriptor[getDescriptors().size()]);
-}
-/**
- * The <code>Name</code> implementation of this
- * <code>IPropertySource</code> method returns the following properties
- *
- * 1) P_FIRSTNAME returns String, firstname
- * 2) P_LASTNAME returns String, lastname
- * 3) P_MIDDLENAME returns String, middle
- */
-public Object getPropertyValue(Object propKey) {
- if (P_ID_FIRSTNAME.equals(propKey))
- return getFirstName();
- if (P_ID_LASTNAME.equals(propKey))
- return getLastName();
- if (P_ID_MIDDLENAME.equals(propKey))
- return getInitial();
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public boolean isPropertySet(Object key) {
- if (key.equals(P_ID_FIRSTNAME))
- return getFirstName() != FIRSTNAME_DEFAULT;
- if (key.equals(P_ID_LASTNAME))
- return getLastName() != LASTNAME_DEFAULT;
- if (key.equals(P_ID_MIDDLENAME))
- return getInitial() != MIDDLENAME_DEFAULT;
- return false;
-}
-/**
- * Implemented as part of IPropertySource framework. Sets the specified property
- * to its default value.
- *
- * @see IPropertySource#resetPropertyValue(Object)
- * @param property The property to reset.
- */
-public void resetPropertyValue(Object property) {
- if (P_ID_FIRSTNAME.equals(property)) {
- setFirstName(FIRSTNAME_DEFAULT);
- return;
- }
- if (P_ID_LASTNAME.equals(property)) {
- setLastName(LASTNAME_DEFAULT);
- return;
- }
- if (P_ID_MIDDLENAME.equals(property)) {
- setInitial(MIDDLENAME_DEFAULT);
- return;
- }
-}
-/**
- * Sets the first name
- */
-private void setFirstName(String newFirstName)
-{
- firstName = newFirstName;
-}
-/**
- * Sets the initial
- */
-private void setInitial(String newInitial)
-{
- initial = newInitial;
-}
-/**
- * Sets the last name
- */
-private void setLastName(String newLastName)
-{
- lastName = newLastName;
-}
-/**
- * The <code>Name</code> implementation of this
- * <code>IPropertySource</code> method
- * defines the following Setable properties
- *
- * 1) P_FIRST, expects String, sets the firstname of this OrganizationElement
- * 2) P_MIDDLENAME, expects String, sets middlename of this OrganizationElement
- * 3) P_LASTNAME, expects String, sets lastname of this OrganizationElement
- */
-public void setPropertyValue(Object propName, Object val) {
- if (P_ID_FIRSTNAME.equals(propName)) {
- setFirstName((String) val);
- return;
- }
- if (P_ID_LASTNAME.equals(propName)) {
- setLastName((String) val);
- return;
- }
- if (P_ID_MIDDLENAME.equals(propName)) {
- setInitial((String) val);
- return;
- }
-}
-/**
- * The value as displayed in the Property Sheet. Will not print default values
- * @return java.lang.String
- */
-public String toString(){
- StringBuffer outStringBuffer = new StringBuffer();
- if(getFirstName()!=FIRSTNAME_DEFAULT) {
- outStringBuffer.append(getFirstName());
- outStringBuffer.append(" "); //$NON-NLS-1$
- }
- if(getInitial()!=MIDDLENAME_DEFAULT) {
- outStringBuffer.append(getInitial());
- outStringBuffer.append(" "); //$NON-NLS-1$
- }
- if(getLastName()!=LASTNAME_DEFAULT) {
- outStringBuffer.append(getLastName());
- }
-
- return outStringBuffer.toString();
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/OrganizationElement.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/OrganizationElement.java
deleted file mode 100644
index b0195d1..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/OrganizationElement.java
+++ /dev/null
@@ -1,173 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.views.properties.*;
-
-/**
- * An Organization Element
- */
-public abstract class OrganizationElement implements IAdaptable, IPropertySource, IWorkbenchAdapter {
- //
- private GroupElement parent;
- private String name;
- private ImageDescriptor imageDescriptor;
-
- //
- private static Vector descriptors;
- static {
- descriptors = new Vector();
- PropertyDescriptor name = new TextPropertyDescriptor(IBasicPropertyConstants.P_TEXT, MessageUtil.getString("name")); //$NON-NLS-1$
- descriptors.addElement(name);
- }
-/**
- * Constructor.
- * Creates a new OrganizationElement within the passed parent GroupElement,
- *
- * @param name the name
- * @param parent the parent
- */
-OrganizationElement(String name, GroupElement parent) {
- this.name = name;
- this.parent = parent;
-}
-/**
- * Deletes this OrganizationElement from its parentGroup
- */
-public void delete()
-{ parent.delete(this);
-}
-/* (non-Javadoc)
- * Method declared on IAdaptable
- */
-public Object getAdapter(Class adapter) {
- if (adapter == IPropertySource.class) {
- return this;
- }
- if (adapter == IWorkbenchAdapter.class) {
- return this;
- }
- return null;
-}
-/**
- * Returns the descriptors
- */
-static Vector getDescriptors()
-{
- return descriptors;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public Object getEditableValue() {
- return this;
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchAdapter
- */
-public ImageDescriptor getImageDescriptor(Object object) {
- return imageDescriptor;
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchAdapter
- */
-public String getLabel(Object o) {
- return getName();
-}
-/**
- * Returns the name
- */
-String getName()
-{
- return name;
-}
-/**
- * Returns the parent
- */
-public Object getParent(Object o)
-{
- return parent;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public IPropertyDescriptor[] getPropertyDescriptors()
-{ return (IPropertyDescriptor[])getDescriptors().toArray(new IPropertyDescriptor[getDescriptors().size()]);
-}
-/**
- * The <code>OrganizationElement</code> implementation of this
- * <code>IPropertySource</code> method returns the following properties
- *
- * 1) P_NAME returns String, name of this element
- * this property key is defined in <code>IBasicPropertyConstants</code>
- */
-public Object getPropertyValue(Object propKey)
-{
- if (propKey.equals(IBasicPropertyConstants.P_TEXT))
- return getName();
- return null;
-}
-/**
- * Hook. Implemented by <code>GroupElement</code> for use instead of instanceof
- * @return boolean
- */
-public boolean isGroup() {
- return false;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public boolean isPropertySet(Object property) {
- return false;
-}
-/**
- * Hook. Implemented by <code>UserElement</code> for use instead of instanceof
- * @return boolean
- */
-public boolean isUser() {
- return false;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public void resetPropertyValue(Object property){}
-/**
- * Sets the image descriptor
- */
-void setImageDescriptor(ImageDescriptor desc) {
- imageDescriptor = desc;
-}
-/**
- * Sets the name
- */
-void setName(String newName) {
- name = newName;
-}
-/**
- * Sets this instance's parent back pointer.
- */
-void setParent(GroupElement newParent){
- parent = newParent;
-}
-/**
- * The <code>OrganizationElement</code> implementation of this
- * <code>IPropertySource</code> method returns the following properties
- * defines the following Setable properties
- *
- * 1) P_NAME, expects String, sets the name of this OrganizationElement
- */
-public void setPropertyValue(Object name, Object value) {
- if (name.equals(IBasicPropertyConstants.P_TEXT)) {
- setName((String) value);
- return;
- }
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PopupMenuActionDelegate.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PopupMenuActionDelegate.java
deleted file mode 100644
index 3c329fc..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PopupMenuActionDelegate.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Action delegate for handling popup menu actions.
- */
-public class PopupMenuActionDelegate implements IObjectActionDelegate {
-
- private IWorkbenchPart part;
-/** (non-Javadoc)
- * Method declared on IDropActionDelegate
- */
-public void run(IAction action) {
- MessageDialog.openInformation(
- this.part.getSite().getShell(),
- MessageUtil.getString("Property_Sheet_Example"), //$NON-NLS-1$
- MessageUtil.getString("Popup_Menu_Action_executed")); //$NON-NLS-1$
-}
-/** (non-Javadoc)
- * Method declared on IActionDelegate
- */
-public void selectionChanged(IAction action, ISelection selection) {
- //Ignored for this example
-}
-/** (non-Javadoc)
- * Method declared on IObjectActionDelegate
- */
-public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- this.part = targetPart;
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PropertySheetContentOutlinePage.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PropertySheetContentOutlinePage.java
deleted file mode 100644
index c86a3dd..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PropertySheetContentOutlinePage.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-
-/**
- * Page for the content outliner
- */
-public class PropertySheetContentOutlinePage extends ContentOutlinePage {
-
- private IAdaptable model;
-/**
- * Create a new instance of the reciver using adapatable
- * as the model.
- */
-public PropertySheetContentOutlinePage(IAdaptable adaptable) {
- this.model = adaptable;
-}
-/**
- * Creates the control and registers the popup menu for this page
- * Menu id "org.eclipse.ui.examples.propertysheet.outline"
- */
-public void createControl(Composite parent) {
- super.createControl(parent);
- TreeViewer viewer = getTreeViewer();
- viewer.setContentProvider(new WorkbenchContentProvider());
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.setInput(this.model);
- viewer.expandAll();
-
- // Configure the context menu.
- MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS+"-end")); //$NON-NLS-1$
-
- Menu menu = menuMgr.createContextMenu(viewer.getTree());
- viewer.getTree().setMenu(menu);
- // Be sure to register it so that other plug-ins can add actions.
- getSite().registerContextMenu("org.eclipse.ui.examples.propertysheet.outline", menuMgr, viewer); //$NON-NLS-1$
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PropertySheetPlugin.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PropertySheetPlugin.java
deleted file mode 100644
index 4b2c20f..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PropertySheetPlugin.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * This is the top-level class of the property sheet example.
- *
- * @see AbstractUIPlugin for additional information on UI plugins
- */
-public class PropertySheetPlugin extends AbstractUIPlugin {
- // Default instance of the receiver
- private static PropertySheetPlugin inst;
-/**
- * Create the PropertySheet plugin and cache its default instance
- *
- * @param descriptor the plugin descriptor which the receiver is made from
- */
-public PropertySheetPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- if (inst==null) inst = this;
-}
-/**
- * Returns the plugin singleton.
- *
- * @return the default PropertySheetPlugin instance
- */
-static public PropertySheetPlugin getDefault() {
- return inst;
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/StreetAddress.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/StreetAddress.java
deleted file mode 100644
index 7d336f5..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/StreetAddress.java
+++ /dev/null
@@ -1,232 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Vector;
-
-import org.eclipse.ui.views.properties.*;
-
-/**
- * PropertySource containing street information pertenant to Address
- */
-public class StreetAddress implements IPropertySource {
-
- //properties
- private Integer buildNo;
- private String aptBox;
- private String streetName;
-
- //default property values
- private static final Integer BUILD_NO_DEFAULT = new Integer(0);
- private static final String APTBOX_DEFAULT = MessageUtil.getString("unspecified"); //$NON-NLS-1$
- private static final String STREETNAME_DEFAULT = MessageUtil.getString("unspecified"); //$NON-NLS-1$
-
- //property unique keys
- public static final String P_ID_BUILD_NO = "Street.buildingNo"; //$NON-NLS-1$
- public static final String P_ID_APTBOX = "Street.aptNo"; //$NON-NLS-1$
- public static final String P_ID_STREET = "Street.street"; //$NON-NLS-1$
-
- //property display keys
- public static final String P_BUILD_NO = MessageUtil.getString("building_number"); //$NON-NLS-1$
- public static final String P_APTBOX = MessageUtil.getString("apt.no_or_box.no"); //$NON-NLS-1$
- public static final String P_STREET = MessageUtil.getString("street"); //$NON-NLS-1$
-
- //
- private static Vector descriptors;
-
- static {
- descriptors = new Vector();
- descriptors.addElement(new TextPropertyDescriptor(P_ID_BUILD_NO, P_BUILD_NO));
- descriptors.addElement(new TextPropertyDescriptor(P_ID_APTBOX, P_APTBOX));
- descriptors.addElement(new TextPropertyDescriptor(P_ID_STREET, P_STREET));
- }
-/**
- * Street Default Constructor.
- */
-public StreetAddress() {
- super();
-}
-/**
- * Convenience Street constructor. AptBox set to default
- */
-public StreetAddress(int buildNo, String streetName) {
- super();
- setBuildNo(new Integer(buildNo));
- setStreetName(streetName);
-}
-/**
- * Convenience Street constructor.
- */
-public StreetAddress(int buildNo, String aptBox, String streetName) {
- super();
- setBuildNo(new Integer(buildNo));
- setAptBox(aptBox);
- setStreetName(streetName);
-}
-/* (non-Javadoc)
- * Method declared on Object
- */
-public boolean equals(Object ob) {
- return toString().equals(ob.toString());
-}
-/**
- * the appartment number
- */
-private String getAptBox() {
- if(aptBox == null)
- aptBox = APTBOX_DEFAULT;
- return aptBox;
-}
-/**
- * Returns the building number
- */
-private Integer getBuildNo() {
- if(buildNo == null)
- buildNo = BUILD_NO_DEFAULT;
- return buildNo;
-}
-/**
- * Returns the descriptors
- */
-private static Vector getDescriptors() {
- return descriptors;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public Object getEditableValue() {
- return this.toString();
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public IPropertyDescriptor[] getPropertyDescriptors() {
- return (IPropertyDescriptor[])getDescriptors().toArray(new IPropertyDescriptor[getDescriptors().size()]);
-}
-/**
- * The <code>Name</code> implementation of this
- * <code>IPropertySource</code> method returns the following properties
- *
- * 1) P_BUILD_NO returns java.lang.Integer
- * 2) P_APTBOX returns java.lang.String
- * 3) P_STREET returns java.lang.String
- */
-public Object getPropertyValue(Object propKey) {
- if (propKey.equals(P_ID_BUILD_NO))
- return getBuildNo().toString();
- if (propKey.equals(P_ID_APTBOX))
- return getAptBox();
- if (propKey.equals(P_ID_STREET))
- return getStreetName();
- return null;
-}
-/**
- * Returns the street name
- */
-private String getStreetName() {
- if(streetName == null)
- streetName = STREETNAME_DEFAULT;
- return streetName;
-}
-/* (non-Javadoc)
- * Method declared on Object
- */
-public int hashCode()
-{ return toString().hashCode();
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public boolean isPropertySet(Object property) {
- if (property.equals(P_ID_BUILD_NO))
- return getBuildNo() != BUILD_NO_DEFAULT;
- if (property.equals(P_ID_APTBOX))
- return getAptBox() != APTBOX_DEFAULT;
- if (property.equals(P_ID_STREET))
- return getStreetName() != STREETNAME_DEFAULT;
- return false;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public void resetPropertyValue(Object property) {
- if (property.equals(P_ID_BUILD_NO)) {
- setBuildNo(BUILD_NO_DEFAULT);
- return;
- }
- if (property.equals(P_ID_APTBOX)) {
- setAptBox(APTBOX_DEFAULT);
- return;
- }
- if (property.equals(P_ID_STREET)) {
- setStreetName(STREETNAME_DEFAULT);
- return;
- }
-}
-/**
- * Sets the appartment number
- */
-private void setAptBox(String newAptBox) {
- aptBox = newAptBox;
-}
-/**
- * Sets the building number
- */
-private void setBuildNo(Integer newBuildNo) {
- buildNo = newBuildNo;
-}
-/**
- * The <code>Name</code> implementation of this
- * <code>IPropertySource</code> method
- * defines the following Setable properties
- *
- * 1) P_BUILD_NO expects java.lang.Integer
- * 2) P_APTBOX expects java.lang.String
- * 3) P_STREET expects java.lang.String
- */
-public void setPropertyValue(Object name, Object value) {
- if (name.equals(P_ID_BUILD_NO)) {
- try {
- setBuildNo(new Integer(Integer.parseInt((String)value)));
- } catch (NumberFormatException e) {
- setBuildNo(BUILD_NO_DEFAULT);
- }
- return;
- }
- if (name.equals(P_ID_APTBOX)) {
- setAptBox((String) value);
- return;
- }
- if (name.equals(P_ID_STREET)){
- setStreetName((String) value);
- return;
- }
-}
-/**
- * Sets the street name
- */
-private void setStreetName(String newStreetName) {
- streetName = newStreetName;
-}
-/**
- * The value as displayed in the Property Sheet. Will not print default values
- * @return java.lang.String
- */
-public String toString() {
- StringBuffer outStringBuffer = new StringBuffer();
- if (!getAptBox().equals(APTBOX_DEFAULT)) {
- outStringBuffer.append(getAptBox());
- outStringBuffer.append(", "); //$NON-NLS-1$
- }
- if (!getBuildNo().equals(BUILD_NO_DEFAULT)) {
- outStringBuffer.append(getBuildNo());
- outStringBuffer.append(" "); //$NON-NLS-1$
- }
- if (!getStreetName().equals(STREETNAME_DEFAULT)) {
- outStringBuffer.append(getStreetName());
- }
- return outStringBuffer.toString();
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserEditor.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserEditor.java
deleted file mode 100644
index 16f86b4..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserEditor.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.text.Document;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.eclipse.ui.views.properties.IPropertySheetPage;
-import org.eclipse.ui.views.properties.PropertySheetPage;
-
-/**
- * This class implements the User editor.
- */
-public class UserEditor extends TextEditor {
- private ContentOutlinePage userContentOutline;
-/**
- * UserEditor default Constructor
- */
-public UserEditor() {
- super();
-}
-/* (non-Javadoc)
- * Method declared on WorkbenchPart
- */
-public void createPartControl(Composite parent) {
- super.createPartControl(parent);
- getSourceViewer().setDocument(new Document(MessageUtil.getString("Editor_instructions"))); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on IAdaptable
- */
-public Object getAdapter(Class adapter) {
- if (adapter.equals(IContentOutlinePage.class)) {
- return getContentOutline();
- }
- if (adapter.equals(IPropertySheetPage.class)) {
- return getPropertySheet();
- }
- return super.getAdapter(adapter);
-}
-/**
- * Returns the content outline.
- */
-protected ContentOutlinePage getContentOutline() {
- if (userContentOutline == null) {
- //Create a property outline page using the parsed result of passing in the document provider.
- userContentOutline =
- new PropertySheetContentOutlinePage(
- new UserFileParser().parse(getDocumentProvider()));
- }
- return userContentOutline;
-}
-/**
- * Returns the property sheet.
- */
-protected IPropertySheetPage getPropertySheet() {
- return new PropertySheetPage();
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserElement.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserElement.java
deleted file mode 100644
index 67e3a0f..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserElement.java
+++ /dev/null
@@ -1,505 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.Vector;
-
-import org.eclipse.jface.viewers.ICellEditorValidator;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.ui.views.properties.*;
-
-/**
- * A User Element
- */
-public class UserElement extends OrganizationElement {
-
- // Properties
- private Name fullName;
- private Address address;
- private String phoneNumber;
- private EmailAddress emailAddress;
- private Boolean coop;
- private Birthday birthday;
- private Float salary;
- private RGB hairColor;
- private RGB eyeColor;
-
- // Property default values
- private Name fullName_Default;
- private Address address_Default;
- private String phoneNumber_Default= "555-1111"; //$NON-NLS-1$
- private EmailAddress emailAddress_Default;
- private Boolean coop_Default;
- private Birthday birthday_Default;
- private Float salary_Default;
- private RGB hairColor_Default;
- private RGB eyeColor_Default;
-
- // Property unique keys
- public static final String P_ID_PHONENUMBER = "User.phonenumber"; //$NON-NLS-1$
- public static final String P_ID_ADDRESS = "User.address"; //$NON-NLS-1$
- public static final String P_ID_FULLNAME = "User.fullname"; //$NON-NLS-1$
- public static final String P_ID_EMAIL = "User.email"; //$NON-NLS-1$
- public static final String P_ID_COOP = "User.coop student"; //$NON-NLS-1$
- public static final String P_ID_BDAY = "User.birthday"; //$NON-NLS-1$
- public static final String P_ID_SALARY = "User.salary"; //$NON-NLS-1$
- public static final String P_ID_HAIRCOLOR = "User.haircolor"; //$NON-NLS-1$
- public static final String P_ID_EYECOLOR = "User.eyecolor"; //$NON-NLS-1$
-
- // Property display keys
- public static final String P_PHONENUMBER = MessageUtil.getString("phonenumber"); //$NON-NLS-1$
- public static final String P_ADDRESS = MessageUtil.getString("address"); //$NON-NLS-1$
- public static final String P_FULLNAME = MessageUtil.getString("fullname"); //$NON-NLS-1$
- public static final String P_EMAIL = MessageUtil.getString("email"); //$NON-NLS-1$
- public static final String P_COOP = MessageUtil.getString("coop_student"); //$NON-NLS-1$
- public static final String P_BDAY = MessageUtil.getString("birthday"); //$NON-NLS-1$
- public static final String P_SALARY = MessageUtil.getString("salary"); //$NON-NLS-1$
- public static final String P_HAIRCOLOR = MessageUtil.getString("haircolor"); //$NON-NLS-1$
- public static final String P_EYECOLOR = MessageUtil.getString("eyecolor"); //$NON-NLS-1$
-
- // Help context ids
- private static final String PHONE_NUMBER_CONTEXT ="org.eclipse.ui.examples.propertysheet.phone_number_context"; //$NON-NLS-1$
- private static final String ADDRESS_CONTEXT ="org.eclipse.ui.examples.propertysheet.address_context"; //$NON-NLS-1$
- private static final String FULL_NAME_CONTEXT ="org.eclipse.ui.examples.propertysheet.full_name_context"; //$NON-NLS-1$
- private static final String EMAIL_CONTEXT ="org.eclipse.ui.examples.propertysheet.email_context"; //$NON-NLS-1$
- private static final String COOP_CONTEXT ="org.eclipse.ui.examples.propertysheet.coop_context"; //$NON-NLS-1$
- private static final String BIRTHDAY_CONTEXT ="org.eclipse.ui.examples.propertysheet.birthday_context"; //$NON-NLS-1$
- private static final String SALARY_CONTEXT ="org.eclipse.ui.examples.propertysheet.salary_context"; //$NON-NLS-1$
- private static final String HAIR_COLOR__CONTEXT ="org.eclipse.ui.examples.propertysheet.hair_color_context"; //$NON-NLS-1$
- private static final String EYE_COLOR_CONTEXT ="org.eclipse.ui.examples.propertysheet.eye_color_context"; //$NON-NLS-1$
-
- // Property Category
- public static final String P_CONTACTINFO = MessageUtil.getString("contact"); //$NON-NLS-1$
- public static final String P_PERSONELINFO = MessageUtil.getString("personel"); //$NON-NLS-1$
- public static final String P_PERSONALINFO = MessageUtil.getString("personal"); //$NON-NLS-1$
-
- // Property Values
- public static final Integer P_VALUE_TRUE = new Integer(0);
- public static final Integer P_VALUE_FALSE = new Integer(1);
- public static final String P_VALUE_TRUE_LABEL = MessageUtil.getString("true"); //$NON-NLS-1$
- public static final String P_VALUE_FALSE_LABEL = MessageUtil.getString("false"); //$NON-NLS-1$
-
-
- static private class BooleanLabelProvider extends LabelProvider {
- public String getText(Object element) {
- String[] values = new String[] {P_VALUE_TRUE_LABEL, P_VALUE_FALSE_LABEL};
- return values[((Integer)element).intValue()];
- }
- }
-
-
- //
- static private Vector descriptors;
- static {
- descriptors = new Vector();
- PropertyDescriptor propertyDescriptor;
-
- ///
- propertyDescriptor = new TextPropertyDescriptor(P_ID_PHONENUMBER, P_PHONENUMBER);
- propertyDescriptor.setCategory(P_CONTACTINFO);
- propertyDescriptor.setHelpContextIds(PHONE_NUMBER_CONTEXT);
- descriptors.addElement(propertyDescriptor);
-
- ///
- propertyDescriptor = new PropertyDescriptor(P_ID_ADDRESS, P_ADDRESS);
- propertyDescriptor.setCategory(P_CONTACTINFO);
- propertyDescriptor.setHelpContextIds(ADDRESS_CONTEXT);
- descriptors.addElement(propertyDescriptor);
-
- ///
- propertyDescriptor = new TextPropertyDescriptor(P_ID_EMAIL, P_EMAIL);
- propertyDescriptor.setCategory(P_CONTACTINFO);
- propertyDescriptor.setHelpContextIds(EMAIL_CONTEXT);
- propertyDescriptor.setValidator(new EmailAddressValidator());
- descriptors.addElement(propertyDescriptor);
-
- ///
- propertyDescriptor = new TextPropertyDescriptor(P_ID_FULLNAME, P_FULLNAME);
- propertyDescriptor.setCategory(P_PERSONELINFO);
- propertyDescriptor.setHelpContextIds(FULL_NAME_CONTEXT);
- descriptors.addElement(propertyDescriptor);
-
- ///
- propertyDescriptor = new PropertyDescriptor(P_ID_BDAY, P_BDAY);
- propertyDescriptor.setCategory(P_PERSONELINFO);
- propertyDescriptor.setHelpContextIds(BIRTHDAY_CONTEXT);
- descriptors.addElement(propertyDescriptor);
-
- ///
- propertyDescriptor = new ComboBoxPropertyDescriptor(P_ID_COOP, P_COOP, new String[] {P_VALUE_TRUE_LABEL, P_VALUE_FALSE_LABEL});
- propertyDescriptor.setCategory(P_PERSONELINFO);
- propertyDescriptor.setHelpContextIds(COOP_CONTEXT);
- propertyDescriptor.setLabelProvider(new BooleanLabelProvider());
- descriptors.addElement(propertyDescriptor);
-
- ///
- propertyDescriptor = new TextPropertyDescriptor(P_ID_SALARY, P_SALARY);
- //add custom validator to propertyDescriptor limiting salary values to be
- //greator than zero
- propertyDescriptor.setHelpContextIds(new Object[] {SALARY_CONTEXT});
- propertyDescriptor.setFilterFlags(new String[] {IPropertySheetEntry.FILTER_ID_EXPERT});
- propertyDescriptor.setValidator(
- new ICellEditorValidator(){
- public String isValid(Object value){
- if(value == null)
- return MessageUtil.getString("salary_is_invalid"); //$NON-NLS-1$
- //
- Float trySalary;
- try {
- trySalary = new Float(Float.parseFloat((String)value));
- } catch (NumberFormatException e) {
- return MessageUtil.getString("salary_is_invalid"); //$NON-NLS-1$
- }
- if(trySalary.floatValue() < 0.0)
- return MessageUtil.getString("salary_must_be_greator_than_zero"); //$NON-NLS-1$
- return null;
- }
- });
- propertyDescriptor.setCategory(P_PERSONELINFO);
- descriptors.addElement(propertyDescriptor);
-
- /// HairColor
- propertyDescriptor = new ColorPropertyDescriptor(P_ID_HAIRCOLOR, P_HAIRCOLOR);
- propertyDescriptor.setCategory(P_PERSONALINFO);
- propertyDescriptor.setHelpContextIds(HAIR_COLOR__CONTEXT);
- descriptors.addElement(propertyDescriptor);
-
- /// EyeColor
- propertyDescriptor = new ColorPropertyDescriptor(P_ID_EYECOLOR, P_EYECOLOR);
- propertyDescriptor.setCategory(P_PERSONALINFO);
- propertyDescriptor.setHelpContextIds(EYE_COLOR_CONTEXT);
- descriptors.addElement(propertyDescriptor);
-
- //gets descriptors from parent, warning name-space collision may occur
- Vector parentDescriptors = OrganizationElement.getDescriptors();
- for (int i = 0; i < parentDescriptors.size(); i++) {
- descriptors.addElement(parentDescriptors.elementAt(i));
- }
- }
-/**
- * Constructor. Default visibility only called from GroupElement.createSubGroup()
- * Creates a new UserElement within the passed parent GroupElement,
- * *
- * @param name the name
- * @param parent the parent
- */
-UserElement(String name, GroupElement parent) {
- super(name, parent);
-}
-/**
- * Returns the address
- */
-private Address getAddress() {
- if (address == null)
- address = new Address();
- return address;
-}
-/**
- * Returns the birthday
- */
-private Birthday getBirthday() {
- if(birthday == null)
- birthday = new Birthday();
- return birthday;
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchAdapter
- */
-public Object[] getChildren(Object o) {
- return new Object[0];
-}
-/**
- * Returns the coop
- */
-private Boolean getCoop() {
- if(coop == null)
- coop = new Boolean(false);
- return coop;
-}
-/**
- * Returns the descriptors
- */
-static Vector getDescriptors()
-{
- return descriptors;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public Object getEditableValue() {
- return this.toString();
-}
-/**
- * Returns the email address
- */
-EmailAddress getEmailAddress() {
- if(emailAddress == null)
- emailAddress = new EmailAddress();
- return emailAddress;
-}
-/**
- * Returns the eye color
- */
-private RGB getEyeColor() {
- if (eyeColor == null)
- eyeColor = new RGB(60, 60, 60);
- return eyeColor;
-}
-/**
- * Returns the full name
- */
-private Name getFullName() {
- if (fullName == null)
- fullName = new Name(getName());
- return fullName;
-}
-/**
- * Returns the hair color
- */
-private RGB getHairColor() {
- if (hairColor == null)
- hairColor = new RGB(255, 255, 255);
- return hairColor;
-}
-/**
- * Returns the phone number
- */
-private String getPhoneNumber(){
- return phoneNumber;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public IPropertyDescriptor[] getPropertyDescriptors() {
- return (IPropertyDescriptor[])getDescriptors().toArray(new IPropertyDescriptor[getDescriptors().size()]);
-}
-/**
- * The <code>Userment</code> implementation of this
- * <code>IPropertySource</code> method returns the following properties
- *
- * 1) P_ADDRESS returns Address (IPropertySource), the address of this user
- * 2) P_FULLNAME returns Name (IPropertySource), the full name of this user
- * 3) P_PHONENUMBER returns String, the phone number of this user
- * 4) P_EMAIL returns EmailAddress (IPropertySource), the email address of this user
- * 5) P_COOP returns Boolean, whether the individual is a coop student or not
- * 6) P_BDAY returns Birthday
- * 7) P_SALARY return java.lang.Float
- * 8) P_HAIRCOLOR, expects RGB
- * 9) P_EYECOLOR, expects RGB
- */
-public Object getPropertyValue(Object propKey) {
- if (propKey.equals(P_ID_ADDRESS))
- return getAddress();
- if (propKey.equals(P_ID_FULLNAME))
- return getFullName();
- if (propKey.equals(P_ID_PHONENUMBER))
- return getPhoneNumber();
- if (propKey.equals(P_ID_EMAIL))
- return getEmailAddress();
- if (propKey.equals(P_ID_COOP))
- return getCoop().equals(Boolean.TRUE) ? P_VALUE_TRUE : P_VALUE_FALSE;
- if (propKey.equals(P_ID_BDAY))
- return getBirthday();
- if (propKey.equals(P_ID_SALARY))
- return getSalary().toString();
- if (propKey.equals(P_ID_HAIRCOLOR))
- return getHairColor();
- if (propKey.equals(P_ID_EYECOLOR))
- return getEyeColor();
- return super.getPropertyValue(propKey);
-}
-/**
- * Returns the salary
- */
-private Float getSalary() {
- if(salary==null)
- salary = new Float(0);
- return salary;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public boolean isPropertySet(Object property) {
- if (property.equals(P_ID_ADDRESS))
- return getAddress() != address_Default;
- if (property.equals(P_ID_FULLNAME))
- return getFullName() != fullName_Default;
- if (property.equals(P_ID_PHONENUMBER))
- return getPhoneNumber() != phoneNumber_Default;
- if (property.equals(P_ID_EMAIL))
- return getEmailAddress() != emailAddress_Default;
- if (property.equals(P_ID_COOP))
- return getCoop() != coop_Default;
- if (property.equals(P_ID_BDAY))
- return getBirthday() != birthday_Default;
- if (property.equals(P_ID_SALARY))
- return getSalary() != salary_Default;
- if (property.equals(P_ID_HAIRCOLOR))
- return getHairColor() != hairColor_Default;
- if (property.equals(P_ID_EYECOLOR))
- return getEyeColor() != eyeColor_Default;
- return false;
-}
-/* (non-Javadoc)
- * Method declared on OrganizationElement
- */
-public boolean isUser() {
- return true;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public void resetPropertyValue(Object property) {
- if (property.equals(P_ID_ADDRESS)) {
- setAddress(address_Default);
- return;
- }
- if (property.equals(P_ID_FULLNAME)) {
- setFullName(fullName_Default);
- return;
- }
- if (property.equals(P_ID_PHONENUMBER)) {
- setPhoneNumber(phoneNumber_Default);
- return;
- }
- if (property.equals(P_ID_EMAIL)) {
- setEmailAddress(emailAddress_Default);
- return;
- }
- if (property.equals(P_ID_COOP)) {
- setCoop(coop_Default);
- }
- if (property.equals(P_ID_BDAY)) {
- setBirthday(birthday_Default);
- return;
- }
- if (property.equals(P_ID_SALARY)) {
- setSalary(salary_Default);
- return;
- }
- if (property.equals(P_ID_HAIRCOLOR)) {
- setHairColor(hairColor_Default);
- return;
- }
- if (property.equals(P_ID_EYECOLOR)) {
- setEyeColor(eyeColor_Default);
- return;
- }
- super.resetPropertyValue(property);
-}
-/**
- * Sets the address
- */
-public void setAddress(Address newAddress) {
- address = newAddress;
-}
-/**
- * Sets the birthday
- */
-public void setBirthday(Birthday newBirthday) {
- birthday = new Birthday();
-}
-/**
- * Sets the coop
- */
-public void setCoop(Boolean newCoop) {
- coop = newCoop;
-}
-/**
- *Sets the email address
- */
-public void setEmailAddress(EmailAddress newEmailAddress){
- emailAddress = newEmailAddress;
-}
-/**
- * Sets eye color
- */
-public void setEyeColor(RGB newEyeColor) {
- eyeColor = newEyeColor;
-}
-/**
- * Sets full name
- */
-public void setFullName(Name newFullName)
-{ fullName = newFullName;
-}
-/**
- * Sets hair color
- */
-public void setHairColor(RGB newHairColor) {
- hairColor = newHairColor;
-}
-/**
- * Sets phone number
- */
-public void setPhoneNumber(String newPhoneNumber)
-{ phoneNumber = newPhoneNumber;
-}
-/**
- * The <code>OrganizationElement</code> implementation of this
- * <code>IPropertySource</code> method
- * defines the following Setable properties
- *
- * 1) P_ADDRESS, expects Address
- * 2) P_FULLNAME, expects Name
- * 3) P_PHONENUMBER, expects String
- * 4) P_EMAIL, expects EmailAddress.
- * 5) P_BOOLEAN, expects Boolean, whether the individual is a coop student or not
- * 6) P_BDAY, expects Birthday
- * 7) P_SALARY, expects java.lang.Float
- * 8) P_HAIRCOLOR, expects RGB
- * 9) P_EYECOLOR, expects RGB
- */
-public void setPropertyValue(Object propKey, Object val) {
- // need to convert from String to domain objects
- if (propKey.equals(P_ID_ADDRESS)) {
- //setAddress((Address)val);
- return;
- }
- if (propKey.equals(P_ID_FULLNAME)) {
- setFullName(new Name((String)val));
- return;
- }
- if (propKey.equals(P_ID_PHONENUMBER)) {
- setPhoneNumber((String) val);
- return;
- }
- if (propKey.equals(P_ID_EMAIL)) {
- setEmailAddress(new EmailAddress((String)val));
- return;
- }
- if (propKey.equals(P_ID_COOP)) {
- setCoop(((Integer)val).equals(P_VALUE_TRUE) ? Boolean.TRUE : Boolean.FALSE);
- }
- if (propKey.equals(P_ID_BDAY)) {
- //setBirthday((Birthday)val);
- return;
- }
- if (propKey.equals(P_ID_SALARY)) {
- try {
- setSalary(new Float(Float.parseFloat((String)val)));
- } catch (NumberFormatException e) {
- setSalary(salary_Default);
- }
- return;
- }
- if (propKey.equals(P_ID_HAIRCOLOR)) {
- setHairColor((RGB) val);
- return;
- }
- if (propKey.equals(P_ID_EYECOLOR)) {
- setEyeColor((RGB) val);
- return;
- }
- super.setPropertyValue(propKey, val);
-}
-/**
- * Sets the salary
- */
-void setSalary(Float newSalary) {
- salary = newSalary;
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserFileParser.java b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserFileParser.java
deleted file mode 100644
index a381941..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserFileParser.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package org.eclipse.ui.examples.propertysheet;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.ui.texteditor.IDocumentProvider;
-
-/**
- * This class is an example of the implementation of a simple parser.
- */
-public class UserFileParser {
-/**
- * Return the fabricated result for this example.
- *
- */
-private static IAdaptable getFabricatedResult() {
- // returns fabricated input.
- GroupElement root = new GroupElement(MessageUtil.getString("Everybody"), null); //$NON-NLS-1$
- GroupElement userGroup = root.createSubGroup(MessageUtil.getString("Company_Inc")); //$NON-NLS-1$
- GroupElement ottGroup = userGroup.createSubGroup(MessageUtil.getString("Waterloo_Lab")); //$NON-NLS-1$
- userGroup.createSubGroup(MessageUtil.getString("Toronto_Lab")); //$NON-NLS-1$
- userGroup.createSubGroup(MessageUtil.getString("Hamilton_Lab")); //$NON-NLS-1$
- userGroup.createSubGroup(MessageUtil.getString("London_Lab")); //$NON-NLS-1$
- userGroup.createSubGroup(MessageUtil.getString("Grimsby_Lab")); //$NON-NLS-1$
- GroupElement uiTeam = ottGroup.createSubGroup(MessageUtil.getString("Team1")); //$NON-NLS-1$
- //
- UserElement user1 = uiTeam.createUser("richard"); //$NON-NLS-1$
- user1.setFullName(new Name(MessageUtil.getString("Richard_Zokol"))); //$NON-NLS-1$
- user1.setEmailAddress(new EmailAddress(MessageUtil.getString("rzokol@company.com"))); //$NON-NLS-1$
- user1.setPhoneNumber("x789"); //$NON-NLS-1$
- user1.setAddress(new Address(new StreetAddress(232, MessageUtil.getString("Champlain")), MessageUtil.getString("Hull"), new Integer(5), MessageUtil.getString("A1B2C3"))); //$NON-NLS-3$ //$NON-NLS-2$ //$NON-NLS-1$
- user1.setBirthday(new Birthday(18, 1, 1981));
- user1.setCoop(new Boolean(true));
- user1.setHairColor(new RGB(0, 0, 0));
- user1.setEyeColor(new RGB(0, 0, 0));
- //
- UserElement user2 = uiTeam.createUser("george"); //$NON-NLS-1$
- user2.setFullName(new Name(MessageUtil.getString("George_Knudson"))); //$NON-NLS-1$
- user2.setEmailAddress(new EmailAddress(MessageUtil.getString("gknudson@company.com"))); //$NON-NLS-1$
- user2.setPhoneNumber("x678"); //$NON-NLS-1$
- user2.setAddress(new Address(new StreetAddress(), MessageUtil.getString("Toronto"), new Integer(4), MessageUtil.getString("A1B2C3"))); //$NON-NLS-2$ //$NON-NLS-1$
- user2.setBirthday(new Birthday(7, 5, 1978));
- user2.setCoop(new Boolean(true));
- user2.setHairColor(new RGB(0, 0, 0));
- user2.setEyeColor(new RGB(0, 0, 0));
-
- //
- UserElement user3 = uiTeam.createUser("arnold"); //$NON-NLS-1$
- user3.setFullName(new Name(MessageUtil.getString("Arnold_Palmer"))); //$NON-NLS-1$
- user3.setEmailAddress(new EmailAddress(MessageUtil.getString("apalmer@company.com"))); //$NON-NLS-1$
- user3.setPhoneNumber("x567"); //$NON-NLS-1$
- user3.setAddress(new Address(new StreetAddress(), MessageUtil.getString("Ottawa"), new Integer(4), MessageUtil.getString("A1B2C3"))); //$NON-NLS-2$ //$NON-NLS-1$
- user3.setBirthday(new Birthday(11, 23, 1962));
- user3.setHairColor(new RGB(0, 0, 0));
- user3.setEyeColor(new RGB(0, 0, 0));
-
- //
- UserElement user4 = uiTeam.createUser("lee"); //$NON-NLS-1$
- user4.setFullName(new Name(MessageUtil.getString("Lee_Trevino"))); //$NON-NLS-1$
- user4.setEmailAddress(new EmailAddress(MessageUtil.getString("ltrevino@company.com"))); //$NON-NLS-1$
- user4.setPhoneNumber("x456"); //$NON-NLS-1$
- user4.setAddress(new Address(new StreetAddress(), MessageUtil.getString("Ottawa"), new Integer(4), MessageUtil.getString("A1B2C3"))); //$NON-NLS-2$ //$NON-NLS-1$
- //
- UserElement user5 = uiTeam.createUser("tiger"); //$NON-NLS-1$
- user5.setFullName(new Name(MessageUtil.getString("Tiger_Woods"))); //$NON-NLS-1$
- user5.setEmailAddress(new EmailAddress(MessageUtil.getString("twoods@company.com"))); //$NON-NLS-1$
- user5.setPhoneNumber("x345"); //$NON-NLS-1$
- user5.setAddress(new Address(new StreetAddress(), MessageUtil.getString("Ottawa"), new Integer(4), MessageUtil.getString("A1B2C3"))); //$NON-NLS-2$ //$NON-NLS-1$
- //
- UserElement user6 = uiTeam.createUser("jack"); //$NON-NLS-1$
- user6.setFullName(new Name(MessageUtil.getString("Jack_Nicklaus"))); //$NON-NLS-1$
- user6.setEmailAddress(new EmailAddress(MessageUtil.getString("jnicklaus@company.com"))); //$NON-NLS-1$
- user6.setPhoneNumber("x234 "); //$NON-NLS-1$
- user6.setAddress(new Address(new StreetAddress(), MessageUtil.getString("Ottawa"), new Integer(4), MessageUtil.getString("A1B2C3"))); //$NON-NLS-2$ //$NON-NLS-1$
- //
- UserElement greg = uiTeam.createUser("weslock"); //$NON-NLS-1$
- greg.setFullName(new Name(MessageUtil.getString("Weslock"))); //$NON-NLS-1$
- greg.setEmailAddress(new EmailAddress(MessageUtil.getString("weslock@company.com"))); //$NON-NLS-1$
- greg.setPhoneNumber("x123"); //$NON-NLS-1$
- greg.setAddress(new Address(new StreetAddress(), MessageUtil.getString("Ottawa"), new Integer(4), MessageUtil.getString("A1B2C3"))); //$NON-NLS-2$ //$NON-NLS-1$
-
- return root;
-}
-/**
- * Parse the input given by the argument. For this example we do no parsing and return
- * a fabricated result.
- *
- */
-public IAdaptable parse(IDocumentProvider documentProvider) {
-
- return getFabricatedResult();
-}
-}
diff --git a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/messages.properties b/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/messages.properties
deleted file mode 100644
index f0076fa..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/messages.properties
+++ /dev/null
@@ -1,98 +0,0 @@
-Alberta=Alberta
-British_Columbia=British Columbia
-City=City
-Manitoba=Manitoba
-New_Brunswick=New Brunswick
-Newfoundland=Newfoundland
-North_West_Territories=North West Territories
-Nova_Scotia=Nova Scotia
-Nunavut=Nunavut
-Ontario=Ontario
-PostalCode=PostalCode
-Prince_Edward_Island=Prince Edward Island
-Province=Province
-Quebec=Quebec
-Saskatchewan=Saskatchewan
-Street=Street
-Yukon=Yukon
-_is_an_invalid_format_for_a_postal_code={0} is an invalid format for a postal code
-postal_code_is_incomplete=postal code is incomplete
-unspecified_city=unspecified city
-April=April
-August=August
-December=December
-February=February
-January=January
-July=July
-June=June
-March=March
-May=May
-November=November
-October=October
-September=September
-day=day
-month=month
-year=year
-domain=domain
-emailaddress_cannot_be_set_to_null=emailaddress cannot be set to null
-invalid_email_address_format_should_have_been_validated=invalid email address format, should have been validated
-unknownDomain=unknownDomain
-unknownUser=unknownUser
-userid=userid
-email_address_does_not_have_a_valid_format=email address does not have a valid format
-email_address_is_incomplete=email address is incomplete
-FirstName=FirstName
-LastName=LastName
-Middle=Middle
-name=name
-apt.no_or_box.no=apt.no or box.no
-building_number=building number
-street=street
-unspecified=unspecified
-Editor_instructions=Click on the items in the content outline\nto see their properties
-address=address
-birthday=birthday
-contact=contact
-coop_student=coop student
-email=email
-eyecolor=eyecolor
-false=false
-fullname=fullname
-haircolor=haircolor
-personal=personal
-personel=personel
-phonenumber=phonenumber
-salary=salary
-salary_is_invalid=salary is invalid
-salary_must_be_greator_than_zero=salary must be greator than zero
-true=true
-A1B2C3=A1B2C3
-Arnold_Palmer=Arnold Palmer
-Champlain=Champlain
-Company_Inc=Company Inc.
-Everybody=Everybody
-George_Knudson=George Knudson
-Grimsby_Lab=Grimsby Lab
-Hamilton_Lab=Hamilton Lab
-Hull=Hull
-Jack_Nicklaus=Jack Nicklaus
-Lee_Trevino=Lee Trevino
-London_Lab=London Lab
-Ottawa=Ottawa
-Richard_Zokol=Richard Zokol
-Team1=Team1
-Tiger_Woods=Tiger Woods
-Toronto=Toronto
-Toronto_Lab=Toronto Lab
-Waterloo_Lab=Waterloo Lab
-Weslock=Weslock
-apalmer@company.com=apalmer@company.com
-gknudson@company.com=gknudson@company.com
-jnicklaus@company.com=jnicklaus@company.com
-ltrevino@company.com=ltrevino@company.com
-rzokol@company.com=rzokol@company.com
-twoods@company.com=twoods@company.com
-weslock@company.com=weslock@company.com
-Popup_Menu_Action_executed=Popup Menu Action executed
-Property_Sheet_Example=Property Sheet Example
-
diff --git a/examples/org.eclipse.ui.examples.propertysheet/HelpContexts.xml b/examples/org.eclipse.ui.examples.propertysheet/HelpContexts.xml
deleted file mode 100644
index a5a47bc..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/HelpContexts.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<contexts>
-
- <context id="phone_number_context" >
- <description>Help for phone number</description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 1"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 2"/>
- </context>
- <context id="address_context" >
- <description>Help for address </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 1"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 2"/>
- </context>
- <context id="full_name_context" >
- <description>Help for full name </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 1"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 2"/>
- </context>
- <context id="email_context" >
- <description>Help for email address </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 1"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 2"/>
- </context>
- <context id="coop_context" >
- <description>Help for coop </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 1"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 2"/>
- </context>
- <context id="birthday_context" >
- <description>Help for birthday </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 1"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 2"/>
- </context>
- <context id="salary_context" >
- <description>Help for salary </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 1"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 2"/>
- </context>
- <context id="hair_color_context" >
- <description>Help for hair color </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 1"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 2"/>
- </context>
- <context id="eye_color_context" >
- <description>Help for eye color </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 1"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 2"/>
- </context>
-
-</contexts>
\ No newline at end of file
diff --git a/examples/org.eclipse.ui.examples.propertysheet/about.html b/examples/org.eclipse.ui.examples.propertysheet/about.html
deleted file mode 100644
index 9db411a..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, "Program" will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/examples/org.eclipse.ui.examples.propertysheet/build.properties b/examples/org.eclipse.ui.examples.propertysheet/build.properties
deleted file mode 100644
index 9427026..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/build.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-source.propertysheet.jar = Eclipse UI Examples PropertySheet/
-
-bin.includes = doc-html/,\
- icons/,\
- .options,\
- about.html,\
- doc.zip,\
- HelpContexts.xml,\
- plugin.properties,\
- plugin.xml,\
- *.jar
-
-src.includes = about.html
diff --git a/examples/org.eclipse.ui.examples.propertysheet/doc-html/hglegal.htm b/examples/org.eclipse.ui.examples.propertysheet/doc-html/hglegal.htm
deleted file mode 100644
index b071dbd..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/doc-html/hglegal.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.ui.examples.propertysheet/doc-html/ngibmcpy.gif b/examples/org.eclipse.ui.examples.propertysheet/doc-html/ngibmcpy.gif
deleted file mode 100644
index 360f8e9..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.propertysheet/doc-html/ui_propertysheet_ex.html b/examples/org.eclipse.ui.examples.propertysheet/doc-html/ui_propertysheet_ex.html
deleted file mode 100644
index 00ba3eb..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/doc-html/ui_propertysheet_ex.html
+++ /dev/null
@@ -1,47 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Desktop - Property Sheet Example</title>
-</head>
-<body>
-
-<h2>
-<b>Example - Property Sheet</b></h2>
-
-<h3>
-Introduction</h3>
-The Property Sheet Example adds an editor for files with the .usr extension
-and also demonstrates how to add properties and outline views on a file.
-<br>
-<h3>
-Running the example</h3>
-To start using the Property Sheet Example, create a file with extension
-.usr. Open the file and the Outline and Properties views to
-see the example in action. Click on items in the Outline view and
-look in the Properties view for details of the selected item in the Outline
-view. The people items in the list show the most detail in the Properties
-view.
-<h4>
-<b>Creating a new usr file</b></h4>
-Create a new file with file extension .usr. From the File menu, select
-New and then select Other... from the sub-menu. Click on Simple in
-the wizard, then select
-<br>File in the list on the left. Click on Next to supply the file
-name (make sure the extension is .usr) and the folder in which the file
-should be contained.
-<br>
-<h3>
-Details</h3>
-The Property Sheet Example demonstrates how to provide properties to the
-Property Sheet View.
-<p>The tree viewer of the Content Outline View contains and presents OrganizationElements.
-When an element is selected in the Content Outline View the Workspace will
-invoke <tt>getAdapter</tt>
-on the selected OrganizationElement. If an adapter is requested for IPropertySource,
-the OrganizationElement returns itself as it impements IPropertySource
-The Property Sheet View then use the Organization Element as it source.
-<br>
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corp. 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a>
-</body>
-</html>
diff --git a/examples/org.eclipse.ui.examples.propertysheet/doc.zip b/examples/org.eclipse.ui.examples.propertysheet/doc.zip
deleted file mode 100644
index 41e8aa9..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/doc.zip
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.gif b/examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.gif
deleted file mode 100644
index 64d7907..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.propertysheet/plugin.properties b/examples/org.eclipse.ui.examples.propertysheet/plugin.properties
deleted file mode 100644
index caa55e8..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/plugin.properties
+++ /dev/null
@@ -1,4 +0,0 @@
-Plugin.name = User File Editor
-Plugin.providerName = Eclipse.org
-Editors.UserEditor = User File Editor
-PopupMenus.action = Show Action
diff --git a/examples/org.eclipse.ui.examples.propertysheet/plugin.xml b/examples/org.eclipse.ui.examples.propertysheet/plugin.xml
deleted file mode 100644
index c59df0c..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/plugin.xml
+++ /dev/null
@@ -1,48 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<plugin
- name = "%Plugin.name"
- id = "org.eclipse.ui.examples.propertysheet"
- version = "2.1.0"
- provider-name = "%Plugin.providerName"
- class="org.eclipse.ui.examples.propertysheet.PropertySheetPlugin">
-
-<requires>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.core.resources"/>
-</requires>
-
-
-<runtime>
- <library name="propertysheet.jar" />
-</runtime>
-
-<extension
- point = "org.eclipse.ui.editors">
- <editor
- id = "org.eclipse.ui.examples.propertysheet.UserEditor"
- name="%Editors.UserEditor"
- icon="icons/obj16/usereditor.gif"
- extensions="usr"
- class="org.eclipse.ui.examples.propertysheet.UserEditor">
- </editor>
-</extension>
-
-<extension point = "org.eclipse.ui.popupMenus">
- <objectContribution
- id="org.eclipse.ui.examples.propertysheet"
- objectClass="org.eclipse.ui.examples.propertysheet.UserElement">
- <action id="org.eclipse.ui.examples.propertysheet.action1"
- label="%PopupMenus.action"
- menubarPath="additions"
- class="org.eclipse.ui.examples.propertysheet.PopupMenuActionDelegate"
- enablesFor="1">
- </action>
- </objectContribution>
-</extension>
-
-<extension point="org.eclipse.help.contexts">
- <contexts name="HelpContexts.xml"/>
-</extension>
-
-</plugin>
diff --git a/examples/org.eclipse.ui.examples.readmetool/.classpath b/examples/org.eclipse.ui.examples.readmetool/.classpath
deleted file mode 100644
index 72dfb48..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/.classpath
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="Eclipse UI Examples Readme Tool"/>
- <classpathentry kind="src" path="/org.eclipse.ui"/>
- <classpathentry kind="src" path="/org.eclipse.swt"/>
- <classpathentry kind="src" path="/org.eclipse.core.resources"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/examples/org.eclipse.ui.examples.readmetool/.cvsignore b/examples/org.eclipse.ui.examples.readmetool/.cvsignore
deleted file mode 100644
index c5e82d7..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
\ No newline at end of file
diff --git a/examples/org.eclipse.ui.examples.readmetool/.project b/examples/org.eclipse.ui.examples.readmetool/.project
deleted file mode 100644
index eff1d50..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/.project
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.examples.readmetool</name>
- <comment></comment>
- <projects>
- <project>org.eclipse.core.resources</project>
- <project>org.eclipse.core.runtime</project>
- <project>org.eclipse.swt</project>
- <project>org.eclipse.ui</project>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AdaptableList.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AdaptableList.java
deleted file mode 100644
index a14bd52..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AdaptableList.java
+++ /dev/null
@@ -1,107 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.PlatformObject;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-import java.util.*;
-
-/**
- * A list of adaptable objects. This is a generic list that can
- * be used to display an arbitrary set of adaptable objects in the workbench.
- * Also implements the IWorkbenchAdapter interface for simple display
- * and navigation.
- */
-public class AdaptableList implements IWorkbenchAdapter, IAdaptable {
- protected List children = new ArrayList();
-/**
- * Creates a new adaptable list with the given children.
- */
-public AdaptableList() {
-}
-/**
- * Creates a new adaptable list with the given children.
- */
-public AdaptableList(IAdaptable[] newChildren) {
- for (int i = 0; i < newChildren.length; i++) {
- children.add(newChildren[i]);
- }
-}
-/**
- * Adds all the adaptable objects in the given enumeration to this list.
- * Returns this list.
- */
-public AdaptableList add(Iterator iterator) {
- while (iterator.hasNext()) {
- add((IAdaptable)iterator.next());
- }
- return this;
-}
-/**
- * Adds the given adaptable object to this list.
- * Returns this list.
- */
-public AdaptableList add(IAdaptable adaptable) {
- children.add(adaptable);
- return this;
-}
-/* (non-Javadoc)
- * Method declared on IAdaptable
- */
-public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class) return this;
- return null;
-}
-/**
- * Returns the elements in this list.
- */
-public Object[] getChildren() {
- return children.toArray();
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchAdapter
- */
-public Object[] getChildren(Object o) {
- return children.toArray();
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchAdapter
- */
-public ImageDescriptor getImageDescriptor(Object object) {
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchAdapter
- */
-public String getLabel(Object object) {
- return object == null ? "" : object.toString(); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchAdapter
- */
-public Object getParent(Object object) {
- return null;
-}
-/**
- * Removes the given adaptable object from this list.
- */
-public void remove(IAdaptable adaptable) {
- children.remove(adaptable);
-}
-/**
- * Returns the number of items in the list
- */
-public int size() {
- return children.size();
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AddReadmeMarkerAction.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AddReadmeMarkerAction.java
deleted file mode 100644
index d525596..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AddReadmeMarkerAction.java
+++ /dev/null
@@ -1,109 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.MarkerUtilities;
-
-
-
-/**
- * Action for creating a readme marker with a specfic id
- * attribute value.
- */
-public class AddReadmeMarkerAction extends Action {
- private ITextEditor textEditor;
- private Object[][] customAttributes;
- private String message;
- private final static String MARKER_TYPE = "org.eclipse.ui.examples.readmetool.readmemarker"; //$NON-NLS-1$
-
- /**
- * Creates a new action for the given text editor.
- *
- * @param editor the text editor
- * @param label the label for the action
- * @param attributes the custom attributes for this marker
- * @param message the message for the marker
- */
- public AddReadmeMarkerAction(ITextEditor editor, String label, Object[][] attributes, String message) {
- textEditor = editor;
- setText(label);
- this.customAttributes = attributes;
- this.message = message;
- }
-
- /*
- * @see IAction#run()
- */
- public void run() {
- Map attributes= new HashMap(11);
-
- ITextSelection selection= (ITextSelection) textEditor.getSelectionProvider().getSelection();
- if (!selection.isEmpty()) {
-
- int start= selection.getOffset();
- int length= selection.getLength();
-
- if (length < 0) {
- length= -length;
- start -= length;
- }
-
- MarkerUtilities.setCharStart(attributes, start);
- MarkerUtilities.setCharEnd(attributes, start + length);
-
- // marker line numbers are 1-based
- int line= selection.getStartLine();
- MarkerUtilities.setLineNumber(attributes, line == -1 ? -1 : line + 1);
-
- // set custom attribute values
- for (int i = 0; i < customAttributes.length; i++) {
- attributes.put(customAttributes[i][0], customAttributes[i][1]);
- }
-
- MarkerUtilities.setMessage(attributes, message);
- }
-
- try {
- MarkerUtilities.createMarker(getResource(), attributes, MARKER_TYPE);
- } catch (CoreException x) {
- Platform.getPlugin(PlatformUI.PLUGIN_ID).getLog().log(x.getStatus());
-
- Shell shell= textEditor.getSite().getShell();
- String title= MessageUtil.getString("Add_readme_marker_error_title"); //$NON-NLS-1$
- String msg= MessageUtil.getString("Add_readme_marker_error_message"); //$NON-NLS-1$
-
- ErrorDialog.openError(shell, title, msg, x.getStatus());
- }
- }
-
- /**
- * Returns the resource on which to create the marker,
- * or <code>null</code> if there is no applicable resource. This
- * queries the editor's input using <code>getAdapter(IResource.class)</code>.
- *
- * @return the resource to which to attach the newly created marker
- */
- protected IResource getResource() {
- IEditorInput input= textEditor.getEditorInput();
- return (IResource) ((IAdaptable) input).getAdapter(IResource.class);
- }
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AddSentenceResolution.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AddSentenceResolution.java
deleted file mode 100644
index 75b3e9b..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AddSentenceResolution.java
+++ /dev/null
@@ -1,79 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IMarkerResolution;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.FileEditorInput;
-
-/**
- * A resolution which inserts a sentence into the readme file
- */
-public class AddSentenceResolution implements IMarkerResolution {
- /* (non-Javadoc)
- * Method declared on IMarkerResolution.
- */
- public String getLabel() {
- return MessageUtil.getString("Add_Sentence"); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on IMarkerResolution.
- */
- public void run(IMarker marker) {
- // Se if there is an open editor on the file containing the marker
- IWorkbenchWindow w = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
- if (w == null)
- return;
- IWorkbenchPage page = w.getActivePage();
- if (page == null)
- return;
- IFileEditorInput input = new FileEditorInput((IFile)marker.getResource());
- IEditorPart editorPart = page.findEditor(input);
-
- if (editorPart == null) {
- // open an editor
- try {
- editorPart = page.openEditor((IFile)marker.getResource());
- } catch (PartInitException e) {
- MessageDialog.openError(
- w.getShell(),
- MessageUtil.getString("Resolution_Error"), //$NON-NLS-1$
- MessageUtil.getString("Unable_to_open_file_editor")); //$NON-NLS-1$
- }
- }
- if (editorPart == null || !(editorPart instanceof ReadmeEditor))
- return;
- // insert the sentence
- ReadmeEditor editor = (ReadmeEditor)editorPart;
- IDocument doc = editor.getDocumentProvider().getDocument(editor.getEditorInput());
- String s = MessageUtil.getString("Simple_sentence"); //$NON-NLS-1$
- try {
- doc.replace(marker.getAttribute(IMarker.CHAR_START, -1), 0, s);
- } catch (BadLocationException e) {
- // ignore
- return;
- }
- // delete the marker
- try {
- marker.delete();
- } catch (CoreException e) {
- e.printStackTrace();
- // ignore
- }
-
- }
-
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/DefaultSectionsParser.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/DefaultSectionsParser.java
deleted file mode 100644
index 4f8cbb0..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/DefaultSectionsParser.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.CoreException;
-import java.io.*;
-import java.util.Enumeration;
-import java.util.Hashtable;
-import java.util.Vector;
-
-/**
- * This class is a simple parser implementing the IReadmeFileParser
- * interface. It parses a Readme file into sections based on the
- * existence of numbered section tags in the input. A line beginning
- * with a number followed by a dot will be taken as a section indicator
- * (for example, 1., 2., or 12.).
- * As well, a line beginning with a subsection-style series of numbers
- * will also be taken as a section indicator, and can be used to
- * indicate subsections (for example, 1.1, or 1.1.12).
- */
-public class DefaultSectionsParser implements IReadmeFileParser {
-/**
- * Returns the mark element that is the logical parent
- * of the given mark number. Each dot in a mark number
- * represents a parent-child separation. For example,
- * the parent of 1.2 is 1, the parent of 1.4.1 is 1.4.
- * Returns null if there is no appropriate parent.
- */
-protected IAdaptable getParent(Hashtable toc, String number) {
- int lastDot = number.lastIndexOf('.');
- if (lastDot < 0)
- return null;
- String parentNumber = number.substring(0, lastDot);
- return (IAdaptable) toc.get(parentNumber);
-}
-/**
- * Returns a string containing the contents of the given
- * file. Returns an empty string if there were any errors
- * reading the file.
- */
-protected String getText(IFile file) {
- try {
- InputStream in = file.getContents();
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- byte[] buf = new byte[1024];
- int read = in.read(buf);
- while (read > 0) {
- out.write(buf, 0, read);
- read = in.read(buf);
- }
- return out.toString();
- } catch (CoreException e) {
- } catch (IOException e) {
- }
- return ""; //$NON-NLS-1$
-}
-/**
- * Parses the input given by the argument.
- *
- * @param file the element containing the input text
- * @return an element collection representing the parsed input
- */
-public MarkElement[] parse(IFile file) {
- Hashtable markTable = new Hashtable(40);
- Vector topLevel = new Vector();
- String s = getText(file);
- int start = 0;
- int end = -1;
- int lineno = 0;
- int lastlineno = 0;
- MarkElement lastme = null;
- int ix;
-
- // parse content for headings
- ix = s.indexOf('\n', start);
- while (ix != -1) {
- start = end + 1;
- end = ix = s.indexOf('\n', start);
- lineno++;
- if (ix != -1) {
- // skip blanks
- while (s.charAt(start) == ' ' || s.charAt(start) == '\t') {
- start++;
- }
- if (Character.isDigit(s.charAt(start))) {
- if (lastme != null) {
- lastme.setNumberOfLines(lineno - lastlineno - 1);
- }
- lastlineno = lineno;
- String markName = parseHeading(s, start, end);
-
- //get the parent mark, if any.
- String markNumber = parseNumber(markName);
- IAdaptable parent = getParent(markTable, markNumber);
- if (parent == null)
- parent = file;
-
- MarkElement me = new MarkElement(parent, markName, start, end - start);
- lastme = me;
-
- markTable.put(markNumber, me);
- if (parent == file) {
- topLevel.add(me);
- }
- }
- }
- }
- if (lastme != null) {
- // set the number of lines for the last section
- lastme.setNumberOfLines(lineno - lastlineno - 1);
- }
- MarkElement[] results = new MarkElement[topLevel.size()];
- topLevel.copyInto(results);
- return results;
-}
-/**
- * Creates a section name from the buffer and trims trailing
- * space characters.
- *
- * @param buffer the string from which to create the section name
- * @param start the start index
- * @param end the end index
- * @return a section name
- */
-private String parseHeading(String buffer, int start, int end) {
- while (Character.isWhitespace(buffer.charAt(end-1)) && end >start) {
- end--;
- }
- return buffer.substring(start, end);
-}
-/**
- * Returns the number for this heading. A heading consists
- * of a number (an arbitrary string of numbers and dots), followed by
- * arbitrary text.
- */
-protected String parseNumber(String heading) {
- int start = 0;
- int end = heading.length();
- char c;
- do {
- c = heading.charAt(start++);
- } while ((c == '.' || Character.isDigit(c)) && start < end);
-
- //disregard trailing dots
- while (heading.charAt(start-1) == '.' && start > 0) {
- start--;
- }
- return heading.substring(0, start);
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/DirtyStateContribution.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/DirtyStateContribution.java
deleted file mode 100644
index 750fb71..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/DirtyStateContribution.java
+++ /dev/null
@@ -1,85 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-
-/**
- * This class demonstrates the contribution of a custom control to the
- * status line for the readme editor. The control shows the
- * dirty status of the editor.
- */
-public class DirtyStateContribution extends ControlContribution
- implements IPropertyListener
-{
- private Composite composite;
- private Label label;
- private IEditorPart activeEditor;
-/**
- * Creates a new DirtyStateContribution.
- */
-protected DirtyStateContribution() {
- super("DirtyState"); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on ControlContribution
- */
-protected Control createControl(Composite parent) {
- // If the composite is good just return it.
- if (composite != null && !composite.isDisposed())
- return composite;
-
- // Create composite for border.
- composite = new Composite(parent, SWT.BORDER);
- composite.setData(this);
-
- // Create label inside composite.
- label = new Label(composite, SWT.NONE);
- label.setSize(80, 15);
-
- updateState();
- return composite;
-}
-/**
- * Called when an editor is activated.
- *
- * @see ReadmeEditorActionBarContributor#setActiveEditor(IEditorPart)
- */
-public void editorChanged(IEditorPart part) {
- if (activeEditor != null) {
- activeEditor.removePropertyListener(this);
- }
- activeEditor = part;
- if (activeEditor != null) {
- activeEditor.addPropertyListener(this);
- }
- updateState();
-}
-/* (non-Javadoc)
- * Method declared on IPropertyListener
- */
-public void propertyChanged(Object source, int propID) {
- if (source instanceof IEditorPart)
- updateState();
-}
-/**
- * Updates the state of the label.
- */
-private void updateState() {
- if (label == null || label.isDisposed())
- return;
-
- boolean saveNeeded = false;
- if (activeEditor != null)
- saveNeeded = activeEditor.isDirty();
- if (saveNeeded)
- label.setText(MessageUtil.getString("Save_Needed")); //$NON-NLS-1$
- else
- label.setText(MessageUtil.getString("Clean")); //$NON-NLS-1$
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/EditorActionDelegate.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/EditorActionDelegate.java
deleted file mode 100644
index c5db722..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/EditorActionDelegate.java
+++ /dev/null
@@ -1,62 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.*;
-
-/**
- * This class is used to demonstrate editor action extensions.
- * An extension should be defined in the readme plugin.xml.
- */
-public class EditorActionDelegate implements IEditorActionDelegate {
- private IEditorPart editor;
-/**
- * Creates a new EditorActionDelegate.
- */
-public EditorActionDelegate() {
-}
-/* (non-Javadoc)
- * Method declared on IActionDelegate
- */
-public void run(IAction action) {
- MessageDialog.openInformation(editor.getSite().getShell(),
- MessageUtil.getString("Readme_Editor"), //$NON-NLS-1$
- MessageUtil.getString("Editor_Action_executed")); //$NON-NLS-1$
-}
-/**
- * The <code>EditorActionDelegate</code> implementation of this
- * <code>IActionDelegate</code> method
- *
- * Selection in the desktop has changed. Plugin provider
- * can use it to change the availability of the action
- * or to modify other presentation properties.
- *
- * <p>Action delegate cannot be notified about
- * selection changes before it is loaded. For that reason,
- * control of action's enable state should also be performed
- * through simple XML rules defined for the extension
- * point. These rules allow enable state control before
- * the delegate has been loaded.</p>
- */
-public void selectionChanged(IAction action, ISelection selection) {
-}
-/**
- * The <code>EditorActionDelegate</code> implementation of this
- * <code>IEditorActionDelegate</code> method
- *
- * The matching editor has been activated. Notification
- * guarantees that only editors that match the type for which
- * this action has been registered will be tracked.
- *
- * @param action action proxy that represents this delegate in the desktop
- * @param editor the matching editor that has been activated
- */
-public void setActiveEditor(IAction action, IEditorPart editor) {
- this.editor = editor;
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/IReadmeConstants.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/IReadmeConstants.java
deleted file mode 100644
index 5869b87..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/IReadmeConstants.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-/**
- * This interface contains constants for use only within the
- * Readme example.
- */
-public interface IReadmeConstants {
- public static final String PLUGIN_ID ="org.eclipse.ui.examples.readmetool"; //$NON-NLS-1$
- public static final String PREFIX = PLUGIN_ID+"."; //$NON-NLS-1$
- public static final String P_CONTENT_OUTLINE=PREFIX+"content_outline"; //$NON-NLS-1$
- public static final String P_SECTIONS=PREFIX+"sections"; //$NON-NLS-1$
- public static final String EXTENSION = "readme"; //$NON-NLS-1$
- public static final String TAG_PARSER = "parser"; //$NON-NLS-1$
- public static final String ATT_CLASS = "class"; //$NON-NLS-1$
- public static final String PP_SECTION_PARSER = "sectionParser"; //$NON-NLS-1$
-
- // Global actions
- public static final String RETARGET2 = PREFIX + "retarget2";
- public static final String LABELRETARGET3 = PREFIX + "labelretarget3";
-
- public static final String ACTION_SET_RETARGET4 = "org_eclipse_ui_examples_readmetool_readmeRetargetAction";
- public static final String ACTION_SET_LABELRETARGET5 = "org_eclipse_ui_examples_readmetool_readmeRelabelRetargetAction";
-
- // Preference constants
- public static final String PRE_CHECK1=PREFIX+"check1"; //$NON-NLS-1$
- public static final String PRE_CHECK2=PREFIX+"check2"; //$NON-NLS-1$
- public static final String PRE_CHECK3=PREFIX+"check3"; //$NON-NLS-1$
- public static final String PRE_RADIO_CHOICE = PREFIX+"radio_choice"; //$NON-NLS-1$
- public static final String PRE_TEXT = PREFIX+"text"; //$NON-NLS-1$
-
- // Help context ids
- public static final String EDITOR_ACTION1_CONTEXT = PREFIX+"editor_action1_context"; //$NON-NLS-1$
- public static final String EDITOR_ACTION2_CONTEXT = PREFIX+"editor_action2_context"; //$NON-NLS-1$
- public static final String EDITOR_ACTION3_CONTEXT = PREFIX+"editor_action3_context"; //$NON-NLS-1$
- public static final String SECTIONS_VIEW_CONTEXT = PREFIX+"sections_view_context"; //$NON-NLS-1$
- public static final String PREFERENCE_PAGE_CONTEXT = PREFIX+"preference_page_context"; //$NON-NLS-1$
- public static final String PROPERTY_PAGE_CONTEXT = PREFIX+"property_page_context"; //$NON-NLS-1$
- public static final String PROPERTY_PAGE2_CONTEXT = PREFIX+"property_page2_context"; //$NON-NLS-1$
- public static final String EDITOR_CONTEXT = PREFIX+"editor_context"; //$NON-NLS-1$
- public static final String SECTIONS_DIALOG_CONTEXT = PREFIX+"sections_dialog_context"; //$NON-NLS-1$
- public static final String CONTENT_OUTLINE_PAGE_CONTEXT = PREFIX+"content_outline_page_context"; //$NON-NLS-1$
- public static final String CREATION_WIZARD_PAGE_CONTEXT = PREFIX+"creation_wizard_page_context"; //$NON-NLS-1$
-
- // Marker attributes
- public static final String MARKER_ATT_ID = PREFIX+"id"; //$NON-NLS-1$
- public static final String MARKER_ATT_LEVEL = PREFIX+"level"; //$NON-NLS-1$
- public static final String MARKER_ATT_DEPT = PREFIX+"department"; //$NON-NLS-1$
- public static final String MARKER_ATT_CODE = PREFIX+"code"; //$NON-NLS-1$
- public static final String MARKER_ATT_LANG = PREFIX+"language"; //$NON-NLS-1$
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/IReadmeFileParser.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/IReadmeFileParser.java
deleted file mode 100644
index 3f51c06..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/IReadmeFileParser.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-
-/**
- * This interface is used as API for the Readme parser extension
- * point. The default implementation simply looks for lines
- * in the file that start with a number and assumes that they
- * represent sections. Tools are allowed to replace this
- * algorithm by defining an extension and supplying an
- * alternative that implements this interface.
- */
-public interface IReadmeFileParser {
-/**
- * Parses the contents of the provided file
- * and generates a collection of sections.
- */
-public MarkElement[] parse(IFile readmeFile);
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MarkElement.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MarkElement.java
deleted file mode 100644
index e611e8e..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MarkElement.java
+++ /dev/null
@@ -1,128 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.model.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import java.util.Iterator;
-import java.util.Vector;
-
-/**
- * This class represents a marked location in the Readme
- * file text.
- *
- * TIP: By implementing the <code>IWorkbenchAdapter</code> interface,
- * we can easily add objects of this type to viewers and parts in
- * the workbench. When a viewer contains <code>IWorkbenchAdapter</code>,
- * the generic <code>WorkbenchContentProvider</code> and
- * <code>WorkbenchLabelProvider</code> can be used to provide
- * navigation and display for that viewer.
- */
-public class MarkElement implements IWorkbenchAdapter,IAdaptable {
- private String headingName;
- private IAdaptable parent;
- private int offset;
- private int numberOfLines;
- private int length;
- private Vector children;
-/**
- * Creates a new MarkElement and stores parent element and
- * location in the text.
- *
- * @param parent the parent of this element
- * @param heading text corresponding to the heading
- * @param offset the offset into the Readme text
- * @param length the length of the element
- */
-public MarkElement(IAdaptable parent, String heading, int offset, int length) {
- this.parent = parent;
- if (parent instanceof MarkElement) {
- ((MarkElement)parent).addChild(this);
- }
- this.headingName = heading;
- this.offset = offset;
- this.length = length;
-}
-/**
- * Adds a child to this element
- */
-private void addChild(MarkElement child) {
- if (children == null) {
- children = new Vector();
- }
- children.add(child);
-}
-/* (non-Javadoc)
- * Method declared on IAdaptable
- */
-public Object getAdapter(Class adapter) {
- if (adapter == IWorkbenchAdapter.class)
- return this;
- if (adapter == IPropertySource.class)
- return new MarkElementProperties(this);
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchAdapter
- */
-public Object[] getChildren(Object object) {
- if (children != null) {
- return children.toArray();
- }
- return new Object[0];
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchAdapter
- */
-public ImageDescriptor getImageDescriptor(Object object) {
- IWorkbenchAdapter parentElement = (IWorkbenchAdapter)parent.getAdapter(IWorkbenchAdapter.class);
- if (parentElement != null) {
- return parentElement.getImageDescriptor(object);
- }
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchAdapter
- */
-public String getLabel(Object o) {
- return headingName;
-}
-/**
- * Returns the number of characters in this section.
- */
-public int getLength() {
- return length;
-}
-/**
- * Returns the number of lines in the element.
- *
- * @return the number of lines in the element
- */
-public int getNumberOfLines() {
- return numberOfLines;
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchAdapter
- */
-public Object getParent(Object o) {
- return null;
-}
-/**
- * Returns the offset of this section in the file.
- */
-public int getStart() {
- return offset;
-}
-/**
- * Sets the number of lines in the element
- *
- * @param newNumberOfLines the number of lines in the element
- */
-public void setNumberOfLines(int newNumberOfLines) {
- numberOfLines = newNumberOfLines;
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MarkElementProperties.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MarkElementProperties.java
deleted file mode 100644
index 7120ae8..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MarkElementProperties.java
+++ /dev/null
@@ -1,87 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.views.properties.*;
-import org.eclipse.ui.views.properties.*;
-import java.util.List;
-import java.util.Vector;
-
-/**
- * This class encapsulates property sheet properties
- * for MarkElement. This will display properties for
- * the MarkElement when selected in the readme editor's
- * content outline.
- */
-public class MarkElementProperties implements IPropertySource {
- protected MarkElement element;
-
- protected static final String PROPERTY_LINECOUNT = "lineno"; //$NON-NLS-1$
- protected static final String PROPERTY_START = "start"; //$NON-NLS-1$
- protected static final String PROPERTY_LENGTH = "length"; //$NON-NLS-1$
-/**
- * Creates a new MarkElementProperties.
- *
- * @param element the element whose properties this instance represents
- */
-public MarkElementProperties(MarkElement element) {
- super();
- this.element = element;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public Object getEditableValue() {
- return this;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public IPropertyDescriptor[] getPropertyDescriptors() {
- // Create the property vector.
- IPropertyDescriptor[] propertyDescriptors = new IPropertyDescriptor[3];
-
- // Add each property supported.
- PropertyDescriptor descriptor;
-
- descriptor = new PropertyDescriptor(PROPERTY_LINECOUNT, MessageUtil.getString("Line_count")); //$NON-NLS-1$
- propertyDescriptors[0] = descriptor;
- descriptor = new PropertyDescriptor(PROPERTY_START, MessageUtil.getString("Title_start")); //$NON-NLS-1$
- propertyDescriptors[1] = descriptor;
- descriptor = new PropertyDescriptor(PROPERTY_LENGTH, MessageUtil.getString("Title_length")); //$NON-NLS-1$
- propertyDescriptors[2] = descriptor;
-
- // Return it.
- return propertyDescriptors;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public Object getPropertyValue(Object name) {
- if (name.equals(PROPERTY_LINECOUNT))
- return new Integer(element.getNumberOfLines());
- if (name.equals(PROPERTY_START))
- return new Integer(element.getStart());
- if (name.equals(PROPERTY_LENGTH))
- return new Integer(element.getLength());
- return null;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public boolean isPropertySet(Object property) {
- return false;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public void resetPropertyValue(Object property) {
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource
- */
-public void setPropertyValue(Object name, Object value) {
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MessageUtil.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MessageUtil.java
deleted file mode 100644
index 75d1815..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MessageUtil.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-package org.eclipse.ui.examples.readmetool;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps with managing messages.
- */
-/* package */ class MessageUtil {
-
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.examples.readmetool.messages";//$NON-NLS-1$
-
- private static ResourceBundle fgResourceBundle= ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
- private MessageUtil() {
- // prevent instantiation of class
- }
-
- /**
- * Returns the formatted message for the given key in
- * the resource bundle.
- *
- * @param key the resource name
- * @param args the message arguments
- * @return the string
- */
- public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key),args);
- }
-
- /**
- * Returns the resource object with the given key in
- * the resource bundle. If there isn't any value under
- * the given key, the key is returned, surrounded by '!'s.
- *
- * @param key the resource name
- * @return the string
- */
- public static String getString(String key) {
- try {
- return fgResourceBundle.getString(key);
- } catch (MissingResourceException e) {
- return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
- }
- }
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/PopupMenuActionDelegate.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/PopupMenuActionDelegate.java
deleted file mode 100644
index d9e53d1..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/PopupMenuActionDelegate.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-
-/**
- * Action delegate for handling popup menu actions on a readme file.
- */
-public class PopupMenuActionDelegate implements IObjectActionDelegate {
-
- private IWorkbenchPart part;
-/** (non-Javadoc)
- * Method declared on IDropActionDelegate
- */
-public void run(IAction action) {
- MessageDialog.openInformation(
- this.part.getSite().getShell(),
- MessageUtil.getString("Readme_Example"), //$NON-NLS-1$
- MessageUtil.getString("Popup_Menu_Action_executed")); //$NON-NLS-1$
-}
-/** (non-Javadoc)
- * Method declared on IActionDelegate
- */
-public void selectionChanged(IAction action, ISelection selection) {
- //Ignored for this example
-}
-/** (non-Javadoc)
- * Method declared on IObjectActionDelegate
- */
-public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- this.part = targetPart;
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeContentOutlineDragListener.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeContentOutlineDragListener.java
deleted file mode 100644
index fbd6b46..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeContentOutlineDragListener.java
+++ /dev/null
@@ -1,58 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.part.PluginTransfer;
-import org.eclipse.ui.part.PluginTransferData;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.dnd.*;
-
-/**
- * A drag listener for the readme editor's content outline page.
- * Allows dragging of content segments into views that support
- * the <code>TextTransfer</code> or <code>PluginTransfer</code> transfer types.
- */
-public class ReadmeContentOutlineDragListener extends DragSourceAdapter {
- private ReadmeContentOutlinePage page;
-/**
- * Creates a new drag listener for the given page.
- */
-public ReadmeContentOutlineDragListener(ReadmeContentOutlinePage page) {
- this.page = page;
-}
-/* (non-Javadoc)
- * Method declared on DragSourceListener
- */
-public void dragSetData(DragSourceEvent event) {
- if (PluginTransfer.getInstance().isSupportedType(event.dataType)) {
- byte[] segmentData = getSegmentText().getBytes();
- event.data = new PluginTransferData(ReadmeDropActionDelegate.ID, segmentData);
- return;
- }
- if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
- event.data = getSegmentText();
- return;
- }
-}
-/**
- * Returns the text of the currently selected readme segment.
- */
-private String getSegmentText() {
- StringBuffer result = new StringBuffer();
- ISelection selection = page.getSelection();
- if (selection instanceof org.eclipse.jface.viewers.IStructuredSelection) {
- Object[] selected = ((IStructuredSelection) selection).toArray();
- result.append("\n"); //$NON-NLS-1$
- for (int i = 0; i < selected.length; i++) {
- if (selected[i] instanceof MarkElement) {
- result.append(((MarkElement) selected[i]).getLabel(selected[i]));
- result.append("\n"); //$NON-NLS-1$
- }
- }
- }
- return result.toString();
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeContentOutlinePage.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeContentOutlinePage.java
deleted file mode 100644
index 7853c22..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeContentOutlinePage.java
+++ /dev/null
@@ -1,132 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.resources.*;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.ui.model.*;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.part.PluginTransfer;
-import org.eclipse.ui.views.contentoutline.*;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * Content outline page for the readme editor.
- */
-public class ReadmeContentOutlinePage extends ContentOutlinePage {
- protected IFile input;
-
- class OutlineAction extends Action {
- private Shell shell;
- public OutlineAction(String label) {
- super(label);
- getTreeViewer().addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- setEnabled(!event.getSelection().isEmpty());
- }
- });
- }
- public void setShell(Shell shell) {
- this.shell = shell;
- }
- public void run() {
- MessageDialog.openInformation(shell,
- MessageUtil.getString("Readme_Outline"), //$NON-NLS-1$
- MessageUtil.getString("ReadmeOutlineActionExecuted")); //$NON-NLS-1$
- }
- }
-
-/**
- * Creates a new ReadmeContentOutlinePage.
- */
-public ReadmeContentOutlinePage(IFile input) {
- super();
- this.input = input;
-}
-/**
- * Creates the control and registers the popup menu for this page
- * Menu id "org.eclipse.ui.examples.readmetool.outline"
- */
-public void createControl(Composite parent) {
- super.createControl(parent);
-
- WorkbenchHelp.setHelp(getControl(), IReadmeConstants.CONTENT_OUTLINE_PAGE_CONTEXT);
-
- TreeViewer viewer = getTreeViewer();
- viewer.setContentProvider(new WorkbenchContentProvider());
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.setInput(getContentOutline(input));
- initDragAndDrop();
-
- // Configure the context menu.
- MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS+"-end")); //$NON-NLS-1$
-
- Menu menu = menuMgr.createContextMenu(viewer.getTree());
- viewer.getTree().setMenu(menu);
- // Be sure to register it so that other plug-ins can add actions.
- getSite().registerContextMenu("org.eclipse.ui.examples.readmetool.outline", menuMgr, viewer); //$NON-NLS-1$
-
- getSite().getActionBars().setGlobalActionHandler(
- IReadmeConstants.RETARGET2,
- new OutlineAction(MessageUtil.getString("Outline_Action2"))); //$NON-NLS-1$
-
- OutlineAction action = new OutlineAction(MessageUtil.getString("Outline_Action3")); //$NON-NLS-1$
- action.setToolTipText(MessageUtil.getString("Readme_Outline_Action3")); //$NON-NLS-1$
- getSite().getActionBars().setGlobalActionHandler(
- IReadmeConstants.LABELRETARGET3,
- action);
- action = new OutlineAction(MessageUtil.getString("Outline_Action4")); //$NON-NLS-1$
- getSite().getActionBars().setGlobalActionHandler(
- IReadmeConstants.ACTION_SET_RETARGET4,
- action);
- action = new OutlineAction(MessageUtil.getString("Outline_Action5")); //$NON-NLS-1$
- action.setToolTipText(MessageUtil.getString("Readme_Outline_Action5")); //$NON-NLS-1$
- getSite().getActionBars().setGlobalActionHandler(
- IReadmeConstants.ACTION_SET_LABELRETARGET5,
- action);
-}
-/**
- * Gets the content outline for a given input element.
- * Returns the outline (a list of MarkElements), or null
- * if the outline could not be generated.
- */
-private IAdaptable getContentOutline(IAdaptable input) {
- return ReadmeModelFactory.getInstance().getContentOutline(input);
-}
-/**
- * Initializes drag and drop for this content outline page.
- */
-private void initDragAndDrop() {
- int ops = DND.DROP_COPY | DND.DROP_MOVE;
- Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), PluginTransfer.getInstance()};
- getTreeViewer().addDragSupport(ops, transfers, new ReadmeContentOutlineDragListener(this));
-}
-/**
- * Forces the page to update its contents.
- *
- * @see ReadmeEditor#doSave(IProgressMonitor)
- */
-public void update() {
- getControl().setRedraw(false);
- getTreeViewer().setInput(getContentOutline(input));
- getTreeViewer().expandAll();
- getControl().setRedraw(true);
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeCreationPage.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeCreationPage.java
deleted file mode 100644
index 2ba1ead..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeCreationPage.java
+++ /dev/null
@@ -1,170 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-
-/**
- * This class is the only page of the Readme file resource creation wizard.
- * It subclasses the standard file resource creation page class,
- * and consequently inherits the file resource creation functionality.
- *
- * This page provides users with the choice of creating sample headings for
- * sections and subsections. Additionally, the option is presented to open
- * the file immediately for editing after creation.
- */
-public class ReadmeCreationPage extends WizardNewFileCreationPage {
- private IWorkbench workbench;
-
- // widgets
- private Button sectionCheckbox;
- private Button subsectionCheckbox;
- private Button openFileCheckbox;
-
- // constants
- private static int nameCounter = 1;
-/**
- * Creates the page for the readme creation wizard.
- *
- * @param workbench the workbench on which the page should be created
- * @param selection the current selection
- */
-public ReadmeCreationPage(IWorkbench workbench, IStructuredSelection selection) {
- super("sampleCreateReadmePage1", selection); //$NON-NLS-1$
- this.setTitle(MessageUtil.getString("Create_Readme_File")); //$NON-NLS-1$
- this.setDescription(MessageUtil.getString("Create_a_new_Readme_file_resource")); //$NON-NLS-1$
- this.workbench = workbench;
-}
-/** (non-Javadoc)
- * Method declared on IDialogPage.
- */
-public void createControl(Composite parent) {
- // inherit default container and name specification widgets
- super.createControl(parent);
- Composite composite = (Composite)getControl();
-
- WorkbenchHelp.setHelp(composite, IReadmeConstants.CREATION_WIZARD_PAGE_CONTEXT);
-
- GridData data = (GridData)composite.getLayoutData();
- this.setFileName("sample" + nameCounter + ".readme"); //$NON-NLS-1$ //$NON-NLS-2$
-
- // sample section generation group
- Group group = new Group(composite,SWT.NONE);
- group.setLayout(new GridLayout());
- group.setText(MessageUtil.getString("Automatic_sample_section_generation")); //$NON-NLS-1$
- group.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
-
- // sample section generation checkboxes
- sectionCheckbox = new Button(group,SWT.CHECK);
- sectionCheckbox.setText(MessageUtil.getString("Generate_sample_section_titles")); //$NON-NLS-1$
- sectionCheckbox.setSelection(true);
- sectionCheckbox.addListener(SWT.Selection,this);
-
- subsectionCheckbox = new Button(group,SWT.CHECK);
- subsectionCheckbox.setText(MessageUtil.getString("Generate_sample_subsection_titles")); //$NON-NLS-1$
- subsectionCheckbox.setSelection(true);
- subsectionCheckbox.addListener(SWT.Selection,this);
-
- // open file for editing checkbox
- openFileCheckbox = new Button(composite,SWT.CHECK);
- openFileCheckbox.setText(MessageUtil.getString("Open_file_for_editing_when_done")); //$NON-NLS-1$
- openFileCheckbox.setSelection(true);
-
- setPageComplete(validatePage());
-
-}
-/**
- * Creates a new file resource as requested by the user. If everything
- * is OK then answer true. If not, false will cause the dialog
- * to stay open.
- *
- * @return whether creation was successful
- * @see ReadmeCreationWizard#performFinish()
- */
-public boolean finish() {
- // create the new file resource
- IFile newFile = createNewFile();
- if (newFile == null)
- return false; // ie.- creation was unsuccessful
-
- // Since the file resource was created fine, open it for editing
- // if requested by the user
- try {
- if (openFileCheckbox.getSelection()) {
- IWorkbenchWindow dwindow = workbench.getActiveWorkbenchWindow();
- IWorkbenchPage page = dwindow.getActivePage();
- if (page != null)
- page.openEditor(newFile);
- }
- } catch (PartInitException e) {
- e.printStackTrace();
- return false;
- }
- nameCounter++;
- return true;
-}
-/**
- * The <code>ReadmeCreationPage</code> implementation of this
- * <code>WizardNewFileCreationPage</code> method
- * generates sample headings for sections and subsections in the
- * newly-created Readme file according to the selections of self's
- * checkbox widgets
- */
-protected InputStream getInitialContents() {
- if (!sectionCheckbox.getSelection())
- return null;
-
- StringBuffer sb = new StringBuffer();
- sb.append(MessageUtil.getString("SAMPLE_README_FILE")); //$NON-NLS-1$
- sb.append(MessageUtil.getString("SECTION_1")); //$NON-NLS-1$
- sb.append(MessageUtil.getString("SECTION_1_BODY_1")); //$NON-NLS-1$
-
- if (subsectionCheckbox.getSelection()) {
- sb.append(MessageUtil.getString("Subsection_1_1")); //$NON-NLS-1$
- sb.append(MessageUtil.getString("Subsection_1_1_Body_1")); //$NON-NLS-1$
- }
-
- sb.append(MessageUtil.getString("SECTION_2")); //$NON-NLS-1$
- sb.append(MessageUtil.getString("SECTION_2_BODY_1")); //$NON-NLS-1$
- sb.append(MessageUtil.getString("SECTION_2_BODY_2")); //$NON-NLS-1$
-
- if (subsectionCheckbox.getSelection()) {
- sb.append(MessageUtil.getString("Subsection_2_1")); //$NON-NLS-1$
- sb.append(MessageUtil.getString("Subsection_2_1_BODY_1")); //$NON-NLS-1$
- sb.append(MessageUtil.getString("Subsection_2_2")); //$NON-NLS-1$
- sb.append(MessageUtil.getString("Subsection_2_2_BODY_1")); //$NON-NLS-1$
- }
-
- return new ByteArrayInputStream(sb.toString().getBytes());
-}
-/** (non-Javadoc)
- * Method declared on WizardNewFileCreationPage.
- */
-protected String getNewFileLabel() {
- return MessageUtil.getString("Readme_file_name"); //$NON-NLS-1$
-}
-/** (non-Javadoc)
- * Method declared on WizardNewFileCreationPage.
- */
-public void handleEvent(Event e) {
- Widget source = e.widget;
-
- if (source == sectionCheckbox) {
- if (!sectionCheckbox.getSelection())
- subsectionCheckbox.setSelection(false);
- subsectionCheckbox.setEnabled(sectionCheckbox.getSelection());
- }
-
- super.handleEvent(e);
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeCreationWizard.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeCreationWizard.java
deleted file mode 100644
index d06fa2a..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeCreationWizard.java
+++ /dev/null
@@ -1,42 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-
-/**
- * This class implements the interface required by the desktop
- * for all 'New' wizards. This wizard creates readme files.
- */
-public class ReadmeCreationWizard extends Wizard implements INewWizard {
- private IStructuredSelection selection;
- private IWorkbench workbench;
- private ReadmeCreationPage mainPage;
-/** (non-Javadoc)
- * Method declared on Wizard.
- */
-public void addPages() {
- mainPage = new ReadmeCreationPage(workbench, selection);
- addPage(mainPage);
-}
-/** (non-Javadoc)
- * Method declared on INewWizard
- */
-public void init(IWorkbench workbench,IStructuredSelection selection) {
- this.workbench = workbench;
- this.selection = selection;
- setWindowTitle(MessageUtil.getString("New_Readme_File")); //$NON-NLS-1$
- setDefaultPageImageDescriptor(ReadmeImages.README_WIZARD_BANNER);
-}
-/** (non-Javadoc)
- * Method declared on IWizard
- */
-public boolean performFinish() {
- return mainPage.finish();
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeDropActionDelegate.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeDropActionDelegate.java
deleted file mode 100644
index 0919590..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeDropActionDelegate.java
+++ /dev/null
@@ -1,36 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.part.IDropActionDelegate;
-import java.io.ByteArrayInputStream;
-
-/**
- * Adapter for handling the dropping of readme segments into
- * another plugin. In this case, we expect the segments
- * to be dropped onto <code>IFile</code> object, or an adapter
- * that supports <code>IFile</code>.
- */
-public class ReadmeDropActionDelegate implements IDropActionDelegate {
- public static final String ID = "org_eclipse_ui_examples_readmetool_drop_actions"; //$NON-NLS-1$
-/** (non-Javadoc)
- * Method declared on IDropActionDelegate
- */
-public boolean run(Object source, Object target) {
- if (source instanceof byte[] && target instanceof IFile) {
- IFile file = (IFile)target;
- try {
- file.appendContents(new ByteArrayInputStream((byte[])source), false, true, null);
- } catch (CoreException e) {
- System.out.println(MessageUtil.getString("Exception_in_readme_drop_adapter") + e.getStatus().getMessage()); //$NON-NLS-1$
- return false;
- }
- return true;
- }
- return false;
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeEditor.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeEditor.java
deleted file mode 100644
index 9b7e52d..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeEditor.java
+++ /dev/null
@@ -1,125 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-
-/**
- * This class implements the Readme editor. Since the readme
- * editor is mostly just a text editor, there is very little
- * implemented in this actual class. It can be regarded as
- * simply decorating the text editor with a content outline.
- */
-public class ReadmeEditor extends TextEditor {
- protected ReadmeContentOutlinePage page;
-
- private final static String ATT_1 = IReadmeConstants.PREFIX + "attribute1"; //$NON-NLS-1$
- private final static String ATT_2 = IReadmeConstants.PREFIX + "attribute2"; //$NON-NLS-1$
- private final static String ATT_3 = IReadmeConstants.PREFIX + "attribute3"; //$NON-NLS-1$
- private final static String ATT_4 = IReadmeConstants.PREFIX + "attribute4"; //$NON-NLS-1$
- private final static String ATT_5 = IReadmeConstants.PREFIX + "attribute5"; //$NON-NLS-1$
-
- /**
- * Creates a new ReadmeEditor.
- */
- public ReadmeEditor() {
- super();
- }
- /** (non-Javadoc)
- * Method declared on IEditorPart
- */
- public void doSave(IProgressMonitor monitor) {
- super.doSave(monitor);
- if (page != null)
- page.update();
- }
- /** (non-Javadoc)
- * Method declared on IAdaptable
- */
- public Object getAdapter(Class key) {
- if (key.equals(IContentOutlinePage.class)) {
- IEditorInput input = getEditorInput();
- if (input instanceof IFileEditorInput) {
- page = new ReadmeContentOutlinePage(((IFileEditorInput)input).getFile());
- return page;
- }
- }
- return super.getAdapter(key);
- }
-
- /** (non-Javadoc)
- * Method declared on AbstractTextEditor
- */
- protected void editorContextMenuAboutToShow(IMenuManager parentMenu) {
- super.editorContextMenuAboutToShow(parentMenu);
- parentMenu.add(new Separator());
- IMenuManager subMenu = new MenuManager(MessageUtil.getString("Add"));
- parentMenu.add(subMenu);
- if (subMenu != null) {
- // Add readme actions with various attributes
- Object[][] att = new Object[][] {{IReadmeConstants.MARKER_ATT_ID, new Integer(1234)}};
- subMenu.add(new AddReadmeMarkerAction(this,
- MessageUtil.getString("Add_readme_marker_action_label") + "1", //$NON-NLS-1$ //$NON-NLS-2$
- att,
- MessageUtil.getString("Readme_marker_message_example") + " id=1234")); //$NON-NLS-1$ //$NON-NLS-2$
-
- att = new Object[][] {{IReadmeConstants.MARKER_ATT_LEVEL, new Integer(7)}};
- subMenu.add(new AddReadmeMarkerAction(this,
- MessageUtil.getString("Add_readme_marker_action_label") + "2", //$NON-NLS-1$ //$NON-NLS-2$
- att,
- MessageUtil.getString("Readme_marker_message_example") + " level=7")); //$NON-NLS-1$ //$NON-NLS-2$
-
- att = new Object[][] {{IReadmeConstants.MARKER_ATT_LEVEL, new Integer(7)},
- {IReadmeConstants.MARKER_ATT_DEPT, "infra"}}; //$NON-NLS-1$
- subMenu.add(new AddReadmeMarkerAction(this,
- MessageUtil.getString("Add_readme_marker_action_label") + "3", //$NON-NLS-1$ //$NON-NLS-2$
- att,
- MessageUtil.getString("Readme_marker_message_example") + " level=7, department=infra")); //$NON-NLS-1$ //$NON-NLS-2$
-
- att = new Object[][] {{IReadmeConstants.MARKER_ATT_CODE, "red"}}; //$NON-NLS-1$
- subMenu.add(new AddReadmeMarkerAction(this,
- MessageUtil.getString("Add_readme_marker_action_label") + "4", //$NON-NLS-1$ //$NON-NLS-2$
- att,
- MessageUtil.getString("Readme_marker_message_example") + " code=red")); //$NON-NLS-1$ //$NON-NLS-2$
-
- att = new Object[][] {{IReadmeConstants.MARKER_ATT_LANG, "english"}}; //$NON-NLS-1$
- subMenu.add(new AddReadmeMarkerAction(this,
- MessageUtil.getString("Add_readme_marker_action_label") + "5", //$NON-NLS-1$ //$NON-NLS-2$
- att,
- MessageUtil.getString("Readme_marker_message_example") + " language=english")); //$NON-NLS-1$ //$NON-NLS-2$
-
- att = new Object[][] {{IReadmeConstants.MARKER_ATT_ID, new Integer(1234)},
- {IReadmeConstants.MARKER_ATT_LEVEL, new Integer(7)},
- {IReadmeConstants.MARKER_ATT_DEPT, "infra"}, //$NON-NLS-1$
- {IReadmeConstants.MARKER_ATT_CODE, "red"}, //$NON-NLS-1$
- {IReadmeConstants.MARKER_ATT_LANG, "english"}}; //$NON-NLS-1$
- subMenu.add(new AddReadmeMarkerAction(this,
- MessageUtil.getString("Add_readme_marker_action_label") + "6", //$NON-NLS-1$ //$NON-NLS-2$
- att,
- MessageUtil.getString("Readme_marker_message_example") + //$NON-NLS-1$
- " id=1234, level=7, department=infra, code=red, language=english")); //$NON-NLS-1$
-
- att = new Object[0][0];
- subMenu.add(new AddReadmeMarkerAction(this,
- MessageUtil.getString("Add_readme_marker_action_label") + "7", //$NON-NLS-1$ //$NON-NLS-2$
- att,
- MessageUtil.getString("Readme_marker_message_example") + " No attributes specified")); //$NON-NLS-1$ //$NON-NLS-2$
- }
- }
-
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeEditorActionBarContributor.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeEditorActionBarContributor.java
deleted file mode 100644
index 7b11af9..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeEditorActionBarContributor.java
+++ /dev/null
@@ -1,185 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.LabelRetargetAction;
-import org.eclipse.ui.actions.RetargetAction;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.EditorActionBarContributor;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.action.ControlContribution;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.ui.texteditor.BasicTextEditorActionContributor;
-
-/**
- * This class demonstrates action contribution for the readme editor.
- * A number of menu, toolbar, and status line contributions are defined
- * in the workbench window. These actions are shared among all
- * readme editors, and are only visible when a readme editor is
- * active. Otherwise, they are invisible.
- */
-public class ReadmeEditorActionBarContributor extends BasicTextEditorActionContributor
-{
- private EditorAction action1;
- private RetargetAction action2;
- private LabelRetargetAction action3;
- private EditorAction handler2;
- private EditorAction handler3;
- private EditorAction handler4;
- private EditorAction handler5;
- private DirtyStateContribution dirtyStateContribution;
-
- class EditorAction extends Action {
- private Shell shell;
- private IEditorPart activeEditor;
- public EditorAction(String label) {
- super(label);
- }
- public void setShell(Shell shell) {
- this.shell = shell;
- }
- public void run() {
- String editorName = MessageUtil.getString("Empty_Editor_Name"); //$NON-NLS-1$
- if (activeEditor != null)
- editorName = activeEditor.getTitle();
- MessageDialog.openInformation(shell,
- MessageUtil.getString("Readme_Editor"), //$NON-NLS-1$
- MessageUtil.format("ReadmeEditorActionExecuted", new Object[] {getText(), editorName})); //$NON-NLS-1$
- }
- public void setActiveEditor(IEditorPart part) {
- activeEditor = part;
- }
- }
-/**
- * Creates a new ReadmeEditorActionBarContributor.
- */
-public ReadmeEditorActionBarContributor() {
- ImageRegistry registry = ReadmePlugin.getDefault().getImageRegistry();
- action1 = new EditorAction(MessageUtil.getString("Editor_Action1")); //$NON-NLS-1$
- action1.setToolTipText(MessageUtil.getString("Readme_Editor_Action1")); //$NON-NLS-1$
- action1.setDisabledImageDescriptor(ReadmeImages.EDITOR_ACTION1_IMAGE_DISABLE);
- action1.setImageDescriptor(ReadmeImages.EDITOR_ACTION1_IMAGE_ENABLE);
- action1.setHoverImageDescriptor(ReadmeImages.EDITOR_ACTION1_IMAGE);
- WorkbenchHelp.setHelp(action1, IReadmeConstants.EDITOR_ACTION1_CONTEXT);
-
- action2 = new RetargetAction(IReadmeConstants.RETARGET2, MessageUtil.getString("Editor_Action2")); //$NON-NLS-1$
- action2.setToolTipText(MessageUtil.getString("Readme_Editor_Action2")); //$NON-NLS-1$
- action2.setDisabledImageDescriptor(ReadmeImages.EDITOR_ACTION2_IMAGE_DISABLE);
- action2.setImageDescriptor(ReadmeImages.EDITOR_ACTION2_IMAGE_ENABLE);
- action2.setHoverImageDescriptor(ReadmeImages.EDITOR_ACTION2_IMAGE);
-
- action3 = new LabelRetargetAction(IReadmeConstants.LABELRETARGET3, MessageUtil.getString("Editor_Action3")); //$NON-NLS-1$
- action3.setDisabledImageDescriptor(ReadmeImages.EDITOR_ACTION3_IMAGE_DISABLE);
- action3.setImageDescriptor(ReadmeImages.EDITOR_ACTION3_IMAGE_ENABLE);
- action3.setHoverImageDescriptor(ReadmeImages.EDITOR_ACTION3_IMAGE);
-
- handler2 = new EditorAction(MessageUtil.getString("Editor_Action2")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(action2, IReadmeConstants.EDITOR_ACTION2_CONTEXT);
-
- handler3 = new EditorAction(MessageUtil.getString("Editor_Action3")); //$NON-NLS-1$
- handler3.setToolTipText(MessageUtil.getString("Readme_Editor_Action3")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(action3, IReadmeConstants.EDITOR_ACTION3_CONTEXT);
-
- handler4 = new EditorAction(MessageUtil.getString("Editor_Action4")); //$NON-NLS-1$
- handler5 = new EditorAction(MessageUtil.getString("Editor_Action5")); //$NON-NLS-1$
- handler5.setToolTipText(MessageUtil.getString("Readme_Editor_Action5")); //$NON-NLS-1$
-
- dirtyStateContribution = new DirtyStateContribution();
-}
-/** (non-Javadoc)
- * Method declared on EditorActionBarContributor
- */
-public void contributeToMenu(IMenuManager menuManager) {
- // Run super.
- super.contributeToMenu(menuManager);
-
- // Editor-specitic menu
- MenuManager readmeMenu = new MenuManager(MessageUtil.getString("Readme_Menu")); //$NON-NLS-1$
- // It is important to append the menu to the
- // group "additions". This group is created
- // between "Project" and "Tools" menus
- // for this purpose.
- menuManager.insertAfter("additions", readmeMenu); //$NON-NLS-1$
- readmeMenu.add(action1);
- readmeMenu.add(action2);
- readmeMenu.add(action3);
-}
-/** (non-Javadoc)
- * Method declared on EditorActionBarContributor
- */
-public void contributeToStatusLine(IStatusLineManager statusLineManager) {
- // Run super.
- super.contributeToStatusLine(statusLineManager);
- // Test status line.
- statusLineManager.setMessage(MessageUtil.getString("Editor_is_active")); //$NON-NLS-1$
- statusLineManager.add(dirtyStateContribution);
-}
-
-/** (non-Javadoc)
- * Method declared on EditorActionBarContributor
- */
-public void contributeToToolBar(IToolBarManager toolBarManager) {
- // Run super.
- super.contributeToToolBar(toolBarManager);
-
- // Add toolbar stuff.
- toolBarManager.add(new Separator("ReadmeEditor")); //$NON-NLS-1$
- toolBarManager.add(action1);
- toolBarManager.add(action2);
- toolBarManager.add(action3);
-}
-/** (non-Javadoc)
- * Method declared on IEditorActionBarContributor
- */
-public void dispose() {
- // Remove retarget actions as page listeners
- getPage().removePartListener(action2);
- getPage().removePartListener(action3);
-}
-
-/** (non-Javadoc)
- * Method declared on IEditorActionBarContributor
- */
-public void init(IActionBars bars, IWorkbenchPage page) {
- super.init(bars, page);
- bars.setGlobalActionHandler(IReadmeConstants.RETARGET2, handler2);
- bars.setGlobalActionHandler(IReadmeConstants.LABELRETARGET3, handler3);
- bars.setGlobalActionHandler(IReadmeConstants.ACTION_SET_RETARGET4, handler4);
- bars.setGlobalActionHandler(IReadmeConstants.ACTION_SET_LABELRETARGET5, handler5);
-
- // Hook retarget actions as page listeners
- page.addPartListener(action2);
- page.addPartListener(action3);
- IWorkbenchPart activePart = page.getActivePart();
- if (activePart != null) {
- action2.partActivated(activePart);
- action3.partActivated(activePart);
- }
-}
-
-/** (non-Javadoc)
- * Method declared on IEditorActionBarContributor
- */
-public void setActiveEditor(IEditorPart editor) {
- // Run super.
- super.setActiveEditor(editor);
-
- // Target shared actions to new editor
- action1.setActiveEditor(editor);
- handler2.setActiveEditor(editor);
- handler3.setActiveEditor(editor);
- handler4.setActiveEditor(editor);
- handler5.setActiveEditor(editor);
- dirtyStateContribution.editorChanged(editor);
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeFilePropertyPage.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeFilePropertyPage.java
deleted file mode 100644
index fc6c558..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeFilePropertyPage.java
+++ /dev/null
@@ -1,171 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.ui.help.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-
-/**
- * This page will be added to the property page dialog
- * when the "Properties..." popup menu item is selected
- * for Readme files.
- */
-public class ReadmeFilePropertyPage extends PropertyPage {
-
-/**
- * Utility method that creates a new composite and
- * sets up its layout data.
- *
- * @param parent the parent of the composite
- * @param numColumns the number of columns in the new composite
- * @return the newly-created composite
- */
-protected Composite createComposite(Composite parent, int numColumns) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- composite.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
- return composite;
-}
-/** (non-Javadoc)
- * Method declared on PreferencePage
- */
-public Control createContents(Composite parent) {
-
- // ensure the page has no special buttons
- noDefaultAndApplyButton();
- Composite panel = createComposite(parent, 2);
-
- WorkbenchHelp.setHelp(panel, IReadmeConstants.PROPERTY_PAGE_CONTEXT);
-
- // layout the page
-
- IResource resource = (IResource) getElement();
- IStatus result = null;
- if (resource.getType() == IResource.FILE) {
- Label l = createLabel(panel, MessageUtil.getString("File_name")); //$NON-NLS-1$
- l = createLabel(panel, resource.getName());
- grabExcessSpace(l);
-
- //
- createLabel(panel, MessageUtil.getString("Path")); //$NON-NLS-1$
- l = createLabel(panel, resource.getFullPath().setDevice(null).toString());
- grabExcessSpace(l);
-
- //
- createLabel(panel, MessageUtil.getString("Size")); //$NON-NLS-1$
- InputStream contentStream = null;
- try {
- IFile file = (IFile) resource;
- if (!file.isLocal(IResource.DEPTH_ZERO))
- l = createLabel(panel,MessageUtil.getString("<file_contents_not_local>")); //$NON-NLS-1$
- else {
- contentStream = file.getContents();
- Reader in = new InputStreamReader(contentStream);
- int chunkSize = contentStream.available();
- StringBuffer buffer = new StringBuffer(chunkSize);
- char[] readBuffer = new char[chunkSize];
- int n = in.read(readBuffer);
-
- while (n > 0) {
- buffer.append(readBuffer);
- n = in.read(readBuffer);
- }
-
- contentStream.close();
- l = createLabel(panel, Integer.toString(buffer.length()));
- }
- } catch (CoreException e) {
- result = e.getStatus();
- String message = result.getMessage();
- if (message == null)
- l = createLabel(panel, MessageUtil.getString("<Unknown>")); //$NON-NLS-1$
- else
- l = createLabel(panel, message);
- } catch (IOException e) {
- l = createLabel(panel, MessageUtil.getString("<Unknown>")); //$NON-NLS-1$
- } finally {
- if (contentStream != null) {
- try {
- contentStream.close();
- } catch (IOException e) {
- }
- }
- }
- grabExcessSpace(l);
- createLabel(panel, MessageUtil.getString("Number_of_sections")); //$NON-NLS-1$
- // We will get the sections property and simply
- // report number of elements found.
- IAdaptable sections = getSections(resource);
- if (sections instanceof AdaptableList) {
- AdaptableList list = (AdaptableList)sections;
- l = createLabel(panel, String.valueOf(list.size()));
- grabExcessSpace(l);
- }
- }
-
- //
- Label l = createLabel(panel, MessageUtil.getString("Additional_information")); //$NON-NLS-1$
- grabExcessSpace(l);
- GridData gd = (GridData) l.getLayoutData();
- gd.horizontalSpan = 2;
- return new Canvas(panel, 0);
-}
-/**
- * Utility method that creates a new label and sets up its layout data.
- *
- * @param parent the parent of the label
- * @param text the text of the label
- * @return the newly-created label
- */
-protected Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
-}
-/**
- * Returns the readme sections for this resource, or null
- * if not applicable (resource is not a readme file).
- */
-private AdaptableList getSections(IAdaptable adaptable) {
- if (adaptable instanceof IFile)
- return ReadmeModelFactory.getInstance().getSections((IFile)adaptable);
- else
- return null;
-}
-/**
- * Sets this control to grab any excess horizontal space
- * left in the window.
- *
- * @param control the control for which to grab excess space
- */
-private void grabExcessSpace(Control control) {
- GridData gd = (GridData) control.getLayoutData();
- if (gd != null) {
- gd.grabExcessHorizontalSpace = true;
- }
-}
-/** (non-Javadoc)
- * Method declared on PreferencePage
- */
-public boolean performOk() {
- // nothing to do - read-only page
- return true;
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeFilePropertyPage2.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeFilePropertyPage2.java
deleted file mode 100644
index b2f0aaa..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeFilePropertyPage2.java
+++ /dev/null
@@ -1,203 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.dialogs.PropertyPage;
-import org.eclipse.ui.help.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import java.io.*;
-
-/**
- * This page will be added to the property page dialog
- * when "Properties..." popup menu item is selected
- * for Readme files.
- *
- * This page demonstrates conditional property pages which look
- * different depending on the state of the element. In this example,
- * the arbitrary condition chosen is whether the Readme file is
- * greater than 256 bytes in length. If it is smaller than 256 bytes
- * in length, this will be a placeholder page containing
- * a simple message. If it is 256 bytes or larger, additional
- * information will be provided. This information is determined at
- * runtime.
- *
- * This class may be reused to implement a conditional property page.
- * The getPageIndex() method tests the condition and returns the
- * index of the page to create. The createPage*() methods are called
- * upon to create the actual pages.
- */
-public class ReadmeFilePropertyPage2 extends PropertyPage {
-
-/**
- * Utility method that creates a new composite and
- * sets up its layout data.
- *
- * @param parent the parent of the composite
- * @param numColumns the number of columns in the new composite
- * @return the newly-created composite
- */
-protected Composite createComposite(Composite parent, int numColumns) {
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- composite.setLayout(layout);
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
- return composite;
-}
-/** (non-Javadoc)
- * Method declared on PreferencePage
- */
-public Control createContents(Composite parent) {
- // ensure the page has no special buttons
- noDefaultAndApplyButton();
- Composite panel = createComposite(parent, 2);
-
- WorkbenchHelp.setHelp(panel, IReadmeConstants.PROPERTY_PAGE2_CONTEXT);
-
- // layout the page
- int page = getPageIndex();
- switch (page) {
- case 1:
- createPageOne(panel);
- break;
- case 2:
- createPageTwo(panel);
- break;
- default:
- }
- return new Canvas(panel, 0);
-}
-/**
- * Utility method that creates a new label and sets up
- * its layout data.
- *
- * @param parent the parent of the label
- * @param text the text of the label
- * @return the newly-created label
- */
-protected Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
-}
-/**
- * Creates the first version of the page. This is a placeholder page which
- * notified the user that the page is not available.
- *
- * @param panel the panel in which to create the page
- */
-protected void createPageOne(Composite panel) {
- Label l = createLabel(panel, MessageUtil.getString("Additional_Readme_properties_not_available.")); //$NON-NLS-1$
- GridData gd = (GridData) l.getLayoutData();
- gd.horizontalSpan = 2;
- gd.grabExcessHorizontalSpace = true;
- l = createLabel(panel, MessageUtil.getString("This_illustrates_a_property_page_that_is_dynamically_determined")); //$NON-NLS-1$
- gd = (GridData) l.getLayoutData();
- gd.horizontalSpan = 2;
- gd.grabExcessHorizontalSpace = true;
- l = createLabel(panel, MessageUtil.getString("not_to_be_available_based_on_the_state_of_the_object.")); //$NON-NLS-1$
- gd = (GridData) l.getLayoutData();
- gd.horizontalSpan = 2;
- gd.grabExcessHorizontalSpace = true;
-}
-/**
- * Creates the second version of the page. This page might contain more information
- * about the file or other information.
- *
- * @param panel the panel in which to create the page
- */
-protected void createPageTwo(Composite panel) {
- Label l = createLabel(panel, MessageUtil.getString("The_size_of_the_Readme_file_is_at_least_256_bytes.")); //$NON-NLS-1$
- GridData gd = (GridData) l.getLayoutData();
- gd.horizontalSpan = 2;
- gd.grabExcessHorizontalSpace = true;
- l = createLabel(panel, MessageUtil.getString("Had_it_been_less_than_256_bytes_this_page_would_be_a_placeholder_page.")); //$NON-NLS-1$
- gd = (GridData) l.getLayoutData();
- gd.horizontalSpan = 2;
- gd.grabExcessHorizontalSpace = true;
- l = createLabel(panel, MessageUtil.getString("Additional_information")); //$NON-NLS-1$
- gd = (GridData) l.getLayoutData();
- gd.horizontalSpan = 2;
- gd.grabExcessHorizontalSpace = true;
- l = createLabel(panel, MessageUtil.getString("This_illustrates_a_property_page_that_is_dynamically_determined")); //$NON-NLS-1$
- gd = (GridData) l.getLayoutData();
- gd.horizontalSpan = 2;
- gd.grabExcessHorizontalSpace = true;
- l = createLabel(panel, MessageUtil.getString("to_be_available_based_on_the_state_of_the_object.")); //$NON-NLS-1$
- gd = (GridData) l.getLayoutData();
- gd.horizontalSpan = 2;
- gd.grabExcessHorizontalSpace = true;
-}
-/**
- * Returns which page to display. This implementation
- * answers 1 if the size of the Readme file is less than 256 bytes
- * and 2 otherwise.
- *
- * @return the index of the page to display
- */
-protected int getPageIndex() {
- IResource resource = (IResource) getElement();
-
- if (resource.getType() == IResource.FILE) {
- InputStream contentStream = null;
- int length = 0;
- try {
- IFile file = (IFile) resource;
-
- if (file.isLocal(IResource.DEPTH_ZERO)) {
- contentStream = file.getContents();
- Reader in = new InputStreamReader(contentStream);
- int chunkSize = contentStream.available();
- StringBuffer buffer = new StringBuffer(chunkSize);
- char[] readBuffer = new char[chunkSize];
- int n = in.read(readBuffer);
-
- while (n > 0) {
- buffer.append(readBuffer);
- n = in.read(readBuffer);
- }
-
- contentStream.close();
- length = buffer.length();
- }
- } catch (CoreException e) {
- length = 0;
- } catch (IOException e) {
- } finally {
- if (contentStream != null) {
- try {
- contentStream.close();
- } catch (IOException e) {
- }
- }
- }
-
- if (length < 256)
- return 1;
- else
- return 2;
- }
-
- return 0;
-}
-/** (non-Javadoc)
- * Method declared on PreferencePage
- */
-public boolean performOk() {
- // nothing to do - read-only page
- return true;
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeImages.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeImages.java
deleted file mode 100644
index 7fd5baa..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeImages.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.widgets.Display;
-import java.net.MalformedURLException;
-import java.net.URL;
-/**
- * Convenience class for storing references to image descriptors
- * used by the readme tool.
- */
-public class ReadmeImages {
- static final URL BASE_URL = ReadmePlugin.getDefault().getDescriptor().getInstallURL();
- static final ImageDescriptor EDITOR_ACTION1_IMAGE;
- static final ImageDescriptor EDITOR_ACTION2_IMAGE;
- static final ImageDescriptor EDITOR_ACTION3_IMAGE;
- static final ImageDescriptor EDITOR_ACTION1_IMAGE_DISABLE;
- static final ImageDescriptor EDITOR_ACTION2_IMAGE_DISABLE;
- static final ImageDescriptor EDITOR_ACTION3_IMAGE_DISABLE;
- static final ImageDescriptor EDITOR_ACTION1_IMAGE_ENABLE;
- static final ImageDescriptor EDITOR_ACTION2_IMAGE_ENABLE;
- static final ImageDescriptor EDITOR_ACTION3_IMAGE_ENABLE;
- static final ImageDescriptor README_WIZARD_BANNER;
-
- static {
- String iconPath = "icons/";
-
- String prefix = iconPath + "ctool16/"; //$NON-NLS-1$
- EDITOR_ACTION1_IMAGE = createImageDescriptor(prefix + "action1.gif"); //$NON-NLS-1$
- EDITOR_ACTION2_IMAGE = createImageDescriptor(prefix + "action2.gif"); //$NON-NLS-1$
- EDITOR_ACTION3_IMAGE = createImageDescriptor(prefix + "action3.gif"); //$NON-NLS-1$
-
- prefix = iconPath + "dtool16/"; //$NON-NLS-1$
- EDITOR_ACTION1_IMAGE_DISABLE = createImageDescriptor(prefix + "action1.gif"); //$NON-NLS-1$
- EDITOR_ACTION2_IMAGE_DISABLE = createImageDescriptor(prefix + "action2.gif"); //$NON-NLS-1$
- EDITOR_ACTION3_IMAGE_DISABLE = createImageDescriptor(prefix + "action3.gif"); //$NON-NLS-1$
-
- prefix = iconPath + "etool16/"; //$NON-NLS-1$
- EDITOR_ACTION1_IMAGE_ENABLE = createImageDescriptor(prefix + "action1.gif"); //$NON-NLS-1$
- EDITOR_ACTION2_IMAGE_ENABLE = createImageDescriptor(prefix + "action2.gif"); //$NON-NLS-1$
- EDITOR_ACTION3_IMAGE_ENABLE = createImageDescriptor(prefix + "action3.gif"); //$NON-NLS-1$
-
- prefix = iconPath + "wizban/"; //$NON-NLS-1$
- README_WIZARD_BANNER = createImageDescriptor(prefix + "newreadme_wiz.gif"); //$NON-NLS-1$
- }
-/**
- * Utility method to create an <code>ImageDescriptor</code>
- * from a path to a file.
- */
-private static ImageDescriptor createImageDescriptor(String path) {
- try {
- URL url = new URL(BASE_URL, path);
- return ImageDescriptor.createFromURL(url);
- } catch (MalformedURLException e) {
- }
- return ImageDescriptor.getMissingImageDescriptor();
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeMarkerResolutionGenerator.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeMarkerResolutionGenerator.java
deleted file mode 100644
index 2b70120..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeMarkerResolutionGenerator.java
+++ /dev/null
@@ -1,24 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * Copyright (c) 2000, 2002 IBM Corp. All rights reserved.
- * This file is made available under the terms of the Common Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v10.html
- */
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.ui.IMarkerResolution;
-import org.eclipse.ui.IMarkerResolutionGenerator;
-
-/**
- * Creates resolutions for readme markers.
- */
-public class ReadmeMarkerResolutionGenerator implements IMarkerResolutionGenerator {
- /*(non-Javadoc)
- * Method declared on IMarkerResolutionGenerator.
- */
- public IMarkerResolution[] getResolutions(IMarker marker) {
- return new IMarkerResolution[] {new AddSentenceResolution()};
- }
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeModelFactory.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeModelFactory.java
deleted file mode 100644
index 187aa3f..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeModelFactory.java
+++ /dev/null
@@ -1,154 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import java.util.Enumeration;
-import java.util.Iterator;
-
-/**
- * Creates the sections used in the <code>ContentOutline</code>
- *
- * @see ReadmeContentOutlinePage#getContentOutline(IAdaptable)
- */
-public class ReadmeModelFactory {
- private static ReadmeModelFactory instance = new ReadmeModelFactory();
- private boolean registryLoaded = false;
- IReadmeFileParser parser = null;
-/**
- * Creates a new ReadmeModelFactory.
- */
-private ReadmeModelFactory() {
-}
-/**
- * Adds all mark elements to the list for the subtree rooted
- * at the given mark element.
- */
-protected void addSections(AdaptableList list, MarkElement element) {
- list.add(element);
- Object[] children = element.getChildren(element);
- for (int i = 0; i < children.length; ++i) {
- addSections(list, (MarkElement) children[i]);
- }
-}
-/**
- * Returns the content outline for the given Readme file.
- *
- * @param adaptable the element for which to return the content outline
- * @return the content outline for the argument
- */
-public AdaptableList getContentOutline(IAdaptable adaptable) {
- return new AdaptableList(getToc((IFile)adaptable));
-}
-/**
- * Returns the singleton readme adapter.
- */
-public static ReadmeModelFactory getInstance() {
- return instance;
-}
-/**
- * Returns a list of all sections in this readme file.
- *
- * @param file the file for which to return section heading and subheadings
- * @return A list containing headings and subheadings
- */
-public AdaptableList getSections(IFile file) {
- MarkElement[] topLevel = getToc(file);
- AdaptableList list = new AdaptableList();
- for (int i = 0; i < topLevel.length; i++) {
- addSections(list, topLevel[i]);
- }
- return list;
-}
-/**
- * Convenience method. Looks for a readme file in the selection,
- * and if one is found, returns the sections for it. Returns null
- * if there is no readme file in the selection.
- */
-public AdaptableList getSections(ISelection sel) {
- // If sel is not a structured selection just return.
- if (!(sel instanceof IStructuredSelection))
- return null;
- IStructuredSelection structured = (IStructuredSelection)sel;
-
- //if the selection is a readme file, get its sections.
- Object object = structured.getFirstElement();
- if (object instanceof IFile) {
- IFile file = (IFile) object;
- String extension = file.getFileExtension();
- if (extension != null && extension.equals(IReadmeConstants.EXTENSION)) {
- return getSections(file);
- }
- }
-
- //the selected object is not a readme file
- return null;
-}
-/**
- * Parses the contents of the Readme file by looking for lines
- * that start with a number.
- *
- * @param file the file representing the Readme file
- * @return an element collection representing the table of contents
- */
-private MarkElement[] getToc(IFile file) {
- if (registryLoaded == false) loadParser();
- return parser.parse(file);
-}
-/**
- * Loads the parser from the registry by searching for
- * extensions that satisfy our published extension point.
- * For the sake of simplicity, we will pick the last extension,
- * allowing tools to override what is used. In a more
- * elaborate tool, all the extensions would be processed.
- */
-private void loadParser() {
- IPluginRegistry pluginRegistry = Platform.getPluginRegistry();
- IExtensionPoint point = pluginRegistry.getExtensionPoint(IReadmeConstants.PLUGIN_ID, IReadmeConstants.PP_SECTION_PARSER);
- if (point != null) {
- IExtension[] extensions = point.getExtensions();
- for (int i = 0; i < extensions.length; i++) {
- IExtension currentExtension = extensions[i];
- // in a real application, we would collection
- // the entire list and probably expose it
- // as a drop-down list. For the sake
- // of simplicity, we will pick the last extension only.
- if (i == extensions.length - 1) {
- IConfigurationElement[] configElements = currentExtension.getConfigurationElements();
- for (int j = 0; j < configElements.length; j++) {
- IConfigurationElement config = configElements[i];
- if (config.getName().equals(IReadmeConstants.TAG_PARSER)) {
- // process the first 'parser' element and stop
- processParserElement(config);
- break;
- }
- }
- }
- }
- }
- if (parser == null)
- parser = new DefaultSectionsParser();
- registryLoaded = true;
-}
-/**
- * Tries to create the Readme file parser. If an error occurs during
- * the creation of the parser, print an error and set the parser
- * to null.
- *
- * @param element the element to process
- */
-private void processParserElement(IConfigurationElement element) {
- try {
- parser = (IReadmeFileParser)element.createExecutableExtension(IReadmeConstants.ATT_CLASS);
- } catch (CoreException e) {
- // since this is an example just write to the console
- System.out.println(MessageUtil.getString("Unable_to_create_file_parser") + e.getStatus().getMessage()); //$NON-NLS-1$
- parser = null;
- }
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmePlugin.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmePlugin.java
deleted file mode 100644
index 6b1b57b..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmePlugin.java
+++ /dev/null
@@ -1,54 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-
-/**
- * This is the top-level class of the Readme plugin tool.
- *
- * @see AbstractUIPlugin for additional information on UI plugins
- */
-public class ReadmePlugin extends AbstractUIPlugin {
- // Default instance of the receiver
-
- private static ReadmePlugin inst;
-/**
- * Creates the Readme plugin and caches its default instance
- *
- * @param descriptor the plugin descriptor which the receiver is made from
- */
-public ReadmePlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- if (inst==null) inst = this;
-}
-/**
- * Gets the plugin singleton.
- *
- * @return the default ReadmePlugin instance
- */
-static public ReadmePlugin getDefault() {
- return inst;
-}
-/**
- * Sets default preference values. These values will be used
- * until some preferences are actually set using Preference dialog.
- */
-protected void initializeDefaultPreferences(IPreferenceStore store) {
- // These settings will show up when Preference dialog
- // opens up for the first time.
- store.setDefault(IReadmeConstants.PRE_CHECK1, true);
- store.setDefault(IReadmeConstants.PRE_CHECK2, true);
- store.setDefault(IReadmeConstants.PRE_CHECK3, false);
- store.setDefault(IReadmeConstants.PRE_RADIO_CHOICE, 2);
- store.setDefault(IReadmeConstants.PRE_TEXT, MessageUtil.getString("Default_text")); //$NON-NLS-1$
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmePreferencePage.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmePreferencePage.java
deleted file mode 100644
index 0ee7d33..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmePreferencePage.java
+++ /dev/null
@@ -1,310 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.jface.preference.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.events.*;
-
-/**
- * This class implements a sample preference page that is
- * added to the preference dialog based on the registration.
- */
-public class ReadmePreferencePage extends PreferencePage implements IWorkbenchPreferencePage, SelectionListener, ModifyListener {
- private Button radioButton1;
- private Button radioButton2;
- private Button radioButton3;
-
- private Button checkBox1;
- private Button checkBox2;
- private Button checkBox3;
-
- private Text textField;
-
- private Button pushButton_textField;
-/**
- * Creates an new checkbox instance and sets the default
- * layout data.
- *
- * @param group the composite in which to create the checkbox
- * @param label the string to set into the checkbox
- * @return the new checkbox
- */
-private Button createCheckBox(Composite group, String label) {
- Button button = new Button(group, SWT.CHECK | SWT.LEFT);
- button.setText(label);
- button.addSelectionListener(this);
- GridData data = new GridData();
- button.setLayoutData(data);
- return button;
-}
-/**
- * Creates composite control and sets the default layout data.
- *
- * @param parent the parent of the new composite
- * @param numColumns the number of columns for the new composite
- * @return the newly-created coposite
- */
-private Composite createComposite(Composite parent, int numColumns) {
- Composite composite = new Composite(parent, SWT.NULL);
-
- //GridLayout
- GridLayout layout = new GridLayout();
- layout.numColumns = numColumns;
- composite.setLayout(layout);
-
- //GridData
- GridData data = new GridData();
- data.verticalAlignment = GridData.FILL;
- data.horizontalAlignment = GridData.FILL;
- composite.setLayoutData(data);
- return composite;
-}
-/** (non-Javadoc)
- * Method declared on PreferencePage
- */
-protected Control createContents(Composite parent)
-{
- WorkbenchHelp.setHelp(parent, IReadmeConstants.PREFERENCE_PAGE_CONTEXT);
-
- //composite_textField << parent
- Composite composite_textField = createComposite(parent, 2);
- Label label_textField = createLabel(composite_textField, MessageUtil.getString("Text_Field")); //$NON-NLS-1$
- textField = createTextField(composite_textField);
- pushButton_textField = createPushButton(composite_textField, MessageUtil.getString("Change")); //$NON-NLS-1$
-
- //composite_tab << parent
- Composite composite_tab = createComposite(parent, 2);
- Label label1 = createLabel(composite_tab, MessageUtil.getString("Radio_Button_Options")); //$NON-NLS-1$
-
- //
- tabForward(composite_tab);
- //radio button composite << tab composite
- Composite composite_radioButton = createComposite(composite_tab, 1);
- radioButton1 = createRadioButton(composite_radioButton, MessageUtil.getString("Radio_button_1")); //$NON-NLS-1$
- radioButton2 = createRadioButton(composite_radioButton, MessageUtil.getString("Radio_button_2")); //$NON-NLS-1$
- radioButton3 = createRadioButton(composite_radioButton, MessageUtil.getString("Radio_button_3")); //$NON-NLS-1$
-
-
- //composite_tab2 << parent
- Composite composite_tab2 = createComposite(parent, 2);
- Label label2 = createLabel(composite_tab2, MessageUtil.getString("Check_Box_Options")); //$NON-NLS-1$
-
- //
- tabForward(composite_tab2);
- //composite_checkBox << composite_tab2
- Composite composite_checkBox = createComposite(composite_tab2, 1);
- checkBox1 = createCheckBox(composite_checkBox, MessageUtil.getString("Check_box_1")); //$NON-NLS-1$
- checkBox2 = createCheckBox(composite_checkBox, MessageUtil.getString("Check_box_2")); //$NON-NLS-1$
- checkBox3 = createCheckBox(composite_checkBox, MessageUtil.getString("Check_box_3")); //$NON-NLS-1$
-
- initializeValues();
-
- //font = null;
- return new Composite(parent, SWT.NULL);
-}
-/**
- * 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
- */
-private Label createLabel(Composite parent, String text) {
- Label label = new Label(parent, SWT.LEFT);
- label.setText(text);
- GridData data = new GridData();
- data.horizontalSpan = 2;
- data.horizontalAlignment = GridData.FILL;
- label.setLayoutData(data);
- return label;
-}
-/**
- * Utility method that creates a push 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
- */
-private Button createPushButton(Composite parent, String label) {
- Button button = new Button(parent, SWT.PUSH);
- button.setText(label);
- button.addSelectionListener(this);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- button.setLayoutData(data);
- return button;
-}
-/**
- * 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
- */
-private Button createRadioButton(Composite parent, String label) {
- Button button = new Button(parent, SWT.RADIO | SWT.LEFT);
- button.setText(label);
- button.addSelectionListener(this);
- GridData data = new GridData();
- button.setLayoutData(data);
- return button;
-}
-/**
- * Create a text field specific for this application
- *
- * @param parent the parent of the new text field
- * @return the new text field
- */
-private Text createTextField(Composite parent) {
- Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
- text.addModifyListener(this);
- GridData data = new GridData();
- data.horizontalAlignment = GridData.FILL;
- data.grabExcessHorizontalSpace = true;
- data.verticalAlignment = GridData.CENTER;
- data.grabExcessVerticalSpace = false;
- text.setLayoutData(data);
- return text;
-}
-/**
- * The <code>ReadmePreferencePage</code> implementation of this
- * <code>PreferencePage</code> method
- * returns preference store that belongs to the our plugin.
- * This is important because we want to store
- * our preferences separately from the desktop.
- */
-protected IPreferenceStore doGetPreferenceStore() {
- return ReadmePlugin.getDefault().getPreferenceStore();
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPreferencePage
- */
-public void init(IWorkbench workbench){
-}
-/**
- * Initializes states of the controls using default values
- * in the preference store.
- */
-private void initializeDefaults() {
- IPreferenceStore store = getPreferenceStore();
- checkBox1.setSelection(store.getDefaultBoolean(IReadmeConstants.PRE_CHECK1));
- checkBox2.setSelection(store.getDefaultBoolean(IReadmeConstants.PRE_CHECK2));
- checkBox3.setSelection(store.getDefaultBoolean(IReadmeConstants.PRE_CHECK3));
-
- radioButton1.setSelection(false);
- radioButton2.setSelection(false);
- radioButton3.setSelection(false);
- int choice = store.getDefaultInt(IReadmeConstants.PRE_RADIO_CHOICE);
- switch (choice) {
- case 1:
- radioButton1.setSelection(true);
- break;
- case 2:
- radioButton2.setSelection(true);
- break;
- case 3:
- radioButton3.setSelection(true);
- break;
- }
- textField.setText(store.getDefaultString(IReadmeConstants.PRE_TEXT));
-}
-/**
- * Initializes states of the controls from the preference store.
- */
-private void initializeValues() {
- IPreferenceStore store = getPreferenceStore();
- checkBox1.setSelection(store.getBoolean(IReadmeConstants.PRE_CHECK1));
- checkBox2.setSelection(store.getBoolean(IReadmeConstants.PRE_CHECK2));
- checkBox3.setSelection(store.getBoolean(IReadmeConstants.PRE_CHECK3));
-
- int choice = store.getInt(IReadmeConstants.PRE_RADIO_CHOICE);
- switch (choice) {
- case 1:
- radioButton1.setSelection(true);
- break;
- case 2:
- radioButton2.setSelection(true);
- break;
- case 3:
- radioButton3.setSelection(true);
- break;
- }
- textField.setText(store.getString(IReadmeConstants.PRE_TEXT));
-}
-/** (non-Javadoc)
- * Method declared on ModifyListener
- */
-public void modifyText(ModifyEvent event) {
- //Do nothing on a modification in this example
-}
-/* (non-Javadoc)
- * Method declared on PreferencePage
- */
-protected void performDefaults() {
- super.performDefaults();
- initializeDefaults();
-}
-/* (non-Javadoc)
- * Method declared on PreferencePage
- */
-public boolean performOk() {
- storeValues();
- ReadmePlugin.getDefault().savePluginPreferences();
- return true;
-}
-/**
- * Stores the values of the controls back to the preference store.
- */
-private void storeValues() {
- IPreferenceStore store = getPreferenceStore();
- store.setValue(IReadmeConstants.PRE_CHECK1, checkBox1.getSelection());
- store.setValue(IReadmeConstants.PRE_CHECK2, checkBox2.getSelection());
- store.setValue(IReadmeConstants.PRE_CHECK3, checkBox3.getSelection());
-
- int choice = 1;
-
- if (radioButton2.getSelection()) choice = 2;
- else if (radioButton3.getSelection()) choice = 3;
-
- store.setValue(IReadmeConstants.PRE_RADIO_CHOICE, choice);
- store.setValue(IReadmeConstants.PRE_TEXT, textField.getText());
-}
-/**
- * Creates a tab of one horizontal spans.
- *
- * @param parent the parent in which the tab should be created
- */
-private void tabForward(Composite parent) {
- Label vfiller = new Label(parent, SWT.LEFT);
- GridData gridData = new GridData();
- gridData = new GridData();
- gridData.horizontalAlignment = GridData.BEGINNING;
- gridData.grabExcessHorizontalSpace = false;
- gridData.verticalAlignment = GridData.CENTER;
- gridData.grabExcessVerticalSpace = false;
- vfiller.setLayoutData(gridData);
-}
-/** (non-Javadoc)
- * Method declared on SelectionListener
- */
-public void widgetDefaultSelected(SelectionEvent event) {
- //Handle a default selection. Do nothing in this example
-}
-/** (non-Javadoc)
- * Method declared on SelectionListener
- */
-public void widgetSelected(SelectionEvent event) {
- //Do nothing on selection in this example;
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeSectionsView.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeSectionsView.java
deleted file mode 100644
index 29fcd4c..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeSectionsView.java
+++ /dev/null
@@ -1,68 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.*;
-import org.eclipse.ui.part.*;
-import org.eclipse.ui.model.*;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * This class demonstrates a simple view containing a single viewer.
- */
-public class ReadmeSectionsView extends ViewPart implements ISelectionListener {
- ListViewer viewer;
-/**
- * Creates a new ReadmeSectionsView .
- */
-public ReadmeSectionsView() {
- super();
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart
- */
-public void createPartControl(Composite parent) {
- viewer = new ListViewer(parent);
-
- WorkbenchHelp.setHelp(viewer.getControl(), IReadmeConstants.SECTIONS_VIEW_CONTEXT);
-
- // if the objects in the viewer implement the IDesktopElement adapter,
- // these generic content and label providers can be used.
- viewer.setContentProvider(new WorkbenchContentProvider());
- viewer.setLabelProvider(new WorkbenchLabelProvider());
-
- // add myself as a global selection listener
- getSite().getPage().addSelectionListener(this);
-
- // prime the selection
- selectionChanged(null, getSite().getPage().getSelection());
-}
-/**
- * The <code>ReadmeSectionView</code> implementation of this
- * <code>IWorkbenchPart</code> method runs super
- * and removes itself from the global selection listener.
- */
-public void dispose() {
- super.dispose();
- getSite().getPage().removeSelectionListener(this);
-}
-/* (non-Javadoc)
- * Method declared on ISelectionListener
- */
-public void selectionChanged(IWorkbenchPart part, ISelection sel) {
- //if the selection is a readme file, get its sections.
- AdaptableList input = ReadmeModelFactory.getInstance().getSections(sel);
- viewer.setInput(input);
-}
-/* (non-Javadoc)
- * Method declared on IWorkbenchPart
- */
-public void setFocus() {
- viewer.getControl().setFocus();
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/SectionsDialog.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/SectionsDialog.java
deleted file mode 100644
index 0c66a7b..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/SectionsDialog.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.model.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-/**
- * This dialog is an example of a detached window launched
- * from an action in the desktop.
- */
-public class SectionsDialog extends Dialog {
- protected IAdaptable input;
-/**
- * Creates a new SectionsDialog.
- */
-public SectionsDialog(Shell parentShell, IAdaptable input) {
- super(parentShell);
- this.input = input;
-}
-/* (non-Javadoc)
- * Method declared on Window.
- */
-protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(MessageUtil.getString("Readme_Sections")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(newShell, IReadmeConstants.SECTIONS_DIALOG_CONTEXT);
-}
-/* (non-Javadoc)
- * Method declared on Dialog
- */
-protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite)super.createDialogArea(parent);
-
- List list = new List(composite, SWT.BORDER);
- GridData data = new GridData(GridData.FILL_BOTH);
- list.setLayoutData(data);
- ListViewer viewer = new ListViewer(list);
- viewer.setContentProvider(new WorkbenchContentProvider());
- viewer.setLabelProvider(new WorkbenchLabelProvider());
- viewer.setInput(input);
-
- return composite;
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ViewActionDelegate.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ViewActionDelegate.java
deleted file mode 100644
index 12614d0..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ViewActionDelegate.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-
-/**
- * This class is used to demonstrate view action extensions.
- * An extension should be defined in the readme plugin.xml.
- */
-public class ViewActionDelegate implements IViewActionDelegate {
- public IViewPart view;
-/**
- * Creates a new ViewActionDelegate.
- */
-public ViewActionDelegate() {
- super();
-}
-/* (non-Javadoc)
- * Method declared on IViewActionDelegate
- */
-public void init(IViewPart view) {
- this.view = view;
-}
-/* (non-Javadoc)
- * Method declared on IActionDelegate
- */
-public void run(org.eclipse.jface.action.IAction action) {
- MessageDialog.openInformation(view.getSite().getShell(),
- MessageUtil.getString("Readme_Editor"), //$NON-NLS-1$
- MessageUtil.getString("View_Action_executed")); //$NON-NLS-1$
-}
-/* (non-Javadoc)
- * Method declared on IActionDelegate
- */
-public void selectionChanged(org.eclipse.jface.action.IAction action, org.eclipse.jface.viewers.ISelection selection) {}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/WindowActionDelegate.java b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/WindowActionDelegate.java
deleted file mode 100644
index ec6df81..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/WindowActionDelegate.java
+++ /dev/null
@@ -1,55 +0,0 @@
-package org.eclipse.ui.examples.readmetool;
-
-/*
- * (c) Copyright IBM Corp. 2000, 2001.
- * All Rights Reserved.
- */
-import org.eclipse.ui.*;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * This class shows how <code>IActionDelegate</code> implementations
- * should be used for global action registration for menu
- * and tool bars. Action proxy object is created in the
- * desktop based on presentation information in the plugin.xml
- * file. Delegate is not loaded until the first time the user
- * presses the button or selects the menu. Based on the action
- * availability, it is possible that the button will disable
- * instead of executing.
- */
-public class WindowActionDelegate implements IWorkbenchWindowActionDelegate {
- private IWorkbenchWindow window;
- private ISelection selection;
-/* (non-Javadoc)
- * Method declared on IWorkbenchActionDelegate
- */
-public void dispose() {}
-/* (non-Javadoc)
- * Method declared on IWorkbenchActionDelegate
- */
-public void init(IWorkbenchWindow window) {
- this.window = window;
-}
-/**
- * The <code>WindowActionDelegate</code> implementation of this
- * <code>IActionDelegate</code> method
- * launches a stand-alone dialog that contains a list of sections for
- * the selected readme file in the navigator.
- */
-public void run(IAction action) {
- SectionsDialog dialog = new SectionsDialog(window.getShell(),
- ReadmeModelFactory.getInstance().getSections(selection));
- dialog.open();
-}
-/**
- * The <code>WindowActionDelegate</code> implementation of this
- * <code>IActionDelegate</code> method
- * does nothing - we will let simple rules in the XML
- * config file react to selections.
- */
-public void selectionChanged(IAction action, ISelection selection) {
- this.selection = selection;
-}
-}
diff --git a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/messages.properties b/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/messages.properties
deleted file mode 100644
index 80368b8..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/messages.properties
+++ /dev/null
@@ -1,85 +0,0 @@
-Add=&Add
-Clean=Clean
-Save_Needed=Save Needed
-Editor_Action_executed=Editor Action executed
-Readme_Editor=Readme Editor
-Readme_Outline=Readme Outline
-Line_count=Line count
-Title_length=Title length
-Title_start=Title start
-Popup_Menu_Action_executed=Popup Menu Action executed
-Readme_Example=Readme Example
-Automatic_sample_section_generation=Automatic sample section generation
-Create_Readme_File=Create Readme File
-Create_a_new_Readme_file_resource=Create a new Readme file resource.
-Generate_sample_section_titles=&Generate sample section titles
-Generate_sample_subsection_titles=Generate sample subsection &titles
-Open_file_for_editing_when_done=&Open file for editing when done
-Readme_file_name=&Readme file name:
-SAMPLE_README_FILE=\n\n SAMPLE README FILE\n\n
-SECTION_1=1. SECTION 1\n
-SECTION_1_BODY_1=This text is a placeholder for the section body.\n
-SECTION_2=2. SECTION 2\n
-SECTION_2_BODY_1=This text is a placeholder for the section body. It is\n
-SECTION_2_BODY_2=a bit longer in order to span two lines.\n
-Subsection_1_1=\ \ \ 1.1 Subsection\n
-Subsection_1_1_Body_1=\ \ \ This text is a placeholder for the subsection body\n
-Subsection_2_1=\ \ \ 2.1 Subsection\n
-Subsection_2_1_BODY_1=\ \ \ This text is a placeholder for the subsection body\n
-Subsection_2_2=\ \ \ 2.2 Subsection\n
-Subsection_2_2_BODY_1=\ \ \ This text is a placeholder for the subsection body\n
-New_Readme_File=New Readme File
-Exception_in_readme_drop_adapter=Exception in readme drop adapter:
-Editor_Action1=Editor Action &1
-Editor_Action2=Editor Action &2
-Editor_Action3=Editor Action &3
-Editor_Action4=Editor Action &4
-Editor_Action5=Editor Action &5
-Outline_Action2=Outline Action &2
-Outline_Action3=Outline Action &3
-Outline_Action4=Outline Action &4
-Outline_Action5=Outline Action &5
-Editor_is_active=Editor is active
-Empty_Editor_Name=Empty
-Readme_Editor_Action1=Readme Editor Action 1
-Readme_Editor_Action2=Readme Retarget Editor Action 2
-Readme_Editor_Action3=Readme Label Retarget Editor Action 3
-Readme_Editor_Action5=Readme Label Retarget Editor Action 5
-Readme_Outline_Action3=Readme Label Retarget Outline Action 3
-Readme_Outline_Action5=Readme Label Retarget Outline Action 5
-Readme_Menu=&Readme
-ReadmeEditorActionExecuted=Readme Editor Action executed: {0} for: {1}
-ReadmeOutlineActionExecuted=Readme Outline Action executed
-<Unknown>=<Unknown>
-<file_contents_not_local>=<file contents not local>
-Additional_information=Additional information about the Readme file can go here.
-File_name=File name:
-Number_of_sections=Number of sections:
-Path=Path:
-Size=Size:
-Additional_Readme_properties_not_available.=Additional Readme properties not available.
-Had_it_been_less_than_256_bytes_this_page_would_be_a_placeholder_page.=Had it been less than 256 bytes, this page would be a placeholder page.
-The_size_of_the_Readme_file_is_at_least_256_bytes.=The size of the Readme file is at least 256 bytes.
-This_illustrates_a_property_page_that_is_dynamically_determined=This illustrates a property page that is dynamically determined
-not_to_be_available_based_on_the_state_of_the_object.=not to be available based on the state of the object.
-to_be_available_based_on_the_state_of_the_object.=to be available based on the state of the object.
-Unable_to_create_file_parser=Unable to create file parser.
-Default_text=Default text
-Change=Chan&ge
-Check_Box_Options=Check Box Options
-Check_box_1=&Check box 1
-Check_box_2=C&heck box 2
-Check_box_3=Check bo&x 3
-Radio_Button_Options=Radio Button Options
-Radio_button_1=&Radio button 1
-Radio_button_2=Rad&io button 2
-Radio_button_3=Radio b&utton 3
-Text_Field=&Text Field
-Readme_Sections=Readme Sections
-View_Action_executed=View Action executed
-Add_Sentence=Add Sentence
-Resolution_Error=Resolution Error
-Unable_to_open_file_editor=Unable to open file editor
-Simple_sentence=This is a simple sentence.\n
-Readme_marker_message_example=Readme marker example
-Add_readme_marker_action_label=Readme Marker Example &
\ No newline at end of file
diff --git a/examples/org.eclipse.ui.examples.readmetool/HelpContexts.xml b/examples/org.eclipse.ui.examples.readmetool/HelpContexts.xml
deleted file mode 100644
index 6bf7c3c..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/HelpContexts.xml
+++ /dev/null
@@ -1,104 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<contexts>
-
- <context id="open_browser_action_context" >
- <description>Opens the readme browser </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
- <context id="view_action_context" >
- <description>Runs a readme view action <b>Help</b> </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
- <context id="editor_action_context" >
- <description>Runs a readme editor action <b>Help</b> </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
- <context id="editor_action1_context" >
- <description>Runs readme editor action 1 <b>Help</b> </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
- <context id="editor_action2_context" >
- <description>Runs readme editor action 2 <b>Help</b> </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
- <context id="editor_action3_context" >
- <description>Runs readme editor action 3 <b>Help</b> </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
-
- <context id="sections_view_context" >
- <description>Readme sections view <b>Help</b> </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
-
- <context id="sections_dialog_context" >
- <description>Readme sections dialog <b>Help</b> </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
-
- <context id="preference_page_context" >
- <description>Readme preference page <b>Help</b> </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
-
- <context id="property_page_context" >
- <description>Readme property page <b>Help</b> </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
- <context id="property_page2_context" >
- <description>Readme property page2 <b>Help</b> </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
-
- <context id="editor_context" >
- <description>Readme editor <b>Help</b> </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
-
- <context id="content_outline_page_context" >
- <description>Readme editor content outline <b>Help</b> </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
-
- <context id="creation_wizard_page_context" >
- <description>Readme file creation wizard <b>Help</b> </description>
- <topic href="contexts/RelatedContext3.html" label="Help Related Topic 3 - Temporary"/>
- <topic href="contexts/RelatedContext4.html" label="Help Related Topic 4 - Temporary"/>
- </context>
-
- <context id="marker_example1_context" >
- <description>Readme marker example 1 <b>Help</b> id = 1234 </description>
- </context>
- <context id="marker_example2_context" >
- <description>Readme marker example 2 <b>Help</b> level = 7 </description>
- </context>
- <context id="marker_example3_context" >
- <description>Readme marker example 3 <b>Help</b> level = 7, department = infra </description>
- </context>
- <context id="marker_example4_context" >
- <description>Readme marker example 4 <b>Help</b> code = red </description>
- </context>
- <context id="marker_example5_context" >
- <description>Readme marker example 5 <b>Help</b> language = english </description>
- </context>
- <context id="marker_example6_context" >
- <description>Readme marker example 6 <b>Help</b> id = 1234, level = 7, department = infra, code = red, language = english </description>
- </context>
- <context id="marker_example7_context" >
- <description>Readme marker example 7 <b>Help</b> No attributes specified </description>
- </context>
-</contexts>
\ No newline at end of file
diff --git a/examples/org.eclipse.ui.examples.readmetool/about.html b/examples/org.eclipse.ui.examples.readmetool/about.html
deleted file mode 100644
index 9db411a..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/about.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<html>
-<head>
-<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>20th June, 2002</p>
-<h3>License</h3>
-<p>Eclipse.org makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the
-Common Public License Version 1.0 ("CPL"). A copy of the CPL is available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>.
-For purposes of the CPL, "Program" will mean the Content.</p>
-
-<h3>Contributions</h3>
-
-<p>If this Content is licensed to you under the terms and conditions of the CPL, any Contributions, as defined in the CPL, uploaded, submitted, or otherwise
-made available to Eclipse.org, members of Eclipse.org and/or the host of Eclipse.org web site, by you that relate to such
-Content are provided under the terms and conditions of the CPL and can be made available to others under the terms of the CPL.</p>
-
-<p>If this Content is licensed to you under license terms and conditions other than the CPL ("Other License"), any modifications, enhancements and/or
-other code and/or documentation ("Modifications") uploaded, submitted, or otherwise made available to Eclipse.org, members of Eclipse.org and/or the
-host of Eclipse.org, by you that relate to such Content are provided under terms and conditions of the Other License and can be made available
-to others under the terms of the Other License. In addition, with regard to Modifications for which you are the copyright holder, you are also
-providing the Modifications under the terms and conditions of the CPL and such Modifications can be made available to others under the terms of
-the CPL.</p>
-
-</body>
-</html>
\ No newline at end of file
diff --git a/examples/org.eclipse.ui.examples.readmetool/build.properties b/examples/org.eclipse.ui.examples.readmetool/build.properties
deleted file mode 100644
index 80dd4c0..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/build.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-source.readmetool.jar = Eclipse UI Examples Readme Tool/
-
-bin.includes = doc/,\
- doc-html/,\
- icons/,\
- .options,\
- about.html,\
- doc.zip,\
- HelpContexts.xml,\
- plugin.properties,\
- plugin.xml,\
- *.jar
-
-src.includes = about.html
diff --git a/examples/org.eclipse.ui.examples.readmetool/doc-html/hglegal.htm b/examples/org.eclipse.ui.examples.readmetool/doc-html/hglegal.htm
deleted file mode 100644
index b071dbd..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/doc-html/hglegal.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.ui.examples.readmetool/doc-html/ngibmcpy.gif b/examples/org.eclipse.ui.examples.readmetool/doc-html/ngibmcpy.gif
deleted file mode 100644
index 360f8e9..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/doc-html/ngibmcpy.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/doc-html/ui_readmetool_ex.html b/examples/org.eclipse.ui.examples.readmetool/doc-html/ui_readmetool_ex.html
deleted file mode 100644
index 796eb76..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/doc-html/ui_readmetool_ex.html
+++ /dev/null
@@ -1,165 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Desktop - Readme Tool Example</title>
-</head>
-<body>
-
-<h2>
-<b>Example - Readme Tool</b></h2>
-
-<h3>
-Introduction</h3>
-The Readme editor shows how to define your own extension points for use
-by other plugins. It also shows how to create extensions for resource popup
-menu entries, new resource wizards, file editors on an extension (.readme),
-a custom view and property pages.
-<h3>
-Running the example</h3>
-To start using this example create a file with the .readme extension using
-the file creation wizard or create one using the example creation wizard.
-The additional view provided by this example can be seen by selecting
-Perspectives > Show View > Other and expanding the Readme section. The
-view action can be seen by clicking on the readme icon on the Navigator
-View.
-<h4>
-Creating a new readme file</h4>
-Create a new file with file extension .readme. From the File menu,
-select New and then select Other... from the sub menu. Click on Simple
-in the wizard, then select File in the list on the left. Click on
-Next to supply the file name (make sure the extension is .readme) and the
-folder in which the file should be contained.
-<h4>
-Example creation wizards</h4>
-From the File menu, select New and from the sub menu select Other...
-Now select Example Creation Wizards. Select Readme File. Click Next. Select
-the folder in which you want the file to be created. Type the name of the
-file with a .readme extension. Click Finish.
-<h4>
-Readme view extension action</h4>
-In the Navigator View, select a file with extension .readme. If there isn't
-one create a file with that extension. On the local toolbar of the Navigator
-View, you will see a button whose hover help says Run Readme View Extension.
-Click on this button. A dialog will popup saying View Action executed.
-<h4>
-Popup menus</h4>
-In the Navigator View, select a file with extension .readme. If there
-isn't one create a file with that extension. Select the file to bring
-up the popup menu. Notice there is a menu item that says Show Readme
-Action in the popup menu. Choose this menu item to open a dialog
-that says Popup Menu Action Executed.
-<h4>
-Preference page</h4>
-From the Window menu, select Preferences. Click on the page called
-Readme Example. This shows an example of a preference page.
-<h4>
-Property page</h4>
-In the Navigator View, select a file with extension .readme. If there
-isn't one create a file with that extension. Select the file to bring
-up the popup menu, then select the Properties menu item. Click on
-the page called Readme Tool to see an example of a property page.
-<h4>
-Readme file editor</h4>
-The Readme File Editor is the default editor for files of type *.readme.
-Create a file with extension .readme and open the file by double clicking
-on it, or by bringing up the popup menu, selecting Open With, then
-selecting Readme File Editor from the sub menu. Notice the editor
-has an icon with a pencil. This is the editor that the readme tool
-uses by default for files of type *.readme.
-<h4>
-Readme Editor Actions</h4>
-This demonstrates an example of actions that are applicable only to a particular
-editor. When a readme file editor has focus, notice 4 additional
-tool bar buttons - Run Readme Editor Extension, Readme Editor Action 1,
-Readme Editor Action 2, Readme Editor Action 3.
-<p>A pull down menu named Readme appears when a readme file editor has
-focus. It contains the actions previously described: Readme Editor
-Action 1, Readme Editor Action 2, Readme Editor Action 3.
-<h4>
-Readme sections view</h4>
-To see this Readme Sections view, from the Window menu select Show
-View, then select Other... from the sub menu. Expand the Readme item
-and then select Readme Sections. This will show a list of the sections
-in the current *.readme file when a .readme file is selected in the Navigator
-View. You can also see the structure of a *.readme file in the Outline
-view.
-<p>A file with extension .readme can be broken down into sections when
-each section begins with a number. For example, if the following
-text were entered into the readme file editor, the readme tool would detect
-2 sections. To see how sections are detected in the readme tool,
-type some text in the readme file editor, save the file by either typing
-CTRL-S or selecting File->Save. Open the Readme Sections view and
-select the .readme file in the Navigator View.
-<p>Example text:
-<p>99.1 This is my first section
-<br>This is some text in my first section.
-<p>99.1.1 This is a sub section
-<br>This is some text in my sub-section.
-<h4>Drag and Drop</h4>
-<p>The Drag and Drop functionality can be seen by selecting a section in the
-Outline View and dragging the selection over top of a text file. The contents of
-the selection will be appended to the file.
-<h4>
-Help contribution</h4>
-The readme tool example also demonstrates how to use and implement context
-help on all of the extensions it supplies - a view, various actions and
-a wizard page. To get context help on an action, hover over the menu
-item, but do no select it, then hit the F1 key. You can also get
-context sensitive (F1) help on the Readme Sections view and the Example
-Creation Wizards page (in the New wizard).
-<br>
-<h3>
-Details</h3>
-The Readme Tool example declares one extension point and supplies a number
-of extensions. The extensions supplied are quite comprehensive in
-understanding how the Workbench functions, as it utilizes a number of the
-more interesting extension points declared by the workbench. Supplied
-extensions included in this example are views and view actions, preference
-pages, property pages, wizards, editors and editor actions, popup menus,
-action sets, help contributions, help contexts, and drop actions.
-<p>This example also supplies an extension point declared in the plug-in..
-The class IReadmeFileParser is required for any plug-in that uses the org.eclipse.ui.examples.readmetool.sectionParser
-extension that this example defines. The class DefaultSectionParser is
-an example implementation of IReadmeFileParser.
-<p>The class ReadmeEditor implements IEditorPart and is defined as an editor
-on files with the extension .readme in the plugin.xml using the org.eclipse.ui.editors
-extension point. The class ReadmeSectionsView implements IViewPart and
-is defined as a view using the org.eclipse.ui.views extension point. This
-extension point also defines a category for the view for use in view selection.
-<p>Two types of preference settings are defined in this example, workbench
-preferences and resource properties. The workbench preference is defined
-in class ReadmePreferencePage which implements IWorkbenchPreferencePage
-so that it will be added to the Workbench->Preferences dialog. The class
-is defined in the extension point org.eclipse.ui.preferencePages in the
-plugin.xml. The two resource properties pages are ReadmeFilePropertyPage
-and ReadmeFilePropertyPage2 both of which implement IWorkbenchPropertyPage.
-They are both defined to be invoked on the IFile type by the objectClass
-tag in the plugin.xml in the org.eclipse.ui.propertyPages extension point.
-<p>The class ReadmeCreationWizard implements INewWizard and is defined
-in the org.eclipse.ui.newWizards extension point in the plugin.xml. This
-extension point also defines the category that the wizard that is shown
-when the user selects File->New->Other....
-<p>Several action stubs are added to this example. The action set declares
-a menu labeled Readme File Editor<b> </b>to be included in the workbench
-window menu bar using the extension point org.eclipse.ui.actionSets. It
-also defines an action for the workbench toolbar and menu bar using the
-tags toolbarPath and menubarPath. It uses the class WindowActionDelegate
-which implements IWorkbenchWindowActionDelegate to implement the action.
-The action for the popup menu is defined as an objectContribution by the
-class PopupMenuActionDelegate in the extension point org.eclipse.ui.popupMenus.
-PopupMenuActionDelegate implements IObjectActionDelegate and uses the IWorkbenchPart
-provided to open a message dialog. The view action ViewActionDelegate is
-defined in the extension point org.eclipse.ui.viewActions and implements
-IViewActionDelegate. The View it appears in is defined by the tag targetID
-which in this example is org.eclipse.ui.views.ResourceNavigator. The editor
-action is defined by the class EditorActionDelegate which implements IEditorActionDelegate
-and is added using the org.eclipse.ui.editorActions extension point. The
-editor that it is applied to is defined by the tag targetID which in this
-example is defined on org.eclipse.ui.examples.readmetool.ReadmeEditor.<p>The
-class ReadmeDropActionDelegate implements IDropDelegate. IDropDelegates are
-informed every time there is a drop action performed in the workbench . The
-extension point for this action is org.eclipse.ui.dropActions.
-<p><a href="hglegal.htm"><img SRC="ngibmcpy.gif" ALT="Copyright IBM Corp. 2000, 2001. All Rights Reserved." BORDER=0 height=12 width=195></a>
-</body>
-</html>
diff --git a/examples/org.eclipse.ui.examples.readmetool/doc.zip b/examples/org.eclipse.ui.examples.readmetool/doc.zip
deleted file mode 100644
index 41e8aa9..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/doc.zip
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/doc/hglegal.htm b/examples/org.eclipse.ui.examples.readmetool/doc/hglegal.htm
deleted file mode 100644
index b071dbd..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/doc/hglegal.htm
+++ /dev/null
@@ -1,14 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <meta name="GENERATOR" content="Mozilla/4.73 [en] (Win98; U) [Netscape]">
- <title>Legal Notices</title>
-</head>
-<body>
-
-<h3>
-<a NAME="Notices"></a>Notices</h3>
-(c) Copyright IBM Corp. 2000, 2001. All Rights Reserved.
-</body>
-</html>
diff --git a/examples/org.eclipse.ui.examples.readmetool/doc/ngibmcpy.gif b/examples/org.eclipse.ui.examples.readmetool/doc/ngibmcpy.gif
deleted file mode 100644
index 360f8e9..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/doc/ngibmcpy.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/doc/org_eclipse_ui_examples_readmetool.html b/examples/org.eclipse.ui.examples.readmetool/doc/org_eclipse_ui_examples_readmetool.html
deleted file mode 100644
index aed1eca..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/doc/org_eclipse_ui_examples_readmetool.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>Readme Tool Extension Points</title>
-</head>
-<body link="#0000FF" vlink="#800080">
-
-<center>
-<h1>
-Readme Tool</h1></center>
-The Readme Tool is provided as an example for tool developers. It demonstrates
-the extension of various aspects of the workbench, both visually and functionally.
-As well, the Readme Tool provides extension points of its own.
-<p>
-<hr WIDTH="100%">
-<h1>
-Extension Points</h1>
-The following extension points can be used to extend the Readme Tool:
-<ul>
-<li>
-<a href="org_eclipse_ui_examples_readmetool_sectionParser.html">org.eclipse.ui.readmetool.sectionParser</a></li>
-</ul>
-
-<p><a href="hglegal.htm"><img src="ngibmcpy.gif" alt="Copyright IBM Corp. 2000, 2001. All Rights Reserved." width="195" height="12" border="0"></a></p>
-
-</body>
-</html>
diff --git a/examples/org.eclipse.ui.examples.readmetool/doc/org_eclipse_ui_examples_readmetool_sectionParser.html b/examples/org.eclipse.ui.examples.readmetool/doc/org_eclipse_ui_examples_readmetool_sectionParser.html
deleted file mode 100644
index 7c889f6..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/doc/org_eclipse_ui_examples_readmetool_sectionParser.html
+++ /dev/null
@@ -1,65 +0,0 @@
-<!doctype html public "-//w3c//dtd html 4.0//en">
-<html>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <title>README Tool Extension Points</title>
-</head>
-<body link="#0000FF" vlink="#800080">
-
-<center>
-<h1>
-Section Parser</h1></center>
-<b><i>Identifier: </i></b>org.eclipse.ui.examples.readmetool.sectionParser
-<p><b><i>Description: </i></b>This extension point allows tools to provide
-a parser for Readme files which identifies the sections of the file.
-The sections determined by this parser will show up in the outliner when a
-Readme file is open in the editor. The sections will also appear in the
-"Readme sections" view.
-<p>The default section parser provided with the Readme Tool is a simple parser
-which considers sections to be numbered at the beginning of a line. Top-level
-sections are signified by a number followed by a period, such as in the following
-regular expression: "[0-9]+\.". Examples are "1.", "0.", and "12345.".
-Subsections are signified by the regular expression: "([0-9]+\.)+[0-9]+". Examples
-of subsections are "1.1", "1.1.1.1", and "123.456.7890". Any level of subsection
-nesting may occur. Section and subsection markers must occur before any other
-non-whitespace characters on a line.
-<p><b><i>Configuration Markup:</i></b>
-<p><tt> <!ATTLIST sectionParser</tt>
-<br><tt> name CDATA #REQUIRED</tt>
-<br><tt> id CDATA #REQUIRED</tt>
-<br><tt> class CDATA #REQUIRED</tt>
-<br><tt> ></tt>
-<ul>
-<li>
-<b>name</b> - a string describing this contribution.</li>
-
-<li>
-<b>id</b> - a unique identifier that can be used to reference this extension.</li>
-
-<li>
-<b>class</b> - a fully qualified name of the class which provides this extension.</li>
-</ul>
-
-<b><i>Examples:</i></b>
-<p>The following is an example of a sectionParser extension point:
-<p><tt> <extension point="org.eclipse.ui.examples.readmetool.sectionParser"></tt>
-<br><tt> <parser</tt>
-<br><tt> name="Custom README Section Parser"</tt>
-<br><tt> id="com.xyz.CustomSectionParser"</tt>
-<br><tt> class="com.xyz.CustomSectionParser"></tt>
-<br><tt> </parser></tt>
-<br><tt> </extension></tt>
-<p>In the example above, the class com.xyz.CustomSectionParser will be used as
-the section parser for Readme files.
-<p><b><i>API Information: </i></b>Value of the action attribute <b>class</b>
-must be a fully qualified class name of a Java class that implements the interface
-org.eclipse.ui.examples.readmetool.IReadmeFileParser. This interface is loaded as
-late as possible to avoid loading the entire tool before it is really needed.
-<p><b><i>Supplied Implementation: </i></b>As described above, the default section
-parser uses a simple grammar of sections identified by numbers followed by periods,
-and subsections identified by the pattern of a number followed by a period, repeated
-an arbitrary number of times, and ending with a number.
-<p><a href="hglegal.htm"><img src="ngibmcpy.gif" alt="Copyright IBM Corp. 2000, 2001. All Rights Reserved." width="195" height="12" border="0"></a></p>
-
-</body>
-</html>
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/action1.gif b/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/action1.gif
deleted file mode 100644
index 91077ef..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/action1.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/action2.gif b/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/action2.gif
deleted file mode 100644
index c2a3e17..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/action2.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/action3.gif b/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/action3.gif
deleted file mode 100644
index 9c14f74..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/action3.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.gif b/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.gif
deleted file mode 100644
index 6d40439..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/dtool16/action1.gif b/examples/org.eclipse.ui.examples.readmetool/icons/dtool16/action1.gif
deleted file mode 100644
index 0c50830..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/dtool16/action1.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/dtool16/action2.gif b/examples/org.eclipse.ui.examples.readmetool/icons/dtool16/action2.gif
deleted file mode 100644
index 3f978df..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/dtool16/action2.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/dtool16/action3.gif b/examples/org.eclipse.ui.examples.readmetool/icons/dtool16/action3.gif
deleted file mode 100644
index f9f1e95..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/dtool16/action3.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/dtool16/openbrwsr.gif b/examples/org.eclipse.ui.examples.readmetool/icons/dtool16/openbrwsr.gif
deleted file mode 100644
index 02a2df8..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/dtool16/openbrwsr.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/etool16/action1.gif b/examples/org.eclipse.ui.examples.readmetool/icons/etool16/action1.gif
deleted file mode 100644
index 55fb1a6..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/etool16/action1.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/etool16/action2.gif b/examples/org.eclipse.ui.examples.readmetool/icons/etool16/action2.gif
deleted file mode 100644
index f801d2e..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/etool16/action2.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/etool16/action3.gif b/examples/org.eclipse.ui.examples.readmetool/icons/etool16/action3.gif
deleted file mode 100644
index 5e199b1..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/etool16/action3.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/etool16/openbrwsr.gif b/examples/org.eclipse.ui.examples.readmetool/icons/etool16/openbrwsr.gif
deleted file mode 100644
index bdbe8ca..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/etool16/openbrwsr.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.gif b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.gif
deleted file mode 100644
index c48d9a9..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.gif b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.gif
deleted file mode 100644
index 293826d..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.gif b/examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.gif
deleted file mode 100644
index 64d7907..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.gif b/examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.gif
deleted file mode 100644
index 008fd7a..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/icons/wizban/newreadme_wiz.gif b/examples/org.eclipse.ui.examples.readmetool/icons/wizban/newreadme_wiz.gif
deleted file mode 100644
index 3265aaf..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/icons/wizban/newreadme_wiz.gif
+++ /dev/null
Binary files differ
diff --git a/examples/org.eclipse.ui.examples.readmetool/plugin.properties b/examples/org.eclipse.ui.examples.readmetool/plugin.properties
deleted file mode 100644
index 1c0dd7a..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/plugin.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-Plugin.name = Readme File Editing Tool
-Plugin.providerName = Eclipse.org
-ExtPoint.sectionParser = Section parser for Readme file editor
-SectionParser.name = Default section parser for Readme tool
-ActionSet.name = ReadMe Actions
-ActionSet.menu = Readme &File Editor
-ReadmeAction.label = &Open Readme Browser
-ReadmeAction.tooltip = Open Readme Browser
-ReadmeRetargetAction.label = &Open Readme Browser (Retarget)
-ReadmeRetargetAction.tooltip = Open Readme Browser (Retarget)
-ReadmeRelabelRetargetAction.label = &Open Readme Browser (Retarget - Label Update)
-ReadmeRelabelRetargetAction.tooltip = Open Readme Browser (Retarget - Label Update)
-NewWizard.category = Example Creation Wizards
-NewWizard.name = Readme File
-NewWizard.desc = An example of a wizard that creates sample Readme file
-Editors.ReadmeEditor = &Readme File Editor
-Views.category = &Readme
-Views.ReadmeSections = Readme Sections
-PreferencePage.name = Readme Example
-PropertiesPage.filePage = Readme Tool
-PropertiesPage.filePage2 = More Readme Info
-PopupMenus.action = &Show Readme Action
-PopupMenu.ResourceNav.label = &Readme View Extension
-PopupMenu.ResourceNav.tooltip = Run Readme View Extension
-Editors.Action.label = &Readme Editor Extension
-Editors.Action.tooltip = Run Readme Editor Extension
-ReadmeMarker.name = Readme Marker
\ No newline at end of file
diff --git a/examples/org.eclipse.ui.examples.readmetool/plugin.xml b/examples/org.eclipse.ui.examples.readmetool/plugin.xml
deleted file mode 100644
index 58a0249..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/plugin.xml
+++ /dev/null
@@ -1,307 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!-- ======================================================================= -->
-<!-- The Readme tool is a sample plugin which demonstrates many available -->
-<!-- extension points provided by the workbench, as well as providing its -->
-<!-- own extension point for other plugins to use. -->
-<!-- ======================================================================= -->
-<plugin
- name = "%Plugin.name"
- id = "org.eclipse.ui.examples.readmetool"
- version = "2.1.0"
- provider-name = "%Plugin.providerName"
- class="org.eclipse.ui.examples.readmetool.ReadmePlugin">
-
- <requires>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.eclipse.core.resources"/>
- </requires>
-
- <runtime>
- <library name="readmetool.jar"/>
- </runtime>
-
- <!-- ================================================================== -->
- <!-- Extension point: org.eclipse.ui.examples.readmetool.sectionParser -->
- <!-- Purpose: Provide a custom parser for Readme files which determines -->
- <!-- the file's section and subsection structure -->
- <!-- Extension Implementation: must implement -->
- <!-- org.eclipse.ui.examples.readmetool.IReadmeFileParser -->
- <!-- ================================================================== -->
- <extension-point name="%ExtPoint.sectionParser" id="sectionParser"/>
-
- <extension
- point="org.eclipse.ui.examples.readmetool.sectionParser">
- <parser
- name="%SectionParser.name"
- id="org.eclipse.ui.examples.readmetool.DefaultSectionsParser"
- class="org.eclipse.ui.examples.readmetool.DefaultSectionsParser">
- </parser>
- </extension>
-
- <extension point = "org.eclipse.ui.actionSets">
- <actionSet id="org_eclipse_ui_examples_readmetool_actionSet"
- label="%ActionSet.name"
- visible="true">
- <menu id="org_eclipse_ui_examples_readmetool"
- label="%ActionSet.menu"
- path="window/additions">
- <separator name="slot1"/>
- <separator name="slot2"/>
- <separator name="slot3"/>
- </menu>
- <action id="org_eclipse_ui_examples_readmetool_readmeAction"
- menubarPath="window/org_eclipse_ui_examples_readmetool/slot1"
- toolbarPath="readme"
- label="%ReadmeAction.label"
- tooltip="%ReadmeAction.tooltip"
- helpContextId="org.eclipse.ui.examples.readmetool.open_browser_action_context"
- icon="icons/ctool16/openbrwsr.gif"
- class="org.eclipse.ui.examples.readmetool.WindowActionDelegate"
- enablesFor="1">
- <selection class="org.eclipse.core.resources.IFile"
- name="*.readme">
- </selection>
- </action>
- <action id="org_eclipse_ui_examples_readmetool_readmeRetargetAction"
- menubarPath="window/org_eclipse_ui_examples_readmetool/slot1"
- toolbarPath="readme"
- label="%ReadmeRetargetAction.label"
- tooltip="%ReadmeRetargetAction.tooltip"
- helpContextId="org.eclipse.ui.examples.readmetool.open_browser_action_context"
- icon="icons/ctool16/openbrwsr.gif"
- retarget="true">
- </action>
- <action id="org_eclipse_ui_examples_readmetool_readmeRelabelRetargetAction"
- menubarPath="window/org_eclipse_ui_examples_readmetool/slot1"
- toolbarPath="readme"
- label="%ReadmeRelabelRetargetAction.label"
- tooltip="%ReadmeRelabelRetargetAction.tooltip"
- helpContextId="org.eclipse.ui.examples.readmetool.open_browser_action_context"
- icon="icons/ctool16/openbrwsr.gif"
- retarget="true"
- allowLabelUpdate="true">
- </action>
- </actionSet>
- </extension>
-
- <extension
- point = "org.eclipse.ui.newWizards">
- <category
- id = "org.eclipse.ui.examples.readmetool.new"
- parentCategory="org.eclipse.ui.Examples"
- name="%NewWizard.category">
- </category>
- <wizard
- id = "org.eclipse.ui.examples.readmetool.wizards.new.file"
- name = "%NewWizard.name"
- class="org.eclipse.ui.examples.readmetool.ReadmeCreationWizard"
- category="org.eclipse.ui.Examples/org.eclipse.ui.examples.readmetool.new"
- icon="icons/obj16/newreadme_wiz.gif">
- <description>%NewWizard.desc</description>
- <selection class="org.eclipse.core.resources.IResource"/>
- </wizard>
- </extension>
-
- <extension
- point = "org.eclipse.ui.editors">
- <editor
- id = "org.eclipse.ui.examples.readmetool.ReadmeEditor"
- name="%Editors.ReadmeEditor"
- icon="icons/obj16/editor.gif"
- class="org.eclipse.ui.examples.readmetool.ReadmeEditor"
- extensions="readme"
- contributorClass="org.eclipse.ui.examples.readmetool.ReadmeEditorActionBarContributor">
- </editor>
- </extension>
-
-
- <extension
- point="org.eclipse.ui.views">
- <category
- id="org.eclipse.ui.examples.readmetool"
- name="%Views.category">
- </category>
- <view
- id="org.eclipse.ui.examples.readmetool.views.SectionsView"
- name="%Views.ReadmeSections"
- icon="icons/view16/sections.gif"
- category="org.eclipse.ui.examples.readmetool"
- class="org.eclipse.ui.examples.readmetool.ReadmeSectionsView">
- </view>
- </extension>
-
- <extension
- point = "org.eclipse.ui.preferencePages">
- <page id="org.eclipse.ui.examples.readmetool.Page1"
- class="org.eclipse.ui.examples.readmetool.ReadmePreferencePage"
- name="%PreferencePage.name">
- </page>
- </extension>
-
- <extension
- point = "org.eclipse.ui.propertyPages">
- <page
- id="org.eclipse.ui.examples.readmetool.FilePage"
- name="%PropertiesPage.filePage"
- objectClass="org.eclipse.core.resources.IFile"
- class="org.eclipse.ui.examples.readmetool.ReadmeFilePropertyPage"
- nameFilter="*.readme">
- </page>
- <page
- id="org.eclipse.ui.examples.readmetool.FilePage2"
- name="%PropertiesPage.filePage2"
- objectClass="org.eclipse.core.resources.IFile"
- class="org.eclipse.ui.examples.readmetool.ReadmeFilePropertyPage2"
- nameFilter="*.readme">
- </page>
- </extension>
-
- <extension point = "org.eclipse.ui.popupMenus">
- <objectContribution
- id="org.eclipse.ui.examples.readmetool"
- objectClass="org.eclipse.core.resources.IFile"
- nameFilter="*.readme">
- <action id="org.eclipse.ui.examples.readmetool.action1"
- label="%PopupMenus.action"
- icon="icons/ctool16/openbrwsr.gif"
- menubarPath="additions"
- helpContextId="org.eclipse.ui.examples.readmetool.open_browser_action_context"
- class="org.eclipse.ui.examples.readmetool.PopupMenuActionDelegate"
- enablesFor="1">
- </action>
- </objectContribution>
- <viewerContribution
- id="org.eclipse.ui.examples.readmetool2"
- targetID="org.eclipse.ui.examples.readmetool.outline">
- <action id="org.eclipse.ui.examples.readmetool.action1"
- label="%PopupMenus.action"
- icon="icons/ctool16/openbrwsr.gif"
- menubarPath="additions"
- helpContextId="org.eclipse.ui.examples.readmetool.open_browser_action_context"
- class="org.eclipse.ui.examples.readmetool.ViewActionDelegate">
- </action>
- </viewerContribution>
- </extension>
-
-<extension
- point = "org.eclipse.ui.viewActions">
- <viewContribution
- id="org.eclipse.ui.examples.readmetool.vc1"
- targetID="org.eclipse.ui.views.ResourceNavigator">
- <action id="org.eclipse.ui.examples.readmetool.va1"
- label="%PopupMenu.ResourceNav.label"
- menubarPath="additions"
- toolbarPath="additions"
- icon="icons/obj16/editor.gif"
- tooltip="%PopupMenu.ResourceNav.tooltip"
- helpContextId="org.eclipse.ui.examples.readmetool.view_action_context"
- class="org.eclipse.ui.examples.readmetool.ViewActionDelegate"
- enablesFor="1">
- <selection class="org.eclipse.core.resources.IFile" name="*.readme"/>
- </action>
- </viewContribution>
- </extension>
-
-<extension
- point = "org.eclipse.ui.editorActions">
- <editorContribution
- id="org.eclipse.ui.examples.readmetool.ec1"
- targetID="org.eclipse.ui.examples.readmetool.ReadmeEditor">
- <action id="org.eclipse.ui.examples.readmetool.ea1"
- label="%Editors.Action.label"
- toolbarPath="ReadmeEditor"
- icon="icons/obj16/editor.gif"
- tooltip="%Editors.Action.tooltip"
- class="org.eclipse.ui.examples.readmetool.EditorActionDelegate"
- />
- </editorContribution>
- </extension>
-
- <extension point="org.eclipse.help.contexts">
- <contexts name="HelpContexts.xml"/>
- </extension>
-
- <extension
- point="org.eclipse.ui.dropActions">
- <action
- id="org_eclipse_ui_examples_readmetool_drop_actions"
- class="org.eclipse.ui.examples.readmetool.ReadmeDropActionDelegate">
- </action>
- </extension>
-
- <extension id="readmemarker" point="org.eclipse.core.resources.markers" name="%ReadmeMarker.name">
- <super type="org.eclipse.core.resources.taskmarker"/>
- <super type="org.eclipse.core.resources.textmarker"/>
- <persistent value="true"/>
- <attribute name="org.eclipse.ui.examples.readmetool.id"/>
- <attribute name="org.eclipse.ui.examples.readmetool.level"/>
- <attribute name="org.eclipse.ui.examples.readmetool.department"/>
- <attribute name="org.eclipse.ui.examples.readmetool.code"/>
- <attribute name="org.eclipse.ui.examples.readmetool.language"/>
- </extension>
-
- <extension point="org.eclipse.ui.markerHelp">
- <markerHelp
- markerType="org.eclipse.ui.examples.readmetool.readmemarker"
- helpContextId="org.eclipse.ui.examples.readmetool.marker_example1_context">
- <attribute name="org.eclipse.ui.examples.readmetool.id" value= "1234"/>
- </markerHelp>
- <markerHelp
- markerType="org.eclipse.ui.examples.readmetool.readmemarker"
- helpContextId="org.eclipse.ui.examples.readmetool.marker_example2_context">
- <attribute name="org.eclipse.ui.examples.readmetool.level" value= "7"/>
- </markerHelp>
- <markerHelp
- markerType="org.eclipse.ui.examples.readmetool.readmemarker"
- helpContextId="org.eclipse.ui.examples.readmetool.marker_example3_context">
- <attribute name="org.eclipse.ui.examples.readmetool.level" value= "7"/>
- <attribute name="org.eclipse.ui.examples.readmetool.department" value= "infra"/>
- </markerHelp>
- <markerHelp
- markerType="org.eclipse.ui.examples.readmetool.readmemarker"
- helpContextId="org.eclipse.ui.examples.readmetool.marker_example4_context">
- <attribute name="org.eclipse.ui.examples.readmetool.code" value= "red"/>
- </markerHelp>
- <markerHelp
- markerType="org.eclipse.ui.examples.readmetool.readmemarker"
- helpContextId="org.eclipse.ui.examples.readmetool.marker_example5_context">
- <attribute name="org.eclipse.ui.examples.readmetool.language" value= "english"/>
- </markerHelp>
- <markerHelp
- markerType="org.eclipse.ui.examples.readmetool.readmemarker"
- helpContextId="org.eclipse.ui.examples.readmetool.marker_example6_context">
- <attribute name="org.eclipse.ui.examples.readmetool.id" value= "1234"/>
- <attribute name="org.eclipse.ui.examples.readmetool.level" value= "7"/>
- <attribute name="org.eclipse.ui.examples.readmetool.department" value= "infra"/>
- <attribute name="org.eclipse.ui.examples.readmetool.code" value= "red"/>
- <attribute name="org.eclipse.ui.examples.readmetool.language" value= "english"/>
- </markerHelp>
- <markerHelp
- markerType="org.eclipse.ui.examples.readmetool.readmemarker"
- helpContextId="org.eclipse.ui.examples.readmetool.marker_example7_context">
- </markerHelp>
- </extension>
-
- <extension point="org.eclipse.ui.markerResolution">
- <markerResolutionGenerator
- class="org.eclipse.ui.examples.readmetool.ReadmeMarkerResolutionGenerator"
- markerType="org.eclipse.ui.examples.readmetool.readmemarker">
- <attribute name="org.eclipse.ui.examples.readmetool.id" value= "1234"/>
- </markerResolutionGenerator>
- <markerResolutionGenerator
- class="org.eclipse.ui.examples.readmetool.ReadmeMarkerResolutionGenerator"
- markerType="org.eclipse.ui.examples.readmetool.readmemarker">
- <attribute name="org.eclipse.ui.examples.readmetool.level" value= "7"/>
- </markerResolutionGenerator>
- <markerResolutionGenerator
- class="org.eclipse.ui.examples.readmetool.ReadmeMarkerResolutionGenerator"
- markerType="org.eclipse.ui.examples.readmetool.readmemarker">
- <attribute name="org.eclipse.ui.examples.readmetool.code" value= "red"/>
- <attribute name="org.eclipse.ui.examples.readmetool.language" value= "english"/>
- </markerResolutionGenerator>
-</extension>
-
-
-
-</plugin>
\ No newline at end of file