This commit was manufactured by cvs2svn to create tag 'v20030708a'.
Sprout from master 2003-07-07 21:05:21 UTC Tod Creasey <tod> 'Fixed task info clear'
Cherrypick from master 2003-07-08 15:04:55 UTC Chris McLaren <cmclaren> '*** empty log message ***':
bundles/org.eclipse.ui/schema/commands.exsd
Delete:
bundles/org.eclipse.jface/.classpath
bundles/org.eclipse.jface/.cvsignore
bundles/org.eclipse.jface/.project
bundles/org.eclipse.jface/about.html
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/ContextResolver.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/IContextResolver.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/IStatusLineManager.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/StatusLine.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/StatusLineLayoutData.java
bundles/org.eclipse.jface/src/org/eclipse/jface/action/StatusLineManager.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/SubStatusLineManager.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/ErrorDialog.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/ProgressMonitorDialog.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/operation/AccumulatingProgressMonitor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/operation/IRunnableContext.java
bundles/org.eclipse.jface/src/org/eclipse/jface/operation/IRunnableWithProgress.java
bundles/org.eclipse.jface/src/org/eclipse/jface/operation/ModalContext.java
bundles/org.eclipse.jface/src/org/eclipse/jface/operation/package.html
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/BooleanFieldEditor.java
bundles/org.eclipse.jface/src/org/eclipse/jface/preference/BooleanPropertyAction.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/IPersistentPreferenceStore.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/progress/IElementCollector.java
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_macosx.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/DelegatingDragAdapter.java
bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDropAdapter.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/SafeRunnable.java
bundles/org.eclipse.jface/src/org/eclipse/jface/util/TransferDragSourceListener.java
bundles/org.eclipse.jface/src/org/eclipse/jface/util/TransferDropTargetListener.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/ArrayContentProvider.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/CustomHashtable.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/IColorProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IContentProvider.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IDecoration.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IDoubleClickListener.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IElementComparer.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/ILightweightLabelDecorator.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IOpenListener.java
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IPostSelectionProvider.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/ApplicationWindow.java
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.jface/src/org/eclipse/jface/wizard/IWizard.java
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/IWizardContainer.java
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/IWizardNode.java
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/IWizardPage.java
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/ProgressMonitorPart.java
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/Wizard.java
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardDialog.java
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardPage.java
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardSelectionPage.java
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/images/error.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/images/page.gif
bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/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/about.html
bundles/org.eclipse.ui.views/build.properties
bundles/org.eclipse.ui.views/extensions/org/eclipse/ui/actions/AddTaskAction.java
bundles/org.eclipse.ui.views/extensions/org/eclipse/ui/internal/ViewsPlugin.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/BookmarkPropertiesDialog.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkSorter.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/EditBookmarkAction.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/MarkerUtil.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/PasteBookmarkAction.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/markers/BookmarkView.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/MarkerViewUtil.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/ProblemView.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/TaskView.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionAddGlobalTask.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionCopyMarker.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionDeleteCompleted.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionMarkCompleted.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionMarkerProperties.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionOpenMarker.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionPasteMarker.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionProblemProperties.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionRemoveMarker.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionResolveMarker.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionRevealMarker.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionSelectAll.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionShowOnBuild.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionTaskProperties.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/BookmarkFilter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DefaultMarkerResourceAdapter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogBookmarkFilter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogMarkerFilter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogMarkerProperties.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogProblemFilter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogProblemProperties.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogTaskFilter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogTaskProperties.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldCreationTime.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldDone.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldFolder.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldLineNumber.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldMessage.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldPriority.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldResource.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldSeverity.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FiltersAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IField.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IFilter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IItemsChangedListener.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IMarkerChangedListener.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IMarkerResourceAdapter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ITableViewContentProvider.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ImageFactory.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerFilter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerLabelProvider.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerRegistry.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerType.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerTypesModel.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerView.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/Messages.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/Messages.properties
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ProblemFilter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableContentProvider.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableSortAction.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableSortDialog.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableSorter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableView.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableViewLabelProvider.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TaskFilter.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/Util.java
bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/CollapseAllAction.java
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/LocalSelectionTransfer.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/ToggleLinkingAction.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
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
tests/org.eclipse.ui.tests/.classpath
tests/org.eclipse.ui.tests/.cvsignore
tests/org.eclipse.ui.tests/.project
tests/org.eclipse.ui.tests/Benchmark Tests/org/eclipse/ui/tests/benchmarks/OpenCloseTest.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/preferences/DeprecatedFontPreferenceTestCase.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/preferences/FontPreferenceTestCase.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/AbstractTreeViewerTest.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/AllTests.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/CheckboxTableViewerTest.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/CheckboxTreeViewerTest.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ITestModelListener.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ListViewerTest.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/StructuredItemViewerTest.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/StructuredSelectionTest.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/StructuredViewerTest.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TableTreeViewerTest.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TableViewerTest.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestElement.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestLabelProvider.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestModel.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestModelChange.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestModelContentProvider.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TreeViewerTest.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddChildAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddElementAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddFilterAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddSiblingAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ChangeChildLabelAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ChangeInputLabelAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ChangeLabelAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ClearSelectionAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/CreateModelAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/DeleteAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/DeleteChildrenAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/DeleteSiblingsAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ExpandAllAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/Filter.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/FlushInputAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ResetFilterAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ResetSorterAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/SetLabelProviderAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/SetSorterAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/Sorter.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestBrowser.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestBrowserAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestCheckboxTree.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestList.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestSelectionAction.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTable.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTableTree.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTableTreeLabelProvider.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTree.java
tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/WorldChangedAction.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Component Tests.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Export.txt
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Import.txt
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Navigator.txt
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Outline.txt
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Preferences.txt
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/PropertiesDialog.txt
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/PropertiesView.txt
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Tasks.txt
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/TextEditor.txt
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/WelcomeEditor.txt
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/WorkbenchAction.txt
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/WorkbenchLayout.txt
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Bookmarks View.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/File System Export.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/File System Import.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Navigator View.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/New File Wizard.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/New Folder Wizard.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/New Project Wizard.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Outline View.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Persistence.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Preferences.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Properties Dialog.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Properties View.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Tasks View.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Test Scenarios.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Text Editor
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Welcome Editor.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Window Actions.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Window Layout.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/ZIP Export.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/ZIP Import.html
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/SelectionProviderView.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/TestPlugin.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/UiTestSuite.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptableDecoratorTestCase.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptableResourceWrapper.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptableTestSuite.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptedResourceNavigator.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/NullLabelDecorator.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/ResourceAction.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/TestAdaptableContentProvider.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/TestAdaptableWorkbenchAdapter.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/TestNavigatorActionGroup.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ApiTestSuite.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/DeprecatedSessionRestoreTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IActionBarsTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IActionDelegateTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IActionFilterTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IConstants.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IDeprecatedWorkbenchPageTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorActionBarContributorTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorActionDelegateTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorDescriptorTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorLauncherTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorPartTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorRegistryTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorSiteTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IFileEditorMappingTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPageListenerTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPageServiceTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveDescriptorTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveListenerTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveRegistryTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ISelectionServiceTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IViewActionDelegateTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IViewPartTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IViewSiteTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPageTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPartSiteTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPartTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchTestSuite.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchWindowActionDelegateTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchWindowTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkingSetManagerTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkingSetTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListContentProvider.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListElement.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListElementActionFilter.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListView.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockAction.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockActionDelegate.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockEditorActionBarContributor.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockEditorActionDelegate.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockEditorPart.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockPartListener.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockPropertyListener.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockSelectionProvider.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockViewActionDelegate.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockViewPart.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkbenchPart.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkbenchWindowActionDelegate.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkingSetPage.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkingSetTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/PlatformUITest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionCreateTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionPerspective.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionRestoreTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionView.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/DataTransferTestSuite.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/ImportOperationTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/tests.ini
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DataTransferMessagesCopy.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DataTransferTestStub.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIDialogs.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIDialogsAuto.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIPreferences.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIPreferencesAuto.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIWizards.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIWizardsAuto.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/EnableTestPreferencePage.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/FontFieldEditorTestPreferencePage.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/NavigatorTestStub.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/PreferenceDialogWrapper.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/PropertyDialogWrapper.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/ResourceMessagesCopy.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/ResourceNavigatorMessagesCopy.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/TaskListTestStub.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/TextEditorTestStub.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIAutomatedSuite.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIDialogs.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIDialogsAuto.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIEditWorkingSetWizardAuto.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIErrorDialogs.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIInteractiveSuite.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIMessageDialogs.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIMessageDialogsAuto.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UINewWorkingSetWizardAuto.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIPreferences.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIPreferencesAuto.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWizards.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWizardsAuto.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWorkingSetWizardsAuto.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ActionExpressionTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ActionSetExpressionTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/EditorActionBarsTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedSourceViewer.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedTextEditor.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedTextSelection.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedTextSelectionActionFilter.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/InternalTestSuite.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/PopupMenuExpressionTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/TextSelectionActionExpressionTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/BrokenUpdatePreferencePage.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/UIPreferencesManual.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/AbstractNavigatorTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/DecoratorTestCase.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/DuplicateMenuItemTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/LightweightDecoratorTestCase.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/NavigatorTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/NavigatorTestSuite.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/ResourceNavigatorTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/TestDecoratorContributor.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/TestLightweightDecoratorContributor.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/PropertySheetAuto.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/PropertySheetTestSuite.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ActivateTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/CloseEditorTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/HideViewTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/OpenEditorTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ShowViewTest.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ZoomTestCase.java
tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ZoomTestSuite.java
tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/AccessibilityTestPass.java
tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/FailureDialog.java
tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/FocusTestPass.java
tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/IDialogTestPass.java
tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/SizingTestPass.java
tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/VerifyDialog.java
tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/ActionUtil.java
tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/ArrayUtil.java
tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/CallHistory.java
tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/DialogCheck.java
tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/EmptyPerspective.java
tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/FileUtil.java
tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/UITestCase.java
tests/org.eclipse.ui.tests/about.html
tests/org.eclipse.ui.tests/build.properties
tests/org.eclipse.ui.tests/doc/Introduction.html
tests/org.eclipse.ui.tests/doc/JUnitPractices.html
tests/org.eclipse.ui.tests/icons/anything.gif
tests/org.eclipse.ui.tests/icons/binary_co.gif
tests/org.eclipse.ui.tests/icons/mockeditorpart1.gif
tests/org.eclipse.ui.tests/icons/mockeditorpart2.gif
tests/org.eclipse.ui.tests/icons/view.gif
tests/org.eclipse.ui.tests/plugin.xml
tests/org.eclipse.ui.tests/test.xml
tests/org.eclipse.ui.tests/uiSniff
tests/org.eclipse.ui.tests/uiSniff.bat
diff --git a/bundles/org.eclipse.jface/.classpath b/bundles/org.eclipse.jface/.classpath
deleted file mode 100644
index 9fba30d..0000000
--- a/bundles/org.eclipse.jface/.classpath
+++ /dev/null
@@ -1,9 +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" sourcepath="JRE_SRC"/>
- <classpathentry kind="src" path="/org.eclipse.core.runtime"/>
- <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 cfda1ca..0000000
--- a/bundles/org.eclipse.jface/.project
+++ /dev/null
@@ -1,20 +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.core.runtime</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/about.html b/bundles/org.eclipse.jface/about.html
deleted file mode 100644
index 9db411a..0000000
--- a/bundles/org.eclipse.jface/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.jface/build.properties b/bundles/org.eclipse.jface/build.properties
deleted file mode 100644
index ac0d00e..0000000
--- a/bundles/org.eclipse.jface/build.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-bin.includes = plugin.properties,\
- plugin.xml,\
- about.html,\
- *.jar
-src.includes = about.html
-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 0cb83df..0000000
--- a/bundles/org.eclipse.jface/plugin.properties
+++ /dev/null
@@ -1,12 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-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 4d5a296..0000000
--- a/bundles/org.eclipse.jface/plugin.xml
+++ /dev/null
@@ -1,20 +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="*"/>
- <packages prefixes="org.eclipse.jface"/>
- </library>
- </runtime>
- <requires>
- <import plugin="org.apache.xerces"/>
- <import plugin="org.eclipse.swt" export="true"/>
- <import plugin="org.eclipse.core.runtime"/>
- </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 798a19b..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/AbstractGroupMarker.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-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 5b46efb..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Action.java
+++ /dev/null
@@ -1,1008 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.HelpListener;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * 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 {
- /*
- * The list of default values the action can have. These
- * values will determine the style of the action.
- */
- private static final String VAL_PUSH_BTN = "PUSH_BTN"; //$NON-NLS-1$
- private static final Integer VAL_RADIO_BTN_ON = new Integer(1);
- private static final Integer VAL_RADIO_BTN_OFF = new Integer(0);
- private static final Boolean VAL_TOGGLE_BTN_ON = Boolean.TRUE;
- private static final Boolean VAL_TOGGLE_BTN_OFF = Boolean.FALSE;
- private static final IMenuCreator VAL_DROP_DOWN_MENU = new IMenuCreator() {
- public void dispose() {
- // do nothing
- }
- public Menu getMenu(Control parent) {
- // do nothing
- return null;
- }
- public Menu getMenu(Menu parent) {
- // do nothing
- return null;
- }
- };
-
- /**
- * 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;
- private static String LOCALIZED_COMMAND;
-
- /**
- * 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 for toggle button, or an Integer for radio button), or
- * <code>null</code> if neither have been set.
- * <p>
- * The value of this field affects the value of <code>getStyle()</code>.
- * </p>
- */
- 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 there 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);
- }
-
- /**
- * Creates a new action with the given text and style.
- *
- * @param text the action's text, or <code>null</code> if there is no text
- * @param style one of <code>AS_PUSH_BUTTON</code>, <code>AS_CHECK_BOX</code>,
- * <code>AS_DROP_DOWN_MENU</code>, <code>AS_RADIO_BUTTON</code>, and
- * <code>AS_UNSPECIFIED</code>.
- */
- protected Action(String text, int style) {
- this(text);
- switch (style) {
- case AS_PUSH_BUTTON :
- value = VAL_PUSH_BTN;
- break;
- case AS_CHECK_BOX :
- value = VAL_TOGGLE_BTN_OFF;
- break;
- case AS_DROP_DOWN_MENU :
- value = VAL_DROP_DOWN_MENU;
- break;
- case AS_RADIO_BUTTON :
- value = VAL_RADIO_BTN_OFF;
- break;
- }
- }
-
- /* (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, Alt, or Command
- 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, Alt, or Command
- 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, Command)
- * 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$
- }
- }
-
- if ((keyCode & SWT.COMMAND) != 0) {
- if (modString.equals("")) { //$NON-NLS-1$
- modString = findModifierString(keyCode & SWT.COMMAND);
- } else {
- modString = modString + "+" + findModifierString(keyCode & SWT.COMMAND); //$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 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, SWT.SHIFT, and SWT.COMMAND). 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 SWT
- * @since 2.0
- */
- public static String findKeyString(int keyCode) {
- if (keyStrings == null)
- initKeyStrings();
- int i = keyCode & ~(SWT.CTRL | SWT.ALT | SWT.SHIFT | SWT.COMMAND);
- 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>,
- * <code>"ALT"</code>, and <code>"COMMAND"</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 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;
- if (token.equals("COMMAND")) //$NON-NLS-1$
- return SWT.COMMAND;
- 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;
- if (token.equals(LOCALIZED_COMMAND)) //$NON-NLS-1$
- return SWT.COMMAND;
- 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$
- LOCALIZED_COMMAND = JFaceResources.getString("Command").toUpperCase(); //$NON-NLS-1$
- }
-
- /**
- * Returns a string representation of an SWT modifier bit (SWT.CTRL,
- * SWT.ALT, SWT.SHIFT, and SWT.COMMAND). 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 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$
- if (keyCode == SWT.COMMAND)
- return JFaceResources.getString("Command"); //$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() {
- // The default drop down menu value is only used
- // to mark this action requested style. So do not
- // return it. For backward compatibility reasons.
- if (value == VAL_DROP_DOWN_MENU)
- return null;
- if (value instanceof IMenuCreator)
- return (IMenuCreator) value;
- return null;
- }
- /* (non-Javadoc)
- * Method declared on IAction.
- */
- public int getStyle() {
- // Infer the style from the value field.
- if (value == VAL_PUSH_BTN || value == null)
- return AS_PUSH_BUTTON;
- if (value == VAL_TOGGLE_BTN_ON || value == VAL_TOGGLE_BTN_OFF)
- return AS_CHECK_BOX;
- if (value == VAL_RADIO_BTN_ON || value == VAL_RADIO_BTN_OFF)
- return AS_RADIO_BUTTON;
- if (value instanceof IMenuCreator)
- return AS_DROP_DOWN_MENU;
-
- // We should never get to this line...
- 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() {
- return value == VAL_TOGGLE_BTN_ON || value == VAL_RADIO_BTN_ON;
- }
- /* (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>runWithEvent(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;
- }
- /* (non-Javadoc)
- * Method declared on IAction.
- */
- public void setChecked(boolean checked) {
- Object newValue = null;
-
- // For backward compatibility, if the style is not
- // set yet, then convert it to a toggle button.
- if (value == null || value == VAL_TOGGLE_BTN_ON || value == VAL_TOGGLE_BTN_OFF) {
- newValue = checked ? VAL_TOGGLE_BTN_ON : VAL_TOGGLE_BTN_OFF;
- } else if (value == VAL_RADIO_BTN_ON || value == VAL_RADIO_BTN_OFF) {
- newValue = checked ? VAL_RADIO_BTN_ON : VAL_RADIO_BTN_OFF;
- } else {
- // Some other style already, so do nothing.
- return;
- }
-
- if (newValue != value) {
- value = newValue;
- if (checked)
- firePropertyChange(CHECKED, Boolean.FALSE, Boolean.TRUE);
- else
- firePropertyChange(CHECKED, Boolean.TRUE, Boolean.FALSE);
- }
- }
- /* (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) {
- // For backward compatibility, if the style is not
- // set yet, then convert it to a drop down menu.
- if (value == null) {
- value = creator;
- return;
- }
-
- if (value instanceof IMenuCreator)
- value = creator == null ? VAL_DROP_DOWN_MENU : 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 e242333..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ActionContributionItem.java
+++ /dev/null
@@ -1,823 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-import org.eclipse.swt.widgets.Widget;
-
-/**
- * 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 boolean USE_COLOR_ICONS = true;
-
- 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;
-
- /**
- * Listener for action property change notifications.
- */
- private final IPropertyChangeListener propertyListener = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- actionPropertyChange(event);
- }
- };
-
- /**
- * Listener for SWT button widget events.
- */
- private Listener buttonListener;
-
- /**
- * Listener for SWT tool item widget events.
- */
- private Listener toolItemListener;
-
- /**
- * Listener for SWT menu item widget events.
- */
- private Listener menuItemListener;
-
- private static 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();
- }
- }
-
-public boolean isVisible() {
- IAction action = getAction();
-
- if (action != null) {
- String commandId = action.getActionDefinitionId();
- IContextResolver contextResolver = ContextResolver.getInstance().getContextResolver();
-
- if (contextResolver != null) {
- return contextResolver.inContext(commandId);
- }
- }
-
- return true;
- //return visible;
-}
-
-/**
- * Returns whether color icons should be used in toolbars.
- *
- * @return <code>true</code> if color icons should be used in toolbars,
- * <code>false</code> otherwise
- */
-public static boolean getUseColorIconsInToolbars() {
- return USE_COLOR_ICONS;
-}
-
-/**
- * Sets whether color icons should be used in toolbars.
- *
- * @param useColorIcons <code>true</code> if color icons should be used in toolbars,
- * <code>false</code> otherwise
- */
-public static void setUseColorIconsInToolbars(boolean useColorIcons) {
- USE_COLOR_ICONS = useColorIcons;
-}
-
-/**
- * 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 an SWT <code>Button</code> for
- * the action using the action's style. If the action's checked property has
- * been set, the 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;
- if (action.getStyle() == IAction.AS_RADIO_BUTTON)
- flags = SWT.RADIO;
- }
-
- Button b = new Button(parent, flags);
- b.setData(this);
- b.addListener(SWT.Dispose, getButtonListener());
- // Don't hook a dispose listener on the parent
- b.addListener(SWT.Selection, getButtonListener());
- if (action.getHelpListener() != null)
- b.addHelpListener(action.getHelpListener());
- widget = b;
- parentWidget = parent;
-
- update(null);
-
- action.addPropertyChangeListener(propertyListener);
- }
-}
-/**
- * The <code>ActionContributionItem</code> implementation of this
- * <code>IContributionItem</code> method creates an SWT <code>MenuItem</code>
- * for the action using the action's style. If the action's checked property has
- * been set, a 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) {
- Menu subMenu= 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_RADIO_BUTTON)
- flags = SWT.RADIO;
- else if (style == IAction.AS_DROP_DOWN_MENU) {
- IMenuCreator mc = action.getMenuCreator();
- if (mc != null) {
- 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.Dispose, getMenuItemListener());
- mi.addListener(SWT.Selection, getMenuItemListener());
- if (action.getHelpListener() != null)
- mi.addHelpListener(action.getHelpListener());
-
- if (subMenu != null)
- mi.setMenu(subMenu);
-
- update(null);
-
- action.addPropertyChangeListener(propertyListener);
- }
-}
-/**
- * The <code>ActionContributionItem</code> implementation of this ,
- * <code>IContributionItem</code> method creates an SWT <code>ToolItem</code>
- * for the action using the action's style. If the action's checked property has
- * been set, a 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_RADIO_BUTTON)
- flags = SWT.RADIO;
- 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, getToolItemListener());
- ti.addListener(SWT.Dispose, getToolItemListener());
-
- widget = ti;
- parentWidget = parent;
-
- update(null);
-
- action.addPropertyChangeListener(propertyListener);
- }
-}
-/**
- * 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;
-}
-/**
- * Returns the listener for SWT button widget events.
- *
- * @return a listener for button events
- */
-private Listener getButtonListener() {
- if (buttonListener == null) {
- buttonListener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Dispose:
- handleWidgetDispose(event);
- break;
- case SWT.Selection:
- Widget ew = event.widget;
- if (ew != null) {
- handleWidgetSelection(event, ((Button)ew).getSelection());
- }
- break;
- }
- }
- };
- }
- return buttonListener;
-}
-/**
- * Returns the listener for SWT tool item widget events.
- *
- * @return a listener for tool item events
- */
-private Listener getToolItemListener() {
- if (toolItemListener == null) {
- toolItemListener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Dispose:
- handleWidgetDispose(event);
- break;
- case SWT.Selection:
- Widget ew = event.widget;
- if (ew != null) {
- handleWidgetSelection(event, ((ToolItem)ew).getSelection());
- }
- break;
- }
- }
- };
- }
- return toolItemListener;
-}
-/**
- * Returns the listener for SWT menu item widget events.
- *
- * @return a listener for menu item events
- */
-private Listener getMenuItemListener() {
- if (menuItemListener == null) {
- menuItemListener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Dispose:
- handleWidgetDispose(event);
- break;
- case SWT.Selection:
- Widget ew = event.widget;
- if (ew != null) {
- handleWidgetSelection(event, ((MenuItem)ew).getSelection());
- }
- break;
- }
- }
- };
- }
- return menuItemListener;
-}
-/**
- * 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
- if (action.getStyle() == IAction.AS_DROP_DOWN_MENU) {
- IMenuCreator mc = action.getMenuCreator();
- if (mc != null) {
- mc.dispose();
- }
- }
- action.removePropertyChangeListener(propertyListener);
- widget = null;
- }
-}
-/**
- * Handles a widget selection event.
- */
-private void handleWidgetSelection(Event e, boolean selection) {
- 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(selection);
- }
- } else if ((style & SWT.RADIO) != 0) {
- if (action.getStyle() == IAction.AS_RADIO_BUTTON) {
- action.setChecked(selection);
- }
- } 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();
- if (mc != null) {
- 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()) {
- boolean trace = "true".equalsIgnoreCase(Platform.getDebugOption("org.eclipse.jface/trace/actions")); //$NON-NLS-1$ //$NON-NLS-2$
- long ms = System.currentTimeMillis();
- if(trace)
- System.out.println("Running action: " + action.getText()); //$NON-NLS-1$
- action.runWithEvent(e);
- if(trace)
- System.out.println((System.currentTimeMillis() - ms) + " ms to run action: " + action.getText()); //$NON-NLS-1$
- }
- }
-}
-/* (non-Javadoc)
- * Method declared on Object.
- */
-public int hashCode() {
- return action.hashCode();
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public boolean isEnabled() {
- return action != null && action.isEnabled();
-}
-/**
- * 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() {
- if(widget instanceof MenuItem) {
- //Optimization. Only recreate the item is the check or radio style has changed.
- boolean itemIsCheck = (widget.getStyle() & SWT.CHECK) != 0;
- boolean actionIsCheck = getAction() != null && getAction().getStyle() == IAction.AS_CHECK_BOX;
- boolean itemIsRadio = (widget.getStyle() & SWT.RADIO) != 0;
- boolean actionIsRadio = getAction() != null && getAction().getStyle() == IAction.AS_RADIO_BUTTON;
- return (itemIsCheck != actionIsCheck) || (itemIsRadio != actionIsRadio);
- }
- return false;
-}
-/**
- * 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 || action.getStyle() == IAction.AS_RADIO_BUTTON)
- && (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) {
- if(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) {
- if (USE_COLOR_ICONS) {
- Image image = cache.getImage(action.getHoverImageDescriptor());
- if (image == null) {
- image = cache.getImage(action.getImageDescriptor());
- }
- Image disabledImage = cache.getImage(action.getDisabledImageDescriptor());
-
- // Make sure there is a valid image.
- if (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).setImage(image);
-
- return image != null;
- }
- else {
- 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/ContextResolver.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContextResolver.java
deleted file mode 100644
index 98d0e2e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContextResolver.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.action;
-
-public class ContextResolver {
-
- private static ContextResolver instance;
-
- public static ContextResolver getInstance() {
- if (instance == null)
- instance = new ContextResolver();
-
- return instance;
- }
-
- private IContextResolver contextResolver;
-
- private ContextResolver() {
- super();
- }
-
- public IContextResolver getContextResolver() {
- return contextResolver;
- }
-
- public void setContextResolver(IContextResolver contextResolver) {
- this.contextResolver = contextResolver;
- }
-}
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 1ffd296..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionItem.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-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 dispose() {
-}
-/**
- * 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 isDirty() {
- return isDynamic();
-}
-/**
- * The default implementation of this <code>IContributionItem</code>
- * method returns <code>true</code>. Subclasses may override.
- */
-public boolean isEnabled() {
- return true;
-}
-/**
- * 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 65e0ae6..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ContributionManager.java
+++ /dev/null
@@ -1,373 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-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);
-}
-/**
- * Returns the index of the item with the given id.
- *
- * @return <code>int</code> the index or -1 if the item is not found
- */
-public int indexOf(String id) {
- for (int i = 0; i < contributions.size(); i++) {
- IContributionItem item = (IContributionItem) contributions.get(i);
- String itemId = item.getId();
- if (itemId != null && itemId.equalsIgnoreCase(id))
- return i;
- }
- return -1;
-}
-/**
- * Insert the item at the given index.
- */
-public void insert(int index, IContributionItem item) {
- if (index > contributions.size())
- throw new IndexOutOfBoundsException("inserting " + item.getId() + " at " + index); //$NON-NLS-1$ //$NON-NLS-2$
- item.setParent(this);
- contributions.add(index, item);
- itemAdded(item);
-}
-/* (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 " + 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() {
- if(isDirty)
- return true;
- if(hasDynamicItems()) {
- for (Iterator iter = contributions.iterator(); iter.hasNext();) {
- IContributionItem item = (IContributionItem)iter.next();
- if(item.isDirty())
- return true;
- }
- }
- return false;
-}
-/* (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 1d33e9c..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ControlContribution.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-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 d3cb0f5..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/GroupMarker.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-
-/**
- * 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 22bee0d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IAction.java
+++ /dev/null
@@ -1,438 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.swt.events.HelpListener;
-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>0</code>) indicating action style
- * is not specified yet. By default, the action will assume a push button
- * style. If <code>setChecked</code> is called, then the style will change
- * to a check box, or if <code>setMenuCreator</code> is called, then the
- * style will change to a drop down menu.
- *
- * @since 2.1
- */
- public static int AS_UNSPECIFIED = 0x00;
-
- /**
- * 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 (or a toggle button).
- */
- 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;
-
- /**
- * Action style constant (value <code>8</code>) indicating action is
- * a radio button.
- *
- * @since 2.1
- */
- public static int AS_RADIO_BUTTON = 0x08;
-
- /**
- * 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>). Applicable when the style is
- * <code>AS_CHECK_BOX</code> or <code>AS_RADIO_BUTTON</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>,
- * <code>AS_RADIO_BUTTON</code> and <code>AS_DROP_DOWN_MENU</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. Applicable only if the style is
- * <code>AS_CHECK_BOX</code> or <code>AS_RADIO_BUTTON</code>.
- * <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. Applicable for the styles
- * <code>AS_CHECK_BOX</code> or <code>AS_RADIO_BUTTON</code>.
- * <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. Applicable for style
- * <code>AS_DROP_DOWN_MENU</code>.
- *
- * @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.
- * @deprecated
- */
-public void setAccelerator(int keycode);
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContextResolver.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContextResolver.java
deleted file mode 100644
index e5313f2..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContextResolver.java
+++ /dev/null
@@ -1,17 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.action;
-
-public interface IContextResolver {
-
- boolean inContext(String commandId);
-}
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 c277d88..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionItem.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.action;
-
-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 {
-
- /**
- * Disposes of this contribution item. Called by the parent
- * contribution manager when the manager is being disposed.
- * Clients should not call this method directly.
- *
- * @since 2.1
- */
- public void dispose();
- /**
- * 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 enabled.
- *
- * @return <code>true</code> if this item is enabled
- */
- public boolean isEnabled();
- /**
- * Returns whether this contribution item is dirty. A dirty item will be
- * recreated when the action bar is updated.
- *
- * @return <code>true</code> if this item is dirty
- */
- public boolean isDirty();
- /**
- * 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);
-}
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 d26d571..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManager.java
+++ /dev/null
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-
-/**
- * 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 f68c809..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IContributionManagerOverrides.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-
-/**
- * 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 55cf411..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuCreator.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-
-/**
- * Interface for something that creates and disposes of SWT menus. Note that
- * it is the responsibility of the implementor to dispose of SWT menus it
- * creates.
- */
-public interface IMenuCreator {
-/**
- * Disposes the menu returned by <code>getMenu</code>. Does nothing
- * if there is no menu. This method will be executed only when the
- * parent of the menu is disposed.
- */
-public void dispose();
-/**
- * Returns the SWT menu, created as a pop up menu parented by the
- * given control. In most cases, this menu can be created once, cached and reused
- * when the pop-up/drop-down action occurs. If the menu must be dynamically
- * created (i.e., each time it is popped up or dropped down), the old menu
- * should be disposed of before replacing it with the new menu.
- *
- * @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. In most cases, this menu can be created once, cached and reused
- * when the pop-up/drop-down action occurs. If the menu must be dynamically
- * created (i.e., each time it is popped up or dropped down), the old menu
- * should be disposed of before replacing it with the new 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 a1199b2..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuListener.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-
-/**
- * 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 6e02b30..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IMenuManager.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-
-/**
- * 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/IStatusLineManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IStatusLineManager.java
deleted file mode 100644
index f02e3e6..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IStatusLineManager.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-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.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 d0a80e1..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/IToolBarManager.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-
-/**
- * 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 4012f9e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/MenuManager.java
+++ /dev/null
@@ -1,650 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-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 {
-
- private final static String PERMANENT = "lkg84hsdf098a!243lkjha9SDFlkjhsdfXlkjhsfdkljhfds$#$%sdfa68fgh"; //$NON-NLS-1$
-
- /**
- * 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;
-
-
-/**
- * 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 <code>Decorations</code>, and installs all registered
- * contributions. Does not create a new control if one already exists.
- *
- * @param parent the parent decorations
- * @return the menu control
- * @since 2.1
- */
-public Menu createMenuBar(Decorations parent) {
- if (!menuExist()) {
- menu = new Menu(parent, SWT.BAR);
- update(false);
- }
- return menu;
-}
-/**
- * Creates and returns an SWT menu bar control for this menu, for use in the
- * given <code>Shell</code>, and installs all registered contributions. Does not
- * create a new control if one already exists. This implementation simply calls
- * the <code>createMenuBar(Decorations)</code> method
- *
- * @param parent the parent decorations
- * @return the menu control
- * @deprecated use <code>createMenuBar(Decorations)</code> instead.
- */
-public Menu createMenuBar(Shell parent) {
- return createMenuBar((Decorations)parent);
-}
-/**
- * Disposes of this menu manager and frees all allocated SWT resources.
- * Notifies all contribution items of the dispose. 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;
- }
-
- IContributionItem[] items = getItems();
- for (int i = 0; i < items.length; i++) {
- items[i].dispose();
- }
-}
-/* (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,true);
-}
-/**
- * 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)
- MenuItem[] mi= menu.getItems();
-
- for (int i= 0; i < mi.length; i++) {
- if (PERMANENT.equals(mi[i].getData(PERMANENT)))
- continue;
-
- Object data = mi[i].getData();
-
- if (data == null || !clean.contains(data)) {
- mi[i].dispose();
- } else if (data instanceof IContributionItem &&
- ((IContributionItem)data).isDynamic() &&
- ((IContributionItem)data).isDirty()) {
- 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;
-
- while (srcIx < mi.length && PERMANENT.equals(mi[srcIx].getData(PERMANENT))) {
- srcIx++;
- destIx++;
- }
-
- // 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);
- }
-
- }
-
- // remove any old menu items not accounted for
- for (; srcIx < mi.length; srcIx++) {
- if (!PERMANENT.equals(mi[srcIx].getData(PERMANENT)))
- mi[srcIx].dispose();
- }
-
- setDirty(false);
- }
- } 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);
- }
- }
- }
- }
- }
- updateMenuItem();
-}
-/* (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() {
-/*
- * Commented out until proper solution to enablement of
- * menu item for a sub-menu is found. See bug 30833 for
- * more details.
- *
- if (menuItem != null && !menuItem.isDisposed() && menuExist()) {
- IContributionItem items[] = getItems();
- boolean enabled = false;
- for (int i = 0; i < items.length; i++) {
- IContributionItem item = items[i];
- enabled = item.isEnabled();
- if(enabled) break;
- }
- // Workaround for 1GDDCN2: SWT:Linux - MenuItem.setEnabled() always causes a redraw
- if (menuItem.getEnabled() != enabled)
- menuItem.setEnabled(enabled);
- }
-*/
- // Partial fix for bug #34969 - diable the menu item if no
- // items in sub-menu (for context menus).
- 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) {
- // We only do this for context menus (for bug #34969)
- Menu topMenu = menu;
- while (topMenu.getParentMenu() != null)
- topMenu = topMenu.getParentMenu();
- if ((topMenu.getStyle() & SWT.BAR) == 0)
- menuItem.setEnabled(enabled);
- }
- }
-}
-
-}
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 b677f6c..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/Separator.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-
-/**
- * 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/StatusLine.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/StatusLine.java
deleted file mode 100644
index 710387c..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/StatusLine.java
+++ /dev/null
@@ -1,534 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.action;
-
-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.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-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 Composite fProgressBarComposite;
- 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$
- }
-
- /**
- * Layout the contribution item controls on the status line.
- */
- public class StatusLineLayout extends Layout {
- private final StatusLineLayoutData DEFAULT_DATA = new StatusLineLayoutData();
-
- 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 == fProgressBarComposite && !fProgressIsVisible)
- useWidth= false;
- else if (w == fToolBar && !fCancelButtonIsVisible)
- useWidth= false;
- StatusLineLayoutData data = (StatusLineLayoutData)w.getLayoutData();
- if (data == null)
- data = DEFAULT_DATA;
- Point e= w.computeSize(data.widthHint, data.heightHint, 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);
- fProgressBarComposite.moveBelow(fToolBar);
-
- Rectangle rect= composite.getClientArea();
- Control[] children= composite.getChildren();
- int count= children.length;
-
- int ws[]= new int[count];
-
- int h= rect.height;
- int totalWidth= -GAP;
- for (int i= 0; i < count; i++) {
- Control w= children[i];
- if (w == fProgressBarComposite && !fProgressIsVisible)
- continue;
- if (w == fToolBar && !fCancelButtonIsVisible)
- continue;
- StatusLineLayoutData data = (StatusLineLayoutData)w.getLayoutData();
- if (data == null)
- data = DEFAULT_DATA;
- int width= w.computeSize(data.widthHint, h, 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;
- 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 == fProgressBarComposite && !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();
- }
- });
-
- // We create a composite to create the progress bar in
- // so that it can be centered. See bug #32331
- fProgressBarComposite = new Composite(this, SWT.NONE);
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- fProgressBarComposite.setLayout(layout);
- fProgressBar= new ProgressIndicator(fProgressBarComposite);
- fProgressBar.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
-
- 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) {
- final long timestamp = System.currentTimeMillis();
- fStartTime = timestamp;
- final boolean animated = (totalWork == UNKNOWN || totalWork == 0);
- // make sure the progress bar is made visible while
- // the task is running. Fixes bug 32198 for the non-animated case.
- Runnable timer = new Runnable() {
- public void run() {
- StatusLine.this.startTask(timestamp, animated);
- }
- };
- fProgressBar.getDisplay().timerExec(DELAY_PROGRESS, timer);
- if (!animated) {
- 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 (fProgressBarComposite != null && !fProgressBarComposite.isDisposed())
- fProgressBarComposite.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.isDisposed()) {
- fToolBar.setVisible(true);
- fToolBar.setEnabled(true);
- fToolBar.setCursor(fStopButtonCursor);
- fCancelButtonIsVisible= true;
- }
- }
- /**
- * Shows the Cancel button and ProgressIndicator.
- * @private
- */
- protected void showProgress() {
- if (!fProgressIsVisible && !isDisposed()) {
- fProgressIsVisible= true;
- if (fCancelEnabled)
- showButton();
- if (fProgressBarComposite != null && !fProgressBarComposite.isDisposed())
- fProgressBarComposite.setVisible(true);
- layout();
- }
- }
- /**
- * @private
- */
- void startTask(final long timestamp, final boolean animated) {
- if (!fProgressIsVisible && fStartTime == timestamp) {
- showProgress();
- if (animated) {
- if (fProgressBar != null && !fProgressBar.isDisposed()) {
- 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.jface/src/org/eclipse/jface/action/StatusLineLayoutData.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/StatusLineLayoutData.java
deleted file mode 100644
index 34732be..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/StatusLineLayoutData.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.action;
-
-import org.eclipse.swt.SWT;
-
-/**
- * Represents the layout data object for <code>Control</code> within the status line.
- * To set a <code>StatusLineLayoutData</code> object into a <code>Control</code>, use
- * the <code>setLayoutData()</code> method.
- * <p>
- * NOTE: Do not reuse <code>StatusLineLayoutData</code> objects. Every control in the
- * status line must have a unique <code>StatusLineLayoutData</code> instance or
- * <code>null</code>.
- * </p>
- *
- * @since 2.1
- */
-public class StatusLineLayoutData {
- /**
- * The <code>widthHint</code> specifies a minimum width for
- * the <code>Control</code>. A value of <code>SWT.DEFAULT</code>
- * indicates that no minimum width is specified.
- *
- * The default value is <code>SWT.DEFAULT</code>.
- */
- public int widthHint = SWT.DEFAULT;
-
- /**
- * The <code>heightHint</code> specifies a minimum height for
- * the <code>Control</code>. A value of <code>SWT.DEFAULT</code>
- * indicates that no minimum height is specified.
- *
- * The default value is <code>SWT.DEFAULT</code>.
- */
- public int heightHint = SWT.DEFAULT;
-
-
- /**
- * Creates an initial status line layout data object.
- */
- public StatusLineLayoutData() {
- super();
- }
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/StatusLineManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/StatusLineManager.java
deleted file mode 100644
index 5f95e15..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/StatusLineManager.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * 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.
- * Notifies all contribution items of the dispose. 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;
-
- IContributionItem items[] = getItems();
- for (int i = 0; i < items.length; i++) {
- items[i].dispose();
- }
-}
-/**
- * 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;
- Control previousControl = ws[srcIx - 1];
-
- for (int i = 0; i < items.length; ++i) {
- src= (IContributionItem) items[i];
-
- // if not active skip this one
- if (!src.isVisible())
- 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: ");
- previousControl = ws[srcIx];
- 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);
- // To keep the Control order the same as the contribution item
- // otherwise, if a contribution item in the middle becomes visible
- // the control will appear at the end.
- newChildren[j].moveBelow(previousControl);
- previousControl = newChildren[j];
- }
- oldChildCount = newChildren.length;
- }
- destIx++;
- }
-
- // remove any old status line items not accounted for
- for (; srcIx < ws.length; srcIx++) {
- ws[srcIx].dispose();
- }
- }
- setDirty(false);
-
- statusLine.layout();
- statusLine.setRedraw(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 56a0c4d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionItem.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-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;
-}
-/**
- * The default implementation of this <code>IContributionItem</code>
- * delegates to the inner item. Subclasses may override.
- */
-public void dispose() {
- innerItem.dispose();
-}
-/* (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 isEnabled() {
- return innerItem.isEnabled();
-}
-/* (non-Javadoc)
- * Method declared on IContributionItem.
- */
-public boolean isDirty() {
- return innerItem.isDirty();
-}
-/* (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 a8b2a08..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubContributionManager.java
+++ /dev/null
@@ -1,305 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-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 e7a9e60..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubMenuManager.java
+++ /dev/null
@@ -1,298 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.ToolBar;
-
-/**
- * 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 {
- /**
- * 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);
- }
- /**
- * The default implementation of this <code>IContributionItem</code>
- * method does nothing. Subclasses may override.
- */
- public void dispose() {
- }
- /* (non-Javadoc)
- * Method declared on IMenuManager.
- */
- public void addMenuListener(IMenuListener listener) {
- getParentMenuManager().addMenuListener(listener);
- }
- /* (non-Javadoc)
- * Method declared on IMenuManager.
- */
- public void fill(Composite parent) {
- if (isVisible())
- getParentMenuManager().fill(parent);
- }
- /* (non-Javadoc)
- * Method declared on IMenuManager.
- */
- public void fill(Menu parent, int index) {
- if (isVisible())
- getParentMenuManager().fill(parent, index);
- }
- /* (non-Javadoc)
- * Method declared on IMenuManager.
- */
- public void fill(ToolBar parent, int index) {
- if (isVisible())
- getParentMenuManager().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 = getParentMenuManager().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;
- }
- /**
- * Returns the parent menu manager that this sub-manager contributes to.
- */
- protected final IMenuManager getParentMenuManager() {
- // Cast is ok because that's the only
- // thing we accept in the construtor.
- return (IMenuManager)getParent();
- }
- /* (non-Javadoc)
- * Method declared on IMenuManager.
- */
- public String getId() {
- return getParentMenuManager().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 getParentMenuManager().isDynamic();
- }
- /* (non-Javadoc)
- * Method declared on IMenuManager.
- */
- public boolean isEnabled() {
- return isVisible() && getParentMenuManager().isEnabled();
- }
- /* (non-Javadoc)
- * Method declared on IMenuManager.
- */
- public boolean isGroupMarker() {
- return getParentMenuManager().isGroupMarker();
- }
- /* (non-Javadoc)
- * Method declared on IMenuManager.
- */
- public boolean isSeparator() {
- return getParentMenuManager().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) {
- getParentMenuManager().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-NLS-1$
- }
- /* (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.
- getParentMenuManager().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.
- getParentMenuManager().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.
- getParentMenuManager().updateAll(force);
- }
- /* (non-Javadoc)
- * Method declared on IContributionItem.
- */
- public void update(String id) {
- getParentMenuManager().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/SubStatusLineManager.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubStatusLineManager.java
deleted file mode 100644
index 66c06cf..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubStatusLineManager.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * 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 {
- /**
- * Current status line message.
- */
- private String message;
-
- /**
- * Current status line error message.
- */
- private String errorMessage;
-
- /**
- * Current status line message image.
- */
- private Image messageImage;
-
- /**
- * Current status line error image
- */
- private Image errorImage;
-
- /**
- * 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);
- }
- /**
- * Returns the parent status line manager that this sub-manager contributes
- * to.
- */
- protected final IStatusLineManager getParentStatusLineManager() {
- // Cast is ok because that's the only
- // thing we accept in the construtor.
- return (IStatusLineManager)getParent();
- }
- /* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
- public IProgressMonitor getProgressMonitor() {
- return getParentStatusLineManager().getProgressMonitor();
- }
- /* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
- public boolean isCancelEnabled() {
- return getParentStatusLineManager().isCancelEnabled();
- }
- /* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
- public void setCancelEnabled(boolean enabled) {
- getParentStatusLineManager().setCancelEnabled(enabled);
- }
- /* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
- public void setErrorMessage(String message) {
- this.errorImage = null;
- this.errorMessage = message;
- if (isVisible())
- getParentStatusLineManager().setErrorMessage(errorMessage);
- }
- /* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
- public void setErrorMessage(Image image, String message) {
- this.errorImage = image;
- this.errorMessage = message;
- if (isVisible())
- getParentStatusLineManager().setErrorMessage(errorImage, errorMessage);
- }
- /* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
- public void setMessage(String message) {
- this.messageImage = null;
- this.message = message;
- if (isVisible())
- getParentStatusLineManager().setMessage(message);
- }
- /* (non-Javadoc)
- * Method declared on IStatusLineManager.
- */
- public void setMessage(Image image, String message) {
- this.messageImage = image;
- this.message = message;
- if (isVisible())
- getParentStatusLineManager().setMessage(messageImage, message);
- }
- /* (non-Javadoc)
- * Method declared on SubContributionManager.
- */
- public void setVisible(boolean visible) {
- super.setVisible(visible);
- if (visible) {
- getParentStatusLineManager().setErrorMessage(errorImage, errorMessage);
- getParentStatusLineManager().setMessage(messageImage, message);
- } else {
- getParentStatusLineManager().setMessage(null, null);
- getParentStatusLineManager().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.
- getParentStatusLineManager().update(force);
- }
-}
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 6823a8d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/SubToolBarManager.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-
-/**
- * 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 {
-
- /**
- * 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);
- }
-
- /**
- * Returns the parent toolbar manager that this sub-manager contributes to.
- */
- protected final IToolBarManager getParentToolBarManager() {
- // Cast is ok because that's the only
- // thing we accept in the construtor.
- return (IToolBarManager)getParent();
- }
-
- /* (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.
- getParentToolBarManager().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 2c04da5..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/action/ToolBarManager.java
+++ /dev/null
@@ -1,280 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.action;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-
-/**
- * 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 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.
- * Notifies all contribution items of the dispose. 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;
-
- IContributionItem[] items = getItems();
- for (int i = 0; i < items.length; i++) {
- items[i].dispose();
- }
-}
-/**
- * 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)
- ToolItem[] 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);
- }
- }
-
- // remove any old tool items not accounted for
- for (int i = mi.length; --i >= srcIx;) {
- ToolItem item = mi[i];
- if (!item.isDisposed()) {
- Control ctrl = item.getControl();
- if (ctrl != null) {
- item.setControl(null);
- ctrl.dispose();
- }
- item.dispose();
- }
- }
-
- 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 d47876f..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 a824dfb..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ControlEnableState.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * 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 1bb529b..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java
+++ /dev/null
@@ -1,825 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-import java.util.HashMap;
-
-import org.eclipse.jface.resource.*;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-/**
- * 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());
- }
-
- /*
- * @see Window.initializeBounds()
- */
- protected void initializeBounds() {
- String platform = SWT.getPlatform();
- if ("carbon".equals(platform)) { //$NON-NLS-1$
- // On Mac OS X the default button must be the right-most button
- Shell shell = getShell();
- if (shell != null) {
- Button defaultButton = shell.getDefaultButton();
- if (defaultButton != null
- && isContained(buttonBar, defaultButton))
- defaultButton.moveBelow(null);
- }
- }
- super.initializeBounds();
- }
-
- /**
- * Returns true if the given Control c is a direct or indirect child of
- * container.
- */
- private boolean isContained(Control container, Control c) {
- Composite parent;
- while ((parent = c.getParent()) != null) {
- if (parent == container)
- return true;
- c = parent;
- }
- return false;
- }
-
- /**
- * 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(Composite, int, String, boolean)
- * @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(Composite, int, String, boolean)
- * @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(Composite, int, String, boolean)
- * @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(JFaceResources.getDialogFont());
- 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();
- }
-
- /**
- * Set the layout data of the button to a GridData with
- * appropriate heights and widths.
- * @param button
- */
- 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);
- }
-
- /**
- * Set the layout data of the button to a FormData with appropriate heights and
- * widths.
- * @param button
- */
- protected void setButtonLayoutFormData(Button button) {
- FormData data = new FormData();
- data.height =
- convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint =
- convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- data.width =
- 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;
- }
-
- /**
- * Applies the dialog font to all controls that currently have the default
- * font.
- *
- * @param control the control to apply the font to. Font will also be applied to
- * its children. If the control is <code>null</code> nothing happens.
- */
- public static void applyDialogFont(Control control) {
- if(control == null)
- return;
- Font dialogFont = JFaceResources.getDialogFont();
- Font defaultFont = JFaceResources.getDefaultFont();
- applyDialogFont(control, dialogFont, defaultFont);
- }
-
- /**
- * Sets the dialog font on the control and any of its children if thier
- * font is not otherwise set.
- *
- * @param control the control to apply the font to. Font will also be applied to
- * its children.
- * @param dialogFont the dialog font to set
- * @param defaultFont the default font to compare against
- */
- private static void applyDialogFont(
- Control control,
- Font dialogFont,
- Font defaultFont) {
-
- if (control.getFont().equals(defaultFont))
- control.setFont(dialogFont);
-
- if (control instanceof Composite) {
- Control[] children = ((Composite) control).getChildren();
- for (int i = 0; i < children.length; i++)
- applyDialogFont(children[i], dialogFont, defaultFont);
- }
- }
-}
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 4a90c24..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogPage.java
+++ /dev/null
@@ -1,415 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-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
- * @deprecated 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 f160647..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-import java.io.*;
-import java.util.*;
-
-import javax.xml.parsers.*;
-
-import org.apache.xerces.dom.DocumentImpl;
-import org.apache.xml.serialize.*;
-import org.w3c.dom.*;
-import org.xml.sax.InputSource;
-import org.xml.sax.SAXException;
-
-
-/**
- * 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);
- BufferedReader reader = new BufferedReader(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/ErrorDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java
deleted file mode 100644
index 72c42db..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ErrorDialog.java
+++ /dev/null
@@ -1,497 +0,0 @@
-package org.eclipse.jface.dialogs;
-
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- * Sebastian Davids <sdavids@gmx.de> - Fix for bug 19346 - Dialog font should
- * be activated and used by other components.
-******************************************************************************/
-import java.util.Arrays;
-import java.util.Iterator;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-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.widgets.*;
-
-/**
- * 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 {
-
- /**
- * Static to prevent opening of error dialogs for
- * automated testing.
- */
- public static boolean AUTOMATED_MODE = false;
-
- /**
- * Reserve room for this many list items.
- */
- private static final int LIST_ITEM_COUNT = 7;
-
- /**
- * The nesting indent.
- */
- private static final String NESTING_INDENT = " "; //$NON-NLS-1$
-
- /**
- * 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;
-
- /**
- * The current clipboard. To be disposed when closing
- * the dialog.
- */
- private Clipboard clipboard;
-
- /**
- * 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(int)
- */
- 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#createDialogAndButtonArea(Composite)
- */
- protected void createDialogAndButtonArea(Composite parent) {
-
- super.createDialogAndButtonArea(parent);
- if (this.dialogArea instanceof Composite) {
- //Create a label if there are no children to force a smaller layout
- Composite dialogComposite = (Composite) dialogArea;
- if (dialogComposite.getChildren().length == 0)
- new Label(dialogComposite, SWT.NULL);
- }
- }
-
- /*
- * @see IconAndMessageDialog#getImage()
- */
- protected Image getImage() {
-
- if (status != null) {
- if (status.getSeverity() == IStatus.WARNING)
- return JFaceResources.getImageRegistry().get(DLG_IMG_WARNING);
- if (status.getSeverity() == IStatus.INFO)
- return JFaceResources.getImageRegistry().get(DLG_IMG_INFO);
- }
-
- //If it was not a warning or an error then return the error image
- 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);
- list.setFont(parent.getFont());
-
- Menu copyMenu = new Menu(list);
- MenuItem copyItem = new MenuItem(copyMenu, SWT.NONE);
- copyItem.addSelectionListener(new SelectionListener() {
- /*
- * @see SelectionListener.widgetSelected (SelectionEvent)
- */
- public void widgetSelected(SelectionEvent e) {
- copyToClipboard();
- }
-
- /*
- * @see SelectionListener.widgetDefaultSelected(SelectionEvent)
- */
- public void widgetDefaultSelected(SelectionEvent e) {
- copyToClipboard();
- }
-
- });
- copyItem.setText(JFaceResources.getString("copy")); //$NON-NLS-1$
- list.setMenu(copyMenu);
-
- 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(AUTOMATED_MODE)
- setBlockOnOpen(false);
-
- 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(int)
- */
- 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(NESTING_INDENT); //$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(int)
- */
- 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)));
-
- }
-
- /**
- * Put the details of the status of the error onto the
- * stream.
- * @param status
- * @param buffer
- * @param nesting
- */
- private void populateCopyBuffer(
- IStatus status,
- StringBuffer buffer,
- int nesting) {
- if (!status.matches(displayMask)) {
- return;
- }
- for (int i = 0; i < nesting; i++) {
- buffer.append(NESTING_INDENT); //$NON-NLS-1$
- }
- buffer.append(status.getMessage());
- buffer.append("\n"); //$NON-NLS-1$
-
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- populateCopyBuffer(children[i], buffer, nesting + 1);
- }
- }
-
- /**
- * Copy the contents of the statuses to the clipboard.
- */
- private void copyToClipboard(){
- if(clipboard != null)
- clipboard.dispose();
-
- StringBuffer statusBuffer = new StringBuffer();
- populateCopyBuffer(status,statusBuffer,0);
- clipboard = new Clipboard(list.getDisplay());
- clipboard.setContents(
- new Object[] {statusBuffer.toString()},
- new Transfer[] {TextTransfer.getInstance()}
- );
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.window.Window#close()
- */
- public boolean close() {
- if(clipboard != null)
- clipboard.dispose();
- return super.close();
- }
-
-}
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 0c40931..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogConstants.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-
-/**
- * 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 20).
- */
- public int SELECT_TYPES_ID = 20;
-
- /**
- * Button id for a "No to All" button (value 21).
- */
- public int NO_TO_ALL_ID = 21;
-
-
- /**
- * 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 2cf10c2..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogPage.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * 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 f1b067f..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IDialogSettings.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-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 299bc68..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IInputValidator.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-
-/*
- * 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 0e97ed4..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IMessageProvider.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-
-
-/**
- * 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 5d54c8d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/IconAndMessageDialog.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-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 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;
-
- /**
- * Message label is the label the message is shown on.
- */
- protected Label messageLabel;
-
- /**
- * Constructor for IconAndMessageDialog.
- *
- * @param parentShell the parent shell, or <code>null</code> to create a top-level shell
- */
- 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, SWT.NULL);
- image.setBackground(label.getBackground());
- label.setImage(image);
- label.setLayoutData(
- new GridData(
- GridData.HORIZONTAL_ALIGN_CENTER
- | GridData.VERTICAL_ALIGN_BEGINNING));
- }
-
- // create message
- if (message != null) {
- messageLabel = new Label(composite, SWT.WRAP);
- messageLabel.setText(message);
- GridData data =
- new GridData(
- GridData.GRAB_HORIZONTAL
- | GridData.HORIZONTAL_ALIGN_FILL
- | GridData.VERTICAL_ALIGN_BEGINNING);
- data.widthHint =
- convertHorizontalDLUsToPixels(
- IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
- messageLabel.setLayoutData(data);
- messageLabel.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) * 3/2;
- layout.marginWidth =
- convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.verticalSpacing =
- convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
- layout.horizontalSpacing =
- convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING)
- * 2;
- layout.makeColumnsEqualWidth = false;
- parent.setLayout(layout);
- parent.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- createDialogAndButtonArea(parent);
-
- return parent;
- }
-
- /**
- * Create the dialog area and the button bar for
- * the receiver.
- * @param parent
- */
- protected void createDialogAndButtonArea(Composite parent) {
- // create the dialog area and button bar
- dialogArea = createDialogArea(parent);
- buttonBar = createButtonBar(parent);
- }
-
-}
\ No newline at end of file
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 f9de32f..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/InputDialog.java
+++ /dev/null
@@ -1,230 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-
-/**
- * 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();
- }
- }
- );
- text.setFont(parent.getFont());
-
- 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); //$NON-NLS-1$
- 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 e5b4cd1..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/MessageDialog.java
+++ /dev/null
@@ -1,382 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-/**
- * A dialog for showing messages to the user.
- * <p>
- * This concrete dialog class can be instantiated as is,
- * or further subclassed as required.
- * </p>
- */
-public class MessageDialog extends IconAndMessageDialog {
-
-
- /**
- * Constant for a dialog with no image (value 0).
- */
- public final static int NONE = 0;
-
- /**
- * Constant for a dialog with an error image (value 1).
- */
- public final static int ERROR = 1;
-
- /**
- * Constant for a dialog with an info image (value 2).
- */
- public final static int INFORMATION = 2;
-
- /**
- * Constant for a dialog with a question image (value 3).
- */
- public final static int QUESTION = 3;
-
- /**
- * Constant for a dialog with a warning image (value 4).
- */
- public final static int WARNING = 4;
-
- /**
- * Labels for buttons in the button bar (localized strings).
- */
- private String[] buttonLabels;
-
- /**
- * The buttons. Parallels <code>buttonLabels</code>.
- */
- private Button[] buttons;
-
- /**
- * Index into <code>buttonLabels</code> of the default button.
- */
- private int defaultButtonIndex;
-
- /**
- * Dialog title (a localized string).
- */
- private String title;
-
- /**
- * Dialog title image.
- */
- private Image titleImage;
-
- /**
- * Image, or <code>null</code> if none.
- */
- private Image image = null;
-
- /**
- * The custom dialog area.
- */
- private Control customArea;
-/**
- * Create a message dialog.
- * Note that the dialog will have no visual representation (no widgets)
- * until it is told to open.
- * <p>
- * The labels of the buttons to appear in the button bar are supplied in this
- * constructor as an array. The <code>open</code> method will return the index
- * of the label in this array corresponding to the button that was pressed to
- * close the dialog. If the dialog was dismissed without pressing a button (ESC, etc.)
- * then -1 is returned. Note that the <code>open</code> method blocks.
- * </p>
- *
- * @param parentShell the parent shell
- * @param dialogTitle the dialog title, or <code>null</code> if none
- * @param dialogTitleImage the dialog title image, or <code>null</code> if none
- * @param dialogMessage the dialog message
- * @param dialogImageType one of the following values:
- * <ul>
- * <li> <code>MessageDialog.NONE</code> for a dialog with no image </li>
- * <li> <code>MessageDialog.ERROR</code> for a dialog with an error image </li>
- * <li> <code>MessageDialog.INFORMATION</code> for a dialog with an information image </li>
- * <li> <code>MessageDialog.QUESTION </code> for a dialog with a question image </li>
- * <li> <code>MessageDialog.WARNING</code> for a dialog with a warning image </li>
- * </ul>
- * @param dialogButtonLabels an array of labels for the buttons in the button bar
- * @param defaultIndex the index in the button label array of the default button
- */
-public MessageDialog(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage, int dialogImageType, String[] dialogButtonLabels, int defaultIndex) {
- super(parentShell);
- this.title = dialogTitle;
- this.titleImage = dialogTitleImage;
- this.message = dialogMessage;
- switch (dialogImageType) {
- case ERROR : {
- this.image = getImage(DLG_IMG_ERROR);
- break;
- }
- case INFORMATION : {
- this.image = getImage(DLG_IMG_INFO);
- break;
- }
- case QUESTION : {
- this.image = getImage(DLG_IMG_QUESTION);
- break;
- }
- case WARNING : {
- this.image = getImage(DLG_IMG_WARNING);
- break;
- }
- }
- this.buttonLabels = dialogButtonLabels;
- this.defaultButtonIndex = defaultIndex;
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void buttonPressed(int buttonId) {
- setReturnCode(buttonId);
- close();
-}
-/* (non-Javadoc)
- * Method declared in Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- if (title != null)
- shell.setText(title);
- if (titleImage != null)
- shell.setImage(titleImage);
-}
-
-/*
- * (non-Javadoc)
- * Method declared on Dialog.
- */
-protected void createButtonsForButtonBar(Composite parent) {
- buttons = new Button[buttonLabels.length];
- for (int i = 0; i < buttonLabels.length; i++) {
- String label = buttonLabels[i];
- Button button = createButton(parent, i, label, defaultButtonIndex == i);
- buttons[i] = button;
- }
-}
-/**
- * Creates and returns the contents of an area
- * of the dialog which appears below the message and
- * above the button bar.
- * <p>
- * The default implementation of this framework method
- * returns <code>null</code>. Subclasses may override.
- * </p>
- *
- * @param the parent composite to contain the custom area
- * @return the custom area control, or <code>null</code>
- */
-protected Control createCustomArea(Composite parent) {
- return null;
-}
-/**
- * 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) {
-
- // create message area
- createMessageArea(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;
- composite.setLayout(layout);
-
- GridData data = new GridData(GridData.FILL_BOTH);
- data.horizontalSpan = 2;
-
- composite.setLayoutData(data);
- composite.setFont(parent.getFont());
-
- // allow subclasses to add custom controls
- customArea = createCustomArea(composite);
-
- //If it is null create a dummy label for spacing purposes
- if(customArea == null)
- customArea = new Label(composite,SWT.NULL);
-
- return composite;
-}
-/**
- * Gets a button in this dialog's button bar.
- *
- * @param index the index of the button in the dialog's button bar
- * @return a button in the dialog's button bar
- */
-protected Button getButton(int index) {
- return buttons[index];
-}
-/**
- * Returns the minimum message area width in pixels
- * This determines the minimum width of the dialog.
- * <p>
- * Subclasses may override.
- * </p>
- *
- * @return the minimum message area width (in pixels)
- */
-protected int getMinimumMessageWidth() {
- return convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
-}
-/* (non-Javadoc)
- * Method declared on Dialog.
- * Sets a return code of -1 since none of the dialog buttons were pressed to close the dialog.
- */
-protected void handleShellCloseEvent() {
- super.handleShellCloseEvent();
- setReturnCode(-1);
-}
-/**
- * Convenience method to open a simple confirm (OK/Cancel) 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 openConfirm(Shell parent, String title, String message) {
- MessageDialog dialog = new MessageDialog(
- parent,
- title,
- null, // accept the default window icon
- message,
- QUESTION,
- new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
- 0); // OK is the default
- return dialog.open() == 0;
-}
-/**
- * Convenience method to open a standard error 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
- */
-public static void openError(Shell parent, String title, String message) {
- MessageDialog dialog = new MessageDialog(
- parent,
- title,
- null, // accept the default window icon
- message,
- ERROR,
- new String[] {IDialogConstants.OK_LABEL},
- 0); // ok is the default
- dialog.open();
- return;
-}
-/**
- * Convenience method to open a standard information 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
- */
-public static void openInformation(
- Shell parent,
- String title,
- String message) {
- MessageDialog dialog =
- new MessageDialog(parent, title, null, // accept the default window icon
- message, INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0);
- // ok is the default
- dialog.open();
- return;
-}
-/**
- * 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) {
- MessageDialog dialog = new MessageDialog(
- parent,
- title,
- null, // accept the default window icon
- message,
- QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
- 0); // yes is the default
- return dialog.open() == 0;
-}
-/**
- * Convenience method to open a standard warning 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
- */
-public static void openWarning(Shell parent, String title, String message) {
- MessageDialog dialog = new MessageDialog(
- parent,
- title,
- null, // accept the default window icon
- message,
- WARNING,
- new String[] {IDialogConstants.OK_LABEL},
- 0); // ok is the default
- dialog.open();
- return;
-}
-/*
- * @see org.eclipse.jface.dialogs.Dialog#createButton(org.eclipse.swt.widgets.Composite, int, java.lang.String, boolean)
- */
-protected Button createButton(Composite parent,int id,String label,boolean defaultButton) {
-
- Button button = super.createButton(parent, id, label, defaultButton);
- //Be sure to set the focus if the custom area cannot so as not
- //to lose the defaultButton.
- if(defaultButton && !customShouldTakeFocus())
- button.setFocus();
- return button;
-}
-/**
- * Return whether or not we should apply the workaround where
- * we take focus for the default button or if that should be
- * determined by the dialog.
- * By default only return true if the custom area is a label
- * or CLabel that cannot take focus.
- * @return boolean
- */
-protected boolean customShouldTakeFocus() {
- if(customArea instanceof Label)
- return false;
-
- if(customArea instanceof CLabel)
- return (customArea.getStyle() & SWT.NO_FOCUS) > 0;
-
- return true;
-}
-
- /*
- * @see IconAndMessageDialog#getImage()
- */
- public Image getImage() {
- return image;
- }
-}
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 9680825..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ProgressIndicator.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-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);
- }
- }
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ProgressMonitorDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ProgressMonitorDialog.java
deleted file mode 100644
index 65d140e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/ProgressMonitorDialog.java
+++ /dev/null
@@ -1,412 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-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.GridData;
-import org.eclipse.swt.widgets.*;
-
-/**
- * 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>
- * <p>
- * Note that not forking the process will result in it running
- * in the UI which may starve the UI. The most obvious symptom
- * of this problem is non responsiveness of the cancel button.
- * If you are running within the UI Thread you should do the bulk
- * of your work in another Thread to prevent starvation.
- * It is recommended that fork is set to true in most cases.
- * </p>
- */
-public class ProgressMonitorDialog extends IconAndMessageDialog 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. Kept for backwards
- * compatibility.
- */
- 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) {
- if (progressIndicator.isDisposed())
- return;
-
- if (name == null)
- task= "";//$NON-NLS-1$
- else
- task= name;
-
- String s= task;
- if (s.length() <= 0)
- s= DEFAULT_TASKNAME;
- setMessage(s);
- if(!forked)
- update();
-
- if (totalWork == UNKNOWN) {
- progressIndicator.beginAnimatedTask();
- } else {
- progressIndicator.beginTask(totalWork);
- }
- }
-
- public void done() {
- if (!progressIndicator.isDisposed()) {
- progressIndicator.sendRemainingWork();
- progressIndicator.done();
- }
- }
-
- public void setTaskName(String name) {
- if (name == null)
- task= "";//$NON-NLS-1$
- else
- task= name;
-
- String s= task;
- if (s.length() <= 0)
- s= DEFAULT_TASKNAME;
- setMessage(s);
- if(!forked)
- update();
- }
-
- public boolean isCanceled() {
- return fIsCanceled;
- }
-
- public void setCanceled(boolean b) {
- fIsCanceled= b;
- }
-
- public void subTask(String 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) {
- internalWorked(work);
- }
-
- public void internalWorked(double 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 parentShell the parent shell, or <code>null</code> to create a top-level 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);
-}
-
-
-/* (non-Javadoc)
- * Method declared on Dialog.
- */
-protected Control createDialogArea(Composite parent) {
-
- setMessage(DEFAULT_TASKNAME);
- createMessageArea(parent);
-
- //Only set for backwards compatibility
- taskLabel = messageLabel;
-
- // progress indicator
- progressIndicator= new ProgressIndicator(parent);
- GridData 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() {
-
- Point calculatedSize = super.getInitialSize();
- if(calculatedSize.x < 450)
- calculatedSize.x = 450;
- return calculatedSize;
-}
-/**
- * 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);
-}
-
-/*
- * @see org.eclipse.jface.dialogs.IconAndMessageDialog#getImage()
- */
-protected Image getImage() {
- return JFaceResources.getImageRegistry().get(Dialog.DLG_IMG_INFO);
-}
-
-/**
- * Set the message in the message label.
- */
-private void setMessage(String messageString) {
- message = messageString;
- if (messageLabel == null || messageLabel.isDisposed())
- return;
- messageLabel.setText(message);
-}
-
-/**
- * Update the message label. Required if the monitor is forked.
- */
-private void update() {
- if (messageLabel == null || messageLabel.isDisposed())
- return;
- messageLabel.update();
-}
-
-}
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 3ceeec3..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/TitleAreaDialog.java
+++ /dev/null
@@ -1,637 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.dialogs;
-
-import org.eclipse.jface.resource.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-/**
- * 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 Text messageLabel;
- private Composite workArea;
-
- 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);
-
- //Now create a work area for the rest of the dialog
- workArea = new Composite(parent, SWT.NULL);
- GridLayout childLayout = new GridLayout();
- childLayout.marginHeight = 0;
- childLayout.marginWidth = 0;
- childLayout.verticalSpacing = 0;
- workArea.setLayout(childLayout);
-
- Control top = createTitleArea(parent);
-
- resetWorkAreaAttachments(top);
-
- workArea.setFont(JFaceResources.getDialogFont());
-
- // initialize the dialog units
- initializeDialogUnits(workArea);
-
- // create the dialog area and button bar
- dialogArea = createDialogArea(workArea);
- buttonBar = createButtonBar(workArea);
-
- 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 Text(parent, SWT.WRAP | SWT.READ_ONLY);
- 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;
- FontData[] data = messageLabel.getFont().getFontData();
- labelY += data[0].getHeight();
-
- 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 but do not
- //change the instance variable
- String displayedErrorMessage = " " + errorMessage; //$NON-NLS-1$
- updateMessage(displayedErrorMessage);
- 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$
-
- // Message string to be shown - if there is an image then add in
- // a space to the message for layout purposes
- String shownMessage = (newImage == null) ?
- message : " " + message; //$NON-NLS-1$
-
- messageImage = newImage;
-
- if (!showingError) {
- // we are not showing an error
- updateMessage(shownMessage);
- 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 "; //$NON-NLS-1$
-
- 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);
- if(newTitleImage != null){
- determineTitleImageLargest();
- Control top;
- if(titleImageLargest)
- top = titleImage;
- else
- top = messageLabel;
- resetWorkAreaAttachments(top);
- }
-}
-
-/**
- * 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);
-}
-
-/**
- * Reset the attachment of the workArea to now attach
- * to top as the top control.
- * @param top
- */
-private void resetWorkAreaAttachments(Control top) {
- 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);
- workArea.setLayoutData(childData);
-}
-
-}
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 da5dab7..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/messages.properties
+++ /dev/null
@@ -1,163 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-# 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
-copy = &Copy
-
-##############################################################
-# 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
-Command = Command
-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.
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/AccumulatingProgressMonitor.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/AccumulatingProgressMonitor.java
deleted file mode 100644
index 86b7b77..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/AccumulatingProgressMonitor.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.operation;
-
-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.jface/src/org/eclipse/jface/operation/IRunnableContext.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/IRunnableContext.java
deleted file mode 100644
index 92df221..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/IRunnableContext.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.operation;
-
-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.jface/src/org/eclipse/jface/operation/IRunnableWithProgress.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/IRunnableWithProgress.java
deleted file mode 100644
index 5526086..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/IRunnableWithProgress.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.operation;
-
-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.jface/src/org/eclipse/jface/operation/ModalContext.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/ModalContext.java
deleted file mode 100644
index 3b214d0..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/ModalContext.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.operation;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * 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.jface/src/org/eclipse/jface/operation/package.html b/bundles/org.eclipse.jface/src/org/eclipse/jface/operation/package.html
deleted file mode 100644
index d5828a6..0000000
--- a/bundles/org.eclipse.jface/src/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.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 b8324f1..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/BooleanFieldEditor.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-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.setFont(parent.getFont());
- 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/BooleanPropertyAction.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/BooleanPropertyAction.java
deleted file mode 100644
index 96cf645..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/BooleanPropertyAction.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.preference;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-public class BooleanPropertyAction extends Action {
-
- private IPreferenceStore preferenceStore;
- private String property;
-
- public BooleanPropertyAction(String title, IPreferenceStore preferenceStore, String property)
- throws IllegalArgumentException {
- super(title, AS_CHECK_BOX);
-
- if (preferenceStore == null || property == null)
- throw new IllegalArgumentException();
-
- this.preferenceStore = preferenceStore;
- this.property = property;
- final String finalProprety = property;
-
- preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (finalProprety.equals(event.getProperty()))
- setChecked(Boolean.TRUE.equals(event.getNewValue()));
- }
- });
-
- setChecked(preferenceStore.getBoolean(property));
- }
-
- public void run() {
- preferenceStore.setValue(property, isChecked());
- }
-}
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 e5ee8fe..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ColorFieldEditor.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-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.*;
-
-/**
- * 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 dccb982..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ColorSelector.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-
-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);
- }
-}
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 60c2188..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/DirectoryFieldEditor.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import java.io.File;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-
-/**
- * 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 62ad34d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditor.java
+++ /dev/null
@@ -1,623 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-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.
- *
- * @return 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);
-}
-
-}
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 a9e812e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FieldEditorPreferencePage.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import java.util.*;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-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.Control;
-/**
- * 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>
- *
- * @return 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 5666e28..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FileFieldEditor.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import java.io.File;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FileDialog;
-
-/**
- * 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 405834e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/FontFieldEditor.java
+++ /dev/null
@@ -1,380 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.resource.StringConverter;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.layout.GridData;
-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;
-
- /**
- * The text for the preview, or <code>null</code> if no preview is desired
- */
- private String previewText;
-
- /**
- * 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 getPreferredExtent() {
- return 40;
- }
- }
- /**
- * Creates a new font field editor
- */
- protected FontFieldEditor() {
- }
- /**
- * Creates a font field editor with an optional preview area.
- *
- * @param name the name of the preference this field editor works on
- * @param labelText the label text of the field editor
- * @param previewAreaText the text used for the preview window. If it is
- * <code>null</code> there will be no preview area,
- * @param parent the parent of the field editor's control
- */
- public FontFieldEditor(
- String name,
- String labelText,
- String previewAreaText,
- Composite parent) {
- init(name, labelText);
- previewText = previewAreaText;
- changeButtonText = JFaceResources.getString("openChange"); //$NON-NLS-1$
- createControl(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) {
- this(name, labelText, null, parent);
-
- }
- /* (non-Javadoc)
- * Method declared on FieldEditor.
- */
- protected void adjustForNumColumns(int numColumns) {
-
- GridData data = new GridData();
- if (valueControl.getLayoutData() != null)
- data = (GridData) valueControl.getLayoutData();
-
- data.horizontalSpan = numColumns - getNumberOfControls() + 1;
- valueControl.setLayoutData(data);
- }
-
- /* (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) {
- getLabelControl(parent);
-
- valueControl = getValueControl(parent);
-
- GridData gd =
- new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.horizontalSpan = numColumns - getNumberOfControls() + 1;
- valueControl.setLayoutData(gd);
- if (previewText != null) {
- previewer = new DefaultPreviewer(previewText, parent);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.heightHint = previewer.getPreferredExtent();
- gd.widthHint = previewer.getPreferredExtent();
- previewer.getControl().setLayoutData(gd);
- }
-
- changeFontButton = getChangeControl(parent);
- gd = new GridData();
- 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);
-
- }
- /* (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() {
- if (chosenFont != null)
- 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());
- if (chosenFont != null)
- fontDialog.setFontData(chosenFont[0]);
- FontData font = fontDialog.open();
- if (font != null) {
- FontData[] oldFont = chosenFont;
- if(oldFont == null)
- oldFont = JFaceResources.getDefaultFont().getFontData();
- setPresentsDefaultValue(false);
- FontData[] newData = new FontData[1];
- newData[0] = font;
- updateFont(newData);
- fireValueChanged(VALUE, oldFont[0], 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() {
- if (previewer == null)
- return 3;
- else
- return 4;
- }
- /**
- * 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.getPreferredExtent();
- }
- /**
- * 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().bestDataArray(
- 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[0]));
- }
- if (previewer != null) {
- previewer.setFont(bestFont);
- }
- }
- /**
- * 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();
- }
-
- /*
- * @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/IPersistentPreferenceStore.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPersistentPreferenceStore.java
deleted file mode 100644
index 23ad890..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPersistentPreferenceStore.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import java.io.IOException;
-
-
-/**
- * IPersistentPreferenceStore is a preference store that can
- * be saved.
- */
-public interface IPersistentPreferenceStore extends IPreferenceStore {
-
- /**
- * 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;
-
-}
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 d509dfd..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferenceNode.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-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 there 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 there 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 f96fbad..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferencePage.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.swt.graphics.Point;
-
-/**
- * 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 ab63c62..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferencePageContainer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-/**
- * 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 861e588..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IPreferenceStore.java
+++ /dev/null
@@ -1,517 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-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 = ""; //$NON-NLS-1$
-
- /**
- * 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 7e9e70b..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/IntegerFieldEditor.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * 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 7b33912..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/JFacePreferences.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-/**
- *
- * JFacePreferences is a class used to administer the preferences
- * used by JFace objects.
- */
-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 be45705..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/ListEditor.java
+++ /dev/null
@@ -1,410 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.Assert;
-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.*;
-
-/**
- * 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>getNewInputObject</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));
- button.setFont(parent.getFont());
- 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.setFont(parent.getFont());
- 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 3fa3d15..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PathEditor.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.StringTokenizer;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.DirectoryDialog;
-/**
- * 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 87840b8..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceConverter.java
+++ /dev/null
@@ -1,541 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import java.util.Arrays;
-import java.util.StringTokenizer;
-
-import org.eclipse.jface.resource.*;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * 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);
- private static final String ENTRY_SEPARATOR = ";"; //$NON-NLS-1$
-
- /**
- * The default-default value for <code>FontData</code> preferences.
- */
- public static final FontData[] FONTDATA_ARRAY_DEFAULT_DEFAULT;
- public static final FontData FONTDATA_DEFAULT_DEFAULT;
- static {
- Shell shell = new Shell();
- FONTDATA_ARRAY_DEFAULT_DEFAULT = shell.getFont().getFontData();
- shell.dispose();
- /**
- * 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.
- */
-
- 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;
- }
-
- /**
- * Reads the supplied string and returns its corresponding
- * FontData. If it cannot be read then the default FontData
- * will be returned.
- *
- * @param fontDataValue the string value for the font data
- * @return the font data
- */
- public static FontData[] readFontData(String fontDataValue) {
- return basicGetFontData(fontDataValue);
- }
- /**
- * 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.
- * <p>
- * Included for backwards compatibility. This method is equivalent to
- * </code>setValue(store, name, new FontData[]{value})</code>.
- * </p>
- *
- * @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) {
- setValue(store, name, new FontData[]{value});
- }
-
- /**
- * Sets the current value of the preference with the given name
- * in the given preference store. This method also sets the corresponding
- * key in the JFace font registry to the value and fires a
- * property change event to listeners on the preference store.
- *
- * <p>
- * Note that this API does not update any other settings that may
- * be dependant upon it. Only the value in the preference store
- * and in the font registry is updated.
- * </p>
- * @param store the preference store
- * @param name the name of the preference
- * @param value the new current value of the preference
- *
- * @see #putValue(IPreferenceStore, String, FontData[])
- */
- 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);
- }
- }
-
- /**
- * Sets the current value of the preference with the given name
- * in the given preference store. This method does not update
- * the font registry or fire a property change event.
- *
- * @param store the preference store
- * @param name the name of the preference
- * @param value the new current value of the preference
- *
- * @see PreferenceConverter#setValue(IPreferenceStore, String, FontData[])
- */
- public static void putValue(
- 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));
- }
- }
-
- /**
- * Returns the stored representation of the given array of FontData objects.
- * The stored representation has the form FontData;FontData;
- * Only includes the non-null entries.
- *
- * @param fontData the array of FontData objects
- * @return the stored representation of the FontData objects
- */
- 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));
- //Clear the cache before updating
- JFaceColors.clearColor(name);
- store.firePropertyChangeEvent(name, oldValue, value);
- }
- }
-}
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 612fcb0..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceDialog.java
+++ /dev/null
@@ -1,1125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.preference;
-
-import java.io.IOException;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.ISafeRunnable;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.resource.*;
-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.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-/**
- * 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 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.
- *
- */
- 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 | SWT.MAX);
- 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()) {
- final IPreferenceNode node = (IPreferenceNode) nodes.next();
- if (node.getPage() != null) {
- Platform.run(new SafeRunnable() {
- public void run() {
- if (!node.getPage().performCancel())
- return;
- }
- });
-
- }
- }
- setReturnCode(CANCEL);
- close();
- }
- /* (non-Javadoc)
- * Method declared on Window.
- */
- public boolean close() {
-
- 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$
-
- 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(final Composite parent) {
- final Control[] control = new Control[1];
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- control[0] = PreferenceDialog.super.createContents(parent);
-
- // Add the first page
- selectSavedItem();
- }
- });
- return control[0];
- }
- /* (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);
-
- // 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 = 2;
- layout.marginWidth = 2;
- 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);
- final Color foreground = JFaceColors.getBannerForeground(display);
-
- GridData layoutData = new GridData(GridData.FILL_BOTH);
- titleArea.setLayout(layout);
- titleArea.setLayoutData(layoutData);
- titleArea.setBackground(background);
-
- final Color borderColor =
- new Color(titleArea.getDisplay(), ViewForm.borderOutsideRGB);
-
- titleArea.addPaintListener(new PaintListener() {
- public void paintControl(PaintEvent e) {
- e.gc.setForeground(borderColor);
- Rectangle bounds = titleArea.getClientArea();
- bounds.height = bounds.height - 2;
- bounds.width = bounds.width - 1;
- e.gc.drawRectangle(bounds);
- }
- });
-
- // Add a dispose listener
- titleArea.addDisposeListener(new DisposeListener() {
- public void widgetDisposed(DisposeEvent e) {
- if (titleAreaColor != null)
- titleAreaColor.dispose();
- if (errorMsgAreaBackground != null)
- errorMsgAreaBackground.dispose();
- borderColor.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()))
- updateMessage();
- if (JFaceResources.DIALOG_FONT.equals(event.getProperty())) {
- updateMessage();
- Font dialogFont = JFaceResources.getDialogFont();
- tree.setFont(dialogFont);
- Control[] children = ((Composite) buttonBar).getChildren();
- for (int i = 0; i < children.length; i++)
- children[i].setFont(dialogFont);
- }
- }
- };
-
- 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()) {
- handleError();
- } else if (!showPage((IPreferenceNode) data)) {
- // Page flipping wasn't successful
- handleError();
- } else {
- // Everything went well
- currentTreeItem = (TreeItem) event.item;
- }
-
- // Keep focus in tree. See bugs 2692, 2621, and 6775.
- tree.setFocus();
- }
- }
-
- private void handleError() {
- showPageFlippingAbortDialog();
- selectCurrentPageAgain();
- clearSelectedNode();
- }
- });
- }
- });
-
- eventAdapter.addSelectionListener(new SelectionAdapter() {
- public void widgetDefaultSelected(final SelectionEvent event) {
- TreeItem[] selection = tree.getSelection();
- if (selection.length > 0)
- selection[0].setExpanded(!selection[0].getExpanded());
- }
- });
-
- //Register help listener on the tree to use context sensitive help
- tree.addHelpListener(new HelpListener() {
- public void helpRequested(HelpEvent event) {
- // call perform help on the current page
- if (currentPage != null) {
- currentPage.performHelp();
- }
- }
- });
-
- 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 IPersistentPreferenceStore) {
- try {
- ((IPersistentPreferenceStore) 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();
- }
- }
- }
- }
-
- /**
- * 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(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) {
- final boolean[] failed = { false };
- Platform.run(new ISafeRunnable() {
- public void run() {
- currentPage.createControl(pageContainer);
- }
- public void handleException(Throwable e) {
- failed[0] = true;
- }
- });
- if (failed[0])
- return false;
-
- // 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.
- final Point[] size = new Point[1];
- final Point failed = new Point(-1, -1);
-
- Platform.run(new ISafeRunnable() {
- public void run() {
- size[0] = currentPage.computeSize();
- }
- public void handleException(Throwable e) {
- size[0] = failed;
- }
- });
- if (size[0].equals(failed))
- return false;
-
- Point contentSize = size[0];
- // 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"), //$NON-NLS-1$
- JFaceResources.getString("AbortPageFlippingDialog.message")); //$NON-NLS-1$
- }
- /**
- * 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 f152254..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceManager.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import java.util.*;
-
-import org.eclipse.jface.util.Assert;
-/**
- * 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 e02650c..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceNode.java
+++ /dev/null
@@ -1,258 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * 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 f19c9fc..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferencePage.java
+++ /dev/null
@@ -1,601 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- * Sebastian Davids <sdavids@gmx.de> - Fix for bug 38729 - [Preferences]
- * NPE PreferencePage isValid.
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-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.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-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
- if (getContainer() != null)
- 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());
- }
-
- /**
- * Creates a composite with a highlighted Note entry and a message text.
- * This is designed to take up the full width of the page.
- *
- * @param font the font to use
- * @param composite the parent composite
- * @param title the title of the note
- * @param message the message for the note
- * @return the composite for the note
- */
- protected Composite createNoteComposite(
- Font font,
- Composite composite,
- String title,
- String message) {
- 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(title);
- 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(message);
- messageLabel.setFont(font);
- return messageComposite;
- }
-
- /**
- * Returns the Apply button.
- *
- * @return the Apply button
- */
- protected Button getApplyButton() {
- return applyButton;
- }
-
- /**
- * Returns the Restore Defaults button.
- *
- * @return the Restore Defaults button
- */
- protected Button getDefaultsButton() {
- return defaultsButton;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.dialogs.IDialogPage#performHelp()
- */
- public void performHelp() {
- getControl().notifyListeners(SWT.Help,new Event());
- }
-
-}
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 2da8947..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/PreferenceStore.java
+++ /dev/null
@@ -1,555 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import java.io.*;
-import java.util.*;
-
-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 IPersistentPreferenceStore {
-
- /**
- * 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(InputStream)
- * @see #save(OutputStream, String)
- */
-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 #save()
- */
-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 c032a67..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/RadioGroupFieldEditor.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import org.eclipse.jface.util.Assert;
-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.*;
-
-/**
- * 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) {
-
- Font font = parent.getFont();
-
- if (useGroup) {
- Group group = new Group(parent, SWT.NONE);
- group.setFont(font);
- 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);
- radioBox.setFont(font);
- }
-
- 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.setFont(font);
- 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 43d4777..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/StringButtonFieldEditor.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- * Thierry Lach - thierry.lach@bbdodetroit.com - Fix for Bug 37155
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.*;
-
-/**
- * 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.setFont(parent.getFont());
- 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);
- }
- /* (non-Javadoc)
- * @see org.eclipse.jface.preference.FieldEditor#setEnabled(boolean, org.eclipse.swt.widgets.Composite)
- */
- public void setEnabled(boolean enabled, Composite parent) {
- super.setEnabled(enabled, parent);
- if (changeButton != null) {
- changeButton.setEnabled(enabled);
- }
- }
-
-}
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 153f28b..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/preference/StringFieldEditor.java
+++ /dev/null
@@ -1,484 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.preference;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * 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/progress/IElementCollector.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/progress/IElementCollector.java
deleted file mode 100644
index bdcc187..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/progress/IElementCollector.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.progress;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-
-/**
- * IElementCollector is a type that allows for the incremental
- * update of a collection of objects.
- */
-public interface IElementCollector {
-
- /**
- * Add element to the IElementCollector.
- * @param element
- * @param monitor
- */
- public void add(Object element,IProgressMonitor monitor);
-
- /**
- * Add elements to the IElementCollector.
- * @param element
- * @param monitor
- */
- public void add(Object[] elements, IProgressMonitor monitor);
-
-}
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 36b049f..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/CompositeImageDescriptor.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.resource;
-
-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 ed7b923..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/DataFormatException.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.resource;
-
-
-/**
- * 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 059d5b0..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FileImageDescriptor.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.resource;
-
-import java.io.*;
-
-import org.eclipse.swt.graphics.ImageData;
-
-/**
- * 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 e93ed35..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/FontRegistry.java
+++ /dev/null
@@ -1,553 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.resource;
-
-import java.util.*;
-
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * 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);
-
- /**
- * Collection of Fonts that are now stale to be disposed
- * when it is safe to do so (i.e. on shutdown).
- * @see List
- */
- private List staleFonts = new ArrayList();
-
- /**
- * 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
- */
- 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;
- }
- }
- }
-
- /**
- * 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.
- * @deprecated use bestDataArray in order to support
- * Motif multiple entry fonts.
- */
- 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;
- }
-
- /**
- * 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.
- */
- public FontData[] bestDataArray(FontData[] fonts, Display display) {
-
- FontData bestData = bestData(fonts, display);
- if (bestData == null)
- return null;
- else {
- FontData[] datas = new FontData[1];
- datas[0] = bestData;
- return datas;
- }
- }
-
- /**
- * 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();
- if(display == null)
- return null;
-
- FontData[] validData = bestDataArray(fonts, display);
- if (validData == null) {
- //Nothing specified
- return null;
- } else {
- //Do not fire the update from creation as it is not a property change
- put(symbolicName, validData, 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, FontData[] oldValue, FontData[] newValue) {
- 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, oldValue, newValue);
- 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);
-
- // 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();
-
- stringToFont.put(symbolicName, font);
-
- return font;
- }
-
- /**
- * Return whether or not the receiver has a value
- * for the supplied fontKey.
- *
- * @param String. The key for the font.
- * @return boolean. true if there is a key for the font.
- */
- public boolean hasValueFor(String fontKey){
- return stringToFontData.containsKey(fontKey);
- }
-
- /**
- * Shut downs this resource registry and disposes of all registered fonts.
- */
- private void handleDisplayDispose() {
-
- disposeFonts(stringToFont.values().iterator());
- disposeFonts(staleFonts.iterator());
- stringToFont.clear();
- staleFonts.clear();
- listeners.clear();
- }
-
- /**
- * Dispose of all of the fonts in this iterator.
- * @param Iterator over Collection of Font
- */
- private void disposeFonts(Iterator iterator) {
- while (iterator.hasNext()) {
- Object next = iterator.next();
- ((Font) next).dispose();
- }
- }
-
- /**
- * 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,existing,fontData);
-
- if (oldFont == defaultFont())
- return;
-
- if (oldFont != null)
- staleFonts.add(oldFont);
- }
- /**
- * 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 d34df49..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.resource;
-
-import java.net.URL;
-
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * 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 f4516b5..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageRegistry.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.resource;
-
-
-import java.util.*;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * 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>
- * 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() {
- this(Display.getCurrent());
- }
-
- /**
- * Creates an empty image registry.
- */
- public ImageRegistry(Display display) {
- super();
- 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) {
- Entry entry = (Entry)table.get(key);
- if (entry == null) {
- return null;
- }
- if (entry.image == null && entry.descriptor != null) {
- entry.image = entry.descriptor.createImage();
- }
- return entry.image;
- }
-
- /**
- * Returns the descriptor associated with the given key in this registry,
- * or <code>null</code> if none.
- *
- * @param key the key
- * @return the descriptor, or <code>null</code> if none
- * @since 2.1
- */
- public ImageDescriptor getDescriptor(String key) {
- Entry entry = (Entry)table.get(key);
- if (entry == null) {
- return null;
- }
- return entry.descriptor;
- }
-
- /**
- * Shut downs this resource registry and disposes of all registered images.
- */
- private void handleDisplayDispose() {
- for (Iterator e = table.values().iterator(); e.hasNext();) {
- Entry entry = (Entry)e.next();
- if (entry.image != null) {
- entry.image.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) {
- Entry entry = (Entry)table.get(key);
- if (entry == null) {
- entry = new Entry();
- table.put(key, entry);
- }
- if (entry.image == null) {
- entry.descriptor = 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 or descriptor for 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) {
- Entry entry = (Entry)table.get(key);
- if (entry == null) {
- entry = new Entry();
- table.put(key, entry);
- }
- if (entry.image == null && entry.descriptor == null) {
- entry.image = image;
- return;
- }
- throw new IllegalArgumentException("ImageRegistry key already in use: " + key); //$NON-NLS-1$
- }
-
-
- /**
- * Contains the data for an entry in the registry.
- */
- private static class Entry {
- protected Image image;
- protected ImageDescriptor descriptor;
- }
-}
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 34e059d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceColors.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.resource;
-
-
-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.containsKey(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);
- }
-
-}
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 8b5bc39..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/JFaceResources.java
+++ /dev/null
@@ -1,311 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.resource;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * 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 2cf3c5f..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/MissingImageDescriptor.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.resource;
-
-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 2099936..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/StringConverter.java
+++ /dev/null
@@ -1,757 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.resource;
-
-import java.util.*;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.*;
-
-/**
- * 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.
- * @deprecated use asString(FontData)
- */
- 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 87184d9..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/URLImageDescriptor.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.resource;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTException;
-import org.eclipse.swt.graphics.ImageData;
-/**
- * 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);
- }
- catch (SWTException e) {
- if (e.code == SWT.ERROR_INVALID_IMAGE)
- return null;
- else
- throw e;
- }
- 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 1b4ed09..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-# Generic NLS font file for JFace
-# *.0 is Windows font
-# *.1 is Unix font
-#############################################################
-org.eclipse.jface.bannerfont.0=MS Sans Serif-bold-8
-org.eclipse.jface.bannerfont.1=b&h-lucidabright-regular-8
-
-org.eclipse.jface.headerfont.0=MS Sans Serif-bold-12
-org.eclipse.jface.headerfont.1=b&h-lucidabright-regular-12
-
-org.eclipse.jface.textfont.0=Courier New-regular-10
-org.eclipse.jface.textfont.1=Courier-regular-10
-org.eclipse.jface.textfont.2=b&h-lucidabright-regular-9
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 462d316..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_aix.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-# Aix font file for JFace
-#############################################################
-org.eclipse.jface.bannerfont.0=adobe-courier-bold-14
-org.eclipse.jface.headerfont.0=misc-fixed-bold-14
-org.eclipse.jface.textfont.0=adobe-courier-regular-12
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 b5be5e7..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_hp-ux.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-# HP UX font file for JFace
-#############################################################
-
-org.eclipse.jface.bannerfont.0=adobe-courier-bold-14
-org.eclipse.jface.headerfont.0=adobe-courier-regular-14
-org.eclipse.jface.textfont.0=adobe-courier-regular-14
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 87ee879..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_linux.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-# Linux font file for JFace
-#############################################################
-org.eclipse.jface.bannerfont.0=adobe-courier-bold-14
-org.eclipse.jface.headerfont.0=misc-fixed-bold-14
-org.eclipse.jface.textfont.0=adobe-courier-regular-12
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 a09fdab..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_linux_gtk.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-# Linux GTK font file for JFace
-#############################################################
-org.eclipse.jface.bannerfont.0=Sans-bold-12
-org.eclipse.jface.headerfont.0=Sans-bold-12
-org.eclipse.jface.textfont.0=Sans-regular-11
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_macosx.properties b/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_macosx.properties
deleted file mode 100644
index 8fe1a54..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_macosx.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-# Carbon font file for JFace
-#############################################################
-org.eclipse.jface.bannerfont.0=Lucida Grande-bold-12
-org.eclipse.jface.headerfont.0=Lucida Grande-bold-14
-
-org.eclipse.jface.textfont.0=Monaco-regular-11
-org.eclipse.jface.textfont.1=Courier-regular-12
-org.eclipse.jface.textfont.2=Courier New-regular-12
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 09fae97..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_qnx.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-# QNX font file for JFace
-#############################################################
-org.eclipse.jface.bannerfont.0=TextFont-bold-14
-org.eclipse.jface.headerfont.0=TextFont-bold-18
-org.eclipse.jface.textfont.0=FixedFont-regular-8
-
-
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 b8477e8..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_sunos.properties
+++ /dev/null
@@ -1,15 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-# Solaris font file for JFace
-#############################################################
-org.eclipse.jface.bannerfont.0=adobe-courier-bold-14
-org.eclipse.jface.headerfont.0=misc-fixed-bold-14
-org.eclipse.jface.textfont.0=adobe-courier-regular-12
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 7278916..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windows2000.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-# NLS font file for JFace when running under Windows NT
-#############################################################
-
-org.eclipse.jface.bannerfont.0=Tahoma-bold-8
-
-org.eclipse.jface.headerfont.0=Tahoma-bold-12
-
-org.eclipse.jface.textfont.0=Courier New-regular-10
-org.eclipse.jface.textfont.1=Courier-regular-10
-org.eclipse.jface.textfont.2=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 01783cc..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windows98.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-# NLS font file for JFace when running under Windows 98
-#############################################################
-
-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 New-regular-10
-org.eclipse.jface.textfont.1=Courier-regular-10
-org.eclipse.jface.textfont.2=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 5994032..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windowsnt.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-# NLS font file for JFace when running under Windows NT
-#############################################################
-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 New-regular-10
-org.eclipse.jface.textfont.1=Courier-regular-10
-org.eclipse.jface.textfont.2=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 2d4e257..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/resource/jfacefonts_windowsxp.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-# NLS font file for JFace when running under Windows NT
-#############################################################
-org.eclipse.jface.bannerfont.0=Tahoma-bold-8
-
-org.eclipse.jface.headerfont.0=Tahoma-bold-12
-
-org.eclipse.jface.textfont.0=Courier New-regular-10
-org.eclipse.jface.textfont.1=Courier-regular-10
-org.eclipse.jface.textfont.2=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 926681c..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/Assert.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.util;
-
-
-/**
- * <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/DelegatingDragAdapter.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDragAdapter.java
deleted file mode 100644
index 64ec0a8..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDragAdapter.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.util;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.swt.dnd.DragSource;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.Transfer;
-
-/**
- * A <code>DelegatingDragAdapter</code> is a <code>DragSourceListener</code> that
- * maintains and delegates to a set of {@link TransferDragSourceListener}s. Each
- * TransferDragSourceListener can then be implemented as if it were the
- * <code>DragSource's</code> only DragSourceListener.
- * <p>
- * When a drag is started, a subset of all <code>TransferDragSourceListeners</code>
- * is generated and stored in a list of <i>active</i> listeners. This subset is
- * calculated by forwarding {@link DragSourceListener#dragStart(DragSourceEvent) to
- * every listener, and checking if the {@link DragSourceEvent#doit doit} field is left
- * set to <code>true</code>.
- * </p>
- * The <code>DragSource</code>'s set of supported Transfer types ({@link
- * DragSource#setTransfer(Transfer[])}) is updated to reflect the Transfer types
- * corresponding to the active listener subset.
- * <p>
- * If and when {@link #dragSetData(DragSourceEvent)} is called, a single
- * <code>TransferDragSourceListener</code> is chosen, and only it is allowed to set the
- * drag data. The chosen listener is the first listener in the subset of active listeners
- * whose Transfer supports ({@link Transfer#isSupportedType(TransferData)}) the
- * <code>dataType</code> in the <code>DragSourceEvent</code>.
- * </p>
- * <p>
- * The following example snippet shows a <code>DelegatingDragAdapter</code> with two
- * <code>TransferDragSourceListeners</code>. One implements drag of text strings,
- * the other supports file transfer and demonstrates how a listener can be disabled using
- * the dragStart method.
- * </p>
- * <code><pre>
- * final TreeViewer viewer = new TreeViewer(shell, SWT.NONE);
- *
- * DelegatingDragAdapter dragAdapter = new DelegatingDragAdapter();
- * dragAdapter.addDragSourceListener(new TransferDragSourceListener() {
- * public Transfer getTransfer() {
- * return TextTransfer.getInstance();
- * }
- * public void dragStart(DragSourceEvent event) {
- * // always enabled, can control enablement based on selection etc.
- * }
- * public void dragSetData(DragSourceEvent event) {
- * event.data = "Transfer data";
- * }
- * public void dragFinished(DragSourceEvent event) {
- * // no clean-up required
- * }
- * });
- * dragAdapter.addDragSourceListener(new TransferDragSourceListener() {
- * public Transfer getTransfer() {
- * return FileTransfer.getInstance();
- * }
- * public void dragStart(DragSourceEvent event) {
- * // enable drag listener if there is a viewer selection
- * event.doit = !viewer.getSelection().isEmpty();
- * }
- * public void dragSetData(DragSourceEvent event) {
- * File file1 = new File("C:/temp/file1");
- * File file2 = new File("C:/temp/file2");
- * event.data = new String[] {file1.getAbsolutePath(), file2.getAbsolutePath()};
- * }
- * public void dragFinished(DragSourceEvent event) {
- * // no clean-up required
- * }
- * });
- * viewer.addDragSupport(DND.DROP_COPY | DND.DROP_MOVE, dragAdapter.getTransfers(), dragAdapter);
- * </pre></code>
- * <p>
- * NOTE: This API is experimental and subject to change including removal.
- * </p>
- * @since 2.2
- */
-public class DelegatingDragAdapter implements DragSourceListener {
- private List listeners = new ArrayList();
- private List activeListeners;
- private TransferDragSourceListener currentListener;
-
- /**
- * Adds the given <code>TransferDragSourceListener</code>.
- *
- * @param listener the new listener
- */
- public void addDragSourceListener(TransferDragSourceListener listener) {
- listeners.add(listener);
- }
- /**
- * The drop has successfully completed. This event is forwarded to the current
- * drag listener.
- * Doesn't update the current listener, since the current listener is already the one
- * that completed the drag operation.
- *
- * @param event the drag source event
- * @see DragSourceListener#dragFinished(DragSourceEvent)
- */
- public void dragFinished(final DragSourceEvent event) {
-// if (Policy.DEBUG_DRAG_DROP)
-// System.out.println("Drag Finished: " + toString()); //$NON-NLS-1$
- Platform.run(new SafeRunnable() {
- public void run() throws Exception {
- if (currentListener != null) {
- // there is a listener that can handle the drop, delegate the event
- currentListener.dragFinished(event);
- }
- else {
- // The drag was canceled and currentListener was never set, so send the
- // dragFinished event to all the active listeners.
- Iterator iterator = activeListeners.iterator();
- while (iterator.hasNext())
- ((TransferDragSourceListener)iterator.next()).dragFinished(event);
- }
- }
- });
- currentListener = null;
- activeListeners = null;
- }
- /**
- * The drop data is requested.
- * Updates the current listener and then forwards the event to it.
- *
- * @param event the drag source event
- * @see DragSourceListener#dragSetData(DragSourceEvent)
- */
- public void dragSetData(final DragSourceEvent event) {
-// if (Policy.DEBUG_DRAG_DROP)
-// System.out.println("Drag Set Data: " + toString()); //$NON-NLS-1$
-
- updateCurrentListener(event); // find a listener that can provide the given data type
- if (currentListener != null) {
- Platform.run(new SafeRunnable() {
- public void run() throws Exception {
- currentListener.dragSetData(event);
- }
- });
- }
- }
- /**
- * A drag operation has started.
- * Forwards this event to each listener. A listener must set <code>event.doit</code>
- * to <code>false</code> if it cannot handle the drag operation. If a listener can
- * handle the drag, it is added to the list of active listeners.
- * The drag is aborted if there are no listeners that can handle it.
- *
- * @param event the drag source event
- * @see DragSourceListener#dragStart(DragSourceEvent)
- */
- public void dragStart(final DragSourceEvent event) {
-// if (Policy.DEBUG_DRAG_DROP)
-// System.out.println("Drag Start: " + toString()); //$NON-NLS-1$
- boolean doit = false; // true if any one of the listeners can handle the drag
- List transfers = new ArrayList(listeners.size());
-
- activeListeners = new ArrayList();
- for (int i = 0; i < listeners.size(); i++) {
- final TransferDragSourceListener listener = (TransferDragSourceListener)listeners.get(i);
- event.doit = true; // restore event.doit
- Platform.run(new SafeRunnable() {
- public void run() throws Exception {
- listener.dragStart(event);
- }
- });
- if (event.doit) { // the listener can handle this drag
- transfers.add(listener.getTransfer());
- activeListeners.add(listener);
- }
- doit |= event.doit;
- }
-
- if (doit)
- ((DragSource)event.widget).setTransfer(
- (Transfer[])transfers.toArray(new Transfer[transfers.size()]));
-
- event.doit = doit;
- }
- /**
- * Returns the <code>Transfer<code>s from every <code>TransferDragSourceListener</code>.
- *
- * @return the combined <code>Transfer</code>s
- */
- public Transfer[] getTransfers() {
- Transfer[] types = new Transfer[listeners.size()];
- for (int i = 0; i < listeners.size(); i++) {
- TransferDragSourceListener listener = (TransferDragSourceListener)listeners.get(i);
- types[i] = listener.getTransfer();
- }
- return types;
- }
- /**
- * Returns <code>true</code> if there are no listeners to delegate drag events to.
- *
- * @return <code>true</code> if there are no <code>TransferDragSourceListeners</code>
- * <code>false</code> otherwise.
- */
- public boolean isEmpty() {
- return listeners.isEmpty();
- }
- /**
- * Removes the given <code>TransferDragSourceListener</code>.
- * Listeners should not be removed while a drag and drop operation is in progress.
- *
- * @param listener the <code>TransferDragSourceListener</code> to remove
- */
- public void removeDragSourceListener(TransferDragSourceListener listener) {
- listeners.remove(listener);
- if (currentListener == listener)
- currentListener = null;
- if (activeListeners.contains(listener))
- activeListeners.remove(listener);
- }
- /**
- * Updates the current listener to one that can handle the drag. There can
- * be many listeners and each listener may be able to handle many <code>TransferData</code>
- * types. The first listener found that supports one of the <code>TransferData</ode>
- * types specified in the <code>DragSourceEvent</code> will be selected.
- *
- * @param event the drag source event
- */
- private void updateCurrentListener(DragSourceEvent event) {
- currentListener = null;
- if (event.dataType == null)
- return;
- Iterator iterator = activeListeners.iterator();
- while (iterator.hasNext()) {
- TransferDragSourceListener listener = (TransferDragSourceListener)iterator.next();
-
- if (listener.getTransfer().isSupportedType(event.dataType)) {
-// if (Policy.DEBUG_DRAG_DROP)
-// System.out.println("Current drag listener: " + listener); //$NON-NLS-1$
- currentListener = listener;
- return;
- }
- }
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDropAdapter.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDropAdapter.java
deleted file mode 100644
index a26c25d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/DelegatingDropAdapter.java
+++ /dev/null
@@ -1,361 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.util;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DropTargetEvent;
-import org.eclipse.swt.dnd.DropTargetListener;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.dnd.TransferData;
-
-/**
- * A <code>DelegatingDropAdapter</code> is a <code>DropTargetListener</code> that
- * maintains and delegates to a set of {@link TransferDropTargetListener}s. Each
- * <code>TransferDropTargetListener</code> can then be implemented as if it were
- * the DropTarget's only <code>DropTargetListener</code>.
- * <p>
- * On <code>dragEnter</code>, <code>dragOperationChanged</code>, <code>dragOver</code>
- * and <code>drop</code>, a <i>current</i> listener is obtained from the set of all
- * <code>TransferDropTargetListeners</code>. The current listener is the first listener
- * to return <code>true</code> for
- * {@link TransferDropTargetListener#isEnabled(DropTargetEvent)}.
- * The current listener is forwarded all <code>DropTargetEvents</code> until some other
- * listener becomes the current listener, or the drop terminates.
- * </p>
- * <p>
- * After adding all <code>TransferDropTargetListeners</code> to the
- * <code>DelegatingDropAdapter</code> the combined set of <code>Transfers</code> should
- * be set in the SWT <code>DropTarget</code>. <code>#getTransfers()</code> provides the
- * set of <code>Transfer</code> types of all <code>TransferDropTargetListeners</code>.
- * </p>
- * <p>
- * The following example snippet shows a <code>DelegatingDropAdapter</code> with two
- * <code>TransferDropTargetListeners</code>. One supports dropping resources and
- * demonstrates how a listener can be disabled in the isEnabled method.
- * The other listener supports text transfer.
- * </p>
- * <code><pre>
- * final TreeViewer viewer = new TreeViewer(shell, SWT.NONE);
- * DelegatingDropAdapter dropAdapter = new DelegatingDropAdapter();
- * dropAdapter.addDropTargetListener(new TransferDropTargetListener() {
- * public Transfer getTransfer() {
- * return ResourceTransfer.getInstance();
- * }
- * public boolean isEnabled(DropTargetEvent event) {
- * // disable drop listener if there is no viewer selection
- * if (viewer.getSelection().isEmpty())
- * return false;
- * return true;
- * }
- * public void dragEnter(DropTargetEvent event) {}
- * public void dragLeave(DropTargetEvent event) {}
- * public void dragOperationChanged(DropTargetEvent event) {}
- * public void dragOver(DropTargetEvent event) {}
- * public void drop(DropTargetEvent event) {
- * if (event.data == null)
- * return;
- * IResource[] resources = (IResource[]) event.data;
- * if (event.detail == DND.DROP_COPY) {
- * // copy resources
- * } else {
- * // move resources
- * }
- *
- * }
- * public void dropAccept(DropTargetEvent event) {}
- * });
- * dropAdapter.addDropTargetListener(new TransferDropTargetListener() {
- * public Transfer getTransfer() {
- * return TextTransfer.getInstance();
- * }
- * public boolean isEnabled(DropTargetEvent event) {
- * return true;
- * }
- * public void dragEnter(DropTargetEvent event) {}
- * public void dragLeave(DropTargetEvent event) {}
- * public void dragOperationChanged(DropTargetEvent event) {}
- * public void dragOver(DropTargetEvent event) {}
- * public void drop(DropTargetEvent event) {
- * if (event.data == null)
- * return;
- * System.out.println(event.data);
- * }
- * public void dropAccept(DropTargetEvent event) {}
- * });
- * viewer.addDropSupport(DND.DROP_COPY | DND.DROP_MOVE, dropAdapter.getTransfers(), dropAdapter);
- * </pre></code>
- * <p>
- * NOTE: This API is experimental and subject to change including removal.
- * </p>
- * @since 2.2
- */
-public class DelegatingDropAdapter implements DropTargetListener {
- private List listeners = new ArrayList();
- private TransferDropTargetListener currentListener;
- private int originalDropType;
-
- /**
- * Adds the given <code>TransferDropTargetListener</code>.
- *
- * @param listener the new listener
- */
- public void addDropTargetListener(TransferDropTargetListener listener) {
- listeners.add(listener);
- }
- /**
- * The cursor has entered the drop target boundaries. The current listener is
- * updated, and <code>#dragEnter()</code> is forwarded to the current listener.
- *
- * @param event the drop target event
- * @see DropTargetListener#dragEnter(DropTargetEvent)
- */
- public void dragEnter(DropTargetEvent event) {
-// if (Policy.DEBUG_DRAG_DROP)
-// System.out.println("Drag Enter: " + toString()); //$NON-NLS-1$
- originalDropType = event.detail;
- updateCurrentListener(event);
- }
- /**
- * The cursor has left the drop target boundaries. The event is forwarded to the
- * current listener.
- *
- * @param event the drop target event
- * @see DropTargetListener#dragLeave(DropTargetEvent)
- */
- public void dragLeave(final DropTargetEvent event) {
-// if (Policy.DEBUG_DRAG_DROP)
-// System.out.println("Drag Leave: " + toString()); //$NON-NLS-1$
- setCurrentListener(null, event);
- }
- /**
- * The operation being performed has changed (usually due to the user changing
- * a drag modifier key while dragging). Updates the current listener and forwards
- * this event to that listener.
- *
- * @param event the drop target event
- * @see DropTargetListener#dragOperationChanged(DropTargetEvent)
- */
- public void dragOperationChanged(final DropTargetEvent event) {
-// if (Policy.DEBUG_DRAG_DROP)
-// System.out.println("Drag Operation Changed to: " + event.detail); //$NON-NLS-1$
- originalDropType = event.detail;
- TransferDropTargetListener oldListener = getCurrentListener();
- updateCurrentListener(event);
- final TransferDropTargetListener newListener = getCurrentListener();
- // only notify the current listener if it hasn't changed based on the
- // operation change. otherwise the new listener would get a dragEnter
- // followed by a dragOperationChanged with the exact same event.
- if (newListener != null && newListener == oldListener) {
- Platform.run(new SafeRunnable() {
- public void run() throws Exception {
- newListener.dragOperationChanged(event);
- }
- });
- }
- }
- /**
- * The cursor is moving over the drop target. Updates the current listener and
- * forwards this event to that listener. If no listener can handle the drag
- * operation the <code>event.detail</code> field is set to <code>DND.DROP_NONE</code>
- * to indicate an invalid drop.
- *
- * @param event the drop target event
- * @see DropTargetListener#dragOver(DropTargetEvent)
- */
- public void dragOver(final DropTargetEvent event) {
- TransferDropTargetListener oldListener = getCurrentListener();
- updateCurrentListener(event);
- final TransferDropTargetListener newListener = getCurrentListener();
-
- // only notify the current listener if it hasn't changed based on the
- // drag over. otherwise the new listener would get a dragEnter
- // followed by a dragOver with the exact same event.
- if (newListener != null && newListener == oldListener) {
- Platform.run(new SafeRunnable() {
- public void run() throws Exception {
- newListener.dragOver(event);
- }
- });
- }
- }
- /**
- * Forwards this event to the current listener, if there is one. Sets the
- * current listener to <code>null</code> afterwards.
- *
- * @param event the drop target event
- * @see DropTargetListener#drop(DropTargetEvent)
- */
- public void drop(final DropTargetEvent event) {
-// if (Policy.DEBUG_DRAG_DROP)
-// System.out.println("Drop: " + toString()); //$NON-NLS-1$
- updateCurrentListener(event);
- if (getCurrentListener() != null) {
- Platform.run(new SafeRunnable() {
- public void run() throws Exception {
- getCurrentListener().drop(event);
- }
- });
- }
- setCurrentListener(null, event);
- }
- /**
- * Forwards this event to the current listener if there is one.
- *
- * @param event the drop target event
- * @see DropTargetListener#dropAccept(DropTargetEvent)
- */
- public void dropAccept(final DropTargetEvent event) {
-// if (Policy.DEBUG_DRAG_DROP)
-// System.out.println("Drop Accept: " + toString()); //$NON-NLS-1$
- if (getCurrentListener() != null) {
- Platform.run(new SafeRunnable() {
- public void run() throws Exception {
- getCurrentListener().dropAccept(event);
- }
- });
- }
- }
- /**
- * Returns the listener which currently handles drop events.
- *
- * @return the <code>TransferDropTargetListener</code> which currently
- * handles drop events.
- */
- private TransferDropTargetListener getCurrentListener() {
- return currentListener;
- }
- /**
- * Returns the transfer data type supported by the given listener.
- * Returns <code>null</code> if the listener does not support any of the
- * specified data types.
- *
- * @param dataTypes available data types
- * @param listener <code>TransferDropTargetListener</code> to use for testing
- * supported data types.
- * @return the transfer data type supported by the given listener or
- * <code>null</code>.
- */
- private TransferData getSupportedTransferType(TransferData[] dataTypes, TransferDropTargetListener listener) {
- for (int i = 0; i < dataTypes.length; i++) {
- if (listener.getTransfer().isSupportedType(dataTypes[i])) {
- return dataTypes[i];
- }
- }
- return null;
- }
- /**
- * Returns the combined set of <code>Transfer</code> types of all
- * <code>TransferDropTargetListeners</code>.
- *
- * @return the combined set of <code>Transfer</code> types
- */
- public Transfer[] getTransfers() {
- Transfer[] types = new Transfer[listeners.size()];
- for (int i = 0; i < listeners.size(); i++) {
- TransferDropTargetListener listener = (TransferDropTargetListener)listeners.get(i);
- types[i] = listener.getTransfer();
- }
- return types;
- }
- /**
- * Returns <code>true</code> if there are no listeners to delegate events to.
- *
- * @return <code>true</code> if there are no <code>TransferDropTargetListeners</code>
- * <code>false</code> otherwise
- */
- public boolean isEmpty() {
- return listeners.isEmpty();
- }
- /**
- * Removes the given <code>TransferDropTargetListener</code>.
- * Listeners should not be removed while a drag and drop operation is in progress.
- *
- * @param listener the listener to remove
- */
- public void removeDropTargetListener(TransferDropTargetListener listener) {
- if (currentListener == listener)
- currentListener = null;
- listeners.remove(listener);
- }
- /**
- * Sets the current listener to <code>listener</code>. Sends the given
- * <code>DropTargetEvent</code> if the current listener changes.
- *
- * @return <code>true</code> if the new listener is different than the previous
- * <code>false</code> otherwise
- */
- private boolean setCurrentListener(TransferDropTargetListener listener, final DropTargetEvent event) {
- if (currentListener == listener)
- return false;
- if (currentListener != null) {
- Platform.run(new SafeRunnable() {
- public void run() throws Exception {
- currentListener.dragLeave(event);
- }
- });
- }
- currentListener = listener;
-// if (Policy.DEBUG_DRAG_DROP)
-// System.out.println("Current drop listener: " + listener); //$NON-NLS-1$
- if (currentListener != null) {
- Platform.run(new SafeRunnable() {
- public void run() throws Exception {
- currentListener.dragEnter(event);
- }
- });
- }
- return true;
- }
- /**
- * Updates the current listener to one that can handle the drop. There can be many
- * listeners and each listener may be able to handle many <code>TransferData</code>
- * types. The first listener found that can handle a drop of one of the given
- * <code>TransferData</code> types will be selected.
- * If no listener can handle the drag operation the <code>event.detail</code> field
- * is set to <code>DND.DROP_NONE</code> to indicate an invalid drop.
- *
- * @param event the drop target event
- */
- private void updateCurrentListener(DropTargetEvent event) {
- int originalDetail = event.detail;
- // revert the detail to the "original" drop type that the User indicated.
- // this is necessary because the previous listener may have changed the detail
- // to something other than what the user indicated.
- event.detail = originalDropType;
-
- Iterator iter = listeners.iterator();
- while (iter.hasNext()) {
- TransferDropTargetListener listener = (TransferDropTargetListener) iter.next();
- TransferData dataType = getSupportedTransferType(event.dataTypes, listener);
- if (dataType != null) {
- TransferData originalDataType = event.currentDataType;
- // set the data type supported by the drop listener
- event.currentDataType = dataType;
- if (listener.isEnabled(event)) {
- // if the listener stays the same, set its previously determined
- // event detail
- if (!setCurrentListener(listener, event))
- event.detail = originalDetail;
- return;
- } else {
- event.currentDataType = originalDataType;
- }
- }
- }
- setCurrentListener(null, event);
- event.detail = DND.DROP_NONE;
- }
-}
\ No newline at end of file
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 cf33317..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/IOpenEventListener.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.util;
-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 e071dd4..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/IPropertyChangeListener.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.util;
-
-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 e7610a5..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/ListenerList.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.util;
-
-
-/**
- * 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 1.
- */
- public ListenerList() {
- this(1);
- }
-
- /**
- * 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,
- * in the order in which they were added.
- * <p>
- * 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.
- * </p>
- *
- * @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;
- }
-}
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 b374405..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/OpenStrategy.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.util;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TableTree;
-import org.eclipse.swt.custom.TableTreeItem;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.*;
-/**
- * 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 ed48a1e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/PropertyChangeEvent.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.util;
-
-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/SafeRunnable.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/SafeRunnable.java
deleted file mode 100644
index 40235d5..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/SafeRunnable.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.util;
-
-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.
- * <p><b>Note:<b> This class can open an error dialog and should not
- * be used outside of the UI Thread.</p>
- */
-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.jface/src/org/eclipse/jface/util/TransferDragSourceListener.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/TransferDragSourceListener.java
deleted file mode 100644
index b3d76be..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/TransferDragSourceListener.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.util;
-
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.Transfer;
-
-/**
- * A <code>TransferDragSourceListener</code> is a <code>DragSourceListener</code>
- * that can handle one type of SWT {@link Transfer}.
- * The purpose of a <code>TransferDragSourceListener</code> is to:
- * <ul>
- * <li>Determine enablement for a drag operation. A <code>TransferDragSourceListener</code>
- * will not be used in a drag operation if the <code>DragSourceEvent#doit</code> field
- * is set to false in <code>DragSourceListener#dragStart(DragSourceEvent)</code>.
- * <li>Set data for a single type of drag and <code>Transfer</code> type.
- * </ul>
- * <p>
- * A <code>DelegatingDragAdapter</code> allows these functions to be implemented
- * separately for unrelated types of drags. <code>DelegatingDragAdapter</code> then
- * combines the function of each <code>TransferDragSourceListener</code>, while
- * allowing them to be implemented as if they were the only <code>DragSourceListener</code>.
- * </p>
- * <p>
- * NOTE: This API is experimental and subject to change including removal.
- * </p>
-* @since 2.2
- */
-public interface TransferDragSourceListener extends DragSourceListener {
- /**
- * Returns the <code>Transfer</code> type that this listener can provide data for.
- *
- * @return the <code>Transfer</code> associated with this listener
- */
- Transfer getTransfer();
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/TransferDropTargetListener.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/util/TransferDropTargetListener.java
deleted file mode 100644
index da6e2a6..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/util/TransferDropTargetListener.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.util;
-
-import org.eclipse.swt.dnd.*;
-
-/**
- * A <code>TransferDropTargetListener</code> is a <code>DropTragetListener</code>
- * that handles one type of SWT {@link Transfer}.
- * The purpose of a <code>TransferDropTargetListener</code> is to:
- * <ul>
- * <li>Determine enablement for a drop operation. A <code>TransferDropTargetListener</code>
- * will not be used if <code>isEnabled</code> returns false.
- * <li>When enabled, optionally show feedback on the <code>DropTarget</code>.
- * <li>Perform the actual drop
- * </ul>
- * A <code>DelegatingDropAdapter</code> allows these functions to be implemented
- * separately for unrelated types of drags. <code>DelegatingDropAdapter</code> then
- * combines the function of each <code>TransferDropTargetListener</code>, while
- * allowing them to be implemented as if they were the only <code>DragSourceListener</code>.
- * <p>
- * NOTE: This API is experimental and subject to change including removal.
- * </p>
- * @since 2.2
-*/
-public interface TransferDropTargetListener extends DropTargetListener {
- /**
- * Returns the <code>Transfer</code> type that this listener can
- * accept a drop operation for.
- *
- * @return the <code>Transfer</code> for this listener
- */
- Transfer getTransfer();
- /**
- * Returns <code>true</code> if this listener can handle the drop
- * based on the given <code>DropTargetEvent</code>.
- * <p>
- * This method is called by the <code>DelegatingDropAdapter</code> only
- * if the <code>DropTargetEvent</code> contains a transfer data type
- * supported by this listener. The <code>Transfer</code> returned by the
- * <code>#getTransfer()</code> method is used for this purpose.
- * </p>
- *
- * @param event the drop target event
- * @return <code>true</code> if the listener is enabled for the given
- * drop target event.
- */
- boolean isEnabled(DropTargetEvent event);
-}
\ No newline at end of file
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 e909ff4..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java
+++ /dev/null
@@ -1,1557 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.viewers;
-
-import java.util.*;
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.*;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.widgets.*;
-
-/**
- * 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;
-
- /**
- * The safe runnable used to call the label provider.
- */
- private UpdateItemSafeRunnable safeUpdateItem =
- new UpdateItemSafeRunnable();
-
- class UpdateItemSafeRunnable extends SafeRunnable {
- Object element;
- Item item;
- boolean exception = false;
- public void run() {
- if (exception)
- return;
- doUpdateItem(item, element);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the application keeps running.
- exception = true;
- }
- }
-
- /**
- * 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) {
-
- Object[] filtered = filter(childElements);
- for (int i = 0; i < filtered.length; i++) {
- Object element = filtered[i];
- int index = indexForElement(widget, element);
- createTreeItem(widget, filtered[i], index);
- }
- }
- }
-
- /**
- * Returns the index where the item should be inserted.
- * @param parent The parent widget the element will be inserted into.
- * @param element The element to insert.
- */
- protected int indexForElement(Widget parent, Object element) {
- ViewerSorter sorter = getSorter();
- Item[] items = getChildren(parent);
-
- if (sorter == null)
- return items.length;
- int count = items.length;
- int min = 0, max = count - 1;
-
- while (min <= max) {
- int mid = (min + max) / 2;
- Object data = items[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 = items[mid].getData();
- compare = sorter.compare(this, data, element);
- }
- return mid;
- }
- if (compare < 0)
- min = mid + 1;
- else
- max = mid - 1;
- }
- return min;
- }
- /**
- * 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);
-
- /* (non-Javadoc)
- * @see StructuredViewer#associate(Object, Item)
- */
- protected void associate(Object element, Item item) {
- Object data = item.getData();
- if (data != null && data != element && equals(data, 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
- super.associate(element, item);
- }
- }
-
- /**
- * 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(final Widget widget) {
- final Item[] tis = getChildren(widget);
- if (tis != null && tis.length > 0) {
- Object data = tis[0].getData();
- if (data != null)
- return; // children already there!
- }
-
- BusyIndicator.showWhile(widget.getDisplay(), new Runnable() {
- public void run() {
- // fix for PR 1FW89L7:
- // don't complain and remove all "dummies" ...
- if (tis != null) {
- 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 (equals(root, 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) {
- associate(element, item);
- } else {
- item.setData(element);
- mapElement(element, item);
- }
-
- // update icon and label
- safeUpdateItem.item = item;
- safeUpdateItem.element = element;
- try {
- Platform.run(safeUpdateItem);
- } finally {
- safeUpdateItem.item = null;
- safeUpdateItem.element = null;
- }
- }
- }
- /**
- * 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(final TreeExpansionEvent event) {
- Object[] listeners = treeListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final ITreeViewerListener l = (ITreeViewerListener) listeners[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.treeCollapsed(event);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the application keeps running.
- removeTreeListener(l);
- }
- });
- }
- }
- /**
- * 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(final TreeExpansionEvent event) {
- Object[] listeners = treeListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final ITreeViewerListener l = (ITreeViewerListener) listeners[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.treeExpanded(event);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the application keeps running.
- removeTreeListener(l);
- }
- });
- }
-
- }
- /**
- * Returns the auto-expand level.
- *
- * @return non-negative level, or <code>ALL_LEVELS</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 (equals(parent, getRoot()))
- return super.getRawChildren(parent);
- ITreeContentProvider cp =
- (ITreeContentProvider) getContentProvider();
- if (cp != null) {
- Object[] result = cp.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 (equals(element, getRoot())) { // stop at root
- return null;
- }
- // my parent has to create me
- ITreeContentProvider cp =
- (ITreeContentProvider) getContentProvider();
- if (cp == null) {
- return null;
- }
- Object parent = cp.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 && equals(data, 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 (equals(data, 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.
- */
- protected void internalRefresh(Object element) {
- internalRefresh(element, true);
- }
- /* (non-Javadoc)
- * Method declared on StructuredViewer.
- */
- protected void internalRefresh(Object element, boolean updateLabels) {
- // If element is null, do a full refresh.
- if (element == null) {
- internalRefresh(getControl(), getRoot(), true, updateLabels);
- return;
- }
- Widget item = findItem(element);
- if (item != null) {
- // pick up structure changes too
- internalRefresh(item, element, true, updateLabels);
- }
- }
- /**
- * 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
- * @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.
- */
- private void internalRefresh(
- Widget widget,
- Object element,
- boolean doStruct,
- boolean updateLabels) {
-
- if (widget instanceof Item) {
- if (doStruct) {
- updatePlus((Item) widget, element);
- }
- if (updateLabels || !equals(element, widget.getData())) {
- doUpdateItem(widget, element, true);
- } else {
- associate(element, (Item) widget);
- }
- }
-
- if (doStruct) {
- internalRefreshStruct(widget, element, updateLabels);
- } else {
- 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, updateLabels);
- }
- }
- }
- }
-
- /**
- * Update the structure and recurse.
- * Items are updated in updateChildren, as needed.
- */
- private void internalRefreshStruct(
- Widget widget,
- Object element,
- boolean updateLabels) {
- updateChildren(widget, element, null, updateLabels);
- 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)
- internalRefreshStruct(item, data, updateLabels);
- }
- }
- }
-
- /**
- * Removes the given elements from this viewer.
- *
- * @param elements the elements to remove
- */
- private void internalRemove(Object[] elements) {
- Object input = getInput();
- HashSet parentItems = new HashSet(5);
- for (int i = 0; i < elements.length; ++i) {
- if (equals(elements[i], 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(HashSet 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) {
- // remove the element to avoid an infinite loop
- // if the same element appears on a child item
- boolean expanded = expandedElements.remove(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) {
- ITreeContentProvider cp = (ITreeContentProvider) getContentProvider();
- return cp != null && cp.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, but do force label updates
- internalRefresh(tree, getRoot(), false, true);
- 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 = 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 = 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 there is no auto-expand;
- * 1 means that top-level elements are expanded, but not their children;
- * 2 means that top-level elements are expanded, and their children,
- * but not grandchildren; and so on.
- * <p>
- * The value <code>ALL_LEVELS</code> means that all subtrees should be
- * expanded.
- * </p>
- *
- * @param level non-negative level, or <code>ALL_LEVELS</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) {
- HashSet 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
- *
- * @deprecated this is no longer called by the framework
- */
- protected void updateChildren(
- Widget widget,
- Object parent,
- Object[] elementChildren) {
- updateChildren(widget, parent, elementChildren, true);
- }
-
- /**
- * 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
- * @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.1
- */
- private void updateChildren(
- Widget widget,
- Object parent,
- Object[] elementChildren,
- boolean updateLabels) {
- // 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);
-
- // save the expanded elements
- HashSet expanded = new HashSet(); // assume num expanded is small
- for (int i = 0; i < items.length; ++i) {
- if (getExpanded(items[i])) {
- Object element = items[i].getData();
- if (element != null) {
- expanded.add(element);
- }
- }
- }
-
- 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 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 (equals(newElement, 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];
- Object newElement = elementChildren[i];
- if (item.getData() == null) {
- // old and new elements are not equal
- associate(newElement, item);
- updatePlus(item, newElement);
- updateItem(item, newElement);
- // Restore expanded state for items that changed position.
- // Make sure setExpanded is called after updatePlus, since
- // setExpanded(false) fails if item has no children.
- // Need to call setExpanded for both expanded and unexpanded cases
- // since the expanded state can change either way.
- setExpanded(item, expanded.contains(newElement));
- } else {
- // old and new elements are equal
- updatePlus(item, newElement);
- if (updateLabels) {
- updateItem(item, newElement);
- }
- }
- }
-
- // add any remaining elements
- if (min < elementChildren.length) {
- for (int i = min; i < elementChildren.length; ++i) {
- createTreeItem(widget, elementChildren[i], i);
- }
-
- // Need to restore expanded state in a separate pass
- // because createTreeItem does not return the new item.
- // Avoid doing this unless needed.
- if (!expanded.isEmpty()) {
- // get the items again, to include the new items
- items = getChildren(widget);
- for (int i = min; i < elementChildren.length; ++i) {
- // Restore expanded state for items that changed position.
- // Make sure setExpanded is called after updatePlus (called in createTreeItem), since
- // setExpanded(false) fails if item has no children.
- // Only need to call setExpanded if element was expanded
- // since new items are initially unexpanded.
- if (expanded.contains(elementChildren[i])) {
- setExpanded(items[i], true);
- }
- }
- }
- }
-
- // 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 && equals(element, 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
- }
-
- /**
- * Gets the expanded elements that are visible
- * to the user. An expanded element is only
- * visible if the parent is expanded.
- *
- * @return the visible expanded elements
- * @since 2.0
- */
- public Object[] getVisibleExpandedElements() {
- ArrayList v = new ArrayList();
- internalCollectVisibleExpanded(v, getControl());
- return v.toArray();
- }
-
- private void internalCollectVisibleExpanded(
- ArrayList 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/ArrayContentProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ArrayContentProvider.java
deleted file mode 100644
index 9d7619f..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ArrayContentProvider.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.viewers;
-
-import java.util.Collection;
-
-/**
- * This implementation of <code>IStructuredContentProvider</code> handles
- * the case where the input is an unchanging array or collection of elements.
- */
-public class ArrayContentProvider implements IStructuredContentProvider {
-
- /**
- * Returns the elements in the input, which must be either an array or a
- * <code>Collection</code>.
- */
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof Object[])
- return (Object[]) inputElement;
- if (inputElement instanceof Collection)
- return ((Collection) inputElement).toArray();
- return new Object[0];
- }
-
- /**
- * This implementation does nothing.
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- /**
- * This implementation does nothing.
- */
- public void dispose() {
- }
-}
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 a39d1c5..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CellEditor.java
+++ /dev/null
@@ -1,813 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.viewers;
-
-import org.eclipse.core.runtime.Platform;
-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 org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-/**
- * 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;
-
- /**
- * Default cell editor style
- */
- private static final int defaultStyle = SWT.NONE;
-
- /**
- * This cell editor's style
- */
- private int style = defaultStyle;
-
- /**
- * 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 with no control
- * The cell editor has no cell validator.
- * @since 2.1
- */
-protected CellEditor() {
-}
-/**
- * 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) {
- this(parent, defaultStyle);
-}
-/**
- * Creates a new cell editor under the given parent control.
- * The cell editor has no cell validator.
- *
- * @param parent the parent control
- * @param style the style bits
- * @since 2.1
- */
-protected CellEditor(Composite parent, int style) {
- this.style = style;
- create(parent);
-}
-/**
- * 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);
-/**
- * Creates the control for this cell editor under the given parent control.
- *
- * @param parent the parent control
- * @since 2.1
- */
-public void create(Composite parent) {
- Assert.isTrue(control==null);
- 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();
-}
-/**
- * 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() {
- if (control != null && !control.isDisposed()) {
- control.dispose();
- }
- control = null;
-}
-/**
- * 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[] array = listeners.getListeners();
- for (int i = 0; i < array.length; i ++) {
- final ICellEditorListener l = (ICellEditorListener)array[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.applyEditorValue();
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removeListener(l);
- }
- });
- }
-}
-/**
- * Notifies all registered cell editor listeners that editing has been
- * canceled.
- *
- * @see ICellEditorListener#cancelEditor
- */
-protected void fireCancelEditor() {
- Object[] array = listeners.getListeners();
- for (int i = 0; i < array.length; i ++) {
- final ICellEditorListener l = (ICellEditorListener)array[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.cancelEditor();
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removeListener(l);
- }
- });
- }
-}
-/**
- * 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(final boolean oldValidState, final boolean newValidState) {
- Object[] array = listeners.getListeners();
- for (int i = 0; i < array.length; i ++) {
- final ICellEditorListener l = (ICellEditorListener)array[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.editorValueChanged(oldValidState, newValidState);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removeListener(l);
- }
- });
- }
-}
-/**
- * Notifies all registered property listeners
- * of an enablement change.
- *
- * @param actionId the id indicating what action's enablement has changed.
- */
-protected void fireEnablementChanged(final String actionId) {
- Object[] array = propertyChangeListeners.getListeners();
- for (int i = 0; i < array.length; i ++) {
- final IPropertyChangeListener l = (IPropertyChangeListener)array[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.propertyChange(new PropertyChangeEvent(this, actionId, null, null));
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removePropertyChangeListener(l);
- }
- });
- }
-}
-/**
- * Sets the style bits for this cell editor.
- *
- * @param style the SWT style bits for this cell editor
- * @since 2.1
- */
-public void setStyle(int style) {
- this.style = style;
-}
-
-/**
- * Returns the style bits for this cell editor.
- *
- * @return the style for this cell editor
- * @since 2.1
- */
-public int getStyle() {
- return style;
-}
-/**
- * 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;
-}
-/**
- * Marks this cell editor as dirty.
- * @since 2.1
- */
-protected void markDirty() {
- dirty = true;
-}
-/**
- * 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 cancels editing
- * when the ESC key is pressed. When the RETURN key is pressed the current
- * value is applied and the cell editor deactivates.
- * 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();
- } else if (keyEvent.character == '\r') { // Return key
- fireApplyEditorValue();
- deactivate();
- }
-}
-/**
- * Processes a focus lost event that occurred in this cell editor.
- * <p>
- * The default implementation of this framework method applies the current
- * value and deactivates the cell editor.
- * Subclasses should call this method at appropriate times.
- * Subclasses may also extend or reimplement.
- * </p>
- */
-protected void focusLost() {
- if (isActivated()) {
- fireApplyEditorValue();
- deactivate();
- }
-}
-/**
- * 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 d105680..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckStateChangedEvent.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-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 afd2668..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxCellEditor.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * 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;
-
- /**
- * Default CheckboxCellEditor style
- */
- private static final int defaultStyle = SWT.NONE;
-
- /**
- * Creates a new checkbox cell editor with no control
- * @since 2.1
- */
- public CheckboxCellEditor() {
- setStyle(defaultStyle);
- }
- /**
- * 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) {
- this(parent, defaultStyle);
- }
- /**
- * 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
- * @param style the style bits
- * @since 2.1
- */
- public CheckboxCellEditor(Composite parent, int style) {
- super(parent, style);
- }
- /**
- * 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 1a8cc6a..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxTableViewer.java
+++ /dev/null
@@ -1,412 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.swt.events.*;
-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(final CheckStateChangedEvent event) {
- Object[] array = checkStateListeners.getListeners();
- for (int i = 0; i < array.length; i ++) {
- final ICheckStateListener l = (ICheckStateListener)array[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.checkStateChanged(event);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removeCheckStateListener(l);
- }
- });
- }
-}
-/* (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 f00eed9..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CheckboxTreeViewer.java
+++ /dev/null
@@ -1,516 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.swt.events.*;
-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(final CheckStateChangedEvent event) {
- Object[] array = checkStateListeners.getListeners();
- for (int i = 0; i < array.length; i ++) {
- final ICheckStateListener l = (ICheckStateListener)array[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.checkStateChanged(event);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removeCheckStateListener(l);
- }
- });
- }
-
-}
-/**
- * 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 4458fad..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColorCellEditor.java
+++ /dev/null
@@ -1,218 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import org.eclipse.swt.SWT;
-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) {
- this(parent, SWT.NONE);
-}
-/**
- * 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
- * @param style the style bits
- * @since 2.1
- */
-public ColorCellEditor(Composite parent, int style) {
- super(parent, style);
- 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, getStyle());
- 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 03adda4..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnLayoutData.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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 6f5e0c8..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnPixelData.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-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 befef9b..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ColumnWeightData.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-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 5380ae2..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ComboBoxCellEditor.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.viewers;
-
-import java.text.MessageFormat;
-
-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.GC;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * 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;
-
- /**
- * Default ComboBoxCellEditor style
- */
- private static final int defaultStyle = SWT.NONE;
-
-/**
- * Creates a new cell editor with no control and no st of choices. Initially,
- * the cell editor has no cell validator.
- *
- * @since 2.1
- * @see #setStyle
- * @see #create
- * @see #setItems
- * @see #dispose
- */
-public ComboBoxCellEditor() {
- setStyle(defaultStyle);
-}
-
-/**
- * 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) {
- this(parent, items, defaultStyle);
-}
-
-/**
- * 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
- * @param style the style bits
- * @since 2.1
- */
-public ComboBoxCellEditor(Composite parent, String[] items, int style) {
- super(parent, style);
- setItems(items);
-}
-
-/**
- * Returns the list of choices for the combo box
- *
- * @return the list of choices for the combo box
- */
-public String[] getItems() {
- return this.items;
-}
-
-/**
- * Sets the list of choices for the combo box
- *
- * @param items the list of choices for the combo box
- */
-public void setItems(String[] items) {
- Assert.isNotNull(items);
- this.items = items;
- populateComboBoxItems();
-}
-
-/* (non-Javadoc)
- * Method declared on CellEditor.
- */
-protected Control createControl(Composite parent) {
-
- comboBox = new CCombo(parent, getStyle());
- 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) {
- applyEditorValueAndDeactivate();
- }
- });
-
- comboBox.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
- e.doit = false;
- }
- }
- });
-
- comboBox.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- ComboBoxCellEditor.this.focusLost();
- }
- });
- 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. The minimum width is 10 characters
- * if <code>comboBox</code> is not <code>null</code> or <code>disposed</code>
- * eles it is 60 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();
- if ((comboBox == null) || comboBox.isDisposed())
- layoutData.minimumWidth = 60;
- else {
- // make the comboBox 10 characters wide
- GC gc = new GC(comboBox);
- layoutData.minimumWidth = (gc.getFontMetrics().getAverageCharWidth() * 10) + 10;
- gc.dispose();
- }
- 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);
-}
-
-/**
- * Updates the list of choices for the combo box for the current control.
- */
-private void populateComboBoxItems() {
- if (comboBox != null && items != null) {
- comboBox.removeAll();
- for (int i = 0; i < items.length; i++)
- comboBox.add(items[i], i);
-
- setValueValid(true);
- selection = 0;
- }
-}
-/**
- * Applies the currently selected value and deactiavates the cell editor
- */
-private void applyEditorValueAndDeactivate() {
- // must set the selection before getting value
- selection = comboBox.getSelectionIndex();
- Object newValue = doGetValue();
- markDirty();
- boolean isValid = isCorrect(newValue);
- setValueValid(isValid);
- if (!isValid) {
- // try to insert the current value into the error message.
- setErrorMessage(
- MessageFormat.format(getErrorMessage(), new Object[] {items[selection]}));
- }
- fireApplyEditorValue();
- deactivate();
-}
-
-/*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.CellEditor#focusLost()
- */
-protected void focusLost() {
- if (isActivated()) {
- applyEditorValueAndDeactivate();
- }
-}
-
-/*
- * (non-Javadoc)
- * @see org.eclipse.jface.viewers.CellEditor#keyReleaseOccured(org.eclipse.swt.events.KeyEvent)
- */
-protected void keyReleaseOccured(KeyEvent keyEvent) {
- if (keyEvent.character == '\u001b') { // Escape character
- fireCancelEditor();
- } else if (keyEvent.character == '\t') { // tab key
- applyEditorValueAndDeactivate();
- }
-}
-}
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 e078eff..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ContentViewer.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * 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/CustomHashtable.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CustomHashtable.java
deleted file mode 100644
index 0929004..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/CustomHashtable.java
+++ /dev/null
@@ -1,372 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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:
- * Peter Shipton - original hashtable implementation
- * Nick Edgar - added element comparer support
- ******************************************************************************/
-
-package org.eclipse.jface.viewers;
-
-import java.util.Enumeration;
-import java.util.NoSuchElementException;
-
-/**
- * CustomHashtable associates keys with values. Keys and values cannot be null.
- * The size of the Hashtable is the number of key/value pairs it contains.
- * The capacity is the number of key/value pairs the Hashtable can hold.
- * The load factor is a float value which determines how full the Hashtable
- * gets before expanding the capacity. If the load factor of the Hashtable
- * is exceeded, the capacity is doubled.
- * <p>
- * CustomHashtable allows a custom comparator and hash code provider.
- */
-/* package */ final class CustomHashtable {
-
-/**
- * HashMapEntry is an internal class which is used to hold the entries of a Hashtable.
- */
-private static class HashMapEntry {
- Object key, value;
- HashMapEntry next;
-
- HashMapEntry(Object theKey, Object theValue) {
- key = theKey;
- value = theValue;
- }
-}
-
-private static final class EmptyEnumerator implements Enumeration {
- public boolean hasMoreElements() {
- return false;
- }
-
- public Object nextElement() {
- throw new NoSuchElementException();
- }
-}
-
-private class HashEnumerator implements Enumeration {
- boolean key;
- int start;
- HashMapEntry entry;
-
- HashEnumerator(boolean isKey) {
- key = isKey;
- start = firstSlot;
- }
-
- public boolean hasMoreElements() {
- if (entry != null) return true;
- while (start <= lastSlot)
- if (elementData[start++] != null) {
- entry = elementData[start-1];
- return true;
- }
- return false;
- }
-
- public Object nextElement() {
- if (hasMoreElements()) {
- Object result = key ? entry.key : entry.value;
- entry = entry.next;
- return result;
- } else throw new NoSuchElementException();
- }
-}
-
- transient int elementCount;
- transient HashMapEntry[] elementData;
- private float loadFactor;
- private int threshold;
- transient int firstSlot = 0;
- transient int lastSlot = -1;
- transient private IElementComparer comparer;
-
- private static final EmptyEnumerator emptyEnumerator = new EmptyEnumerator();
-
- /**
- * Constructs a new Hashtable using the default capacity
- * and load factor.
- */
- public CustomHashtable() {
- this(13);
- }
-
- /**
- * Constructs a new Hashtable using the specified capacity
- * and the default load factor.
- *
- * @param capacity the initial capacity
- */
- public CustomHashtable(int capacity) {
- this(capacity, null);
- }
-
- /**
- * Constructs a new hash table with the default capacity and the given
- * element comparer.
- *
- * @param comparer the element comparer to use to compare keys and obtain
- * hash codes for keys, or <code>null</code> to use the normal
- * <code>equals</code> and <code>hashCode</code> methods
- */
- public CustomHashtable(IElementComparer comparer) {
- this(13, comparer);
- }
-
- /**
- * Constructs a new hash table with the given capacity and the given
- * element comparer.
- *
- * @param capacity the maximum number of elements that can be added without
- * rehashing
- * @param comparer the element comparer to use to compare keys and obtain
- * hash codes for keys, or <code>null</code> to use the normal
- * <code>equals</code> and <code>hashCode</code> methods
- */
- public CustomHashtable(int capacity, IElementComparer comparer) {
- if (capacity >= 0) {
- elementCount = 0;
- elementData = new HashMapEntry[capacity == 0 ? 1 : capacity];
- firstSlot = elementData.length;
- loadFactor = 0.75f;
- computeMaxSize();
- } else throw new IllegalArgumentException();
- this.comparer = comparer;
- }
-
- /**
- * Constructs a new hash table with enough capacity to hold all keys in the
- * given hash table, then adds all key/value pairs in the given hash table
- * to the new one, using the given element comparer.
- *
- * @param capacity the maximum number of elements that can be added without
- * rehashing
- * @param comparer the element comparer to use to compare keys and obtain
- * hash codes for keys, or <code>null</code> to use the normal
- * <code>equals</code> and <code>hashCode</code> methods
- */
- public CustomHashtable(CustomHashtable table, IElementComparer comparer) {
- this(table.size() * 2, comparer);
- for (int i = table.elementData.length; --i >= 0;) {
- HashMapEntry entry = table.elementData[i];
- while (entry != null) {
- put(entry.key, entry.value);
- entry = entry.next;
- }
- }
- }
-
- private void computeMaxSize() {
- threshold = (int)(elementData.length * loadFactor);
- }
-
- /**
- * Answers if this Hashtable contains the specified object as a key
- * of one of the key/value pairs.
- *
- * @param key the object to look for as a key in this Hashtable
- * @return true if object is a key in this Hashtable, false otherwise
- */
- public boolean containsKey(Object key) {
- return getEntry(key) != null;
- }
-
- /**
- * Answers an Enumeration on the values of this Hashtable. The
- * results of the Enumeration may be affected if the contents
- * of this Hashtable are modified.
- *
- * @return an Enumeration of the values of this Hashtable
- */
- public Enumeration elements() {
- if (elementCount == 0) return emptyEnumerator;
- return new HashEnumerator(false);
- }
-
- /**
- * Answers the value associated with the specified key in
- * this Hashtable.
- *
- * @param key the key of the value returned
- * @return the value associated with the specified key, null if the specified key
- * does not exist
- */
- public Object get(Object key) {
- int index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
- HashMapEntry entry = elementData[index];
- while (entry != null) {
- if (keyEquals(key, entry.key)) return entry.value;
- entry = entry.next;
- }
- return null;
- }
-
- private HashMapEntry getEntry(Object key) {
- int index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
- HashMapEntry entry = elementData[index];
- while (entry != null) {
- if (keyEquals(key, entry.key)) return entry;
- entry = entry.next;
- }
- return null;
- }
-
- /**
- * Answers the hash code for the given key.
- */
- private int hashCode(Object key) {
- if (comparer == null)
- return key.hashCode();
- else
- return comparer.hashCode(key);
- }
-
- /**
- * Compares two keys for equality.
- */
- private boolean keyEquals(Object a, Object b) {
- if (comparer == null)
- return a.equals(b);
- else
- return comparer.equals(a, b);
- }
-
- /**
- * Answers an Enumeration on the keys of this Hashtable. The
- * results of the Enumeration may be affected if the contents
- * of this Hashtable are modified.
- *
- * @return an Enumeration of the keys of this Hashtable
- */
- public Enumeration keys() {
- if (elementCount == 0) return emptyEnumerator;
- return new HashEnumerator(true);
- }
-
- /**
- * Associate the specified value with the specified key in this Hashtable.
- * If the key already exists, the old value is replaced. The key and value
- * cannot be null.
- *
- * @param key the key to add
- * @param value the value to add
- * @return the old value associated with the specified key, null if the key did
- * not exist
- */
- public Object put(Object key, Object value) {
- if (key != null && value != null) {
- int index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
- HashMapEntry entry = elementData[index];
- while (entry != null && !keyEquals(key, entry.key))
- entry = entry.next;
- if (entry == null) {
- if (++elementCount > threshold) {
- rehash();
- index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
- }
- if (index < firstSlot) firstSlot = index;
- if (index > lastSlot) lastSlot = index;
- entry = new HashMapEntry(key, value);
- entry.next = elementData[index];
- elementData[index] = entry;
- return null;
- }
- Object result = entry.value;
- entry.key = key; // important to avoid hanging onto keys that are equal but "old" -- see bug 30607
- entry.value = value;
- return result;
- } else throw new NullPointerException();
- }
-
-
- /**
- * Increases the capacity of this Hashtable. This method is sent when
- * the size of this Hashtable exceeds the load factor.
- */
- private void rehash() {
- int length = elementData.length<<1;
- if (length == 0) length = 1;
- firstSlot = length;
- lastSlot = -1;
- HashMapEntry[] newData = new HashMapEntry[length];
- for (int i=elementData.length; --i >= 0;) {
- HashMapEntry entry = elementData[i];
- while (entry != null) {
- int index = (hashCode(entry.key) & 0x7FFFFFFF) % length;
- if(index < firstSlot) firstSlot = index;
- if(index > lastSlot) lastSlot = index;
- HashMapEntry next = entry.next;
- entry.next = newData[index];
- newData[index] = entry;
- entry = next;
- }
- }
- elementData = newData;
- computeMaxSize();
- }
-
- /**
- * Remove the key/value pair with the specified key from this Hashtable.
- *
- * @param key the key to remove
- * @return the value associated with the specified key, null if the specified key
- * did not exist
- */
- public Object remove(Object key) {
- HashMapEntry last = null;
- int index = (hashCode(key) & 0x7FFFFFFF) % elementData.length;
- HashMapEntry entry = elementData[index];
- while (entry != null && !keyEquals(key, entry.key)) {
- last = entry;
- entry = entry.next;
- }
- if (entry != null) {
- if (last == null) elementData[index] = entry.next;
- else last.next = entry.next;
- elementCount--;
- return entry.value;
- }
- return null;
- }
-
- /**
- * Answers the number of key/value pairs in this Hashtable.
- *
- * @return the number of key/value pairs in this Hashtable
- */
- public int size() {
- return elementCount;
- }
-
- /**
- * Answers the string representation of this Hashtable.
- *
- * @return the string representation of this Hashtable
- */
- public String toString() {
- if (size() == 0) return "{}"; //$NON-NLS-1$
-
- StringBuffer buffer = new StringBuffer();
- buffer.append('{');
- for (int i=elementData.length; --i >= 0;) {
- HashMapEntry entry = elementData[i];
- while (entry != null) {
- buffer.append(entry.key);
- buffer.append('=');
- buffer.append(entry.value);
- buffer.append(", "); //$NON-NLS-1$
- entry = entry.next;
- }
- }
- // Remove the last ", "
- if (elementCount > 0) buffer.setLength(buffer.length() - 2);
- buffer.append('}');
- return buffer.toString();
- }
-}
\ No newline at end of file
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 94da7d7..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DecoratingLabelProvider.java
+++ /dev/null
@@ -1,171 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * 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 25af5ee..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DialogCellEditor.java
+++ /dev/null
@@ -1,283 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.resource.*;
-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;
- }
- }
-
- /**
- * Default DialogCellEditor style
- */
- private static final int defaultStyle = SWT.NONE;
-
-/**
- * Creates a new dialog cell editor with no control
- * @since 2.1
- */
-public DialogCellEditor() {
- setStyle(defaultStyle);
-}
-/**
- * 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) {
- this(parent, defaultStyle);
-}
-/**
- * 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
- * @param style the style bits
- * @since 2.1
- */
-protected DialogCellEditor(Composite parent, int style) {
- super(parent, style);
-}
-/**
- * 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, getStyle());
- 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) {
- markDirty();
- 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 067e69d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/DoubleClickEvent.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import java.util.EventObject;
-
-import org.eclipse.jface.util.Assert;
-
-/**
- * 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 d13eeb2..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IBaseLabelProvider.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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 231fbae..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IBasicPropertyConstants.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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 9190975..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellEditorListener.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-
-/**
- * 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 is changing the value in the cell editor. This
- * notification is normally sent only by text-based editors in response to a
- * keystroke, so that the listener may show an error message reflecting the
- * current valid state. This notification is sent while the value is being
- * actively edited, before the value is applied or cancelled. 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 e736dd9..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellEditorValidator.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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 fd420ea..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICellModifier.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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 ed567c9..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICheckStateListener.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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 93347e1..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ICheckable.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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/IColorProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IColorProvider.java
deleted file mode 100644
index d115491..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IColorProvider.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.viewers;
-
-import org.eclipse.swt.graphics.Color;
-
-/**
- * Interface to provide color representation for a given element.
- */
-public interface IColorProvider {
-
- /**
- * Provides a foreground color for the given element.
- *
- * @param element the element
- * @return the foreground color for the element, or <code>null</code>
- * to use the default foreground color
- */
- Color getForeground(Object element);
-
- /**
- * Provides a background color for the given element.
- *
- * @param element the element
- * @return the background color for the element, or <code>null</code>
- * to use the default background color
- */
- Color getBackground(Object element);
-}
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 4ba8c0a..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IContentProvider.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * A content provider mediates between the viewer's model
- * and the viewer itself.
- *
- * @see org.eclipse.jface.viewers.ContentViewer#setContentProvider(IContentProvider)
- */
-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/IDecoration.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IDecoration.java
deleted file mode 100644
index 88acd9f..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IDecoration.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-/**
- * Defines the result of decorating an element.
- *
- * This interface is not meant to be implemented and will
- * be provided to instances of <code>ILightweightLabelDecorator</code>.
- */
-public interface IDecoration {
-
- /**
- * Adds a prefix to the element's label.
- *
- * @param prefix the prefix
- */
- public void addPrefix(String prefix);
-
- /**
- * Adds a suffix to the element's label.
- *
- * @param suffix the suffix
- */
- public void addSuffix(String suffix);
-
- /**
- * Adds an overlay to the element's image.
- *
- * @param overlay the overlay image descriptor
- */
- public void addOverlay(ImageDescriptor overlay);
-}
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 eda3ae5..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IDoubleClickListener.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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/IElementComparer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IElementComparer.java
deleted file mode 100644
index bf7f51f..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IElementComparer.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.viewers;
-
-/**
- * This interface is used to compare elements in a viewer for equality,
- * and to provide the hash code for an element.
- * This allows the client of the viewer to specify different equality criteria
- * and a different hash code implementation than the
- * <code>equals</code> and <code>hashCode</code> implementations of the
- * elements themselves.
- *
- * @see StructuredViewer#setComparer
- */
-public interface IElementComparer {
-
- /**
- * Compares two elements for equality
- *
- * @param a the first element
- * @param b the second element
- * @return whether a is equal to b
- */
- boolean equals(Object a, Object b);
-
- /**
- * Returns the hash code for the given element.
- *
- * @return the hash code for the given element
- */
- int hashCode(Object element);
-}
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 7a23c7a..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IInputProvider.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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 d05fa7d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IInputSelectionProvider.java
+++ /dev/null
@@ -1,19 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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 979049d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelDecorator.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import org.eclipse.swt.graphics.Image;
-
-/**
- * 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.
- *
- * Text and image decoration updates can occur as a result of other updates
- * within the workbench including deferred decoration by background processes.
- * Clients should handle labelProviderChangedEvents for the given element to get
- * the complete decoration.
- * @see LabelProviderChangedEvent
- * @see IBaseLabelProvider#addListener
- *
- * @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.
- *
- * Text and image decoration updates can occur as a result of other updates
- * within the workbench including deferred decoration by background processes.
- * Clients should handle labelProviderChangedEvents for the given element to get
- * the complete decoration.
- * @see LabelProviderChangedEvent
- * @see IBaseLabelProvider#addListener
- *
- * @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 9a4843f..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-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 there 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 there 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 b2e1cab..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILabelProviderListener.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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/ILightweightLabelDecorator.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILightweightLabelDecorator.java
deleted file mode 100644
index 493b833..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ILightweightLabelDecorator.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-
-/**
- * The <code>ILightweightLabelDecorator</code> is a decorator that decorates
- * using a prefix, suffix and overlay image rather than doing all
- * of the image and text management itself like an <code>ILabelDecorator</code>.
- */
-public interface ILightweightLabelDecorator extends IBaseLabelProvider {
-
- /**
- * Calculates decorations based on element.
- *
- * @param element the element to decorate
- * @param decoration the decoration to set
- */
- public void decorate(Object element, IDecoration decoration);
-
-}
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 846ef33..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IOpenListener.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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/IPostSelectionProvider.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IPostSelectionProvider.java
deleted file mode 100644
index 586ad3d..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IPostSelectionProvider.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * Selection provider extension interface to allow providers
- * to notify about post selection changed events.
- * A post selection changed event is equivalent to selection changed event
- * if the selection change was triggered by the mouse, but it has a delay
- * if the selection change is triggered by keyboard navigation.
- *
- * @see ISelectionProvider
- *
- * @since 3.0
- */
-public interface IPostSelectionProvider extends ISelectionProvider {
-
-/**
- * Adds a listener for post selection changes in this selection provider.
- * Has no effect if an identical listener is already registered.
- *
- * @param listener a selection changed listener
- */
-public void addPostSelectionChangedListener(ISelectionChangedListener listener);
-
-/**
- * Removes the given listener for post selection changes from this selection
- * provider.
- * Has no affect if an identical listener is not registered.
- *
- * @param listener a selection changed listener
- */
-public void removePostSelectionChangedListener(ISelectionChangedListener listener);
-
-}
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 568a49a..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelection.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-/**
- * 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 b219034..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelectionChangedListener.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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 aba90e9..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ISelectionProvider.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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 5e8478c..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IStructuredContentProvider.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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 02d38f2..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IStructuredSelection.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-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 79698e3..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITableLabelProvider.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-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 7d9fc95..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITreeContentProvider.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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 d213faf..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ITreeViewerListener.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-
-/**
- * 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 b29e931..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/LabelProvider.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.SafeRunnable;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * 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(final LabelProviderChangedEvent event) {
- Object[] listeners = this.listeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final ILabelProviderListener l = (ILabelProviderListener)listeners[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.labelProviderChanged(event);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removeListener(l);
- }
- });
-
-
- }
-}
-/**
- * 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 655e569..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/LabelProviderChangedEvent.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-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;
- }
-}
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 ecd5092..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ListViewer.java
+++ /dev/null
@@ -1,394 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.viewers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Widget;
-
-import org.eclipse.jface.util.Assert;
-
-/**
- * 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 <code>List</code> control and configured
- * with a domain-specific content provider, label provider, element filter (optional),
- * and element sorter (optional).
- * <p>
- * Note that the SWT <code>List</code> control only supports the display of strings, not icons.
- * If you need to show icons for items, use <code>TableViewer</code> instead.
- * </p>
- *
- * @see TableViewer
- */
-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 && equals(element, 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 || equals(element, 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 (equals(elements[i], 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 c15bcdf..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/OpenEvent.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import java.util.EventObject;
-
-import org.eclipse.jface.util.Assert;
-
-/**
- * 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 d87db74..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/SelectionChangedEvent.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import java.util.EventObject;
-
-import org.eclipse.jface.util.Assert;
-
-/**
- * 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 5493d03..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredSelection.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import java.util.*;
-
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.Assert;
-
-/**
- * A concrete implementation of the <code>IStructuredSelection</code> interface,
- * suitable for instantiating.
- * <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 the 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 fa442da..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java
+++ /dev/null
@@ -1,1299 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- ******************************************************************************/package org.eclipse.jface.viewers;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.swt.dnd.DragSource;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.DropTarget;
-import org.eclipse.swt.dnd.DropTargetListener;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Widget;
-
-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.jface.util.SafeRunnable;
-
-/**
- * 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 implements IPostSelectionProvider {
-
- /**
- * 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 CustomHashtable elementMap;
-
- /**
- * The comparer to use for comparing elements,
- * or <code>null</code> to use the default <code>equals</code>
- * and <code>hashCode</code> methods on the element itself.
- */
- private IElementComparer comparer;
-
- /**
- * 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);
-
- /**
- * The safe runnable used to call the label provider.
- */
- private UpdateItemSafeRunnable safeUpdateItem = new UpdateItemSafeRunnable();
-
- class UpdateItemSafeRunnable extends SafeRunnable {
- Object object;
- Widget widget;
- boolean fullMap;
- boolean exception = false;
- public void run() {
- if(exception) return;
- doUpdateItem(widget,object,fullMap);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the application keeps running.
- exception = true;
- }
- }
-
-/**
- * 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);
-}
-
-/* (non-Javadoc)
- * Method declared on IPostSelectionProvider.
- */
-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);
-
-/**
- * Compares two elements for equality.
- * Uses the element comparer if one has been set, otherwise
- * uses the default <code>equals</code> method on the elements themselves.
- *
- * @param elementA the first element
- * @param elementB the second element
- * @return whether elementA is equal to elementB
- */
-protected boolean equals(Object elementA, Object elementB) {
- if (comparer == null)
- return elementA == null ? elementB == null : elementA.equals(elementB);
- else
- return elementA == null ? elementB == null : comparer.equals(elementA, elementB);
-}
-
-/**
- * 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(final DoubleClickEvent event) {
- Object[] listeners = doubleClickListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final IDoubleClickListener l = (IDoubleClickListener)listeners[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.doubleClick(event);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removeDoubleClickListener(l);
- }
- });
- }
-}
-/**
- * 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#open(OpenEvent)
- */
-protected void fireOpen(final OpenEvent event) {
- Object[] listeners = openListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final IOpenListener l = (IOpenListener)listeners[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.open(event);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removeOpenListener(l);
- }
- });
- }
-}
-/**
- * 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(ISelectionChangedListener)
- */
-protected void firePostSelectionChanged(final SelectionChangedEvent event) {
- Object[] listeners = postSelectionChangedListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final ISelectionChangedListener l = (ISelectionChangedListener)listeners[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.selectionChanged(event);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removeSelectionChangedListener(l);
- }
- });
- }
-}
-
-/**
- * Returns the comparator to use for comparing elements,
- * or <code>null</code> if none has been set.
- *
- * @param comparator the comparator to use for comparing elements
- * or <code>null</code>
- */
-public IElementComparer getComparer() {
- return comparer;
-}
-
-/**
- * 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) {
- IStructuredContentProvider cp = (IStructuredContentProvider) getContentProvider();
- if (cp != null) {
- result = cp.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 an <code>IStructuredSelection</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);
- SelectionChangedEvent event = new SelectionChangedEvent(this, newSelection);
- firePostSelectionChanged(event);
-}
-/**
- * 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, n = filters.size(); i < n; ++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) {
- safeUpdateItem.widget = widget;
- safeUpdateItem.object = element;
- safeUpdateItem.fullMap = false;
- Platform.run(safeUpdateItem);
-}
-/**
- * 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);
-}
-/* (non-Javadoc)
- * Method declared on IPostSelectionProvider.
- */
-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 CustomHashtable(comparer);
- } else {
- elementMap= null;
- }
-}
-
-/**
- * Sets the comparator to use for comparing elements,
- * or <code>null</code> to use the default <code>equals</code> and
- * <code>hashCode</code> methods on the elements themselves.
- *
- * @param comparator the comparator to use for comparing elements
- * or <code>null</code>
- */
-public void setComparer(IElementComparer comparer) {
- this.comparer = comparer;
- if (elementMap != null) {
- elementMap = new CustomHashtable(elementMap, comparer);
- }
-}
-
-/**
- * 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 CustomHashtable(comparer);
- }
-}
-/**
- * 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) {
- safeUpdateItem.widget = widget;
- safeUpdateItem.object = element;
- safeUpdateItem.fullMap = true;
- Platform.run(safeUpdateItem);
-}
-/**
- * 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 adcc04a..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableLayout.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.*;
-/**
- * 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 2172467..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableTreeViewer.java
+++ /dev/null
@@ -1,439 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.viewers;
-
-import java.util.List;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TableTree;
-import org.eclipse.swt.custom.TableTreeEditor;
-import org.eclipse.swt.custom.TableTreeItem;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.TreeListener;
-import org.eclipse.swt.graphics.Image;
-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.Item;
-import org.eclipse.swt.widgets.Widget;
-/**
- * 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 {
- public TableTreeViewerImpl(TableTreeViewer viewer) {
- super(viewer);
- }
- 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;
- }
- void handleDoubleClickEvent() {
- Viewer viewer = getViewer();
- fireDoubleClick (new DoubleClickEvent(viewer, viewer.getSelection()));
- fireOpen(new OpenEvent(viewer, viewer.getSelection()));
- }
- }
-/**
- * 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(this);
-}
-/**
- * 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();
- TableTreeItem ti = (TableTreeItem)item;
- // 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++) {
- 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 (ti.getImage(column) != image)
- ti.setImage(column, image);
- }
- if (prov instanceof IColorProvider) {
- IColorProvider cprov = (IColorProvider) prov;
- ti.setForeground(cprov.getForeground(element));
- ti.setBackground(cprov.getBackground(element));
- }
-}
-/**
- * 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);
- }
- });
-}
-/**
- * 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 382afef..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewer.java
+++ /dev/null
@@ -1,661 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.viewers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TableEditor;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.Widget;
-
-import org.eclipse.jface.util.Assert;
-
-/**
- * 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 (equals(element, 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 && equals(data, 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();
- TableItem ti = (TableItem) item;
- // 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()
- 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);
- }
- }
- if (prov instanceof IColorProvider) {
- IColorProvider cprov = (IColorProvider) prov;
- ti.setForeground(cprov.getForeground(element));
- ti.setBackground(cprov.getBackground(element));
- }
- }
-}
-/**
- * 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);
- }
- });
-}
-/*
- * 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(this) {
- 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;
- }
- void handleDoubleClickEvent() {
- Viewer viewer = getViewer();
- fireDoubleClick (new DoubleClickEvent(viewer, viewer.getSelection()));
- fireOpen (new OpenEvent(viewer, viewer.getSelection()));
- }
- };
-}
-/* (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 || equals(element, 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 (equals(children[i], items[i].getData())) {
- if (updateLabels) {
- updateItem(items[i], children[i]);
- }
- else {
- // associate the new element, even if equal to the old one,
- // to remove stale references (see bug 31314)
- associate(children[i], items[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 (equals(elements[i], 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 3d2c25e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TableViewerImpl.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.viewers;
-
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Item;
-
-/**
- * Internal table viewer implementation.
- */
-/* package */ abstract class TableViewerImpl {
-
- private CellEditor cellEditor;
- private CellEditor[] cellEditors;
- private ICellModifier cellModifier;
- private String[] columnProperties;
- private Item tableItem;
- private int columnNumber;
- private ICellEditorListener cellEditorListener;
- private FocusListener focusListener;
- private MouseListener mouseListener;
- private int doubleClickExpirationTime;
- private StructuredViewer viewer;
-
-
-TableViewerImpl(StructuredViewer viewer) {
- this.viewer = viewer;
- initCellEditorListener();
-}
-
-/**
- * Returns this <code>TableViewerImpl</code> viewer
- *
- * @return the viewer
- */
-public StructuredViewer getViewer() {
- return viewer;
-}
-
-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.
- final 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);
- mouseListener = new MouseAdapter() {
- public void mouseDown(MouseEvent e) {
- // time wrap?
- // check for expiration of doubleClickTime
- if (e.time <= doubleClickExpirationTime ) {
- control.removeMouseListener(mouseListener);
- cancelEditing();
- handleDoubleClickEvent();
- } else if (mouseListener != null) {
- control.removeMouseListener(mouseListener);
- }
- }
- };
- control.addMouseListener(mouseListener);
- }
- }
- }
-}
-/**
- * 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);
- Control control = c.getControl();
- if (control != null) {
- if (mouseListener != null) {
- control.removeMouseListener(mouseListener);
- }
- if (focusListener != null) {
- control.removeFocusListener(focusListener);
- }
- }
- 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 mouse down event; activates the cell editor.
- */
-public void handleMouseDown(MouseEvent event) {
- if (event.button != 1)
- return;
-
- // activate the cell editor immediately. If a second mouseDown
- // is received prior to the expiration of the doubleClick time then
- // the cell editor will be deactivated and a doubleClick event will
- // be processed.
- //
- doubleClickExpirationTime = event.time + Display.getCurrent().getDoubleClickTime();
-
- Item[] items = getSelection();
- // Do not edit if more than one row is selected.
- if (items.length != 1) {
- tableItem = null;
- return;
- }
- tableItem = items[0];
- activateCellEditor(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;
-}
-/**
- * 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();
-abstract void handleDoubleClickEvent();
-}
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 7a5bec9..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TextCellEditor.java
+++ /dev/null
@@ -1,384 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.viewers;
-
-import java.text.MessageFormat;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-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.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.MouseAdapter;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.TraverseEvent;
-import org.eclipse.swt.events.TraverseListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * 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;
-
- /**
- * Default TextCellEditor style
- * specify no borders on text widget as cell outline in table already
- * provides the look of a border.
- */
- private static final int defaultStyle = SWT.SINGLE;
-
-/**
- * Creates a new text string cell editor with no control
- * The cell editor value is the string itself, which is initially the empty
- * string. Initially, the cell editor has no cell validator.
- *
- * @since 2.1
- */
-public TextCellEditor() {
- setStyle(defaultStyle);
-}
-/**
- * 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) {
- this(parent, defaultStyle);
-}
-/**
- * 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
- * @param style the style bits
- * @since 2.1
- */
-public TextCellEditor(Composite parent, int style) {
- super(parent, style);
-}
-/**
- * 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) {
- text = new Text(parent, getStyle());
- 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.addFocusListener(new FocusAdapter() {
- public void focusLost(FocusEvent e) {
- TextCellEditor.this.focusLost();
- }
- });
- 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 2a597e8..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeExpansionEvent.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-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 80b36a4..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/TreeViewer.java
+++ /dev/null
@@ -1,234 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.viewers;
-
-import java.util.List;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.TreeListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-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.util.Assert;
-
-/**
- * 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.
- *
- * @param parent the parent control
- * @param style the SWT style bits used to create the tree.
- */
-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 (item.getImage() != image) {
- item.setImage(image);
- }
- if (provider instanceof IColorProvider) {
- IColorProvider cp = (IColorProvider) provider;
- TreeItem treeItem = (TreeItem) item;
- treeItem.setForeground(cp.getForeground(element));
- treeItem.setBackground(cp.getBackground(element));
- }
-}
-/* (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 3bdf937..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/Viewer.java
+++ /dev/null
@@ -1,375 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.swt.events.HelpListener;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Item;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.util.SafeRunnable;
-
-/**
- * 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 org.eclipse.swt.widgets.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(org.eclipse.swt.events.HelpEvent)
- */
-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(final SelectionChangedEvent event) {
- Object[] listeners = selectionChangedListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final ISelectionChangedListener l = (ISelectionChangedListener)listeners[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.selectionChanged(event);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removeSelectionChangedListener(l);
- }
- });
- }
-}
-/**
- * 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
- * @param value 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 4ea670a..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerDropAdapter.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.*;
-
-/**
- * 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 #getCurrentLocation()
- */
- 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 #getCurrentLocation()
- */
- 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 #getCurrentLocation()
- */
- 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 #getCurrentLocation()
- */
- 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) {
- currentTarget = determineTarget(event);
- doDropValidation(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) {
- currentTarget = determineTarget(event);
- doDropValidation(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) {
- //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);
- }
-}
-/* (non-Javadoc)
- * Method declared on DropTargetAdapter.
- * The user has dropped something on the desktop viewer.
- */
-public void drop(DropTargetEvent event) {
- currentLocation = determineLocation(event);
-
- //perform the drop behaviour
- if (!performDrop(event.data)) {
- event.detail = DND.DROP_NONE;
- }
- currentOperation = event.detail;
-}
-/* (non-Javadoc)
- * Method declared on DropTargetAdapter.
- * Last chance for the action to disable itself
- */
-public void dropAccept(DropTargetEvent event) {
- if (!validateDrop(currentTarget, event.detail, event.currentDataType)) {
- event.detail = DND.DROP_NONE;
- }
-}
-/**
- * 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;
-}
-/**
- * @deprecated this method should not be used. Exception handling has been
- * removed from DropTargetAdapter methods overridden by this class.
- * 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 (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;
- }
- }
- if (scrollExpandEnabled)
- event.feedback |= DND.FEEDBACK_EXPAND | DND.FEEDBACK_SCROLL;
-}
-/**
- * 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 7be1710..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerFilter.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import java.util.ArrayList;
-/**
- * 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 7043bae..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerSorter.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.viewers;
-
-import java.text.Collator;
-import java.util.Arrays;
-import java.util.Comparator;
-
-/**
- * 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/ApplicationWindow.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/window/ApplicationWindow.java
deleted file mode 100644
index ecd29fb..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/window/ApplicationWindow.java
+++ /dev/null
@@ -1,508 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.jface.window;
-
-import java.lang.reflect.InvocationTargetException;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Font;
-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.Decorations;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Layout;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.ToolBar;
-
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.StatusLineManager;
-import org.eclipse.jface.action.ToolBarManager;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.operation.ModalContext;
-import org.eclipse.jface.resource.JFaceResources;
-
-/**
- * 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;
-
- /**
- * The seperator between the menu bar and the rest of the window.
- */
- protected Label seperator1;
-
- /**
- * A flag indicating that an operation is running.
- */
- private boolean operationInProgress = false;
-
- /**
- * 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);
- }
- }
- }
- }
-
- /**
- * Return the top seperator.
- * @return Label
- */
- protected Label getSeperator1() {
- return seperator1;
- }
-
-/**
- * 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.
- */
-protected boolean canHandleShellCloseEvent() {
- return super.canHandleShellCloseEvent() && !operationInProgress;
-}
-/* (non-Javadoc)
- * Method declared on Window.
- */
-public boolean close() {
- if(operationInProgress)
- return false;
-
- 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((Decorations)shell));
- }
-
- // we need a special layout
- shell.setLayout(new ApplicationWindowLayout());
-
- if (! "carbon".equals(SWT.getPlatform())) //$NON-NLS-1$
- seperator1 = 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 {
- try {
- operationInProgress = true;
- 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.getEnabled();
- 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.getEnabled();
-
- // 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.getEnabled();
- 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 {
- operationInProgress = false;
- // 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.isDisposed()) currentFocus.setFocus();
- }
- } finally {
- operationInProgress = false;
- }
-}
-/**
- * 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.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 8e835d5..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/window/Window.java
+++ /dev/null
@@ -1,674 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.window;
-
-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.*;
-import org.eclipse.swt.graphics.*;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.*;
-
-/**
- * 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;
-}
-/**
- * Determines if the window should handle the close event
- * or do nothing.
- * <p>
- * The default implementation of this framework method
- * returns <code>true</code>, which will allow the
- * <code>handleShellCloseEvent</code> method to be called.
- * Subclasses may extend or reimplement.
- * </p>
- *
- * @return whether the window should handle the close event.
- */
-protected boolean canHandleShellCloseEvent() {
- return true;
-}
-/**
- * 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
- if (canHandleShellCloseEvent())
- 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 62b5459..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/window/WindowManager.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.window;
-
-import java.util.*;
-
-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.jface/src/org/eclipse/jface/wizard/IWizard.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/IWizard.java
deleted file mode 100644
index d5938d6..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/IWizard.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.wizard;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
-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.jface/src/org/eclipse/jface/wizard/IWizardContainer.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/IWizardContainer.java
deleted file mode 100644
index 966cedc..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/IWizardContainer.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.wizard;
-
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * 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.jface/src/org/eclipse/jface/wizard/IWizardNode.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/IWizardNode.java
deleted file mode 100644
index a0a3d2c..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/IWizardNode.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.wizard;
-
-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.jface/src/org/eclipse/jface/wizard/IWizardPage.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/IWizardPage.java
deleted file mode 100644
index 92176c4..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/IWizardPage.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.wizard;
-
-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.jface/src/org/eclipse/jface/wizard/ProgressMonitorPart.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/ProgressMonitorPart.java
deleted file mode 100644
index ee7d351..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/ProgressMonitorPart.java
+++ /dev/null
@@ -1,225 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.wizard;
-
-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));
- //Force an update as we are in the UI Thread
- fLabel.update();
- }
-
- /**
- * Implements <code>IProgressMonitor.worked</code>.
- * @see IProgressMonitor#worked(int)
- */
- public void worked(int work) {
- internalWorked(work);
- }
-}
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/Wizard.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/Wizard.java
deleted file mode 100644
index d2411b8..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/Wizard.java
+++ /dev/null
@@ -1,426 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.wizard;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Shell;
-/**
- * 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 #needsProgressMonitor()
- */
-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.jface/src/org/eclipse/jface/wizard/WizardDialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardDialog.java
deleted file mode 100644
index 62c3aeb..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardDialog.java
+++ /dev/null
@@ -1,1179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.wizard;
-
-import java.lang.reflect.InvocationTargetException;
-import java.util.*;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.*;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jface.operation.ModalContext;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-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.*;
-/**
- * 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;
-
- // 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 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.getEnabled()));
- 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(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(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;
-
- //Update for the new page ina busy cursor if possible
- if (getContents() == null)
- updateForPage(page);
- else {
- final IWizardPage finalPage = page;
- BusyIndicator
- .showWhile(getContents().getDisplay(), new Runnable() {
- public void run() {
- updateForPage(finalPage);
- }
- });
- }
-
- }
-
- /**
- * Update the receiver for the new page.
- * @param page
- */
- private void updateForPage(IWizardPage page) {
- // 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() {
-
- 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() {
-
- 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.jface/src/org/eclipse/jface/wizard/WizardPage.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardPage.java
deleted file mode 100644
index 1639c96..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardPage.java
+++ /dev/null
@@ -1,306 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.wizard;
-
-import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * 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.jface/src/org/eclipse/jface/wizard/WizardSelectionPage.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardSelectionPage.java
deleted file mode 100644
index f8ff03e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/WizardSelectionPage.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.wizard;
-
-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.jface/src/org/eclipse/jface/wizard/images/error.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/images/error.gif
deleted file mode 100644
index def995e..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/images/error.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/images/page.gif b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/images/page.gif
deleted file mode 100644
index befca65..0000000
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/images/page.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/package.html b/bundles/org.eclipse.jface/src/org/eclipse/jface/wizard/package.html
deleted file mode 100644
index f0e7c52..0000000
--- a/bundles/org.eclipse.jface/src/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.views/.classpath b/bundles/org.eclipse.ui.views/.classpath
deleted file mode 100644
index 2f01b0a..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" 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/about.html b/bundles/org.eclipse.ui.views/about.html
deleted file mode 100644
index 9db411a..0000000
--- a/bundles/org.eclipse.ui.views/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.views/build.properties b/bundles/org.eclipse.ui.views/build.properties
deleted file mode 100644
index dad6e72..0000000
--- a/bundles/org.eclipse.ui.views/build.properties
+++ /dev/null
@@ -1,17 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-bin.includes = plugin.properties,\
- plugin.xml,\
- about.html,\
- *.jar
-src.includes = about.html
-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 20b6e26..0000000
--- a/bundles/org.eclipse.ui.views/extensions/org/eclipse/ui/actions/AddTaskAction.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.actions;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.views.markers.internal.DialogTaskProperties;
-
-/**
- * Standard action for adding a task to the currently selected file
- * resource(s).
- * <p>
- * This class may be instantiated; it is not intended to be subclassed.
- * </p>
- * @since 2.1
- */
-public class AddTaskAction extends SelectionListenerAction {
- /**
- * The id of this action.
- */
- public static final String ID = PlatformUI.PLUGIN_ID + ".AddTaskAction";//$NON-NLS-1$
- /**
- * The shell in which to show any dialogs.
- */
- private Shell shell;
-
- /**
- * Creates a new instance of the receiver.
- *
- * @param shell shell to use to show any dialogs
- */
- public AddTaskAction(Shell shell) {
- super(WorkbenchMessages.getString("AddTaskLabel")); //$NON-NLS-1$
- setId(ID);
- this.shell = shell;
- Assert.isNotNull(shell);
- setToolTipText(WorkbenchMessages.getString("AddTaskToolTip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IHelpContextIds.ADD_TASK_ACTION);
- }
- private IResource getElement(IStructuredSelection selection) {
- if (selection.size() != 1)
- return null;
-
- Object element = selection.getFirstElement();
- IResource resource = null;
- if (element instanceof IResource)
- resource = (IResource) element;
- if (element instanceof IAdaptable)
- resource = (IResource) ((IAdaptable) element).getAdapter(IResource.class);
-
- if (resource != null && resource instanceof IProject) {
- IProject project = (IProject) resource;
- if (project.isOpen() == false)
- resource = null;
- }
- return resource;
- }
- /* (non-Javadoc)
- * Method declared on IAction.
- */
- public void run() {
- IResource resource = getElement(getStructuredSelection());
- if (resource != null) {
- DialogTaskProperties dialog= new DialogTaskProperties(shell);
- dialog.setResource(resource);
- dialog.open();
- }
- }
-
- /**
- * The <code>AddTaskAction</code> implementation of this
- * <code>SelectionListenerAction</code> method enables the action only
- * if the selection contains a single resource and the resource is
- * not a closed project.
- *
- * @param selection the selection to update the enabled state for
- */
- protected boolean updateSelection(IStructuredSelection selection) {
- return super.updateSelection(selection) && getElement(selection) != null;
- }
-}
diff --git a/bundles/org.eclipse.ui.views/extensions/org/eclipse/ui/internal/ViewsPlugin.java b/bundles/org.eclipse.ui.views/extensions/org/eclipse/ui/internal/ViewsPlugin.java
deleted file mode 100644
index 9d3953a..0000000
--- a/bundles/org.eclipse.ui.views/extensions/org/eclipse/ui/internal/ViewsPlugin.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal;
-
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * The plug-in runtime class for the views UI plug-in (id <code>"org.eclipse.ui.views"</code>).
- * <p>
- * This class provides static methods and fields only; it is not intended to be
- * instantiated or subclassed by clients.
- * </p>
- *
- * @since 2.1
- */
-public final class ViewsPlugin extends AbstractUIPlugin {
- /**
- * Text views UI plug-in id (value <code>"org.eclipse.ui.views"</code>).
- */
- public static final String PLUGIN_ID = "org.eclipse.ui.views"; //$NON-NLS-1$
-
- private static ViewsPlugin instance;
-
- /**
- * Returns the singleton instance.
- *
- * @return the singleton instance.
- */
- public static ViewsPlugin getDefault() {
- return instance;
- }
- /**
- * Creates a new instance of the receiver.
- *
- * @see org.eclipse.core.runtime.Plugin#Plugin(IPluginDescriptor)
- */
- public ViewsPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- instance = this;
- }
-}
diff --git a/bundles/org.eclipse.ui.views/plugin.properties b/bundles/org.eclipse.ui.views/plugin.properties
deleted file mode 100644
index 3f93211..0000000
--- a/bundles/org.eclipse.ui.views/plugin.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-pluginName= Views
-providerName= Eclipse.org
-
-CreateBookmark.text = Create &Bookmark
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/plugin.xml b/bundles/org.eclipse.ui.views/plugin.xml
deleted file mode 100644
index 67a933f..0000000
--- a/bundles/org.eclipse.ui.views/plugin.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.ui.views"
- name="%pluginName"
- version="2.1.0"
- provider-name="%providerName"
- class="org.eclipse.ui.internal.ViewsPlugin">
- <runtime>
- <library name="views.jar">
- <export name="*"/>
- <packages prefixes="org.eclipse.ui"/>
- </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 776df6f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkAction.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-import org.eclipse.ui.actions.SelectionProviderAction;
-
-/**
- * An abstract class for all bookmark view actions.
- */
-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 22f3485..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkContentProvider.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * Provides content for the bookmark navigator
- */
-class BookmarkContentProvider implements IStructuredContentProvider, 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;
-
- 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 79bde81..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkLabelProvider.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Provides labels for the bookmark navigator table
- */
-class BookmarkLabelProvider
- extends LabelProvider
- implements ITableLabelProvider {
-
- private Image image;
-
- final static int COLUMN_ICON = 0;
- final static int COLUMN_DESCRIPTION = 1;
- final static int COLUMN_RESOURCE = 2;
- final static int COLUMN_FOLDER = 3;
- final static int COLUMN_LOCATION = 4;
-
- 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;
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (!(element instanceof IMarker))
- return ""; //$NON-NLS-1$
- IMarker marker = (IMarker) element;
-
- switch (columnIndex) {
- case COLUMN_DESCRIPTION :
- return marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
- case COLUMN_RESOURCE :
- return marker.getResource().getName();
- case COLUMN_FOLDER :
- return getContainerName(marker);
- case COLUMN_LOCATION :
- {
- int line = marker.getAttribute(IMarker.LINE_NUMBER, -1);
- if (line == -1)
- return ""; //$NON-NLS-1$
- return BookmarkMessages.format("LineIndicator.text", new String[] {String.valueOf(line)});//$NON-NLS-1$
- }
- }
- return ""; //$NON-NLS-1$
- }
-
- public Image getColumnImage(Object element, int index) {
- if (index == COLUMN_ICON)
- return image;
- return null;
- }
-
- /**
- * Returns the container name if it is defined, or empty string if not.
- */
- public static String getContainerName(IMarker marker) {
- IPath path = marker.getResource().getFullPath();
- int n = path.segmentCount() - 1;
- // n is the number of segments in container, not path
- if (n <= 0)
- return ""; //$NON-NLS-1$
- int len = 0;
- for (int i = 0; i < n; ++i)
- len += path.segment(i).length();
- // account for /'s
- if (n > 1)
- len += n - 1;
- StringBuffer sb = new StringBuffer(len);
- for (int i = 0; i < n; ++i) {
- if (i != 0)
- sb.append('/');
- sb.append(path.segment(i));
- }
- return sb.toString();
- }
-}
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 967d6be..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkMessages.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-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 505df56..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkNavigator.java
+++ /dev/null
@@ -1,673 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.swt.widgets.Scrollable;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.IShowInSource;
-import org.eclipse.ui.part.IShowInTargetList;
-import org.eclipse.ui.part.MarkerTransfer;
-import org.eclipse.ui.part.ShowInContext;
-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 Table table;
- private TableViewer viewer;
- private OpenBookmarkAction openAction;
- private CopyBookmarkAction copyAction;
- private PasteBookmarkAction pasteAction;
- private RemoveBookmarkAction removeAction;
- private EditBookmarkAction editAction;
- private SelectAllAction selectAllAction;
- private ShowInNavigatorAction showInNavigatorAction;
- private SortByAction sortByDescriptionAction;
- private SortByAction sortByResourceAction;
- private SortByAction sortByFolderAction;
- private SortByAction sortByLineAction;
- private SortByAction sortByCreationTime;
- private ChangeSortDirectionAction sortAscendingAction;
- private ChangeSortDirectionAction sortDescendingAction;
- private IMemento memento;
- private BookmarkSorter sorter;
- private Clipboard clipboard;
-
- private final String columnHeaders[] = {
- BookmarkMessages.getString("ColumnIcon.header"),//$NON-NLS-1$
- BookmarkMessages.getString("ColumnDescription.header"),//$NON-NLS-1$
- BookmarkMessages.getString("ColumnResource.header"),//$NON-NLS-1$
- BookmarkMessages.getString("ColumnFolder.header"),//$NON-NLS-1$
- BookmarkMessages.getString("ColumnLocation.header")};//$NON-NLS-1$
-
- private ColumnLayoutData columnLayouts[] = {
- new ColumnPixelData(19, false),
- new ColumnWeightData(200),
- new ColumnWeightData(75),
- new ColumnWeightData(150),
- new ColumnWeightData(60)};
-
- // 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$
-
- class SortByAction extends Action {
-
- private int column;
-
- public SortByAction(int column) {
- this.column = column;
- }
-
- public void run() {
- sorter.setTopPriority(column);
- updateSortState();
- viewer.refresh();
- IDialogSettings workbenchSettings = getPlugin().getDialogSettings();
- IDialogSettings settings = workbenchSettings.getSection("BookmarkSortState");//$NON-NLS-1$
- if (settings == null)
- settings = workbenchSettings.addNewSection("BookmarkSortState");//$NON-NLS-1$
- sorter.saveState(settings);
- }
- }
-
- class ChangeSortDirectionAction extends Action {
-
- private int direction;
-
- public ChangeSortDirectionAction(int direction) {
- this.direction = direction;
- }
-
- public void run() {
- sorter.setTopPriorityDirection(direction);
- updateSortState();
- viewer.refresh();
- IDialogSettings workbenchSettings = getPlugin().getDialogSettings();
- IDialogSettings settings = workbenchSettings.getSection("BookmarkSortState");//$NON-NLS-1$
- if (settings == null)
- settings = workbenchSettings.addNewSection("BookmarkSortState");//$NON-NLS-1$
- sorter.saveState(settings);
- }
- }
-
- /**
- * Creates the bookmarks view.
- */
- public BookmarkNavigator() {
- super();
- }
- /**
- * Adds this views contributions to the workbench.
- */
- void addContributions() {
- ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
-
- // 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(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_HOVER));
-
- pasteAction = new PasteBookmarkAction(this);
- pasteAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_HOVER));
-
- removeAction = new RemoveBookmarkAction(this);
- removeAction.setHoverImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_HOVER));
- removeAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
- removeAction.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
-
- editAction = new EditBookmarkAction(this);
-
- 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.PASTE, pasteAction);
- 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) {
- clipboard = new Clipboard(parent.getDisplay());
- createTable(parent);
- viewer = new TableViewer(table);
- createColumns();
-
- sorter = new BookmarkSorter();
- viewer.setContentProvider(new BookmarkContentProvider(this));
- viewer.setLabelProvider(new BookmarkLabelProvider(this));
- viewer.setInput(ResourcesPlugin.getWorkspace().getRoot());
- viewer.setSorter(sorter);
-
- IDialogSettings workbenchSettings = getPlugin().getDialogSettings();
- IDialogSettings settings = workbenchSettings.getSection("BookmarkSortState");//$NON-NLS-1$
- sorter.restoreState(settings);
-
- addContributions();
- initDragAndDrop();
- createSortActions();
- fillActionBars();
- updateSortState();
- updatePasteEnablement();
-
- getSite().setSelectionProvider(viewer);
-
- if(memento != null) restoreState(memento);
- memento = null;
-
- WorkbenchHelp.setHelp(viewer.getControl(), IBookmarkHelpContextIds.BOOKMARK_VIEW);
- }
-
- public void dispose() {
- if (clipboard != null)
- clipboard.dispose();
- }
-
- /**
- * 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);
- updatePasteEnablement();
- manager.add(pasteAction);
- manager.add(removeAction);
- manager.add(selectAllAction);
- manager.add(showInNavigatorAction);
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- manager.add(new Separator());
- manager.add(editAction);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IShowInSource.class) {
- return new IShowInSource() {
- public ShowInContext getShowInContext() {
- return new ShowInContext(null, getViewer().getSelection());
- }
- };
- }
- if (adapter == IShowInTargetList.class) {
- return new IShowInTargetList() {
- public String[] getShowInTargetIds() {
- return new String[] { IPageLayout.ID_RES_NAV };
- }
-
- };
- }
- return super.getAdapter(adapter);
- }
-
- /**
- * 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);
- editAction.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){}
- }
-
- updateSortState();
- viewer.refresh();
- }
- 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();
- }
-
- void createColumns() {
- 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 - first column doesn't count
- int column = table.indexOf((TableColumn) e.widget) - 1;
- if (column == sorter.getTopPriority())
- sorter.reverseTopPriority();
- else {
- sorter.setTopPriority(column);
- }
- updateSortState();
- viewer.refresh();
- IDialogSettings workbenchSettings = getPlugin().getDialogSettings();
- IDialogSettings settings = workbenchSettings.getSection("BookmarkSortState");//$NON-NLS-1$
- if (settings == null)
- settings = workbenchSettings.addNewSection("BookmarkSortState");//$NON-NLS-1$
- sorter.saveState(settings);
- }
- };
-
- 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]);
- if (i > 0)
- tc.addSelectionListener(headerListener);
- }
- }
-
- /**
- * 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());
- }
-
- /**
- * Fills the local tool bar and menu manager with actions.
- */
- void fillActionBars() {
- IActionBars actionBars = getViewSite().getActionBars();
- IMenuManager menu = actionBars.getMenuManager();
- IMenuManager submenu =
- new MenuManager(BookmarkMessages.getString("SortMenuGroup.text")); //$NON-NLS-1$
- menu.add(submenu);
- submenu.add(sortByDescriptionAction);
- submenu.add(sortByResourceAction);
- submenu.add(sortByFolderAction);
- submenu.add(sortByLineAction);
- submenu.add(sortByCreationTime);
- submenu.add(new Separator());
- submenu.add(sortAscendingAction);
- submenu.add(sortDescendingAction);
- }
-
- void createSortActions() {
- sortByDescriptionAction = new SortByAction(BookmarkSorter.DESCRIPTION);
- sortByDescriptionAction.setText(BookmarkMessages.getString("ColumnDescription.text")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(sortByDescriptionAction, IBookmarkHelpContextIds.SORT_DESCRIPTION_ACTION);
-
- sortByResourceAction = new SortByAction(BookmarkSorter.RESOURCE);
- sortByResourceAction.setText(BookmarkMessages.getString("ColumnResource.text")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(sortByResourceAction, IBookmarkHelpContextIds.SORT_RESOURCE_ACTION);
-
- sortByFolderAction = new SortByAction(BookmarkSorter.FOLDER);
- sortByFolderAction.setText(BookmarkMessages.getString("ColumnFolder.text")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(sortByFolderAction, IBookmarkHelpContextIds.SORT_FOLDER_ACTION);
-
- sortByLineAction = new SortByAction(BookmarkSorter.LOCATION);
- sortByLineAction.setText(BookmarkMessages.getString("ColumnLocation.text"));//$NON-NLS-1$
- WorkbenchHelp.setHelp(sortByLineAction, IBookmarkHelpContextIds.SORT_LOCATION_ACTION);
-
- sortByCreationTime = new SortByAction(BookmarkSorter.CREATION_TIME);
- sortByCreationTime.setText(BookmarkMessages.getString("ColumnCreationTime.text"));//$NON-NLS-1$
- WorkbenchHelp.setHelp(sortByCreationTime, IBookmarkHelpContextIds.SORT_CREATION_TIME_ACTION);
-
- sortAscendingAction = new ChangeSortDirectionAction(BookmarkSorter.ASCENDING);
- sortAscendingAction.setText(BookmarkMessages.getString("SortDirectionAscending.text"));//$NON-NLS-1$
- WorkbenchHelp.setHelp(sortAscendingAction, IBookmarkHelpContextIds.SORT_ASCENDING_ACTION);
-
- sortDescendingAction = new ChangeSortDirectionAction(BookmarkSorter.DESCENDING);
- sortDescendingAction.setText(BookmarkMessages.getString("SortDirectionDescending.text"));//$NON-NLS-1$
- WorkbenchHelp.setHelp(sortDescendingAction, IBookmarkHelpContextIds.SORT_DESCENDING_ACTION);
- }
-
- void updateSortState() {
- int column = sorter.getTopPriority();
- sortByDescriptionAction.setChecked(column == BookmarkSorter.DESCRIPTION);
- sortByResourceAction.setChecked(column == BookmarkSorter.RESOURCE);
- sortByFolderAction.setChecked(column == BookmarkSorter.FOLDER);
- sortByLineAction.setChecked(column == BookmarkSorter.LOCATION);
- sortByCreationTime.setChecked(column == BookmarkSorter.CREATION_TIME);
-
- int direction = sorter.getTopPriorityDirection();
- sortAscendingAction.setChecked(direction == BookmarkSorter.ASCENDING);
- sortDescendingAction.setChecked(direction == BookmarkSorter.DESCENDING);
- }
-
- /**
- * 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++) {
- try {
- if (markerData[i].getType().equals(IMarker.BOOKMARK)) {
- canPaste = true;
- break;
- }
- }
- catch (CoreException e) {
- canPaste = false;
- }
- }
- }
- pasteAction.setEnabled(canPaste);
- }
-
- Clipboard getClipboard() {
- return clipboard;
- }
-
-}
-
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkPropertiesDialog.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkPropertiesDialog.java
deleted file mode 100644
index 589ee5d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkPropertiesDialog.java
+++ /dev/null
@@ -1,454 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-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.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.graphics.Font;
-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.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Shows the properties of a new or existing bookmark
- */
-class BookmarkPropertiesDialog extends Dialog {
-
- /**
- * The bookmark being shown, or <code>null</code> for a new bookmark
- */
- private IMarker marker = null;
-
- /**
- * The resource on which to create a new bookmark
- */
- private IResource resource = null;
-
- /**
- * The initial attributes to use when creating a new bookmark
- */
- private Map initialAttributes = null;
-
- /**
- * The text control for the Description field.
- */
- private Text descriptionText;
-
- /**
- * The control for the Creation Time field.
- */
- private Label creationTime;
-
- /**
- * 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;
-
- private String title;
-
- /**
- * Creates the dialog. By default this dialog creates a new bookmark.
- * To set the resource and initial attributes for the new bookmark,
- * use <code>setResource</code> and <code>setInitialAttributes</code>.
- * To show or modify an existing bookmark, use <code>setMarker</code>.
- *
- * @param shell the parent shell
- */
- public BookmarkPropertiesDialog(Shell parentShell) {
- super(parentShell);
- }
-
- public BookmarkPropertiesDialog(Shell parentShell, String title) {
- super(parentShell);
- this.title = title;
- }
-
- public void create() {
- super.create();
- }
-
- /**
- * 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 bookmark.
- * If not set, the new bookmark is created on the workspace root.
- */
- public void setResource(IResource resource) {
- this.resource = resource;
- }
-
- /**
- * Returns the resource to use when creating a new bookmark,
- * or <code>null</code> if none has been set.
- * If not set, the new bookmark is created on the workspace root.
- */
- public IResource getResource() {
- return resource;
- }
-
- /**
- * Sets initial attributes to use when creating a new bookmark.
- * If not set, the new bookmark is created with default attributes.
- */
- public void setInitialAttributes(Map initialAttributes) {
- this.initialAttributes = initialAttributes;
- }
-
- /**
- * Returns the initial attributes to use when creating a new bookmark,
- * or <code>null</code> if not set.
- * If not set, the new bookmark 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 (title == null)
- newShell.setText(
- BookmarkMessages.getString("PropertiesDialogTitle.text")); //$NON-NLS-1$
- else
- newShell.setText(title);
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- //initialize resources/properties
- if (marker != null) {
- resource = marker.getResource();
- try {
- initialAttributes = marker.getAttributes();
- }
- catch (CoreException e) {
- }
- }
- else if (initialAttributes == null && resource == null) {
- resource = (IResource) ResourcesPlugin.getWorkspace().getRoot();
- }
-
- Composite composite = (Composite) super.createDialogArea(parent);
- initializeDialogUnits(composite);
- createDescriptionArea(composite);
- if (marker != null)
- createCreationTimeArea(composite);
- if (resource != null && resource.getType() != IResource.ROOT)
- createResourceArea(composite);
- updateDialogFromMarker();
- return composite;
- }
- /**
- * Method createCreationTimeArea.
- * @param composite
- */
- private void createCreationTimeArea(Composite parent) {
- String creation = BookmarkMessages.getString("MarkerCreationTime.text");//$NON-NLS-1$
-
- Font font = parent.getFont();
- 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(creation);
- label.setFont(font);
-
- creationTime = new Label(composite, SWT.NONE);
- creationTime.setFont(font);
- }
-
- /**
- * Creates the OK and Cancel buttons.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(
- parent,
- IDialogConstants.OK_ID,
- IDialogConstants.OK_LABEL,
- true);
- createButton(
- parent,
- IDialogConstants.CANCEL_ID,
- IDialogConstants.CANCEL_LABEL,
- false);
- }
-
- /**
- * Creates the area for the Description field.
- */
- private void createDescriptionArea(Composite parent) {
- Font font = parent.getFont();
- 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(BookmarkMessages.getString("ColumnDescription.dialogText")); //$NON-NLS-1$
- label.setFont(font);
- int style = SWT.SINGLE | SWT.BORDER;
- descriptionText = new Text(composite, style);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = convertHorizontalDLUsToPixels(400);
- descriptionText.setLayoutData(gridData);
- descriptionText.setFont(font);
-
- descriptionText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- markDirty();
- }
- });
- }
-
- /**
- * Creates the area for the Resource field.
- */
- private void createResourceArea(Composite parent) {
- Font font = parent.getFont();
- 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(BookmarkMessages.getString("ColumnResource.dialogText")); //$NON-NLS-1$
- resourceLabel.setFont(font);
- resourceText =
- new Text(
- composite,
- SWT.SINGLE | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- resourceText.setLayoutData(gridData);
- resourceText.setFont(font);
-
- Label folderLabel = new Label(composite, SWT.NONE);
- folderLabel.setText(BookmarkMessages.getString("ColumnFolder.dialogText")); //$NON-NLS-1$
- folderLabel.setFont(font);
- folderText =
- new Text(
- composite,
- SWT.SINGLE | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- folderText.setLayoutData(gridData);
- folderText.setFont(font);
-
- Label locationLabel = new Label(composite, SWT.NONE);
- locationLabel.setText(BookmarkMessages.getString("ColumnLocation.dialogText")); //$NON-NLS-1$
- locationLabel.setFont(font);
- locationText =
- new Text(
- composite,
- SWT.SINGLE | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- locationText.setLayoutData(gridData);
- locationText.setFont(font);
- }
-
- /**
- * Updates the dialog from the marker state.
- */
- private void updateDialogFromMarker() {
- if (marker == null) {
- updateDialogForNewMarker();
- return;
- }
- descriptionText.setText(MarkerUtil.getMessage(marker));
- if (creationTime != null)
- creationTime.setText(MarkerUtil.getCreationTime(marker));
- if (resourceText != null)
- resourceText.setText(MarkerUtil.getResourceName(marker));
- if (folderText != null)
- folderText.setText(MarkerUtil.getContainerName(marker));
- if (locationText != null) {
- int line = MarkerUtil.getLineNumber(marker);
- if (line < 0)
- locationText.setText(""); //$NON-NLS-1$
- else
- locationText.setText(BookmarkMessages.format("LineIndicator.text", new String[] {String.valueOf(line)})); //$NON-NLS-1$
- }
-
- descriptionText.selectAll();
- }
-
- void updateDialogForNewMarker() {
- if (resource != null) {
- resourceText.setText(resource.getName());
-
- IPath path = resource.getFullPath();
- int n = path.segmentCount() - 1; // n is the number of segments in container, not path
- if (n > 0) {
- int len = 0;
- for (int i = 0; i < n; ++i)
- len += path.segment(i).length();
- // account for /'s
- if (n > 1)
- len += n-1;
- StringBuffer sb = new StringBuffer(len);
- for (int i = 0; i < n; ++i) {
- if (i != 0)
- sb.append('/');
- sb.append(path.segment(i));
- }
- folderText.setText(sb.toString());
- }
- }
-
- if (initialAttributes != null) {
- Object description = initialAttributes.get(IMarker.MESSAGE);
- if (description != null && description instanceof String)
- descriptionText.setText((String) description);
- descriptionText.selectAll();
-
- Object line = initialAttributes.get(IMarker.LINE_NUMBER);
- if (line != null && line instanceof Integer)
- locationText.setText(BookmarkMessages.format("LineIndicator.text", new String[] {line.toString()})); //$NON-NLS-1$
- }
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog
- */
- protected void okPressed() {
- saveChanges();
- super.okPressed();
- }
-
- private void markDirty() {
- dirty = true;
- }
-
- private boolean isDirty() {
- return dirty;
- }
-
- /**
- * Saves the changes made in the dialog if needed.
- * Creates a new bookmark if needed.
- * Updates the existing bookmark only if there have been changes.
- */
- private void saveChanges() {
- try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor)
- throws CoreException {
- if (marker == null)
- createMarker();
- else if (isDirty())
- updateMarker();
- }
- }, null);
- } catch (CoreException e) {
- ErrorDialog.openError(getShell(), BookmarkMessages.getString("Error"), null, e.getStatus()); //$NON-NLS-1$
- return;
- }
- }
-
- /**
- * Creates or updates the marker. Must be called within a workspace runnable.
- */
- private void updateMarker() throws CoreException {
- // 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();
- attribs.put(IMarker.MESSAGE, descriptionText.getText());
- return attribs;
- }
-
- private void createMarker() {
- if (resource == null || !(resource instanceof IFile))
- return;
-
- IFile file = (IFile) resource;
- try {
- IMarker newMarker = file.createMarker(IMarker.BOOKMARK);
- if (initialAttributes != null)
- newMarker.setAttributes(initialAttributes);
- String message = descriptionText.getText();
- newMarker.setAttribute(IMarker.MESSAGE, message);
- }
- catch (CoreException e) {
- }
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkSorter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkSorter.java
deleted file mode 100644
index 5d7c7a3..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/BookmarkSorter.java
+++ /dev/null
@@ -1,186 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-class BookmarkSorter extends ViewerSorter {
-
- private int[] directions;
- private int[] priorities;
-
- final static int ASCENDING = 1;
- final static int DESCENDING = -1;
- final static int DESCRIPTION = 0;
- final static int RESOURCE = 1;
- final static int FOLDER = 2;
- final static int LOCATION = 3;
- final static int CREATION_TIME = 4;
- final static int[] DEFAULT_PRIORITIES =
- { FOLDER,
- RESOURCE,
- LOCATION,
- DESCRIPTION,
- CREATION_TIME };
- final static int[] DEFAULT_DIRECTIONS =
- { ASCENDING, //description
- ASCENDING, //resource
- ASCENDING, //folder
- ASCENDING, //location
- ASCENDING, }; //creation time
-
- public BookmarkSorter() {
- resetState();
- }
-
- public void reverseTopPriority() {
- directions[priorities[0]] *= -1;
- }
-
- public void setTopPriority(int priority) {
- if (priority < 0 || priority >= priorities.length)
- return;
-
- int index = -1;
- for (int i = 0; i < priorities.length; i++) {
- if (priorities[i] == priority)
- index = i;
- }
-
- if (index == -1) {
- resetState();
- return;
- }
-
- //shift the array
- for (int i = index; i > 0; i--) {
- priorities[i] = priorities[i - 1];
- }
- priorities[0] = priority;
- directions[priority] = DEFAULT_DIRECTIONS[priority];
- }
-
- public void setTopPriorityDirection(int direction) {
- if (direction == ASCENDING || direction == DESCENDING)
- directions[priorities[0]] = direction;
- }
-
- public int getTopPriorityDirection() {
- return directions[priorities[0]];
- }
-
- public int getTopPriority() {
- return priorities[0];
- }
-
- public int[] getPriorities() {
- return priorities;
- }
-
- public void resetState() {
- priorities = new int[DEFAULT_PRIORITIES.length];
- System.arraycopy(DEFAULT_PRIORITIES, 0, priorities, 0, priorities.length);
- directions = new int[DEFAULT_DIRECTIONS.length];
- System.arraycopy(DEFAULT_DIRECTIONS, 0, directions, 0, directions.length);
- }
-
- private int compare(IMarker marker1, IMarker marker2, int depth) {
- if (depth >= priorities.length)
- return 0;
-
- int column = priorities[depth];
- switch (column) {
- case DESCRIPTION: {
- String desc1 = marker1.getAttribute(IMarker.MESSAGE, "");//$NON-NLS-1$
- String desc2 = marker2.getAttribute(IMarker.MESSAGE, "");//$NON-NLS-1$
- int result = collator.compare(desc1, desc2);
- if (result == 0)
- return compare(marker1, marker2, depth + 1);
- return result * directions[column];
- }
- case RESOURCE: {
- String res1 = marker1.getResource().getName();
- String res2 = marker2.getResource().getName();
- int result = collator.compare(res1, res2);
- if (result == 0)
- return compare(marker1, marker2, depth + 1);
- return result * directions[column];
- }
- case FOLDER: {
- String folder1 = BookmarkLabelProvider.getContainerName(marker1);
- String folder2 = BookmarkLabelProvider.getContainerName(marker2);
- int result = collator.compare(folder1, folder2);
- if (result == 0)
- return compare(marker1, marker2, depth + 1);
- return result * directions[column];
- }
- case LOCATION: {
- int line1 = marker1.getAttribute(IMarker.LINE_NUMBER, -1);
- int line2 = marker2.getAttribute(IMarker.LINE_NUMBER, -1);
- int result = line1 - line2;
- if (result == 0)
- return compare(marker1, marker2, depth + 1);
- return result * directions[column];
- }
- case CREATION_TIME: {
- long result;
- try {
- result = marker1.getCreationTime() - marker2.getCreationTime();
- }
- catch (CoreException e) {
- result = 0;
- }
- if (result == 0)
- return compare(marker1, marker2, depth + 1);
- return ((int) result) * directions[column];
- }
- }
-
- return 0;
- }
-
- public int compare(Viewer viewer, Object e1, Object e2) {
- IMarker marker1 = (IMarker) e1;
- IMarker marker2 = (IMarker) e2;
-
- return compare(marker1, marker2, 0);
- }
-
- public void saveState(IDialogSettings settings) {
- if (settings == null)
- return;
-
- for (int i = 0; i < priorities.length; i++) {
- settings.put("priority" + i, priorities[i]);//$NON-NLS-1$
- settings.put("direction" + i, directions[i]);//$NON-NLS-1$
- }
- }
-
- public void restoreState(IDialogSettings settings) {
- if (settings == null)
- return;
-
- try {
- for (int i = 0; i < priorities.length; i++) {
- priorities[i] = settings.getInt("priority" + i);//$NON-NLS-1$
- directions[i] = settings.getInt("direction" + i);//$NON-NLS-1$
- }
- }
- catch (NumberFormatException e) {
- resetState();
- }
- }
-}
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 441c09c..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/CopyBookmarkAction.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-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.StructuredViewer;
-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 one or more bookmark(s) to the clipboard.
- */
-class CopyBookmarkAction extends BookmarkAction {
-
- /**
- * 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);
- }
-
- /**
- * 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);
-
- setClipboard(markers, createBookmarkReport(markers));
- }
-
- /**
- * 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
- getView().getClipboard().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);
- }
- }
-
- private String createBookmarkReport(IMarker[] markers) {
- String report = ""; //$NON-NLS-1$
-
- //write header
- report += BookmarkMessages.getString("ColumnDescription.header") + '\t'; //$NON-NLS-1$
- report += BookmarkMessages.getString("ColumnResource.header") + '\t'; //$NON-NLS-1$
- report += BookmarkMessages.getString("ColumnFolder.header") + '\t'; //$NON-NLS-1$
- report += BookmarkMessages.getString("ColumnLocation.header"); //$NON-NLS-1$
- report += System.getProperty("line.separator"); //$NON-NLS-1$
-
- //write markers
- for (int i = 0; i < markers.length; i++) {
- report += MarkerUtil.getMessage(markers[i]) + '\t';
- report += MarkerUtil.getResourceName(markers[i]) + '\t';
- report += MarkerUtil.getContainerName(markers[i]) + '\t';
- int line = MarkerUtil.getLineNumber(markers[i]);
- report += BookmarkMessages.format("LineIndicator.text", new String[] {String.valueOf(line)});//$NON-NLS-1$
- report += System.getProperty("line.separator"); //$NON-NLS-1$
- }
-
- return report;
- }
-}
-
-
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/EditBookmarkAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/EditBookmarkAction.java
deleted file mode 100644
index 79fda07..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/EditBookmarkAction.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * Opens a properties dialog allowing the user to edit the bookmark's description.
- */
-class EditBookmarkAction extends BookmarkAction {
-
- protected EditBookmarkAction(BookmarkNavigator view) {
- super(view, BookmarkMessages.getString("Properties.text")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(this, IBookmarkHelpContextIds.BOOKMARK_PROPERTIES_ACTION);
- setEnabled(false);
- }
-
- private IMarker marker;
-
- public void run() {
- if (marker != null)
- editBookmark();
- }
-
- /**
- * Sets marker to the current selection if the selection is an instance of
- * <code>org.eclipse.core.resources.IMarker<code> and the selected marker's
- * resource is an instance of <code>org.eclipse.core.resources.IFile<code>.
- * Otherwise sets marker to null.
- */
- public void selectionChanged(IStructuredSelection selection) {
- marker = null;
- setEnabled(false);
-
- if (selection.size() != 1)
- return;
-
- Object o = selection.getFirstElement();
- if (!(o instanceof IMarker))
- return;
-
- IMarker selectedMarker = (IMarker) o;
- IResource resource = selectedMarker.getResource();
- if (resource instanceof IFile) {
- marker = selectedMarker;
- setEnabled(true);
- }
- }
-
- private void editBookmark() {
- IFile file = (IFile) marker.getResource();
-
- try {
- file.getWorkspace().run(
- new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- BookmarkPropertiesDialog dialog = new BookmarkPropertiesDialog(getView().getSite().getShell());
- dialog.setMarker(marker);
- dialog.open();
- }
- },
- null);
- } catch (CoreException e) {
- WorkbenchPlugin.log(null, e.getStatus()); // We don't care
- }
- }
-
-}
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 fd0f40f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/IBookmarkHelpContextIds.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-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>
- *
- */
-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 PASTE_BOOKMARK_ACTION = PREFIX + "paste_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$
- public static final String BOOKMARK_PROPERTIES_ACTION = PREFIX + "bookmark_properties_action_context"; //$NON-NLS-1$
- public static final String SORT_ASCENDING_ACTION = PREFIX + "bookmark_sort_ascending_action_context"; //$NON-NLS-1$
- public static final String SORT_DESCENDING_ACTION = PREFIX + "bookmark_sort_descending_action_context"; //$NON-NLS-1$
- public static final String SORT_DESCRIPTION_ACTION = PREFIX + "bookmark_sort_description_action_context"; //$NON-NLS-1$
- public static final String SORT_RESOURCE_ACTION = PREFIX + "bookmark_sort_resource_action_context"; //$NON-NLS-1$
- public static final String SORT_FOLDER_ACTION = PREFIX + "bookmark_sort_folder_action_context"; //$NON-NLS-1$
- public static final String SORT_LOCATION_ACTION = PREFIX + "bookmark_sort_location_action_context"; //$NON-NLS-1$
- public static final String SORT_CREATION_TIME_ACTION = PREFIX + "bookmark_sort_creation_time_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/MarkerUtil.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/MarkerUtil.java
deleted file mode 100644
index a53fe72..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/MarkerUtil.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-import java.text.DateFormat;
-import java.util.Date;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * Utility class for accessing marker attributes.
- */
-class MarkerUtil {
-
- /**
- * Don't allow instantiation.
- */
- private MarkerUtil() {
- }
- /**
- * Returns the ending character offset of the given marker.
- */
- static int getCharEnd(IMarker marker) {
- return marker.getAttribute(IMarker.CHAR_END, -1);
- }
- /**
- * Returns the starting character offset of the given marker.
- */
- static int getCharStart(IMarker marker) {
- return marker.getAttribute(IMarker.CHAR_START, -1);
- }
-
- /**
- * Returns the container name if it is defined, or empty string if not.
- */
- static String getContainerName(IMarker marker) {
- IPath path = marker.getResource().getFullPath();
- int n = path.segmentCount() - 1; // n is the number of segments in container, not path
- if (n <= 0)
- return ""; //$NON-NLS-1$
- int len = 0;
- for (int i = 0; i < n; ++i)
- len += path.segment(i).length();
- // account for /'s
- if (n > 1)
- len += n-1;
- StringBuffer sb = new StringBuffer(len);
- for (int i = 0; i < n; ++i) {
- if (i != 0)
- sb.append('/');
- sb.append(path.segment(i));
- }
- return sb.toString();
- }
-
- /**
- * Returns the line number of the given marker.
- */
- static int getLineNumber(IMarker marker) {
- return marker.getAttribute(IMarker.LINE_NUMBER, -1);
- }
- /**
- * Returns the text for the location field.
- */
- 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.
- */
- 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 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;
- }
-
- /**
- * Implements IProvider interface by supporting a number of
- * properties required for visual representation of markers
- * in the tasklist.
- */
-
- /**
- * Returns name if it is defined, or
- * blank string if not.
- */
- static String getResourceName(IMarker marker) {
- return marker.getResource().getName();
- }
-
- /**
- * Returns the creation time of the marker as a string.
- */
- static String getCreationTime(IMarker marker) {
- try {
- return DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM).format(new Date(marker.getCreationTime()));
- } catch (CoreException e) {
- return null;
- }
- }
-}
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 d8da818..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/OpenBookmarkAction.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-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;
-
-/**
- * Action to open an editor on the selected bookmarks.
- */
-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/PasteBookmarkAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/PasteBookmarkAction.java
deleted file mode 100644
index 9c8785f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/PasteBookmarkAction.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-import java.util.ArrayList;
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-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;
-
-/**
- * Pastes one or more bookmark(s) from the clipboard into the bookmark navigator.
- */
-class PasteBookmarkAction extends BookmarkAction {
-
- private BookmarkNavigator view;
-
- /**
- * The constructor.
- */
- public PasteBookmarkAction(BookmarkNavigator view) {
- super(view, BookmarkMessages.getString("PasteBookmark.text"));//$NON-NLS-1$
- this.view = view;
- WorkbenchHelp.setHelp(this, IBookmarkHelpContextIds.PASTE_BOOKMARK_ACTION);
- setEnabled(false);
- }
-
- /**
- * Copies the marker(s) from the clipboard to the bookmark navigator view.
- */
- public void run() {
- // Get the markers from the clipboard
- MarkerTransfer transfer = MarkerTransfer.getInstance();
- final IMarker[] markerData = (IMarker[]) view.getClipboard().getContents(transfer);
-
- if (markerData == null)
- return;
-
- final ArrayList newMarkers = new ArrayList();
-
- try {
- view.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.BOOKMARK))
- continue;
-
- // Paste to the same resource as the original
- IResource resource = markerData[i].getResource();
- Map attributes = markerData[i].getAttributes();
- IMarker marker = resource.createMarker(IMarker.BOOKMARK);
- marker.setAttributes(attributes);
- newMarkers.add(marker);
- }
- }
- }, null);
- } catch (CoreException e) {
- ErrorDialog.openError(
- view.getShell(),
- BookmarkMessages.getString("PasteBookmark.errorTitle"), //$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 bookmark navigator 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) {
- view.getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- view.getViewer().setSelection(new StructuredSelection(newMarkers));
- view.updatePasteEnablement();
- }
- });
- }
- }
-
-}
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 f72b31c..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/RemoveBookmarkAction.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Action to remove the selected bookmarks.
- */
-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 de5cecf..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/SelectAllAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.bookmarkexplorer;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Action to select all bookmarks.
- */
-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 Table) {
- ((Table) 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 62cd72f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/bookmarkexplorer/messages.properties
+++ /dev/null
@@ -1,69 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-
-# package: org.eclipse.ui.views.bookmarkexplorer
-
-
-# ==============================================================================
-# Bookmarks View
-# ==============================================================================
-BookmarkLabel.textHasContainer = {0} (on {1} in {2})
-BookmarkLabel.textNoContainer = {0} (on {1})
-
-CopyBookmark.text = &Copy
-
-PasteBookmark.text = &Paste
-PasteBookmark.errorTitle = Error pasting bookmark(s)
-
-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
-
-Properties.text = P&roperties
-
-ColumnIcon.text =
-ColumnDescription.text = by &Description
-ColumnResource.text = by &Resource
-ColumnFolder.text = by &Folder
-ColumnLocation.text = by &Location
-ColumnCreationTime.text = by &Creation Time
-
-LineIndicator.text = line {0}
-
-ColumnIcon.header =
-ColumnDescription.header = Description
-ColumnResource.header = Resource
-ColumnFolder.header = In Folder
-ColumnLocation.header = Location
-
-ColumnIcon.dialogText =
-ColumnDescription.dialogText = Description:
-ColumnResource.dialogText = Resource:
-ColumnFolder.dialogText = In Folder:
-ColumnLocation.dialogText = Location:
-
-SortMenuGroup.text = &Sort
-SortDirectionAscending.text = &Ascending
-SortDirectionDescending.text = D&escending
-
-PropertiesDialogTitle.text = Bookmark Properties
-NewBookmarkDialogTitle.text = New Bookmark
-
-MarkerCreationTime.text = &Creation Time:
-
-Error.text = &Error
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 f25ef32..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutline.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.contentoutline;
-
-import org.eclipse.swt.widgets.Composite;
-
-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.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.IContributedContentsView;
-import org.eclipse.ui.part.IPage;
-import org.eclipse.ui.part.IPageBookViewPage;
-import org.eclipse.ui.part.IPageSite;
-import org.eclipse.ui.part.MessagePage;
-import org.eclipse.ui.part.PageBook;
-import org.eclipse.ui.part.PageBookView;
-
-/**
- * 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 super.getAdapter(key);
-}
-/* (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);
-}
-}
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 fd6e845..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutlinePage.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.contentoutline;
-
-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.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
- final SelectionChangedEvent event = new SelectionChangedEvent(this, selection);
-
- // fire the event
- Object[] listeners = selectionChangedListeners.getListeners();
- for (int i = 0; i < listeners.length; ++i) {
- final ISelectionChangedListener l = (ISelectionChangedListener)listeners[i];
- Platform.run(new SafeRunnable() {
- public void run() {
- l.selectionChanged(event);
- }
- public void handleException(Throwable e) {
- super.handleException(e);
- //If and unexpected exception happens, remove it
- //to make sure the workbench keeps running.
- removeSelectionChangedListener(l);
- }
- });
- }
-}
-/* (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 04789db..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/IContentOutlinePage.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.contentoutline;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.ui.part.IPage;
-
-/**
- * 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 extends <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 bf8e69c..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/messages.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-
-# 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 0106b5c..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/BackAction.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.framelist;
-
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-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$
- ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
- setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_BACK_HOVER));
- setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_BACK));
- setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_BACK_DISABLED));
- 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));
- }
-
-}
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 66f74a3..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/ForwardAction.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.framelist;
-
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-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$
- ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
- setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_HOVER));
- setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD));
- setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_FORWARD_DISABLED));
- 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));
- }
-
-}
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 10ccf4d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/Frame.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.framelist;
-
-
-/**
- * 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;
- }
-}
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 d4a345d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameAction.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.framelist;
-
-
-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.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() {
- }
-
-}
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 cb9e2c6..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameList.java
+++ /dev/null
@@ -1,217 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.framelist;
-
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.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);
- }
-}
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 758a227..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/FrameListMessages.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.framelist;
-
-
-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;
- }
- }
-}
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 4256818..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/GoIntoAction.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.framelist;
-
-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);
- }
-}
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 a63ae24..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/IFrameListHelpContextIds.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.framelist;
-
-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 6292f3f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/IFrameSource.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.framelist;
-
-
-/**
- * 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);
-}
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 87433df..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/TreeFrame.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.framelist;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * Frame for tree viewers. This capture the viewer's input element, selection,
- * and expanded elements.
- */
-public class TreeFrame extends Frame {
- 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_FRAME_INPUT = "frameInput"; //$NON-NLS-1$
-
- 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;
- }
-
- /**
- * Restore IPersistableElements from the specified memento.
- *
- * @param memento memento to restore elements from
- * @return list of restored elements. May be empty.
- */
- private List restoreElements(IMemento memento) {
- IMemento[] elementMem = memento.getChildren(TAG_ELEMENT);
- List elements = new ArrayList(elementMem.length);
-
- for (int i = 0; i < elementMem.length; i++) {
- String factoryID = elementMem[i].getString(IWorkbenchConstants.TAG_FACTORY_ID);
- if (factoryID != null) {
- IElementFactory factory = WorkbenchPlugin.getDefault().getElementFactory(factoryID);
- if (factory != null)
- elements.add(factory.createElement(elementMem[i]));
- }
- }
- return elements;
- }
-
- /**
- * Restore the frame from the specified memento.
- *
- * @param memento memento to restore frame from
- */
- public void restoreState(IMemento memento) {
- IMemento childMem = memento.getChild(TAG_FRAME_INPUT);
-
- if (childMem == null)
- return;
-
- String factoryID = childMem.getString(IWorkbenchConstants.TAG_FACTORY_ID);
- IAdaptable frameInput = null;
- if (factoryID != null) {
- IElementFactory factory = WorkbenchPlugin.getDefault().getElementFactory(factoryID);
- if (factory != null)
- frameInput = factory.createElement(childMem);
- }
- if (frameInput != null) {
- input = frameInput;
- }
- IMemento expandedMem = memento.getChild(TAG_EXPANDED);
- if (expandedMem != null) {
- List elements = restoreElements(expandedMem);
- expandedElements = (Object[]) elements.toArray(new Object[elements.size()]);
- }
- else {
- expandedElements = new Object[0];
- }
- IMemento selectionMem = memento.getChild(TAG_SELECTION);
- if (selectionMem != null) {
- List elements = restoreElements(selectionMem);
- selection = new StructuredSelection(elements);
- }
- else {
- selection = StructuredSelection.EMPTY;
- }
- }
-
- /**
- * Save the specified elements to the given memento.
- * The elements have to be adaptable to IPersistableElement.
- *
- * @param elements elements to persist
- * @param memento memento to persist elements in
- */
- private void saveElements(Object[] elements, IMemento memento) {
- for (int i = 0; i < elements.length; i++) {
- if (elements[i] instanceof IAdaptable) {
- IPersistableElement persistable = (IPersistableElement) ((IAdaptable) elements[i]).getAdapter(IPersistableElement.class);
- if (persistable != null) {
- IMemento elementMem = memento.createChild(TAG_ELEMENT);
- elementMem.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable.getFactoryId());
- persistable.saveState(elementMem);
- }
- }
- }
- }
-
- /**
- * Save the frame state in the given memento.
- *
- * @param memento memento to persist the frame state in.
- */
- public void saveState(IMemento memento) {
- if (!(input instanceof IAdaptable))
- return;
-
- IPersistableElement persistable = (IPersistableElement) ((IAdaptable) input).getAdapter(IPersistableElement.class);
- if (persistable != null) {
- IMemento frameMemento = memento.createChild(TAG_FRAME_INPUT);
-
- frameMemento.putString(IWorkbenchConstants.TAG_FACTORY_ID, persistable.getFactoryId());
- persistable.saveState(frameMemento);
-
- if (expandedElements.length > 0) {
- IMemento expandedMem = memento.createChild(TAG_EXPANDED);
- saveElements(expandedElements, expandedMem);
- }
- // always IStructuredSelection since we only deal with tree viewers
- if (selection instanceof IStructuredSelection) {
- Object[] elements = ((IStructuredSelection) selection).toArray();
- if (elements.length > 0) {
- IMemento selectionMem = memento.createChild(TAG_SELECTION);
- saveElements(elements, selectionMem);
- }
- }
- }
- }
-
- /**
- * 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;
- }
-}
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 57a80f9..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/TreeViewerFrameSource.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.framelist;
-
-
-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());
- }
- }
-}
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 14c18b1..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/UpAction.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.framelist;
-
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.PlatformUI;
-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$
- ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
- setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_UP_HOVER));
- setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_UP));
- setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_UP_DISABLED));
- 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));
- }
-}
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 817c49f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/framelist/messages.properties
+++ /dev/null
@@ -1,31 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-
-# 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/markers/BookmarkView.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/BookmarkView.java
deleted file mode 100644
index bad48fe..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/BookmarkView.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.views.markers.internal.BookmarkFilter;
-import org.eclipse.ui.views.markers.internal.DialogBookmarkFilter;
-import org.eclipse.ui.views.markers.internal.FieldCreationTime;
-import org.eclipse.ui.views.markers.internal.FieldFolder;
-import org.eclipse.ui.views.markers.internal.FieldLineNumber;
-import org.eclipse.ui.views.markers.internal.FieldMessage;
-import org.eclipse.ui.views.markers.internal.FieldResource;
-import org.eclipse.ui.views.markers.internal.IField;
-import org.eclipse.ui.views.markers.internal.IFilter;
-import org.eclipse.ui.views.markers.internal.MarkerRegistry;
-import org.eclipse.ui.views.markers.internal.MarkerView;
-import org.eclipse.ui.views.markers.internal.Messages;
-
-public class BookmarkView extends MarkerView {
-
- private final static ColumnLayoutData[] DEFAULT_COLUMN_LAYOUTS = {
- new ColumnWeightData(200),
- new ColumnWeightData(75),
- new ColumnWeightData(150),
- new ColumnWeightData(60)
- };
-
- private final static IField[] HIDDEN_FIELDS = {
- new FieldCreationTime()
- };
-
- private final static String[] ROOT_TYPES = {
- IMarker.BOOKMARK
- };
-
- private final static String[] TABLE_COLUMN_PROPERTIES = {
- IMarker.MESSAGE,
- "", //$NON-NLS-1$
- "", //$NON-NLS-1$
- "" //$NON-NLS-1$
- };
-
- private final static String TAG_DIALOG_SECTION = "org.eclipse.ui.views.bookmark"; //$NON-NLS-1$
-
- private final static IField[] VISIBLE_FIELDS = {
- new FieldMessage(),
- new FieldResource(),
- new FieldFolder(),
- new FieldLineNumber()
- };
-
- private ICellModifier cellModifier = new ICellModifier() {
- public Object getValue(Object element, String property) {
- if (element instanceof IMarker && IMarker.MESSAGE.equals(property))
- return ((IMarker) element).getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
- else
- return null;
- }
-
- public boolean canModify(Object element, String property) {
- return true;
- }
-
- public void modify(Object element, String property, Object value) {
- if (element instanceof Item) {
- Item item = (Item) element;
- Object data = item.getData();
-
- if (data instanceof IMarker) {
- IMarker marker = (IMarker) data;
-
- try {
- if (!marker.getAttribute(property).equals(value)) {
- if (IMarker.MESSAGE.equals(property))
- marker.setAttribute(IMarker.MESSAGE, value);
-
- if (bookmarkFilter != null && !bookmarkFilter.select(marker))
- filtersChanged();
- }
- } catch (CoreException e) {
- ErrorDialog.openError(getSite().getShell(), Messages.getString("errorModifyingBookmark") , null, e.getStatus()); //$NON-NLS-1$
- }
- }
- }
- }
- };
-
- private CellEditorActionHandler cellEditorActionHandler;
- private BookmarkFilter bookmarkFilter;
- private MarkerRegistry markerRegistry;
-
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
-
- TableViewer tableViewer = getViewer();
- CellEditor cellEditors[] = new CellEditor[tableViewer.getTable().getColumnCount()];
- CellEditor descriptionCellEditor = new TextCellEditor(tableViewer.getTable());
- cellEditors[0] = descriptionCellEditor;
- tableViewer.setCellEditors(cellEditors);
- tableViewer.setCellModifier(cellModifier);
- tableViewer.setColumnProperties(TABLE_COLUMN_PROPERTIES);
-
- cellEditorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
- cellEditorActionHandler.addCellEditor(descriptionCellEditor);
- cellEditorActionHandler.setCopyAction(copyAction);
- cellEditorActionHandler.setPasteAction(pasteAction);
- cellEditorActionHandler.setDeleteAction(deleteAction);
- cellEditorActionHandler.setSelectAllAction(selectAllAction);
- }
-
- public void dispose() {
- if (cellEditorActionHandler != null)
- cellEditorActionHandler.dispose();
-
- super.dispose();
- }
-
- public void init(IViewSite viewSite, IMemento memento) throws PartInitException {
- super.init(viewSite, memento);
- bookmarkFilter = new BookmarkFilter();
- IDialogSettings dialogSettings = getDialogSettings();
-
- if (bookmarkFilter != null)
- bookmarkFilter.restoreState(dialogSettings);
-
- markerRegistry = new MarkerRegistry();
- markerRegistry.setType(IMarker.BOOKMARK);
- markerRegistry.setFilter(bookmarkFilter);
- markerRegistry.setInput((IResource) getViewerInput());
- }
-
- public void saveState(IMemento memento) {
- IDialogSettings dialogSettings = getDialogSettings();
-
- if (bookmarkFilter != null)
- bookmarkFilter.saveState(dialogSettings);
-
- super.saveState(memento);
- }
-
- protected ColumnLayoutData[] getDefaultColumnLayouts() {
- return DEFAULT_COLUMN_LAYOUTS;
- }
-
- protected IDialogSettings getDialogSettings() {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
- IDialogSettings settings = workbenchSettings.getSection(TAG_DIALOG_SECTION);
-
- if (settings == null)
- settings = workbenchSettings.addNewSection(TAG_DIALOG_SECTION);
-
- return settings;
- }
-
- protected IFilter getFilter() {
- return bookmarkFilter;
- }
-
- protected Dialog getFiltersDialog() {
- return new DialogBookmarkFilter(getSite().getShell(), bookmarkFilter);
- }
-
- protected IField[] getHiddenFields() {
- return HIDDEN_FIELDS;
- }
-
- protected MarkerRegistry getRegistry() {
- return markerRegistry;
- }
-
- protected String[] getRootTypes() {
- return ROOT_TYPES;
- }
-
- protected Object getViewerInput() {
- return ResourcesPlugin.getWorkspace().getRoot();
- }
-
- protected IField[] getVisibleFields() {
- return VISIBLE_FIELDS;
- }
-
- public IStructuredSelection getSelection() {
- // TODO: added because nick doesn't like public API inherited from internal classes
- return super.getSelection();
- }
-
- public void setSelection(IStructuredSelection structuredSelection, boolean reveal) {
- // TODO: added because nick doesn't like public API inherited from internal classes
- super.setSelection(structuredSelection, reveal);
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/MarkerViewUtil.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/MarkerViewUtil.java
deleted file mode 100644
index a7ab3fd..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/MarkerViewUtil.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-
-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.views.markers.internal.MarkerView;
-
-/**
- * Utility class for showing markers in the marker views.
- */
-public class MarkerViewUtil {
-
-/**
- * Returns the id of the view used to show markers of the
- * same type as the given marker.
- *
- * @param marker the marker
- * @return the view id or <code>null</code> if no appropriate view could be determined
- * @throws CoreException if an exception occurs testing the type of the marker
- */
-public static String getViewId(IMarker marker) throws CoreException {
- if (marker.isSubtypeOf(IMarker.TASK)) {
- return IPageLayout.ID_TASK_LIST;
- }
- else if (marker.isSubtypeOf(IMarker.PROBLEM)) {
- return IPageLayout.ID_PROBLEM_VIEW;
- }
- else if (marker.isSubtypeOf(IMarker.BOOKMARK)) {
- return IPageLayout.ID_BOOKMARKS;
- }
- return null;
-}
-
-/**
- * Shows the given marker in the appropriate view in the given page.
- * This must be called from the UI thread.
- *
- * @param page the workbench page in which to show the marker
- * @param marker the marker to show
- * @param showView <code>true</code> if the view should be shown first
- * <code>false</code> to only show the marker if the view is already showing
- * @return <code>true</code> if the marker was successfully shown,
- * <code>false</code> if not
- */
-public static boolean showMarker(IWorkbenchPage page, IMarker marker, boolean showView) {
- try {
- String viewId = getViewId(marker);
- if (viewId != null) {
- IViewPart view = showView ? page.showView(viewId) : page.findView(viewId);
- if (view instanceof MarkerView) {
- StructuredSelection selection = new StructuredSelection(marker);
- MarkerView markerView = (MarkerView) view;
- markerView.setSelection(selection, true);
- return markerView.getSelection().equals(selection);
- }
- }
- }
- catch (CoreException e) {
- // ignore
- }
- return false;
-}
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/ProblemView.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/ProblemView.java
deleted file mode 100644
index af90b0b..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/ProblemView.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.views.markers.internal.ActionProblemProperties;
-import org.eclipse.ui.views.markers.internal.ActionResolveMarker;
-import org.eclipse.ui.views.markers.internal.ActionShowOnBuild;
-import org.eclipse.ui.views.markers.internal.DialogProblemFilter;
-import org.eclipse.ui.views.markers.internal.FieldCreationTime;
-import org.eclipse.ui.views.markers.internal.FieldFolder;
-import org.eclipse.ui.views.markers.internal.FieldLineNumber;
-import org.eclipse.ui.views.markers.internal.FieldMessage;
-import org.eclipse.ui.views.markers.internal.FieldResource;
-import org.eclipse.ui.views.markers.internal.FieldSeverity;
-import org.eclipse.ui.views.markers.internal.IField;
-import org.eclipse.ui.views.markers.internal.IFilter;
-import org.eclipse.ui.views.markers.internal.MarkerRegistry;
-import org.eclipse.ui.views.markers.internal.MarkerView;
-import org.eclipse.ui.views.markers.internal.ProblemFilter;
-
-public class ProblemView extends MarkerView {
-
- private final static ColumnLayoutData[] DEFAULT_COLUMN_LAYOUTS = {
- new ColumnPixelData(19, false),
- new ColumnWeightData(200),
- new ColumnWeightData(75),
- new ColumnWeightData(150),
- new ColumnWeightData(60)
- };
-
- private final static IField[] HIDDEN_FIELDS = {
- new FieldCreationTime()
- };
-
- private final static String[] ROOT_TYPES = {
- IMarker.PROBLEM
- };
-
- private final static String TAG_DIALOG_SECTION = "org.eclipse.ui.views.problem"; //$NON-NLS-1$
-
- private final static IField[] VISIBLE_FIELDS = {
- new FieldSeverity(),
- new FieldMessage(),
- new FieldResource(),
- new FieldFolder(),
- new FieldLineNumber()
- };
-
- private MarkerRegistry markerRegistry;
- private ProblemFilter problemFilter;
- private ActionResolveMarker resolveMarkerAction;
-
- public void dispose() {
- if (resolveMarkerAction != null)
- resolveMarkerAction.dispose();
-
- super.dispose();
- }
-
- public void init(IViewSite viewSite, IMemento memento) throws PartInitException {
- super.init(viewSite, memento);
- problemFilter = new ProblemFilter();
- IDialogSettings dialogSettings = getDialogSettings();
-
- if (problemFilter != null)
- problemFilter.restoreState(dialogSettings);
-
- markerRegistry = new MarkerRegistry();
- markerRegistry.setType(IMarker.PROBLEM);
- markerRegistry.setFilter(problemFilter);
- markerRegistry.setInput((IResource) getViewerInput());
- }
-
- public void saveState(IMemento memento) {
- IDialogSettings dialogSettings = getDialogSettings();
-
- if (problemFilter != null)
- problemFilter.saveState(dialogSettings);
-
- super.saveState(memento);
- }
-
- protected ColumnLayoutData[] getDefaultColumnLayouts() {
- return DEFAULT_COLUMN_LAYOUTS;
- }
-
- protected IDialogSettings getDialogSettings() {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
- IDialogSettings settings = workbenchSettings.getSection(TAG_DIALOG_SECTION);
-
- if (settings == null)
- settings = workbenchSettings.addNewSection(TAG_DIALOG_SECTION);
-
- return settings;
- }
-
- protected void createActions() {
- super.createActions();
- propertiesAction = new ActionProblemProperties(this, getViewer());
- resolveMarkerAction = new ActionResolveMarker(this, getViewer());
- }
-
- protected void createColumns(Table table) {
- super.createColumns(table);
- TableColumn[] columns = table.getColumns();
-
- if (columns != null && columns.length >= 1)
- columns[0].setResizable(false);
- }
-
- protected void fillContextMenuAdditions(IMenuManager manager) {
- manager.add(new Separator());
- manager.add(resolveMarkerAction);
- }
-
- protected IFilter getFilter() {
- return problemFilter;
- }
-
- protected Dialog getFiltersDialog() {
- return new DialogProblemFilter(getSite().getShell(), problemFilter);
- }
-
- protected IField[] getHiddenFields() {
- return HIDDEN_FIELDS;
- }
-
- protected MarkerRegistry getRegistry() {
- return markerRegistry;
- }
-
- protected String[] getRootTypes() {
- return ROOT_TYPES;
- }
-
- protected Object getViewerInput() {
- return ResourcesPlugin.getWorkspace().getRoot();
- }
-
- protected IField[] getVisibleFields() {
- return VISIBLE_FIELDS;
- }
-
- protected void initMenu(IMenuManager menu ) {
- super.initMenu(menu);
- menu.add(new Separator());
- menu.add(new ActionShowOnBuild());
- }
-
- public IStructuredSelection getSelection() {
- // TODO: added because nick doesn't like public API inherited from internal classes
- return super.getSelection();
- }
-
- public void setSelection(IStructuredSelection structuredSelection, boolean reveal) {
- // TODO: added because nick doesn't like public API inherited from internal classes
- super.setSelection(structuredSelection, reveal);
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/TaskView.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/TaskView.java
deleted file mode 100644
index 565e509..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/TaskView.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.CheckboxCellEditor;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.views.markers.internal.ActionAddGlobalTask;
-import org.eclipse.ui.views.markers.internal.ActionDeleteCompleted;
-import org.eclipse.ui.views.markers.internal.ActionMarkCompleted;
-import org.eclipse.ui.views.markers.internal.ActionTaskProperties;
-import org.eclipse.ui.views.markers.internal.DialogTaskFilter;
-import org.eclipse.ui.views.markers.internal.FieldCreationTime;
-import org.eclipse.ui.views.markers.internal.FieldDone;
-import org.eclipse.ui.views.markers.internal.FieldFolder;
-import org.eclipse.ui.views.markers.internal.FieldLineNumber;
-import org.eclipse.ui.views.markers.internal.FieldMessage;
-import org.eclipse.ui.views.markers.internal.FieldPriority;
-import org.eclipse.ui.views.markers.internal.FieldResource;
-import org.eclipse.ui.views.markers.internal.IField;
-import org.eclipse.ui.views.markers.internal.IFilter;
-import org.eclipse.ui.views.markers.internal.MarkerRegistry;
-import org.eclipse.ui.views.markers.internal.MarkerView;
-import org.eclipse.ui.views.markers.internal.Messages;
-import org.eclipse.ui.views.markers.internal.TaskFilter;
-import org.eclipse.ui.views.markers.internal.Util;
-
-public class TaskView extends MarkerView {
-
- private final static ColumnLayoutData[] DEFAULT_COLUMN_LAYOUTS = {
- new ColumnPixelData(19, false),
- new ColumnPixelData(19, false),
- new ColumnWeightData(200),
- new ColumnWeightData(75),
- new ColumnWeightData(150),
- new ColumnWeightData(60)
- };
-
- private final static IField[] HIDDEN_FIELDS = {
- new FieldCreationTime()
- };
-
- private final static String[] ROOT_TYPES = {
- IMarker.TASK
- };
-
- private final static String[] TABLE_COLUMN_PROPERTIES = {
- FieldDone.COMPLETION,
- IMarker.PRIORITY,
- IMarker.MESSAGE,
- "", //$NON-NLS-1$
- "", //$NON-NLS-1$
- "" //$NON-NLS-1$
- };
-
- private final static String TAG_DIALOG_SECTION = "org.eclipse.ui.views.task"; //$NON-NLS-1$
-
- private final static IField[] VISIBLE_FIELDS = {
- new FieldDone(),
- new FieldPriority(),
- new FieldMessage(),
- new FieldResource(),
- new FieldFolder(),
- new FieldLineNumber()
- };
-
- private ICellModifier cellModifier = new ICellModifier() {
- public Object getValue(Object element, String property) {
- if (element instanceof IMarker) {
- IMarker marker = (IMarker) element;
-
- if (FieldDone.COMPLETION.equals(property))
- return new Boolean(marker.getAttribute(IMarker.DONE, false));
-
- if (IMarker.PRIORITY.equals(property))
- return new Integer(IMarker.PRIORITY_HIGH - marker.getAttribute(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL));
-
- if (IMarker.MESSAGE.equals(property))
- return marker.getAttribute(IMarker.MESSAGE, ""); //$NON-NLS-1$
- }
-
- return null;
- }
-
- public boolean canModify(Object element, String property) {
- return Util.isEditable((IMarker) element);
- }
-
- public void modify(Object element, String property, Object value) {
- if (element instanceof Item) {
- Item item = (Item) element;
- Object data = item.getData();
-
- if (data instanceof IMarker) {
- IMarker marker = (IMarker) data;
-
- try {
- if (!getValue(marker, property).equals(value)) {
- if (FieldDone.COMPLETION.equals(property))
- marker.setAttribute(IMarker.DONE, value);
- else if (IMarker.PRIORITY.equals(property))
- marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH - ((Integer) value).intValue());
- else if (IMarker.MESSAGE.equals(property))
- marker.setAttribute(IMarker.MESSAGE, value);
-
- if (taskFilter != null && !taskFilter.select(marker))
- filtersChanged();
- }
- } catch (CoreException e) {
- ErrorDialog.openError(getSite().getShell(), Messages.getString("errorModifyingTask") , null, e.getStatus()); //$NON-NLS-1$
- }
- }
- }
- }
- };
-
- private CellEditorActionHandler cellEditorActionHandler;
- private TaskFilter taskFilter;
- private MarkerRegistry markerRegistry;
- private ActionAddGlobalTask addGlobalTaskAction;
- private ActionDeleteCompleted deleteCompletedAction;
- private ActionMarkCompleted markCompletedAction;
-
- public void createPartControl(Composite parent) {
- super.createPartControl(parent);
-
- TableViewer tableViewer = getViewer();
- CellEditor cellEditors[] = new CellEditor[tableViewer.getTable().getColumnCount()];
- cellEditors[0] = new CheckboxCellEditor(tableViewer.getTable());
-
- String[] priorities = new String[] {
- Messages.getString("priority.high"), //$NON-NLS-1$
- Messages.getString("priority.normal"), //$NON-NLS-1$
- Messages.getString("priority.low") //$NON-NLS-1$
- };
-
- cellEditors[1] = new ComboBoxCellEditor(tableViewer.getTable(), priorities, SWT.READ_ONLY);
- CellEditor descriptionCellEditor = new TextCellEditor(tableViewer.getTable());
- cellEditors[2] = descriptionCellEditor;
- tableViewer.setCellEditors(cellEditors);
- tableViewer.setCellModifier(cellModifier);
- tableViewer.setColumnProperties(TABLE_COLUMN_PROPERTIES);
-
- cellEditorActionHandler = new CellEditorActionHandler(getViewSite().getActionBars());
- cellEditorActionHandler.addCellEditor(descriptionCellEditor);
- cellEditorActionHandler.setCopyAction(copyAction);
- cellEditorActionHandler.setPasteAction(pasteAction);
- cellEditorActionHandler.setDeleteAction(deleteAction);
- cellEditorActionHandler.setSelectAllAction(selectAllAction);
- }
-
- public void dispose() {
- if (cellEditorActionHandler != null)
- cellEditorActionHandler.dispose();
-
- if (markCompletedAction != null)
- markCompletedAction.dispose();
-
- super.dispose();
- }
-
- public void init(IViewSite viewSite, IMemento memento) throws PartInitException {
- super.init(viewSite, memento);
- taskFilter = new TaskFilter();
- IDialogSettings dialogSettings = getDialogSettings();
-
- if (taskFilter != null)
- taskFilter.restoreState(dialogSettings);
-
- markerRegistry = new MarkerRegistry();
- markerRegistry.setType(IMarker.TASK);
- markerRegistry.setFilter(taskFilter);
- markerRegistry.setInput((IResource) getViewerInput());
- }
-
- public void saveState(IMemento memento) {
- IDialogSettings dialogSettings = getDialogSettings();
-
- if (taskFilter != null)
- taskFilter.saveState(dialogSettings);
-
- super.saveState(memento);
- }
-
- protected ColumnLayoutData[] getDefaultColumnLayouts() {
- return DEFAULT_COLUMN_LAYOUTS;
- }
-
- protected IDialogSettings getDialogSettings() {
- AbstractUIPlugin plugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IDialogSettings workbenchSettings = plugin.getDialogSettings();
- IDialogSettings settings = workbenchSettings.getSection(TAG_DIALOG_SECTION);
-
- if (settings == null)
- settings = workbenchSettings.addNewSection(TAG_DIALOG_SECTION);
-
- return settings;
- }
-
- protected void createActions() {
- super.createActions();
- addGlobalTaskAction = new ActionAddGlobalTask(this);
- deleteCompletedAction = new ActionDeleteCompleted(this, getViewer(), getRegistry());
- markCompletedAction = new ActionMarkCompleted(getViewer());
- propertiesAction = new ActionTaskProperties(this, getViewer());
- }
-
- protected void createColumns(Table table) {
- super.createColumns(table);
- TableColumn[] columns = table.getColumns();
-
- if (columns != null && columns.length >= 1) {
- columns[0].setResizable(false);
-
- if (columns.length >= 2)
- columns[1].setResizable(false);
- }
- }
-
- protected void fillContextMenu(IMenuManager manager) {
- manager.add(addGlobalTaskAction);
- manager.add(new Separator());
- super.fillContextMenu(manager);
- }
-
- protected void fillContextMenuAdditions(IMenuManager manager) {
- manager.add(new Separator());
- manager.add(markCompletedAction);
- manager.add(deleteCompletedAction);
- }
-
- protected IFilter getFilter() {
- return taskFilter;
- }
-
- protected Dialog getFiltersDialog() {
- return new DialogTaskFilter(getSite().getShell(), taskFilter);
- }
-
- protected IField[] getHiddenFields() {
- return HIDDEN_FIELDS;
- }
-
- protected MarkerRegistry getRegistry() {
- return markerRegistry;
- }
-
- protected String[] getRootTypes() {
- return ROOT_TYPES;
- }
-
- protected Object getViewerInput() {
- return ResourcesPlugin.getWorkspace().getRoot();
- }
-
- protected IField[] getVisibleFields() {
- return VISIBLE_FIELDS;
- }
-
- protected void initToolBar(IToolBarManager toolBarManager) {
- toolBarManager.add(addGlobalTaskAction);
- super.initToolBar(toolBarManager);
- }
-
- public IStructuredSelection getSelection() {
- // TODO: added because nick doesn't like public API inherited from internal classes
- return super.getSelection();
- }
-
- public void setSelection(IStructuredSelection structuredSelection, boolean reveal) {
- // TODO: added because nick doesn't like public API inherited from internal classes
- super.setSelection(structuredSelection, reveal);
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionAddGlobalTask.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionAddGlobalTask.java
deleted file mode 100644
index 618d12e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionAddGlobalTask.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class ActionAddGlobalTask extends Action {
-
- private static final String ENABLED_IMAGE_PATH = "elcl16/addtsk_tsk.gif"; //$NON-NLS-1$
- private static final String HOVER_IMAGE_PATH = "clcl16/addtsk_tsk.gif"; //$NON-NLS-1$
-
- private IWorkbenchPart part;
-
- public ActionAddGlobalTask(IWorkbenchPart part) {
- setText(Messages.getString("addGlobalTaskAction.title")); //$NON-NLS-1$
- setImageDescriptor(ImageFactory.getImageDescriptor(ENABLED_IMAGE_PATH));
- setHoverImageDescriptor(ImageFactory.getImageDescriptor(HOVER_IMAGE_PATH));
- this.part = part;
- }
-
- public void run() {
- DialogTaskProperties dialog = new DialogTaskProperties(part.getSite().getShell(),
- Messages.getString("addGlobalTaskDialog.title")); //$NON-NLS-1$
- dialog.open();
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionCopyMarker.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionCopyMarker.java
deleted file mode 100644
index 23965ca..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionCopyMarker.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-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.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.SelectionProviderAction;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.part.MarkerTransfer;
-
-/**
- * Copies one or more marker to the clipboard.
- */
-public class ActionCopyMarker extends SelectionProviderAction {
-
- private IWorkbenchPart part;
- private Clipboard clipboard;
- private IField[] properties;
-
- /**
- * Creates the action.
- */
- public ActionCopyMarker(IWorkbenchPart part, ISelectionProvider provider) {
- super(provider, Messages.getString("copyAction.title")); //$NON-NLS-1$
- this.part = part;
- setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_COPY_HOVER));
- setEnabled(false);
- }
-
- /**
- * Sets the clipboard that the marker(s) will be copied to.
- * @param clipboard the clipboard
- */
- void setClipboard(Clipboard clipboard) {
- this.clipboard = clipboard;
- }
-
- /**
- * Sets the properties to be added to the plain-text marker report that
- * will be copied to the clipboard.
- * @param properties
- */
- void setProperties(IField[] properties) {
- this.properties = properties;
- }
-
- /**
- * Copies the selected IMarker objects to the clipboard. If properties have
- * been set, also copies a plain-text report of the selected markers to the
- * clipboard.
- */
- public void run() {
- IStructuredSelection selection = getStructuredSelection();
- if (selection == null || selection.isEmpty() || clipboard == null)
- return;
- List list = selection.toList();
- IMarker[] markers = new IMarker[list.size()];
- list.toArray(markers);
- setClipboard(markers, createMarkerReport(markers));
- }
-
- /**
- * Updates enablement based on the current selection
- */
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(selection != null && !selection.isEmpty());
- }
-
- private void setClipboard(IMarker[] markers, String markerReport) {
- try {
- // Place the markers on the clipboard
- Object[] data;
- Transfer[] transferTypes;
- if (markerReport == null) {
- data = new Object[] {markers};
- transferTypes = new Transfer[] {MarkerTransfer.getInstance()};
- }
- else {
- data = new Object[] {
- markers,
- markerReport};
- transferTypes = new Transfer[] {
- MarkerTransfer.getInstance(),
- TextTransfer.getInstance()};
- }
-
- clipboard.setContents(data, transferTypes);
- } catch (SWTError e){
- if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD)
- throw e;
- if (MessageDialog.openQuestion(part.getSite().getShell(), WorkbenchMessages.getString("CopyToClipboardProblemDialog.title"), WorkbenchMessages.getString("CopyToClipboardProblemDialog.message"))) //$NON-NLS-1$ //$NON-NLS-2$
- setClipboard(markers, markerReport);
- }
- }
-
- /**
- * Creates a plain-text report of the selected markers based on predefined properties.
- * @param markers
- * @return the marker report
- */
- String createMarkerReport(IMarker[] markers) {
- String report = ""; //$NON-NLS-1$
- final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
- final char DELIMITER = '\t';
-
-
- if (properties == null) {
- return null;
- }
-
- //create header
- for (int i = 0; i < properties.length; i++) {
- report += properties[i].getDescription();
- if (i == properties.length - 1)
- report += NEWLINE;
- else
- report += DELIMITER;
- }
-
- for (int i = 0; i < markers.length; i++) {
- IMarker marker = markers[i];
- for (int j = 0; j < properties.length; j++) {
- report += properties[j].getValue(marker);
- if (j == properties.length - 1)
- report += NEWLINE;
- else
- report += DELIMITER;
- }
- }
-
- return report;
- }
-}
-
-
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionDeleteCompleted.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionDeleteCompleted.java
deleted file mode 100644
index d0816d8..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionDeleteCompleted.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.SelectionProviderAction;
-
-public class ActionDeleteCompleted extends SelectionProviderAction {
-
- private MarkerRegistry registry;
- private IWorkbenchPart part;
-
- /**
- * @param provider
- * @param text
- */
- public ActionDeleteCompleted(IWorkbenchPart part, ISelectionProvider provider, MarkerRegistry registry) {
- super(provider, Messages.getString("deleteCompletedAction.title")); //$NON-NLS-1$
- this.part = part;
- this.registry = registry;
- setEnabled(false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- final List completed = getCompletedTasks();
- // Check if there is anything to do
- if (completed.size() == 0) {
- MessageDialog.openInformation(
- part.getSite().getShell(),
- Messages.getString("deleteCompletedTasks.dialogTitle"), //$NON-NLS-1$
- Messages.getString("deleteCompletedTasks.noneCompleted")); //$NON-NLS-1$
- return;
- }
- String message;
- if (completed.size() == 1) {
- message = Messages.getString("deleteCompletedTasks.permanentSingular"); //$NON-NLS-1$
- }
- else {
- message = Messages.format("deleteCompletedTasks.permanentPlural", //$NON-NLS-1$
- new Object[] { new Integer(completed.size()) } );
- }
- // Verify.
- if (!MessageDialog
- .openConfirm(
- part.getSite().getShell(),
- Messages.getString("deleteCompletedTasks.dialogTitle"), //$NON-NLS-1$
- message)) {
- return;
- }
- try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- for (int i = 0; i < completed.size(); i++) {
- IMarker marker = (IMarker) completed.get(i);
- try {
- marker.delete();
- }
- catch (CoreException e) {
- }
- }
- }
- }, null);
- }
- catch (CoreException e) {
- ErrorDialog.openError(part.getSite().getShell(), Messages.getString("deleteCompletedTasks.errorMessage"), null, e.getStatus()); //$NON-NLS-1$
- }
- }
-
- private List getCompletedTasks() {
- List completed = new ArrayList();
- Object[] markers = registry.getElements();
-
- for (int i = 0; i < markers.length; i++) {
- IMarker marker = (IMarker) markers[i];
- if (Util.isEditable(marker) && marker.getAttribute(IMarker.DONE, false)) {
- completed.add(marker);
- }
- }
-
- return completed;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(!selection.isEmpty());
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionMarkCompleted.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionMarkCompleted.java
deleted file mode 100644
index 00baa0c..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionMarkCompleted.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.actions.SelectionProviderAction;
-
-public class ActionMarkCompleted extends SelectionProviderAction {
-
- /**
- * @param provider
- * @param text
- */
- public ActionMarkCompleted(ISelectionProvider provider) {
- super(provider, Messages.getString("markCompletedAction.title")); //$NON-NLS-1$
- setEnabled(false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) {
- for (Iterator iterator = getStructuredSelection().iterator(); iterator.hasNext();) {
- Object obj = iterator.next();
- if (obj instanceof IMarker) {
- IMarker marker = (IMarker) obj;
- try {
- marker.setAttribute(IMarker.DONE, true);
- }
- catch (CoreException e) {
- }
- }
- }
- }
- }, null);
- }
- catch (CoreException e) {
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(false);
- if (selection == null || selection.isEmpty()) {
- return;
- }
- for (Iterator iterator = selection.iterator(); iterator.hasNext();) {
- Object obj = iterator.next();
- if (!(obj instanceof IMarker)) {
- return;
- }
- IMarker marker = (IMarker) obj;
- if (!marker.getAttribute(IMarker.USER_EDITABLE, true)) {
- return;
- }
- if (marker.getAttribute(IMarker.DONE, false)) {
- return;
- }
- }
- setEnabled(true);
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionMarkerProperties.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionMarkerProperties.java
deleted file mode 100644
index 093b791..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionMarkerProperties.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.SelectionProviderAction;
-
-public class ActionMarkerProperties extends SelectionProviderAction {
-
- private IWorkbenchPart part;
-
- /**
- * @param provider
- * @param text
- */
- public ActionMarkerProperties(IWorkbenchPart part, ISelectionProvider provider) {
- super(provider, Messages.getString("propertiesAction.title")); //$NON-NLS-1$
- setEnabled(false);
- this.part = part;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- if (!isEnabled()) {
- return;
- }
- Object obj = getStructuredSelection().getFirstElement();
- if (!(obj instanceof IMarker)) {
- return;
- }
- IMarker marker = (IMarker) obj;
- DialogMarkerProperties dialog = new DialogMarkerProperties(part.getSite().getShell());
- dialog.setMarker(marker);
- dialog.open();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(selection != null && selection.size() == 1);
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionOpenMarker.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionOpenMarker.java
deleted file mode 100644
index ad611f5..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionOpenMarker.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.util.OpenStrategy;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.actions.SelectionProviderAction;
-
-/**
- * Action to open an editor on the selected bookmarks.
- */
-public class ActionOpenMarker extends SelectionProviderAction {
-
- private final String HOVER_IMAGE_PATH = "clcl16/gotoobj_tsk.gif"; //$NON-NLS-1$
- private final String IMAGE_PATH = "elcl16/gotoobj_tsk.gif"; //$NON-NLS-1$
- private final String DISABLED_IMAGE_PATH = "dlcl16/gotoobj_tsk.gif"; //$NON-NLS-1$
-
- protected IWorkbenchPart part;
-
- public ActionOpenMarker(IWorkbenchPart part, ISelectionProvider provider) {
- super(provider, Messages.getString("openAction.title")); //$NON-NLS-1$
- this.part = part;
- setHoverImageDescriptor(ImageFactory.getImageDescriptor(HOVER_IMAGE_PATH));
- setImageDescriptor(ImageFactory.getImageDescriptor(IMAGE_PATH));
- setDisabledImageDescriptor(ImageFactory.getImageDescriptor(DISABLED_IMAGE_PATH));
- setEnabled(false);
- }
-
- public void run() {
- IStructuredSelection selection = getStructuredSelection();
- if (selection == null || selection.size() != 1)
- return;
-
- Object obj = selection.getFirstElement();
- if (!(obj instanceof IMarker))
- return;
-
- IMarker marker = (IMarker) obj;
- //optimization: if the active editor has the same input as the selected marker then
- //RevealMarkerAction would have been run and we only need to activate the editor
- IEditorPart editor = part.getSite().getPage().getActiveEditor();
- if (editor != null) {
- IEditorInput input = editor.getEditorInput();
- if (input instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput) input).getFile();
- if (marker.getResource().equals(file)) {
- part.getSite().getPage().activate(editor);
- }
- }
- }
-
- try {
- part.getSite().getPage().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(
- part.getSite().getShell(),
- Messages.getString("OpenMarker.errorTitle"), //$NON-NLS-1$
- e.getMessage(),
- nestedException.getStatus());
- } else {
- // Open a regular error dialog since there is no
- // extra information to display
- MessageDialog.openError(
- part.getSite().getShell(),
- Messages.getString("OpenMarker.errorTitle"), //$NON-NLS-1$
- e.getMessage());
- }
- }
- }
-
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(selection != null && selection.size() == 1);
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionPasteMarker.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionPasteMarker.java
deleted file mode 100644
index 1adb331..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionPasteMarker.java
+++ /dev/null
@@ -1,155 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.ArrayList;
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.SelectionProviderAction;
-import org.eclipse.ui.part.MarkerTransfer;
-
-/**
- * Pastes one or more bookmark(s) from the clipboard into the bookmark navigator.
- */
-public class ActionPasteMarker extends SelectionProviderAction {
-
- private IWorkbenchPart part;
- private Clipboard clipboard;
- private String[] pastableTypes;
-
- /**
- * Creates the action.
- */
- public ActionPasteMarker(IWorkbenchPart part, ISelectionProvider provider) {
- super(provider, Messages.getString("pasteAction.title")); //$NON-NLS-1$
- this.part = part;
- this.pastableTypes = new String[0];
- setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_HOVER));
- setEnabled(false);
- }
-
- void setClipboard(Clipboard clipboard) {
- this.clipboard = clipboard;
- }
-
- /**
- * Copies the marker(s) from the clipboard to the bookmark navigator view.
- */
- public void run() {
- // Get the markers from the clipboard
- MarkerTransfer transfer = MarkerTransfer.getInstance();
- IMarker[] markerData = (IMarker[]) clipboard.getContents(transfer);
- paste(markerData);
- }
-
- void paste(final IMarker[] markers) {
- if (markers == null)
- return;
-
- final ArrayList newMarkers = new ArrayList();
-
- try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (int i = 0; i < markers.length; i++) {
- String type = markers[i].getType();
- // Paste to the same resource as the original
- IResource resource = markers[i].getResource();
- Map attributes = markers[i].getAttributes();
- IMarker marker = resource.createMarker(type);
- marker.setAttributes(attributes);
- newMarkers.add(marker);
- }
- }
- }, null);
- } catch (CoreException e) {
- ErrorDialog.openError(
- part.getSite().getShell(),
- Messages.getString("PasteMarker.errorTitle"), //$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 marker view 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 (getSelectionProvider() != null && newMarkers.size() > 0) {
- part.getSite().getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- getSelectionProvider().setSelection(new StructuredSelection(newMarkers));
- }
- });
- }
- }
-
- void updateEnablement() {
- setEnabled(false);
- if (clipboard == null) {
- return;
- }
-
- // Paste if clipboard contains pastable markers
- MarkerTransfer transfer = MarkerTransfer.getInstance();
- IMarker[] markerData = (IMarker[]) clipboard.getContents(transfer);
- if (markerData == null || markerData.length < 1 || pastableTypes == null) {
- return;
- }
- for (int i = 0; i < markerData.length; i++) {
- try {
- IMarker marker = markerData[i];
- if (!marker.exists()) {
- break;
- }
- boolean pastable = false;
- for (int j = 0; j < pastableTypes.length; j++) {
- if (marker.isSubtypeOf((String) pastableTypes[j])) {
- pastable = true;
- break;
- }
- }
- if (!pastable) {
- return;
- }
- if (!Util.isEditable(marker)) {
- return;
- }
- }
- catch (CoreException e) {
- return;
- }
- }
- setEnabled(true);
- }
-
- /**
- * @param strings
- */
- void setPastableTypes(String[] strings) {
- pastableTypes = strings;
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionProblemProperties.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionProblemProperties.java
deleted file mode 100644
index 84bfc5d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionProblemProperties.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.SelectionProviderAction;
-
-public class ActionProblemProperties extends SelectionProviderAction {
-
- private IWorkbenchPart part;
-
- /**
- * @param provider
- * @param text
- */
- public ActionProblemProperties(IWorkbenchPart part, ISelectionProvider provider) {
- super(provider, Messages.getString("propertiesAction.title")); //$NON-NLS-1$
- setEnabled(false);
- this.part = part;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- if (!isEnabled()) {
- return;
- }
- Object obj = getStructuredSelection().getFirstElement();
- if (!(obj instanceof IMarker)) {
- return;
- }
- IMarker marker = (IMarker) obj;
- DialogMarkerProperties dialog = new DialogProblemProperties(part.getSite().getShell());
- dialog.setMarker(marker);
- dialog.open();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(selection != null && selection.size() == 1);
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionRemoveMarker.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionRemoveMarker.java
deleted file mode 100644
index a265638..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionRemoveMarker.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.SelectionProviderAction;
-
-/**
- * Action to remove the selected bookmarks.
- */
-public class ActionRemoveMarker extends SelectionProviderAction {
-
- private IWorkbenchPart part;
-
- /**
- * Creates the action.
- */
- public ActionRemoveMarker(IWorkbenchPart part, ISelectionProvider provider) {
- super(provider, Messages.getString("deleteAction.title")); //$NON-NLS-1$
- this.part = part;
- setHoverImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_HOVER));
- setImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
- setDisabledImageDescriptor(PlatformUI.getWorkbench().getSharedImages().getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
- setEnabled(false);
- }
-
- /**
- * Delete the marker selection.
- */
- public void run() {
- if (!isEnabled()) {
- return;
- }
- final IStructuredSelection selection = getStructuredSelection();
- if (selection.isEmpty()) {
- return;
- }
- try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor) throws CoreException {
- for (Iterator iter = selection.iterator(); iter.hasNext();) {
- Object o = iter.next();
- if (o instanceof IMarker) {
- IMarker marker = (IMarker) o;
- marker.delete();
- }
- }
- }
- }, null);
- }
- catch (CoreException e) {
- ErrorDialog.openError(part.getSite().getShell(), Messages.getString("RemoveMarker.errorTitle"), null, e.getStatus()); //$NON-NLS-1$
- }
- }
-
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(false);
- if (selection == null || selection.isEmpty()) {
- return;
- }
- for (Iterator iterator = selection.iterator(); iterator.hasNext();) {
- Object obj = iterator.next();
- if (!(obj instanceof IMarker)) {
- return;
- }
- IMarker marker = (IMarker) obj;
- if (!Util.isEditable(marker)) {
- return;
- }
- }
- setEnabled(true);
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionResolveMarker.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionResolveMarker.java
deleted file mode 100644
index 7513d73..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionResolveMarker.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IMarkerResolution;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.SelectionProviderAction;
-import org.eclipse.ui.dialogs.MarkerResolutionSelectionDialog;
-
-/**
- * This action displays a list of resolutions for the selected marker
- *
- * @since 2.0
- */
-public class ActionResolveMarker extends SelectionProviderAction {
-
- private IWorkbenchPart part;
-
- /**
- * @param provider
- * @param text
- */
- public ActionResolveMarker(IWorkbenchPart part, ISelectionProvider provider) {
- super(provider, Messages.getString("resolveMarkerAction.title")); //$NON-NLS-1$
- this.part = part;
- setEnabled(false);
- }
-
- /**
- * Displays a list of resolutions and performs the selection.
- */
- public void run() {
- if (!isEnabled()) {
- return;
- }
- IMarker marker = getMarker();
- if (marker == null) {
- return;
- }
- IMarkerResolution[] resolutions = getResolutions(marker);
- if (resolutions.length == 0) {
- MessageDialog.openInformation(
- part.getSite().getShell(),
- Messages.getString("resolveMarkerAction.dialogTitle"), //$NON-NLS-1$
- Messages.getString("resolveMarkerAction.noResolutionsLabel")); //$NON-NLS-1$
- return;
- }
- MarkerResolutionSelectionDialog d = new MarkerResolutionSelectionDialog(part.getSite().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 = part.getSite().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 = getStructuredSelection();
- // only enable for single selection
- if (selection.size() != 1)
- return null;
- return (IMarker) selection.getFirstElement();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(false);
- if (selection.size() != 1) {
- return;
- }
- IMarker marker = (IMarker) selection.getFirstElement();
- if (marker == null) {
- return;
- }
- IWorkbench workbench = part.getSite().getWorkbenchWindow().getWorkbench();
- setEnabled(workbench.getMarkerHelpRegistry().hasResolutions(marker));
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionRevealMarker.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionRevealMarker.java
deleted file mode 100644
index 7197dc9..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionRevealMarker.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.SelectionProviderAction;
-
-public class ActionRevealMarker extends SelectionProviderAction {
-
- protected IWorkbenchPart part;
-
- /**
- * @param provider
- * @param text
- */
- public ActionRevealMarker(IWorkbenchPart part, ISelectionProvider provider) {
- super(provider, ""); //$NON-NLS-1$
- this.part = part;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- IStructuredSelection selection = getStructuredSelection();
- Object obj = selection.getFirstElement();
- if (obj == null || !(obj instanceof IMarker))
- return;
-
- IMarker marker = (IMarker) obj;
- IEditorPart editor = part.getSite().getPage().getActiveEditor();
- if (editor == null)
- return;
- IEditorInput input = editor.getEditorInput();
- if (input instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput) input).getFile();
- if (marker.getResource().equals(file)) {
- try {
- part.getSite().getPage().openEditor(marker, false);
- }
- catch (CoreException e) {
- }
- }
- }
- }
-
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(selection != null && selection.size() == 1);
- if (isEnabled()) {
- run();
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionSelectAll.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionSelectAll.java
deleted file mode 100644
index 60777b7..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionSelectAll.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.actions.SelectionProviderAction;
-
-public class ActionSelectAll extends SelectionProviderAction {
-
- protected MarkerRegistry registry;
-
- /**
- * @param provider
- * @param text
- */
- public ActionSelectAll(ISelectionProvider provider, MarkerRegistry registry) {
- super(provider, Messages.getString("selectAllAction.title")); //$NON-NLS-1$
- this.registry = registry;
- setEnabled(true);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- StructuredSelection newSelection = new StructuredSelection(registry.getElements());
- super.getSelectionProvider().setSelection(newSelection);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(!selection.isEmpty());
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionShowOnBuild.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionShowOnBuild.java
deleted file mode 100644
index d53cfec..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionShowOnBuild.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.jface.preference.BooleanPropertyAction;
-import org.eclipse.ui.internal.IPreferenceConstants;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-public class ActionShowOnBuild extends BooleanPropertyAction {
-
- public ActionShowOnBuild() {
- super(Messages.getString("showAction.title"), WorkbenchPlugin.getDefault().getPreferenceStore(), IPreferenceConstants.SHOW_TASKS_ON_BUILD); //$NON-NLS-1$
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionTaskProperties.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionTaskProperties.java
deleted file mode 100644
index d7f3795..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ActionTaskProperties.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.SelectionProviderAction;
-
-public class ActionTaskProperties extends SelectionProviderAction {
-
- private IWorkbenchPart part;
-
- /**
- * @param provider
- * @param text
- */
- public ActionTaskProperties(IWorkbenchPart part, ISelectionProvider provider) {
- super(provider, Messages.getString("propertiesAction.title")); //$NON-NLS-1$
- setEnabled(false);
- this.part = part;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.action.Action#run()
- */
- public void run() {
- if (!isEnabled()) {
- return;
- }
- Object obj = getStructuredSelection().getFirstElement();
- if (!(obj instanceof IMarker)) {
- return;
- }
- IMarker marker = (IMarker) obj;
- DialogMarkerProperties dialog = new DialogTaskProperties(part.getSite().getShell());
- dialog.setMarker(marker);
- dialog.open();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.actions.SelectionProviderAction#selectionChanged(org.eclipse.jface.viewers.IStructuredSelection)
- */
- public void selectionChanged(IStructuredSelection selection) {
- setEnabled(selection != null && selection.size() == 1);
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/BookmarkFilter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/BookmarkFilter.java
deleted file mode 100644
index bba9aa2..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/BookmarkFilter.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.dialogs.IDialogSettings;
-
-public class BookmarkFilter extends MarkerFilter {
-
- private final static String TAG_CONTAINS = "contains"; //$NON-NLS-1$
- private final static String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
- private final static String TAG_DIALOG_SECTION = "filter"; //$NON-NLS-1$
-
- final static boolean DEFAULT_CONTAINS = true;
- final static String DEFAULT_DESCRIPTION = ""; //$NON-NLS-1$
-
- private boolean contains;
- private String description;
-
- public BookmarkFilter() {
- super(new String[] { IMarker.BOOKMARK });
- }
-
- public boolean select(Object item) {
- return isEnabled() ? super.select(item) && selectByDescription(item) : true;
- }
-
- private boolean selectByDescription(Object item) {
- if (!(item instanceof IMarker) || description == null || description.equals("")) //$NON-NLS-1$
- return true;
-
- IMarker marker = (IMarker) item;
- String markerDescription = marker.getAttribute(IMarker.MESSAGE, DEFAULT_DESCRIPTION); //$NON-NLS-1$
- int index = markerDescription.indexOf(description);
- return contains ? (index >= 0) : (index < 0);
- }
-
- boolean getContains() {
- return contains;
- }
-
- String getDescription() {
- return description;
- }
-
- void setContains(boolean contains) {
- this.contains = contains;
- }
-
- void setDescription(String description) {
- this.description = description;
- }
-
- void resetState() {
- super.resetState();
- contains = DEFAULT_CONTAINS;
- description = DEFAULT_DESCRIPTION;
- }
-
- public void restoreState(IDialogSettings dialogSettings) {
- super.restoreState(dialogSettings);
- IDialogSettings settings = dialogSettings.getSection(TAG_DIALOG_SECTION);
-
- if (settings != null) {
- String setting = settings.get(TAG_CONTAINS);
-
- if (setting != null)
- contains = Boolean.valueOf(setting).booleanValue();
-
- setting = settings.get(TAG_DESCRIPTION);
-
- if (setting != null)
- description = new String(setting);
- }
- }
-
- public void saveState(IDialogSettings dialogSettings) {
- super.saveState(dialogSettings);
-
- if (dialogSettings != null) {
- IDialogSettings settings = dialogSettings.getSection(TAG_DIALOG_SECTION);
-
- if (settings == null)
- settings = dialogSettings.addNewSection(TAG_DIALOG_SECTION);
-
- settings.put(TAG_CONTAINS, contains);
- settings.put(TAG_DESCRIPTION, description);
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DefaultMarkerResourceAdapter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DefaultMarkerResourceAdapter.java
deleted file mode 100644
index 3a0b26f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DefaultMarkerResourceAdapter.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.ui.views.tasklist.ITaskListResourceAdapter;
-
-/**
- * The DefaultMarkerResourceAdapter is the default
- * implementation of the IMarkerResourceAdapter used by the
- * MarkerView for resource adaption.
- */
-class DefaultMarkerResourceAdapter implements ITaskListResourceAdapter {
-
- private static ITaskListResourceAdapter singleton;
-
- /**
- * Constructor for DefaultMarkerResourceAdapter.
- */
- DefaultMarkerResourceAdapter() {
- super();
- }
-
- /**
- * Return the default instance used for MarkerView adapting.
- */
- static ITaskListResourceAdapter getDefault(){
- if(singleton == null)
- singleton = new DefaultMarkerResourceAdapter();
- return singleton;
- }
-
- /**
- * @see IMarkerResourceAdapter#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;
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogBookmarkFilter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogBookmarkFilter.java
deleted file mode 100644
index bf4a059..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogBookmarkFilter.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-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.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-
-public class DialogBookmarkFilter extends org.eclipse.ui.views.markers.internal.DialogMarkerFilter {
-
- private DescriptionGroup descriptionGroup;
-
- private class DescriptionGroup {
- private Label descriptionLabel;
- private Combo combo;
- private Text description;
- private String contains = Messages.getString("filtersDialog.contains"); //$NON-NLS-1$
- private String doesNotContain = Messages.getString("filtersDialog.doesNotContain"); //$NON-NLS-1$
- public DescriptionGroup(Composite parent) {
- descriptionLabel = new Label(parent, SWT.NONE);
- descriptionLabel.setFont(parent.getFont());
- descriptionLabel.setText(Messages.getString("filtersDialog.descriptionLabel")); //$NON-NLS-1$
-
- combo = new Combo(parent, SWT.READ_ONLY);
- combo.setFont(parent.getFont());
- combo.add(contains);
- combo.add(doesNotContain);
- combo.addSelectionListener(selectionListener);
- // Prevent Esc and Return from closing the dialog when the combo is active.
- combo.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
- e.doit = false;
- }
- }
- });
-
- description = new Text(parent, SWT.SINGLE | SWT.BORDER);
- description.setFont(parent.getFont());
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- description.setLayoutData(data);
- description.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- DialogBookmarkFilter.this.markDirty();
- }
- });
- }
- public boolean getContains() {
- return combo.getSelectionIndex() == combo.indexOf(contains);
- }
- public void setContains(boolean value) {
- if (value) {
- combo.select(combo.indexOf(contains));
- }
- else {
- combo.select(combo.indexOf(doesNotContain));
- }
- }
- public void setDescription(String text) {
- if (text == null) {
- description.setText(""); //$NON-NLS-1$
- }
- else {
- description.setText(text);
- }
- }
- public String getDescription() {
- return description.getText();
- }
- public void updateEnablement() {
- descriptionLabel.setEnabled(isFilterEnabled());
- combo.setEnabled(isFilterEnabled());
- description.setEnabled(isFilterEnabled());
- }
- }
-
- /**
- * @param parentShell
- * @param filter
- */
- public DialogBookmarkFilter(Shell parentShell, BookmarkFilter filter) {
- super(parentShell, filter);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#createAttributesArea(org.eclipse.swt.widgets.Composite)
- */
- protected void createAttributesArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(parent.getFont());
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout layout = new GridLayout(5, false);
- layout.verticalSpacing = 7;
- composite.setLayout(layout);
-
- descriptionGroup = new DescriptionGroup(composite);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#updateFilterFromUI(org.eclipse.ui.views.markerview.MarkerFilter)
- */
- protected void updateFilterFromUI() {
- BookmarkFilter filter = (BookmarkFilter) getFilter();
-
- filter.setContains(descriptionGroup.getContains());
- filter.setDescription(descriptionGroup.getDescription().trim());
-
- super.updateFilterFromUI();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#updateUIFromFilter(org.eclipse.ui.views.markerview.MarkerFilter)
- */
- protected void updateUIFromFilter() {
- BookmarkFilter filter = (BookmarkFilter) getFilter();
-
- descriptionGroup.setContains(filter.getContains());
- descriptionGroup.setDescription(filter.getDescription());
-
- super.updateUIFromFilter();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#updateEnabledState()
- */
- protected void updateEnabledState() {
- super.updateEnabledState();
- descriptionGroup.updateEnablement();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#resetPressed()
- */
- protected void resetPressed() {
- descriptionGroup.setContains(BookmarkFilter.DEFAULT_CONTAINS);
- descriptionGroup.setDescription(BookmarkFilter.DEFAULT_DESCRIPTION);
-
- super.resetPressed();
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogMarkerFilter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogMarkerFilter.java
deleted file mode 100644
index 327477c..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogMarkerFilter.java
+++ /dev/null
@@ -1,755 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-import org.eclipse.jface.window.Window;
-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.events.SelectionListener;
-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.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * Dialog which allows user to modify all settings of an org.eclipse.ui.views.MarkerFilter object.
- */
-class DialogMarkerFilter extends Dialog {
- /**
- * button IDs
- */
- static final int RESET_ID = IDialogConstants.CLIENT_ID;
- static final int SELECT_WORKING_SET_ID = IDialogConstants.CLIENT_ID + 1;
- static final int SELECT_ALL_ID = IDialogConstants.CLIENT_ID + 2;
- static final int DESELECT_ALL_ID = IDialogConstants.CLIENT_ID + 3;
-
- private class TypesLabelProvider extends LabelProvider implements ITableLabelProvider {
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- if (!(element instanceof MarkerType)) {
- return ""; //$NON-NLS-1$
- }
- MarkerType type = (MarkerType) element;
- if (columnIndex == 0) {
- return type.getLabel();
- }
- if (columnIndex == 1) {
- String superTypes = ""; //$NON-NLS-1$
- MarkerType[] supers = type.getSupertypes();
- for (int i = 0; i < supers.length; i++) {
- superTypes += supers[i].getLabel();
- if (i < supers.length - 1) {
- superTypes += "; "; //$NON-NLS-1$
- }
- }
- return superTypes;
- }
- return ""; //$NON-NLS-1$
- }
- }
-
- /**
- * Creates and manages a group of widgets for selecting a working
- * set marker 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, Messages.getString("filtersDialog.noWorkingSet")); //$NON-NLS-1$
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- button.setLayoutData(data);
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(parent.getFont());
- 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_WORKING_SET_ID, Messages.getString("filtersDialog.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) {
- markDirty();
- 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(Messages.format(
- "filtersDialog.workingSet", //$NON-NLS-1$
- new Object[] {workingSet.getName()}));
- }
- else {
- button.setText(Messages.getString("filtersDialog.noWorkingSet")); //$NON-NLS-1$
- }
- }
- void setEnabled(boolean enabled) {
- button.setEnabled(enabled);
- selectButton.setEnabled(enabled);
- }
- }
-
- private MarkerFilter filter;
-
- private CheckboxTableViewer typesViewer;
- private Button filterEnabledButton;
- private Button filterOnMarkerLimit;
- private Button anyResourceButton;
- private Button anyResourceInSameProjectButton;
- private Button selectedResourceButton;
- private Button selectedResourceAndChildrenButton;
- private Button selectAllButton;
- private Button deselectAllButton;
- private WorkingSetGroup workingSetGroup;
- private Text markerLimit;
-
- private boolean dirty = false;
-
- protected SelectionListener selectionListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- DialogMarkerFilter.this.widgetSelected(e);
- }
- };
-
- protected ICheckStateListener checkStateListener = new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- DialogMarkerFilter.this.checkStateChanged(event);
- }
- };
-
- /**
- * Creates a new filters dialog.
- */
- DialogMarkerFilter(Shell parentShell, MarkerFilter filter) {
- super(parentShell);
- this.filter = filter;
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void buttonPressed(int buttonId) {
- if (buttonId == RESET_ID) {
- resetPressed();
- markDirty();
- }
- else if (buttonId == SELECT_WORKING_SET_ID) {
- workingSetGroup.selectPressed();
- }
- else if (buttonId == SELECT_ALL_ID) {
- typesViewer.setAllChecked(true);
- }
- else if (buttonId == DESELECT_ALL_ID) {
- typesViewer.setAllChecked(false);
- }
- else {
- super.buttonPressed(buttonId);
- }
- }
-
- /**
- * This method is called when a button is checked or unchecked. It updates the enablement
- * state of all widgets and marks the dialog as dirty.
- */
- void checkStateChanged(CheckStateChangedEvent event) {
- updateEnabledState();
- markDirty();
- }
-
- /**
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(Messages.getString("filtersDialog.title")); //$NON-NLS-1$
- }
-
- protected void createResetArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(parent.getFont());
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
-
- Button reset = new Button(composite, SWT.PUSH);
- reset.setText(Messages.getString("restoreDefaults.text")); //$NON-NLS-1$
- reset.setData(new Integer(RESET_ID));
-
- reset.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- buttonPressed(((Integer) event.widget.getData()).intValue());
- }
- });
-
- reset.setFont(composite.getFont());
- setButtonLayoutData(reset);
- }
-
- /**
- * 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
- */
- protected 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);
- button.setFont(parent.getFont());
- 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
- */
- protected 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.setFont(parent.getFont());
- combo.setItems(items);
- combo.select(selectionIndex);
- combo.addSelectionListener(selectionListener);
- return combo;
- }
-
- /**
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- createOnOffArea(composite);
- createMarkerLimitArea(composite);
- createTypesArea(composite);
- createResourceArea(composite);
- createAttributesArea(composite);
- createResetArea(composite);
- createSeparatorLine(composite);
-
- updateUIFromFilter();
-
- return composite;
- }
-
- /**
- * Creates a separator line above the OK/Cancel buttons bar
- *
- * @param parent the parent composite
- */
- protected void createSeparatorLine(Composite parent) {
- // Build the separator line
- Label separator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 1;
- separator.setLayoutData(gd);
- }
-
- /**
- * 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
- */
- protected Button createRadioButton(Composite parent, String text) {
- Button button = new Button(parent, SWT.RADIO);
- button.setText(text);
- button.setFont(parent.getFont());
- button.addSelectionListener(selectionListener);
- return button;
- }
-
- /**
- * Creates the area showing which resources should be considered.
- *
- * @param parent the parent composite
- */
- protected void createResourceArea(Composite parent) {
- Composite group = new Composite(parent, SWT.NONE);
- group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- group.setLayout(new GridLayout());
- group.setFont(parent.getFont());
- anyResourceButton = createRadioButton(group, Messages.getString("filtersDialog.anyResource")); //$NON-NLS-1$
- anyResourceInSameProjectButton = createRadioButton(group, Messages.getString("filtersDialog.anyResourceInSameProject")); //$NON-NLS-1$ // added by cagatayk@acm.org
- selectedResourceButton = createRadioButton(group, Messages.getString("filtersDialog.selectedResource")); //$NON-NLS-1$
- selectedResourceAndChildrenButton = createRadioButton(group, Messages.getString("filtersDialog.selectedAndChildren")); //$NON-NLS-1$
- workingSetGroup = new WorkingSetGroup(group);
- }
-
- /**
- * Creates the area showing which marker types should be included.
- *
- * @param parent the parent composite
- */
- protected void createTypesArea(Composite parent) {
- Font font = parent.getFont();
- 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(Messages.getString("filtersDialog.showItemsOfType")); //$NON-NLS-1$
- label.setFont(font);
-
- Table table = new Table(composite, SWT.CHECK | SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION | SWT.BORDER);
- table.setLinesVisible(true);
- table.setHeaderVisible(true);
- TableLayout tableLayout = new TableLayout();
- table.setLayout(tableLayout);
- tableLayout.addColumnData(new ColumnPixelData(150, true));
- TableColumn tc = new TableColumn(table, SWT.NONE, 0);
- tc.setText(Messages.getString("filtersDialog.type.columnHeader")); //$NON-NLS-1$
- tableLayout.addColumnData(new ColumnPixelData(224, true));
- tc = new TableColumn(table, SWT.NONE, 1);
- tc.setText(Messages.getString("filtersDialog.superTypecolumnHeader")); //$NON-NLS-1$
- typesViewer = new CheckboxTableViewer(table);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.heightHint = 105;
- gridData.widthHint = 350;
- typesViewer.getTable().setFont(font);
- typesViewer.getControl().setLayoutData(gridData);
- typesViewer.setContentProvider(getContentProvider());
- typesViewer.setLabelProvider(getLabelProvider());
- typesViewer.setSorter(getSorter());
- typesViewer.addCheckStateListener(checkStateListener);
- typesViewer.setInput(filter.getRootTypes().toArray());
-
- Composite buttonComposite = new Composite(composite, SWT.NONE);
- GridLayout buttonLayout = new GridLayout();
- buttonLayout.marginWidth = 0;
- buttonComposite.setLayout(buttonLayout);
- selectAllButton = createButton(buttonComposite,
- SELECT_ALL_ID,
- Messages.getString("filtersDialog.selectAll"), //$NON-NLS-1$
- false);
- deselectAllButton = createButton(buttonComposite,
- DESELECT_ALL_ID,
- Messages.getString("filtersDialog.deselectAll"), //$NON-NLS-1$
- false);
- }
-
- private IStructuredContentProvider getContentProvider() {
- return new IStructuredContentProvider() {
- public Object[] getElements(Object inputElement) {
- List roots = filter.getRootTypes();
- List elements = new ArrayList();
- for (int i = 0; i < roots.size(); i++) {
- Object obj = roots.get(i);
- if (obj instanceof MarkerType) {
- elements.add(obj);
- MarkerType[] subTypes = ((MarkerType) obj).getAllSubTypes();
- for (int j = 0; j < subTypes.length; j++) {
- MarkerType subType = subTypes[j];
- if (!elements.contains(subType)) {
- elements.add(subType);
- }
- }
- }
- }
- return elements.toArray();
- }
- public void dispose() {
- }
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- };
- }
-
- /**
- * Creates the filter enablement area.
- *
- * @param parent the parent composite
- */
- protected void createOnOffArea(Composite parent) {
- Font font = parent.getFont();
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- composite.setFont(font);
- composite.setLayout(new GridLayout());
- filterEnabledButton = createCheckbox(composite,
- Messages.getString("filtersDialog.onOff"), //$NON-NLS-1$
- false);
- filterEnabledButton.setFont(composite.getFont());
- filterEnabledButton.setLayoutData(new GridData());
- filterEnabledButton.addSelectionListener(selectionListener);
- }
-
- /**
- * Creates the area where the user can specify a maximum number of items
- * to display in the table.
- *
- * @param parent the parent composite
- */
- protected void createMarkerLimitArea(Composite parent) {
- Font font = parent.getFont();
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- composite.setFont(font);
- GridLayout layout = new GridLayout();
- layout.numColumns = 2;
- composite.setLayout(layout);
- filterOnMarkerLimit = createCheckbox(composite,
- Messages.getString("filtersDialog.limitVisibleMarkersTo"), //$NON-NLS-1$
- false);
- filterOnMarkerLimit.setFont(composite.getFont());
- filterOnMarkerLimit.setLayoutData(new GridData());
- filterOnMarkerLimit.addSelectionListener(selectionListener);
- markerLimit = new Text(composite, SWT.SINGLE | SWT.BORDER);
- markerLimit.setTextLimit(6);
- GridData gridData = new GridData();
- gridData.widthHint = convertWidthInCharsToPixels(10);
- markerLimit.setLayoutData(gridData);
- markerLimit.setFont(font);
- markerLimit.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- markDirty();
- }
- });
- }
-
- /**
- * This method is intended to be overridden by subclasses of FiltersDialog. The
- * attributes area will be created just above the Restore Defaults button.
- *
- * @param parent the parent Composite
- */
- protected void createAttributesArea(Composite parent) {
- }
-
- private ILabelProvider getLabelProvider() {
- return new TypesLabelProvider();
- }
-
- /**
- * Returns the selected marker types.
- *
- * @return the selected marker types
- */
- protected List getSelectedTypes() {
- return Arrays.asList(typesViewer.getCheckedElements());
- }
-
- protected 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());
- }
- };
- }
-
- /**
- * 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();
- super.okPressed();
- }
- catch (NumberFormatException eNumberFormat) {
- MessageBox messageBox = new MessageBox(getShell(),
- SWT.OK | SWT.APPLICATION_MODAL | SWT.ICON_ERROR);
- messageBox.setText(Messages.getString(
- "filtersDialog.titleMarkerLimitInvalid")); //$NON-NLS-1$
- messageBox.setMessage(Messages.getString(
- "filtersDialog.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.
- */
- protected void resetPressed() {
- filterEnabledButton.setSelection(MarkerFilter.DEFAULT_ACTIVATION_STATUS);
- filterOnMarkerLimit.setSelection(MarkerFilter.DEFAULT_FILTER_ON_MARKER_LIMIT);
- markerLimit.setText(String.valueOf(MarkerFilter.DEFAULT_MARKER_LIMIT));
- typesViewer.setAllChecked(true);
- int onResource = MarkerFilter.DEFAULT_ON_RESOURCE;
- anyResourceButton.setSelection(onResource == MarkerFilter.ON_ANY_RESOURCE);
- anyResourceInSameProjectButton.setSelection(onResource == MarkerFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT);
- selectedResourceButton.setSelection(onResource == MarkerFilter.ON_SELECTED_RESOURCE_ONLY);
- selectedResourceAndChildrenButton.setSelection(onResource == MarkerFilter.ON_SELECTED_RESOURCE_AND_CHILDREN);
- workingSetGroup.setSelection(onResource == MarkerFilter.ON_WORKING_SET);
- updateEnabledState();
- }
-
- /**
- * Sets the selected marker types.
- *
- * @param markerTypes
- */
- void setSelectedTypes(List markerTypes) {
- typesViewer.setCheckedElements(new Object[0]);
- for (int i = 0; i < markerTypes.size(); i++) {
- Object obj = markerTypes.get(i);
- if (obj instanceof MarkerType) {
- typesViewer.setChecked(obj, true);
- }
- }
- }
-
- /**
- * Updates the enabled state of the widgetry.
- */
- protected void updateEnabledState() {
- filterOnMarkerLimit.setEnabled(isFilterEnabled());
- markerLimit.setEnabled(isFilterEnabled() && filterOnMarkerLimit.getSelection());
-
- typesViewer.getTable().setEnabled(isFilterEnabled());
- selectAllButton.setEnabled(isFilterEnabled() && typesViewer.getTable().getItemCount() > 0);
- deselectAllButton.setEnabled(isFilterEnabled() && typesViewer.getTable().getItemCount() > 0);
-
- anyResourceButton.setEnabled(isFilterEnabled());
- anyResourceInSameProjectButton.setEnabled(isFilterEnabled());
- selectedResourceButton.setEnabled(isFilterEnabled());
- selectedResourceAndChildrenButton.setEnabled(isFilterEnabled());
- workingSetGroup.setEnabled(isFilterEnabled());
- }
-
- /**
- * Updates the given filter from the UI state.
- *
- * @param filter the filter to update
- */
- protected void updateFilterFromUI() {
- filter.setEnabled(filterEnabledButton.getSelection());
-
- filter.setSelectedTypes(getSelectedTypes());
-
- if (selectedResourceButton.getSelection())
- filter.setOnResource(MarkerFilter.ON_SELECTED_RESOURCE_ONLY);
- else if (selectedResourceAndChildrenButton.getSelection())
- filter.setOnResource(MarkerFilter.ON_SELECTED_RESOURCE_AND_CHILDREN);
- else if (anyResourceInSameProjectButton.getSelection())
- filter.setOnResource(MarkerFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT);
- else if (workingSetGroup.getSelection())
- filter.setOnResource(MarkerFilter.ON_WORKING_SET);
- else
- filter.setOnResource(MarkerFilter.ON_ANY_RESOURCE);
-
- filter.setWorkingSet(workingSetGroup.getWorkingSet());
-
- int markerLimit = MarkerFilter.DEFAULT_MARKER_LIMIT;
-
- try {
- markerLimit = Integer.parseInt(this.markerLimit.getText());
- }
- catch (NumberFormatException e) {
- }
-
- filter.setMarkerLimit(markerLimit);
- filter.setFilterOnMarkerLimit(filterOnMarkerLimit.getSelection());
- }
-
- /**
- * Updates the UI state from the given filter.
- *
- * @param filter the filter to use
- */
- protected void updateUIFromFilter() {
- filterEnabledButton.setSelection(filter.isEnabled());
-
- setSelectedTypes(filter.getSelectedTypes());
-
- int on = filter.getOnResource();
- anyResourceButton.setSelection(on == MarkerFilter.ON_ANY_RESOURCE);
- anyResourceInSameProjectButton.setSelection(on == MarkerFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT);
- selectedResourceButton.setSelection(on == MarkerFilter.ON_SELECTED_RESOURCE_ONLY);
- selectedResourceAndChildrenButton.setSelection(on == MarkerFilter.ON_SELECTED_RESOURCE_AND_CHILDREN);
- workingSetGroup.setSelection(on == MarkerFilter.ON_WORKING_SET);
- workingSetGroup.setWorkingSet(filter.getWorkingSet());
-
- markerLimit.setText("" + filter.getMarkerLimit()); //$NON-NLS-1$
- filterOnMarkerLimit.setSelection(filter.getFilterOnMarkerLimit());
-
- updateEnabledState();
- }
-
- /**
- * Handles selection on a check box or combo box.
- */
- protected void widgetSelected(SelectionEvent e) {
- updateEnabledState();
- markDirty();
- }
-
- /**
- * @return <code>true</code> if the dirty flag has been set otherwise
- * <code>false</code>.
- */
- boolean isDirty() {
- return dirty;
- }
-
- /**
- * Marks the dialog as dirty.
- */
- void markDirty() {
- dirty = true;
- }
-
- /**
- * @return the MarkerFilter associated with the dialog.
- */
- protected MarkerFilter getFilter() {
- return filter;
- }
-
- /**
- * @return <code>true</code> if the filter's enablement button is checked
- * otherwise <code>false</code>.
- */
- protected boolean isFilterEnabled() {
- return (filterEnabledButton == null) || filterEnabledButton.getSelection();
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogMarkerProperties.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogMarkerProperties.java
deleted file mode 100644
index 69bed4c..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogMarkerProperties.java
+++ /dev/null
@@ -1,538 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRunnable;
-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.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.graphics.Font;
-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.Shell;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * Shows the properties of a new or existing marker
- */
-class DialogMarkerProperties extends Dialog {
-
- /**
- * The marker being shown, or <code>null</code> for a new marker
- */
- private IMarker marker = null;
-
- /**
- * The resource on which to create a new marker
- */
- private IResource resource = null;
-
- /**
- * The type of marker to be created
- */
- private String type = IMarker.MARKER;
-
- /**
- * The initial attributes to use when creating a new marker
- */
- private Map initialAttributes = null;
-
- /**
- * The text control for the Description field.
- */
- private Text descriptionText;
-
- /**
- * The control for the Creation Time field.
- */
- private Label creationTime;
-
- /**
- * 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;
-
- private String title;
-
- /**
- * Creates the dialog. By default this dialog creates a new marker.
- * To set the resource and initial attributes for the new marker,
- * use <code>setResource</code> and <code>setInitialAttributes</code>.
- * To show or modify an existing marker, use <code>setMarker</code>.
- *
- * @param shell the parent shell
- */
- DialogMarkerProperties(Shell parentShell) {
- super(parentShell);
- }
-
- /**
- * Creates the dialog. By default this dialog creates a new marker.
- * To set the resource and initial attributes for the new marker,
- * use <code>setResource</code> and <code>setInitialAttributes</code>.
- * To show or modify an existing marker, use <code>setMarker</code>.
- *
- * @param shell the parent shell
- * @param title the title of the dialog
- */
- DialogMarkerProperties(Shell parentShell, String title) {
- super(parentShell);
- this.title = title;
- }
-
- /**
- * @see org.eclipse.jface.window.Window#create()
- */
- public void create() {
- super.create();
- }
-
- /**
- * Sets the marker to show or modify.
- *
- * @param marker the marker, or <code>null</code> to create a new marker
- */
- void setMarker(IMarker marker) {
- this.marker = marker;
- if (marker != null) {
- try {
- type = marker.getType();
- }
- catch (CoreException e) {
- }
- }
- }
-
- /**
- * 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.
- */
- IMarker getMarker() {
- return marker;
- }
-
- /**
- * Sets the resource to use when creating a new marker.
- * If not set, the new marker is created on the workspace root.
- */
- public void setResource(IResource resource) {
- this.resource = resource;
- }
-
- /**
- * Returns the resource to use when creating a new marker,
- * or <code>null</code> if none has been set.
- * If not set, the new marker is created on the workspace root.
- */
- IResource getResource() {
- return resource;
- }
-
- /**
- * Sets initial attributes to use when creating a new marker.
- * If not set, the new marker is created with default attributes.
- */
- void setInitialAttributes(Map initialAttributes) {
- this.initialAttributes = initialAttributes;
- }
-
- /**
- * Returns the initial attributes to use when creating a new marker,
- * or <code>null</code> if not set.
- * If not set, the new marker is created with default attributes.
- */
- Map getInitialAttributes() {
- if (initialAttributes == null) {
- initialAttributes = new HashMap();
- }
- return initialAttributes;
- }
-
- /**
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- if (title == null)
- newShell.setText(
- Messages.getString("propertiesDialog.title")); //$NON-NLS-1$
- else
- newShell.setText(title);
- }
-
- /**
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- //initialize resources/properties
- if (marker != null) {
- resource = marker.getResource();
- try {
- initialAttributes = marker.getAttributes();
- }
- catch (CoreException e) {
- }
- }
- else if (resource == null) {
- resource = ResourcesPlugin.getWorkspace().getRoot();
- }
-
- Composite composite = (Composite) super.createDialogArea(parent);
- initializeDialogUnits(composite);
- createDescriptionArea(composite);
- if (marker != null) {
- createCreationTimeArea(composite);
- }
- createAttributesArea(composite);
- if (resource != null)
- createResourceArea(composite);
- updateDialogFromMarker();
- updateEnablement();
- return composite;
- }
- /**
- * Method createCreationTimeArea.
- * @param composite
- */
- private void createCreationTimeArea(Composite parent) {
- String creation = Messages.getString("propertiesDialog.creationTime.text");//$NON-NLS-1$
-
- Font font = parent.getFont();
- 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(creation);
- label.setFont(font);
-
- creationTime = new Label(composite, SWT.NONE);
- creationTime.setFont(font);
- }
-
- /**
- * Creates the OK and Cancel buttons.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(
- parent,
- IDialogConstants.OK_ID,
- IDialogConstants.OK_LABEL,
- true);
- createButton(
- parent,
- IDialogConstants.CANCEL_ID,
- IDialogConstants.CANCEL_LABEL,
- false);
- }
-
- /**
- * Creates the area for the Description field.
- */
- private void createDescriptionArea(Composite parent) {
- Font font = parent.getFont();
- 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(Messages.getString("propertiesDialog.description.text")); //$NON-NLS-1$
- label.setFont(font);
- int style = SWT.SINGLE | SWT.BORDER;
- descriptionText = new Text(composite, style);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = convertHorizontalDLUsToPixels(400);
- descriptionText.setLayoutData(gridData);
- descriptionText.setFont(font);
-
- descriptionText.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- markDirty();
- }
- });
- }
-
- /**
- * This method is intended to be overridden by subclasses. The attributes area is created between
- * the creation time area and the resource area.
- *
- * @param parent the parent composite
- */
- protected void createAttributesArea(Composite parent) {
- }
-
- /**
- * Creates the area for the Resource field.
- */
- private void createResourceArea(Composite parent) {
- Font font = parent.getFont();
- 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(Messages.getString("propertiesDialog.resource.text")); //$NON-NLS-1$
- resourceLabel.setFont(font);
- resourceText =
- new Text(
- composite,
- SWT.SINGLE | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- resourceText.setLayoutData(gridData);
- resourceText.setFont(font);
-
- Label folderLabel = new Label(composite, SWT.NONE);
- folderLabel.setText(Messages.getString("propertiesDialog.folder.text")); //$NON-NLS-1$
- folderLabel.setFont(font);
- folderText =
- new Text(
- composite,
- SWT.SINGLE | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- folderText.setLayoutData(gridData);
- folderText.setFont(font);
-
- Label locationLabel = new Label(composite, SWT.NONE);
- locationLabel.setText(Messages.getString("propertiesDialog.location.text")); //$NON-NLS-1$
- locationLabel.setFont(font);
- locationText =
- new Text(
- composite,
- SWT.SINGLE | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- locationText.setLayoutData(gridData);
- locationText.setFont(font);
- }
-
- /**
- * Updates the dialog from the marker state.
- */
- protected void updateDialogFromMarker() {
- if (marker == null) {
- updateDialogForNewMarker();
- return;
- }
- descriptionText.setText(Util.getProperty(IMarker.MESSAGE, marker));
- if (creationTime != null)
- creationTime.setText(Util.getCreationTime(marker));
- if (resourceText != null)
- resourceText.setText(Util.getResourceName(marker));
- if (folderText != null)
- folderText.setText(Util.getContainerName(marker));
- if (locationText != null) {
- String line = Util.getProperty(IMarker.LINE_NUMBER, marker);
- if (line.equals("")) //$NON-NLS-1$
- locationText.setText(""); //$NON-NLS-1$
- else
- locationText.setText(Messages.format("label.lineNumber", new String[] {line})); //$NON-NLS-1$
- }
-
- descriptionText.selectAll();
- }
-
- /**
- * Updates the dialog from the predefined attributes.
- */
- protected void updateDialogForNewMarker() {
- if (resource != null && resourceText != null && folderText != null) {
- resourceText.setText(resource.getName());
-
- IPath path = resource.getFullPath();
- int n = path.segmentCount() - 1; // n is the number of segments in container, not path
- if (n > 0) {
- int len = 0;
- for (int i = 0; i < n; ++i)
- len += path.segment(i).length();
- // account for /'s
- if (n > 1)
- len += n-1;
- StringBuffer sb = new StringBuffer(len);
- for (int i = 0; i < n; ++i) {
- if (i != 0)
- sb.append('/');
- sb.append(path.segment(i));
- }
- folderText.setText(sb.toString());
- }
- }
-
- if (initialAttributes != null) {
- Object description = initialAttributes.get(IMarker.MESSAGE);
- if (description != null && description instanceof String)
- descriptionText.setText((String) description);
- descriptionText.selectAll();
-
- Object line = initialAttributes.get(IMarker.LINE_NUMBER);
- if (line != null && line instanceof Integer && locationText != null)
- locationText.setText(Messages.format("label.lineNumber", new Object[] {line})); //$NON-NLS-1$
- }
- }
-
- /**
- * Method declared on Dialog
- */
- protected void okPressed() {
- if (marker == null || Util.isEditable(marker)) {
- saveChanges();
- }
- super.okPressed();
- }
-
- /**
- * Sets the dialog's dirty flag to <code>true</code>
- */
- protected void markDirty() {
- dirty = true;
- }
-
- /**
- * @return
- * <ul>
- * <li><code>true</code> if the dirty flag has been set to true.</li>
- * <li><code>false</code> otherwise.</li>
- * </ul>
- */
- protected boolean isDirty() {
- return dirty;
- }
-
- /**
- * Saves the changes made in the dialog if needed.
- * Creates a new marker if needed.
- * Updates the existing marker only if there have been changes.
- */
- private void saveChanges() {
- try {
- ResourcesPlugin.getWorkspace().run(new IWorkspaceRunnable() {
- public void run(IProgressMonitor monitor)
- throws CoreException {
- if (marker == null)
- createMarker();
- if (isDirty())
- updateMarker();
- }
- }, null);
- } catch (CoreException e) {
- ErrorDialog.openError(getShell(), Messages.getString("Error"), null, e.getStatus()); //$NON-NLS-1$
- return;
- }
- }
-
- /**
- * Creates or updates the marker. Must be called within a workspace runnable.
- */
- private void updateMarker() throws CoreException {
- // 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 = getMarkerAttributes();
- 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.
- */
- protected Map getMarkerAttributes() {
- Map attrs;
- if (initialAttributes == null) {
- attrs = initialAttributes;
- }
- else {
- attrs = new HashMap();
- }
- attrs.put(IMarker.MESSAGE, descriptionText.getText());
- return attrs;
- }
-
- private void createMarker() {
- if (resource == null) {
- return;
- }
-
- try {
- marker = resource.createMarker(type);
- }
- catch (CoreException e) {
- }
- }
-
- /**
- * Updates widget enablement for the dialog. Should be overridden by subclasses.
- */
- protected void updateEnablement() {
- descriptionText.setEditable(isEditable());
- }
-
- /**
- * @return
- * <ul>
- * <li><code>true</code> if the marker is editable or the dialog is creating a new marker.</li>
- * <li><code>false</code> if the marker is not editable.</li>
- * </ul>
- */
- protected boolean isEditable() {
- if (marker == null) {
- return true;
- }
- return Util.isEditable(marker);
- }
-
- /**
- * Sets the marker type when creating a new marker.
- *
- * @param type the marker type
- */
- void setType(String type) {
- this.type = type;
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogProblemFilter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogProblemFilter.java
deleted file mode 100644
index f6f62cb..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogProblemFilter.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-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.events.SelectionListener;
-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.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-
-public class DialogProblemFilter extends org.eclipse.ui.views.markers.internal.DialogMarkerFilter {
-
- private DescriptionGroup descriptionGroup;
- private SeverityGroup severityGroup;
-
- private class DescriptionGroup {
- private Label descriptionLabel;
- private Combo combo;
- private Text description;
- private String contains = Messages.getString("filtersDialog.contains"); //$NON-NLS-1$
- private String doesNotContain = Messages.getString("filtersDialog.doesNotContain"); //$NON-NLS-1$
- public DescriptionGroup(Composite parent) {
- descriptionLabel = new Label(parent, SWT.NONE);
- descriptionLabel.setFont(parent.getFont());
- descriptionLabel.setText(Messages.getString("filtersDialog.descriptionLabel")); //$NON-NLS-1$
-
- combo = new Combo(parent, SWT.READ_ONLY);
- combo.setFont(parent.getFont());
- combo.add(contains);
- combo.add(doesNotContain);
- combo.addSelectionListener(selectionListener);
- // Prevent Esc and Return from closing the dialog when the combo is active.
- combo.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
- e.doit = false;
- }
- }
- });
-
- description = new Text(parent, SWT.SINGLE | SWT.BORDER);
- description.setFont(parent.getFont());
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- description.setLayoutData(data);
- description.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- DialogProblemFilter.this.markDirty();
- }
- });
- }
- public boolean getContains() {
- return combo.getSelectionIndex() == combo.indexOf(contains);
- }
- public void setContains(boolean value) {
- if (value) {
- combo.select(combo.indexOf(contains));
- }
- else {
- combo.select(combo.indexOf(doesNotContain));
- }
- }
- public void setDescription(String text) {
- if (text == null) {
- description.setText(""); //$NON-NLS-1$
- }
- else {
- description.setText(text);
- }
- }
- public String getDescription() {
- return description.getText();
- }
- public void updateEnablement() {
- descriptionLabel.setEnabled(isFilterEnabled());
- combo.setEnabled(isFilterEnabled());
- description.setEnabled(isFilterEnabled());
- }
- }
-
- private class SeverityGroup {
- private Button enablementButton;
- private Button errorButton;
- private Button warningButton;
- private Button infoButton;
- public SeverityGroup(Composite parent) {
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEnablement();
- DialogProblemFilter.this.markDirty();
- }
- };
-
- enablementButton = new Button(parent, SWT.CHECK);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- enablementButton.setLayoutData(data);
- enablementButton.setFont(parent.getFont());
- enablementButton.setText(Messages.getString("filtersDialog.severityLabel")); //$NON-NLS-1$
- enablementButton.addSelectionListener(listener);
-
- errorButton = new Button(parent, SWT.CHECK);
- errorButton.setFont(parent.getFont());
- errorButton.setText(Messages.getString("filtersDialog.severityError")); //$NON-NLS-1$
- errorButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- errorButton.addSelectionListener(selectionListener);
-
- warningButton = new Button(parent, SWT.CHECK);
- warningButton.setFont(parent.getFont());
- warningButton.setText(Messages.getString("filtersDialog.severityWarning")); //$NON-NLS-1$
- warningButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- warningButton.addSelectionListener(selectionListener);
-
- infoButton = new Button(parent, SWT.CHECK);
- infoButton.setFont(parent.getFont());
- infoButton.setText(Messages.getString("filtersDialog.severityInfo")); //$NON-NLS-1$
- infoButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- infoButton.addSelectionListener(selectionListener);
- }
- public boolean isEnabled() {
- return enablementButton.getSelection();
- }
- public void setEnabled(boolean enabled) {
- enablementButton.setSelection(enabled);
- }
- public boolean isErrorSelected() {
- return errorButton.getSelection();
- }
- public void setErrorSelected(boolean selected) {
- errorButton.setSelection(selected);
- }
- public boolean isWarningSelected() {
- return warningButton.getSelection();
- }
- public void setWarningSelected(boolean selected) {
- warningButton.setSelection(selected);
- }
- public boolean isInfoSelected() {
- return infoButton.getSelection();
- }
- public void setInfoSelected(boolean selected) {
- infoButton.setSelection(selected);
- }
- public void updateEnablement() {
- enablementButton.setEnabled(isFilterEnabled());
- errorButton.setEnabled(enablementButton.isEnabled() && isEnabled());
- warningButton.setEnabled(enablementButton.isEnabled() && isEnabled());
- infoButton.setEnabled(enablementButton.isEnabled() && isEnabled());
- }
- }
-
- /**
- * @param parentShell
- * @param filter
- */
- public DialogProblemFilter(Shell parentShell, ProblemFilter filter) {
- super(parentShell, filter);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#createAttributesArea(org.eclipse.swt.widgets.Composite)
- */
- protected void createAttributesArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(parent.getFont());
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout layout = new GridLayout(5, false);
- layout.verticalSpacing = 7;
- composite.setLayout(layout);
-
- descriptionGroup = new DescriptionGroup(composite);
- severityGroup = new SeverityGroup(composite);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#updateFilterFromUI(org.eclipse.ui.views.markerview.MarkerFilter)
- */
- protected void updateFilterFromUI() {
- ProblemFilter filter = (ProblemFilter) getFilter();
-
- filter.setContains(descriptionGroup.getContains());
- filter.setDescription(descriptionGroup.getDescription().trim());
-
- filter.setSelectBySeverity(severityGroup.isEnabled());
- int severity = 0;
- if (severityGroup.isErrorSelected()) {
- severity = severity | ProblemFilter.SEVERITY_ERROR;
- }
- if (severityGroup.isWarningSelected()) {
- severity = severity | ProblemFilter.SEVERITY_WARNING;
- }
- if (severityGroup.isInfoSelected()) {
- severity = severity | ProblemFilter.SEVERITY_INFO;
- }
- filter.setSeverity(severity);
-
- super.updateFilterFromUI();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#updateUIFromFilter(org.eclipse.ui.views.markerview.MarkerFilter)
- */
- protected void updateUIFromFilter() {
- ProblemFilter filter = (ProblemFilter) getFilter();
-
- descriptionGroup.setContains(filter.getContains());
- descriptionGroup.setDescription(filter.getDescription());
-
- severityGroup.setEnabled(filter.getSelectBySeverity());
- int severity = filter.getSeverity();
- severityGroup.setErrorSelected((severity & ProblemFilter.SEVERITY_ERROR) > 0);
- severityGroup.setWarningSelected((severity & ProblemFilter.SEVERITY_WARNING) > 0);
- severityGroup.setInfoSelected((severity & ProblemFilter.SEVERITY_INFO) > 0);
-
- super.updateUIFromFilter();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#updateEnabledState()
- */
- protected void updateEnabledState() {
- super.updateEnabledState();
- descriptionGroup.updateEnablement();
- severityGroup.updateEnablement();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#resetPressed()
- */
- protected void resetPressed() {
- descriptionGroup.setContains(ProblemFilter.DEFAULT_CONTAINS);
- descriptionGroup.setDescription(ProblemFilter.DEFAULT_DESCRIPTION);
-
- severityGroup.setEnabled(ProblemFilter.DEFAULT_SELECT_BY_SEVERITY);
- severityGroup.setErrorSelected((ProblemFilter.DEFAULT_SEVERITY & ProblemFilter.SEVERITY_ERROR) > 0);
- severityGroup.setWarningSelected((ProblemFilter.DEFAULT_SEVERITY & ProblemFilter.SEVERITY_WARNING) > 0);
- severityGroup.setInfoSelected((ProblemFilter.DEFAULT_SEVERITY & ProblemFilter.SEVERITY_INFO) > 0);
-
- super.resetPressed();
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogProblemProperties.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogProblemProperties.java
deleted file mode 100644
index 1dcf7f4..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogProblemProperties.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-
-class DialogProblemProperties extends DialogMarkerProperties {
-
- private Label severityLabel;
-
- DialogProblemProperties(Shell parentShell) {
- super(parentShell);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.MarkerPropertiesDialog#createAttributesArea(org.eclipse.swt.widgets.Composite)
- */
- protected void createAttributesArea(Composite parent) {
- super.createAttributesArea(parent);
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(parent.getFont());
- composite.setLayout(new GridLayout());
-
- severityLabel = new Label(composite, SWT.NONE);
- severityLabel.setFont(composite.getFont());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.MarkerPropertiesDialog#updateDialogFromMarker()
- */
- protected void updateDialogFromMarker() {
- super.updateDialogFromMarker();
- IMarker marker = getMarker();
- if (marker == null) {
- return;
- }
- //TODO display image rather than text
- FieldSeverity type = new FieldSeverity();
- severityLabel.setImage(type.getImage(marker));
- int severity = marker.getAttribute(IMarker.SEVERITY, -1);
- if (severity == IMarker.SEVERITY_ERROR) {
- severityLabel.setText(Messages.format("propertiesDialog.severityLabel", //$NON-NLS-1$
- new String[] {Messages.getString("propertiesDialog.errorLabel")})); //$NON-NLS-1$
- }
- else if (severity == IMarker.SEVERITY_WARNING) {
- severityLabel.setText(Messages.format("propertiesDialog.severityLabel", //$NON-NLS-1$
- new String[] {Messages.getString("propertiesDialog.warningLabel")})); //$NON-NLS-1$
- }
- else if (severity == IMarker.SEVERITY_INFO) {
- severityLabel.setText(Messages.format("propertiesDialog.severityLabel", //$NON-NLS-1$
- new String[] {Messages.getString("propertiesDialog.infoLabel")})); //$NON-NLS-1$
- }
- else {
- severityLabel.setText(Messages.format("propertiesDialog.severityLabel", //$NON-NLS-1$
- new String[] {Messages.getString("propertiesDialog.noseverityLabel")})); //$NON-NLS-1$
- }
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogTaskFilter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogTaskFilter.java
deleted file mode 100644
index 020961e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogTaskFilter.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-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.events.SelectionListener;
-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.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-
-public class DialogTaskFilter extends org.eclipse.ui.views.markers.internal.DialogMarkerFilter {
-
- private DescriptionGroup descriptionGroup;
- private PriorityGroup priorityGroup;
- private StatusGroup statusGroup;
-
- private class DescriptionGroup {
- private Label descriptionLabel;
- private Combo combo;
- private Text description;
- private String contains = Messages.getString("filtersDialog.contains"); //$NON-NLS-1$
- private String doesNotContain = Messages.getString("filtersDialog.doesNotContain"); //$NON-NLS-1$
- public DescriptionGroup(Composite parent) {
- descriptionLabel = new Label(parent, SWT.NONE);
- descriptionLabel.setFont(parent.getFont());
- descriptionLabel.setText(Messages.getString("filtersDialog.descriptionLabel")); //$NON-NLS-1$
-
- combo = new Combo(parent, SWT.READ_ONLY);
- combo.setFont(parent.getFont());
- combo.add(contains);
- combo.add(doesNotContain);
- combo.addSelectionListener(selectionListener);
- // Prevent Esc and Return from closing the dialog when the combo is active.
- combo.addTraverseListener(new TraverseListener() {
- public void keyTraversed(TraverseEvent e) {
- if (e.detail == SWT.TRAVERSE_ESCAPE || e.detail == SWT.TRAVERSE_RETURN) {
- e.doit = false;
- }
- }
- });
-
- description = new Text(parent, SWT.SINGLE | SWT.BORDER);
- description.setFont(parent.getFont());
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- description.setLayoutData(data);
- description.addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- DialogTaskFilter.this.markDirty();
- }
- });
- }
- public boolean getContains() {
- return combo.getSelectionIndex() == combo.indexOf(contains);
- }
- public void setContains(boolean value) {
- if (value) {
- combo.select(combo.indexOf(contains));
- }
- else {
- combo.select(combo.indexOf(doesNotContain));
- }
- }
- public void setDescription(String text) {
- if (text == null) {
- description.setText(""); //$NON-NLS-1$
- }
- else {
- description.setText(text);
- }
- }
- public String getDescription() {
- return description.getText();
- }
- public void updateEnablement() {
- descriptionLabel.setEnabled(isFilterEnabled());
- combo.setEnabled(isFilterEnabled());
- description.setEnabled(isFilterEnabled());
- }
- }
-
- private class PriorityGroup {
- private Button enablementButton;
- private Button highButton;
- private Button normalButton;
- private Button lowButton;
- public PriorityGroup(Composite parent) {
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEnablement();
- DialogTaskFilter.this.markDirty();
- }
- };
-
- enablementButton = new Button(parent, SWT.CHECK);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- enablementButton.setLayoutData(data);
- enablementButton.setFont(parent.getFont());
- enablementButton.setText(Messages.getString("filtersDialog.priorityLabel")); //$NON-NLS-1$
- enablementButton.addSelectionListener(listener);
-
- highButton = new Button(parent, SWT.CHECK);
- highButton.setFont(parent.getFont());
- highButton.setText(Messages.getString("filtersDialog.priorityHigh")); //$NON-NLS-1$
- highButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- highButton.addSelectionListener(selectionListener);
-
- normalButton = new Button(parent, SWT.CHECK);
- normalButton.setFont(parent.getFont());
- normalButton.setText(Messages.getString("filtersDialog.priorityNormal")); //$NON-NLS-1$
- normalButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- normalButton.addSelectionListener(selectionListener);
-
- lowButton = new Button(parent, SWT.CHECK);
- lowButton.setFont(parent.getFont());
- lowButton.setText(Messages.getString("filtersDialog.priorityLow")); //$NON-NLS-1$
- lowButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- lowButton.addSelectionListener(selectionListener);
- }
- public boolean isEnabled() {
- return enablementButton.getSelection();
- }
- public void setEnabled(boolean enabled) {
- enablementButton.setSelection(enabled);
- }
- public boolean isHighSelected() {
- return highButton.getSelection();
- }
- public void setHighSelected(boolean selected) {
- highButton.setSelection(selected);
- }
- public boolean isNormalSelected() {
- return normalButton.getSelection();
- }
- public void setNormalSelected(boolean selected) {
- normalButton.setSelection(selected);
- }
- public boolean isLowSelected() {
- return lowButton.getSelection();
- }
- public void setLowSelected(boolean selected) {
- lowButton.setSelection(selected);
- }
- public void updateEnablement() {
- enablementButton.setEnabled(isFilterEnabled());
- highButton.setEnabled(enablementButton.isEnabled() && isEnabled());
- normalButton.setEnabled(enablementButton.isEnabled() && isEnabled());
- lowButton.setEnabled(enablementButton.isEnabled() && isEnabled());
- }
- }
-
- private class StatusGroup {
- private Button enablementButton;
- private Button completeButton;
- private Button incompleteButton;
- public StatusGroup(Composite parent) {
- SelectionListener enablementListener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- updateEnablement();
- DialogTaskFilter.this.markDirty();
- }
- };
-
- enablementButton = new Button(parent, SWT.CHECK);
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 2;
- enablementButton.setLayoutData(data);
- enablementButton.setFont(parent.getFont());
- enablementButton.setText(Messages.getString("filtersDialog.statusLabel")); //$NON-NLS-1$
- enablementButton.addSelectionListener(enablementListener);
-
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(parent.getFont());
- GridLayout layout = new GridLayout(2, false);
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- composite.setLayout(layout);
- data = new GridData(GridData.FILL_HORIZONTAL);
- data.horizontalSpan = 3;
- composite.setLayoutData(data);
-
- SelectionListener listener = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- completeButton.setSelection(!incompleteButton.getSelection());
- incompleteButton.setSelection(!completeButton.getSelection());
- DialogTaskFilter.this.markDirty();
- }
- };
-
- completeButton = new Button(composite, SWT.RADIO);
- completeButton.setFont(composite.getFont());
- completeButton.setText(Messages.getString("filtersDialog.statusComplete")); //$NON-NLS-1$
- completeButton.addSelectionListener(listener);
-
- incompleteButton = new Button(composite, SWT.RADIO);
- incompleteButton.setFont(composite.getFont());
- incompleteButton.setText(Messages.getString("filtersDialog.statusIncomplete")); //$NON-NLS-1$
- incompleteButton.addSelectionListener(listener);
- }
- public boolean isEnabled() {
- return enablementButton.getSelection();
- }
- public void setEnabled(boolean enabled) {
- enablementButton.setSelection(enabled);
- }
- public boolean getDone() {
- return completeButton.getSelection();
- }
- public void setDone(boolean done) {
- completeButton.setSelection(done);
- incompleteButton.setSelection(!done);
- }
- public void updateEnablement() {
- enablementButton.setEnabled(isFilterEnabled());
- completeButton.setEnabled(enablementButton.isEnabled() && isEnabled());
- incompleteButton.setEnabled(enablementButton.isEnabled() && isEnabled());
- }
- }
-
- /**
- * @param parentShell
- * @param filter
- */
- public DialogTaskFilter(Shell parentShell, TaskFilter filter) {
- super(parentShell, filter);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#createAttributesArea(org.eclipse.swt.widgets.Composite)
- */
- protected void createAttributesArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(parent.getFont());
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- GridLayout layout = new GridLayout(5, false);
- layout.verticalSpacing = 7;
- composite.setLayout(layout);
-
- descriptionGroup = new DescriptionGroup(composite);
- priorityGroup = new PriorityGroup(composite);
- statusGroup = new StatusGroup(composite);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#updateFilterFromUI(org.eclipse.ui.views.markerview.MarkerFilter)
- */
- protected void updateFilterFromUI() {
- TaskFilter filter = (TaskFilter) getFilter();
-
- filter.setContains(descriptionGroup.getContains());
- filter.setDescription(descriptionGroup.getDescription().trim());
-
- filter.setSelectByPriority(priorityGroup.isEnabled());
- int priority = 0;
- if (priorityGroup.isHighSelected()) {
- priority = priority | TaskFilter.PRIORITY_HIGH;
- }
- if (priorityGroup.isNormalSelected()) {
- priority = priority | TaskFilter.PRIORITY_NORMAL;
- }
- if (priorityGroup.isLowSelected()) {
- priority = priority | TaskFilter.PRIORITY_LOW;
- }
- filter.setPriority(priority);
-
- filter.setSelectByDone(statusGroup.isEnabled());
- filter.setDone(statusGroup.getDone());
-
- super.updateFilterFromUI();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#updateUIFromFilter(org.eclipse.ui.views.markerview.MarkerFilter)
- */
- protected void updateUIFromFilter() {
- TaskFilter filter = (TaskFilter) getFilter();
-
- descriptionGroup.setContains(filter.getContains());
- descriptionGroup.setDescription(filter.getDescription());
-
- priorityGroup.setEnabled(filter.getSelectByPriority());
- int priority = filter.getPriority();
- priorityGroup.setHighSelected((priority & TaskFilter.PRIORITY_HIGH) > 0);
- priorityGroup.setNormalSelected((priority & TaskFilter.PRIORITY_NORMAL) > 0);
- priorityGroup.setLowSelected((priority & TaskFilter.PRIORITY_LOW) > 0);
-
- statusGroup.setEnabled(filter.getSelectByDone());
- statusGroup.setDone(filter.getDone());
-
- super.updateUIFromFilter();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#updateEnabledState()
- */
- protected void updateEnabledState() {
- super.updateEnabledState();
- descriptionGroup.updateEnablement();
- priorityGroup.updateEnablement();
- statusGroup.updateEnablement();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.markerview.FiltersDialog#resetPressed()
- */
- protected void resetPressed() {
- descriptionGroup.setContains(TaskFilter.DEFAULT_CONTAINS);
- descriptionGroup.setDescription(TaskFilter.DEFAULT_DESCRIPTION);
-
- priorityGroup.setEnabled(TaskFilter.DEFAULT_SELECT_BY_PRIORITY);
- priorityGroup.setHighSelected((TaskFilter.DEFAULT_PRIORITY & TaskFilter.PRIORITY_HIGH) > 0);
- priorityGroup.setNormalSelected((TaskFilter.DEFAULT_PRIORITY & TaskFilter.PRIORITY_NORMAL) > 0);
- priorityGroup.setLowSelected((TaskFilter.DEFAULT_PRIORITY & TaskFilter.PRIORITY_NORMAL) > 0);
-
- statusGroup.setEnabled(TaskFilter.DEFAULT_SELECT_BY_DONE);
- statusGroup.setDone(TaskFilter.DEFAULT_DONE);
-
- super.resetPressed();
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogTaskProperties.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogTaskProperties.java
deleted file mode 100644
index 04b0a24..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/DialogTaskProperties.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.Map;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-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.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-
-public class DialogTaskProperties extends DialogMarkerProperties {
-
- private static final String PRIORITY_HIGH = Messages.getString("propertiesDialog.priorityHigh"); //$NON-NLS-1$
- private static final String PRIORITY_NORMAL = Messages.getString("propertiesDialog.priorityNormal"); //$NON-NLS-1$
- private static final String PRIORITY_LOW = Messages.getString("propertiesDialog.priorityLow"); //$NON-NLS-1$
-
- protected Combo priorityCombo;
- protected Button completedCheckbox;
-
- /**
- * @param parentShell
- */
- public DialogTaskProperties(Shell parentShell) {
- super(parentShell);
- setType(IMarker.TASK);
- }
-
- /**
- * @param parentShell
- */
- DialogTaskProperties(Shell parentShell, String title) {
- super(parentShell, title);
- setType(IMarker.TASK);
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.MarkerPropertiesDialog#createAttributesArea(org.eclipse.swt.widgets.Composite)
- */
- protected void createAttributesArea(Composite parent) {
- super.createAttributesArea(parent);
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(parent.getFont());
- GridLayout layout = new GridLayout();
- layout.numColumns = 3;
- composite.setLayout(layout);
-
- Label label = new Label(composite, SWT.NONE);
- label.setFont(composite.getFont());
- label.setText(Messages.getString("propertiesDialog.priority")); //$NON-NLS-1$
- priorityCombo = new Combo(composite, SWT.READ_ONLY);
- priorityCombo.setItems(new String[] {PRIORITY_HIGH, PRIORITY_NORMAL, PRIORITY_LOW});
- // 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;
- }
- }
- });
- priorityCombo.setFont(composite.getFont());
- priorityCombo.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (getMarker() == null) {
- Map initialAttributes = getInitialAttributes();
- initialAttributes.put(IMarker.PRIORITY, new Integer(getPriorityFromDialog()));
- }
- markDirty();
- }
- });
-
- completedCheckbox = new Button(composite, SWT.CHECK);
- completedCheckbox.setFont(composite.getFont());
- completedCheckbox.setText(Messages.getString("propertiesDialog.completed")); //$NON-NLS-1$
- GridData gridData = new GridData();
- gridData.horizontalIndent = convertHorizontalDLUsToPixels(20);
- completedCheckbox.setLayoutData(gridData);
- completedCheckbox.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- if (getMarker() == null) {
- Map initialAttributes = getInitialAttributes();
- initialAttributes.put(IMarker.DONE, new Boolean(completedCheckbox.getSelection()));
- }
- markDirty();
- }
- });
- }
-
- protected boolean getCompleted() {
- IMarker marker = getMarker();
- boolean complete = false;
- if (marker == null) {
- Map attributes = getInitialAttributes();
- Object done = attributes.get(IMarker.DONE);
- return done != null && done instanceof Boolean && ((Boolean) done).booleanValue();
- }
- else {
- return marker.getAttribute(IMarker.DONE, false);
- }
- }
-
- protected int getPriority() {
- IMarker marker = getMarker();
- int priority = IMarker.PRIORITY_NORMAL;
- if (marker == null) {
- Map attributes = getInitialAttributes();
- Object priorityObj = attributes.get(IMarker.PRIORITY);
- if (priorityObj != null && priorityObj instanceof Integer) {
- priority = ((Integer) priorityObj).intValue();
- }
- }
- else {
- priority = marker.getAttribute(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
- }
- return priority;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.MarkerPropertiesDialog#updateEnablement()
- */
- protected void updateEnablement() {
- super.updateEnablement();
- priorityCombo.setEnabled(isEditable());
- completedCheckbox.setEnabled(isEditable());
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.MarkerPropertiesDialog#updateDialogForNewMarker()
- */
- protected void updateDialogForNewMarker() {
- Map initialAttributes = getInitialAttributes();
- int priority = getPriority();
- initialAttributes.put(IMarker.PRIORITY, new Integer(priority));
- if (priority == IMarker.PRIORITY_HIGH) {
- priorityCombo.select(priorityCombo.indexOf(PRIORITY_HIGH));
- }
- else if (priority == IMarker.PRIORITY_LOW) {
- priorityCombo.select(priorityCombo.indexOf(PRIORITY_LOW));
- }
- else {
- priorityCombo.select(priorityCombo.indexOf(PRIORITY_NORMAL));
- }
- boolean completed = getCompleted();
- initialAttributes.put(IMarker.DONE, new Boolean(completed));
- completedCheckbox.setSelection(completed);
- super.updateDialogForNewMarker();
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.MarkerPropertiesDialog#updateDialogFromMarker()
- */
- protected void updateDialogFromMarker() {
- Map initialAttributes = getInitialAttributes();
- int priority = getPriority();
- initialAttributes.put(IMarker.PRIORITY, new Integer(priority));
- if (priority == IMarker.PRIORITY_HIGH) {
- priorityCombo.select(priorityCombo.indexOf(PRIORITY_HIGH));
- }
- else if (priority == IMarker.PRIORITY_LOW) {
- priorityCombo.select(priorityCombo.indexOf(PRIORITY_LOW));
- }
- else {
- priorityCombo.select(priorityCombo.indexOf(PRIORITY_NORMAL));
- }
- boolean completed = getCompleted();
- initialAttributes.put(IMarker.DONE, new Boolean(completed));
- completedCheckbox.setSelection(completed);
- super.updateDialogFromMarker();
- }
-
- private int getPriorityFromDialog() {
- int priority = IMarker.PRIORITY_NORMAL;
- if (priorityCombo.getSelectionIndex() == priorityCombo.indexOf(PRIORITY_HIGH)) {
- priority = IMarker.PRIORITY_HIGH;
- }
- else if (priorityCombo.getSelectionIndex() == priorityCombo.indexOf(PRIORITY_LOW)) {
- priority = IMarker.PRIORITY_LOW;
- }
- return priority;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.MarkerPropertiesDialog#getMarkerAttributesFromDialog()
- */
- protected Map getMarkerAttributes() {
- Map attrs = super.getMarkerAttributes();
- attrs.put(IMarker.PRIORITY, new Integer(getPriorityFromDialog()));
- attrs.put(IMarker.DONE, new Boolean(completedCheckbox.getSelection()));
- Object userEditable = attrs.get(IMarker.USER_EDITABLE);
- if (userEditable == null || !(userEditable instanceof Boolean)) {
- attrs.put(IMarker.USER_EDITABLE, new Boolean(true));
- }
- return attrs;
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldCreationTime.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldCreationTime.java
deleted file mode 100644
index c2bac78..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldCreationTime.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.swt.graphics.Image;
-
-
-/**
- * Creation time field. Designed to display and compare creation times of IMarker objects.
- */
-public class FieldCreationTime implements IField {
-
- static final String CREATION_TIME = "creationTime"; //$NON-NLS-1$
-
- private String name;
- private String description;
- private Image image;
-
- /**
- * The constructor
- */
- public FieldCreationTime() {
- name = CREATION_TIME;
- description = Messages.getString("description." + name); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getName()
- */
- public String getName() {
- return name;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescription()
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescriptionImage()
- */
- public Image getDescriptionImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderText()
- */
- public String getColumnHeaderText() {
- return description;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderImage()
- */
- public Image getColumnHeaderImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getValue(java.lang.Object)
- */
- public String getValue(Object obj) {
- if (obj == null || !(obj instanceof IMarker)) {
- return ""; //$NON-NLS-1$
- }
- IMarker marker = (IMarker) obj;
- return Util.getCreationTime(marker);
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getImage(java.lang.Object)
- */
- public Image getImage(Object obj) {
- return null;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object other) {
- if (!(other instanceof IField)) {
- return false;
- }
- IField otherProperty = (IField) other;
- return (this.name.equals(otherProperty.getName()));
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object obj1, Object obj2) {
- if (obj1 == null || obj2 == null || !(obj1 instanceof IMarker) || !(obj2 instanceof IMarker)) {
- return 0;
- }
- IMarker marker1 = (IMarker) obj1;
- IMarker marker2 = (IMarker) obj2;
- try {
- long value = marker1.getCreationTime() - marker2.getCreationTime();
- return (new Long(value)).intValue();
- }
- catch (CoreException e) {
- }
- return 0;
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldDone.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldDone.java
deleted file mode 100644
index 02791f5..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldDone.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.swt.graphics.Image;
-
-public class FieldDone implements IField {
-
- public static final String COMPLETION = "completion"; //$NON-NLS-1$
-
- static final String DESCRIPTION_IMAGE_PATH = "obj16/header_complete.gif"; //$NON-NLS-1$
- static final String COMPLETE_IMAGE_PATH = "obj16/complete_tsk.gif"; //$NON-NLS-1$
- static final String INCOMPLETE_IMAGE_PATH = "obj16/incomplete_tsk.gif"; //$NON-NLS-1$
-
- private String name;
- private String description;
- private Image image;
-
- public FieldDone() {
- name = COMPLETION;
- description = Messages.getString(name + ".description"); //$NON-NLS-1$
- image = ImageFactory.getImage(DESCRIPTION_IMAGE_PATH);
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getName()
- */
- public String getName() {
- return name;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescription()
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescriptionImage()
- */
- public Image getDescriptionImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderText()
- */
- public String getColumnHeaderText() {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderImage()
- */
- public Image getColumnHeaderImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getValue(java.lang.Object)
- */
- public String getValue(Object obj) {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getImage(java.lang.Object)
- */
- public Image getImage(Object obj) {
- if (obj == null || !(obj instanceof IMarker)) {
- return null;
- }
- IMarker marker = (IMarker) obj;
- if (!marker.getAttribute(IMarker.USER_EDITABLE, true)) {
- return null;
- }
- if (marker.getAttribute(IMarker.DONE, false)) {
- return ImageFactory.getImage(COMPLETE_IMAGE_PATH);
- }
- return ImageFactory.getImage(INCOMPLETE_IMAGE_PATH);
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object other) {
- if (!(other instanceof IField)) {
- return false;
- }
- IField otherProperty = (IField) other;
- return (this.name.equals(otherProperty.getName()));
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object obj1, Object obj2) {
- if (obj1 == null || obj2 == null || !(obj1 instanceof IMarker) || !(obj2 instanceof IMarker)) {
- return 0;
- }
- IMarker marker1 = (IMarker) obj1;
- IMarker marker2 = (IMarker) obj2;
- int value1 = -1;
- if (marker1.getAttribute(IMarker.USER_EDITABLE, true)) {
- value1 = 0;
- if (marker1.getAttribute(IMarker.DONE, false)) {
- value1 = 1;
- }
- }
- int value2 = -1;
- if (marker2.getAttribute(IMarker.USER_EDITABLE, true)) {
- value2 = 0;
- if (marker2.getAttribute(IMarker.DONE, false)) {
- value2 = 1;
- }
- }
- return value1 - value2;
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldFolder.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldFolder.java
deleted file mode 100644
index 274dd6d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldFolder.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.text.Collator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Folder field. Designed to display and compare the names of the folders that contain
- * IMarker objects.
- */
-public class FieldFolder implements IField {
-
- static final String FOLDER = "folder"; //$NON-NLS-1$
-
- private String name;
- private String description;
- private Image image;
-
- public FieldFolder() {
- name = FOLDER;
- description = Messages.getString("description.folder"); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getName()
- */
- public String getName() {
- return name;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescription()
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescriptionImage()
- */
- public Image getDescriptionImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderText()
- */
- public String getColumnHeaderText() {
- return description;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderImage()
- */
- public Image getColumnHeaderImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getValue(java.lang.Object)
- */
- public String getValue(Object obj) {
- if (obj == null || !(obj instanceof IMarker)) {
- return ""; //$NON-NLS-1$
- }
- IMarker marker = (IMarker) obj;
- return Util.getContainerName(marker);
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getImage(java.lang.Object)
- */
- public Image getImage(Object obj) {
- return null;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object other) {
- if (!(other instanceof IField)) {
- return false;
- }
- IField otherProperty = (IField) other;
- return (this.name.equals(otherProperty.getName()));
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object obj1, Object obj2) {
- if (obj1 == null || obj2 == null || !(obj1 instanceof IMarker) || !(obj2 instanceof IMarker)) {
- return 0;
- }
- return Collator.getInstance().compare(getValue(obj1), getValue(obj2));
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldLineNumber.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldLineNumber.java
deleted file mode 100644
index 06a1478..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldLineNumber.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.swt.graphics.Image;
-
-public class FieldLineNumber implements IField {
-
- private String name;
- private String description;
- private Image image;
-
- public FieldLineNumber() {
- name = IMarker.LINE_NUMBER;
- description = Messages.getString("description." + name); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getName()
- */
- public String getName() {
- return name;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescription()
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescriptionImage()
- */
- public Image getDescriptionImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderText()
- */
- public String getColumnHeaderText() {
- return description;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderImage()
- */
- public Image getColumnHeaderImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getValue(java.lang.Object)
- */
- public String getValue(Object obj) {
- if (obj == null || !(obj instanceof IMarker)) {
- return ""; //$NON-NLS-1$
- }
- IMarker marker = (IMarker) obj;
- String lineNumber = Util.getProperty(name, marker);
- if (lineNumber.equals("")) { //$NON-NLS-1$
- return lineNumber;
- }
- return Messages.format("label." + name, new String[] {lineNumber}); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getImage(java.lang.Object)
- */
- public Image getImage(Object obj) {
- return null;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object other) {
- if (!(other instanceof IField)) {
- return false;
- }
- IField otherProperty = (IField) other;
- return (this.name.equals(otherProperty.getName()));
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object obj1, Object obj2) {
- if (obj1 == null || obj2 == null || !(obj1 instanceof IMarker) || !(obj2 instanceof IMarker)) {
- return 0;
- }
- IMarker marker1 = (IMarker) obj1;
- IMarker marker2 = (IMarker) obj2;
- int line1 = marker1.getAttribute(IMarker.LINE_NUMBER, -1);
- int line2 = marker2.getAttribute(IMarker.LINE_NUMBER, -1);
- return line1 - line2;
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldMessage.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldMessage.java
deleted file mode 100644
index 01b837b..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldMessage.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.text.Collator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.swt.graphics.Image;
-
-public class FieldMessage implements IField {
-
- private String name;
- private String description;
- private Image image;
-
- public FieldMessage() {
- name = IMarker.MESSAGE;
- description = Messages.getString("description." + name); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getName()
- */
- public String getName() {
- return name;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescription()
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescriptionImage()
- */
- public Image getDescriptionImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderText()
- */
- public String getColumnHeaderText() {
- return description;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderImage()
- */
- public Image getColumnHeaderImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getValue(java.lang.Object)
- */
- public String getValue(Object obj) {
- if (obj == null || !(obj instanceof IMarker)) {
- return ""; //$NON-NLS-1$
- }
- IMarker marker = (IMarker) obj;
- return Util.getProperty(name, marker);
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getImage(java.lang.Object)
- */
- public Image getImage(Object obj) {
- return null;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object other) {
- if (!(other instanceof IField)) {
- return false;
- }
- IField otherProperty = (IField) other;
- return (this.name.equals(otherProperty.getName()));
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object obj1, Object obj2) {
- if (obj1 == null || obj2 == null || !(obj1 instanceof IMarker) || !(obj2 instanceof IMarker)) {
- return 0;
- }
- return Collator.getInstance().compare(getValue(obj1), getValue(obj2));
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldPriority.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldPriority.java
deleted file mode 100644
index ad9a561..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldPriority.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.swt.graphics.Image;
-
-public class FieldPriority implements IField {
-
- static final String DESCRIPTION_IMAGE_PATH = "obj16/header_priority.gif"; //$NON-NLS-1$
- static final String HIGH_PRIORITY_IMAGE_PATH = "obj16/hprio_tsk.gif"; //$NON-NLS-1$
- static final String LOW_PRIORITY_IMAGE_PATH = "obj16/lprio_tsk.gif"; //$NON-NLS-1$
-
- private String name;
- private String description;
- private Image image;
-
- public FieldPriority() {
- name = IMarker.PRIORITY;
- description = Messages.getString(name + ".description"); //$NON-NLS-1$
- image = ImageFactory.getImage(DESCRIPTION_IMAGE_PATH);
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getName()
- */
- public String getName() {
- return name;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescription()
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescriptionImage()
- */
- public Image getDescriptionImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderText()
- */
- public String getColumnHeaderText() {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderImage()
- */
- public Image getColumnHeaderImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getValue(java.lang.Object)
- */
- public String getValue(Object obj) {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getImage(java.lang.Object)
- */
- public Image getImage(Object obj) {
- if (obj == null || !(obj instanceof IMarker)) {
- return null;
- }
- try {
- int priority = Integer.parseInt(Util.getProperty(name, (IMarker) obj));
- if (priority == IMarker.PRIORITY_HIGH) {
- return ImageFactory.getImage(HIGH_PRIORITY_IMAGE_PATH);
- }
- if (priority == IMarker.PRIORITY_LOW) {
- return ImageFactory.getImage(LOW_PRIORITY_IMAGE_PATH);
- }
- }
- catch (NumberFormatException e) {
- }
- return null;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object other) {
- if (!(other instanceof IField)) {
- return false;
- }
- IField otherProperty = (IField) other;
- return (this.name.equals(otherProperty.getName()));
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object obj1, Object obj2) {
- if (obj1 == null || obj2 == null || !(obj1 instanceof IMarker) || !(obj2 instanceof IMarker)) {
- return 0;
- }
- int priority1 = -1;
- try {
- priority1 = Integer.parseInt(Util.getProperty(name, (IMarker) obj1));
- }
- catch (NumberFormatException e) {
- }
- int priority2 = -1;
- try {
- priority2 = Integer.parseInt(Util.getProperty(name, (IMarker) obj2));
- }
- catch (NumberFormatException e) {
- }
- return priority1 - priority2;
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldResource.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldResource.java
deleted file mode 100644
index 33601a7..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldResource.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.text.Collator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.swt.graphics.Image;
-
-public class FieldResource implements IField {
-
- static final String RESOURCE = "resource"; //$NON-NLS-1$
-
- private String name;
- private String description;
- private Image image;
-
- public FieldResource() {
- name = RESOURCE;
- description = Messages.getString("description." + name); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getName()
- */
- public String getName() {
- return name;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescription()
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescriptionImage()
- */
- public Image getDescriptionImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderText()
- */
- public String getColumnHeaderText() {
- return description;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderImage()
- */
- public Image getColumnHeaderImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getValue(java.lang.Object)
- */
- public String getValue(Object obj) {
- if (obj == null || !(obj instanceof IMarker)) {
- return ""; //$NON-NLS-1$
- }
- IMarker marker = (IMarker) obj;
- return marker.getResource().getName();
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getImage(java.lang.Object)
- */
- public Image getImage(Object obj) {
- return null;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object other) {
- if (!(other instanceof IField)) {
- return false;
- }
- IField otherProperty = (IField) other;
- return (this.name.equals(otherProperty.getName()));
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object obj1, Object obj2) {
- if (obj1 == null || obj2 == null || !(obj1 instanceof IMarker) || !(obj2 instanceof IMarker)) {
- return 0;
- }
- return Collator.getInstance().compare(getValue(obj1), getValue(obj2));
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldSeverity.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldSeverity.java
deleted file mode 100644
index 9d2bc43..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FieldSeverity.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.swt.graphics.Image;
-
-public class FieldSeverity implements IField {
-
- final static String PROBLEM_SEVERITY = "problemSeverity"; //$NON-NLS-1$
-
- private static final String IMAGE_ERROR_PATH = "obj16/error_tsk.gif"; //$NON-NLS-1$
- private static final String IMAGE_WARNING_PATH = "obj16/warn_tsk.gif"; //$NON-NLS-1$
- private static final String IMAGE_INFO_PATH = "obj16/info_tsk.gif"; //$NON-NLS-1$
-
- private String name;
- private String description;
- private Image image;
-
- public FieldSeverity() {
- name = PROBLEM_SEVERITY;
- description = Messages.getString(name + ".description"); //$NON-NLS-1$
- image = null;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getName()
- */
- public String getName() {
- return name;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescription()
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getDescriptionImage()
- */
- public Image getDescriptionImage() {
- return image;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderText()
- */
- public String getColumnHeaderText() {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getColumnHeaderImage()
- */
- public Image getColumnHeaderImage() {
- return null;
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getValue(java.lang.Object)
- */
- public String getValue(Object obj) {
- return ""; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#getImage(java.lang.Object)
- */
- public Image getImage(Object obj) {
- if (obj == null || !(obj instanceof IMarker)) {
- return null;
- }
- IMarker marker = (IMarker) obj;
- int severity = marker.getAttribute(IMarker.SEVERITY, -1);
- if (severity == IMarker.SEVERITY_ERROR) {
- return ImageFactory.getImage(IMAGE_ERROR_PATH);
- }
- if (severity == IMarker.SEVERITY_WARNING) {
- return ImageFactory.getImage(IMAGE_WARNING_PATH);
- }
- if (severity == IMarker.SEVERITY_INFO) {
- return ImageFactory.getImage(IMAGE_INFO_PATH);
- }
- return null;
- }
-
- /**
- * @see java.lang.Object#equals(java.lang.Object)
- */
- public boolean equals(Object other) {
- if (!(other instanceof IField)) {
- return false;
- }
- IField otherProperty = (IField) other;
- return (this.name.equals(otherProperty.getName()));
- }
-
- /**
- * @see org.eclipse.ui.views.markerview.IField#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object obj1, Object obj2) {
- if (obj1 == null || obj2 == null || !(obj1 instanceof IMarker) || !(obj2 instanceof IMarker)) {
- return 0;
- }
- IMarker marker1 = (IMarker) obj1;
- IMarker marker2 = (IMarker) obj2;
- int severity1 = marker1.getAttribute(IMarker.SEVERITY, -1);
- int severity2 = marker2.getAttribute(IMarker.SEVERITY, -1);
- return severity1 - severity2;
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FiltersAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FiltersAction.java
deleted file mode 100644
index b97ee37..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/FiltersAction.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.Dialog;
-
-/**
- * This action opens a Filters Dialog and notifies the Marker View if the user has
- * modified the filter via the filters dialog.
- */
-class FiltersAction extends Action {
-
- private TableView view;
- private Dialog dialog;
-
- /**
- * Creates the action
- */
- public FiltersAction(TableView view, Dialog dialog) {
- super(Messages.getString("filtersAction.title")); //$NON-NLS-1$
- setImageDescriptor(ImageFactory.getImageDescriptor("clcl16/filter_ps.gif")); //$NON-NLS-1$
- this.view = view;
- this.dialog = dialog;
- setEnabled(true);
- }
-
- /**
- * Opens the dialog. Notifies the view if the filter has been modified.
- */
- public void run() {
- if (dialog != null && dialog.open() == Dialog.OK)
- view.filtersChanged();
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IField.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IField.java
deleted file mode 100644
index f04e723..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IField.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.swt.graphics.Image;
-
-public interface IField {
-
- /**
- * @return the name of the field.
- */
- String getName();
-
- /**
- * @return the description of the field.
- */
- String getDescription();
-
- /**
- * @return the image associated with the description of the field or <code>null<code>.
- */
- Image getDescriptionImage();
-
- /**
- * @return The text to be displayed in the column header for this field.
- */
- String getColumnHeaderText();
-
- /**
- * @return The image to be displayed in the column header for this field or <code>null<code>.
- */
- Image getColumnHeaderImage();
-
- /**
- * @param obj
- * @return The String value of the object for this particular field to be displayed to the user.
- */
- String getValue(Object obj);
-
- /**
- * @param obj
- * @return The image value of the object for this particular field to be displayed to the user
- * or <code>null<code>.
- */
- Image getImage(Object obj);
-
- /**
- * @param obj1
- * @param obj2
- * @return Either:
- * <li>a negative number if the value of obj1 is less than the value of obj2 for this field.
- * <li><code>0</code> if the value of obj1 and the value of obj2 are equal for this field.
- * <li>a positive number if the value of obj1 is greater than the value of obj2 for this field.
- */
- int compare(Object obj1, Object obj2);
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IFilter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IFilter.java
deleted file mode 100644
index 7bb897d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IFilter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-
-/**
- * Generic filtering interface.
- */
-public interface IFilter {
-
- /**
- * Filters the list of elements. Removes the elements that need to filtered out from the list.
- *
- * @param elements
- */
- public Object[] filter(Object[] elements);
-
- /**
- * @param item
- * @return
- * <ul>
- * <li><code>true</code> if the item will make it through the filter.</li>
- * <li><code>false</code> if the item will not make it through the filter.</li>
- * </ul>
- */
- public boolean select(Object item);
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IItemsChangedListener.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IItemsChangedListener.java
deleted file mode 100644
index c28ca8b..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IItemsChangedListener.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.List;
-
-
-public interface IItemsChangedListener {
-
- /**
- * @param additions new items added
- * @param removals items removed
- * @param changes changed items
- */
- public void itemsChanged(List additions, List removals, List changes);
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IMarkerChangedListener.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IMarkerChangedListener.java
deleted file mode 100644
index 3eec4f9..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IMarkerChangedListener.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.List;
-
-
-/**
- * Listener interface that listens for changes in resource markers.
- */
-public interface IMarkerChangedListener {
-
- /**
- * @param additions new markers added
- * @param removals markers removed
- * @param changes changed markers
- */
- public void markerChanged(List additions, List removals, List changes);
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IMarkerResourceAdapter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IMarkerResourceAdapter.java
deleted file mode 100644
index dfa1d8e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/IMarkerResourceAdapter.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * <code>IMarkerResourceAdapter</code> is an adapter interface that
- * supplies the resource to query for markers to display in the marker view
- * or any of its subclasses.
- *
- * Implementors of this interface are typically registered with an
- * IAdapterFactory for lookup via the getAdapter() mechanism.
- */
-public interface IMarkerResourceAdapter {
-
- /**
- * 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);
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ITableViewContentProvider.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ITableViewContentProvider.java
deleted file mode 100644
index 5fb0969..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ITableViewContentProvider.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-
-
-public interface ITableViewContentProvider {
-
- public Object[] getElements();
- public IFilter getFilter();
- public void setFilter(IFilter filter);
- public void addItemsChangedListener(IItemsChangedListener listener);
- public void removeItemsChangedListener(IItemsChangedListener listener);
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ImageFactory.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ImageFactory.java
deleted file mode 100644
index 832a373..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ImageFactory.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Manages images and image descriptors.
- */
-public class ImageFactory {
-
- private static ImageRegistry imageRegistry = new ImageRegistry();
- private static Map map = new HashMap();
-
- private static ImageDescriptor create(String path) {
- try {
- URL url = Platform.getPlugin(PlatformUI.PLUGIN_ID).getDescriptor().getInstallURL();
- url = new URL(url, "icons/full/" + path); //$NON-NLS-1$
- return ImageDescriptor.createFromURL(url);
- } catch (MalformedURLException eMalformedURL) {
- return null;
- }
- }
-
- /**
- * Returns an image for the given path or <code>null</code> if an image could
- * not be created.
- *
- * @param path the path of the image relative to "org.eclipse.ui/icons/full"
- * @return the image located at the specified path or <code>null</code> if
- * no image could be created.
- */
- public static Image getImage(String path) {
- Image image = (Image) imageRegistry.get(path);
-
- if (image == null) {
- ImageDescriptor imageDescriptor = getImageDescriptor(path);
-
- if (imageDescriptor != null) {
- image = imageDescriptor.createImage(false);
-
- if (image == null)
- System.err.println(ImageFactory.class + ": error creating image for " + path); //$NON-NLS-1$
-
- imageRegistry.put(path, image);
- }
- }
-
- return image;
- }
-
- /**
- * Returns an image descriptor for the given path or <code>null</code> if no
- * image could be found.
- *
- * @param path the path of the image relative to "org.eclipse.ui/icons/full"
- * @return an image descriptor or <code>null</code> if no image was found at the
- * specified path.
- */
- public static ImageDescriptor getImageDescriptor(String path) {
- ImageDescriptor imageDescriptor = (ImageDescriptor) map.get(path);
-
- if (imageDescriptor == null) {
- imageDescriptor = create(path);
- map.put(path, imageDescriptor);
- }
-
- return imageDescriptor;
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerFilter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerFilter.java
deleted file mode 100644
index 3ba8361..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerFilter.java
+++ /dev/null
@@ -1,484 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.StringTokenizer;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.ui.IContainmentAdapter;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-class MarkerFilter implements IFilter {
-
- private static final String TAG_DIALOG_SECTION = "filter"; //$NON-NLS-1$
- private static final String TAG_ENABLED = "enabled"; //$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$
- private static final String TAG_ON_RESOURCE = "onResource"; //$NON-NLS-1$
- private static final String TAG_SELECTED_TYPES = "selectedType"; //$NON-NLS-1$
- private static final String TAG_WORKING_SET = "workingSet"; //$NON-NLS-1$
- private static final String TAG_TYPES_DELIMITER = ":"; //$NON-NLS-1$
-
- 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;
- static final int ON_WORKING_SET = 4;
-
- static final int DEFAULT_MARKER_LIMIT = 2000;
- static final boolean DEFAULT_FILTER_ON_MARKER_LIMIT = true;
- static final int DEFAULT_ON_RESOURCE = ON_ANY_RESOURCE;
- static final boolean DEFAULT_ACTIVATION_STATUS = true;
-
- protected List rootTypes = new ArrayList();
- protected List selectedTypes = new ArrayList();
- protected IWorkingSet workingSet;
- protected int onResource;
- protected boolean filterOnMarkerLimit;
- protected boolean enabled;
- protected int markerLimit;
-
- private MarkerTypesModel typesModel;
-
- private IResource[] focusResource;
-
- MarkerFilter(String[] rootTypes) {
- typesModel = new MarkerTypesModel();
-
- for (int i = 0; i < rootTypes.length; i++) {
- MarkerType type = typesModel.getType(rootTypes[i]);
-
- if (!this.rootTypes.contains(type))
- this.rootTypes.add(type);
- }
- }
-
- private void addAllSubTypes() {
- for (int i = 0; i < rootTypes.size(); i++) {
- MarkerType rootType = (MarkerType) rootTypes.get(i);
- addAllSubTypes(rootType);
- }
- }
-
- private void addAllSubTypes(MarkerType type) {
- if (type == null)
- return;
-
- if (!selectedTypes.contains(type))
- selectedTypes.add(type);
-
- MarkerType[] subTypes = type.getSubtypes();
-
- for (int i = 0; i < subTypes.length; i++)
- addAllSubTypes(subTypes[i]);
- }
-
- public Object[] filter(Object[] elements) {
- if (elements == null)
- return new Object[0];
-
- List filteredElements = new ArrayList();
-
- for (int i = 0; i < elements.length; i++) {
- Object element = elements[i];
-
- if (select(element))
- filteredElements.add(element);
- }
-
- return filteredElements.toArray();
- }
-
- public boolean select(Object item) {
- if (!isEnabled()) {
- return true;
- }
-
- if (!(item instanceof IMarker))
- return false;
-
- IMarker marker = (IMarker) item;
- return selectByType(marker) && selectBySelection(marker);
- }
-
- private boolean selectByType(IMarker marker) {
- String type;
-
- try {
- type = marker.getType();
- }
- catch (CoreException e) {
- return false;
- }
-
- return selectedTypes.contains(typesModel.getType(type));
- }
-
- /**
- * 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 selectBySelection(IMarker marker) {
- if (onResource == ON_ANY_RESOURCE || marker == null)
- return true;
-
- if (focusResource == null)
- return true;
-
- IResource resource = marker.getResource();
-
- if (onResource == ON_WORKING_SET) {
- if (workingSet == null)
- return true;
-
- if (resource != null)
- return isEnclosed(resource);
-
- } else if (onResource == ON_ANY_RESOURCE_OF_SAME_PROJECT) {
- IProject project = resource.getProject();
-
- for (int i = 0; i < focusResource.length; i++) {
- IProject selectedProject = focusResource[i].getProject();
-
- if (project.equals(selectedProject))
- return true;
- }
- } else if (onResource == ON_SELECTED_RESOURCE_ONLY) {
- for (int i = 0; i < focusResource.length; i++) {
- if (resource.equals(focusResource[i]))
- return true;
- }
- } else if (onResource == ON_SELECTED_RESOURCE_AND_CHILDREN) {
- for (int i = 0; i < focusResource.length; i++) {
- IResource parentResource = resource;
-
- while (parentResource != null) {
- if (parentResource.equals(focusResource[i]))
- return true;
-
- parentResource = parentResource.getParent();
- }
- }
- }
-
- return false;
- }
-
- /**
- * Returns if the given resource is enclosed by a working set element.
- * The IContainmentAdapter of each working set element is used for the
- * containment test. If there is no IContainmentAdapter for a working
- * set element, a simple resource based test is used.
- *
- * @param element resource to test for enclosure by a working set
- * element
- * @return true if element is enclosed by a working set element and
- * false otherwise.
- */
- private boolean isEnclosed(IResource element) {
- IPath elementPath = element.getFullPath();
- IAdaptable[] workingSetElements = workingSet.getElements();
-
- if (elementPath.isEmpty() || elementPath.isRoot())
- return false;
-
- for (int i = 0; i < workingSetElements.length; i++) {
- IAdaptable workingSetElement = workingSetElements[i];
- IContainmentAdapter containmentAdapter = (IContainmentAdapter) workingSetElement.getAdapter(IContainmentAdapter.class);
-
- // if there is no IContainmentAdapter defined for the working
- // set element type fall back to using resource based
- // containment check
- if (containmentAdapter != null) {
- if (containmentAdapter.contains(workingSetElement, element, IContainmentAdapter.CHECK_CONTEXT | IContainmentAdapter.CHECK_IF_CHILD | IContainmentAdapter.CHECK_IF_DESCENDANT))
- return true;
- } else if (isEnclosedResource(element, elementPath, workingSetElement)) {
- return true;
- }
- }
-
- return false;
- }
-
- /**
- * Returns if the given resource is enclosed by a working set element.
- * A resource is enclosed if it is either a parent of a working set
- * element, a child of a working set element or a working set element
- * itself.
- * Simple path comparison is used. This is only guaranteed to return
- * correct results for resource working set elements.
- *
- * @param element resource to test for enclosure by a working set
- * element
- * @param elementPath full, absolute path of the element to test
- * @return true if element is enclosed by a working set element and
- * false otherwise.
- */
- private boolean isEnclosedResource(IResource element, IPath elementPath, IAdaptable workingSetElement) {
- IResource workingSetResource = null;
-
- if (workingSetElement.equals(element))
- return true;
-
- if (workingSetElement instanceof IResource)
- workingSetResource = (IResource) workingSetElement;
- else
- workingSetResource = (IResource) workingSetElement.getAdapter(IResource.class);
-
- if (workingSetResource != null) {
- IPath resourcePath = workingSetResource.getFullPath();
-
- if (resourcePath.isPrefixOf(elementPath))
- return true;
- }
-
- return false;
- }
-
- /**
- * @return the defined limit on the number of markers to be displayed.
- */
- int getMarkerLimit() {
- return markerLimit;
- }
-
- /**
- * Sets the limit on the number of markers to be displayed.
- *
- * @param the new limit
- */
- void setMarkerLimit(int markerLimit) {
- this.markerLimit = markerLimit;
- }
-
- /**
- * @return <ul>
- * <li><code>MarkerFilter.ON_ANY_RESOURCE</code> if showing items associated with any resource.</li>
- * <li><code>MarkerFilter.ON_SELECTED_RESOURCE_ONLY</code> if showing items associated with
- * the selected resource within the workbench.</li>
- * <li><code>MarkerFilter.ON_SELECTED_RESOURCE_AND_CHILDREN</code> if showing items associated with
- * the selected resource within the workbench and its children.</li>
- * <li><code>MarkerFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT</code> if showing items in the same project
- * as the selected resource within the workbench.</li>
- * <li><code>MarkerFilter.ON_WORKING_SET</code> if showing items in some working set.</li>
- * </ul>
- */
- int getOnResource() {
- return onResource;
- }
-
- /**
- * Sets the type of filtering by selection.
- *
- * @param onResource must be one of:
- * <ul>
- * <li><code>MarkerFilter.ON_ANY_RESOURCE</code></li>
- * <li><code>MarkerFilter.ON_SELECTED_RESOURCE_ONLY</code></li>
- * <li><code>MarkerFilter.ON_SELECTED_RESOURCE_AND_CHILDREN</code></li>
- * <li><code>MarkerFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT</code></li>
- * <li><code>MarkerFilter.ON_WORKING_SET</code></li>
- * </ul>
- */
- void setOnResource(int onResource) {
- if (onResource >= ON_ANY_RESOURCE && onResource <= ON_WORKING_SET)
- this.onResource = onResource;
- }
-
- /**
- * @return the selected resource(s) withing the workbench.
- */
- IResource[] getFocusResource() {
- return focusResource;
- }
-
- /**
- * Sets the focused resources.
- */
- void setFocusResource(IResource[] resources) {
- focusResource = resources;
- }
-
- /**
- * @return
- * <ul>
- * <li><code>true</code> if the filter is enabled.</li>
- * <li><code>false</code> if the filter is not enabled.</li>
- * </ul>
- */
- boolean isEnabled() {
- return enabled;
- }
-
- /**
- * @return
- * <ul>
- * <li><code>true</code> if filtering by marker limit is enabled.</li>
- * <li><code>false</code> if filtering by marker limit is not enabled.</li>
- * </ul>
- */
- boolean getFilterOnMarkerLimit() {
- return filterOnMarkerLimit;
- }
-
- /**
- * @return the root marker types.
- */
- List getRootTypes() {
- return rootTypes;
- }
-
- /**
- * @return the selected marker types to be displayed.
- */
- List getSelectedTypes() {
- return selectedTypes;
- }
-
- /**
- * @return the current working set or <code>null</code> if no working set is defined.
- */
- IWorkingSet getWorkingSet() {
- return workingSet;
- }
-
- /**
- * Sets the enablement state of the filter.
- */
- void setEnabled(boolean enabled) {
- this.enabled = enabled;
- }
-
- /**
- * Sets the enablement state of filtering by marker limit.
- */
- void setFilterOnMarkerLimit(boolean filterOnMarkerLimit) {
- this.filterOnMarkerLimit = filterOnMarkerLimit;
- }
-
- /**
- * Sets the selected marker types to be displayed. The List <b>MUST ONLY</b> contain
- * <code>MarkerType</code> objects.
- */
- void setSelectedTypes(List selectedTypes) {
- this.selectedTypes = selectedTypes;
- }
-
- /**
- * Sets the current working set.
- */
- void setWorkingSet(IWorkingSet workingSet) {
- this.workingSet = workingSet;
- }
-
- void resetState() {
- enabled = DEFAULT_ACTIVATION_STATUS;
- filterOnMarkerLimit = DEFAULT_FILTER_ON_MARKER_LIMIT;
- markerLimit = DEFAULT_MARKER_LIMIT;
- onResource = DEFAULT_ON_RESOURCE;
- selectedTypes.clear();
- addAllSubTypes();
- workingSet = null;
- }
-
- public void restoreState(IDialogSettings dialogSettings) {
- resetState();
- IDialogSettings settings = dialogSettings.getSection(TAG_DIALOG_SECTION);
-
- if (settings != null) {
- String setting = settings.get(TAG_ENABLED);
-
- if (setting != null)
- enabled = Boolean.valueOf(setting).booleanValue();
-
- setting = settings.get(TAG_FILTER_ON_MARKER_LIMIT);
-
- if (setting != null)
- filterOnMarkerLimit = Boolean.valueOf(setting).booleanValue();
-
- setting = settings.get(TAG_MARKER_LIMIT);
-
- if (setting != null)
- try {
- markerLimit = Integer.parseInt(setting);
- }
- catch (NumberFormatException eNumberFormat) {
- }
-
- setting = settings.get(TAG_ON_RESOURCE);
-
- if (setting != null)
- try {
- onResource = Integer.parseInt(setting);
- }
- catch (NumberFormatException eNumberFormat) {
- }
-
- setting = settings.get(TAG_SELECTED_TYPES);
-
- if (setting != null) {
- selectedTypes.clear();
- StringTokenizer stringTokenizer = new StringTokenizer(setting);
-
- while (stringTokenizer.hasMoreTokens()) {
- MarkerType markerType = typesModel.getType(stringTokenizer.nextToken(TAG_TYPES_DELIMITER));
-
- if (markerType != null && !selectedTypes.contains(markerType))
- selectedTypes.add(markerType);
- }
- }
-
- setting = settings.get(TAG_WORKING_SET);
-
- if (setting != null)
- workingSet = WorkbenchPlugin.getDefault().getWorkingSetManager().getWorkingSet(setting);
- }
- }
-
- public void saveState(IDialogSettings dialogSettings) {
- if (dialogSettings != null) {
- IDialogSettings settings = dialogSettings.getSection(TAG_DIALOG_SECTION);
-
- if (settings == null)
- settings = dialogSettings.addNewSection(TAG_DIALOG_SECTION);
-
- settings.put(TAG_ENABLED, enabled);
- settings.put(TAG_FILTER_ON_MARKER_LIMIT, filterOnMarkerLimit);
- settings.put(TAG_MARKER_LIMIT, markerLimit);
- settings.put(TAG_ON_RESOURCE, onResource);
-
- String markerTypeIds = ""; //$NON-NLS-1$
-
- for (int i = 0; i < selectedTypes.size(); i++) {
- MarkerType markerType = (MarkerType) selectedTypes.get(i);
- markerTypeIds += markerType.getId() + TAG_TYPES_DELIMITER;
- }
-
- settings.put(TAG_SELECTED_TYPES, markerTypeIds);
-
- if (workingSet != null)
- settings.put(TAG_WORKING_SET, workingSet.getName());
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerLabelProvider.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerLabelProvider.java
deleted file mode 100644
index adbbe70..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerLabelProvider.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-class MarkerLabelProvider extends LabelProvider implements ITableLabelProvider {
-
- IField[] properties;
-
- public MarkerLabelProvider(IField[] properties) {
- this.properties = properties;
- }
-
- public Image getColumnImage(Object element, int columnIndex) {
- if (element == null || !(element instanceof IMarker) || properties == null || columnIndex >= properties.length)
- return null;
-
- return properties[columnIndex].getImage(element);
- }
-
- public String getColumnText(Object element, int columnIndex) {
- if (element == null || !(element instanceof IMarker) || properties == null || columnIndex >= properties.length)
- return ""; //$NON-NLS-1$
-
- return properties[columnIndex].getValue(element);
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerRegistry.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerRegistry.java
deleted file mode 100644
index 0020063..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerRegistry.java
+++ /dev/null
@@ -1,275 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IMarkerDelta;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.runtime.CoreException;
-
-
-/**
- * Registry that tracks resource markers and maintains a sorted, filtered list of the markers.
- * Notifies listeners of changes in these markers.
- */
-public class MarkerRegistry implements IResourceChangeListener, ITableViewContentProvider {
-
- private IFilter filter;
- private IResource input;
- private String[] types;
-
- private List listeners;
-
- public MarkerRegistry() {
- listeners = new ArrayList();
- types = new String[0];
- }
-
- /**
- * @return a filtered, sorted list of markers.
- */
- public Object[] getElements() {
- Object[] elements = getUnfilteredElements();
- if (filter != null) {
- Object[] filteredItems = filter.filter(elements);
- return filteredItems;
- }
- return elements;
- }
-
- /**
- * @return an unfiltered list of elements
- */
- public Object[] getUnfilteredElements() {
- if (input == null) {
- return new Object[0];
- }
- List elements = new ArrayList();
- for (int i = 0; i < types.length; i++) {
- try {
- IMarker[] newMarkers = input.findMarkers(types[i], true, IResource.DEPTH_INFINITE);
- elements.addAll(Arrays.asList(newMarkers));
- }
- catch (CoreException e) {
- }
- }
- return elements.toArray();
- }
-
- /**
- * @return the registry's filter or <code>null</code> if no filter has been assigned
- * to the registry.
- */
- public IFilter getFilter() {
- return filter;
- }
-
- /**
- * @return the registry's input resource
- */
- public IResource getInput() {
- return input;
- }
-
- /**
- * Sets the registry's filter
- *
- * @param filter
- */
- public void setFilter(IFilter filter) {
- if (this.filter == null || !this.filter.equals(filter)) {
- this.filter = filter;
- }
- }
-
- /**
- * Sets the registry's input resource
- *
- * @param resource
- */
- public void setInput(IResource resource) {
- if (input != null) {
- if (input.equals(resource))
- return;
- input.getWorkspace().removeResourceChangeListener(this);
- }
- input = resource;
- if (input != null)
- resource.getWorkspace().addResourceChangeListener(this);
- }
-
- /**
- * @return the base marker types that the registry is tracking
- */
- public String[] getTypes() {
- return types;
- }
-
- /**
- * Sets the base marker types to track. By default the registry will search for
- * all markers of these types and their subtypes.
- *
- * @param types
- */
- public void setTypes(String[] types) {
- if (types == null)
- this.types = new String[0];
- else
- this.types = types;
- }
-
- /**
- * Convenience method used if only interested in one base marker type.
- *
- * @param type
- */
- public void setType(String type) {
- setTypes(new String[] { type });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- */
- public void resourceChanged(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);
- //filter additions and changes but not removals since they have already been deleted
- filterList(additions);
- filterList(changes);
- notifyListeners(additions, removals, changes);
- }
-
- /**
- * Recursively walks over the resource delta and gathers all marker deltas. Marker
- * deltas are placed into one of the two given lists depending on the type of delta
- * (add or remove).
- */
- private 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: {
- boolean added = false;
- for (int j = 0; j < types.length && !added; j++) {
- if (markerDelta.isSubtypeOf(types[j])) {
- additions.add(marker);
- added = true;
- }
- }
- break;
- }
- case IResourceDelta.REMOVED: {
- boolean added = false;
- for (int j = 0; j < types.length && !added; j++) {
- if (markerDelta.isSubtypeOf(types[j])) {
- removals.add(marker);
- added = true;
- }
- }
- break;
- }
- case IResourceDelta.CHANGED: {
- boolean added = false;
- for (int j = 0; j < types.length && !added; j++) {
- if (markerDelta.isSubtypeOf(types[j])) {
- changes.add(marker);
- added = true;
- }
- }
- break;
- }
- }
- }
-
- //recurse on child deltas
- IResourceDelta[] children = delta.getAffectedChildren();
- for (int i = 0; i < children.length; i++) {
- getMarkerDeltas(children[i], additions, removals, changes);
- }
- }
-
- private void notifyListeners(List additions, List removals, List changes) {
- if (listeners == null)
- return;
- for (int i = 0; i < listeners.size(); i++) {
- IItemsChangedListener listener = (IItemsChangedListener) listeners.get(i);
- listener.itemsChanged(additions, removals, changes);
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.ITableViewContentProvider#addItemsChangedListener(org.eclipse.ui.views.internal.tableview.IItemsChangedListener)
- */
- public void addItemsChangedListener(IItemsChangedListener listener) {
- if (listeners == null || listener == null)
- return;
- if (!listeners.contains(listener))
- listeners.add(listener);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.ITableViewContentProvider#removeItemsChangedListener(org.eclipse.ui.views.internal.tableview.IItemsChangedListener)
- */
- public void removeItemsChangedListener(IItemsChangedListener listener) {
- if (listeners == null || listener == null)
- return;
- listeners.remove(listener);
- }
-
- /**
- * @return
- */
- public int getItemCount() {
- //TODO do this more efficiently
- return getElements().length;
- }
-
- public int getRawItemCount() {
- //TODO do this more efficiently
- return getUnfilteredElements().length;
- }
-
- private void filterList(List list) {
- if (filter == null || list == null) {
- return;
- }
- int i = 0;
- while (i < list.size()) {
- if (filter.select(list.get(i))) {
- i++;
- }
- else {
- list.remove(i);
- }
- }
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerType.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerType.java
deleted file mode 100644
index 4bf717e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerType.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Represents a marker type.
- */
-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()]);
- }
-
- public MarkerType[] getAllSubTypes() {
- List subTypes = new ArrayList();
- addSubTypes(subTypes, this);
- MarkerType[] subs = new MarkerType[subTypes.size()];
- subTypes.toArray(subs);
- return subs;
- }
-
- private void addSubTypes(List list, MarkerType superType) {
- MarkerType[] subTypes = superType.getSubtypes();
- for (int i = 0; i < subTypes.length; i++) {
- MarkerType subType = subTypes[i];
- if (!list.contains(subType)) {
- list.add(subType);
- }
- addSubTypes(list, subType);
- }
- }
-
- /**
- * 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;
- }
-
- public boolean equals(Object other) {
- if (!(other instanceof MarkerType)) {
- return false;
- }
- return ((MarkerType) other).getId().equals(this.id);
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerTypesModel.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerTypesModel.java
deleted file mode 100644
index d39accc..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerTypesModel.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-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.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-
-/**
- * Maintains a model of all known marker types.
- */
-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/markers/internal/MarkerView.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerView.java
deleted file mode 100644
index 95c202f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/MarkerView.java
+++ /dev/null
@@ -1,552 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.actions.SelectionProviderAction;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.part.MarkerTransfer;
-import org.eclipse.ui.views.navigator.ShowInNavigatorAction;
-import org.eclipse.ui.views.tasklist.ITaskListResourceAdapter;
-
-public abstract class MarkerView extends TableView {
-
- private static final String TAG_SELECTION = "selection"; //$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_ID = "id"; //$NON-NLS-1$
-
- protected IResource[] focusResources;
-
- private TableViewer viewer;
- private MarkerFilter filter;
- private Clipboard clipboard;
-
- protected ActionCopyMarker copyAction;
- protected ActionPasteMarker pasteAction;
- protected SelectionProviderAction revealAction;
- protected SelectionProviderAction openAction;
- protected SelectionProviderAction showInNavigatorAction;
- protected SelectionProviderAction deleteAction;
- protected SelectionProviderAction selectAllAction;
- protected SelectionProviderAction propertiesAction;
-
- protected Composite compositeMarkerLimitExceeded;
- protected StackLayout stackLayout = new StackLayout();
-
- private IItemsChangedListener itemsListener = new IItemsChangedListener() {
- public void itemsChanged(List additions, List removals, List changes) {
- MarkerView.this.itemsChanged(additions, removals, changes);
- }
- };
-
- private ISelectionListener focusListener = new ISelectionListener() {
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- MarkerView.this.focusSelectionChanged(part, selection);
- }
- };
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#init(org.eclipse.ui.IViewSite, org.eclipse.ui.IMemento)
- */
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- getSite().getPage().addSelectionListener(focusListener);
- getRegistry().addItemsChangedListener(itemsListener);
-
- clipboard = new Clipboard(parent.getDisplay());
-
- super.createPartControl(parent);
-
- initDragAndDrop();
-
- compositeMarkerLimitExceeded = new Composite(parent, SWT.NONE);
- compositeMarkerLimitExceeded.setLayout(new GridLayout());
- Label labelMarkerLimitExceeded =
- new Label(compositeMarkerLimitExceeded, SWT.WRAP);
- labelMarkerLimitExceeded.setText(Messages.getString("markerLimitExceeded.title")); //$NON-NLS-1$
- parent.setLayout(stackLayout);
-
- checkMarkerLimit();
- updateTitle();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#dispose()
- */
- public void dispose() {
- super.dispose();
- getRegistry().removeItemsChangedListener(itemsListener);
- getSite().getPage().removeSelectionListener(focusListener);
-
- //dispose of selection provider actions
- openAction.dispose();
- copyAction.dispose();
- selectAllAction.dispose();
- deleteAction.dispose();
- revealAction.dispose();
- showInNavigatorAction.dispose();
- propertiesAction.dispose();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#createActions()
- */
- protected void createActions() {
- viewer = getViewer();
- revealAction = new ActionRevealMarker(this, viewer);
- openAction = new ActionOpenMarker(this, viewer);
- copyAction = new ActionCopyMarker(this, viewer);
- copyAction.setClipboard(clipboard);
- copyAction.setProperties(getFields());
- pasteAction = new ActionPasteMarker(this, viewer);
- pasteAction.setClipboard(clipboard);
- pasteAction.setPastableTypes(getRegistry().getTypes());
- deleteAction = new ActionRemoveMarker(this, viewer);
- selectAllAction = new ActionSelectAll(viewer, getRegistry());
- showInNavigatorAction = new ShowInNavigatorAction(getViewSite().getPage(), viewer);
- propertiesAction = new ActionMarkerProperties(this, viewer);
-
- super.createActions();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#initToolBar(org.eclipse.jface.action.IToolBarManager)
- */
- protected void initToolBar(IToolBarManager tbm) {
- tbm.add(deleteAction);
- tbm.add(getAction(TableView.FILTERS_ACTION_ID));
- tbm.update(false);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#registerGlobalActions(org.eclipse.ui.IActionBars)
- */
- protected void registerGlobalActions(IActionBars actionBars) {
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.COPY, copyAction);
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.PASTE, pasteAction);
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.DELETE, deleteAction);
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.SELECT_ALL, selectAllAction);
- actionBars.setGlobalActionHandler(IWorkbenchActionConstants.PROPERTIES, propertiesAction);
- }
-
- 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) {
- }
- };
- getViewer().addDragSupport(operations, transferTypes, listener);
- }
-
- /**
- * The user is attempting to drag marker data. Add the appropriate
- * data to the event depending on the transfer type.
- */
- private void performDragSetData(DragSourceEvent event) {
- if (MarkerTransfer.getInstance().isSupportedType(event.dataType)) {
- event.data = ((IStructuredSelection) getViewer().getSelection()).toArray();
- return;
- }
- if (TextTransfer.getInstance().isSupportedType(event.dataType)) {
- List selection = ((IStructuredSelection) getViewer().getSelection()).toList();
- try {
- IMarker[] markers = new IMarker[selection.size()];
- selection.toArray(markers);
- if (markers != null) {
- event.data = copyAction.createMarkerReport(markers);
- }
- }
- catch (ArrayStoreException e) {
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#fillContextMenu(org.eclipse.jface.action.IMenuManager)
- */
- protected void fillContextMenu(IMenuManager manager) {
- if (manager == null)
- return;
- manager.add(openAction);
- manager.add(showInNavigatorAction);
- manager.add(new Separator());
- manager.add(copyAction);
- pasteAction.updateEnablement();
- manager.add(pasteAction);
- manager.add(deleteAction);
- manager.add(selectAllAction);
- fillContextMenuAdditions(manager);
- manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- manager.add(new Separator());
- manager.add(propertiesAction);
- }
-
- protected void fillContextMenuAdditions(IMenuManager manager) {
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#getFilter()
- */
- protected IFilter getFilter() {
- if (filter == null) {
- filter = new MarkerFilter(getRootTypes());
- filter.restoreState(getDialogSettings());
- }
- return filter;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#getContentProvider()
- */
- protected ITableViewContentProvider getContentProvider() {
- return getRegistry();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#handleKeyPressed(org.eclipse.swt.events.KeyEvent)
- */
- protected void handleKeyPressed(KeyEvent event) {
- if (event.character == SWT.DEL && event.stateMask == 0 && deleteAction.isEnabled()) {
- deleteAction.run();
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#handleOpenEvent(org.eclipse.jface.viewers.OpenEvent)
- */
- protected void handleOpenEvent(OpenEvent event) {
- openAction.run();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#saveSelection(org.eclipse.ui.IMemento)
- */
- protected void saveSelection(IMemento memento) {
- IStructuredSelection selection = (IStructuredSelection) getViewer().getSelection();
- IMemento selectionMem = memento.createChild(TAG_SELECTION);
- for (Iterator iterator = selection.iterator(); iterator.hasNext();) {
- IMarker marker = (IMarker) iterator.next();
- IMemento elementMem = selectionMem.createChild(TAG_MARKER);
- elementMem.putString(TAG_RESOURCE, marker.getResource().getFullPath().toString());
- elementMem.putString(TAG_ID, String.valueOf(marker.getId()));
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#restoreSelection(org.eclipse.ui.IMemento)
- */
- protected IStructuredSelection restoreSelection(IMemento memento) {
- if (memento == null) {
- return new StructuredSelection();
- }
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- IMemento selectionMemento = memento.getChild(TAG_SELECTION);
- if (selectionMemento == null) {
- return new StructuredSelection();
- }
- ArrayList selectionList = new ArrayList();
- IMemento[] markerMems = selectionMemento.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) {
- }
- }
- return new StructuredSelection(selectionList);
- }
-
- protected abstract String[] getRootTypes();
-
- protected abstract MarkerRegistry getRegistry();
-
- protected Dialog getFiltersDialog() {
- IFilter filter = getFilter();
- if (filter != null && filter instanceof MarkerFilter) {
- return new DialogMarkerFilter(getSite().getShell(), (MarkerFilter) filter);
- }
- return null;
- }
-
- /**
- * @param part
- * @param selection
- */
- protected void focusSelectionChanged(IWorkbenchPart part, ISelection selection) {
- List resources = new ArrayList();
- if (part instanceof IEditorPart) {
- IEditorInput input = ((IEditorPart) part).getEditorInput();
- if (input instanceof FileEditorInput) {
- resources.add(((FileEditorInput) input).getFile());
- }
- }
- else {
- if (selection instanceof IStructuredSelection) {
- for (Iterator iterator = ((IStructuredSelection) selection).iterator(); iterator.hasNext();) {
- Object object = iterator.next();
- if (object instanceof IAdaptable) {
- ITaskListResourceAdapter taskListResourceAdapter;
- Object adapter =
- ((IAdaptable) object).getAdapter(
- ITaskListResourceAdapter.class);
- if (adapter != null
- && adapter instanceof ITaskListResourceAdapter) {
- taskListResourceAdapter =
- (ITaskListResourceAdapter) adapter;
- } else {
- taskListResourceAdapter =
- DefaultMarkerResourceAdapter.getDefault();
- }
-
- IResource resource =
- taskListResourceAdapter.getAffectedResource(
- (IAdaptable) object);
- if (resource != null) {
- resources.add(resource);
- }
- }
- }
- }
- }
- IResource[] focus = new IResource[resources.size()];
- resources.toArray(focus);
- updateFocusResource(focus);
- }
-
- void updateFocusResource(IResource[] resources) {
- boolean updateNeeded = updateNeeded(focusResources, resources);
- if (getFilter() != null && getFilter() instanceof MarkerFilter) {
- ((MarkerFilter) getFilter()).setFocusResource(resources);
- }
- focusResources = resources;
- if (updateNeeded) {
- filtersChanged();
- }
- }
-
- private boolean updateNeeded(IResource[] oldResources, IResource[] newResources) {
- //determine if an update if refiltering is required
- IFilter iFilter = getFilter();
- if (iFilter == null) {
- return false;
- }
- MarkerFilter filter = (MarkerFilter) iFilter;
- int onResource = filter.getOnResource();
- if (onResource == MarkerFilter.ON_ANY_RESOURCE || onResource == MarkerFilter.ON_WORKING_SET) {
- return false;
- }
- if (newResources == null || newResources.length < 1) {
- return false;
- }
- if (oldResources == null || oldResources.length < 1) {
- return true;
- }
- if (Arrays.equals(oldResources, newResources)) {
- return false;
- }
- if (onResource == MarkerFilter.ON_ANY_RESOURCE_OF_SAME_PROJECT) {
- List oldProjects = new ArrayList(newResources.length);
- List newProjects = new ArrayList(newResources.length);
- for (int i = 0; i < oldResources.length; i++) {
- IProject project = oldResources[i].getProject();
- if (!oldProjects.contains(project)) {
- oldProjects.add(project);
- }
- }
- for (int i = 0; i < newResources.length; i++) {
- IProject project = newResources[i].getProject();
- if (!newProjects.contains(project)) {
- newProjects.add(project);
- }
- }
- if (oldProjects.size() == newProjects.size()) {
- for (int i = 0; i < oldProjects.size(); i++) {
- if (!newProjects.contains(oldProjects.get(i))) {
- return true;
- }
- }
- }
- else {
- return true;
- }
- }
- else {
- return true;
- }
- return false;
- }
-
- /**
- * @param additions
- * @param removals
- * @param changes
- */
- protected void itemsChanged(List additions, List removals, List changes) {
- getSite().getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- checkMarkerLimit();
- updateTitle();
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.TableView#filtersChanged()
- */
- protected void filtersChanged() {
- super.filtersChanged();
- getSite().getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- checkMarkerLimit();
- updateTitle();
- }
- });
- }
-
- void checkMarkerLimit() {
- IFilter iFilter = getFilter();
-
- if (iFilter == null || !(iFilter instanceof MarkerFilter))
- return;
-
- MarkerFilter filter = (MarkerFilter) iFilter;
- int itemCount = getRegistry().getItemCount();
-
- if (getFilter() == null || !filter.getFilterOnMarkerLimit() || itemCount <= filter.getMarkerLimit()) {
- if (stackLayout.topControl != viewer.getTable()) {
- stackLayout.topControl = viewer.getTable();
- TableViewer viewer = getViewer();
-
- if (viewer != null) {
- Table table = viewer.getTable();
-
- if (table != null && !table.isDisposed()) {
- Composite parent = table.getParent();
-
- if (parent != null && !parent.isDisposed())
- parent.layout();
- }
- }
- }
- }
- else {
- if (stackLayout.topControl != compositeMarkerLimitExceeded) {
- stackLayout.topControl = compositeMarkerLimitExceeded;
- TableViewer viewer = getViewer();
-
- if (viewer != null) {
- Table table = viewer.getTable();
-
- if (table != null && !table.isDisposed()) {
- Composite parent = table.getParent();
-
- if (parent != null && !parent.isDisposed())
- parent.layout();
- }
- }
- }
- }
- }
-
- void updateTitle() {
- String currentTitle = getTitle();
- String viewName = getConfigurationElement().getAttribute("name"); //$NON-NLS-1$
- String status = ""; //$NON-NLS-1$
- int filteredCount = getRegistry().getItemCount();
- int totalCount = getRegistry().getRawItemCount();
- if (filteredCount == totalCount) {
- status = Messages.format("filter.itemsMessage", new Object[] {new Integer(totalCount)}); //$NON-NLS-1$
- }
- else {
- status = Messages.format("filter.matchedMessage", new Object[] {new Integer(filteredCount), new Integer(totalCount)}); //$NON-NLS-1$
- }
- String newTitle = Messages.format("view.title", new String[] {viewName, status}); //$NON-NLS-1$
- if (!newTitle.equals(currentTitle)) {
- setTitle(newTitle);
- }
- }
-
- public IStructuredSelection getSelection() {
- return (IStructuredSelection) viewer.getSelection();
- }
-
- public void setSelection(IStructuredSelection structuredSelection, boolean reveal) {
- for (Iterator i = structuredSelection.iterator(); i.hasNext();)
- if (!(i.next() instanceof IMarker))
- return;
-
- if (viewer != null)
- viewer.setSelection(structuredSelection, reveal);
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/Messages.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/Messages.java
deleted file mode 100644
index 4a1dd46..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/Messages.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.text.MessageFormat;
-import java.util.ResourceBundle;
-
-public class Messages {
-
- private final static ResourceBundle bundle = ResourceBundle.getBundle(Messages.class.getName());
-
- private Messages() {
- super();
- }
-
- public static String format(String key, Object[] args) {
- return MessageFormat.format(getString(key), args);
- }
-
- public static String getString(String key) {
- return Util.getString(bundle, key);
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/Messages.properties b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/Messages.properties
deleted file mode 100644
index e777e63..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/Messages.properties
+++ /dev/null
@@ -1,142 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-
-sortAction.title = &Sorting...
-filtersAction.title = &Filters...
-
-sortDialog.title = Sorting
-sortDialog.label = Sort by:
-sortDialog.columnLabel = &{0}.
-sortDirectionAscending.text = &Ascending
-sortDirectionDescending.text = &Descending
-restoreDefaults.text = Restore &Defaults
-
-Error = Error:
-
-columnHeader.message = Description
-columnHeader.location = Location
-columnHeader.lineNumber = Location
-columnHeader.charStart = Char Start
-columnHeader.charEnd = Char End
-columnHeader.transient = Transient
-columnHeader.userEditable = User Editable
-columnHeader.severity =
-columnHeader.priority =
-columnHeader.done =
-
-description.message = Description
-description.resource = Resource
-description.folder = In Folder
-description.lineNumber = Location
-description.creationTime = Creation Time
-description.priority = Priority
-description.completion = Completion
-
-label.lineNumber = line {0}
-
-openAction.title = &Go To
-copyAction.title = &Copy
-pasteAction.title = &Paste
-deleteAction.title = &Delete
-selectAllAction.title = Select &All
-propertiesAction.title = P&roperties
-
-filtersDialog.title = Filters
-filtersDialog.onOff = &Enabled
-filtersDialog.limitVisibleMarkersTo = Limit visi&ble items to:
-filtersDialog.showItemsOfType = Show items of &type:
-filtersDialog.anyResource = On any &resource
-filtersDialog.anyResourceInSameProject = On any resource in same &project
-filtersDialog.selectedResource = On selected resource &only
-filtersDialog.selectedAndChildren = On selected resource and its &children
-filtersDialog.workingSet = On wor&king set: {0}
-filtersDialog.workingSetSelect = &Select...
-filtersDialog.noWorkingSet = On wor&king set: <no working set selected>
-filtersDialog.selectAll = Select &All
-filtersDialog.deselectAll = &Deselect All
-filtersDialog.type.columnHeader = Type
-filtersDialog.superTypecolumnHeader = Parent types
-filtersDialog.titleMarkerLimitInvalid = Error
-filtersDialog.messageMarkerLimitInvalid = The visible item limit must be a positive integer.
-filtersDialog.descriptionLabel = Where &description
-filtersDialog.contains = contains
-filtersDialog.doesNotContain = does not contain
-filtersDialog.severityLabel = Where se&verity is:
-filtersDialog.severityError = &Error
-filtersDialog.severityWarning = Warnin&g
-filtersDialog.severityInfo = &Info
-filtersDialog.priorityLabel = Where priorit&y is:
-filtersDialog.priorityHigh = &High
-filtersDialog.priorityNormal = &Normal
-filtersDialog.priorityLow = Lo&w
-filtersDialog.statusLabel = Where stat&us is:
-filtersDialog.statusComplete = Co&mpleted
-filtersDialog.statusIncomplete = Not Comp&leted
-
-propertiesDialog.creationTime.text = Creation &Time:
-propertiesDialog.description.text = &Description:
-propertiesDialog.folder.text = In &Folder:
-propertiesDialog.location.text = &Location:
-propertiesDialog.resource.text = On &Resource:
-propertiesDialog.title = Properties
-propertiesDialog.severityLabel = &Severity: {0}
-propertiesDialog.errorLabel = Error
-propertiesDialog.warningLabel = Warning
-propertiesDialog.infoLabel = Info
-propertiesDialog.noseverityLabel = Not defined
-propertiesDialog.priority = &Priority
-propertiesDialog.priorityHigh = High
-propertiesDialog.priorityNormal = Normal
-propertiesDialog.priorityLow = Low
-propertiesDialog.completed = &Completed
-
-restoreDefaults.text = Restore &Defaults
-
-markerLimitExceeded.title = There are too many items to display.\n\
- To see items in this window, adjust the filter settings.
-
-filter.matchedMessage = Filter matched {0} of {1} items
-filter.itemsMessage = {0} items
-view.title = {0} ({1})
-
-errorModifyingBookmark = Error Modifying Bookmark
-errorModifyingTask = Error Modifying Task
-
-problemSeverity.description = Severity
-
-deleteCompletedAction.title = Delete Completed &Tasks
-
-filtersAction.title = &Filters...
-
-markCompletedAction.title = &Mark Completed
-
-resolveMarkerAction.title = &Quick Fix
-resolveMarkerAction.dialogTitle = Quick Fix
-resolveMarkerAction.noResolutionsLabel = There are no quick fixes available for the selected marker.
-
-showAction.title = &Open on new problems
-
-deleteCompletedTasks.dialogTitle = Delete Completed Tasks
-deleteCompletedTasks.noneCompleted = No user-editable completed tasks to delete.
-deleteCompletedTasks.permanentPlural = Do you want to permanently delete the {0} completed tasks?
-deleteCompletedTasks.permanentSingular = Do you want to permanently delete the completed task?
-deleteCompletedTasks.errorMessage = Error deleting completed tasks
-
-addGlobalTaskAction.title = &Add Task
-
-addGlobalTaskDialog.title = Add Task
-
-completion.description = Completed
-priority.description = Priority
-
-priority.high = High
-priority.normal = Normal
-priority.low = Low
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ProblemFilter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ProblemFilter.java
deleted file mode 100644
index 431408c..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/ProblemFilter.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.dialogs.IDialogSettings;
-
-public class ProblemFilter extends MarkerFilter {
-
- private static final String TAG_CONTAINS = "contains"; //$NON-NLS-1$
- private static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
- private static final String TAG_DIALOG_SECTION = "filter"; //$NON-NLS-1$
- private static final String TAG_SELECT_BY_SEVERITY = "selectBySeverity"; //$NON-NLS-1$
- private static final String TAG_SEVERITY = "severity"; //$NON-NLS-1$
-
- final static boolean DEFAULT_CONTAINS = true;
- final static String DEFAULT_DESCRIPTION = ""; //$NON-NLS-1$
- final static boolean DEFAULT_SELECT_BY_SEVERITY = false;
- final static int DEFAULT_SEVERITY = 0;
-
- final static int SEVERITY_ERROR = 1 << 2;
- final static int SEVERITY_WARNING = 1 << 1;
- final static int SEVERITY_INFO = 1 << 0;
-
- private boolean contains;
- private String description;
- private boolean selectBySeverity;
- private int severity;
-
- public ProblemFilter() {
- super(new String[] { IMarker.PROBLEM });
- }
-
- public boolean select(Object item) {
- return isEnabled() ? super.select(item) && selectByDescription(item) && selectBySeverity(item) : true;
- }
-
- private boolean selectByDescription(Object item) {
- if (!(item instanceof IMarker) || description == null || description.equals("")) //$NON-NLS-1$
- return true;
-
- IMarker marker = (IMarker) item;
- String markerDescription = marker.getAttribute(IMarker.MESSAGE, DEFAULT_DESCRIPTION); //$NON-NLS-1$
- int index = markerDescription.indexOf(description);
- return contains ? (index >= 0) : (index < 0);
- }
-
- private boolean selectBySeverity(Object item) {
- if (item instanceof IMarker && selectBySeverity) {
- int markerSeverity = ((IMarker) item).getAttribute(IMarker.SEVERITY, -1);
-
- if (markerSeverity == IMarker.SEVERITY_ERROR)
- return (severity & SEVERITY_ERROR) > 0;
- else if (markerSeverity == IMarker.SEVERITY_WARNING)
- return (severity & SEVERITY_WARNING) > 0;
- else if (markerSeverity == IMarker.SEVERITY_INFO)
- return (severity & SEVERITY_INFO) > 0;
- }
-
- return true;
- }
-
- public boolean getContains() {
- return contains;
- }
-
- public String getDescription() {
- return description;
- }
-
- public boolean getSelectBySeverity() {
- return selectBySeverity;
- }
-
- public int getSeverity() {
- return severity;
- }
-
- public void setContains(boolean contains) {
- this.contains = contains;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setSelectBySeverity(boolean selectBySeverity) {
- this.selectBySeverity = selectBySeverity;
- }
-
- public void setSeverity(int severity) {
- this.severity = severity;
- }
-
- public void resetState() {
- super.resetState();
- contains = DEFAULT_CONTAINS;
- description = DEFAULT_DESCRIPTION;
- selectBySeverity = DEFAULT_SELECT_BY_SEVERITY;
- severity = DEFAULT_SEVERITY;
- }
-
- public void restoreState(IDialogSettings dialogSettings) {
- super.restoreState(dialogSettings);
- IDialogSettings settings = dialogSettings.getSection(TAG_DIALOG_SECTION);
-
- if (settings != null) {
- String setting = settings.get(TAG_CONTAINS);
-
- if (setting != null)
- contains = Boolean.valueOf(setting).booleanValue();
-
- setting = settings.get(TAG_DESCRIPTION);
-
- if (setting != null)
- description = new String(setting);
-
- setting = settings.get(TAG_SELECT_BY_SEVERITY);
-
- if (setting != null)
- selectBySeverity = Boolean.valueOf(setting).booleanValue();
-
- setting = settings.get(TAG_SEVERITY);
-
- if (setting != null)
- try {
- severity = Integer.parseInt(setting);
- }
- catch (NumberFormatException eNumberFormat) {
- }
- }
- }
-
- public void saveState(IDialogSettings dialogSettings) {
- super.saveState(dialogSettings);
-
- if (dialogSettings != null) {
- IDialogSettings settings = dialogSettings.getSection(TAG_DIALOG_SECTION);
-
- if (settings == null)
- settings = dialogSettings.addNewSection(TAG_DIALOG_SECTION);
-
- settings.put(TAG_CONTAINS, contains);
- settings.put(TAG_DESCRIPTION, description);
- settings.put(TAG_SELECT_BY_SEVERITY, selectBySeverity);
- settings.put(TAG_SEVERITY, severity);
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableContentProvider.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableContentProvider.java
deleted file mode 100644
index d1225a3..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableContentProvider.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.IWorkbenchPartSite;
-
-
-class TableContentProvider implements IStructuredContentProvider, IItemsChangedListener {
-
- private ITableViewContentProvider provider;
- private IWorkbenchPartSite site;
- private TableViewer viewer;
-
- public TableContentProvider(IWorkbenchPartSite site, ITableViewContentProvider provider) {
- this.site = site;
- this.provider = provider;
- provider.addItemsChangedListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object)
- */
- public Object[] getElements(Object inputElement) {
- return provider.getElements();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
- provider.removeItemsChangedListener(this);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- if (viewer != null && viewer instanceof TableViewer) {
- this.viewer = (TableViewer) viewer;
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.views.internal.tableview.IItemsChangedListener#itemsChanged(java.util.List, java.util.List, java.util.List)
- */
- public void itemsChanged(final List additions, final List removals, final List changes) {
- if (viewer != null) {
- site.getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- updateViewer(additions, removals, changes);
- }
- });
- }
- }
-
- /**
- * 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;
- }
-
- ctrl.setRedraw(false);
-
- //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);
- }
-
- ctrl.setRedraw(true);
- }
-
-}
\ No newline at end of file
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableSortAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableSortAction.java
deleted file mode 100644
index 38d1357..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableSortAction.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.window.Window;
-
-
-public class TableSortAction extends Action {
-
- private TableView view;
- private TableSortDialog dialog;
-
- public TableSortAction(TableView view, TableSortDialog dialog) {
- super(Messages.getString("sortAction.title")); //$NON-NLS-1$
- this.view = view;
- this.dialog = dialog;
- setEnabled(true);
- }
-
- public void run() {
- if (dialog.open() == Window.OK && dialog.isDirty()) {
- view.sorterChanged();
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableSortDialog.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableSortDialog.java
deleted file mode 100644
index 2b2d94d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableSortDialog.java
+++ /dev/null
@@ -1,291 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-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.Button;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-
-public class TableSortDialog extends Dialog {
-
- private TableSorter sorter;
- private Combo[] priorityCombos;
- private String[] propertyText;
- private IField[] properties;
- private Button[] ascendingButtons;
- private Button[] descendingButtons;
- private boolean dirty;
- private final Comparator columnComparator = new Comparator() {
- public int compare(Object arg0, Object arg1) {
- int index0 = -1;
- int index1 = -1;
- for (int i = 0; i < propertyText.length; i++) {
- if (propertyText[i].equals(arg0))
- index0 = i;
- if (propertyText[i].equals(arg1))
- index1 = i;
- }
- return index0 - index1;
- }
- };
-
-
- public TableSortDialog(Shell parentShell, TableSorter sorter) {
- super(parentShell);
- this.sorter = sorter;
- dirty = false;
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(Messages.getString("sortDialog.title")); //$NON-NLS-1$
- }
-
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- Composite composite = (Composite) super.createDialogArea(parent);
- if (sorter == null)
- return composite;
-
- createPrioritiesArea(composite);
- createRestoreDefaultsButton(composite);
- createSeparatorLine(composite);
-
- return composite;
- }
-
- private void createPrioritiesArea(Composite parent) {
- Composite prioritiesArea = new Composite(parent, SWT.NULL);
- prioritiesArea.setLayout(new GridLayout(3, false));
-
- int[] priorities = sorter.getPriorities();
- int[] directions = sorter.getDirections();
-
- ascendingButtons = new Button[priorities.length];
- descendingButtons = new Button[priorities.length];
- priorityCombos = new Combo[Math.min(priorities.length, TableSorter.MAX_DEPTH)];
- initPriotityText();
-
- Label sortByLabel = new Label(prioritiesArea, SWT.NULL);
- sortByLabel.setText(Messages.getString("sortDialog.label")); //$NON-NLS-1$
- GridData data = new GridData();
- data.horizontalSpan = 3;
- sortByLabel.setLayoutData(data);
-
- for (int i = 0; i < priorityCombos.length; i++) {
- final int index = i;
- Label numberLabel = new Label(prioritiesArea, SWT.NULL);
- numberLabel.setText(Messages.format("sortDialog.columnLabel", new Object[] {new Integer(i + 1)})); //$NON-NLS-1$
-
- priorityCombos[i] = new Combo(prioritiesArea, SWT.READ_ONLY);
- priorityCombos[i].setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- Composite directionGroup = new Composite(prioritiesArea, SWT.NONE);
- directionGroup.setLayout(new GridLayout(2, false));
- ascendingButtons[i] = new Button(directionGroup, SWT.RADIO);
- ascendingButtons[i].setText(Messages.getString("sortDirectionAscending.text")); //$NON-NLS-1$
- ascendingButtons[i].addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- markDirty();
- }
- });
- descendingButtons[i] = new Button(directionGroup, SWT.RADIO);
- descendingButtons[i].setText(Messages.getString("sortDirectionDescending.text")); //$NON-NLS-1$
- descendingButtons[i].addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- markDirty();
- }
- });
-
- if (i < priorityCombos.length - 1) {
- priorityCombos[i].addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- int oldSelectionDirection = TableSorter.ASCENDING;
- if (descendingButtons[index].getSelection())
- oldSelectionDirection = TableSorter.DESCENDING;
- ArrayList oldSelectionList = new ArrayList(Arrays.asList(priorityCombos[index].getItems()));
- oldSelectionList.removeAll(Arrays.asList(priorityCombos[index + 1].getItems()));
- if (oldSelectionList.size() != 1)
- return;
- String oldSelection = (String) oldSelectionList.get(0);
- String newSelection = priorityCombos[index].getItem(priorityCombos[index].getSelectionIndex());
- if (oldSelection.equals(newSelection)) {
- return;
- }
- for (int j = index + 1; j < priorityCombos.length; j++) {
- int newSelectionIndex = priorityCombos[j].indexOf(newSelection);
- //this combo's current selection is equal to newSelection
- if (priorityCombos[j].getSelectionIndex() == newSelectionIndex) {
- priorityCombos[j].remove(newSelection);
- int insertionPoint = -1 - Arrays.binarySearch(priorityCombos[j].getItems(), oldSelection, columnComparator);
- if (insertionPoint >= 0 && insertionPoint <= priorityCombos[j].getItemCount())
- priorityCombos[j].add(oldSelection, insertionPoint);
- else
- priorityCombos[j].add(oldSelection);
- priorityCombos[j].select(priorityCombos[j].indexOf(oldSelection));
- ascendingButtons[index].setSelection(ascendingButtons[j].getSelection());
- descendingButtons[index].setSelection(descendingButtons[j].getSelection());
- ascendingButtons[j].setSelection(oldSelectionDirection == TableSorter.ASCENDING);
- descendingButtons[j].setSelection(oldSelectionDirection == TableSorter.DESCENDING);
- }
- //this combo contains newSelection
- else if (newSelectionIndex >= 0) {
- priorityCombos[j].remove(newSelection);
- int insertionPoint = -1 - Arrays.binarySearch(priorityCombos[j].getItems(), oldSelection, columnComparator);
- if (insertionPoint >= 0 && insertionPoint <= priorityCombos[j].getItemCount())
- priorityCombos[j].add(oldSelection, insertionPoint);
- else
- priorityCombos[j].add(oldSelection);
- }
- }
- markDirty();
- }
- });
- }
- else {
- priorityCombos[i].addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- markDirty();
- }
- });
- }
- }
- updateUIFromSorter();
- }
-
- private void createRestoreDefaultsButton(Composite parent) {
- Button defaultsButton = new Button(parent, SWT.PUSH);
- defaultsButton.setText(Messages.getString("restoreDefaults.text")); //$NON-NLS-1$
- setButtonSize(defaultsButton, new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.FILL_HORIZONTAL));
- defaultsButton.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- restoreDefaults();
- markDirty();
- }
- });
- }
-
- private void createSeparatorLine(Composite parent) {
- Label separator = new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
- separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_CENTER));
-// separator.setForeground(new Color(parent.getDisplay(), 150, 150, 150));
-// separator.setBackground(new Color(parent.getDisplay(), 150, 150, 150));
- }
-
- private void restoreDefaults() {
- updateUI(sorter.getDefaultPriorities(), sorter.getDefaultDirections());
- }
-
- private void updateUIFromSorter() {
- updateUI(sorter.getPriorities(), sorter.getDirections());
- }
-
- private void updateUI(int[] priorities, int[] directions) {
- ArrayList availablePriorities = new ArrayList(Arrays.asList(propertyText));
-
- for (int i = 0; i < priorityCombos.length; i++) {
- priorityCombos[i].removeAll();
- for (int j = 0; j < availablePriorities.size(); j++)
- priorityCombos[i].add((String) availablePriorities.get(j));
- priorityCombos[i].select(priorityCombos[i].indexOf(propertyText[priorities[i]]));
- availablePriorities.remove(propertyText[priorities[i]]);
-
- ascendingButtons[i].setSelection(directions[priorities[i]] == TableSorter.ASCENDING);
- descendingButtons[i].setSelection(directions[priorities[i]] == TableSorter.DESCENDING);
- }
- }
-
- protected void okPressed() {
- if (isDirty()) {
- for (int i = priorityCombos.length - 1; i >= 0; i--) {
- String column = priorityCombos[i].getItem(priorityCombos[i].getSelectionIndex());
- int index = -1;
- for (int j = 0; j < propertyText.length && index == -1; j++) {
- if (propertyText[j].equals(column))
- index = j;
- }
- if (index == -1) {
- sorter.resetState();
- return;
- }
- sorter.setTopPriority(properties[index]);
- int direction = TableSorter.ASCENDING;
- if (descendingButtons[i].getSelection())
- direction = TableSorter.DESCENDING;
- sorter.setTopPriorityDirection(direction);
- }
- }
- super.okPressed();
- }
-
- /**
- * @return boolean
- */
- public boolean isDirty() {
- return dirty;
- }
-
- /**
- * Sets the dirty flag to true;
- * @param dirty The dirty to set
- */
- public void markDirty() {
- dirty = true;
- }
-
- /**
- * Set the layout data of the button to a GridData with
- * appropriate heights and widths.
- * @param button
- */
- private void setButtonSize(Button button, GridData buttonData) {
- buttonData.heightHint =
- convertVerticalDLUsToPixels(IDialogConstants.BUTTON_HEIGHT);
- int widthHint =
- convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
- buttonData.widthHint =
- Math.max(
- widthHint,
- button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true).x);
- button.setLayoutData(buttonData);
- }
-
- private void initPriotityText() {
- IField[] unorderedProperties = sorter.getFields();
- properties = new IField[unorderedProperties.length];
- System.arraycopy(unorderedProperties, 0, properties, 0, properties.length);
- propertyText = new String[properties.length];
- for (int i = 0; i < properties.length; i++) {
- propertyText[i] = properties[i].getDescription();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableSorter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableSorter.java
deleted file mode 100644
index a60ecd9..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableSorter.java
+++ /dev/null
@@ -1,268 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.text.Collator;
-import java.util.Arrays;
-import java.util.Comparator;
-
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-
-public class TableSorter extends ViewerSorter implements Comparator {
-
- public static final int MAX_DEPTH = 4;
- public static final int ASCENDING = 1;
- public static final int DESCENDING = -1;
-
- protected IField[] fields;
- protected Collator collator = Collator.getInstance();
-
- protected int[] priorities;
- protected int[] directions;
- protected int[] defaultPriorities;
- protected int[] defaultDirections;
-
- private final String TAG_DIALOG_SECTION = "sorter"; //$NON-NLS-1$
- private final String TAG_PRIORITY = "priority"; //$NON-NLS-1$
- private final String TAG_DIRECTION = "direction"; //$NON-NLS-1$
- private final String TAG_DEFAULT_PRIORITY = "defaultPriority"; //$NON-NLS-1$
- private final String TAG_DEFAULT_DIRECTION = "defaultDirection"; //$NON-NLS-1$
-
- public TableSorter(TableSorter other) {
- this(other.getFields(), other.getDefaultPriorities(), other.getDefaultDirections());
- priorities = other.getPriorities();
- directions = other.getDirections();
- }
-
- public TableSorter(IField[] properties, final int[] defaultPriorities, final int[] defaultDirections) {
- super();
- this.fields = properties;
- if (properties == null || defaultPriorities == null || defaultDirections == null ||
- !(properties.length == defaultPriorities.length && properties.length == defaultDirections.length) ||
- !verifyPriorities(defaultPriorities) || !verifyDirections(defaultDirections)) {
- this.priorities = new int[0];
- this.directions = new int[0];
- this.defaultPriorities = new int[0];
- this.defaultDirections = new int[0];
- }
- else {
- this.priorities = new int[defaultPriorities.length];
- System.arraycopy(defaultPriorities, 0, this.priorities, 0, priorities.length);
- this.directions = new int[defaultDirections.length];
- System.arraycopy(defaultDirections, 0, this.directions, 0, directions.length);
- this.defaultPriorities = new int[defaultPriorities.length];
- System.arraycopy(defaultPriorities, 0, this.defaultPriorities, 0, defaultPriorities.length);
- this.defaultDirections = new int[defaultDirections.length];
- System.arraycopy(defaultDirections, 0, this.defaultDirections, 0, defaultDirections.length);
- }
- }
-
- protected void resetState() {
- System.arraycopy(defaultPriorities, 0, priorities, 0, priorities.length);
- System.arraycopy(defaultDirections, 0, directions, 0, directions.length);
- }
-
- public void reverseTopPriority() {
- directions[priorities[0]] *= -1;
- }
-
- public void setTopPriority(IField property) {
- int index = -1;
- for (int i = 0; i < fields.length; i++) {
- if (fields[i].equals(property)) {
- setTopPriority(i);
- return;
- }
- }
- }
-
- public void setTopPriority(int priority) {
- if (priority < 0 || priority >= priorities.length)
- return;
-
- int index = -1;
- for (int i = 0; i < priorities.length; i++) {
- if (priorities[i] == priority)
- index = i;
- }
-
- if (index == -1) {
- resetState();
- return;
- }
-
- //shift the array
- for (int i = index; i > 0; i--) {
- priorities[i] = priorities[i - 1];
- }
- priorities[0] = priority;
- directions[priority] = defaultDirections[priority];
- }
-
- public void setTopPriorityDirection(int direction) {
- if (direction == ASCENDING || direction == DESCENDING)
- directions[priorities[0]] = direction;
- }
-
- public int getTopPriorityDirection() {
- return directions[priorities[0]];
- }
-
- public int getTopPriority() {
- return priorities[0];
- }
-
- public int[] getPriorities() {
- int[] copy = new int[priorities.length];
- System.arraycopy(priorities, 0, copy, 0, copy.length);
- return copy;
- }
-
- public int[] getDirections() {
- int[] copy = new int[directions.length];
- System.arraycopy(directions, 0, copy, 0, copy.length);
- return copy;
- }
-
- public int[] getDefaultPriorities() {
- int[] copy = new int[defaultPriorities.length];
- System.arraycopy(defaultPriorities, 0, copy, 0, copy.length);
- return copy;
- }
-
- public int[] getDefaultDirections() {
- int[] copy = new int[defaultDirections.length];
- System.arraycopy(defaultDirections, 0, copy, 0, copy.length);
- return copy;
- }
-
- public int compare(Viewer viewer, Object e1, Object e2) {
- return compare(e1, e2, 0);
- }
-
- protected int compare(Object obj1, Object obj2, int depth) {
- if (depth >= priorities.length) {
- return 0;
- }
-
- int column = priorities[depth];
- IField property = fields[column];
- int result = property.compare(obj1, obj2);
- if (result == 0)
- return compare(obj1, obj2, depth + 1);
- return result * directions[column];
- }
-
- /**
- * @return
- */
- public IField[] getFields() {
- return fields;
- }
-
- private boolean verifyPriorities(int[] priorities) {
- int length = priorities.length;
- boolean[] included = new boolean[length];
- Arrays.fill(included, false);
- for (int i = 0; i < length; i++) {
- int priority = priorities[i];
- if (priority < 0 || priority >= length)
- return false;
- if (included[priority])
- return false;
- included[priority] = true;
- }
- return true;
- }
-
- private boolean verifyDirections(int[] directions) {
- for (int i = 0; i < directions.length; i++) {
- if (directions[i] != ASCENDING && directions[i] != DESCENDING)
- return false;
- }
- return true;
- }
-
- /* (non-Javadoc)
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object o1, Object o2) {
- return compare(null, o1, o2);
- }
-
- public void saveState(IDialogSettings dialogSettings) {
- if (dialogSettings == null) {
- return;
- }
-
- IDialogSettings settings = dialogSettings.getSection(TAG_DIALOG_SECTION);
- if (settings == null) {
- settings = dialogSettings.addNewSection(TAG_DIALOG_SECTION);
- }
-
- for (int i = 0; i < priorities.length; i++) {
- settings.put(TAG_PRIORITY + i, priorities[i]);
- settings.put(TAG_DIRECTION + i, directions[i]);
- settings.put(TAG_DEFAULT_PRIORITY + i, defaultPriorities[i]);
- settings.put(TAG_DEFAULT_DIRECTION + i, defaultDirections[i]);
- }
- }
-
- public void restoreState(IDialogSettings dialogSettings) {
- if (dialogSettings == null) {
- resetState();
- return;
- }
-
- IDialogSettings settings = dialogSettings.getSection(TAG_DIALOG_SECTION);
- if (settings == null) {
- resetState();
- return;
- }
-
- try {
- for (int i = 0; i < priorities.length; i++) {
- String priority = settings.get(TAG_PRIORITY + i);
- if (priority == null) {
- resetState();
- return;
- }
- priorities[i] = Integer.parseInt(priority);
- String direction = settings.get(TAG_DIRECTION + i);
- if (direction == null) {
- resetState();
- return;
- }
- directions[i] = Integer.parseInt(direction);
- String defaultPriority = settings.get(TAG_DEFAULT_PRIORITY + i);
- if (defaultPriority == null) {
- resetState();
- return;
- }
- defaultPriorities[i] = Integer.parseInt(defaultPriority);
- String defaultDirection = settings.get(TAG_DEFAULT_DIRECTION + i);
- if (defaultDirection == null) {
- resetState();
- return;
- }
- defaultDirections[i] = Integer.parseInt(defaultDirection);
- }
- }
- catch (NumberFormatException e) {
- resetState();
- }
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableView.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableView.java
deleted file mode 100644
index e94ad66..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableView.java
+++ /dev/null
@@ -1,387 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.swt.widgets.Scrollable;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.ViewPart;
-
-public abstract class TableView extends ViewPart {
-
- private static final String TAG_COLUMN_WIDTH = "columnWidth"; //$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$
-
- public static final String SORT_ACTION_ID = "sort"; //$NON-NLS-1$
- public static final String FILTERS_ACTION_ID = "filters"; //$NON-NLS-1$
-
- private TableViewer viewer;
- private Clipboard clipboard;
- private IMemento memento;
- protected ColumnLayoutData[] columnLayouts;
-
- private Map actions = new HashMap();
-
- private TableSorter sorter;
-
- /* (non-Javadoc)
- * Method declared on IViewPart.
- */
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- this.memento = memento;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- */
- public void createPartControl(Composite parent) {
- viewer = new TableViewer(createTable(parent));
- restoreColumnWidths(memento);
- createColumns(viewer.getTable());
- getContentProvider().setFilter(getFilter());
- viewer.setContentProvider(new TableContentProvider(getSite(), getContentProvider()));
- viewer.setLabelProvider(new TableViewLabelProvider(getVisibleFields()));
-
- viewer.setSorter(getSorter());
-
- //create the actions before the input is set on the viewer but after the
- //sorter and filter are set so the actions will be enabled correctly.
- createActions();
-
- viewer.setInput(getViewerInput());
- viewer.setSelection(restoreSelection(memento), true);
- Scrollable scrollable = (Scrollable) viewer.getControl();
- ScrollBar bar = scrollable.getVerticalBar();
- if (bar != null) {
- bar.setSelection(restoreVerticalScrollBarPosition(memento));
- }
- bar = scrollable.getHorizontalBar();
- if (bar != null) {
- bar.setSelection(restoreHorizontalScrollBarPosition(memento));
- }
-
- MenuManager mgr = initContextMenu();
- Menu menu = mgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- getSite().registerContextMenu(mgr, viewer);
- initActionBars(getViewSite().getActionBars());
- registerGlobalActions(getViewSite().getActionBars());
-
- viewer.addOpenListener(new IOpenListener() {
- public void open(OpenEvent event) {
- handleOpenEvent(event);
- }
- });
- viewer.getControl().addKeyListener(new KeyAdapter() {
- public void keyPressed(KeyEvent e) {
- handleKeyPressed(e);
- }
- });
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.IWorkbenchPart#dispose()
- */
- public void dispose() {
- }
-
- /**
- * Creates the table control.
- */
- protected Table createTable(Composite parent) {
- Table table = new Table(parent, SWT.H_SCROLL | SWT.V_SCROLL | SWT.MULTI | SWT.FULL_SELECTION);
- table.setLinesVisible(true);
- table.setFont(parent.getFont());
- return table;
- }
-
- protected void createColumns(final Table table) {
- SelectionListener headerListener = getHeaderListener();
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
- table.setHeaderVisible(true);
- final IField[] fields = getVisibleFields();
- ColumnLayoutData[] columnWidths = columnLayouts;
- if (columnWidths == null) {
- columnWidths = getDefaultColumnLayouts();
- }
- for (int i = 0; i < fields.length; i++) {
- if (columnWidths == null || i >= columnWidths.length || columnWidths[i] == null) {
- layout.addColumnData(new ColumnPixelData(504 / fields.length, true));
- }
- else {
- layout.addColumnData(columnWidths[i]);
- }
- TableColumn tc = new TableColumn(table, SWT.NONE,i);
- tc.setText(fields[i].getColumnHeaderText());
- tc.setImage(fields[i].getColumnHeaderImage());
- tc.addSelectionListener(headerListener);
- }
- }
-
- protected void createActions() {
- if (getSortDialog() != null) {
- putAction(SORT_ACTION_ID, new TableSortAction(this, getSortDialog()));
- }
- if (getFiltersDialog() != null) {
- putAction(FILTERS_ACTION_ID, new FiltersAction(this, getFiltersDialog()));
- }
- }
-
- protected IAction getAction(String id) {
- return (IAction) actions.get(id);
- }
-
- protected void putAction(String id, IAction action) {
- actions.put(id, action);
- }
-
- protected MenuManager initContextMenu() {
- MenuManager mgr = new MenuManager();
- mgr.setRemoveAllWhenShown(true);
- mgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager mgr) {
- getViewer().cancelEditing();
- fillContextMenu(mgr);
- }
- });
- return mgr;
- }
-
- protected abstract void initToolBar(IToolBarManager tbm);
-
- protected void initActionBars(IActionBars actionBars) {
- initMenu(actionBars.getMenuManager());
- initToolBar(actionBars.getToolBarManager());
- }
-
- protected void initMenu(IMenuManager menu) {
- IAction sortAction = getAction(SORT_ACTION_ID);
- if (sortAction != null)
- menu.add(sortAction);
- IAction filtersAction = getAction(FILTERS_ACTION_ID);
- if (filtersAction != null)
- menu.add(filtersAction);
- }
-
- protected abstract void registerGlobalActions(IActionBars actionBars);
-
- protected abstract void fillContextMenu(IMenuManager manager);
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.WorkbenchPart#setFocus()
- */
- public void setFocus() {
- TableViewer viewer = getViewer();
- if (viewer != null && !viewer.getControl().isDisposed()) {
- viewer.getControl().setFocus();
- }
- }
-
- protected abstract IFilter getFilter();
-
- protected TableSorter getSorter() {
- if (sorter == null) {
- int[] priorities = new int[getFields().length];
- int[] directions = new int[getFields().length];
- for (int i = 0; i < getFields().length; i++) {
- priorities[i] = i;
- }
- Arrays.fill(directions, TableSorter.ASCENDING);
- sorter = new TableSorter(getFields(), priorities, directions);
- sorter.restoreState(getDialogSettings());
- }
- return sorter;
- }
-
- protected abstract ITableViewContentProvider getContentProvider();
-
- protected IField[] getFields() {
- IField[] vProps = getVisibleFields();
- IField[] hProps = getHiddenFields();
- IField[] fields = new IField[vProps.length + hProps.length];
- System.arraycopy(vProps, 0, fields, 0, vProps.length);
- System.arraycopy(hProps, 0, fields, vProps.length, hProps.length);
- return fields;
- }
-
- protected abstract Object getViewerInput();
-
- protected abstract IField[] getVisibleFields();
-
- protected abstract IField[] getHiddenFields();
-
- protected abstract IDialogSettings getDialogSettings();
-
- protected TableViewer getViewer() {
- return viewer;
- }
-
- protected SelectionListener getHeaderListener() {
- return new SelectionAdapter() {
- /**
- * Handles the case of user selecting the
- * header area.
- */
- public void widgetSelected(SelectionEvent e) {
- int column = getViewer().getTable().indexOf((TableColumn) e.widget);
- if (column == getSorter().getTopPriority())
- getSorter().reverseTopPriority();
- else {
- getSorter().setTopPriority(column);
- }
- viewer.refresh(false);
- getSorter().saveState(getDialogSettings());
- }
- };
- }
-
- protected abstract ColumnLayoutData[] getDefaultColumnLayouts();
-
- protected TableSortDialog getSortDialog() {
- if (getSorter() != null) {
- return new TableSortDialog(getSite().getShell(), getSorter());
- }
- return null;
- }
-
- protected abstract Dialog getFiltersDialog();
-
- protected void filtersChanged() {
- final TableViewer viewer = getViewer();
- if (viewer == null) {
- return;
- }
- getSite().getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- viewer.getControl().setRedraw(false);
- viewer.refresh(false);
- viewer.getControl().setRedraw(true);
- }
- });
- }
-
- protected void sorterChanged() {
- final TableViewer viewer = getViewer();
- if (viewer == null) {
- return;
- }
- getSite().getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- viewer.getControl().setRedraw(false);
- viewer.refresh(false);
- viewer.getControl().setRedraw(true);
- }
- });
- }
-
- protected abstract void handleKeyPressed(KeyEvent event);
-
- protected abstract void handleOpenEvent(OpenEvent event);
-
- /* (non-Javadoc)
- * @see org.eclipse.ui.part.ViewPart#saveState(org.eclipse.ui.IMemento)
- */
- public void saveState(IMemento memento) {
- super.saveState(memento);
-
- //save column widths
- TableColumn[] columns = viewer.getTable().getColumns();
- for (int i = 0; i < columns.length; i++) {
- memento.putInteger(TAG_COLUMN_WIDTH + i, columns[i].getWidth());
- }
-
- saveSelection(memento);
-
- //save vertical position
- Scrollable scrollable = (Scrollable) viewer.getControl();
- ScrollBar bar = scrollable.getVerticalBar();
- int position = (bar != null) ? bar.getSelection() : 0;
- memento.putInteger(TAG_VERTICAL_POSITION, position);
- //save horizontal position
- bar = scrollable.getHorizontalBar();
- position = (bar != null) ? bar.getSelection() : 0;
- memento.putInteger(TAG_HORIZONTAL_POSITION, position);
- }
-
- protected abstract void saveSelection(IMemento memento);
-
- private void restoreColumnWidths(IMemento memento) {
- if (memento == null) {
- return;
- }
- columnLayouts = new ColumnLayoutData[getFields().length];
- for (int i = 0; i < columnLayouts.length; i++) {
- Integer width = memento.getInteger(TAG_COLUMN_WIDTH + i);
- if (width == null) {
- columnLayouts = null;
- break;
- }
- else {
- columnLayouts[i] = new ColumnPixelData(width.intValue(), true);
- }
- }
- }
-
- protected abstract IStructuredSelection restoreSelection(IMemento memento);
-
- private int restoreVerticalScrollBarPosition(IMemento memento) {
- if (memento == null) {
- return 0;
- }
- Integer position = memento.getInteger(TAG_VERTICAL_POSITION);
- return (position == null) ? 0 : position.intValue();
- }
-
- private int restoreHorizontalScrollBarPosition(IMemento memento) {
- if (memento == null) {
- return 0;
- }
- Integer position = memento.getInteger(TAG_HORIZONTAL_POSITION);
- return (position == null) ? 0 : position.intValue();
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableViewLabelProvider.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableViewLabelProvider.java
deleted file mode 100644
index 1d910df..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TableViewLabelProvider.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.graphics.Image;
-
-
-public class TableViewLabelProvider extends LabelProvider implements ITableLabelProvider {
-
- IField[] fields;
-
- public TableViewLabelProvider(IField[] fields) {
- this.fields = fields;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnImage(java.lang.Object, int)
- */
- public Image getColumnImage(Object element, int columnIndex) {
- if (fields == null || columnIndex < 0 || columnIndex >= fields.length) {
- return null;
- }
- return fields[columnIndex].getImage(element);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, int)
- */
- public String getColumnText(Object element, int columnIndex) {
- if (fields == null || columnIndex < 0 || columnIndex >= fields.length) {
- return null;
- }
- return fields[columnIndex].getValue(element);
- }
-
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TaskFilter.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TaskFilter.java
deleted file mode 100644
index 03036c3..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/TaskFilter.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.dialogs.IDialogSettings;
-
-public class TaskFilter extends MarkerFilter {
-
- private static final String TAG_CONTAINS = "contains"; //$NON-NLS-1$
- private static final String TAG_DESCRIPTION = "description"; //$NON-NLS-1$
- private static final String TAG_DIALOG_SECTION = "filter"; //$NON-NLS-1$
- private static final String TAG_DONE = "done"; //$NON-NLS-1$
- private static final String TAG_PRIORITY = "priority"; //$NON-NLS-1$
- private static final String TAG_SELECT_BY_DONE = "selectByDone"; //$NON-NLS-1$
- private static final String TAG_SELECT_BY_PRIORITY = "selectByPriority"; //$NON-NLS-1$
-
- final static boolean DEFAULT_CONTAINS = true;
- final static String DEFAULT_DESCRIPTION = ""; //$NON-NLS-1$
- final static boolean DEFAULT_DONE = false;
- final static int DEFAULT_PRIORITY = 0;
- final static boolean DEFAULT_SELECT_BY_DONE = false;
- final static boolean DEFAULT_SELECT_BY_PRIORITY = false;
-
- final static int PRIORITY_HIGH = 1 << 2;
- final static int PRIORITY_NORMAL = 1 << 1;
- final static int PRIORITY_LOW = 1 << 0;
-
- private boolean contains;
- private String description;
- private boolean done;
- private int priority;
- private boolean selectByPriority;
- private boolean selectByDone;
-
- public TaskFilter() {
- super(new String[] { IMarker.TASK });
- }
-
- public boolean select(Object item) {
- return isEnabled() ? super.select(item) && selectByDescription(item) && selectByDone(item) && selectByPriority(item) : true;
- }
-
- private boolean selectByDescription(Object item) {
- if (!(item instanceof IMarker) || description == null || description.equals("")) //$NON-NLS-1$
- return true;
-
- IMarker marker = (IMarker) item;
- String markerDescription = marker.getAttribute(IMarker.MESSAGE, DEFAULT_DESCRIPTION); //$NON-NLS-1$
- int index = markerDescription.indexOf(description);
- return contains ? (index >= 0) : (index < 0);
- }
-
- private boolean selectByDone(Object item) {
- if (item instanceof IMarker && selectByDone)
- return done == ((IMarker) item).getAttribute(IMarker.DONE, false);
-
- return true;
- }
-
- private boolean selectByPriority(Object item) {
- if (item instanceof IMarker && priority != 0 && selectByPriority) {
- int markerPriority = ((IMarker) item).getAttribute(IMarker.PRIORITY, -1);
-
- if (markerPriority == IMarker.PRIORITY_HIGH)
- return (priority & PRIORITY_HIGH) > 0;
- else if (markerPriority == IMarker.PRIORITY_NORMAL)
- return (priority & PRIORITY_NORMAL) > 0;
- else if (markerPriority == IMarker.PRIORITY_LOW)
- return (priority & PRIORITY_LOW) > 0;
- }
-
- return true;
- }
-
- public boolean getContains() {
- return contains;
- }
-
- public String getDescription() {
- return description;
- }
-
- public boolean getDone() {
- return done;
- }
-
- public int getPriority() {
- return priority;
- }
-
- public boolean getSelectByDone() {
- return selectByDone;
- }
-
- public boolean getSelectByPriority() {
- return selectByPriority;
- }
-
- public void setContains(boolean contains) {
- this.contains = contains;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setDone(boolean done) {
- this.done = done;
- }
-
- public void setPriority(int priority) {
- this.priority = priority;
- }
-
- public void setSelectByDone(boolean selectByDone) {
- this.selectByDone = selectByDone;
- }
-
- public void setSelectByPriority(boolean selectByPriority) {
- this.selectByPriority = selectByPriority;
- }
-
- public void resetState() {
- super.resetState();
- contains = DEFAULT_CONTAINS;
- description = DEFAULT_DESCRIPTION;
- done = DEFAULT_DONE;
- priority = DEFAULT_PRIORITY;
- selectByDone = DEFAULT_SELECT_BY_DONE;
- selectByPriority = DEFAULT_SELECT_BY_PRIORITY;
- }
-
- public void restoreState(IDialogSettings dialogSettings) {
- super.restoreState(dialogSettings);
- IDialogSettings settings = dialogSettings.getSection(TAG_DIALOG_SECTION);
-
- if (settings != null) {
- String setting = settings.get(TAG_CONTAINS);
-
- if (setting != null)
- contains = Boolean.valueOf(setting).booleanValue();
-
- setting = settings.get(TAG_DESCRIPTION);
-
- if (setting != null)
- description = new String(setting);
-
- setting = settings.get(TAG_DONE);
-
- if (setting != null)
- done = Boolean.valueOf(setting).booleanValue();
-
- setting = settings.get(TAG_PRIORITY);
-
- if (setting != null)
- try {
- priority = Integer.parseInt(setting);
- }
- catch (NumberFormatException eNumberFormat) {
- }
-
- setting = settings.get(TAG_SELECT_BY_DONE);
-
- if (setting != null)
- selectByDone = Boolean.valueOf(setting).booleanValue();
-
- setting = settings.get(TAG_SELECT_BY_PRIORITY);
-
- if (setting != null)
- selectByPriority = Boolean.valueOf(setting).booleanValue();
- }
- }
-
- public void saveState(IDialogSettings dialogSettings) {
- super.saveState(dialogSettings);
-
- if (dialogSettings != null) {
- IDialogSettings settings = dialogSettings.getSection(TAG_DIALOG_SECTION);
-
- if (settings == null)
- settings = dialogSettings.addNewSection(TAG_DIALOG_SECTION);
-
- settings.put(TAG_CONTAINS, contains);
- settings.put(TAG_DESCRIPTION, description);
- settings.put(TAG_DONE, done);
- settings.put(TAG_PRIORITY, priority);
- settings.put(TAG_SELECT_BY_DONE, selectByDone);
- settings.put(TAG_SELECT_BY_PRIORITY, selectByPriority);
- }
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/Util.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/Util.java
deleted file mode 100644
index 6d183f9..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/markers/internal/Util.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.markers.internal;
-
-import java.text.DateFormat;
-import java.util.Date;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-
-public final class Util {
-
- public static String getString(ResourceBundle resourceBundle, String key)
- throws IllegalArgumentException {
- if (resourceBundle == null || key == null)
- throw new IllegalArgumentException();
-
- String value = key;
-
- try {
- value = resourceBundle.getString(key);
- } catch (MissingResourceException eMissingResource) {
- System.err.println(eMissingResource);
- }
-
- return value != null ? value.trim() : null;
- }
-
- public static String getProperty(String property, IMarker marker) {
- if (marker == null)
- return ""; //$NON-NLS-1$
- try {
- Object obj = marker.getAttribute(property);
- if (obj != null)
- return obj.toString();
- return ""; //$NON-NLS-1$
- }
- catch (CoreException e) {
- return ""; //$NON-NLS-1$
- }
- }
-
- public static String getCreationTime(IMarker marker) {
- try {
- return DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM).format(new Date(marker.getCreationTime()));
- } catch (CoreException e) {
- return ""; //$NON-NLS-1$
- }
- }
-
- public static String getContainerName(IMarker marker) {
- IPath path = marker.getResource().getFullPath();
- int n = path.segmentCount() - 1; // n is the number of segments in container, not path
- if (n <= 0)
- return ""; //$NON-NLS-1$
- int len = 0;
- for (int i = 0; i < n; ++i)
- len += path.segment(i).length();
- // account for /'s
- if (n > 1)
- len += n-1;
- StringBuffer sb = new StringBuffer(len);
- for (int i = 0; i < n; ++i) {
- if (i != 0)
- sb.append('/');
- sb.append(path.segment(i));
- }
- return sb.toString();
- }
-
- public static String getResourceName(IMarker marker) {
- return marker.getResource().getName();
- }
-
- public static boolean isEditable(IMarker marker) {
- if (marker == null) {
- return false;
- }
- try {
- return marker.isSubtypeOf(IMarker.BOOKMARK) ||
- (marker.isSubtypeOf(IMarker.TASK) &&
- marker.getAttribute(IMarker.USER_EDITABLE, false));
- }
- catch (CoreException e) {
- return false;
- }
- }
-
- private Util() {
- super();
- }
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/CollapseAllAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/CollapseAllAction.java
deleted file mode 100644
index 1a22d43..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/CollapseAllAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- * Sebastian Davids <sdavids@gmx.de> - Initial Implementation
-******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Collapse all project nodes.
- */
-public class CollapseAllAction extends ResourceNavigatorAction {
-
-/**
- * Creates the action.
- *
- * @param navigator the resource navigator
- * @param label the label for the action
- */
-public CollapseAllAction(IResourceNavigator navigator, String label) {
- super(navigator, label);
- WorkbenchHelp.setHelp(this, INavigatorHelpContextIds.COLLAPSE_ALL_ACTION);
- setEnabled(true);
-}
-
-/*
- * Implementation of method defined on <code>IAction</code>.
- */
-public void run() {
- getNavigator().getViewer().collapseAll();
-}
-}
\ No newline at end of file
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 e5d99e8..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/CopyAction.java
+++ /dev/null
@@ -1,207 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-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.*;
-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
- final int length = resources.length;
- int actualLength = 0;
- String[] fileNames = new String[length];
- StringBuffer buf = new StringBuffer();
- for (int i = 0; i < length; i++) {
- IPath location = resources[i].getLocation();
- // location may be null. See bug 29491.
- if (location != null)
- fileNames[actualLength++] = location.toOSString();
- if (i > 0)
- buf.append("\n"); //$NON-NLS-1$
- buf.append(resources[i].getName());
- }
- // was one or more of the locations null?
- if (actualLength < length) {
- String[] tempFileNames = fileNames;
- fileNames = new String[actualLength];
- for (int i = 0; i < actualLength; i++)
- fileNames[i] = tempFileNames[i];
- }
- 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
- if (fileNames.length > 0) {
- clipboard.setContents(
- new Object[]{
- resources,
- fileNames,
- names},
- new Transfer[]{
- ResourceTransfer.getInstance(),
- FileTransfer.getInstance(),
- TextTransfer.getInstance()});
- } else {
- clipboard.setContents(
- new Object[]{
- resources,
- names},
- new Transfer[]{
- ResourceTransfer.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;
- // resource location must exist
- if (currentResource.getLocation() == null)
- 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 eb45bce..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/FilterSelectionAction.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.navigator;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.dialogs.ListSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * 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);
-
- ListSelectionDialog dialog =
- new ListSelectionDialog(
- getShell(),
- getViewer(),
- contentProvider,
- new LabelProvider(),
- FILTER_SELECTION_MESSAGE);
-
- dialog.setTitle(FILTER_TITLE_MESSAGE);
- dialog.setInitialSelections(contentProvider.getInitialSelections());
- dialog.open();
- if (dialog.getReturnCode() == Dialog.OK) {
- Object[] results = dialog.getResult();
- String[] selectedPatterns = new String[results.length];
- System.arraycopy(results, 0, selectedPatterns, 0, results.length);
- filter.setPatterns(selectedPatterns);
- navigator.setFiltersPreference(selectedPatterns);
- Viewer viewer = getViewer();
- viewer.getControl().setRedraw(false);
- viewer.refresh();
- viewer.getControl().setRedraw(true);
- }
-}
-
-}
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 7d10174..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/FiltersContentProvider.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * 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 01b4f2c..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoActionGroup.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.views.framelist.BackAction;
-import org.eclipse.ui.views.framelist.ForwardAction;
-import org.eclipse.ui.views.framelist.FrameList;
-import org.eclipse.ui.views.framelist.GoIntoAction;
-import org.eclipse.ui.views.framelist.UpAction;
-
-/**
- * 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;
-
- public GotoActionGroup(IResourceNavigator navigator) {
- super(navigator);
- }
-
- 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);
- }
- }
- }
- }
-
- 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);
- actionBars.setGlobalActionHandler(
- IWorkbenchActionConstants.GO_TO_RESOURCE,
- goToResourceAction);
-
- 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("GoToResource.label")); //$NON-NLS-1$
- }
-
- public void updateActionBars() {
- ActionContext context = getContext();
- boolean enable = false;
-
- // Fix for bug 26126. Resource change listener could call
- // updateActionBars without a context being set.
- // This should never happen because resource navigator sets
- // context immediately after this group is created.
- if (context != null) {
- IStructuredSelection selection =
- (IStructuredSelection) context.getSelection();
-
- 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
- }
-}
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 126f158..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoResourceAction.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * 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 open a dialog asking
- * the user to select a resource and change the selection in
- * the navigator.
- */
-public void run() {
- IContainer container = (IContainer)getViewer().getInput();
- GotoResourceDialog dialog = new GotoResourceDialog(getShell(),container, IResource.FILE | IResource.FOLDER | IResource.PROJECT);
- dialog.open();
- Object[] result = dialog.getResult();
- if (result == null || result.length == 0 || result[0] instanceof IResource == false)
- return;
-
- IResource selection = (IResource) result[0];
- 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 d1fb5d6..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/GotoResourceDialog.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.ResourceListSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * 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 ResourceListSelectionDialog {
-
-/**
- * Creates a new instance of the class.
- */
-protected GotoResourceDialog(Shell parentShell, IContainer container, int typesMask) {
- super(parentShell, container, typesMask);
- setTitle(ResourceNavigatorMessages.getString("Goto.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(parentShell, INavigatorHelpContextIds.GOTO_RESOURCE_DIALOG);
-}
-}
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 96dd146..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/INavigatorHelpContextIds.java
+++ /dev/null
@@ -1,44 +0,0 @@
-package org.eclipse.ui.views.navigator;
-
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- * Sebastian Davids <sdavids@gmx.de> - Collapse all action
-******************************************************************************/
-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$
- public static final String COLLAPSE_ALL_ACTION = PREFIX + "collapse_all_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 8cd0b27..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/IResourceNavigator.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-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.
- * <p>
- * This interface is not intended to be implemented by clients.
- * Subclass <code>org.eclipse.ui.views.ResourceNavigator</code>
- * instead.
- * </p>
- *
- * @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();
-
- /**
- * Returns whether this navigator's selection automatically tracks the active editor.
- *
- * @return <code>true</code> if linking is enabled, <code>false</code> if not
- * @since 2.1
- */
- boolean isLinkingEnabled();
-
- /**
- * 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);
-
- /**
- * Sets whether this navigator's selection automatically tracks the active editor.
- *
- * @param enabled <code>true</code> to enable, <code>false</code> to disable
- * @since 2.1
- */
- void setLinkingEnabled(boolean enabled);
-}
diff --git a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/LocalSelectionTransfer.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/LocalSelectionTransfer.java
deleted file mode 100644
index c59b223..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/LocalSelectionTransfer.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.dnd.ByteArrayTransfer;
-import org.eclipse.swt.dnd.TransferData;
-import org.eclipse.ui.internal.ViewsPlugin;
-
-/**
- * A LocalSelectionTransfer may be used for drag and drop operations
- * within the same instance of Eclipse.
- * The selection is made available directly for use in the DropTargetListener.
- * dropAccept method. The DropTargetEvent passed to dropAccept does not contain
- * the drop data. The selection may be used for validation purposes so that the
- * drop can be aborted if appropriate.
- *
- * This class is not intended to be subclassed.
- *
- * @since 2.1
- */
-public class LocalSelectionTransfer extends ByteArrayTransfer {
-
- // First attempt to create a UUID for the type name to make sure that
- // different Eclipse applications use different "types" of
- // <code>LocalSelectionTransfer</code>
- private static final String TYPE_NAME= "local-selection-transfer-format" + (new Long(System.currentTimeMillis())).toString(); //$NON-NLS-1$;
- private static final int TYPEID= registerType(TYPE_NAME);
-
- private static final LocalSelectionTransfer INSTANCE= new LocalSelectionTransfer();
-
- private ISelection selection;
-
- /**
- * Only the singleton instance of this class may be used.
- */
- private LocalSelectionTransfer() {
- }
- /**
- * Returns the singleton.
- */
- public static LocalSelectionTransfer getInstance() {
- return INSTANCE;
- }
- /**
- * Returns the local transfer data.
- *
- * @return the local transfer data
- */
- public ISelection getSelection() {
- return selection;
- }
- /**
- * Tests whether native drop data matches this transfer type.
- *
- * @param result result of converting the native drop data to Java
- * @return true if the native drop data does not match this transfer type.
- * false otherwise.
- */
- private boolean isInvalidNativeType(Object result) {
- return !(result instanceof byte[]) || !TYPE_NAME.equals(new String((byte[])result));
- }
- /**
- * Returns the type id used to identify this transfer.
- *
- * @return the type id used to identify this transfer.
- */
- protected int[] getTypeIds() {
- return new int[] {TYPEID};
- }
- /**
- * Returns the type name used to identify this transfer.
- *
- * @return the type name used to identify this transfer.
- */
- protected String[] getTypeNames(){
- return new String[] {TYPE_NAME};
- }
- /**
- * Overrides org.eclipse.swt.dnd.ByteArrayTransfer#javaToNative(Object,
- * TransferData).
- * Only encode the transfer type name since the selection is read and
- * written in the same process.
- *
- * @see org.eclipse.swt.dnd.ByteArrayTransfer#javaToNative(java.lang.Object, org.eclipse.swt.dnd.TransferData)
- */
- public void javaToNative(Object object, TransferData transferData) {
- byte[] check= TYPE_NAME.getBytes();
- super.javaToNative(check, transferData);
- }
- /**
- * Overrides org.eclipse.swt.dnd.ByteArrayTransfer#nativeToJava(TransferData).
- * Test if the native drop data matches this transfer type.
- *
- * @see org.eclipse.swt.dnd.ByteArrayTransfer#nativeToJava(TransferData)
- */
- public Object nativeToJava(TransferData transferData) {
- Object result= super.nativeToJava(transferData);
- if (isInvalidNativeType(result)) {
- ILog log = ViewsPlugin.getDefault().getLog();
- log.log(
- new Status(
- IStatus.ERROR,
- ViewsPlugin.PLUGIN_ID,
- IStatus.ERROR,
- ResourceNavigatorMessages.getString("LocalSelectionTransfer.errorMessage"), null)); //$NON-NLS-1$
- }
- return selection;
- }
- /**
- * Sets the transfer data for local use.
- *
- * @param s the transfer data
- */
- public void setSelection(ISelection s) {
- selection = s;
- }
-}
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 dcfea79..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/MainActionGroup.java
+++ /dev/null
@@ -1,323 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- * Sebastian Davids <sdavids@gmx.de> - Collapse all action
- * Sebastian Davids <sdavids@gmx.de> - Images for menu items
-************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.actions.AddBookmarkAction;
-import org.eclipse.ui.actions.AddTaskAction;
-import org.eclipse.ui.actions.ExportResourcesAction;
-import org.eclipse.ui.actions.ImportResourcesAction;
-import org.eclipse.ui.actions.NewWizardMenu;
-import org.eclipse.ui.actions.WorkingSetFilterActionGroup;
-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 PropertyDialogAction propertyDialogAction;
- protected ImportResourcesAction importAction;
- protected ExportResourcesAction exportAction;
- protected CollapseAllAction collapseAllAction;
- protected ToggleLinkingAction toggleLinkingAction;
-
- protected GotoActionGroup gotoGroup;
- protected OpenActionGroup openGroup;
- protected RefactorActionGroup refactorGroup;
- protected WorkingSetFilterActionGroup workingSetGroup;
- protected SortAndFilterActionGroup sortAndFilterGroup;
- protected WorkspaceActionGroup workspaceGroup;
-
- private IResourceChangeListener resourceChangeListener;
-
- /**
- * Constructs the main action group.
- */
- public MainActionGroup(IResourceNavigator navigator) {
- super(navigator);
- resourceChangeListener = new IResourceChangeListener() {
- public void resourceChanged(IResourceChangeEvent event) {
- handleResourceChanged(event);
- }
- };
- ResourcesPlugin.getWorkspace().addResourceChangeListener(resourceChangeListener, IResourceChangeEvent.POST_CHANGE);
- makeSubGroups();
- }
-
- /**
- * Handles a resource changed event by updating the enablement
- * if one of the selected projects is opened or closed.
- */
- protected void handleResourceChanged(IResourceChangeEvent event) {
- ActionContext context = getContext();
- if (context == null) {
- return;
- }
-
- IStructuredSelection selection = (IStructuredSelection) context.getSelection();
- if (ResourceSelectionUtil.allResourcesAreOfType(selection, IResource.PROJECT) == false) {
- return;
- }
- List sel = selection.toList();
- IResourceDelta delta = event.getDelta();
- if (delta == null) {
- return;
- }
- 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())) {
- addTaskAction.selectionChanged(selection);
- gotoGroup.updateActionBars();
- refactorGroup.updateActionBars();
- workspaceGroup.updateActionBars();
- return;
- }
- }
- }
- }
-
- /**
- * Makes the actions contained directly in this action group.
- */
- protected void makeActions() {
- Shell shell = navigator.getSite().getShell();
-
- addBookmarkAction = new AddBookmarkAction(shell);
- addTaskAction = new AddTaskAction(shell);
- propertyDialogAction =
- new PropertyDialogAction(shell, navigator.getViewer());
-
- importAction = new ImportResourcesAction(navigator.getSite().getWorkbenchWindow());
- importAction.setDisabledImageDescriptor(getImageDescriptor("dtool16/import_wiz.gif")); //$NON-NLS-1$
- importAction.setImageDescriptor(getImageDescriptor("etool16/import_wiz.gif")); //$NON-NLS-1$
- importAction.setHoverImageDescriptor(getImageDescriptor("ctool16/import_wiz.gif")); //$NON-NLS-1$
-
- exportAction = new ExportResourcesAction(navigator.getSite().getWorkbenchWindow());
- exportAction.setDisabledImageDescriptor(getImageDescriptor("dtool16/export_wiz.gif")); //$NON-NLS-1$
- exportAction.setImageDescriptor(getImageDescriptor("etool16/export_wiz.gif")); //$NON-NLS-1$
- exportAction.setHoverImageDescriptor(getImageDescriptor("ctool16/export_wiz.gif")); //$NON-NLS-1$
-
- collapseAllAction = new CollapseAllAction(navigator, ResourceNavigatorMessages.getString("CollapseAllAction.title"));//$NON-NLS-1$
- collapseAllAction.setToolTipText(ResourceNavigatorMessages.getString("CollapseAllAction.toolTip")); //$NON-NLS-1$
- collapseAllAction.setImageDescriptor(getImageDescriptor("elcl16/collapseall.gif")); //$NON-NLS-1$
- collapseAllAction.setHoverImageDescriptor(getImageDescriptor("clcl16/collapseall.gif")); //$NON-NLS-1$
-
- toggleLinkingAction = new ToggleLinkingAction(
- navigator,
- ResourceNavigatorMessages.getString("ToggleLinkingAction.text")); //$NON-NLS-1$
- toggleLinkingAction.setToolTipText(
- ResourceNavigatorMessages.getString("ToggleLinkingAction.toolTip")); //$NON-NLS-1$
- toggleLinkingAction.setImageDescriptor(getImageDescriptor("elcl16/synced.gif"));//$NON-NLS-1$
- toggleLinkingAction.setHoverImageDescriptor(getImageDescriptor("clcl16/synced.gif"));//$NON-NLS-1$
- }
-
- /**
- * Makes the sub action groups.
- */
- protected void makeSubGroups() {
- gotoGroup = new GotoActionGroup(navigator);
- openGroup = new OpenActionGroup(navigator);
- refactorGroup = new RefactorActionGroup(navigator);
- IPropertyChangeListener workingSetUpdater = new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- String property = event.getProperty();
-
- if (WorkingSetFilterActionGroup.CHANGE_WORKING_SET.equals(property)) {
- IResourceNavigator navigator = getNavigator();
- Object newValue = event.getNewValue();
-
- if (newValue instanceof IWorkingSet) {
- navigator.setWorkingSet((IWorkingSet) newValue);
- }
- else
- if (newValue == null) {
- navigator.setWorkingSet(null);
- }
- }
- }
- };
- TreeViewer treeView = navigator.getViewer();
- Shell shell = treeView.getControl().getShell();
- workingSetGroup = new WorkingSetFilterActionGroup(shell, workingSetUpdater);
- workingSetGroup.setWorkingSet(navigator.getWorkingSet());
- 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);
- workingSetGroup.fillActionBars(actionBars);
- sortAndFilterGroup.fillActionBars(actionBars);
- workspaceGroup.fillActionBars(actionBars);
-
- IMenuManager menu = actionBars.getMenuManager();
- menu.add(toggleLinkingAction);
-
- IToolBarManager toolBar = actionBars.getToolBarManager();
- toolBar.add(new Separator());
- toolBar.add(collapseAllAction);
- toolBar.add(toggleLinkingAction);
- }
-
- /**
- * 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();
- workingSetGroup.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() {
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(resourceChangeListener);
- gotoGroup.dispose();
- openGroup.dispose();
- refactorGroup.dispose();
- workingSetGroup.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 2c90a71..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorDragAdapter.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-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 {
- private static final String CHECK_MOVE_TITLE = ResourceNavigatorMessages.getString("DragAdapter.title"); //$NON-NLS-1$
- private static final String CHECK_DELETE_MESSAGE = ResourceNavigatorMessages.getString("DragAdapter.checkDeleteMessage"); //$NON-NLS-1$
-
- ISelectionProvider selectionProvider;
-
- private TransferData lastDataType;
-
- /**
- * Constructs a new drag adapter.
- */
- public NavigatorDragAdapter(ISelectionProvider provider) {
- selectionProvider = provider;
- }
- /*
- * @see DragSourceListener#dragFinished(org.eclipse.swt.dnd.DragSourceEvent)
- */
- public void dragFinished(DragSourceEvent event) {
- LocalSelectionTransfer.getInstance().setSelection(null);
-
- if (event.doit == false)
- return;
-
- final int typeMask = IResource.FOLDER | IResource.FILE;
- if (event.detail == DND.DROP_MOVE) {
- //never delete resources when dragging outside Eclipse.
- //workaround for bug 30543.
- if (lastDataType != null && FileTransfer.getInstance().isSupportedType(lastDataType))
- return;
-
- 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(org.eclipse.swt.dnd.DragSourceEvent)
- */
- public void dragSetData(DragSourceEvent event) {
- final int typeMask = IResource.FILE | IResource.FOLDER;
- IResource[] resources = getSelectedResources(typeMask);
-
- if (resources == null || resources.length == 0)
- return;
-
- lastDataType = event.dataType;
- //use local selection transfer if possible
- if (LocalSelectionTransfer.getInstance().isSupportedType(event.dataType)) {
- event.data = LocalSelectionTransfer.getInstance().getSelection();
- 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 length = resources.length;
- int actualLength = 0;
- String[] fileNames = new String[length];
- for (int i = 0; i < length; i++) {
- IPath location = resources[i].getLocation();
- // location may be null. See bug 29491.
- if (location != null)
- fileNames[actualLength++] = location.toOSString();
- }
- if (actualLength == 0)
- return;
- // was one or more of the locations null?
- if (actualLength < length) {
- String[] tempFileNames = fileNames;
- fileNames = new String[actualLength];
- for (int i = 0; i < actualLength; i++)
- fileNames[i] = tempFileNames[i];
- }
- event.data = fileNames;
- }
-
- /*
- * @see DragSourceListener#dragStart(org.eclipse.swt.dnd.DragSourceEvent)
- */
- public void dragStart(DragSourceEvent event) {
- lastDataType = null;
- // 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;
- }
- }
- if (selection.isEmpty()) {
- event.doit = false;
- return;
- }
- LocalSelectionTransfer.getInstance().setSelection(selection);
- 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;
- }
-}
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 adbc058..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorDropAdapter.java
+++ /dev/null
@@ -1,378 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-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 {
-
- /**
- * A flag indicating that overwrites should always occur.
- */
- private boolean alwaysOverwrite = false;
-
- /**
- * 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(org.eclipse.swt.dnd.DropTargetEvent)
- */
- public void dragEnter(DropTargetEvent event) {
- if (FileTransfer.getInstance().isSupportedType(event.currentDataType) &&
- event.detail == DND.DROP_DEFAULT) {
- // default to copy when dragging from outside Eclipse. Fixes bug 16308.
- event.detail = DND.DROP_COPY;
- }
- super.dragEnter(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 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 resource selection from the LocalSelectionTransfer.
- *
- * @return the resource selection from the LocalSelectionTransfer
- */
- private IResource[] getSelectedResources() {
- IResource[] selectedResources = null;
-
- ISelection selection = LocalSelectionTransfer.getInstance().getSelection();
- if (selection instanceof IStructuredSelection) {
- List selectionList = ((IStructuredSelection) selection).toList();
- selectedResources = (IResource[]) selectionList.toArray(new IResource[selectionList.size()]);
- }
- return selectedResources;
- }
-
- /**
- * 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);
- }
- }
-
- /**
- * 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);
- }
-
- /**
- * Perform the drop.
- * @see DropTargetListener#drop(org.eclipse.swt.dnd.DropTargetEvent)
- */
- public boolean performDrop(final Object data) {
- alwaysOverwrite = false;
- if (getCurrentTarget() == null || data == null) {
- return false;
- }
- boolean result = false;
- IStatus status = null;
- IResource[] resources = null;
- TransferData currentTransfer = getCurrentTransfer();
- if (LocalSelectionTransfer.getInstance().isSupportedType(currentTransfer)) {
- resources = getSelectedResources();
- } else if (ResourceTransfer.getInstance().isSupportedType(currentTransfer)) {
- resources = (IResource[]) data;
- } else if (FileTransfer.getInstance().isSupportedType(currentTransfer)) {
- status = performFileDrop(data);
- result = status.isOK();
- } else {
- result = NavigatorDropAdapter.super.performDrop(data);
- }
- if (resources != null) {
- if (getCurrentOperation() == DND.DROP_COPY)
- status = performResourceCopy(getShell(), resources);
- else
- status = performResourceMove(resources);
- }
- 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, IResource[] sources) {
- 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());
- CopyFilesAndFoldersOperation operation = new CopyFilesAndFoldersOperation(shell);
- operation.copyResources(sources, target);
-
- return problems;
- }
-
- /**
- * Performs a resource move
- */
- private IStatus performResourceMove(IResource[] sources) {
- 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());
- 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(String)
- */
- 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 (FileTransfer.getInstance().isSupportedType(transferType) &&
- lastValidOperation != DND.DROP_COPY) {
- // only allow copying when dragging from outside Eclipse
- return false;
- }
- 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;
- // drag within Eclipse?
- if (LocalSelectionTransfer.getInstance().isSupportedType(transferType)) {
- IResource[] selectedResources = getSelectedResources();
-
- if (selectedResources == null)
- message = ResourceNavigatorMessages.getString("DropAdapter.dropOperationErrorOther"); //$NON-NLS-1$
- else {
- CopyFilesAndFoldersOperation operation;
- if (lastValidOperation == DND.DROP_COPY) {
- operation = new CopyFilesAndFoldersOperation(getShell());
- }
- else {
- operation = new MoveFilesAndFoldersOperation(getShell());
- }
- message = operation.validateDestination(destination, selectedResources);
- }
- } // file import?
- else if (FileTransfer.getInstance().isSupportedType(transferType)) {
- String[] sourceNames = (String[]) FileTransfer.getInstance().nativeToJava(transferType);
- if (sourceNames == null) {
- // source names will be null on Linux. Use empty names to do destination validation.
- // Fixes bug 29778
- sourceNames = new String[0];
- }
- CopyFilesAndFoldersOperation copyOperation = new CopyFilesAndFoldersOperation(getShell());
- message = copyOperation.validateImportDestination(destination, sourceNames);
- }
- if (message != null) {
- return error(message);
- }
- return ok();
- }
-}
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 c999fc9..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/NavigatorFrameSource.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.dialogs.MessageDialog;
-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) {
- IResource resource = (IResource) frame.getInput();
- IProject project = resource.getProject();
-
- if (project != null && project.isOpen() == false) {
- MessageDialog.openInformation(
- navigator.getViewSite().getShell(),
- ResourceNavigatorMessages.getString("NavigatorFrameSource.closedProject.title"), //$NON-NLS-1$
- ResourceNavigatorMessages.format("NavigatorFrameSource.closedProject.message", new Object[]{project.getName()})); //$NON-NLS-1$
- navigator.getFrameList().back();
- }
- else {
- 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 be84f73..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/OpenActionGroup.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-
-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();
- }
- }
-}
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 4412833..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/PasteAction.java
+++ /dev/null
@@ -1,223 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import java.util.List;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.*;
-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);
-}
-/**
- * Returns the actual target of the paste action. Returns null
- * if no valid target is selected.
- *
- * @return the actual target of the paste action
- */
-private IResource getTarget() {
- List selectedResources = getSelectedResources();
-
- for (int i = 0; i < selectedResources.size(); i++) {
- IResource resource = (IResource)selectedResources.get(i);
-
- if (resource instanceof IProject && !((IProject)resource).isOpen())
- return null;
- if (resource.getType() == IResource.FILE)
- resource = resource.getParent();
- if (resource != null)
- return resource;
- }
- return null;
-}
-/**
- * Returns whether any of the given resources are linked resources.
- *
- * @param resources resource to check for linked type. may be null
- * @return true=one or more resources are linked. false=none of the
- * resources are linked
- */
-private boolean isLinked(IResource[] resources) {
- for (int i = 0; i < resources.length; i++) {
- if (resources[i].isLinked())
- return true;
- }
- return false;
-}
-/**
- * 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 && resourceData.length > 0) {
- if (resourceData[0].getType() == IResource.PROJECT) {
- // enablement checks for all projects
- for (int i = 0; i < resourceData.length; i++) {
- CopyProjectOperation operation = new CopyProjectOperation(this.shell);
- operation.copyProject((IProject) resourceData[i]);
- }
- } 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.
- *
- * -Clipboard must have IResource or java.io.File
- * -Projects can always be pasted if they are open
- * -Workspace folder may not be copied into itself
- * -Files and folders may be pasted to a single selected folder in open
- * project or multiple selected files in the same folder
- */
-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);
- boolean isProjectRes = resourceData != null
- && resourceData.length > 0
- && resourceData[0].getType() == IResource.PROJECT;
-
- if (isProjectRes) {
- for (int i = 0; i < resourceData.length; i++) {
- // make sure all resource data are open projects
- // can paste open projects regardless of selection
- if (resourceData[i].getType() != IResource.PROJECT || ((IProject) resourceData[i]).isOpen() == false)
- return false;
- }
- return true;
- }
-
- if (getSelectedNonResources().size() > 0)
- return false;
-
- IResource targetResource = getTarget();
- // targetResource is null if no valid target is selected (e.g., open project)
- // or selection is empty
- if (targetResource == null)
- return false;
-
- // can paste files and folders to a single selection (file, folder,
- // open project) or multiple file selection with the same parent
- List selectedResources = getSelectedResources();
- 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.equals(resource.getParent()))
- return false;
- }
- }
- if (resourceData != null) {
- // linked resources can only be pasted into projects
- if (isLinked(resourceData) && targetResource.getType() != IResource.PROJECT)
- return false;
-
- if (targetResource.getType() == IResource.FOLDER) {
- // 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;
- }
- TransferData[] transfers = clipboard.getAvailableTypes();
- FileTransfer fileTransfer = FileTransfer.getInstance();
- for (int i = 0; i < transfers.length; i++) {
- if (fileTransfer.isSupportedType(transfers[i]))
- return true;
- }
- return false;
-}
-}
-
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 a06330d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/RefactorActionGroup.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- * Sebastian Davids <sdavids@gmx.de> - Images for menu items
-************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-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.ui.IActionBars;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.PlatformUI;
-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);
- }
-
- public void dispose() {
- if (clipboard != null) {
- clipboard.dispose();
- clipboard = null;
- }
- super.dispose();
- }
-
- 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);
- }
-
- /**
- * 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();
- }
- }
- }
-
- protected void makeActions() {
- TreeViewer treeViewer = (TreeViewer) navigator.getViewer();
- Shell shell = navigator.getSite().getShell();
- clipboard = new Clipboard(shell.getDisplay());
-
- pasteAction = new PasteAction(shell, clipboard);
- ISharedImages images = PlatformUI.getWorkbench().getSharedImages();
- pasteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_DISABLED));
- pasteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
- pasteAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_HOVER));
-
- copyAction = new CopyAction(shell, clipboard, pasteAction);
- copyAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_DISABLED));
- copyAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
- copyAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_HOVER));
-
- moveAction = new ResourceNavigatorMoveAction(shell, treeViewer);
- renameAction = new ResourceNavigatorRenameAction(shell, treeViewer);
-
- deleteAction = new DeleteResourceAction(shell);
- deleteAction.setDisabledImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
- deleteAction.setImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
- deleteAction.setHoverImageDescriptor(images.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_HOVER));
- }
-
- public void updateActionBars() {
- IStructuredSelection selection =
- (IStructuredSelection) getContext().getSelection();
-
- copyAction.selectionChanged(selection);
- pasteAction.selectionChanged(selection);
- deleteAction.selectionChanged(selection);
- moveAction.selectionChanged(selection);
- renameAction.selectionChanged(selection);
- }
-
-}
\ 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 93131b1..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigator.java
+++ /dev/null
@@ -1,1301 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.navigator;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.FileTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-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.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPreferenceConstants;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ResourceWorkingSetFilter;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.ViewsPlugin;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.part.ISetSelectionTarget;
-import org.eclipse.ui.part.IShowInSource;
-import org.eclipse.ui.part.IShowInTarget;
-import org.eclipse.ui.part.PluginTransfer;
-import org.eclipse.ui.part.ResourceTransfer;
-import org.eclipse.ui.part.ShowInContext;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.views.framelist.FrameList;
-import org.eclipse.ui.views.framelist.TreeFrame;
-
-/**
- * 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();
- private boolean linkingEnabled;
- private boolean dragDetected;
- private Listener dragDetectListener;
-
- /**
- * Settings constant for section name (value <code>ResourceNavigator</code>).
- */
- private static final String STORE_SECTION = "ResourceNavigator"; //$NON-NLS-1$
- /**
- * Settings constant for sort order (value <code>ResourceViewer.STORE_SORT_TYPE</code>).
- */
- private static final String STORE_SORT_TYPE = "ResourceViewer.STORE_SORT_TYPE"; //$NON-NLS-1$
- /**
- * Settings constant for working set (value <code>ResourceWorkingSetFilter.STORE_WORKING_SET</code>).
- */
- 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;
-
- // 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 static final String TAG_CURRENT_FRAME = "currentFrame"; //$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 viewsSettings = getPlugin().getDialogSettings();
-
- settings = viewsSettings.getSection(STORE_SECTION);
- if (settings == null) {
- settings = viewsSettings.addNewSection(STORE_SECTION);
- migrateDialogSettings();
- }
-
- initLinkingEnabled();
- }
- /**
- * 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();
- restoreLinkingEnabled();
- }
- frameList = createFrameList();
- initDragAndDrop();
- updateTitle();
-
- initContextMenu();
-
- initResourceSorter();
- initWorkingSetFilter();
-
- // make sure input is set after sorters and filters,
- // to avoid unnecessary refreshes
- viewer.setInput(getInitialInput());
-
- // make actions after setting input, because some actions
- // look at the viewer for enablement (e.g. the Up action)
- makeActions();
-
- // 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);
- }
-
- /**
- * Initializes the linking enabled setting from the preference store.
- */
- private void initLinkingEnabled() {
- // Try the dialog settings first, which remember the last choice.
- String setting = settings.get(IWorkbenchPreferenceConstants.LINK_NAVIGATOR_TO_EDITOR);
- if (setting != null) {
- linkingEnabled = setting.equals("true"); //$NON-NLS-1$
- return;
- }
- // If not in the dialog settings, check the preference store for the default setting.
- // Use the UI plugin's preference store since this is a public preference.
- AbstractUIPlugin uiPlugin =
- (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- linkingEnabled =
- uiPlugin.getPreferenceStore().getBoolean(
- IWorkbenchPreferenceConstants.LINK_NAVIGATOR_TO_EDITOR);
- }
-
- /**
- * 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();
- }
- Control control = viewer.getControl();
- if (dragDetectListener != null && control != null && control.isDisposed() == false) {
- control.removeListener(SWT.DragDetect, dragDetectListener);
- }
- super.dispose();
- }
-
- /**
- * An editor has been activated. Sets the selection in this navigator
- * to be the editor's input, if linking is enabled.
- *
- * @param editor the active editor
- * @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(ViewsPlugin.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) {
- final IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- updateStatusLine(sel);
- updateActionBars(sel);
- dragDetected = false;
- if (isLinkingEnabled()) {
- getShell().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (dragDetected == false) {
- // only synchronize with editor when the selection is not the result
- // of a drag. Fixes bug 22274.
- 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[] {
- LocalSelectionTransfer.getInstance(),
- 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);
- dragDetectListener = new Listener() {
- public void handleEvent(Event event) {
- dragDetected = true;
- }
- };
- viewer.getControl().addListener(SWT.DragDetect, dragDetectListener);
- }
-
- /**
- * 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) { //$NON-NLS-1$
- IWorkingSetManager workingSetManager =
- getPlugin().getWorkbench().getWorkingSetManager();
- IWorkingSet workingSet = workingSetManager.getWorkingSet(workingSetName);
-
- if (workingSet != null) {
- // Only initialize filter. Don't set working set into viewer.
- // Working set is set via WorkingSetFilterActionGroup
- // during action creation.
- workingSetFilter.setWorkingSet(workingSet);
- }
- }
- }
-
- /**
- * Returns whether the navigator selection automatically tracks the active
- * editor.
- *
- * @return <code>true</code> if linking is enabled, <code>false</code> if not
- * @since 2.0 (this was protected in 2.0, but was made public in 2.1)
- */
- public boolean isLinkingEnabled() {
- return linkingEnabled;
- }
-
- /**
- * Activates the editor if the selected resource is open.
- *
- * @since 2.0
- */
- protected void linkToEditor(IStructuredSelection selection) {
- 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));
- }
-
- /**
- * Migrates the dialog settings from the UI plugin store to the
- * Views plugin store.
- */
- private void migrateDialogSettings() {
- AbstractUIPlugin uiPlugin = (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- IDialogSettings uiSettings = uiPlugin.getDialogSettings();
-
- uiSettings = uiSettings.getSection(STORE_SECTION);
- if (uiSettings != null) {
- String workingSetName = uiSettings.get(STORE_WORKING_SET);
- if (workingSetName != null && workingSetName.length() > 0) {
- settings.put(STORE_WORKING_SET, workingSetName);
- uiSettings.put(STORE_WORKING_SET, ""); //$NON-NLS-1$
- }
- String sortType = uiSettings.get(STORE_SORT_TYPE);
- if (sortType != null && sortType.length() > 0) {
- settings.put(STORE_SORT_TYPE, sortType);
- uiSettings.put(STORE_SORT_TYPE, ""); //$NON-NLS-1$
- }
- }
- }
-
- /**
- * 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();
- IMemento frameMemento = memento.getChild(TAG_CURRENT_FRAME);
-
- if (frameMemento != null) {
- TreeFrame frame = new TreeFrame(viewer);
- frame.restoreState(frameMemento);
- frame.setName(getFrameName(frame.getInput()));
- frame.setToolTipText(getFrameToolTipText(frame.getInput()));
- viewer.setSelection(new StructuredSelection(frame.getInput()));
- frameList.gotoFrame(frame);
- }
- else {
- 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));
- }
- }
- }
-
- /**
- * Restores the linking enabled state.
- */
- private void restoreLinkingEnabled() {
- Integer val = memento.getInteger(IWorkbenchPreferenceConstants.LINK_NAVIGATOR_TO_EDITOR);
- if (val != null) {
- linkingEnabled = val.intValue() != 0;
- }
- }
-
- /**
- * @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)));
- }
-
- if (frameList.getCurrentIndex() > 0) {
- //save frame, it's not the "home"/workspace frame
- TreeFrame currentFrame = (TreeFrame) frameList.getCurrentFrame();
- IMemento frameMemento = memento.createChild(TAG_CURRENT_FRAME);
- currentFrame.saveState(frameMemento);
- }
- else {
- //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());
- }
- }
- }
-
- saveLinkingEnabled(memento);
- }
-
- /**
- * Saves the linking enabled state.
- */
- private void saveLinkingEnabled(IMemento memento) {
- memento.putInteger(
- IWorkbenchPreferenceConstants.LINK_NAVIGATOR_TO_EDITOR,
- linkingEnabled ? 1 : 0);
- }
-
- /**
- * 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]);
- }
-
- getPlugin().getPreferenceStore().setValue(
- ResourcePatternFilter.FILTERS_TAG,
- sb.toString());
-
- // remove value in old workbench preference store location
- IPreferenceStore preferenceStore = WorkbenchPlugin.getDefault().getPreferenceStore();
- String storedPatterns = preferenceStore.getString(ResourcePatternFilter.FILTERS_TAG);
- if (storedPatterns.length() > 0)
- preferenceStore.setValue(ResourcePatternFilter.FILTERS_TAG, ""); //$NON-NLS-1$
- }
-
- /**
- * @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
- }
-
- /**
- * @see IResourceNavigator#setLinkingEnabled(boolean)
- * @since 2.1
- */
- public void setLinkingEnabled(boolean enabled) {
- this.linkingEnabled = enabled;
-
- // remember the last setting in the dialog settings
- settings.put(IWorkbenchPreferenceConstants.LINK_NAVIGATOR_TO_EDITOR, enabled);
-
- // if turning linking on, update the selection to correspond to the active editor
- if (enabled) {
- IEditorPart editor = getSite().getPage().getActiveEditor();
- if (editor != null) {
- editorActivated(editor);
- }
- }
- }
-
- /**
- * Sets the resource sorter.
- *
- * @param sorter the resource sorter
- * @since 2.0
- */
- public void setSorter(ResourceSorter sorter) {
- TreeViewer viewer = getTreeViewer();
- ViewerSorter viewerSorter = viewer.getSorter();
-
- viewer.getControl().setRedraw(false);
- if (viewerSorter == sorter) {
- viewer.refresh();
- } else {
- viewer.setSorter(sorter);
- }
- viewer.getControl().setRedraw(true);
- settings.put(STORE_SORT_TYPE, sorter.getCriteria());
-
- // update the sort actions' checked state
- updateActionBars((IStructuredSelection) viewer.getSelection());
- }
-
- /*
- * @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, ""); //$NON-NLS-1$
- }
- 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) {
- ResourceNavigatorActionGroup group = getActionGroup();
- if (group != null) {
- group.setContext(new ActionContext(selection));
- group.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;
- }
-
- /*
- * @see IWorkbenchPart#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IShowInSource.class) {
- return getShowInSource();
- }
- if (adapter == IShowInTarget.class) {
- return getShowInTarget();
- }
- return null;
- }
-
- /**
- * Returns the <code>IShowInSource</code> for this view.
- */
- protected IShowInSource getShowInSource() {
- return new IShowInSource() {
- public ShowInContext getShowInContext() {
- return new ShowInContext(
- getViewer().getInput(),
- getViewer().getSelection());
- }
- };
- }
-
- /**
- * Returns the <code>IShowInTarget</code> for this view.
- */
- protected IShowInTarget getShowInTarget() {
- return new IShowInTarget() {
- public boolean show(ShowInContext context) {
- ArrayList toSelect = new ArrayList();
- ISelection sel = context.getSelection();
- if (sel instanceof IStructuredSelection) {
- IStructuredSelection ssel = (IStructuredSelection) sel;
- for (Iterator i = ssel.iterator(); i.hasNext();) {
- Object o = i.next();
- if (o instanceof IResource) {
- toSelect.add(o);
- }
- else if (o instanceof IMarker) {
- IResource r = ((IMarker) o).getResource();
- if (r.getType() != IResource.ROOT) {
- toSelect.add(r);
- }
- }
- else if (o instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable) o;
- o = adaptable.getAdapter(IResource.class);
- if (o instanceof IResource) {
- toSelect.add(o);
- }
- else {
- o = adaptable.getAdapter(IMarker.class);
- if (o instanceof IMarker) {
- IResource r = ((IMarker) o).getResource();
- if (r.getType() != IResource.ROOT) {
- toSelect.add(r);
- }
- }
- }
- }
- }
- }
- if (toSelect.isEmpty()) {
- Object input = context.getInput();
- if (input instanceof IAdaptable) {
- IAdaptable adaptable = (IAdaptable) input;
- Object o = adaptable.getAdapter(IResource.class);
- if (o instanceof IResource) {
- toSelect.add(o);
- }
- }
- }
- if (!toSelect.isEmpty()) {
- selectReveal(new StructuredSelection(toSelect));
- return true;
- }
- return false;
- }
- };
- }
-}
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 55a22d8..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorAction.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.widgets.Shell;
-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();
- }
-}
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 2c6598d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorActionGroup.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- * Sebastian Davids <sdavids@gmx.de> - Images for menu items
-************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-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.swt.events.KeyEvent;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * 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 image descriptor with the given relative path.
- */
- protected 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();
- }
- }
-
- /**
- * Returns the resource navigator.
- */
- public IResourceNavigator getNavigator() {
- return navigator;
- }
-
- /**
- * Handles a key pressed event by invoking the appropriate action.
- * Does nothing by default.
- */
- public void handleKeyPressed(KeyEvent event) {
- }
-
- /**
- * 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) {
- }
-
-}
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 ca17c68..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorMessages.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-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 0859d2d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorMoveAction.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-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.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 ebaa5cc..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceNavigatorRenameAction.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-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.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-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();
- }
- }
-}
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 9d5392b..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourcePatternFilter.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.ui.internal.ViewsPlugin;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-/**
- * 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() {
- // get the filters that were saved by ResourceNavigator.setFiltersPreference
- IPreferenceStore viewsPrefs = ViewsPlugin.getDefault().getPreferenceStore();
- String storedPatterns = viewsPrefs.getString(FILTERS_TAG);
-
- if (storedPatterns.length() == 0) {
- // try to migrate patterns from old workbench preference store location
- IPreferenceStore workbenchPrefs = WorkbenchPlugin.getDefault().getPreferenceStore();
- storedPatterns = workbenchPrefs.getString(FILTERS_TAG);
- if (storedPatterns.length() > 0) {
- viewsPrefs.setValue(FILTERS_TAG, storedPatterns);
- workbenchPrefs.setValue(FILTERS_TAG, ""); //$NON-NLS-1$
- }
- }
-
- 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 b7c4af2..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceSelectionUtil.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-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 36c6dcf..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ResourceSorter.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-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 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$
- }
- /**
- * Sets the sort criteria of this sorter.
- *
- * @param criteria the sort criterion:
- * one of <code>ResourceSorter.NAME</code> or
- * <code>ResourceSorter.TYPE</code>
- */
- public void setCriteria(int criteria) {
- this.criteria = criteria;
- }
-}
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 9ed2aba..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ShowInNavigatorAction.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-
-import java.util.*;
-
-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.util.Assert;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.actions.SelectionProviderAction;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.ISetSelectionTarget;
-
-/**
- * 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 1a13db1..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/SortAndFilterActionGroup.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- * Sebastian Davids <sdavids@gmx.de> - Images for menu items
-************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-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$
- filterAction.setDisabledImageDescriptor(getImageDescriptor("dlcl16/filter_ps.gif"));//$NON-NLS-1$
- filterAction.setImageDescriptor(getImageDescriptor("elcl16/filter_ps.gif"));//$NON-NLS-1$
- filterAction.setHoverImageDescriptor(getImageDescriptor("clcl16/filter_ps.gif"));//$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 a38defc..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/SortViewAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * Implementation of the view sorting actions.
- * @since 2.0
- */
-public class SortViewAction extends ResourceNavigatorAction {
- private int sortCriteria;
-
-/**
- * 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);
- sortCriteria = sortByType ? ResourceSorter.TYPE : ResourceSorter.NAME;
- WorkbenchHelp.setHelp(this, INavigatorHelpContextIds.SORT_VIEW_ACTION);
-}
-public void run() {
- IResourceNavigator navigator = getNavigator();
- ResourceSorter sorter = navigator.getSorter();
-
- if (sorter == null)
- navigator.setSorter(new ResourceSorter(sortCriteria));
- else {
- sorter.setCriteria(sortCriteria);
- navigator.setSorter(sorter);
- }
-
-}
-}
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 0b00b8d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/StringMatcher.java
+++ /dev/null
@@ -1,392 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import java.util.Vector;
-
-/**
- * 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;
- }
- }
- if ((fSegments.length == 1) && (!fHasLeadingStar) && (!fHasTrailingStar)) {
- // only one segment to match, no wildcards specified
- return tCurPos == end;
- }
- /* 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/ToggleLinkingAction.java b/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ToggleLinkingAction.java
deleted file mode 100644
index 4958d29..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/ToggleLinkingAction.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.navigator;
-
-/**
- * This action toggles whether this navigator links its selection to the active
- * editor.
- *
- * @since 2.1
- */
-public class ToggleLinkingAction extends ResourceNavigatorAction {
-
- /**
- * Constructs a new action.
- */
- public ToggleLinkingAction(IResourceNavigator navigator, String label) {
- super(navigator, label);
- setChecked(navigator.isLinkingEnabled());
- }
-
- /**
- * Runs the action.
- */
- public void run() {
- getNavigator().setLinkingEnabled(isChecked());
- }
-
-}
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 b0bb72f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/WorkspaceActionGroup.java
+++ /dev/null
@@ -1,193 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- * Sebastian Davids <sdavids@gmx.de> - Images for menu items
-************************************************************************/
-package org.eclipse.ui.views.navigator;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.ICommand;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IncrementalProjectBuilder;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.BuildAction;
-import org.eclipse.ui.actions.CloseResourceAction;
-import org.eclipse.ui.actions.OpenResourceAction;
-import org.eclipse.ui.actions.RefreshAction;
-
-/**
- * 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);
- }
-
- 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);
- }
- /**
- * Adds the build, open project, close project and refresh resource
- * actions to the context menu.
- * <p>
- * The following conditions apply:
- * build-only projects selected, auto build disabled, at least one
- * builder present
- * open project-only projects selected, at least one closed project
- * close project-only projects selected, at least one open project
- * refresh-no closed project selected
- * </p>
- * <p>
- * Both the open project and close project action may be on the menu
- * at the same time.
- * </p>
- * <p>
- * No disabled action should be on the context menu.
- * </p>
- *
- * @param menu context menu to add actions to
- */
- public void fillContextMenu(IMenuManager menu) {
- IStructuredSelection selection =
- (IStructuredSelection) getContext().getSelection();
- boolean isProjectSelection = true;
- boolean hasOpenProjects = false;
- boolean hasClosedProjects = false;
- boolean hasBuilder = true; // false if any project is closed or does not have builder
- Iterator resources = selection.iterator();
-
- while (resources.hasNext() &&
- (!hasOpenProjects || !hasClosedProjects ||
- hasBuilder || isProjectSelection)) {
- Object next = resources.next();
- IProject project = null;
-
- if (next instanceof IProject)
- project = (IProject) next;
- else if (next instanceof IAdaptable)
- project = (IProject) ((IAdaptable) next).getAdapter(IProject.class);
-
- if (project == null) {
- isProjectSelection = false;
- continue;
- }
- if (project.isOpen()) {
- hasOpenProjects = true;
- if (hasBuilder && !hasBuilder(project))
- hasBuilder = false;
- } else {
- hasClosedProjects = true;
- hasBuilder = false;
- }
- }
- if (!selection.isEmpty() && isProjectSelection &&
- !ResourcesPlugin.getWorkspace().isAutoBuilding() && hasBuilder) {
- // Allow manual incremental build only if auto build is off.
- buildAction.selectionChanged(selection);
- menu.add(buildAction);
- }
- if (!hasClosedProjects) {
- refreshAction.selectionChanged(selection);
- menu.add(refreshAction);
- }
- if (isProjectSelection) {
- if (hasClosedProjects) {
- openProjectAction.selectionChanged(selection);
- menu.add(openProjectAction);
- }
- if (hasOpenProjects) {
- closeProjectAction.selectionChanged(selection);
- menu.add(closeProjectAction);
- }
- }
- }
- /**
- * Handles a key pressed event by invoking the appropriate action.
- */
- public void handleKeyPressed(KeyEvent event) {
- if (event.keyCode == SWT.F5 && event.stateMask == 0) {
- if (refreshAction.isEnabled()) {
- refreshAction.refreshAll();
- }
- }
- }
- /**
- * 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 could not be determined
- */
- boolean hasBuilder(IProject project) {
- try {
- ICommand[] commands = project.getDescription().getBuildSpec();
- if (commands.length > 0)
- return true;
- }
- catch (CoreException e) {
- // Cannot determine if project has builders. Project is closed
- // or does not exist. Fall through to return false.
- }
- return false;
- }
-
- protected void makeActions() {
- Shell shell = navigator.getSite().getShell();
- openProjectAction = new OpenResourceAction(shell);
- closeProjectAction = new CloseResourceAction(shell);
- refreshAction = new RefreshAction(shell);
- refreshAction.setDisabledImageDescriptor(getImageDescriptor("dlcl16/refresh_nav.gif"));//$NON-NLS-1$
- refreshAction.setImageDescriptor(getImageDescriptor("elcl16/refresh_nav.gif"));//$NON-NLS-1$
- refreshAction.setHoverImageDescriptor(getImageDescriptor("clcl16/refresh_nav.gif"));//$NON-NLS-1$
-
- buildAction = new BuildAction(shell, IncrementalProjectBuilder.INCREMENTAL_BUILD);
- rebuildAction = new BuildAction(shell, IncrementalProjectBuilder.FULL_BUILD);
- }
-
- public void updateActionBars() {
- IStructuredSelection selection =
- (IStructuredSelection) getContext().getSelection();
- refreshAction.selectionChanged(selection);
- buildAction.selectionChanged(selection);
- rebuildAction.selectionChanged(selection);
- openProjectAction.selectionChanged(selection);
- closeProjectAction.selectionChanged(selection);
- }
-}
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 e3a7646..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/navigator/messages.properties
+++ /dev/null
@@ -1,99 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-
-# 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
-
-ToggleLinkingAction.text = &Link with Editor
-ToggleLinkingAction.toolTip = Link with Editor
-
-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
-
-CollapseAllAction.title = Co&llapse All
-CollapseAllAction.toolTip = Collapse All
-
-GoToResource.showNavError=Could not open resource navigator view.
-GoToResource.label=&Resource...
-
-NavigatorFrameSource.closedProject.title=Closed Project
-NavigatorFrameSource.closedProject.message=You attempted to go into a closed project: {0}\nPlease open the project and try again.
-# --- 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}
-DropAdapter.dropOperationErrorOther = An error occurred during the drop operation.
-
-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?
-
-LocalSelectionTransfer.errorMessage=Received wrong transfer data.
\ No newline at end of file
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 40e4d08..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CategoriesAction.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * 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 77f3119..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ColorPropertyDescriptor.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColorCellEditor;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * 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 10267b1..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * 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, SWT.READ_ONLY);
- 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 7451be8..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CopyPropertyAction.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.properties;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.dnd.*;
-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, Clipboard clipboard) {
- super(viewer, name);
- WorkbenchHelp.setHelp(this, IPropertiesHelpContextIds.COPY_PROPERTY_ACTION);
- this.clipboard = clipboard;
- }
-
- /**
- * 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 98bcb11..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/DefaultsAction.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.properties;
-
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * 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);
- 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 486126f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/FilePropertySource.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-
-/**
- * The FilePropertySource gives the extra information that is shown for files
- */
-public class FilePropertySource extends ResourcePropertySource {
-
- private static PropertyDescriptor fileDescriptor;
- {
- fileDescriptor =
- new PropertyDescriptor(
- IResourcePropertyConstants.P_SIZE_RES,
- IResourcePropertyConstants.P_DISPLAY_SIZE);
- fileDescriptor.setAlwaysIncompatible(true);
- fileDescriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
- }
-/**
- * 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() {
- return fileDescriptor;
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource.
- */
-public IPropertyDescriptor[] getPropertyDescriptors() {
- IPropertyDescriptor[] superDescriptors = super.getPropertyDescriptors();
- int superLength = superDescriptors.length;
- IPropertyDescriptor[] fileDescriptors = new IPropertyDescriptor[superLength + 1];
- System.arraycopy(superDescriptors, 0, fileDescriptors, 0, superLength);
- fileDescriptors[superLength] = getInitialPropertyDescriptor();
-
- 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 {
- IPath location = file.getLocation();
- if (location == null) {
- if (file.isLinked())
- return UNDEFINED_PATH_VARIABLE;
-
- return FILE_NOT_FOUND;
- }
- else {
- File localFile = location.toFile();
-
- if (localFile.exists()) {
- return Long.toString(localFile.length());
- }
- return FILE_NOT_FOUND;
- }
- }
-}
-
-}
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 acfb290..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/FilterAction.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.properties;
-
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * 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);
- 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 2a2eb05..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ICellEditorActivationListener.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-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 18b9ab6..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertiesHelpContextIds.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-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 fced1cf..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertyDescriptor.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-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 435dab2..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntry.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-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 505b210..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetEntryListener.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-/**
- * 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 2130c7a..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySheetPage.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.part.IPage;
-
-/**
- * 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 f89df9e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySource.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-
-/**
- * Interface to an object which is 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 org.eclipse.ui.views.properties.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 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
- * as 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 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>). 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 it has been editted
- * </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 09e696e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IPropertySourceProvider.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-/**
- * 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 5d279b2..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/IResourcePropertyConstants.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-/**
- * 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> property key for read-only.
- */
- public static final String P_DERIVED_RES = "org.eclipse.ui.derived"; //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> property key for display read-only.
- */
- public static final String P_DISPLAYDERIVED_RES = PropertiesMessages.getString("IResourcePropertyConstants.derived"); //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> property key for location.
- */
- public static final String P_LOCATION_RES = "org.eclipse.ui.location"; //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> property key for display location.
- */
- public static final String P_DISPLAYLOCATION_RES = PropertiesMessages.getString("IResourcePropertyConstants.location"); //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> property key for resolved location.
- */
- public static final String P_RESOLVED_LOCATION_RES = "org.eclipse.ui.resolvedLocation"; //$NON-NLS-1$,
-
- /**
- * The <code>IResource</code> property key for display resolved location.
- */
- public static final String P_DISPLAYRESOLVED_LOCATION_RES = PropertiesMessages.getString("IResourcePropertyConstants.resolvedLocation"); //$NON-NLS-1$
-
- /**
- * The <code>IResource</code> property key for linked.
- */
- public static final String P_LINKED_RES = "org.eclipse.ui.linked"; //$NON-NLS-1$,
-
- /**
- * The <code>IResource</code> property key for display linked.
- */
- public static final String P_DISPLAYLINKED_RES = PropertiesMessages.getString("IResourcePropertyConstants.linked"); //$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 09b7e4f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertiesMessages.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.properties;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps manage 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 eae08d0..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java
+++ /dev/null
@@ -1,327 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.*;
-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 3897688..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.*;
-
-/**
- * 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 7688f7a..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetAction.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-
-import org.eclipse.jface.action.Action;
-
-/**
- * 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 5cc38bc..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetCategory.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-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 82d848f..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java
+++ /dev/null
@@ -1,639 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.properties;
-
-import java.text.Collator;
-import java.util.*;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <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() {
- if (editor == null)
- return;
-
- // Check if editor has a valid value
- if (!editor.isValueValid()) {
- setErrorText(editor.getErrorMessage());
- return;
- } else {
- setErrorText(null);
- }
-
- // 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 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 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 3d8aa0e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java
+++ /dev/null
@@ -1,427 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.properties;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.help.IContext;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.swt.custom.TableTree;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSource;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.swt.events.HelpListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-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 ICellEditorActivationListener cellEditorActivationListener;
- private CellEditorActionHandler cellEditorActionHandler;
-
- private Clipboard clipboard;
- /**
- * 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();
- makeActions();
-
- // Create the popup menu for the page.
- MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.add(copyAction);
- menuMgr.add(new Separator());
- menuMgr.add(defaultsAction);
- 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();
- rootEntry = null;
- }
- if (clipboard != null) {
- clipboard.dispose();
- clipboard = null;
- }
- }
- /**
- * 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) {
- if (selection.isEmpty()) {
- defaultsAction.setEnabled(false);
- return;
- }
- // see if item is editable
- boolean editable = viewer.getActiveCellEditor() != null;
- defaultsAction.setEnabled(editable);
- }
- }
- /**
- * 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() {
- ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
-
- // Restore Default Value
- defaultsAction = new DefaultsAction(viewer, "defaults"); //$NON-NLS-1$
- defaultsAction.setText(PropertiesMessages.getString("Defaults.text")); //$NON-NLS-1$
- defaultsAction.setToolTipText(PropertiesMessages.getString("Defaults.toolTip")); //$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);
-
- // Show Advanced Properties
- filterAction = new FilterAction(viewer, "filter"); //$NON-NLS-1$
- filterAction.setText(PropertiesMessages.getString("Filter.text")); //$NON-NLS-1$
- filterAction.setToolTipText(PropertiesMessages.getString("Filter.toolTip")); //$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);
-
- // Show Categories
- categoriesAction = new CategoriesAction(viewer, "categories"); //$NON-NLS-1$
- categoriesAction.setText(PropertiesMessages.getString("Categories.text")); //$NON-NLS-1$
- categoriesAction.setToolTipText(PropertiesMessages.getString("Categories.toolTip")); //$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);
-
- // Copy
- Shell shell = viewer.getControl().getShell();
- clipboard = new Clipboard(shell.getDisplay());
- copyAction = new CopyPropertyAction(viewer, "copy", clipboard); //$NON-NLS-1$
- copyAction.setText(PropertiesMessages.getString("CopyProperty.text")); //$NON-NLS-1$
- copyAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
- copyAction.setHoverImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_HOVER));
-
-
- }
- /* (non-Javadoc)
- * Method declared on IPage (and Page).
- */
- public void makeContributions(IMenuManager menuManager, IToolBarManager toolBarManager, IStatusLineManager statusLineManager) {
-
- // add actions to the tool bar
- toolBarManager.add(categoriesAction);
- toolBarManager.add(filterAction);
- toolBarManager.add(defaultsAction);
-
- // add actions to the menu
- menuManager.add(categoriesAction);
- menuManager.add(filterAction);
-
- // 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 default 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);
- }
-}
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 034eca5..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPageContextComputer.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-import java.util.ArrayList;
-
-import org.eclipse.help.IContext;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.ui.help.IContextComputer;
-
-/**
- * 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 013eb01..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetViewer.java
+++ /dev/null
@@ -1,1121 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.properties;
-
-import java.text.Collator;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.util.ListenerList;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ICellEditorListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TableTree;
-import org.eclipse.swt.custom.TableTreeEditor;
-import org.eclipse.swt.custom.TableTreeItem;
-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.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.TreeEvent;
-import org.eclipse.swt.events.TreeListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.Widget;
-/**
- * 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.misc"); //$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 selection the TableTreeItem that is selected
- */
- private void handleSelect(TableTreeItem selection) {
- // deactivate the current cell editor
- if (cellEditor != null) {
- applyEditorValue();
- deactivateCellEditor();
- }
-
- // get the new selection
- TableTreeItem[] sel = new TableTreeItem[] {selection};
- 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
- // Part1: Double click only (allow traversal via keyboard without
- // activation
- tableTree.addSelectionListener(new SelectionAdapter() {
- public void widgetDefaultSelected(SelectionEvent e) {
- handleSelect((TableTreeItem)e.item);
- }
- });
- // Part2: handle single click activation of cell editor
- tableTree.getTable().addMouseListener(new MouseAdapter() {
- public void mouseDown(MouseEvent event) {
- // only activate if there is a cell editor
- Point pt = new Point (event.x, event.y);
- TableTreeItem item = tableTree.getItem(pt);
- if (item != null) {
- handleSelect(item);
- }
- }
- });
-
- // 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
- }
- }
-}
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 cfd2ddb..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ResourcePropertySource.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-import java.io.File;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-
-/**
- * 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$
- protected static String UNDEFINED_PATH_VARIABLE = PropertiesMessages.getString("PropertySource.undefinedPathVariable"); //$NON-NLS-1$
- protected static String FILE_NOT_EXIST_TEXT = PropertiesMessages.getString("PropertySource.fileNotExist"); //$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[7];
- static protected IPropertyDescriptor[] propertyDescriptorsLinkVariable =
- new IPropertyDescriptor[8];
- {
- 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;
- propertyDescriptorsLinkVariable[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;
- propertyDescriptorsLinkVariable[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;
- propertyDescriptorsLinkVariable[2] = descriptor;
-
- // derived state
- descriptor =
- new PropertyDescriptor(
- IResourcePropertyConstants.P_DERIVED_RES,
- IResourcePropertyConstants.P_DISPLAYDERIVED_RES);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
- propertyDescriptors[3] = descriptor;
- propertyDescriptorsLinkVariable[3] = 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[4] = descriptor;
- propertyDescriptorsLinkVariable[4] = descriptor;
-
- // link state
- descriptor =
- new PropertyDescriptor(
- IResourcePropertyConstants.P_LINKED_RES,
- IResourcePropertyConstants.P_DISPLAYLINKED_RES);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
- propertyDescriptors[5] = descriptor;
- propertyDescriptorsLinkVariable[5] = descriptor;
-
- // location
- descriptor =
- new PropertyDescriptor(
- IResourcePropertyConstants.P_LOCATION_RES,
- IResourcePropertyConstants.P_DISPLAYLOCATION_RES);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
- propertyDescriptors[6] = descriptor;
- propertyDescriptorsLinkVariable[6] = descriptor;
-
- // resolved location
- descriptor =
- new PropertyDescriptor(
- IResourcePropertyConstants.P_RESOLVED_LOCATION_RES,
- IResourcePropertyConstants.P_DISPLAYRESOLVED_LOCATION_RES);
- descriptor.setAlwaysIncompatible(true);
- descriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
- propertyDescriptorsLinkVariable[7] = 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;
-
- IPath location = resource.getLocation();
- if (location == null) {
- if (resource.isLinked())
- return UNDEFINED_PATH_VARIABLE;
-
- return FILE_NOT_FOUND;
- }
- else {
- File localFile = location.toFile();
- if (localFile.exists()) {
- DateFormat format = new SimpleDateFormat();
- return format.format(new Date(localFile.lastModified()));
- }
- return FILE_NOT_FOUND;
- }
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource.
- */
-public Object getEditableValue() {
- return this;
-}
-/**
- * Get the location of a resource
- */
-private String getLocationText(IResource resource) {
- if (!resource.isLocal(IResource.DEPTH_ZERO))
- return NOT_LOCAL_TEXT;
-
- IPath resolvedLocation = resource.getLocation();
- IPath location = resolvedLocation;
- if (resource.isLinked()) {
- location = resource.getRawLocation();
- }
- if (location == null) {
- return FILE_NOT_FOUND;
- }
- else {
- String locationString = location.toOSString();
- if (resolvedLocation != null && !isPathVariable(resource)) {
- // No path variable used. Display the file not exist message
- // in the location. Fixes bug 33318.
- File file = resolvedLocation.toFile();
- if (!file.exists()) {
- locationString += " " + FILE_NOT_EXIST_TEXT; //$NON-NLS-1$
- }
- }
- return locationString;
- }
-}
-/**
- * Get the resolved location of a resource.
- * This resolves path variables if present in the resource path.
- */
-private String getResolvedLocationText(IResource resource) {
- if (!resource.isLocal(IResource.DEPTH_ZERO))
- return NOT_LOCAL_TEXT;
-
- IPath location = resource.getLocation();
- if (location == null) {
- if (resource.isLinked())
- return UNDEFINED_PATH_VARIABLE;
-
- return FILE_NOT_FOUND;
- }
- else {
- String locationString = location.toOSString();
- File file = location.toFile();
-
- if (!file.exists()) {
- locationString += " " + FILE_NOT_EXIST_TEXT; //$NON-NLS-1$
- }
- return locationString;
- }
-}
-/* (non-Javadoc)
- * Method declared on IPropertySource.
- */
-public IPropertyDescriptor[] getPropertyDescriptors() {
- if (isPathVariable(element))
- return propertyDescriptorsLinkVariable;
- else
- 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 PropertiesMessages.getString("ResourceProperty.false"); //$NON-NLS-1$
- else
- return PropertiesMessages.getString("ResourceProperty.true"); //$NON-NLS-1$
- }
- if (name.equals(IResourcePropertyConstants.P_DERIVED_RES)) {
- return String.valueOf(element.isDerived());
- }
- if (name.equals(IResourcePropertyConstants.P_LINKED_RES)) {
- return String.valueOf(element.isLinked());
- }
- if (name.equals(IResourcePropertyConstants.P_LOCATION_RES)) {
- return getLocationText(element);
- }
- if (name.equals(IResourcePropertyConstants.P_RESOLVED_LOCATION_RES)) {
- return getResolvedLocationText(element);
- }
- return null;
-}
-/**
- * Returns whether the given resource is a linked resource bound
- * to a path variable.
- *
- * @param resource resource to test
- * @return boolean <code>true</code> the given resource is a linked
- * resource bound to a path variable. <code>false</code> the given
- * resource is either not a linked resource or it is not using a
- * path variable.
- */
-private boolean isPathVariable(IResource resource){
- if (!resource.isLinked())
- return false;
-
- IPath resolvedLocation = resource.getLocation();
- if (resolvedLocation == null) {
- // missing path variable
- return true;
- }
- IPath rawLocation = resource.getRawLocation();
- if (resolvedLocation.equals(rawLocation))
- return false;
-
- return true;
-}
-/* (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 12f8d37..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/StandardPropertiesAdapterFactory.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-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 d7318de..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/TextPropertyDescriptor.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.views.properties;
-
-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 8e400c8..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/messages.properties
+++ /dev/null
@@ -1,49 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-
-# package: org.eclipse.ui.views.properties
-
-# ==============================================================================
-# Properties View
-# ==============================================================================
-
-Categories.text = Show &Categories
-Categories.toolTip = Show Categories
-
-CopyProperty.text = &Copy
-
-Defaults.text = &Restore Default Value
-Defaults.toolTip = Restore Default Value
-
-Filter.text = Show &Advanced Properties
-Filter.toolTip = Show Advanced Properties
-
-PropertyViewer.property = Property
-PropertyViewer.value = Value
-PropertyViewer.misc = Misc
-PropertySource.notLocal = <not local>
-PropertySource.notFound = <resource does not exist>
-PropertySource.readOnly = Read only
-PropertySource.undefinedPathVariable = <undefined path variable>
-PropertySource.fileNotExist = - (does not exist)
-
-IResourcePropertyConstants.name = name
-IResourcePropertyConstants.path = path
-IResourcePropertyConstants.editable = editable
-IResourcePropertyConstants.derived = derived
-IResourcePropertyConstants.size = size
-IResourcePropertyConstants.lastModified = last modified
-IResourcePropertyConstants.info = Info
-IResourcePropertyConstants.location = location
-IResourcePropertyConstants.resolvedLocation = resolved location
-IResourcePropertyConstants.linked = linked
-ResourceProperty.false = false
-ResourceProperty.true = true
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 f45e75e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/CopyTaskAction.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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.*;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.part.MarkerTransfer;
-
-/**
- * Copies a task to the clipboard.
- */
-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 4245304..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/DefaultTaskListResourceAdapter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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;
-
- }
-
-}
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 c983b9b..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/FiltersAction.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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.
- */
-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 7ae1b88..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/FiltersDialog.java
+++ /dev/null
@@ -1,889 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-import java.text.Collator;
-import java.util.*;
-
-import org.eclipse.core.resources.IMarker;
-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.swt.SWT;
-import org.eclipse.swt.events.*;
-import org.eclipse.swt.graphics.Font;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-
-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) {
- Font font = parent.getFont();
- 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);
- enableButton.setFont(font);
- 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());
- valueButton.setFont(font);
- 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) {
- Font font = parent.getFont();
- 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);
- group.setFont(font);
- label = new Label(group, SWT.NONE);
- label.setText(labelText);
- label.setFont(font);
- 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.setFont(font);
- 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);
- composite.setFont(parent.getFont());
- 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);
- composite.setFont(parent.getFont());
-
- 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$
- }
-
- void createResetArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setFont(parent.getFont());
- composite.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
-
- Button reset = new Button(composite, SWT.PUSH);
- reset.setText(TaskListMessages.getString("TaskList.resetText")); //$NON-NLS-1$
- reset.setData(new Integer(RESET_ID));
-
- reset.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent event) {
- buttonPressed(((Integer) event.widget.getData()).intValue());
- }
- });
-
- reset.setFont(composite.getFont());
- setButtonLayoutData(reset);
- }
-
- /**
- * 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);
- button.setFont(parent.getFont());
- 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.setFont(parent.getFont());
- 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);
- createResetArea(composite);
- createSeparatorLine(composite);
-
- updateUIFromFilter(getFilter());
-
- return composite;
- }
-
- /**
- * Creates a separator line above the OK/Cancel buttons bar
- *
- * @param parent the parent composite
- */
- void createSeparatorLine(Composite parent) {
- // Build the separator line
- Label separator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 1;
- separator.setLayoutData(gd);
- }
-
- /**
- * 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.setFont(parent.getFont());
- 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());
- group.setFont(parent.getFont());
- 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) {
- Font font = parent.getFont();
- 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$
- label.setFont(font);
-
- typesViewer = new CheckboxTreeViewer(composite);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.heightHint = 100;
- typesViewer.getTree().setFont(font);
- 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) {
- Font font = parent.getFont();
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- composite.setFont(font);
- 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);
- markerLimit.setFont(font);
- }
-
- /**
- * 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$
- }
- );
- }
-
- /**
- * 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()); //$NON-NLS-1$
- 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 9d2063d..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/GotoTaskAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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.
- */
-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 a1cb564..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/IMarkerConstants.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-/**
- * This interface defines constants used for marker properties
- * and attributes.
- *
- * @see IMarker
- */
-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 f1e7074..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ITaskListHelpContextIds.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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>
- *
- */
-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$
- public static final String TASK_SORT_TYPE_ACTION = PREFIX + "task_sort_type_action_context"; //$NON-NLS-1$
- public static final String TASK_SORT_COMPLETED_ACTION = PREFIX + "task_sort_completed_action_context"; //$NON-NLS-1$
- public static final String TASK_SORT_PRIORITY_ACTION = PREFIX + "task_sort_priority_action_context"; //$NON-NLS-1$
- public static final String TASK_SORT_DESCRIPTION_ACTION = PREFIX + "task_sort_description_action_context"; //$NON-NLS-1$
- public static final String TASK_SORT_RESOURCE_ACTION = PREFIX + "task_sort_resource_action_context"; //$NON-NLS-1$
- public static final String TASK_SORT_FOLDER_ACTION = PREFIX + "task_sort_folder_action_context"; //$NON-NLS-1$
- public static final String TASK_SORT_LOCATION_ACTION = PREFIX + "task_sort_location_action_context"; //$NON-NLS-1$
- public static final String TASK_SORT_CREATION_TIME_ACTION = PREFIX + "task_sort_creation_time_action_context"; //$NON-NLS-1$
- public static final String TASK_SORT_ASCENDING_ACTION = PREFIX + "task_sort_ascending_action_context"; //$NON-NLS-1$
- public static final String TASK_SORT_DESCENDING_ACTION = PREFIX + "task_sort_descending_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 245498a..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ITaskListResourceAdapter.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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);
-
-}
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 648aa9a..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkCompletedAction.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-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);
- }
- }
- }
-
- /**
- * Returns whether this action should be enabled for the given selection.
- */
- public boolean shouldEnable(IStructuredSelection selection) {
- if (selection.isEmpty())
- return false;
- for (Iterator i = selection.iterator(); i.hasNext();) {
- IMarker marker = (IMarker) i.next();
- if (!(MarkerUtil.isMarkerType(marker, IMarker.TASK)
- && !MarkerUtil.isComplete(marker)
- && MarkerUtil.isEditable(marker))) {
- return false;
- }
- }
- return true;
- }
-
-}
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 637b9a2..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerType.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-import java.util.ArrayList;
-
-/**
- * Represents a marker type.
- */
-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 a3f3565..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerTypesModel.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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.
- */
-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 e5ad04a..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/MarkerUtil.java
+++ /dev/null
@@ -1,485 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.text.DateFormat;
-import java.text.MessageFormat;
-import java.util.Date;
-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.
- */
-class MarkerUtil implements IMarkerConstants {
-
- private static Map imageDescriptors;
-
- private static ImageRegistry imageRegistry = new ImageRegistry();
-
- private static MessageFormat line =
- new MessageFormat(TaskListMessages.getString("TaskList.line")); //$NON-NLS-1$;
-
- private static MessageFormat lineAndLocation =
- new MessageFormat(TaskListMessages.getString("TaskList.lineAndLocation")); //$NON-NLS-1$
-
- 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 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("header_complete", createImageDescriptor("obj16/header_complete.gif"));//$NON-NLS-2$//$NON-NLS-1$
- imageDescriptors.put("header_priority", createImageDescriptor("obj16/header_priority.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("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("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 if (!isReadOnly(marker)) // don't show a check box for read-only tasks
- 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) {
- IPath path = marker.getResource().getFullPath();
- int n = path.segmentCount() - 1; // n is the number of segments in container, not path
- if (n <= 0)
- return ""; //$NON-NLS-1$
- int len = 0;
- for (int i = 0; i < n; ++i)
- len += path.segment(i).length();
- // account for /'s
- if (n > 1)
- len += n-1;
- StringBuffer sb = new StringBuffer(len);
- for (int i = 0; i < n; ++i) {
- if (i != 0)
- sb.append('/');
- sb.append(path.segment(i));
- }
- return sb.toString();
- }
-
- /**
- * 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 line.format(new Object[] { Integer.toString(lineNumber) });
- }
- else {
- return lineAndLocation.format(new Object[] { Integer.toString(lineNumber), location });
- }
- }
- }
-
- /**
- * 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) {
- if (!isMarkerType(marker, IMarker.TASK))
- return ""; //$NON-NLS-1$
-
- switch (getPriority(marker)) {
- case IMarker.PRIORITY_HIGH:
- return TaskListMessages.getString("TaskList.high"); //$NON-NLS-1$
- case IMarker.PRIORITY_NORMAL:
- return TaskListMessages.getString("TaskList.normal"); //$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 editable.
- * Only tasks which have not been marked as read-only are editable.
- */
- public static boolean isEditable(IMarker marker) {
- return isMarkerType(marker, IMarker.TASK) && !isReadOnly(marker);
- }
-
- /**
- * 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 marker is read-only.
- */
- public static boolean isReadOnly(IMarker marker) {
- return !marker.getAttribute(IMarker.USER_EDITABLE, true);
- }
-
- /**
- * Returns the creation time of the marker as a string.
- */
- public static String getCreationTime(IMarker marker) {
- try {
- return DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM).format(new Date(marker.getCreationTime()));
- } catch (CoreException e) {
- return null;
- }
- }
-}
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 7dc96d4..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/NewTaskAction.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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.
- */
-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 889eb04..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/PasteTaskAction.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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
- */
-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 b5db51b..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/PurgeCompletedAction.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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.
- */
-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() {
- try {
- IResource resource = getTaskList().getResource();
- int depth = getTaskList().getResourceDepth();
- IMarker[] tasks = resource.findMarkers(IMarker.TASK, true, depth);
- final List completed = new ArrayList();
- for (int i = 0; i < tasks.length; i++) {
- IMarker task = tasks[i];
- if (MarkerUtil.isComplete(task) && !MarkerUtil.isReadOnly(task)) {
- completed.add(task);
- }
- }
- // Check if there is anything to do
- if (completed.size() == 0) {
- MessageDialog.openInformation(
- getShell(),
- TaskListMessages.getString("PurgeCompleted.title"), //$NON-NLS-1$
- TaskListMessages.getString("PurgeCompleted.noneCompleted")); //$NON-NLS-1$
- return;
- }
-
- // Verify.
- if (!MessageDialog
- .openConfirm(
- getShell(),
- TaskListMessages.getString("PurgeCompleted.title"), //$NON-NLS-1$
- TaskListMessages.format("PurgeCompleted.permanent", //$NON-NLS-1$
- new Object[] { new Integer(completed.size()) } )
- )) {
- 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 4c11d4e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/RemoveTaskAction.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.widgets.Table;
-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.
- */
-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 b35e30b..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/ResolveMarkerAction.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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
- */
-class ResolveMarkerAction extends TaskAction {
-
- /**
- * Creates the action.
- */
- protected ResolveMarkerAction(TaskList tasklist, String id) {
- super(tasklist, id);
- WorkbenchHelp.setHelp(this, ITaskListHelpContextIds.RESOLVE_MARKER_ACTION);
- }
-
- /**
- * Returns whether this action should be enabled given the selection.
- */
- public boolean shouldEnable(IStructuredSelection selection) {
- if (selection.size() != 1)
- return false;
- IMarker marker = (IMarker) selection.getFirstElement();
- 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();
- if (marker == null) {
- return;
- }
- 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 1f031fd..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/SelectAllTasksAction.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * This action selects all tasks currently showing in the task list.
- */
-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 4399f07..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskAction.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.swt.widgets.Shell;
-
-/**
- * This is the base class of all the local actions used
- * in the task list view.
- */
-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 7f3558a..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskList.java
+++ /dev/null
@@ -1,1650 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- * Cagatay Kavukcuoglu <cagatayk@acm.org> - Filter for markers in same project
- * Sebastian Davids <sdavids@gmx.de> - Reordered menu items
-***********************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-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.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.CheckboxCellEditor;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ComboBoxCellEditor;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.IOpenListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.OpenEvent;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.ACC;
-import org.eclipse.swt.accessibility.AccessibleControlAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlEvent;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.custom.StackLayout;
-import org.eclipse.swt.custom.TableEditor;
-import org.eclipse.swt.dnd.Clipboard;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.DragSourceListener;
-import org.eclipse.swt.dnd.TextTransfer;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.events.HelpEvent;
-import org.eclipse.swt.events.HelpListener;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.part.CellEditorActionHandler;
-import org.eclipse.ui.part.IShowInSource;
-import org.eclipse.ui.part.IShowInTargetList;
-import org.eclipse.ui.part.MarkerTransfer;
-import org.eclipse.ui.part.ShowInContext;
-import org.eclipse.ui.part.ViewPart;
-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 TaskSorter sorter;
-
- 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 ResolveMarkerAction resolveMarkerAction;
- private TaskAction filtersAction;
- private MarkCompletedAction markCompletedAction;
- private TaskAction propertiesAction;
-
- //sort by action
- private Action sortByCategoryAction;
- private Action sortByCompletedAction;
- private Action sortByPriorityAction;
- private Action sortByDescriptionAction;
- private Action sortByResourceAction;
- private Action sortByContainerAction;
- private Action sortByLocationAction;
- private Action sortByCreationTimeAction;
-
- private Action sortAscendingAction;
- private Action sortDescendingAction;
-
- 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_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$
- private static final String TAG_SORT_SECTION = "TaskListSortState"; //$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;
- }
- }
-
- class SortByAction extends Action {
-
- private int column;
-
- public SortByAction(int column) {
- this.column = column;
- }
-
- public void run() {
- sorter.setTopPriority(column);
- updateSortingState();
- viewer.refresh();
- IDialogSettings workbenchSettings = getPlugin().getDialogSettings();
- IDialogSettings settings = workbenchSettings.getSection(TAG_SORT_SECTION);
- if (settings == null)
- settings = workbenchSettings.addNewSection(TAG_SORT_SECTION);
- sorter.saveState(settings);
- }
- }
-
- class SortDirectionAction extends Action {
-
- private int direction;
-
- public SortDirectionAction(int direction) {
- this.direction = direction;
- }
-
- public void run() {
- sorter.setTopPriorityDirection(direction);
- updateSortingState();
- viewer.refresh();
- IDialogSettings workbenchSettings = getPlugin().getDialogSettings();
- IDialogSettings settings = workbenchSettings.getSection(TAG_SORT_SECTION);
- if (settings == null)
- settings = workbenchSettings.addNewSection(TAG_SORT_SECTION);
- sorter.saveState(settings);
- }
- }
-
- 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) {
- return MarkerUtil.isEditable((IMarker) element);
- }
-
- /**
- * 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);
- if (column == sorter.getTopPriority())
- sorter.reverseTopPriority();
- else {
- sorter.setTopPriority(column);
- }
- updateSortingState();
- viewer.refresh();
- IDialogSettings workbenchSettings = getPlugin().getDialogSettings();
- IDialogSettings settings = workbenchSettings.getSection(TAG_SORT_SECTION);
- if (settings == null)
- settings = workbenchSettings.addNewSection(TAG_SORT_SECTION);
- sorter.saveState(settings);
- }
- };
-
- 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);
- }
- }
- }
- }
- }
-
- boolean text = "carbon".equals(SWT.getPlatform()); //$NON-NLS-1$
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
- table.setHeaderVisible(true);
-
- for (int i = 0; i < columnHeaders.length; i++) {
- TableColumn tc = new TableColumn(table, SWT.NONE, i);
-
- if (!text && i == 1)
- tc.setImage(MarkerUtil.getImage("header_complete")); //$NON-NLS-1$
- else if (!text && i == 2)
- tc.setImage(MarkerUtil.getImage("header_priority")); //$NON-NLS-1$
- else
- tc.setText(columnHeaders[i]);
-
- if (text && (i == 1 || i == 2)) {
- tc.pack();
- columnLayouts[i] = new ColumnPixelData(Math.max(19, tc.getWidth()), false);
- }
-
- tc.setResizable(columnLayouts[i].resizable);
- layout.addColumnData(columnLayouts[i]);
- tc.addSelectionListener(headerListener);
- }
- }
- /**
- * Returns a string that summarizes the contents of the
- * given markers.
- */
- 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();
- }
-
- /**
- * 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$
- }
-
- /* 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) {
- // long t = System.currentTimeMillis();
- createPartControl0(parent);
- // t = System.currentTimeMillis() - t;
- // System.out.println("TaskList.createPartControl: " + t + "ms");
- }
-
- private void createPartControl0(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());
- if (memento != null) {
- //restore filter
- IMemento filterMem = memento.getChild(TAG_FILTER);
- if (filterMem != null)
- getFilter().restoreState(filterMem);
- }
-
- sorter = new TaskSorter();
- IDialogSettings workbenchSettings = getPlugin().getDialogSettings();
- IDialogSettings settings = workbenchSettings.getSection(TAG_SORT_SECTION);
- sorter.restoreState(settings);
- viewer.setSorter(sorter);
-
- //update the menu to indicate how task are currently sorted
- updateSortingState();
- 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);
- }
- });
-
- //Add in some accessibility support to supplement the description that we already
- //get from the SWT table.
- viewer
- .getControl()
- .getAccessible()
- .addAccessibleControlListener(new AccessibleControlAdapter() {
-
- /* (non-Javadoc)
- * @see org.eclipse.swt.accessibility.AccessibleControlListener#getValue(org.eclipse.swt.accessibility.AccessibleControlEvent)
- */
- public void getValue(AccessibleControlEvent e) {
-
- int childIndex = e.childID;
-
- if (childIndex == ACC.CHILDID_SELF) {
- super.getValue(e);
- return;
- }
- Object item = viewer.getElementAt(childIndex);
- if (item instanceof IMarker) {
- IMarker marker = (IMarker) item;
-
- //If it is editable all we need is completeness
- // the rest is found by the table accessibility
- if (MarkerUtil.isEditable(marker))
- e.result = MarkerUtil.getCompleteText(marker);
- else
- //Otherwise all it needs is severity
- e.result = MarkerUtil.getKindText(marker);
-
- } else {
- super.getValue(e);
- return;
- }
-
- }
-
- });
-
- CellEditor editors[] = new CellEditor[columnHeaders.length];
- editors[1] = new CheckboxCellEditor(table);
- String[] priorities = new String[] { TaskListMessages.getString("TaskList.high"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.normal"), //$NON-NLS-1$
- TaskListMessages.getString("TaskList.low") //$NON-NLS-1$
- };
- editors[2] = new ComboBoxCellEditor(table, priorities, SWT.READ_ONLY);
- 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);
-
- getSite().setSelectionProvider(viewer);
-
- 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();
- IMenuManager submenu = new MenuManager(TaskListMessages.getString("SortByMenu.text")); //$NON-NLS-1$
-
- menu.add(submenu);
- submenu.add(sortByCategoryAction);
- submenu.add(sortByCompletedAction);
- submenu.add(sortByPriorityAction);
- submenu.add(sortByDescriptionAction);
- submenu.add(sortByResourceAction);
- submenu.add(sortByContainerAction);
- submenu.add(sortByLocationAction);
- submenu.add(sortByCreationTimeAction);
- submenu.add(new Separator());
- submenu.add(sortAscendingAction);
- submenu.add(sortDescendingAction);
-
- 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) {
- // update enabled state for actions that aren't updated in selectionChanged
- IStructuredSelection selection = (IStructuredSelection) getSelection();
- markCompletedAction.setEnabled(
- markCompletedAction.shouldEnable(selection));
- resolveMarkerAction.setEnabled(
- resolveMarkerAction.shouldEnable(selection));
-
- // add the actions to the 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());
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.core.runtime.IAdaptable#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IShowInSource.class) {
- return new IShowInSource() {
- public ShowInContext getShowInContext() {
- return new ShowInContext(null, getSelection());
- }
- };
- }
- if (adapter == IShowInTargetList.class) {
- return new IShowInTargetList() {
- public String[] getShowInTargetIds() {
- return new String[] { IPageLayout.ID_RES_NAV };
- }
-
- };
- }
- return super.getAdapter(adapter);
- }
-
- /**
- * 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 != null && selection.size() == 1) {
- IMarker marker = (IMarker) selection.getFirstElement();
- return MarkerUtil.getMessage(marker);
- }
-
- TaskListContentProvider provider = (TaskListContentProvider) viewer.getContentProvider();
-
- if (selection != null && 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 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() {
- ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
-
- // 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(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY_HOVER));
- 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(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE_HOVER));
- 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(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_HOVER));
- removeTaskAction.setImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE));
- removeTaskAction.setDisabledImageDescriptor(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_DISABLED));
- 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(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_DELETE_HOVER));
- 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$
- resolveMarkerAction.setEnabled(false);
-
- // Sort by ->
- sortByCategoryAction = new SortByAction(TaskSorter.TYPE);
- sortByCategoryAction.setText(TaskListMessages.getString("SortByCategory.text")); //$NON-NLS-1$
- sortByCategoryAction.setToolTipText(TaskListMessages.getString("SortByCategory.tooltip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(sortByCategoryAction, ITaskListHelpContextIds.TASK_SORT_TYPE_ACTION);
-
- sortByCompletedAction = new SortByAction(TaskSorter.COMPLETION);
- sortByCompletedAction.setText(TaskListMessages.getString("SortByCompleted.text")); //$NON-NLS-1$
- sortByCompletedAction.setToolTipText(TaskListMessages.getString("SortByCompleted.tooltip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(sortByCompletedAction, ITaskListHelpContextIds.TASK_SORT_COMPLETED_ACTION);
-
- sortByPriorityAction = new SortByAction(TaskSorter.PRIORITY);
- sortByPriorityAction.setText(TaskListMessages.getString("SortByPriority.text")); //$NON-NLS-1$
- sortByPriorityAction.setToolTipText(TaskListMessages.getString("SortByPriority.tooltip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(sortByPriorityAction, ITaskListHelpContextIds.TASK_SORT_PRIORITY_ACTION);
-
- sortByDescriptionAction = new SortByAction(TaskSorter.DESCRIPTION);
- sortByDescriptionAction.setText(TaskListMessages.getString("SortByDescription.text")); //$NON-NLS-1$
- sortByDescriptionAction.setToolTipText(TaskListMessages.getString("SortByDescription.tooltip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(sortByDescriptionAction, ITaskListHelpContextIds.TASK_SORT_DESCRIPTION_ACTION);
-
- sortByResourceAction = new SortByAction(TaskSorter.RESOURCE);
- sortByResourceAction.setText(TaskListMessages.getString("SortByResource.text")); //$NON-NLS-1$
- sortByResourceAction.setToolTipText(TaskListMessages.getString("SortByResource.tooltip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(sortByResourceAction, ITaskListHelpContextIds.TASK_SORT_RESOURCE_ACTION);
-
- sortByContainerAction = new SortByAction(TaskSorter.FOLDER);
- sortByContainerAction.setText(TaskListMessages.getString("SortByContainer.text")); //$NON-NLS-1$
- sortByContainerAction.setToolTipText(TaskListMessages.getString("SortByContainer.tooltip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(sortByContainerAction, ITaskListHelpContextIds.TASK_SORT_FOLDER_ACTION);
-
- sortByLocationAction = new SortByAction(TaskSorter.LOCATION);
- sortByLocationAction.setText(TaskListMessages.getString("SortByLocation.text")); //$NON-NLS-1$
- sortByLocationAction.setToolTipText(TaskListMessages.getString("SortByLocation.tooltip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(sortByLocationAction, ITaskListHelpContextIds.TASK_SORT_LOCATION_ACTION);
-
- sortByCreationTimeAction = new SortByAction(TaskSorter.CREATION_TIME);
- sortByCreationTimeAction.setText(TaskListMessages.getString("SortByCreationTime.text")); //$NON-NLS-1$
- sortByCreationTimeAction.setToolTipText(TaskListMessages.getString("SortByCreationTime.tooltip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(sortByCreationTimeAction, ITaskListHelpContextIds.TASK_SORT_CREATION_TIME_ACTION);
-
- sortAscendingAction = new SortDirectionAction(TaskSorter.ASCENDING);
- sortAscendingAction.setText(TaskListMessages.getString("SortAscending.text")); //$NON-NLS-1$
- sortAscendingAction.setToolTipText(TaskListMessages.getString("SortAscending.tooltip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(sortAscendingAction, ITaskListHelpContextIds.TASK_SORT_ASCENDING_ACTION);
-
- sortDescendingAction = new SortDirectionAction(TaskSorter.DESCENDING);
- sortDescendingAction.setText(TaskListMessages.getString("SortDescending.text")); //$NON-NLS-1$
- sortDescendingAction.setToolTipText(TaskListMessages.getString("SortDescending.tooltip")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(sortDescendingAction, ITaskListHelpContextIds.TASK_SORT_DESCENDING_ACTION);
-
- // 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 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.isEditable(m)) {
- 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);
-
- if (viewer != null)
- 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) {
- ArrayList list = new ArrayList();
-
- if (selection instanceof IStructuredSelection) {
- Iterator iterator = ((IStructuredSelection) selection).iterator();
- while (iterator.hasNext()) {
- Object object = iterator.next();
-
- if (object instanceof IAdaptable) {
- ITaskListResourceAdapter taskListResourceAdapter;
- Object adapter =
- ((IAdaptable) object).getAdapter(
- ITaskListResourceAdapter.class);
- if (adapter != null
- && adapter instanceof ITaskListResourceAdapter) {
- taskListResourceAdapter =
- (ITaskListResourceAdapter) adapter;
- } else {
- taskListResourceAdapter =
- DefaultTaskListResourceAdapter.getDefault();
- }
-
- IResource resource =
- taskListResourceAdapter.getAffectedResource(
- (IAdaptable) object);
- if (resource != null) {
- list.add(resource);
- }
- }
- }
- }
-
- if (list.size() == 0 && focusPart instanceof IEditorPart) {
- IEditorInput input = ((IEditorPart) focusPart).getEditorInput();
-
- if (input != null) {
- if (input instanceof IFileEditorInput) {
- IFile file = ((IFileEditorInput) input).getFile();
- if (file != null) {
- list.add(file);
- }
- } else {
- IResource resource =
- (IResource) input.getAdapter(IResource.class);
- if (resource == null) {
- resource = (IFile) input.getAdapter(IFile.class);
- }
- if (resource != null) {
- list.add(resource);
- }
- }
- }
- }
-
- int l = list.size();
- if (l < 1) {
- return; // required to achieve lazy update behavior.
- }
-
- IResource[] resources = (IResource[]) list.toArray(new IResource[l]);
- for (int i = 0; i < l; i++) {
- Assert.isNotNull(resources[i]);
- }
-
- if (!Arrays.equals(resources, focusResources)) {
- boolean updateNeeded = false;
-
- if (showOwnerProject()) {
- int m = focusResources == null ? 0 : focusResources.length;
- if (l != m) {
- updateNeeded = true;
- } else {
- for (int i = 0; i < l; i++) {
- IProject oldProject =
- m < 1 ? null : focusResources[0].getProject();
- IProject newProject = resources[0].getProject();
- boolean projectsEqual =
- (oldProject == null
- ? newProject == null
- : oldProject.equals(newProject));
- if (!projectsEqual) {
- updateNeeded = true;
- break;
- }
- }
- }
- } else if (showSelections()) {
- updateNeeded = true;
- }
-
- // remember the focus resources even if update is not needed,
- // so that we know them 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() {
- ISelection selection = viewer.getSelection();
-
- if (selection instanceof IStructuredSelection)
- updateStatusMessage((IStructuredSelection) selection);
- else
- updateStatusMessage(null);
- }
- /**
- * 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);
- }
- }
-
- /**
- * Method updateSortingState.
- */
- void updateSortingState() {
- int curColumn = sorter.getTopPriority();
- sortByCategoryAction.setChecked(curColumn == TaskSorter.TYPE);
- sortByCompletedAction.setChecked(curColumn == TaskSorter.COMPLETION);
- sortByPriorityAction.setChecked(curColumn == TaskSorter.PRIORITY);
- sortByDescriptionAction.setChecked(curColumn == TaskSorter.DESCRIPTION);
- sortByResourceAction.setChecked(curColumn == TaskSorter.RESOURCE);
- sortByContainerAction.setChecked(curColumn == TaskSorter.FOLDER);
- sortByLocationAction.setChecked(curColumn == TaskSorter.LOCATION);
- sortByCreationTimeAction.setChecked(curColumn == TaskSorter.CREATION_TIME);
-
- int curDirection = sorter.getTopPriorityDirection();
- sortAscendingAction.setChecked(curDirection == TaskSorter.ASCENDING);
- sortDescendingAction.setChecked(curDirection == TaskSorter.DESCENDING);
- }
-
-}
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 3563fe6..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskListContentProvider.java
+++ /dev/null
@@ -1,557 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * 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);
- }
-
- /**
- * 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 difference) {
- 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] += difference;
- break;
- case IMarker.SEVERITY_WARNING:
- visibleMarkerCounts[WARNINGS] += difference;
- break;
- case IMarker.SEVERITY_INFO:
- visibleMarkerCounts[INFOS] += difference;
- break;
- }
- } else if (markerDelta.isSubtypeOf(IMarker.TASK))
- visibleMarkerCounts[TASKS] += difference;
- }
-
- /**
- * 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);
-
- viewer.getControl().getDisplay().syncExec(new Runnable() {
- public void run() {
- viewer.refresh();
- }
- });
- }
-
- return new IMarker[0];
- }
- else {
- if (isMarkerLimitExceeded()) {
- setMarkerLimitExceeded(false);
-
- viewer.getControl().getDisplay().syncExec(new Runnable() {
- public void run() {
- viewer.refresh();
- }
- });
- }
-
- 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);
-
- if (markerDeltas == null)
- return;
-
- 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];
-
- if (markerDelta == null)
- continue;
-
- 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.
- */
-
- IResource resource = markerDelta.getResource();
-
- if (resource == null)
- continue;
-
- boolean affectedBy = taskList.checkResource(resource) && taskList.getFilter().select(markerDelta);
-
- if (affectedBy) {
- 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);
- viewer.refresh();
- }
- }
- else if (taskList.isMarkerLimitExceeded()) {
- setMarkerLimitExceeded(false);
- viewer.refresh();
- }
- 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 8e2556b..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskListMessages.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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 c50794e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskPropertiesAction.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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.
- */
-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 5f304b4..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskPropertiesDialog.java
+++ /dev/null
@@ -1,572 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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.graphics.Font;
-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 control for the Creation Time field.
- */
- private Label creationTime;
-
- /**
- * 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 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 (marker != null)
- createCreationTimeArea(composite);
- if (isTask()) {
- createPriorityAndStatusArea(composite);
- }
- else {
- createSeverityArea(composite);
- }
- createResourceArea(composite);
- updateDialogFromMarker();
- return composite;
- }
-
- /**
- * Method createCreationTimeArea.
- * @param composite
- */
- private void createCreationTimeArea(Composite parent) {
- Font font = parent.getFont();
- 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.creationTime")); //$NON-NLS-1$
- label.setFont(font);
-
- creationTime = new Label(composite, SWT.NONE);
- creationTime.setFont(font);
- }
-
- /**
- * 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 (isEditable()) {
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
- }
-
- /**
- * Creates the area for the Description field.
- */
- private void createDescriptionArea(Composite parent) {
- Font font = parent.getFont();
- 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$
- label.setFont(font);
- int style = SWT.SINGLE | SWT.BORDER;
- if (!isEditable()) {
- style |= SWT.READ_ONLY;
- }
- descriptionText = new Text(composite, style);
- GridData gridData = new GridData(GridData.FILL_HORIZONTAL);
- gridData.widthHint = convertHorizontalDLUsToPixels(400);
- descriptionText.setLayoutData(gridData);
- descriptionText.setFont(font);
- }
-
- /**
- * Creates the area for the Priority and Status fields.
- */
- private void createPriorityAndStatusArea(Composite parent) {
- Font font = parent.getFont();
- 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$
- label.setFont(font);
- 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;
- }
- }
- });
- priorityCombo.setFont(font);
-
- 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);
- completedCheckbox.setFont(font);
-
- if (!isEditable()) {
- priorityCombo.setEnabled(false);
- completedCheckbox.setEnabled(false);
- }
- }
-
- /**
- * Creates the area for the Severity field.
- */
- private void createSeverityArea(Composite parent) {
- Font font = parent.getFont();
- 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$
- label.setFont(font);
- // workaround for bug 11078: Can't get a read-only combo box
- severityLabel = new Label(composite, SWT.NONE);
- severityLabel.setFont(font);
- /*
- 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) {
- IResource resource = getResource();
- if (marker == null) {
- if (resource == null)
- return;
- if ((resource.getType() & (IResource.FILE | IResource.FOLDER | IResource.PROJECT)) == 0)
- return;
- }
-
- Font font = parent.getFont();
- 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$
- resourceLabel.setFont(font);
- resourceText = new Text(composite, SWT.SINGLE | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- resourceText.setLayoutData(gridData);
- resourceText.setFont(font);
-
- Label folderLabel = new Label(composite, SWT.NONE);
- folderLabel.setText(TaskListMessages.getString("TaskProp.inFolder")); //$NON-NLS-1$
- folderLabel.setFont(font);
- folderText = new Text(composite, SWT.SINGLE | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- folderText.setLayoutData(gridData);
- folderText.setFont(font);
-
- Label locationLabel = new Label(composite, SWT.NONE);
- locationLabel.setText(TaskListMessages.getString("TaskProp.location")); //$NON-NLS-1$
- locationLabel.setFont(font);
- locationText = new Text(composite, SWT.SINGLE | SWT.WRAP | SWT.READ_ONLY | SWT.BORDER);
- gridData = new GridData(GridData.FILL_HORIZONTAL);
- locationText.setLayoutData(gridData);
- locationText.setFont(font);
- }
-
- /**
- * Updates the dialog from the marker state.
- */
- private void updateDialogFromMarker() {
- if (marker == null) {
- updateDialogForNewMarker();
- return;
- }
- descriptionText.setText(MarkerUtil.getMessage(marker));
- descriptionText.selectAll();
- creationTime.setText(MarkerUtil.getCreationTime(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);
- descriptionText.selectAll();
-
- 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 != 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;
- }
- }
- if (locationText != null)
- 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 whether the marker is editable.
- */
- private boolean isEditable() {
- return marker == null || MarkerUtil.isEditable(marker);
- }
-
- /**
- * 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 (!isEditable() || !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;
- }
-}
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 112972e..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TaskSorter.java
+++ /dev/null
@@ -1,326 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-/**
- * This is the task list's sorter.
- */
-class TaskSorter extends ViewerSorter {
- private int[] priorities;
- private int[] directions;
-
- final static int ASCENDING = 1;
- final static int DEFAULT_DIRECTION = 0;
- final static int DESCENDING = -1;
- final static int TYPE = 0;
- final static int COMPLETION = 1;
- final static int PRIORITY = 2;
- final static int DESCRIPTION = 3;
- final static int RESOURCE = 4;
- final static int FOLDER = 5;
- final static int LOCATION = 6;
- final static int CREATION_TIME = 7;
- final static int[] DEFAULT_PRIORITIES =
- { FOLDER,
- RESOURCE,
- LOCATION,
- DESCRIPTION,
- TYPE,
- PRIORITY,
- COMPLETION,
- CREATION_TIME };
- final static int[] DEFAULT_DIRECTIONS =
- { DESCENDING, //type
- DESCENDING, //completed
- DESCENDING, //priority
- ASCENDING, //description
- ASCENDING, //resource
- ASCENDING, //folder
- ASCENDING, //location
- ASCENDING }; //creation time
-
- /**
- * Creates a new task sorter.
- */
- public TaskSorter() {
- resetState();
- }
-
- /* (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;
- return compareColumnValue(m1, m2, 0);
- }
-
- public void setTopPriority(int priority) {
- if (priority < 0 || priority >= priorities.length)
- return;
-
- int index = -1;
- for (int i = 0; i < priorities.length; i++) {
- if (priorities[i] == priority) {
- index = i;
- break;
- }
- }
-
- if (index == -1) {
- resetState();
- return;
- }
-
- //shift the array
- for (int i = index; i > 0; i--) {
- priorities[i] = priorities[i - 1];
- }
- priorities[0] = priority;
- directions[priority] = DEFAULT_DIRECTIONS[priority];
- }
-
- public int getTopPriority() {
- return priorities[0];
- }
-
- public int[] getPriorities() {
- return priorities;
- }
-
- public void setTopPriorityDirection(int direction) {
- if (direction == DEFAULT_DIRECTION)
- directions[priorities[0]] = DEFAULT_DIRECTIONS[priorities[0]];
- else if (direction == ASCENDING || direction == DESCENDING)
- directions[priorities[0]] = direction;
- }
-
- public int getTopPriorityDirection() {
- return directions[priorities[0]];
- }
-
- public void reverseTopPriority() {
- directions[priorities[0]] *= -1;
- }
-
- public void resetState() {
- priorities = new int[DEFAULT_PRIORITIES.length];
- System.arraycopy(DEFAULT_PRIORITIES, 0, priorities, 0, priorities.length);
- directions = new int[DEFAULT_DIRECTIONS.length];
- System.arraycopy(DEFAULT_DIRECTIONS, 0, directions, 0, directions.length);
- }
-
- /* (non-Javadoc)
- * Method declared on ViewerSorter.
- */
- /**
- * Compares two markers, based only on the value of the specified column.
- */
- private int compareColumnValue(IMarker m1, IMarker m2, int depth) {
- if (depth >= priorities.length)
- return 0;
-
- int columnNumber = priorities[depth];
- int direction = directions[columnNumber];
- switch (columnNumber) {
- case TYPE: {
- /* category */
- int result = getCategoryOrder(m1) - getCategoryOrder(m2);
- if (result == 0)
- return compareColumnValue(m1, m2, depth + 1);
- return result * direction;
- }
- case COMPLETION: {
- /* completed */
- int result = getCompletedOrder(m1) - getCompletedOrder(m2);
- if (result == 0)
- return compareColumnValue(m1, m2, depth + 1);
- return result * direction;
- }
- case PRIORITY: {
- /* priority */
- int result = getPriorityOrder(m1) - getPriorityOrder(m2);
- if (result == 0)
- return compareColumnValue(m1, m2, depth + 1);
- return result * direction;
- }
- case DESCRIPTION: {
- /* description */
- int result = collator.compare(MarkerUtil.getMessage(m1), MarkerUtil.getMessage(m2));
- if (result == 0)
- return compareColumnValue(m1, m2, depth + 1);
- return result * direction;
- }
- case RESOURCE: {
- /* resource name */
- IResource r1 = m1.getResource();
- IResource r2 = m2.getResource();
- String n1 = r1.getName();
- String n2 = r2.getName();
- int result = collator.compare(n1, n2);
- if (result == 0)
- return compareColumnValue(m1, m2, depth + 1);
- return result * direction;
- }
- case FOLDER: {
- /* container name */
- String c1 = MarkerUtil.getContainerName(m1);
- String c2 = MarkerUtil.getContainerName(m2);
- int result = c1.equals(c2) ? 0 : collator.compare(c1, c2);
- if (result == 0)
- return compareColumnValue(m1, m2, depth + 1);
- return result * direction;
- }
- case LOCATION: {
- /* line and location */
- int result = compareLineAndLocation(m1, m2);
- if (result == 0)
- return compareColumnValue(m1, m2, depth + 1);
- return result * direction;
- }
- case CREATION_TIME: {
- /* creation time */
- int result = compareCreationTime(m1, m2);
- if (result == 0)
- return compareColumnValue(m1, m2, depth + 1);
- return result * direction;
- }
- default:
- return 0;
- }
- }
-
- /**
- * Compares the creation time of two markers.
- */
- private int compareCreationTime(IMarker m1, IMarker m2) {
- long result;
- try {
- result = m1.getCreationTime() - m2.getCreationTime();
- } catch (CoreException e) {
- result = 0;
- }
- if (result > 0) return 1;
- else if (result < 0) return -1;
- 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 4;
- case IMarker.SEVERITY_WARNING:
- return 3;
- case IMarker.SEVERITY_INFO:
- return 2;
- }
- } else if (MarkerUtil.isMarkerType(marker, IMarker.TASK)) {
- return 1;
- }
- return 1000;
- }
-
- /**
- * Returns the sort order for the given marker based on its completion status.
- * Lower numbers appear first.
- */
- private int getCompletedOrder(IMarker marker) {
- if (MarkerUtil.isMarkerType(marker, IMarker.TASK))
- return MarkerUtil.isComplete(marker) ? 2 : 1;
- return 0;
- }
-
- /**
- * Returns the sort order for the given marker based on its priority.
- */
- private int getPriorityOrder(IMarker marker) {
- if (MarkerUtil.isMarkerType(marker, IMarker.TASK))
- return MarkerUtil.getPriority(marker);
- return -1;
- }
- public void saveState(IDialogSettings settings) {
- if (settings == null)
- return;
-
- for (int i = 0; i < directions.length; i++) {
- settings.put("direction" + i, directions[i]);//$NON-NLS-1$
- settings.put("priority" + i, priorities[i]);//$NON-NLS-1$
- }
- }
-
- public void restoreState(IDialogSettings settings) {
- if (settings == null)
- return;
-
- try {
- for (int i = 0; i < priorities.length; i++) {
- directions[i] = settings.getInt("direction" + i);//$NON-NLS-1$
- priorities[i] = settings.getInt("priority" + i);//$NON-NLS-1$
- }
- }
- catch (NumberFormatException e) {
- resetState();
- }
- }
-
-}
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 9c21836..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/TasksFilter.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- * Cagatay Kavukcuoglu <cagatayk@acm.org> - Filter for markers in same project
-************************************************************************/
-
-package org.eclipse.ui.views.tasklist;
-
-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;
-
-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) {
- if (desc == null) { // be paranoid
- desc = ""; //$NON-NLS-1$
- }
- 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 if the given resource is enclosed by a working set element.
- * The IContainmentAdapter of each working set element is used for the
- * containment test. If there is no IContainmentAdapter for a working
- * set element, a simple resource based test is used.
- *
- * @param element resource to test for enclosure by a working set
- * element
- * @return true if element is enclosed by a working set element and
- * false otherwise.
- */
- private boolean isEnclosed(IResource element) {
- IPath elementPath = element.getFullPath();
- IAdaptable[] workingSetElements = workingSet.getElements();
-
- if (elementPath.isEmpty() || elementPath.isRoot()) {
- return false;
- }
- for (int i = 0; i < workingSetElements.length; i++) {
- IAdaptable workingSetElement = workingSetElements[i];
- IContainmentAdapter containmentAdapter = (IContainmentAdapter) workingSetElement.getAdapter(IContainmentAdapter.class);
-
- // if there is no IContainmentAdapter defined for the working
- // set element type fall back to using resource based
- // containment check
- if (containmentAdapter != null) {
- if (containmentAdapter.contains(workingSetElement, element, IContainmentAdapter.CHECK_CONTEXT | IContainmentAdapter.CHECK_IF_CHILD | IContainmentAdapter.CHECK_IF_DESCENDANT))
- return true;
- } else if (isEnclosedResource(element, elementPath, workingSetElement)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Returns if the given resource is enclosed by a working set element.
- * A resource is enclosed if it is either a parent of a working set
- * element, a child of a working set element or a working set element
- * itself.
- * Simple path comparison is used. This is only guaranteed to return
- * correct results for resource working set elements.
- *
- * @param element resource to test for enclosure by a working set
- * element
- * @param elementPath full, absolute path of the element to test
- * @return true if element is enclosed by a working set element and
- * false otherwise.
- */
- private boolean isEnclosedResource(IResource element, IPath elementPath, IAdaptable workingSetElement) {
- IResource workingSetResource = null;
-
- if (workingSetElement.equals(element))
- return true;
- if (workingSetElement instanceof IResource) {
- workingSetResource = (IResource) workingSetElement;
- }
- else {
- workingSetResource = (IResource) workingSetElement.getAdapter(IResource.class);
- }
- if (workingSetResource != null) {
- IPath resourcePath = workingSetResource.getFullPath();
- if (resourcePath.isPrefixOf(elementPath))
- 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 0f98a46..0000000
--- a/bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/tasklist/messages.properties
+++ /dev/null
@@ -1,177 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-# 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 = &Filters...
-Filters.tooltip = Filters...
-
-SortByMenu.text= &Sort
-SortByCategory.text= by &Type
-SortByCategory.tooltip= Sort by type column
-SortByCompleted.text= by &Completion
-SortByCompleted.tooltip= Sort by completion column
-SortByPriority.text= by &Priority
-SortByPriority.tooltip= Sort by priority column
-SortByDescription.text= by &Description
-SortByDescription.tooltip= Sort by description column
-SortByResource.text= by &Resource
-SortByResource.tooltip= Sort by resource column
-SortByContainer.text= by &Folder
-SortByContainer.tooltip= Sort by folder column
-SortByLocation.text= by &Location
-SortByLocation.tooltip= Sort by location column
-SortByCreationTime.text= by Cr&eation Time
-SortByCreationTime.tooltip= Sort by task creation time
-SortAscending.text= &Ascending
-SortAscending.tooltip= Sort ascending
-SortDescending.text= De&scending
-SortDescending.tooltip= Sort Descending
-
-GotoTask.text = &Go To
-GotoTask.tooltip = Go To
-GotoTask.errorMessage = Problems Opening Editor
-
-PurgeCompleted.text = Delete Completed &Tasks
-PurgeCompleted.tooltip = Delete Completed Tasks
-PurgeCompleted.title = Delete Completed Tasks
-PurgeCompleted.noneCompleted = No completed tasks to delete.
-PurgeCompleted.permanent = Do you want to permanently delete all {0} 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 = &Restore Defaults
-
-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.creationTime = Creation &Time:
-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 bbfd6fe..0000000
--- a/bundles/org.eclipse.ui.win32/.classpath
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="var" path="JRE_LIB" sourcepath="JRE_SRC"/>
- <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="src" path="/org.eclipse.jface"/>
- <classpathentry kind="src" path="/org.eclipse.ui.workbench"/>
- <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 369fa41..0000000
--- a/bundles/org.eclipse.ui.win32/.project
+++ /dev/null
@@ -1,22 +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.jface</project>
- <project>org.eclipse.swt</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.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 ed5519f..0000000
--- a/bundles/org.eclipse.ui.win32/build.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-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 49f2fcd..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.workbench"
- 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 36f8995..0000000
--- a/bundles/org.eclipse.ui.win32/src/org/eclipse/ui/internal/editorsupport/win32/OleEditor.java
+++ /dev/null
@@ -1,642 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.internal.editorsupport.win32;
-
-import java.io.File;
-import java.lang.reflect.InvocationTargetException;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.ole.win32.OLE;
-import org.eclipse.swt.ole.win32.OleAutomation;
-import org.eclipse.swt.ole.win32.OleClientSite;
-import org.eclipse.swt.ole.win32.OleFrame;
-import org.eclipse.swt.ole.win32.Variant;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceColors;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.SaveAsDialog;
-import org.eclipse.ui.internal.WorkbenchMessages;
-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 RENAME_ERROR_TITLE =
- WorkbenchMessages.getString("OleEditor.errorSaving"); //$NON-NLS-1$
- private static final String OLE_EXCEPTION_TITLE =
- WorkbenchMessages.getString("OleEditor.oleExceptionTitle"); //$NON-NLS-1$
- private static final String OLE_EXCEPTION_MESSAGE =
- WorkbenchMessages.getString("OleEditor.oleExceptionMessage"); //$NON-NLS-1$
- private static final String SAVE_ERROR_TITLE =
- WorkbenchMessages.getString("OleEditor.savingTitle"); //$NON-NLS-1$
- private static final String SAVE_ERROR_MESSAGE =
- WorkbenchMessages.getString("OleEditor.savingMessage"); //$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(IResource.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(IResource.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"}); //$NON-NLS-1$
- if (appId != null) {
- Variant pVarResult = dispInterface.getProperty(appId[0]);
- if (pVarResult != null) {
- OleAutomation application = pVarResult.getAutomation();
- int[] dispid = application.getIDsOfNames(new String[] {"DisplayScrollBars"}); //$NON-NLS-1$
- if (dispid != null) {
- Variant rgvarg = new Variant(true);
- 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$
-
- IFile file = (((IFileEditorInput) input).getFile());
-
- //Cannot create this with a file and no physical location
- if(file.getLocation() == null || !(new File(file.getLocation().toOSString()).exists()))
- throw new PartInitException(
- WorkbenchMessages.format("OleEditor.noFileInput", new Object[] { file.getLocation() })); //$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();
- }
-
-}
diff --git a/bundles/org.eclipse.ui/schema/commands.exsd b/bundles/org.eclipse.ui/schema/commands.exsd
index 485fb68..205192d 100644
--- a/bundles/org.eclipse.ui/schema/commands.exsd
+++ b/bundles/org.eclipse.ui/schema/commands.exsd
@@ -19,8 +19,8 @@
<element ref="activeKeyConfiguration"/>
<element ref="category"/>
<element ref="command"/>
-<!--element ref="gestureBinding"/-->
<!--element ref="gestureConfiguration"/-->
+<!--element ref="gestureBinding"/-->
<element ref="keyBinding"/>
<element ref="keyConfiguration"/>
<element ref="context"/>
@@ -153,6 +153,38 @@
</complexType>
</element>
+<!--element name="gestureConfiguration">
+ <complexType>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="parent" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element-->
<!--element name="gestureBinding">
<complexType>
<sequence>
@@ -202,38 +234,6 @@
</attribute>
</complexType>
</element-->
-<!--element name="gestureConfiguration">
- <complexType>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="parent" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element-->
<element name="keyBinding">
<annotation>
<documentation>
@@ -334,13 +334,6 @@
</complexType>
</element>
-<!--element name="sequence">
- <complexType>
- <sequence>
- <element ref="stroke" minOccurs="1" maxOccurs="unbounded"/>
- </sequence>
- </complexType>
- </element-->
<!--element name="stroke">
<complexType>
<attribute name="value" type="string">
@@ -352,6 +345,13 @@
</attribute>
</complexType>
</element-->
+<!--element name="sequence">
+ <complexType>
+ <sequence>
+ <element ref="stroke" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ </complexType>
+ </element-->
<element name="context">
<annotation>
<documentation>
@@ -438,7 +438,7 @@
</appInfo>
<documentation>
<p>
-Copyright (c) 2000, 2003 IBM Corporation and others.<br />
+Copyright (c) 2000, 2003 IBM Corporation and others.<br></br>
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
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 33a8f29..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/.project
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.examples.multipageeditor</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.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 8b24c1c..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MessageUtil.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-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 52ce9e1..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MultiPageContributor.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.multipageeditor;
-
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.ui.*;
-import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
-import org.eclipse.ui.texteditor.ITextEditor;
-import org.eclipse.ui.texteditor.ITextEditorActionConstants;
-
-/**
- * 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 MultiPageEditorActionBarContributor.
- */
-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.setGlobalActionHandler(IWorkbenchActionConstants.ADD_TASK, getAction(editor, ITextEditorActionConstants.ADD_TASK));
- 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 7691096..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/MultiPageEditorExample.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.multipageeditor;
-
-
-import java.io.StringWriter;
-import java.text.Collator;
-import java.util.*;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-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.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.part.MultiPageEditorPart;
-
-/**
- * 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 74743a3..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/Eclipse UI Examples MultiPageEditor/org/eclipse/ui/examples/multipageeditor/messages.properties
+++ /dev/null
@@ -1,16 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-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 f544c84..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/build.properties
+++ /dev/null
@@ -1,21 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-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 c598113..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 069eb62..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 2e5c9f4..0000000
--- a/examples/org.eclipse.ui.examples.multipageeditor/plugin.properties
+++ /dev/null
@@ -1,13 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-Plugin.name = Multi-Page 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 1bf0d23..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 1b410f9..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 72c26d6..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Address.java
+++ /dev/null
@@ -1,329 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-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 30ac7de..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Birthday.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-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 32cecb9..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddress.java
+++ /dev/null
@@ -1,187 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-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 7511f15..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/EmailAddressValidator.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-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 6d80b04..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/GroupElement.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-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 a626b30..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/IUserConstants.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-/**
- * 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 d02e553..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/MessageUtil.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-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 89206f5..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/Name.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.examples.propertysheet;
-
-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;
- index1 = name.indexOf(' ');
- if (index1 < 0)
- index1 = name.length();
- index2 = name.lastIndexOf(' ');
- 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 10e9b81..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/OrganizationElement.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-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 f2538e6..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PopupMenuActionDelegate.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-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 b863e3d..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PropertySheetContentOutlinePage.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-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.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 f4cdd6f..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/PropertySheetPlugin.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-import org.eclipse.core.runtime.IPluginDescriptor;
-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 647558a..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/StreetAddress.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-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 1881030..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserEditor.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-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 59179d3..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserElement.java
+++ /dev/null
@@ -1,511 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-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 f7dd32c..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/UserFileParser.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.propertysheet;
-
-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 bd2cd53..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/Eclipse UI Examples PropertySheet/org/eclipse/ui/examples/propertysheet/messages.properties
+++ /dev/null
@@ -1,108 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-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 0a1ed0a..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 7fb518e..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/build.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-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 c598113..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 7b59fba..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 93bcdca..0000000
--- a/examples/org.eclipse.ui.examples.propertysheet/plugin.properties
+++ /dev/null
@@ -1,14 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-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 dc3966f..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 d458e54..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 41bc317..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 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import java.util.*;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * 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 9492a15..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AddReadmeMarkerAction.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-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 357a221..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/AddSentenceResolution.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-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.ui.*;
-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 9ce8f0f..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/DefaultSectionsParser.java
+++ /dev/null
@@ -1,160 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import java.io.*;
-import java.util.Hashtable;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-
-/**
- * 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 5f48296..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/DirtyStateContribution.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.jface.action.ControlContribution;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IPropertyListener;
-
-/**
- * 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 53528bf..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/EditorActionDelegate.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorPart;
-
-/**
- * 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 6583b5b..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/IReadmeConstants.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-/**
- * 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"; //$NON-NLS-1$
- public static final String LABELRETARGET3 = PREFIX + "labelretarget3"; //$NON-NLS-1$
-
- public static final String ACTION_SET_RETARGET4 = "org_eclipse_ui_examples_readmetool_readmeRetargetAction"; //$NON-NLS-1$
- public static final String ACTION_SET_LABELRETARGET5 = "org_eclipse_ui_examples_readmetool_readmeRelabelRetargetAction"; //$NON-NLS-1$
-
- // 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 3f8203b..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/IReadmeFileParser.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-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 a94604f..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MarkElement.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import java.util.Vector;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.views.properties.IPropertySource;
-
-/**
- * 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 69b602d..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MarkElementProperties.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.ui.views.properties.*;
-
-/**
- * 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 3939564..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/MessageUtil.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-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 3a2fa46..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/PopupMenuActionDelegate.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-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 add61d6..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeContentOutlineDragListener.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.ui.part.PluginTransfer;
-import org.eclipse.ui.part.PluginTransferData;
-
-/**
- * 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 6dd5d58..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeContentOutlinePage.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.swt.dnd.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.PluginTransfer;
-import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
-
-/**
- * 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 397edf6..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeCreationPage.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.examples.readmetool;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import org.eclipse.core.resources.IFile;
-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.ui.*;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * 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);
-
- 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 ea9cff2..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeCreationWizard.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.IWorkbench;
-
-/**
- * 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 0d63b41..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeDropActionDelegate.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import java.io.ByteArrayInputStream;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.ui.part.IDropActionDelegate;
-
-/**
- * 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 fea6fcf..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeEditor.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.action.*;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.editors.text.TextEditor;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-/**
- * 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;
-
- /**
- * 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")); //$NON-NLS-1$
- 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 606ec5a..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeEditorActionBarContributor.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.jface.action.*;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.widgets.Shell;
-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.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() {
- 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 71006d0..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeFilePropertyPage.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import java.io.*;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.*;
-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.dialogs.PropertyPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * 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(getControl(), 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 59fd6b3..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeFilePropertyPage2.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import java.io.*;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-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.dialogs.PropertyPage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * 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(getControl(), 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 d160884..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeImages.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-/**
- * 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/"; //$NON-NLS-1$
-
- 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 40549ce..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeMarkerResolutionGenerator.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.ui.IMarkerResolution;
-import org.eclipse.ui.IMarkerResolutionGenerator2;
-
-/**
- * Creates resolutions for readme markers.
- */
-public class ReadmeMarkerResolutionGenerator implements IMarkerResolutionGenerator2 {
-
- /* (non-Javadoc)
- * Method declared on IMarkerResolutionGenerator.
- */
- public IMarkerResolution[] getResolutions(IMarker marker) {
- return new IMarkerResolution[] {new AddSentenceResolution()};
- }
-
- /* (non-Javadoc)
- * Method declared on IMarkerResolutionGenerator2.
- */
- public boolean hasResolutions(IMarker marker) {
- return true;
- }
-
-}
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 ef156d4..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeModelFactory.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-/**
- * 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 3569246..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmePlugin.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.core.runtime.IPluginDescriptor;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * 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 b2bfa04..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmePreferencePage.java
+++ /dev/null
@@ -1,319 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-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.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-
-/**
- * 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);
- 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);
- 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);
- 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 37a8431..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ReadmeSectionsView.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * 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 14e931b..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/SectionsDialog.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.viewers.ListViewer;
-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.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-/**
- * 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 6a8025a..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/ViewActionDelegate.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-/**
- * 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 b8afc29..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/WindowActionDelegate.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.examples.readmetool;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-/**
- * 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 5f0cf3a..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/Eclipse UI Examples Readme Tool/org/eclipse/ui/examples/readmetool/messages.properties
+++ /dev/null
@@ -1,95 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-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 bf2b580..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 e212ac0..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/build.properties
+++ /dev/null
@@ -1,24 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-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 c598113..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 0167478..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
-Window > 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 Example...
-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 Window->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->Example....
-<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 c598113..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 9db703c..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 12419de..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 49d11dd..0000000
--- a/examples/org.eclipse.ui.examples.readmetool/plugin.properties
+++ /dev/null
@@ -1,37 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-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 07b95dd..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
diff --git a/tests/org.eclipse.ui.tests/.classpath b/tests/org.eclipse.ui.tests/.classpath
deleted file mode 100644
index 6e87e01..0000000
--- a/tests/org.eclipse.ui.tests/.classpath
+++ /dev/null
@@ -1,15 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="UI Test Utils"/>
- <classpathentry kind="src" path="Eclipse JFace Tests"/>
- <classpathentry kind="src" path="Eclipse UI Tests"/>
- <classpathentry kind="src" path="/org.junit"/>
- <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="ECLIPSE_HOME/startup.jar"/>
- <classpathentry kind="var" path="JRE_LIB" rootpath="JRE_SRCROOT" sourcepath="JRE_SRC"/>
- <classpathentry kind="src" path="Benchmark Tests"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/tests/org.eclipse.ui.tests/.cvsignore b/tests/org.eclipse.ui.tests/.cvsignore
deleted file mode 100644
index c5e82d7..0000000
--- a/tests/org.eclipse.ui.tests/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-bin
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/.project b/tests/org.eclipse.ui.tests/.project
deleted file mode 100644
index 1f24162..0000000
--- a/tests/org.eclipse.ui.tests/.project
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.ui.tests</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>
- <project>org.junit</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/tests/org.eclipse.ui.tests/Benchmark Tests/org/eclipse/ui/tests/benchmarks/OpenCloseTest.java b/tests/org.eclipse.ui.tests/Benchmark Tests/org/eclipse/ui/tests/benchmarks/OpenCloseTest.java
deleted file mode 100644
index 8197d70..0000000
--- a/tests/org.eclipse.ui.tests/Benchmark Tests/org/eclipse/ui/tests/benchmarks/OpenCloseTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.benchmarks;
-
-
-import org.eclipse.ui.tests.util.UITestCase;
-
-/**
- * @version 1.0
- * @author
- */
-public class OpenCloseTest extends UITestCase {
-
- /**
- * Constructor for OpenCloseTest.
- * @param testName
- */
- public OpenCloseTest(String testName) {
- super(testName);
- }
-
- /**
- * Tests that the Navigator is initially populated with
- * the correct elements from the workspace.
- */
- public void testOpenClose() {
- }
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/preferences/DeprecatedFontPreferenceTestCase.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/preferences/DeprecatedFontPreferenceTestCase.java
deleted file mode 100644
index c76dcde..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/preferences/DeprecatedFontPreferenceTestCase.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.preferences;
-
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.resource.FontRegistry;
-import org.eclipse.jface.resource.JFaceResources;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.tests.util.UITestCase;
-
-/**
- * The FontPreferenceTestCase tests adding fonts to
- * the preference store and what occurs if the values
- * are bogus
- */
-
-public class DeprecatedFontPreferenceTestCase extends UITestCase {
-
- public String BAD_FONT_DEFINITION = "BadFont-regular-10";
- public String TEST_FONT_ID = "org.eclipse.jface.tests.preference.testfont";
- public String MISSING_FONT_ID =
- "org.eclipse.jface.tests.preference.missingfont";
-
- private IPreferenceStore preferenceStore;
-
- /**
- * Constructor for FontPreferenceTestCase.
- * @param testName
- */
- public DeprecatedFontPreferenceTestCase(String testName) {
- super(testName);
- }
-
- /*
- * @see TestCase#setUp
- */
- protected void setUp() throws Exception {
- super.setUp();
- AbstractUIPlugin plugin =
- (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- preferenceStore = plugin.getPreferenceStore();
-
- //Set up the bogus entry for the bad first test
- FontData bogusData = new FontData();
- bogusData.setName("BadData");
- bogusData.setHeight(11);
- FontData[] storedValue = new FontData[2];
-
- //We assume here that the text font is OK
- storedValue[0] = bogusData;
- storedValue[1] =
- (PreferenceConverter
- .getDefaultFontDataArray(preferenceStore, JFaceResources.TEXT_FONT))[0];
- PreferenceConverter.setValue(preferenceStore,TEST_FONT_ID,storedValue);
- PreferenceConverter.setDefault(preferenceStore,TEST_FONT_ID,storedValue);
-
- }
-
-
- /**
- * Test for a valid font like the test font. The first good one
- * we should find should be the first one in the list.
- */
-
- public void testGoodFontDefinition(){
-
- FontRegistry fontRegistry = JFaceResources.getFontRegistry();
- FontData[] currentTextFonts =
- PreferenceConverter.getFontDataArray(preferenceStore, JFaceResources.TEXT_FONT);
- FontData bestFont = fontRegistry.bestData(currentTextFonts,Display.getCurrent());
-
- //Assert that it is the first font that we get as the
- //valid one
- assertEquals(bestFont.getName(),currentTextFonts[0].getName());
- assertEquals(bestFont.getHeight(),currentTextFonts[0].getHeight());
- }
-
- /**
- * Test that if the first font in the list is bad that the
- * second one comes back as valid.
- */
-
- public void testBadFirstFontDefinition(){
-
- FontRegistry fontRegistry = JFaceResources.getFontRegistry();
- FontData[] currentTestFonts =
- PreferenceConverter.getFontDataArray(preferenceStore, TEST_FONT_ID);
- FontData bestFont = fontRegistry.bestData(currentTestFonts,Display.getCurrent());
-
- //Assert that it is the second font that we get as the
- //valid one
- assertEquals(bestFont.getName(),currentTestFonts[1].getName());
- assertEquals(bestFont.getHeight(),currentTestFonts[1].getHeight());
- }
-
- /**
- * Test that the no valid font is returned when the entry
- * is missing.
- */
-
- public void testNoFontDefinition(){
-
- FontRegistry fontRegistry = JFaceResources.getFontRegistry();
- FontData[] currentTestFonts =
- PreferenceConverter.getFontDataArray(preferenceStore, MISSING_FONT_ID);
- FontData bestFont = fontRegistry.bestData(currentTestFonts,Display.getCurrent());
-
- FontData[] systemFontData = Display.getCurrent().getSystemFont().getFontData();
-
- //Assert that the first font is the system font
- assertEquals(bestFont.getName(),systemFontData[0].getName());
- assertEquals(bestFont.getHeight(),systemFontData[0].getHeight());
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/preferences/FontPreferenceTestCase.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/preferences/FontPreferenceTestCase.java
deleted file mode 100644
index 60f53a9..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/preferences/FontPreferenceTestCase.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.preferences;
-
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.swt.graphics.FontData;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferenceConverter;
-import org.eclipse.jface.resource.FontRegistry;
-import org.eclipse.jface.resource.JFaceResources;
-
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.tests.util.UITestCase;
-
-/**
- * The FontPreferenceTestCase tests adding fonts to
- * the preference store and what occurs if the values
- * are bogus
- */
-
-public class FontPreferenceTestCase extends UITestCase {
-
- public String BAD_FONT_DEFINITION = "BadFont-regular-10";
- public String TEST_FONT_ID = "org.eclipse.jface.tests.preference.testfont";
- public String MISSING_FONT_ID =
- "org.eclipse.jface.tests.preference.missingfont";
-
- private IPreferenceStore preferenceStore;
-
- /**
- * Constructor for FontPreferenceTestCase.
- * @param testName
- */
- public FontPreferenceTestCase(String testName) {
- super(testName);
- }
-
- /*
- * @see TestCase#setUp
- */
- protected void setUp() throws Exception {
- super.setUp();
- AbstractUIPlugin plugin =
- (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- preferenceStore = plugin.getPreferenceStore();
-
- //Set up the bogus entry for the bad first test
- FontData bogusData = new FontData();
- bogusData.setName("BadData");
- bogusData.setHeight(11);
- FontData[] storedValue = new FontData[2];
-
- //We assume here that the text font is OK
- storedValue[0] = bogusData;
- storedValue[1] =
- (PreferenceConverter
- .getDefaultFontDataArray(preferenceStore, JFaceResources.TEXT_FONT))[0];
- PreferenceConverter.setValue(preferenceStore,TEST_FONT_ID,storedValue);
- PreferenceConverter.setDefault(preferenceStore,TEST_FONT_ID,storedValue);
-
- }
-
-
- /**
- * Test for a valid font like the test font. The first good one
- * we should find should be the first one in the list.
- */
-
- public void testGoodFontDefinition(){
-
- FontRegistry fontRegistry = JFaceResources.getFontRegistry();
- FontData[] currentTextFonts =
- PreferenceConverter.getFontDataArray(preferenceStore, JFaceResources.TEXT_FONT);
- FontData[] bestFont = fontRegistry.bestDataArray(currentTextFonts,Display.getCurrent());
-
- //Assert that it is the first font that we get as the
- //valid one
- assertEquals(bestFont[0].getName(),currentTextFonts[0].getName());
- assertEquals(bestFont[0].getHeight(),currentTextFonts[0].getHeight());
- }
-
- /**
- * Test that if the first font in the list is bad that the
- * second one comes back as valid.
- */
-
- public void testBadFirstFontDefinition(){
-
- FontRegistry fontRegistry = JFaceResources.getFontRegistry();
- FontData[] currentTestFonts =
- PreferenceConverter.getFontDataArray(preferenceStore, TEST_FONT_ID);
- FontData[] bestFont = fontRegistry.bestDataArray(currentTestFonts,Display.getCurrent());
-
- //Assert that it is the second font that we get as the
- //valid one
- assertEquals(bestFont[0].getName(),currentTestFonts[1].getName());
- assertEquals(bestFont[0].getHeight(),currentTestFonts[1].getHeight());
- }
-
- /**
- * Test that the no valid font is returned when the entry
- * is missing.
- */
-
- public void testNoFontDefinition(){
-
- FontRegistry fontRegistry = JFaceResources.getFontRegistry();
- FontData[] currentTestFonts =
- PreferenceConverter.getFontDataArray(preferenceStore, MISSING_FONT_ID);
- FontData[] bestFont = fontRegistry.bestDataArray(currentTestFonts,Display.getCurrent());
-
- FontData[] systemFontData = Display.getCurrent().getSystemFont().getFontData();
-
- //Assert that the first font is the system font
- assertEquals(bestFont[0].getName(),systemFontData[0].getName());
- assertEquals(bestFont[0].getHeight(),systemFontData[0].getHeight());
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/AbstractTreeViewerTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/AbstractTreeViewerTest.java
deleted file mode 100644
index 36454a4..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/AbstractTreeViewerTest.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-
-import org.eclipse.swt.widgets.Item;
-import org.eclipse.swt.widgets.Widget;
-
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-
-public abstract class AbstractTreeViewerTest extends StructuredItemViewerTest {
-
- AbstractTreeViewer fTreeViewer;
-
- public AbstractTreeViewerTest(String name) {
- super(name);
- }
- protected void assertEqualsArray(String s, Object[] a1, Object[] a2) {
- int s1= a1.length;
- int s2= a2.length;
- assertTrue(s, s1 == s2);
- for (int i= 0; i < s1; i++) {
- assertEquals(s, a1[i], a2[i]);
- }
- }
- protected abstract int getItemCount(TestElement element); //was IElement
-public void testBulkExpand() {
- // navigate
- TestElement first = fRootElement.getFirstChild();
- TestElement first2 = first.getFirstChild();
- TestElement last = fRootElement.getLastChild();
-
- // expand a few nodes
- fTreeViewer.expandToLevel(first, 2);
- fTreeViewer.expandToLevel(first2, 2);
- fTreeViewer.expandToLevel(last, 2);
-
- // get expand state
- Object[] list1 = fTreeViewer.getExpandedElements();
-
- // flush viewer
- fViewer.setInput(fRootElement);
-
- // restore old expand state
- fTreeViewer.collapseAll();
- fTreeViewer.expandToLevel(first, 2);
- fTreeViewer.expandToLevel(first2, 2);
- fTreeViewer.expandToLevel(last, 2);
-
- Object[] list2 = fTreeViewer.getExpandedElements();
-
- assertEqualsArray("old and new expand state are the same", list1, list2);
-}
- public void testDeleteChildExpanded() {
- TestElement first= fRootElement.getFirstChild();
- TestElement first2= first.getFirstChild();
- fTreeViewer.expandToLevel(first2,0);
-
- assertNotNull("first child is visible", fViewer.testFindItem(first2));
- first.deleteChild(first2);
- assertNull("first child is not visible", fViewer.testFindItem(first2));
- }
- public void testDeleteChildren() {
- TestElement first= fRootElement.getFirstChild();
- first.deleteChildren();
- assertTrue("no children", getItemCount(first) == 0);
- }
- public void testDeleteChildrenExpanded() {
- TestElement first= fRootElement.getFirstChild();
- TestElement first2= first.getFirstChild();
- fTreeViewer.expandToLevel(first2,0);
- assertNotNull("first child is visible", fViewer.testFindItem(first2));
-
- first.deleteChildren();
- assertTrue("no children", getItemCount(first) == 0);
- }
- public void testExpand() {
- TestElement first= fRootElement.getFirstChild();
- TestElement first2= first.getFirstChild();
- assertNull("first child is not visible", fViewer.testFindItem(first2));
- fTreeViewer.expandToLevel(first2,0);
- assertNotNull("first child is visible", fViewer.testFindItem(first2));
- }
-public void testExpandElement() {
- TestElement first = fRootElement.getFirstChild();
- TestElement first2 = first.getFirstChild();
- TestElement first3 = first2.getFirstChild();
- fTreeViewer.expandToLevel(first3, 0);
- assertNotNull("first3 is visible", fViewer.testFindItem(first3));
- assertNotNull("first2 is visible", fViewer.testFindItem(first2));
-}
- public void testExpandToLevel() {
- TestElement first= fRootElement.getFirstChild();
- TestElement first2= first.getFirstChild();
- fTreeViewer.expandToLevel(2);
- assertNotNull("first2 is visible", fViewer.testFindItem(first2));
- }
- public void testFilterExpanded() {
- TestElement first= fRootElement.getFirstChild();
- TestElement first2= first.getFirstChild();
- fTreeViewer.expandToLevel(first2,0);
-
- fTreeViewer.addFilter(new TestLabelFilter());
- assertTrue("filtered count", getItemCount() == 5);
- }
- public void testInsertChildReveal() {
- TestElement first= fRootElement.getFirstChild();
- TestElement newElement= first.addChild(TestModelChange.INSERT | TestModelChange.REVEAL);
- assertNotNull("new sibling is visible", fViewer.testFindItem(newElement));
- }
- public void testInsertChildRevealSelect() {
- TestElement last= fRootElement.getLastChild();
- TestElement newElement= last.addChild(TestModelChange.INSERT | TestModelChange.REVEAL | TestModelChange.SELECT);
- assertNotNull("new sibling is visible", fViewer.testFindItem(newElement));
- assertSelectionEquals("new element is selected", newElement);
- }
- public void testInsertChildRevealSelectExpanded() {
- TestElement first= fRootElement.getFirstChild();
- TestElement newElement= first.addChild(TestModelChange.INSERT | TestModelChange.REVEAL | TestModelChange.SELECT);
- assertNotNull("new sibling is visible", fViewer.testFindItem(newElement));
- assertSelectionEquals("new element is selected", newElement);
- }
- /**
- * Regression test for 1GDN0PX: ITPUI:WIN2000 - SEVERE - AssertionFailure when expanding Navigator
- * Problem was:
- * - before addition, parent item had no children, and was expanded
- * - after addition, during refresh(), updatePlus() added dummy node even though parent item was expanded
- * - in updateChildren, it wasn't handling a dummy node
- */
- public void testRefreshWithAddedChildren() {
- TestElement parent = fRootElement.addChild(TestModelChange.INSERT);
- TestElement child = parent.addChild(TestModelChange.INSERT);
- ((AbstractTreeViewer) fViewer).setExpandedState(parent, true);
- parent.deleteChild(child);
- child = parent.addChild(TestModelChange.STRUCTURE_CHANGE);
- assertNotNull("new child is visible", fViewer.testFindItem(child));
- }
- /**
- * Regression test for 1GBDB5A: ITPUI:WINNT - Exception in AbstractTreeViewer update.
- * Problem was:
- * node has child A
- * node gets duplicate child A
- * viewer is refreshed rather than using add for new A
- * AbstractTreeViewer.updateChildren(...) was not properly handling it
- */
- public void testRefreshWithDuplicateChild() {
- TestElement first= fRootElement.getFirstChild();
- TestElement newElement= (TestElement) first.clone();
- fRootElement.addChild(newElement, new TestModelChange(TestModelChange.STRUCTURE_CHANGE, fRootElement));
- assertNotNull("new sibling is visible", fViewer.testFindItem(newElement));
- }
-
- /**
- * Regression test for Bug 3840 [Viewers] free expansion of jar happening when deleting projects (1GEV2FL)
- * Problem was:
- * - node has children A and B
- * - A is expanded, B is not
- * - A gets deleted
- * - B gets expanded because it reused A's item
- */
- public void testRefreshWithReusedItems() {
-// TestElement a= fRootElement.getFirstChild();
-// TestElement aa= a.getChildAt(0);
-// TestElement ab= a.getChildAt(1);
-// fTreeViewer.expandToLevel(aa, 1);
-// List expandedBefore = Arrays.asList(fTreeViewer.getExpandedElements());
-// assertTrue(expandedBefore.contains(a));
-// assertTrue(expandedBefore.contains(aa));
-// assertFalse(expandedBefore.contains(ab));
-// a.deleteChild(aa, new TestModelChange(TestModelChange.STRUCTURE_CHANGE, a));
-// List expandedAfter = Arrays.asList(fTreeViewer.getExpandedElements());
-// assertFalse(expandedAfter.contains(ab));
- }
-
- public void testRenameChildElement() {
- TestElement first= fRootElement.getFirstChild();
- TestElement first2= first.getFirstChild();
- fTreeViewer.expandToLevel(first2,0);
- assertNotNull("first child is visible", fViewer.testFindItem(first2));
-
- String newLabel= first2.getLabel()+" changed";
- first2.setLabel(newLabel);
- Widget widget= fViewer.testFindItem(first2);
- assertTrue(widget instanceof Item);
- assertEquals("changed label", first2.getID()+" "+newLabel, ((Item)widget).getText());
- }
-
- /**
- * Regression test for Bug 26698 [Viewers] stack overflow during debug session, causing IDE to crash
- * Problem was:
- * - node A has child A
- * - setExpanded with A in the list caused an infinite recursion
- */
- public void testSetExpandedWithCycle() {
- TestElement first= fRootElement.getFirstChild();
- first.addChild(first, new TestModelChange(TestModelChange.INSERT, first, first));
- fTreeViewer.setExpandedElements(new Object[] { first });
-
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/AllTests.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/AllTests.java
deleted file mode 100644
index 12c0ddf..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/AllTests.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-import org.eclipse.jface.tests.preferences.DeprecatedFontPreferenceTestCase;
-import org.eclipse.jface.tests.preferences.FontPreferenceTestCase;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-public class AllTests {
-
- public static void main(String[] args) {
- junit.textui.TestRunner.run(suite());
- }
- public static Test suite() {
- TestSuite suite= new TestSuite();
- suite.addTest(new TestSuite(TreeViewerTest.class));
- suite.addTest(new TestSuite(TableViewerTest.class));
- suite.addTest(new TestSuite(TableTreeViewerTest.class));
- suite.addTest(new TestSuite(ListViewerTest.class));
- suite.addTest(new TestSuite(CheckboxTableViewerTest.class));
- suite.addTest(new TestSuite(CheckboxTreeViewerTest.class));
- suite.addTest(new TestSuite(FontPreferenceTestCase.class));
- suite.addTest(new TestSuite(DeprecatedFontPreferenceTestCase.class));
- return suite;
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/CheckboxTableViewerTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/CheckboxTableViewerTest.java
deleted file mode 100644
index 8465d26..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/CheckboxTableViewerTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-
-
-public class CheckboxTableViewerTest extends TableViewerTest {
-public static class CheckboxTableTestLabelProvider
- extends TestLabelProvider
- implements ITableLabelProvider {
-
- public boolean fExtended = false;
-
- public String getText(Object element) {
- if (fExtended)
- return providedString((String) element);
- return element.toString();
- }
- public String getColumnText(Object element, int index) {
- if (fExtended)
- return providedString((TestElement) element);
- return element.toString();
- }
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-}
- public CheckboxTableViewerTest(String name) {
- super(name);
- }
-protected StructuredViewer createViewer(Composite parent) {
- Table table = new Table(parent, SWT.CHECK | SWT.BORDER);
- table.setLinesVisible(true);
- TableLayout layout = new TableLayout();
- table.setLayout(layout);
- table.setHeaderVisible(true);
-
- String headers[] = { "column 1 header", "column 2 header" };
-
- ColumnLayoutData layouts[] =
- { new ColumnWeightData(100), new ColumnWeightData(100)};
-
- final TableColumn columns[] = new TableColumn[headers.length];
-
- for (int i = 0; i < headers.length; i++) {
- layout.addColumnData(layouts[i]);
- TableColumn tc = new TableColumn(table, SWT.NONE, i);
- tc.setResizable(layouts[i].resizable);
- tc.setText(headers[i]);
- columns[i] = tc;
- }
-
- TableViewer viewer = new CheckboxTableViewer(table);
- viewer.setContentProvider(new TestModelContentProvider());
- viewer.setLabelProvider(new TableTestLabelProvider());
- return viewer;
-}
- public static void main(String args[]) {
- junit.textui.TestRunner.run(CheckboxTableViewerTest.class);
- }
- public void testCheckAllElements() {
- CheckboxTableViewer ctv= (CheckboxTableViewer)fViewer;
- ctv.setAllChecked(true);
- assertTrue(ctv.getChecked(fRootElement.getFirstChild()));
- assertTrue(ctv.getChecked(fRootElement.getLastChild()));
- ctv.setAllChecked(false);
- assertTrue(!ctv.getChecked(fRootElement.getFirstChild()));
- assertTrue(!ctv.getChecked(fRootElement.getLastChild()));
- }
- public void testGrayAllElements() {
- CheckboxTableViewer ctv= (CheckboxTableViewer)fViewer;
- ctv.setAllGrayed(true);
- assertTrue(ctv.getGrayed(fRootElement.getFirstChild()));
- assertTrue(ctv.getGrayed(fRootElement.getLastChild()));
- ctv.setAllGrayed(false);
- assertTrue(!ctv.getGrayed(fRootElement.getFirstChild()));
- assertTrue(!ctv.getGrayed(fRootElement.getLastChild()));
- }
- public void testGrayed() {
- CheckboxTableViewer ctv= (CheckboxTableViewer)fViewer;
- TestElement element= fRootElement.getFirstChild();
-
- assertTrue(ctv.getGrayedElements().length == 0);
- assertTrue(!ctv.getGrayed(element));
-
- ctv.setGrayed(element, true);
- assertTrue(ctv.getGrayedElements().length == 1);
- assertTrue(ctv.getGrayed(element));
-
- ctv.setGrayed(element, false);
- assertTrue(ctv.getGrayedElements().length == 0);
- assertTrue(!ctv.getGrayed(element));
-
- ctv.setAllGrayed(false);
- }
- public void testGrayedElements() {
- CheckboxTableViewer ctv= (CheckboxTableViewer)fViewer;
- TestElement first= fRootElement.getFirstChild();
- TestElement last= fRootElement.getLastChild();
-
- assertTrue(ctv.getGrayedElements().length == 0);
- assertTrue(!ctv.getGrayed(first));
- assertTrue(!ctv.getGrayed(last));
-
- ctv.setGrayed(first, true);
- ctv.setGrayed(last, true);
- Object[] elements= ctv.getGrayedElements();
- assertTrue(elements.length == 2);
- assertTrue(elements[0] == first);
- assertTrue(elements[1] == last);
-
- ctv.setGrayed(first, false);
- ctv.setGrayed(last, false);
- assertTrue(ctv.getGrayedElements().length == 0);
-
- ctv.setAllGrayed(false);
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/CheckboxTreeViewerTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/CheckboxTreeViewerTest.java
deleted file mode 100644
index 916f2bb..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/CheckboxTreeViewerTest.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.viewers.CheckboxTreeViewer;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-
-public class CheckboxTreeViewerTest extends TreeViewerTest {
- public static class CheckboxTableTestLabelProvider
- extends TestLabelProvider
- implements ITableLabelProvider {
-
- public boolean fExtended = false;
-
- public String getText(Object element) {
- if (fExtended)
- return providedString((String) element);
- return element.toString();
- }
- public String getColumnText(Object element, int index) {
- if (fExtended)
- return providedString((TestElement) element);
- return element.toString();
- }
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
- }
- public CheckboxTreeViewerTest(String name) {
- super(name);
- }
- protected StructuredViewer createViewer(Composite parent) {
- fTreeViewer = new CheckboxTreeViewer(parent);
- fTreeViewer.setContentProvider(new TestModelContentProvider());
- return fTreeViewer;
- }
- public static void main(String args[]) {
- junit.textui.TestRunner.run(CheckboxTreeViewerTest.class);
- }
- public void testCheckSubtree() {
- CheckboxTreeViewer ctv = (CheckboxTreeViewer) fViewer;
- TestElement first = fRootElement.getFirstChild();
- TestElement firstfirst = first.getFirstChild();
- TestElement firstfirstfirst = firstfirst.getFirstChild();
- fTreeViewer.expandToLevel(firstfirst, 0);
-
- ctv.setSubtreeChecked(first, true);
- assertTrue(ctv.getChecked(firstfirst));
- ctv.setSubtreeChecked(first, false);
- assertTrue(!ctv.getChecked(firstfirst));
-
- // uncheck invisible subtree
- assertTrue(ctv.setSubtreeChecked(firstfirstfirst, false));
- assertTrue(!ctv.getChecked(firstfirstfirst));
- }
- public void testGrayed() {
- CheckboxTreeViewer ctv = (CheckboxTreeViewer) fViewer;
- TestElement element = fRootElement.getFirstChild();
-
- assertTrue(ctv.getGrayedElements().length == 0);
- assertTrue(!ctv.getGrayed(element));
-
- ctv.setGrayed(element, true);
- assertTrue(ctv.getGrayedElements().length == 1);
- assertTrue(ctv.getGrayed(element));
-
- ctv.setGrayed(element, false);
- assertTrue(ctv.getGrayedElements().length == 0);
- assertTrue(!ctv.getGrayed(element));
- }
- public void testParentGrayed() {
- CheckboxTreeViewer ctv = (CheckboxTreeViewer) fViewer;
- TestElement first = fRootElement.getFirstChild();
- TestElement firstfirst = first.getFirstChild();
- TestElement firstfirstfirst = firstfirst.getFirstChild();
- ctv.expandToLevel(firstfirstfirst, 0);
-
- ctv.setParentsGrayed(firstfirstfirst, true);
- Object[] elements = ctv.getGrayedElements();
- assertTrue(elements.length == 3);
- for (int i = 0; i < elements.length; ++i) {
- assertTrue(ctv.getGrayed(elements[i]));
- };
-
- assertTrue(elements[0] == first);
- assertTrue(elements[1] == firstfirst);
- assertTrue(elements[2] == firstfirstfirst);
- ctv.setParentsGrayed(firstfirstfirst, false);
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ITestModelListener.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ITestModelListener.java
deleted file mode 100644
index 481c146..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ITestModelListener.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-public interface ITestModelListener {
- public void testModelChanged(TestModelChange change);
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ListViewerTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ListViewerTest.java
deleted file mode 100644
index 546241a..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/ListViewerTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.List;
-
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.StructuredViewer;
-
-public class ListViewerTest extends StructuredViewerTest {
-
- public ListViewerTest(String name) {
- super(name);
- }
- protected StructuredViewer createViewer(Composite parent) {
- ListViewer viewer= new ListViewer(parent);
- viewer.setContentProvider(new TestModelContentProvider());
- return viewer;
- }
- protected int getItemCount() {
- TestElement first= fRootElement.getFirstChild();
- List list= (List)fViewer.testFindItem(first);
- return list.getItemCount();
- }
- protected String getItemText(int at) {
- List list= (List) fViewer.getControl();
- return list.getItem(at);
- }
- public static void main(String args[]) {
- junit.textui.TestRunner.run(ListViewerTest.class);
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/StructuredItemViewerTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/StructuredItemViewerTest.java
deleted file mode 100644
index 697d284..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/StructuredItemViewerTest.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ICheckable;
-
-
-public abstract class StructuredItemViewerTest extends StructuredViewerTest {
-
- public StructuredItemViewerTest(String name) {
- super(name);
- }
-public void testCheckElement() {
-
- if (fViewer instanceof ICheckable) {
- TestElement first = fRootElement.getFirstChild();
- TestElement firstfirst = first.getFirstChild();
-
- ICheckable ctv = (ICheckable) fViewer;
- ctv.setChecked(first, true);
- assertTrue(ctv.getChecked(first));
-
- // checking an invisible element
- if (fViewer instanceof AbstractTreeViewer) {
- // The first child of the first child can only be resolved in a tree
- assertTrue(ctv.setChecked(firstfirst, true));
- assertTrue(ctv.getChecked(firstfirst));
- } else {
- assertTrue(!ctv.setChecked(firstfirst, true));
- assertTrue(!ctv.getChecked(firstfirst));
- }
-
- ctv.setChecked(first, false);
- assertTrue(!ctv.getChecked(first));
- }
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/StructuredSelectionTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/StructuredSelectionTest.java
deleted file mode 100644
index d209495..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/StructuredSelectionTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.TestCase;
-
-import org.eclipse.jface.viewers.StructuredSelection;
-
-public class StructuredSelectionTest extends TestCase {
-
- public StructuredSelectionTest(String name) {
- super(name);
- }
- public static void main(String args[]) {
- junit.textui.TestRunner.run(StructuredSelectionTest.class);
- }
- public void testEquals() {
- String element= "A selection";
- StructuredSelection sel1= new StructuredSelection(element);
- StructuredSelection sel2= new StructuredSelection(element);
- assertEquals(sel1, sel2);
- }
- public void testEquals2() {
- String element1= "A selection";
- String element2= "A selection";
- String element3= "Other";
- StructuredSelection sel1= new StructuredSelection(element1);
- StructuredSelection sel2= new StructuredSelection(element2);
- StructuredSelection sel3= new StructuredSelection(element3);
- assertEquals(sel1, sel2);
- assertTrue(!sel1.equals(sel3));
- }
- public void testEquals3() { // two empty selections
- StructuredSelection empty1= new StructuredSelection();
- StructuredSelection empty2= new StructuredSelection();
- assertTrue(empty1.equals(empty2));
- assertTrue(empty2.equals(empty1));
- }
- public void testEquals4() { // empty selection with non-empty selection
- StructuredSelection sel= new StructuredSelection("A selection");
- StructuredSelection empty= new StructuredSelection();
- assertTrue(!sel.equals(empty));
- assertTrue(!empty.equals(sel));
- }
- public void testEquals5() { // equality is order-dependent
- List l1 = new ArrayList();
- l1.add("element 1");
- l1.add("element 2");
-
- List l2 = new ArrayList();
- l2.add("element 2");
- l2.add("element 1");
-
- StructuredSelection sel1 = new StructuredSelection(l1);
- StructuredSelection sel2 = new StructuredSelection(l2);
- assertTrue(!sel1.equals(sel2));
- assertTrue(!sel2.equals(sel1));
- }
- public void testEquals6() { // equality is independent from order
- List l1 = new ArrayList();
- l1.add("element 1");
- l1.add("element 2");
-
- List l2 = new ArrayList();
- l2.add("element 2");
- l2.add("element 3");
- l2.add("element 1");
-
- StructuredSelection sel1= new StructuredSelection(l1);
- StructuredSelection sel2= new StructuredSelection(l2);
- assertTrue(!sel1.equals(sel2));
- assertTrue(!sel2.equals(sel1));
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/StructuredViewerTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/StructuredViewerTest.java
deleted file mode 100644
index 9d88af8..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/StructuredViewerTest.java
+++ /dev/null
@@ -1,359 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-import junit.framework.TestCase;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.FillLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableTreeViewer;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-public abstract class StructuredViewerTest extends TestCase {
- Display fDisplay;
- Shell fShell;
- StructuredViewer fViewer;
- TestElement fRootElement;
-
- public static class TestLabelFilter extends ViewerFilter {
- public boolean select(Viewer viewer, Object parent, Object element) {
- String label = ((TestElement) element).getLabel();
- int count = label.indexOf("-");
- if (count < 0)
- return false;
- String number = label.substring(count + 1);
- return ((Integer.parseInt(number) % 2) == 0);
- }
- public boolean isFilterProperty(Object element, String property) {
- return property.equals(IBasicPropertyConstants.P_TEXT);
- }
- };
-
- public static class TestLabelSorter extends ViewerSorter {
- public int compare(Viewer v, Object e1, Object e2) {
- // put greater labels first
- String name1 = ((TestElement) e1).getLabel();
- String name2 = ((TestElement) e2).getLabel();
- return name2.compareTo(name1);
- }
- public boolean isSorterProperty(Object element, String property) {
- return property.equals(IBasicPropertyConstants.P_TEXT);
- }
- };
-
- public static class TestLabelProvider extends LabelProvider {
- public static String fgSuffix = "";
-
- static Image fgImage = ImageDescriptor.createFromFile(TestLabelProvider.class, "images/java.gif").createImage();
-
- public String getText(Object element) {
- return providedString((TestElement) element);
- }
-
- public Image getImage(Object element) {
- return fgImage;
- }
-
- public void setSuffix(String suffix) {
- fgSuffix = suffix;
- fireLabelProviderChanged(new LabelProviderChangedEvent(this));
- }
- };
-
- public TestModel fModel;
- public StructuredViewerTest(String name) {
- super(name);
- }
-protected void assertSelectionEquals(String message, TestElement expected) {
- ISelection selection = fViewer.getSelection();
- assertTrue(selection instanceof StructuredSelection);
- StructuredSelection expectedSelection = new StructuredSelection(expected);
- assertEquals("selections", selection, expectedSelection);
-}
-protected void bulkChange(TestModelChange eventToFire) {
- TestElement first = fRootElement.getFirstChild();
- TestElement newElement = first.getContainer().basicAddChild();
- fRootElement.basicDeleteChild(first);
- fModel.fireModelChanged(eventToFire);
- assertNotNull("new sibling is visible", fViewer.testFindItem(newElement));
- assertNull("first child is not visible", fViewer.testFindItem(first));
-}
-/**
- * Creates the viewer used by this test, under the given parent widget.
- */
-protected abstract StructuredViewer createViewer(Composite parent);
- protected abstract int getItemCount();
- protected abstract String getItemText(int at);
- /**
- * Interacts with a test set up. Call this method from your
- * test when you want to interactively experiment with a set up.
- * The interaction terminates when the browser is closed.
- */
- public void interact() {
- Shell shell= fShell;
- if (shell != null && !shell.isDisposed()) {
- Display display= shell.getDisplay();
- if (display != null) {
- while (shell.isVisible())
- display.readAndDispatch();
- }
- }
- }
- protected void openBrowser() {
- fDisplay = Display.getCurrent();
- if (fDisplay == null) {
- fDisplay = new Display();
- }
- fShell = new Shell(fDisplay);
- fShell.setSize(500, 500);
- fShell.setLayout(new FillLayout());
- fViewer = createViewer(fShell);
- fViewer.setUseHashlookup(true);
- fViewer.setInput(fRootElement);
- fShell.open();
- //processEvents();
- }
-public void processEvents() {
- Shell shell = fShell;
- if (shell != null && !shell.isDisposed()) {
- Display display = shell.getDisplay();
- if (display != null) {
- while (display.readAndDispatch())
- ;
- }
- }
-}
- public static String providedString(String s) {
- return s+"<rendered>"+TestLabelProvider.fgSuffix;
- }
- public static String providedString(TestElement element) {
- return element.getID()+" "+element.getLabel()+"<rendered>"+TestLabelProvider.fgSuffix;
- }
- public void setUp() {
- fRootElement= TestElement.createModel(3, 10);
- fModel= fRootElement.getModel();
- openBrowser();
- }
- /**
- * Sleeps for the given duration and processes pending
- * events. Call this method to temporarily suspend a test
- * see the current state in the browser.
- */
- void sleep(int d) {
- processEvents();
- try {
- Thread.sleep(d*1000);
- } catch(Exception e) {}
- }
-public void tearDown() {
- processEvents();
- fViewer = null;
- if (fShell != null) {
- fShell.dispose();
- fShell = null;
- }
- // leave the display
- fRootElement = null;
-}
- public void testClearSelection() {
- TestElement first= fRootElement.getFirstChild();
- StructuredSelection selection= new StructuredSelection(first);
- fViewer.setSelection(selection);
- fViewer.setSelection(new StructuredSelection());
- ISelection result= fViewer.getSelection();
- assertTrue(result.isEmpty());
- }
- public void testDeleteChild() {
- TestElement first= fRootElement.getFirstChild();
- TestElement first2= first.getFirstChild();
- first.deleteChild(first2);
- assertNull("first child is not visible", fViewer.testFindItem(first2));
- }
- public void testDeleteInput() {
- TestElement first= fRootElement.getFirstChild();
- TestElement firstfirst= first.getFirstChild();
- fViewer.setInput(first);
- fRootElement.deleteChild(first);
- assertNull("first child is not visible", fViewer.testFindItem(firstfirst));
- }
- public void testDeleteSibling() {
- TestElement first= fRootElement.getFirstChild();
- assertNotNull("first child is visible", fViewer.testFindItem(first));
- fRootElement.deleteChild(first);
- assertNull("first child is not visible", fViewer.testFindItem(first));
- }
- public void testFilter() {
- ViewerFilter filter= new TestLabelFilter();
- fViewer.addFilter(filter);
- assertTrue("filtered count", getItemCount() == 5);
- fViewer.removeFilter(filter);
- assertTrue("unfiltered count", getItemCount() == 10);
-
- }
- public void testInsertChild() {
- TestElement first= fRootElement.getFirstChild();
- TestElement newElement= first.addChild(TestModelChange.INSERT);
- assertNull("new sibling is not visible", fViewer.testFindItem(newElement));
- }
- public void testInsertSibling() {
- TestElement newElement= fRootElement.addChild(TestModelChange.INSERT);
- assertNotNull("new sibling is visible", fViewer.testFindItem(newElement));
- }
- public void testInsertSiblingReveal() {
- TestElement newElement= fRootElement.addChild(TestModelChange.INSERT | TestModelChange.REVEAL);
- assertNotNull("new sibling is visible", fViewer.testFindItem(newElement));
- }
- public void testInsertSiblings() {
- TestElement[] newElements = fRootElement.addChildren(TestModelChange.INSERT);
- for (int i = 0; i < newElements.length; ++i)
- assertNotNull("new siblings are visible", fViewer.testFindItem(newElements[i]));
- }
- public void testInsertSiblingSelectExpanded() {
- TestElement newElement= fRootElement.addChild(TestModelChange.INSERT | TestModelChange.REVEAL | TestModelChange.SELECT);
- assertNotNull("new sibling is visible", fViewer.testFindItem(newElement));
- assertSelectionEquals("new element is selected", newElement);
- }
- public void testInsertSiblingWithFilterFiltered() {
- fViewer.addFilter(new TestLabelFilter());
- TestElement newElement= new TestElement(fModel, fRootElement);
- newElement.setLabel("name-111");
- fRootElement.addChild(newElement,
- new TestModelChange(TestModelChange.INSERT | TestModelChange.REVEAL | TestModelChange.SELECT, fRootElement, newElement)
- );
- assertNull("new sibling is not visible", fViewer.testFindItem(newElement));
- assertTrue(getItemCount() == 5);
- }
- public void testInsertSiblingWithFilterNotFiltered() {
- fViewer.addFilter(new TestLabelFilter());
- TestElement newElement= new TestElement(fModel, fRootElement);
- newElement.setLabel("name-222");
- fRootElement.addChild(newElement,
- new TestModelChange(TestModelChange.INSERT | TestModelChange.REVEAL | TestModelChange.SELECT, fRootElement, newElement)
- );
- assertNotNull("new sibling is visible", fViewer.testFindItem(newElement));
- assertTrue(getItemCount() == 6);
- }
- public void testInsertSiblingWithSorter() {
- fViewer.setSorter(new TestLabelSorter());
- TestElement newElement= new TestElement(fModel, fRootElement);
- newElement.setLabel("name-9999");
- fRootElement.addChild(newElement,
- new TestModelChange(TestModelChange.INSERT |TestModelChange.REVEAL | TestModelChange.SELECT, fRootElement, newElement)
- );
- String newLabel= newElement.toString();
- assertEquals("sorted first", newLabel, getItemText(0));
- assertSelectionEquals("new element is selected", newElement);
- }
- public void testLabelProvider() {
- // BUG: non-polymorphic behaviour
- // if (fViewer instanceof TableViewer || fViewer instanceof TableTreeViewer)
- // return;
- fViewer.setLabelProvider(new TestLabelProvider());
- TestElement first= fRootElement.getFirstChild();
- String newLabel= providedString(first);
- assertEquals("rendered label", newLabel, getItemText(0));
- }
- public void testLabelProviderStateChange() {
- // BUG: non-polymorphic behaviour
- // if (fViewer instanceof TableViewer || fViewer instanceof TableTreeViewer)
- // return;
- TestLabelProvider provider= new TestLabelProvider();
- fViewer.setLabelProvider(provider);
- provider.setSuffix("added suffix");
- TestElement first= fRootElement.getFirstChild();
- String newLabel= providedString(first);
- assertEquals("rendered label", newLabel, getItemText(0));
- }
- public void testRename() {
- TestElement first= fRootElement.getFirstChild();
- String newLabel= first.getLabel()+" changed";
- first.setLabel(newLabel);
- assertEquals("changed label", first.getID()+" "+newLabel, getItemText(0));
- }
- public void testRenameWithFilter() {
- fViewer.addFilter(new TestLabelFilter());
- TestElement first= fRootElement.getFirstChild();
- first.setLabel("name-1111"); // should disappear
- assertNull("changed sibling is not visible", fViewer.testFindItem(first));
- first.setLabel("name-2222"); // should reappear
- fViewer.refresh();
- assertNotNull("changed sibling is not visible", fViewer.testFindItem(first));
- }
- public void testRenameWithLabelProvider() {
- if (fViewer instanceof TableViewer || fViewer instanceof TableTreeViewer)
- return;
- fViewer.setLabelProvider(new TestLabelProvider());
- TestElement first= fRootElement.getFirstChild();
- first.setLabel("changed name");
- String newLabel= providedString(first);
- assertEquals("rendered label", newLabel, getItemText(0));
- }
- public void testRenameWithSorter() {
- fViewer.setSorter(new TestLabelSorter());
- TestElement first= fRootElement.getFirstChild();
- first.setLabel("name-9999");
- String newElementLabel= first.toString();
- assertEquals("sorted first", newElementLabel, getItemText(0));
- }
- public void testSetInput() {
- TestElement first= fRootElement.getFirstChild();
- TestElement firstfirst= first.getFirstChild();
-
- fViewer.setInput(first);
- assertNotNull("first child is visible", fViewer.testFindItem(firstfirst));
- }
- public void testSetSelection() {
- TestElement first= fRootElement.getFirstChild();
- StructuredSelection selection= new StructuredSelection(first);
- fViewer.setSelection(selection);
- IStructuredSelection result= (IStructuredSelection)fViewer.getSelection();
- assertTrue(result.size() == 1);
- assertTrue(result.getFirstElement() == first);
- }
- public void testSomeChildrenChanged() {
- bulkChange(new TestModelChange(TestModelChange.STRUCTURE_CHANGE, fRootElement));
- }
- public void testSorter() {
- TestElement first= fRootElement.getFirstChild();
- TestElement last= fRootElement.getLastChild();
- int size= fRootElement.getChildCount();
-
- String firstLabel= first.toString();
- String lastLabel= last.toString();
- assertEquals("unsorted", firstLabel, getItemText(0));
- assertEquals("unsorted", lastLabel, getItemText(size-1));
- fViewer.setSorter(new TestLabelSorter());
- assertEquals("reverse sorted", firstLabel, getItemText(size-1));
- assertEquals("reverse sorted", lastLabel, getItemText(0));
-
- fViewer.setSorter(null);
- assertEquals("unsorted", firstLabel, getItemText(0));
- assertEquals("unsorted", lastLabel, getItemText(size-1));
- }
- public void testWorldChanged() {
- bulkChange(new TestModelChange(TestModelChange.STRUCTURE_CHANGE, null));
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TableTreeViewerTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TableTreeViewerTest.java
deleted file mode 100644
index e8c8127..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TableTreeViewerTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.TableTree;
-import org.eclipse.swt.custom.TableTreeItem;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TableColumn;
-
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableTreeViewer;
-
-public class TableTreeViewerTest extends AbstractTreeViewerTest {
-
-public static class TableTreeTestLabelProvider
- extends TestLabelProvider
- implements ITableLabelProvider {
- public boolean fExtended = false;
-
- public String getText(Object element) {
- if (fExtended)
- return providedString((String) element);
-
- return element.toString();
- }
- public String getColumnText(Object element, int index) {
- if (fExtended)
- return providedString((TestElement)element);
- return element.toString();
- }
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-}
-
- public TableTreeViewerTest(String name) {
- super(name);
- }
-protected StructuredViewer createViewer(Composite parent) {
- TableTreeViewer viewer = new TableTreeViewer(parent);
- viewer.setContentProvider(new TestModelContentProvider());
- viewer.setLabelProvider(new TableTreeTestLabelProvider());
- viewer.getTableTree().getTable().setLinesVisible(true);
-
- TableLayout layout = new TableLayout();
- viewer.getTableTree().getTable().setLayout(layout);
- viewer.getTableTree().getTable().setHeaderVisible(true);
- String headers[] = { "column 1 header", "column 2 header" };
-
- ColumnLayoutData layouts[] =
- { new ColumnWeightData(100), new ColumnWeightData(100)};
-
- final TableColumn columns[] = new TableColumn[headers.length];
-
- for (int i = 0; i < headers.length; i++) {
- layout.addColumnData(layouts[i]);
- TableColumn tc = new TableColumn(viewer.getTableTree().getTable(), SWT.NONE, i);
- tc.setResizable(layouts[i].resizable);
- tc.setText(headers[i]);
- columns[i] = tc;
- }
- fTreeViewer = viewer;
- return viewer;
-}
- protected int getItemCount() {
- TestElement first = fRootElement.getFirstChild();
- TableTreeItem ti = (TableTreeItem) fViewer.testFindItem(first);
- TableTree table = ti.getParent();
- return table.getItemCount();
- }
- protected int getItemCount(TestElement element) {
- TableTreeItem ti = (TableTreeItem) fViewer.testFindItem(element);
- return ti.getItemCount();
- }
- protected String getItemText(int at) {
- TableTree table = (TableTree) fViewer.getControl();
- return table.getItems()[at].getText();
- }
- public static void main(String args[]) {
- junit.textui.TestRunner.run(TableTreeViewerTest.class);
- }
- public void testLabelProvider() {
- TableTreeViewer viewer = (TableTreeViewer) fViewer;
- TableTreeTestLabelProvider provider = (TableTreeTestLabelProvider) viewer.getLabelProvider();
- provider.fExtended = true;
- // BUG 1FZ5SDC: JFUIF:WINNT - TableViewerColumn should listen for LabelProvider changes
- fViewer.refresh();
- TestElement first = fRootElement.getFirstChild();
- String newLabel = providedString(first);
- assertEquals("rendered label", newLabel, getItemText(0));
- provider.fExtended = false;
- // BUG 1FZ5SDC: JFUIF:WINNT - TableViewerColumn should listen for LabelProvider changes
- fViewer.refresh();
- }
- public void testLabelProviderStateChange() {
- TableTreeViewer viewer = (TableTreeViewer) fViewer;
- TableTreeTestLabelProvider provider =
- (TableTreeTestLabelProvider) viewer.getLabelProvider();
- provider.fExtended = true;
- provider.setSuffix("added suffix");
- // BUG 1FZ5SDC: JFUIF:WINNT - TableViewerColumn should listen for LabelProvider changes
- fViewer.refresh();
- TestElement first = fRootElement.getFirstChild();
- String newLabel = providedString(first);
- assertEquals("rendered label", newLabel, getItemText(0));
- provider.fExtended = false;
- // BUG 1FZ5SDC: JFUIF:WINNT - TableViewerColumn should listen for LabelProvider changes
- fViewer.refresh();
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TableViewerTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TableViewerTest.java
deleted file mode 100644
index 49ab9f1..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TableViewerTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-
-public class TableViewerTest extends StructuredItemViewerTest {
-public static class TableTestLabelProvider
- extends TestLabelProvider
- implements ITableLabelProvider {
- public boolean fExtended = false;
-
- public String getText(Object element) {
- if (fExtended)
- return providedString((String) element);
- return element.toString();
- }
- public String getColumnText(Object element, int index) {
- if (fExtended)
- return providedString((TestElement) element);
- return element.toString();
- }
- public Image getColumnImage(Object element, int columnIndex) {
- return null;
- }
-}
-public TableViewerTest(String name) {
- super(name);
-}
-/**
- * Creates the viewer used by this test, under the given parent widget.
- */
-protected StructuredViewer createViewer(Composite parent) {
- TableViewer viewer = new TableViewer(parent);
- viewer.setContentProvider(new TestModelContentProvider());
- viewer.setLabelProvider(new TableTestLabelProvider());
- viewer.getTable().setLinesVisible(true);
-
- TableLayout layout = new TableLayout();
- viewer.getTable().setLayout(layout);
- viewer.getTable().setHeaderVisible(true);
- String headers[] = { "column 1 header", "column 2 header" };
-
- ColumnLayoutData layouts[] =
- { new ColumnWeightData(100), new ColumnWeightData(100)};
-
- final TableColumn columns[] = new TableColumn[headers.length];
-
- for (int i = 0; i < headers.length; i++) {
- layout.addColumnData(layouts[i]);
- TableColumn tc = new TableColumn(viewer.getTable(), SWT.NONE, i);
- tc.setResizable(layouts[i].resizable);
- tc.setText(headers[i]);
- columns[i] = tc;
- }
-
- return viewer;
-}
-protected int getItemCount() {
- TestElement first = fRootElement.getFirstChild();
- TableItem ti = (TableItem) fViewer.testFindItem(first);
- Table table = ti.getParent();
- return table.getItemCount();
-}
-protected String getItemText(int at) {
- Table table = (Table) fViewer.getControl();
- return table.getItem(at).getText();
-}
-public static void main(String args[]) {
- junit.textui.TestRunner.run(TableViewerTest.class);
-}
-public void testLabelProvider() {
-
- TableViewer viewer = (TableViewer) fViewer;
- TableTestLabelProvider provider = (TableTestLabelProvider) viewer.getLabelProvider();
-
- provider.fExtended = true;
- // BUG 1FZ5SDC: JFUIF:WINNT - TableViewerColumn should listen for LabelProvider changes
- fViewer.refresh();
- TestElement first = fRootElement.getFirstChild();
- String newLabel = providedString(first);
- assertEquals("rendered label", newLabel, getItemText(0));
- provider.fExtended = false;
- // BUG 1FZ5SDC: JFUIF:WINNT - TableViewerColumn should listen for LabelProvider changes
-}
-public void testLabelProviderStateChange() {
- TableViewer tableviewer = (TableViewer) fViewer;
- TableTestLabelProvider provider = (TableTestLabelProvider) tableviewer.getLabelProvider();
-
- provider.fExtended = true;
- provider.setSuffix("added suffix");
- // BUG 1FZ5SDC: JFUIF:WINNT - TableViewerColumn should listen for LabelProvider changes
- tableviewer.refresh();
- TestElement first = fRootElement.getFirstChild();
- String newLabel = providedString(first);
- assertEquals("rendered label", newLabel, getItemText(0));
- provider.fExtended = false;
- // BUG 1FZ5SDC: JFUIF:WINNT - TableViewerColumn should listen for LabelProvider changes
- fViewer.refresh();
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestElement.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestElement.java
deleted file mode 100644
index c7ae94c..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestElement.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-import java.util.Vector;
-
-public class TestElement implements Cloneable {
- TestModel fModel;
- TestElement fContainer;
- String fSomeName;
- String fId;
- Vector fChildren= new Vector();
- boolean fIsDeleted= false;
-
- public static final String P_SOMENAME= "org.eclipse.jface.viewertest.name";
- public static final String P_COLUMN_1= "org.eclipse.jface.viewertest.column1";
-
-
-public TestElement(TestModel model, TestElement container) {
- fModel = model;
- fContainer = container;
- int p = 0;
- TestElement lastSibling = container.getLastChild();
- if (lastSibling != null) {
- p = lastSibling.childId() + 1;
- }
- fId = container.getID() + "-" + p;
-}
-public TestElement(TestModel model, TestElement container, int level, int position) {
- fModel = model;
- fContainer = container;
- if (container != null)
- fId = container.getID() + "-" + position;
- else
- fId = Integer.toString(position);
- fSomeName = "name-" + position;
-
- if (level < model.getNumLevels()) {
- for (int i = 0; i < model.getNumChildren(); i++) {
- fChildren.add(new TestElement(model, this, level + 1, i));
- }
- }
-}
- public TestElement addChild(int event) {
- TestElement element= new TestElement(fModel, this);
- element.fSomeName= "added";
- addChild(element, new TestModelChange(event, this, element));
- return element;
- }
- public TestElement addChild(TestElement element, TestModelChange change) {
- fChildren.add(element);
- fModel.fireModelChanged(change);
- return element;
- }
- public void addChildren(TestElement[] elements, TestModelChange change) {
- for (int i= 0; i < elements.length; i++)
- fChildren.add(elements[i]);
- fModel.fireModelChanged(change);
- }
- public TestElement[] addChildren(int event) {
- TestElement elements[]= new TestElement[] {
- new TestElement(fModel, this),
- new TestElement(fModel, this)
- };
-
- elements[0].fSomeName= "added1";
- elements[1].fSomeName= "added2";
- addChildren(elements, new TestModelChange(event, this, elements));
- return elements;
- }
- public TestElement basicAddChild() {
- TestElement element= new TestElement(fModel, this);
- element.fSomeName= "added";
- fChildren.add(element);
- return element;
- }
- public void basicDeleteChild(TestElement element) {
- fChildren.remove(element);
- element.fIsDeleted= true;
- }
- private int childId() {
- String id= fId.substring(fId.lastIndexOf("-")+1);
- return Integer.parseInt(id);
- }
- public Object clone() {
- try {
- return super.clone();
- }
- catch (CloneNotSupportedException e) {
- throw new Error(); // should not happen
- }
- }
- static public TestElement createModel(int numLevels, int numChildren) {
- return new TestElement(new TestModel(numLevels, numChildren), null, 0, 0);
- }
- public void deleteChild(TestElement element) {
- deleteChild(element, new TestModelChange(TestModelChange.REMOVE, this, element));
- }
- public void deleteChild(TestElement element, TestModelChange change) {
- basicDeleteChild(element);
- fModel.fireModelChanged(change);
- }
-public void deleteChildren() {
- for (int i = fChildren.size() - 1; i >= 0; i--) {
- TestElement te = (TestElement) fChildren.elementAt(i);
- fChildren.remove(te);
- te.fIsDeleted = true;
- }
- fModel.fireModelChanged(new TestModelChange(TestModelChange.STRUCTURE_CHANGE, this));
-}
-public void deleteSomeChildren() {
- for (int i = fChildren.size() - 1; i >= 0; i -= 2) {
- TestElement te = (TestElement) fChildren.elementAt(i);
- fChildren.remove(te);
- te.fIsDeleted = true;
- }
- fModel.fireModelChanged(new TestModelChange(TestModelChange.STRUCTURE_CHANGE, this));
-}
- public boolean equals(Object arg) {
- if (!(arg instanceof TestElement))
- return false;
- TestElement element= (TestElement)arg;
- return element.fId.equals(fId);
- }
- public TestElement getChildAt(int i) {
- return (TestElement) fChildren.elementAt(i);
- }
- public int getChildCount() {
- return fChildren.size();
- }
- public TestElement getContainer() {
- return fContainer;
- }
- public TestElement getFirstChild() {
- if (fChildren.size() > 0)
- return (TestElement)fChildren.elementAt(0);
- return null;
- }
- public String getID() {
- return fId;
- }
- public String getLabel() {
- return fSomeName;
- }
-public TestElement getLastChild() {
- int size = fChildren.size();
- if (size > 0)
- return (TestElement) fChildren.elementAt(size - 1);
- return null;
-}
-public TestModel getModel() {
- return fModel;
-}
- public int hashCode() {
- return fId.hashCode();
- }
-public boolean isDeleted() {
- return fIsDeleted;
-}
- public void setLabel(String label) {
- fSomeName= label;
- fModel.fireModelChanged(new TestModelChange(TestModelChange.NON_STRUCTURE_CHANGE, this));
- }
- public boolean testDeleted() {
- if (fIsDeleted)
- return true;
- if (fContainer != null)
- return fContainer.testDeleted();
- return false;
- }
-public String toString() {
- return getID() + " " + getLabel();
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestLabelProvider.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestLabelProvider.java
deleted file mode 100644
index e2f7104..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestLabelProvider.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.LabelProvider;
-
-public class TestLabelProvider extends LabelProvider {
-
- static Image fgImage= null;
-
-/**
- *
- */
-public static Image getImage() {
- if (fgImage == null)
- fgImage = ImageDescriptor.createFromFile(TestLabelProvider.class, "images/java.gif").createImage();
- return fgImage;
-}
- public Image getImage(Object element) {
- return getImage();
- }
- public String getText(Object element) {
- String label= element.toString();
- return label+ " <rendered>";
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestModel.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestModel.java
deleted file mode 100644
index c8b9e35..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestModel.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-import java.util.Vector;
-
-public class TestModel {
- Vector fListeners = new Vector();
- int fNumLevels;
- int fNumChildren;
-public TestModel(int numLevels, int numChildren) {
- fNumLevels = numLevels;
- fNumChildren = numChildren;
-}
-public void addListener(ITestModelListener listener) {
- fListeners.addElement(listener);
-}
-/**
- * Fires a model changed event to all listeners.
- */
-public void fireModelChanged(TestModelChange change) {
- for (int i = 0; i < fListeners.size(); ++i) {
- ITestModelListener listener = (ITestModelListener) fListeners.get(i);
- listener.testModelChanged(change);
- }
-}
-public int getNumChildren() {
- return fNumChildren;
-}
-public int getNumLevels() {
- return fNumLevels;
-}
-public void removeListener(ITestModelListener listener) {
- fListeners.removeElement(listener);
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestModelChange.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestModelChange.java
deleted file mode 100644
index 8feaf57..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestModelChange.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-public class TestModelChange {
- private int fKind;
- private TestElement fParent;
- private TestElement[] fChildren;
-
- public static final int KIND_MASK = 0x0F;
-
- public static final int INSERT = 1;
- public static final int REMOVE = 2;
- public static final int STRUCTURE_CHANGE = 3;
- public static final int NON_STRUCTURE_CHANGE = 4;
-
- public static final int REVEAL = 16;
- public static final int SELECT = 32;
-
-public TestModelChange(int kind, TestElement parent) {
- this(kind, parent, new TestElement[0]);
-}
-public TestModelChange(int kind, TestElement parent, TestElement[] children) {
- fKind = kind;
- fParent = parent;
- fChildren = children;
-}
-public TestModelChange(int kind, TestElement parent, TestElement child) {
- this(kind, parent, new TestElement[] { child });
-}
-public TestElement[] getChildren() {
- return fChildren;
-}
-public int getKind() {
- return fKind & KIND_MASK;
-}
-public int getModifiers() {
- return fKind & ~KIND_MASK;
-}
-public TestElement getParent() {
- return fParent;
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestModelContentProvider.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestModelContentProvider.java
deleted file mode 100644
index f199b97..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TestModelContentProvider.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-import org.eclipse.jface.util.Assert;
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-
-public class TestModelContentProvider implements ITestModelListener, IStructuredContentProvider, ITreeContentProvider {
- Viewer fViewer;
-public void dispose() {
-}
-protected void doInsert(TestModelChange change) {
- if (fViewer instanceof ListViewer) {
- if (change.getParent() != null && change.getParent().equals(fViewer.getInput())) {
- ((ListViewer) fViewer).add(change.getChildren());
- }
- }
- else if (fViewer instanceof TableViewer) {
- if (change.getParent() != null && change.getParent().equals(fViewer.getInput())) {
- ((TableViewer) fViewer).add(change.getChildren());
- }
- }
- else if (fViewer instanceof AbstractTreeViewer) {
- ((AbstractTreeViewer) fViewer).add(change.getParent(), change.getChildren());
- }
- else {
- Assert.isTrue(false, "Unknown kind of viewer");
- }
-}
-protected void doNonStructureChange(TestModelChange change) {
- if (fViewer instanceof StructuredViewer) {
- ((StructuredViewer) fViewer).update(change.getParent(), new String[] { IBasicPropertyConstants.P_TEXT });
- }
- else {
- Assert.isTrue(false, "Unknown kind of viewer");
- }
-}
-protected void doRemove(TestModelChange change) {
- if (fViewer instanceof ListViewer) {
- ((ListViewer) fViewer).remove(change.getChildren());
- }
- else if (fViewer instanceof TableViewer) {
- ((TableViewer) fViewer).remove(change.getChildren());
- }
- else if (fViewer instanceof AbstractTreeViewer) {
- ((AbstractTreeViewer) fViewer).remove(change.getChildren());
- }
- else {
- Assert.isTrue(false, "Unknown kind of viewer");
- }
-}
-protected void doStructureChange(TestModelChange change) {
- if (fViewer instanceof StructuredViewer) {
- ((StructuredViewer) fViewer).refresh(change.getParent());
- }
- else {
- Assert.isTrue(false, "Unknown kind of viewer");
- }
-}
-public Object[] getChildren(Object element) {
- TestElement testElement = (TestElement) element;
- int count = testElement.getChildCount();
- TestElement[] children = new TestElement[count];
- for (int i = 0; i < count; ++i)
- children[i] = testElement.getChildAt(i);
- return children;
-}
-public Object[] getElements(Object element) {
- return getChildren(element);
-}
-public Object getParent(Object element) {
- return ((TestElement) element).getContainer();
-}
-public boolean hasChildren(Object element) {
- return ((TestElement) element).getChildCount() > 0;
-}
-public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- fViewer = viewer;
- TestElement oldElement = (TestElement) oldInput;
- if (oldElement != null) {
- oldElement.getModel().removeListener(this);
- }
- TestElement newElement = (TestElement) newInput;
- if (newElement != null) {
- newElement.getModel().addListener(this);
- }
-}
-public boolean isDeleted(Object element) {
- return ((TestElement) element).isDeleted();
-}
-public void testModelChanged(TestModelChange change) {
- switch (change.getKind()) {
- case TestModelChange.INSERT:
- doInsert(change);
- break;
- case TestModelChange.REMOVE:
- doRemove(change);
- break;
- case TestModelChange.STRUCTURE_CHANGE:
- doStructureChange(change);
- break;
- case TestModelChange.NON_STRUCTURE_CHANGE:
- doNonStructureChange(change);
- break;
- default:
- throw new IllegalArgumentException("Unknown kind of change");
- }
-
- StructuredSelection selection = new StructuredSelection(change.getChildren());
- if ((change.getModifiers() & TestModelChange.SELECT) != 0) {
- ((StructuredViewer) fViewer).setSelection(selection);
- }
- if ((change.getModifiers() & TestModelChange.REVEAL) != 0) {
- Object element = selection.getFirstElement();
- if (element != null) {
- ((StructuredViewer) fViewer).reveal(element);
- }
- }
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TreeViewerTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TreeViewerTest.java
deleted file mode 100644
index a0a46c5..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/TreeViewerTest.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers;
-
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.TreeViewer;
-
-public class TreeViewerTest extends AbstractTreeViewerTest {
-
- public TreeViewerTest(String name) {
- super(name);
- }
- protected StructuredViewer createViewer(Composite parent) {
- fTreeViewer= new TreeViewer(parent);
- fTreeViewer.setContentProvider(new TestModelContentProvider());
- return fTreeViewer;
- }
- protected int getItemCount() {
- TestElement first= fRootElement.getFirstChild();
- TreeItem ti= (TreeItem)fViewer.testFindItem(first);
- Tree tree= ti.getParent();
- return tree.getItemCount();
- }
-/**
- * getItemCount method comment.
- */
-protected int getItemCount(TestElement element) {
- return 0;
-}
- protected String getItemText(int at) {
- Tree tree= (Tree) fTreeViewer.getControl();
- return tree.getItems()[at].getText();
- }
- public static void main(String args[]) {
- junit.textui.TestRunner.run(TreeViewerTest.class);
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddChildAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddChildAction.java
deleted file mode 100644
index 556972c..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddChildAction.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.tests.viewers.TestElement;
-import org.eclipse.jface.tests.viewers.TestModelChange;
-
-public class AddChildAction extends TestSelectionAction {
-
- int fEventKind;
-
- public AddChildAction(String label, TestBrowser browser) {
- this(label, browser, TestModelChange.INSERT);
- }
- public AddChildAction(String label, TestBrowser browser, int eventKind) {
- super(label, browser);
- fEventKind= eventKind;
- }
- public void run(TestElement element) {
- element.addChild(fEventKind);
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddElementAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddElementAction.java
deleted file mode 100644
index 89eedfd..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddElementAction.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.tests.viewers.TestElement;
-import org.eclipse.jface.tests.viewers.TestModelChange;
-
-public class AddElementAction extends TestBrowserAction {
-
- public AddElementAction(String label, TestBrowser browser) {
- super(label, browser);
-// window.addFocusChangedListener(this);
- }
- public void run() {
- TestElement element = (TestElement) getBrowser().getViewer().getInput();
- element.addChild(TestModelChange.INSERT);
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddFilterAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddFilterAction.java
deleted file mode 100644
index d399b33..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddFilterAction.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-
-public class AddFilterAction extends TestBrowserAction {
-
- public AddFilterAction(String label, TestBrowser browser) {
- super(label, browser);
- }
- public void run() {
- Viewer viewer = getBrowser().getViewer();
- if (viewer instanceof StructuredViewer)
- ((StructuredViewer) viewer).addFilter(new Filter());
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddSiblingAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddSiblingAction.java
deleted file mode 100644
index 8128795..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/AddSiblingAction.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.tests.viewers.TestElement;
-import org.eclipse.jface.tests.viewers.TestModelChange;
-
-public class AddSiblingAction extends TestSelectionAction {
-
- int fEventKind;
-
- public AddSiblingAction(String label, TestBrowser browser) {
- this(label, browser, TestModelChange.INSERT);
- }
- public AddSiblingAction(String label, TestBrowser browser, int eventKind) {
- super(label, browser);
- fEventKind= eventKind;
- }
- public void run(TestElement element) {
- element.getContainer().addChild(fEventKind);
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ChangeChildLabelAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ChangeChildLabelAction.java
deleted file mode 100644
index 11212eb..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ChangeChildLabelAction.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.tests.viewers.TestElement;
-
-public class ChangeChildLabelAction extends TestSelectionAction {
- public ChangeChildLabelAction(String label, TestBrowser browser) {
- super(label, browser);
- }
- public void run(TestElement element) {
- TestElement child= element.getFirstChild();
- if (child != null)
- child.setLabel(child.getLabel() + " renamed child");
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ChangeInputLabelAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ChangeInputLabelAction.java
deleted file mode 100644
index f967426..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ChangeInputLabelAction.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.tests.viewers.TestElement;
-
-public class ChangeInputLabelAction extends TestBrowserAction {
-
- public ChangeInputLabelAction(String label, TestBrowser browser) {
- super(label, browser);
- }
-public void run() {
- TestElement element = (TestElement) getBrowser().getInput();
- element.setLabel(element.getLabel() + " changed");
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ChangeLabelAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ChangeLabelAction.java
deleted file mode 100644
index d179ad9..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ChangeLabelAction.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.tests.viewers.TestElement;
-
-public class ChangeLabelAction extends TestSelectionAction {
-
- public ChangeLabelAction(String label, TestBrowser browser) {
- super(label, browser);
- }
- public void run(TestElement element) {
- element.setLabel(element.getLabel() + " changed");
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ClearSelectionAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ClearSelectionAction.java
deleted file mode 100644
index 2923393..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ClearSelectionAction.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.viewers.StructuredSelection;
-
-public class ClearSelectionAction extends TestBrowserAction {
-
- public ClearSelectionAction(String label, TestBrowser browser) {
- super(label, browser);
- }
- public void run() {
- getBrowser().getViewer().setSelection(new StructuredSelection());
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/CreateModelAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/CreateModelAction.java
deleted file mode 100644
index d97b757..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/CreateModelAction.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.tests.viewers.TestElement;
-
-public class CreateModelAction extends TestBrowserAction {
- int fLevel;
- int fChildCount;
- public CreateModelAction(String label, TestBrowser browser, int level, int childCount) {
- super(label, browser);
- fLevel= level;
- fChildCount= childCount;
- }
- public void run() {
- // Clear input since TestElement.equals does only
- // check the id, not the size of the TestElement.
- getBrowser().setInput(null);
- getBrowser().setInput(TestElement.createModel(fLevel, fChildCount));
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/DeleteAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/DeleteAction.java
deleted file mode 100644
index 4b6acdf..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/DeleteAction.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.tests.viewers.TestElement;
-
-public class DeleteAction extends TestSelectionAction {
-
- public DeleteAction(String label, TestBrowser browser) {
- super(label, browser);
- }
- public void run(TestElement element) {
- element.getContainer().deleteChild(element);
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/DeleteChildrenAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/DeleteChildrenAction.java
deleted file mode 100644
index d3de898..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/DeleteChildrenAction.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.tests.viewers.TestElement;
-
-public class DeleteChildrenAction extends TestSelectionAction {
-
- boolean fAll= false;
-
- public DeleteChildrenAction(String label, TestBrowser browser, boolean all) {
- super(label, browser);
- fAll= all;
- }
- public void run(TestElement element) {
- if (fAll)
- element.deleteChildren();
- else
- element.deleteSomeChildren();
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/DeleteSiblingsAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/DeleteSiblingsAction.java
deleted file mode 100644
index 7d6e879..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/DeleteSiblingsAction.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.tests.viewers.TestElement;
-
-public class DeleteSiblingsAction extends TestSelectionAction {
-
- boolean fAll= false;
-
- public DeleteSiblingsAction(String label, TestBrowser browser, boolean all) {
- super(label, browser);
- fAll= all;
- }
- public void run(TestElement element) {
- if (fAll)
- element.getContainer().deleteChildren();
- else
- element.getContainer().deleteSomeChildren();
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ExpandAllAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ExpandAllAction.java
deleted file mode 100644
index 00dd1b6..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ExpandAllAction.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-
-public class ExpandAllAction extends TestBrowserAction {
-
- public ExpandAllAction(String label, TestBrowser browser) {
- super(label, browser);
- }
- public void run() {
- Viewer viewer = getBrowser().getViewer();
- if (viewer instanceof AbstractTreeViewer)
- ((AbstractTreeViewer) viewer).expandAll();
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/Filter.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/Filter.java
deleted file mode 100644
index b5b6e3b..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/Filter.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import java.util.ArrayList;
-
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-
-public class Filter extends ViewerFilter {
-
- public Object[] filter(Viewer viewer, Object parent, Object[] elements) {
- ArrayList result = new ArrayList();
- for (int i = 0; i < elements.length; ++i) {
- // toss every second item
- if (i % 2 == 1) {
- result.add(elements[i]);
- }
- }
- return result.toArray();
- }
- public boolean isFilterProperty(Object element, Object aspect) {
- return false;
- }
-/* (non-Javadoc)
- * Method declared on ViewerFilter
- */
-public boolean select(Viewer viewer, Object parentElement, Object element) {
- // not used
- return false;
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/FlushInputAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/FlushInputAction.java
deleted file mode 100644
index 72eb0a6..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/FlushInputAction.java
+++ /dev/null
@@ -1,22 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-
-public class FlushInputAction extends TestBrowserAction {
-
- public FlushInputAction(String label, TestBrowser browser) {
- super(label, browser);
- }
- public void run() {
- getBrowser().setInput(null);
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ResetFilterAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ResetFilterAction.java
deleted file mode 100644
index 3e1580d..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ResetFilterAction.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-
-public class ResetFilterAction extends TestBrowserAction {
-
- public ResetFilterAction(String label, TestBrowser browser) {
- super(label, browser);
- }
- public void run() {
- Viewer viewer = getBrowser().getViewer();
- if (viewer instanceof StructuredViewer) {
- StructuredViewer v = (StructuredViewer) viewer;
- v.resetFilters();
- }
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ResetSorterAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ResetSorterAction.java
deleted file mode 100644
index fe873c9..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/ResetSorterAction.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-
-public class ResetSorterAction extends TestBrowserAction {
-
- public ResetSorterAction(String label, TestBrowser browser) {
- super(label, browser);
- }
- public void run() {
- Viewer viewer = getBrowser().getViewer();
- if (viewer instanceof StructuredViewer) {
- StructuredViewer v = (StructuredViewer) viewer;
- v.setSorter(null);
- }
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/SetLabelProviderAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/SetLabelProviderAction.java
deleted file mode 100644
index dffe048..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/SetLabelProviderAction.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.tests.viewers.TestLabelProvider;
-import org.eclipse.jface.viewers.ContentViewer;
-
-public class SetLabelProviderAction extends TestBrowserAction {
-
- public SetLabelProviderAction(String label, TestBrowser browser) {
- super(label, browser);
- }
- public void run() {
- ((ContentViewer) getBrowser().getViewer()).setLabelProvider(new TestLabelProvider());
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/SetSorterAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/SetSorterAction.java
deleted file mode 100644
index 727e1c1..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/SetSorterAction.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-
-public class SetSorterAction extends TestBrowserAction {
-
- public SetSorterAction(String label, TestBrowser browser) {
- super(label, browser);
- }
- public void run() {
- Viewer viewer = getBrowser().getViewer();
- if (viewer instanceof StructuredViewer) {
- StructuredViewer v = (StructuredViewer) viewer;
- v.setSorter(new Sorter());
- }
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/Sorter.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/Sorter.java
deleted file mode 100644
index 1bc04b6..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/Sorter.java
+++ /dev/null
@@ -1,21 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.viewers.IBasicPropertyConstants;
-import org.eclipse.jface.viewers.ViewerSorter;
-
-public class Sorter extends ViewerSorter {
-
- public boolean isSorterProperty(Object element, String property) {
- return IBasicPropertyConstants.P_TEXT.equals(property);
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestBrowser.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestBrowser.java
deleted file mode 100644
index 3953c5b..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestBrowser.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.CLabel;
-import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.custom.ViewForm;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.tests.viewers.TestElement;
-import org.eclipse.jface.tests.viewers.TestModelChange;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.window.ApplicationWindow;
-
-public abstract class TestBrowser extends ApplicationWindow {
- TestElement fInput;
- Viewer fViewer;
-
- Action fChangeLabelAction;
- Action fChangeInputLabelAction;
- Action fChangeChildLabelAction;
- Action fReloadAction;
- Action fReloadActionLarge;
- Action fReloadActionFlat;
-
- Action fDeleteAction;
- Action fDeleteChildrenAction;
- Action fDeleteSomeChildrenAction;
- Action fDeleteSiblingsAction;
- Action fFlushInputAction;
-
- Action fAddElementAction;
-
- Action fAddSiblingAction;
- Action fAddSiblingRevealAction;
- Action fAddSiblingSelectAction;
-
- Action fAddChildAction;
- Action fAddChildRevealAction;
- Action fAddChildSelectAction;
-
- Action fWorldChangedAction;
-
- Action fSetLabelProvider;
-
- Action fAddFilterAction;
- Action fResetFilters;
-
- Action fSetSorter;
- Action fResetSorter;
-
- Action fClearSelection;
-
- int fPanes= 1;
-
- public TestBrowser() {
- super(null);
- addMenuBar();
- }
-/* (non-Javadoc)
- * Method declared on Window.
- */
-protected void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText("Test Browser");
-}
-protected void createActions() {
- fChangeLabelAction = new ChangeLabelAction("Change Label", this);
- fChangeChildLabelAction =
- new ChangeChildLabelAction("Change Child Label", this);
-// fChangeInputLabelAction =
-// new ChangeInputLabelAction("Change Input Label", this);
-
- fReloadAction = new CreateModelAction("Reload Test Data (small)", this, 3, 10);
- fReloadActionLarge =
- new CreateModelAction("Reload Test Data (large)", this, 3, 33);
- fReloadActionFlat =
- new CreateModelAction("Reload Test Data (flat)", this, 1, 2000);
-
- fDeleteAction = new DeleteAction("Delete", this);
- fDeleteChildrenAction = new DeleteChildrenAction("Delete Children", this, true);
- fDeleteSomeChildrenAction =
- new DeleteChildrenAction("Delete Odd Children", this, false);
- fDeleteSiblingsAction = new DeleteSiblingsAction("Delete Siblings", this, true);
-
- fFlushInputAction = new FlushInputAction("Flush Input", this);
-
- fAddElementAction = new AddElementAction("Add Element to Input", this);
- fAddSiblingAction = new AddSiblingAction("Add Sibling", this);
- fAddSiblingRevealAction =
- new AddSiblingAction(
- "Add Sibling and Reveal",
- this,
- TestModelChange.INSERT | TestModelChange.REVEAL);
- fAddSiblingSelectAction =
- new AddSiblingAction(
- "Add Sibling and Select",
- this,
- TestModelChange.INSERT | TestModelChange.REVEAL | TestModelChange.SELECT);
- fAddChildAction = new AddChildAction("Add Child", this);
- fAddChildRevealAction =
- new AddChildAction(
- "Add Child and Reveal",
- this,
- TestModelChange.INSERT | TestModelChange.REVEAL);
- fAddChildSelectAction =
- new AddChildAction(
- "Add Child and Select",
- this,
- TestModelChange.INSERT | TestModelChange.REVEAL | TestModelChange.SELECT);
-
- fWorldChangedAction = new WorldChangedAction("World Changed", this);
-
- fSetLabelProvider =
- new SetLabelProviderAction("Set Custom Label Provider", this);
-
- fAddFilterAction = new AddFilterAction("Add Filter", this);
- fResetFilters = new ResetFilterAction("Reset All Filters", this);
-
- fSetSorter = new SetSorterAction("Set Sorter", this);
- fResetSorter = new ResetSorterAction("Reset Sorter", this);
-
- fClearSelection = new ClearSelectionAction("Clear Selection", this);
-}
-protected Control createContents() {
- Shell shell = getShell();
- ViewForm form = new ViewForm(shell, SWT.NONE);
- CLabel label = new CLabel(form, SWT.NONE);
- form.setTopLeft(label);
- Object input = getInput();
- label.setText(input.toString());
- if (fPanes == 1) {
- Viewer viewer = createViewer(form);
- form.setContent(viewer.getControl());
- fViewer = viewer;
- viewer.setInput(input);
- } else if (fPanes == 2) {
- SashForm sashForm = new SashForm(form, SWT.VERTICAL);
- form.setContent(sashForm);
- Viewer viewer = createViewer(sashForm);
- fViewer = viewer;
- viewer.setInput(input);
- viewer = createViewer(sashForm);
- viewer.setInput(input);
- }
- createActions();
- fillMenuBar(getMenuBarManager());
- viewerFillMenuBar(getMenuBarManager());
- getMenuBarManager().updateAll(false);
- return form;
-}
-protected Control createContents(Composite parent) {
- ViewForm form = new ViewForm(parent, SWT.NONE);
- CLabel label = new CLabel(form, SWT.NONE);
- form.setTopLeft(label);
- Object input = getInput();
- label.setText(input.toString());
- if (fPanes == 1) {
- Viewer viewer = createViewer(form);
- form.setContent(viewer.getControl());
- fViewer = viewer;
- viewer.setInput(input);
- } else if (fPanes == 2) {
- SashForm sashForm = new SashForm(form, SWT.VERTICAL);
- form.setContent(sashForm);
- Viewer viewer = createViewer(sashForm);
- fViewer = viewer;
- viewer.setInput(input);
- viewer = createViewer(sashForm);
- viewer.setInput(input);
- }
- createActions();
- fillMenuBar(getMenuBarManager());
- viewerFillMenuBar(getMenuBarManager());
- getMenuBarManager().updateAll(false);
- return form;
-}
- public abstract Viewer createViewer(Composite parent);
-protected void fillMenuBar(MenuManager mgr) {
-
- MenuManager setupMenu = new MenuManager("Setup","Setup");
- mgr.add(setupMenu);
- setupMenu.add(fReloadAction);
- setupMenu.add(fReloadActionLarge);
- setupMenu.add(fReloadActionFlat);
- setupMenu.add(new Separator());
- setupMenu.add(fFlushInputAction);
- setupMenu.add(new Separator());
- setupMenu.add(fSetLabelProvider);
- setupMenu.add(new Separator());
- setupMenu.add(fAddFilterAction);
- setupMenu.add(fResetFilters);
- setupMenu.add(new Separator());
- setupMenu.add(fSetSorter);
- setupMenu.add(fResetSorter);
-
- MenuManager testMenu = new MenuManager("Tests","Tests");
- mgr.add(testMenu);
- testMenu.add(fChangeLabelAction);
- testMenu.add(fChangeChildLabelAction);
-// testMenu.add(fChangeInputLabelAction);
- testMenu.add(new Separator());
-
- testMenu.add(fDeleteAction);
- testMenu.add(fDeleteChildrenAction);
- testMenu.add(fDeleteSomeChildrenAction);
- testMenu.add(fDeleteSiblingsAction);
- testMenu.add(new Separator());
-
- testMenu.add(fAddElementAction);
- testMenu.add(new Separator());
-
- testMenu.add(fAddSiblingAction);
- testMenu.add(fAddSiblingRevealAction);
- testMenu.add(fAddSiblingSelectAction);
- testMenu.add(new Separator());
-
- testMenu.add(fAddChildAction);
- testMenu.add(fAddChildRevealAction);
- testMenu.add(fAddChildSelectAction);
- testMenu.add(new Separator());
-
- testMenu.add(fClearSelection);
- testMenu.add(new Separator());
-
- testMenu.add(fWorldChangedAction);
-// ((TestTree)this).testTreeFillMenuBar(testMenu);
-}
-public TestElement getInput() {
- return fInput;
-}
- public Viewer getViewer() {
- return fViewer;
- }
- public Composite getViewerContainer() {
- return null;
- }
-public void open(TestElement input) {
- setInput(input);
- super.open();
-}
-public void setInput(TestElement input) {
- fInput = input;
- if (getViewer() != null)
- getViewer().setInput(input);
-}
- public void show2Panes() {
- fPanes= 2;
- }
-protected abstract void viewerFillMenuBar(MenuManager mgr);
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestBrowserAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestBrowserAction.java
deleted file mode 100644
index 96c4d7b..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestBrowserAction.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.action.Action;
-
-public abstract class TestBrowserAction extends Action {
- private TestBrowser browser;
- public TestBrowserAction(String label, TestBrowser browser) {
- super(label);
- this.browser = browser;
- }
- /**
- * Returns the test browser.
- */
- public TestBrowser getBrowser() {
- return browser;
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestCheckboxTree.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestCheckboxTree.java
deleted file mode 100644
index 53b58ce..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestCheckboxTree.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.tests.viewers.TestElement;
-import org.eclipse.jface.tests.viewers.TestLabelProvider;
-import org.eclipse.jface.tests.viewers.TestModelContentProvider;
-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;
-import org.eclipse.jface.viewers.Viewer;
-
-public class TestCheckboxTree extends TestTree {
- CheckboxTreeViewer fCheckboxViewer;
-
- public TestCheckboxTree() {
- super();
- }
-public void checkChildren(TestElement element, boolean state) {
- int numChildren = element.getChildCount();
- for (int i = 0; i < numChildren; i++) {
- TestElement child = element.getChildAt(i);
- if (fCheckboxViewer.setChecked(child, state))
- checkChildren(child, state);
- }
-}
-public Viewer createViewer(Composite parent) {
- CheckboxTreeViewer viewer = new CheckboxTreeViewer(parent);
- viewer.setContentProvider(new TestModelContentProvider());
- viewer.setLabelProvider(new TestLabelProvider());
-
- viewer.addTreeListener(new ITreeViewerListener() {
- public void treeExpanded(TreeExpansionEvent e) {
- handleTreeExpanded((TestElement) e.getElement());
- }
- public void treeCollapsed(TreeExpansionEvent e) {
- }
- });
-
- viewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent e) {
- checkChildren((TestElement) e.getElement(), e.getChecked());
- }
- });
-
- fCheckboxViewer = viewer;
- fViewer = viewer;
- return viewer;
-}
- public void handleTreeExpanded(TestElement element) {
- // apply the same check recursively to all children
- boolean checked = fCheckboxViewer.getChecked(element);
- int numChildren = element.getChildCount();
- for (int i= 0; i < numChildren; i++) {
- TestElement child= element.getChildAt(i);
- fCheckboxViewer.setChecked(child, checked);
- }
- }
-public static void main(String[] args) {
- TestBrowser browser = new TestCheckboxTree();
- if (args.length > 0 && args[0].equals("-twopanes"))
- browser.show2Panes();
- browser.setBlockOnOpen(true);
- browser.open(TestElement.createModel(3, 10));
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestList.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestList.java
deleted file mode 100644
index 17ad2a0..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestList.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.tests.viewers.TestElement;
-import org.eclipse.jface.tests.viewers.TestModelContentProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.Viewer;
-
-public class TestList extends TestBrowser {
- public Viewer createViewer(Composite parent) {
- ListViewer viewer= new ListViewer(parent);
- viewer.setUseHashlookup(true);
- viewer.setContentProvider(new TestModelContentProvider());
- return viewer;
- }
- public static void main(String[] args) {
- TestList browser = new TestList();
- browser.setBlockOnOpen(true);
- browser.open(TestElement.createModel(3, 10));
- }
-/**
- *
- */
-protected void viewerFillMenuBar(MenuManager mgr) {
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestSelectionAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestSelectionAction.java
deleted file mode 100644
index 8713045..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestSelectionAction.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.tests.viewers.TestElement;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-
-public abstract class TestSelectionAction extends TestBrowserAction implements ISelectionChangedListener {
- public TestSelectionAction(String label, TestBrowser browser) {
- super(label, browser);
- browser.getViewer().addSelectionChangedListener(this);
- setEnabled(false);
- }
- public TestElement getTestElement(ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- return (TestElement) ((IStructuredSelection) selection).getFirstElement();
- }
- return null;
- }
-/**
- * Overridden from Action.
- */
-public void run() {
- TestElement testElement = getTestElement(getBrowser().getViewer().getSelection());
- if (testElement != null) {
- run(testElement);
- }
-}
- /**
- * The default implementation calls run(TestElement)
- * on every element contained in the vector.
- */
- public void run(TestElement o) {
- }
- public void selectionChanged(SelectionChangedEvent event) {
- setEnabled(!event.getSelection().isEmpty());
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTable.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTable.java
deleted file mode 100644
index 4374c59..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTable.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TableColumn;
-
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.tests.viewers.TestElement;
-import org.eclipse.jface.tests.viewers.TestLabelProvider;
-import org.eclipse.jface.tests.viewers.TestModelContentProvider;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.Viewer;
-
-public class TestTable extends TestBrowser {
-
-public Viewer createViewer(Composite parent) {
- TableViewer viewer = new TableViewer(parent);
- viewer.setContentProvider(new TestModelContentProvider());
- viewer.setLabelProvider(new TestLabelProvider());
- viewer.getTable().setLinesVisible(true);
-
- TableLayout layout = new TableLayout();
- viewer.getTable().setLayout(layout);
- viewer.getTable().setHeaderVisible(true);
- String headers[] = { "Label Column", "Second Column" };
-
- ColumnLayoutData layouts[] =
- { new ColumnWeightData(100, false), new ColumnWeightData(100, false)};
-
- final TableColumn columns[] = new TableColumn[headers.length];
-
- for (int i = 0; i < headers.length; i++) {
- layout.addColumnData(layouts[i]);
- TableColumn tc = new TableColumn(viewer.getTable(), SWT.NONE, i);
- tc.setResizable(layouts[i].resizable);
- tc.setText(headers[i]);
- columns[i] = tc;
- }
-
- viewer.setUseHashlookup(true);
-
- return viewer;
-}
- public static void main(String[] args) {
- TestTable browser = new TestTable();
- browser.setBlockOnOpen(true);
- browser.open(TestElement.createModel(3, 10));
- }
-/**
- *
- */
-protected void viewerFillMenuBar(MenuManager mgr) {
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTableTree.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTableTree.java
deleted file mode 100644
index 5c20400..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTableTree.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.TableColumn;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.tests.viewers.TestElement;
-import org.eclipse.jface.tests.viewers.TestModelContentProvider;
-import org.eclipse.jface.viewers.ColumnLayoutData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.TableLayout;
-import org.eclipse.jface.viewers.TableTreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-
-public class TestTableTree extends TestBrowser {
-
- TableTreeViewer fViewer;
- Action fExpandAllAction;
-
- public TestTableTree() {
- super();
- fExpandAllAction= new ExpandAllAction("Expand All", this);
- }
-public Viewer createViewer(Composite parent) {
- TableTreeViewer viewer = new TableTreeViewer(parent);
- viewer.setContentProvider(new TestModelContentProvider());
- viewer.setLabelProvider(new TestTableTreeLabelProvider());
- viewer.getTableTree().getTable().setLinesVisible(true);
-
- TableLayout layout = new TableLayout();
- viewer.getTableTree().getTable().setLayout(layout);
- viewer.getTableTree().getTable().setHeaderVisible(true);
- String headers[] = { "First Column", "Second Column" };
-
- ColumnLayoutData layouts[] =
- { new ColumnWeightData(100), new ColumnWeightData(100)};
-
- final TableColumn columns[] = new TableColumn[headers.length];
-
- for (int i = 0; i < headers.length; i++) {
- layout.addColumnData(layouts[i]);
- TableColumn tc = new TableColumn(viewer.getTableTree().getTable(), SWT.NONE, i);
- tc.setResizable(layouts[i].resizable);
- tc.setText(headers[i]);
- columns[i] = tc;
- }
- if (fViewer == null)
- fViewer = viewer;
-
- return viewer;
-}
-public static void main(String[] args) {
- TestBrowser browser = new TestTableTree();
- if (args.length > 0 && args[0].equals("-twopanes"))
- browser.show2Panes();
- browser.setBlockOnOpen(true);
- browser.open(TestElement.createModel(3, 10));
-}
-/**
- * Adds the expand all action to the tests menu.
- */
-protected void viewerFillMenuBar(MenuManager mgr) {
- MenuManager testMenu = (MenuManager) (mgr.findMenuUsingPath("tests"));
- testMenu.add(new Separator());
- testMenu.add(fExpandAllAction);
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTableTreeLabelProvider.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTableTreeLabelProvider.java
deleted file mode 100644
index 73a0f68..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTableTreeLabelProvider.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.tests.viewers.TestLabelProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-
-public class TestTableTreeLabelProvider extends TestLabelProvider implements ITableLabelProvider{
-/**
- * Returns the label image for a given column.
- *
- * @param element the object representing the entire row. Can be
- * <code>null</code> indicating that no input object is set in the viewer.
- * @param columnIndex the index of the column in which the label appears. Numbering is zero based.
- */
-public Image getColumnImage(Object element, int columnIndex) {
- return getImage();
-}
-/**
- * Returns the label text for a given column.
- *
- * @param element the object representing the entire row. Can be
- * <code>null</code> indicating that no input object is set in the viewer.
- * @param columnIndex the index of the column in which the label appears. Numbering is zero based.
- */
-public String getColumnText(Object element, int columnIndex) {
- if (element != null)
- return element.toString() + " column " + columnIndex;
- return null;
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTree.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTree.java
deleted file mode 100644
index 912e1bc..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/TestTree.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.tests.viewers.TestElement;
-import org.eclipse.jface.tests.viewers.TestModelContentProvider;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-
-public class TestTree extends TestBrowser {
- TreeViewer fViewer;
- Action fExpandAllAction;
- public TestTree() {
- super();
- fExpandAllAction= new ExpandAllAction("Expand All", this);
- }
-/**
- *
- */
-public Viewer createViewer(Composite parent) {
- TreeViewer viewer = new TreeViewer(parent);
- viewer.setContentProvider(new TestModelContentProvider());
- viewer.setUseHashlookup(true);
-
- if (fViewer == null)
- fViewer = viewer;
- return viewer;
-}
- public static void main(String[] args) {
- TestBrowser browser= new TestTree();
- if (args.length > 0 && args[0].equals("-twopanes"))
- browser.show2Panes();
- browser.setBlockOnOpen(true);
- browser.open(TestElement.createModel(3, 10));
- }
- public void testTreeFillMenuBar(MenuManager testMenu) {
-
-
-
- }
-/**
- * Adds the expand all action to the tests menu.
- */
-protected void viewerFillMenuBar(MenuManager mgr) {
- MenuManager testMenu = (MenuManager) (mgr.findMenuUsingPath("tests"));
- testMenu.add(new Separator());
- testMenu.add(fExpandAllAction);
-}
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/WorldChangedAction.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/WorldChangedAction.java
deleted file mode 100644
index 640b426..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/viewers/interactive/WorldChangedAction.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.jface.tests.viewers.interactive;
-
-import org.eclipse.jface.viewers.StructuredViewer;
-
-public class WorldChangedAction extends TestBrowserAction {
-
- public WorldChangedAction(String label, TestBrowser browser) {
- super(label, browser);
- }
- public void run() {
- ((StructuredViewer)getBrowser().getViewer()).refresh();
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Component Tests.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Component Tests.html
deleted file mode 100644
index d32fcff..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Component Tests.html
+++ /dev/null
@@ -1,30 +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>Workbench Manual Component Tests</title>
-</head>
-<body>
-
-<h2>
-<b>Manual Component Tests for the Workbench (org.eclipse.ui)</b></h2>
-Last updated June 2, 2002
-
-<p>
-<br><a href="WorkbenchLayout.txt">Workbench Layout</a>
-<br><a href="WorkbenchAction.txt">Workbench Actions</a>
-<br><a href="WelcomeEditor.txt">Welcome Editor</a>
-<br><a href="Import.txt">Import</a>
-<br><a href="Export.txt">Export</a>
-<br><a href="Navigator.txt">Navigator View</a>
-<br><a href="Outline.txt">Outline View</a>
-<br><a href="PropertiesView.txt">Properties View</a>
-<br><a href="Tasks.txt">Tasks View</a>
-<br><a href="Preferences.txt">Preferences</a>
-<br><a href="PropertiesDialog.txt">Properties Dialog</a>
-<br><a href="TextEditor.txt">Text Editor</a>
-
-<br>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Export.txt b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Export.txt
deleted file mode 100644
index 6f33c9c..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Export.txt
+++ /dev/null
@@ -1,105 +0,0 @@
-This is a test script for the export wizard.
-
-Common Properties for All Pages
- Verify that all listboxes show appropriate scrollbars when
- their contents extends beyond their client area.
- The Cancel button is enabled all the time.
- Verify that Cancel discards all changes made to the wizard by
- doing the following:
- - on the Select page, choose any one of items in the list and click Next.
- - make change to the destination or the option settings or both.
- - cancel the wizard.
- - open the wizard again and ensure that the preselection of the Select page( if there was any ), and the values of
- the destination and the options remain the same as before the change.
-
-Select Page( first page )
- The Next button is enabled only if there is selection in the list.
- Verify that the destination from the most recent export, regardless
- of session, is preselected in the listbox.
- Verify icons for items in the list.
-
-Common Properties for the File System Page and the Zip File Page( second page )
-* Please run this test separately for each of the pages.
- [Presentation]
- The folder tree shows open projects only.
- Verify icons for files in the file listbox.
- [Enablement]
- The Back and Browse button are enabled and the Next button
- is disabled all the time.
- Finish is disabled if the destination folder is empty.
- If nothing is selected when Finish is pressed a warning dialog
- appears.
- The 'Select Types', 'Select All', and 'Deselect All' buttons
- are always enabled.
- [Selection Action]
- Verify that 'Select All' and 'Deselect All' work.
- Selecting a folder resource shows all files it has in the
- file listbox.
- Checking a folder resource checks all of its subfolders and
- its files, and always grey-checks its ancestor folders.
- Unchecking a folder unchecks files and subfolders underneath it.
- It unchecks its ancestor folder recursively.
- If it is last resource checked. Otherwise, it grey-checks
- its ancestor recursively.
- Checking a file always grey-checks the folder it is in.
- Unchecking a file unchecks its ancestor folder recursively
- if it is last resource selected.
- Otherwise, it grey-checks its ancestor recursively.
- [Select Types Dialog]
- Verify that the 'Other Extensions' text box shows only those
- user-defined file types that are not in the list.
- e.g.
- - type in *.java and click OK
- - open the dialog again and ensure that the .java check box is checked and the textbox does NOT have .java in it.
- - in the dialog, type in *.eclipse and click OK
- - open the dialog again and ensure that the textbox has .eclipse in it.
- The filter selects files by both checked file types and
- specified types from entire resources.
- Invoking the filter updates appropriate checkboxes of files and
- folders.
- [Destination]
- The destination combo listbox is preselected with the most
- recent destination to which the user exported.
- The destination combo listbox in the wizard stores the five
- most recent destinations to which resources were exported.
- [Options]
- The setting for common options are shared by pages.
- If the Overwrite checkbox is unchecked, exporting a resource
- to the same destination twice pops up the Confirm Overwrite
- dialog.
- If the Overwrite checkbox is checked, exporting a resource
- to the same destination twice does not invoke confirmation.
- [Persistence]
- Verify that the five most recent destinations stored in
- the destination listbox are persistent between sessions.
- Verify that the settings of the options are persistent
- between sessions.
- [Navigator View]
- If the wizard is invoked while there is a resource(s) selected
- in the navigator view, those resource(s) are checked in the folder tree.
-
-File System Page
- [Export]
- Verify that all files are exported successfully to the
- specified destination.
- If the 'Create directory structure' checkbox is unchecked,
- exporting creates a directory structure that roots from
- the root of the folder tree within the destination directory.
- If the 'Create directory structure' checkbox is checked,
- exporting creates the same directory structure as the
- workspace within the destination directory.
- [Browse for Folder Dialog]
- The destination textbox of the dialog is preselected with
- the current destination folder from the dialog.
- Specifying the destination in the dialog and then clicking OK
- updates the destination textbox of the wizard. Otherwise,
- the wizard is not updated.
-
-Zip File Page
- Verify that a .zip file is exported successfully to the
- specified destination.
- Use an external ZIP program to verify the following:
- - the ZIP file is extracted successfully by the ZIP program.
- - the ZIP file made with the 'Create directory structure'
- checkbox turned on has the same directory structure
- as the workspace.
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Import.txt b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Import.txt
deleted file mode 100644
index cdb51ca..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Import.txt
+++ /dev/null
@@ -1,79 +0,0 @@
-This is a test list for the import wizard.
-
-Common Properties for All Pages
- Verify that all listboxes show appropriate scrollbars when
- their contents extends beyond their client area.
- The Cancel button is enabled all the time.
- Verify that Cancel discards all changes made to the wizard by doing
- the following:
- - on the Select page, choose any one of items in the list and
- click Next.
- - make change to the destination or the option settings or both.
- - cancel the wizard.
- - open the wizard again and ensure that the preselection of
- the Select page( if there was any ), and the values of
- the destination and the options remain the same as before
- the change.
-
-Select Page( first page )
- The Next button is enabled only if there is selection in the list.
- Verify that the source from the most recent import, regardless
- of session, is preselected in the listbox.
- Verify icons for items in the list.
-
-Common Properties for Import Pages( second page )
-* Please run this test separately for each of the pages
- [Presentation]
- The source combo listbox stores the five most recent
- sources from which resources were imported.
- Verify icons for files in the file listbox.
- [Enablement]
- The Back button is enabled and the Next button is greyed out all the time.
- Both of the Browse buttons are enabled.
- The 'Select Types', 'Select All', and 'Deselect All' buttons are enabled only if there is at least one item in the folder tree.
- Finish is enabled only if there is one or more resources selected and the destination folder is not empty.
- [Selection Action]
- Verify that 'Select All' and 'Deselect All' work.
- Selecting a folder resource shows all files it has in the file listbox.
- Checking a folder resource checks all of its subfolders and its files, and always grey-checks its ancestor folders.
- Unchecking a folder unchecks files and subfolders underneath it. It unchecks its ancestor folder recursively if
- it is last resource checked. Otherwise, it grey-checks its ancestor recursively.
- Checking a file always grey-checks the folder it is in.
- Unchecking a file unchecks its ancestor folder recursively if it is last file selected. Otherwise, it grey-checks its ancestor recursively.
- [Select Types Dialog]
- Verify that the 'Other Extensions' text box shows only those user-defined file types that are not in the list.
- e.g.
- - type in *.java and click OK
- - open the dialog again and ensure that the .java check box is checked and the textbox does NOT have .java in it.
- - in the dialog, type in *.eclipse and click OK
- - open the dialog again and ensure that the textbox has .eclipse in it.
- Verify that the filter selects files by both checked file types and specified types among the selected resources only.
- Verify that invoking the filter updates appropriate checkboxes of files and folders.
- Verify that invoking the filter by one type and then immediately by a different type leaves all resources unchecked.
- [Destination Folder Selection Dialog]
- Go-into is enabled only if the selected folder has a subfolder.
- If the root of the tree widget is the same as the root of the workspace, Home is enabled and Back is not.
- If the root of the tree widget is NOT the same as the root of the workspace, Home is disabled and Back is enabled.
- Verify that Home, Back, and Go-Into work.
- Selecting a folder shows its complete path in the text box.
- Clicking on OK in the dialog updates the contents of the Folder textbox in the wizard.
- [Options]
- The setting for common options are shared by pages.
- If the Overwrite checkbox is unchecked, importing a resource to the same destination twice pops up the Confirm Overwrite dialog.
- If the Overwrite checkbox is checked, you can import a resource to the same destination twice without confirming it.
- [Navigator View]
- Verify that the navigator view is updated after importing.
- [Persistence]
- Verify that the five most recent sources stored in the source combo listbox are persistent between sessions.
- Verify that the settings of the options are persistent between sessions.
-
-File System Page
- Selecting a source directory shows its folder structure using itself as the root in the left tree.
- Verify that all of the selected resources are imported successfully.
- If the 'Complete folder structure' checkbox is unchecked, importing a resource creates a folder structure relative
- to the root of the tree widget in the destination folder.
- If the 'Complete folder structure' checkbox is checked, importing a resource creates a folder structure using the
- source's absolute path in the destination folder.
-
-Zip File Page
- Selecting a source archive shows its folder structure in the left tree AND checks all of resources in it.
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Navigator.txt b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Navigator.txt
deleted file mode 100644
index e2db473..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Navigator.txt
+++ /dev/null
@@ -1,63 +0,0 @@
-This is a test list for the navigator view.
-
-Edit Actions
- Verify that enablement of Copy, Delete, Add Bookmark is consistent with that of the Navigator view's context menu, and that
- the same behaviour occurs.
-
-Presentation
- Verify that appropriate strings appear in all menu items and text fields.
- Verify icons for file, folder and project.
- Verify that the view shows appropriate scrollbars when its contents extends beyond its client area.
-
-Standard Object Actions
- Verify menu items: Copy, Move, Rename, Delete for all resouces.
- Verify that the DELETE key maps to the Delete action.
- Verify Delete on a read-only resource.
- Verify Properties for projects, folders, files, and combinations of the same.
- Verify that when the view is active, the status bar shows the full path of the selected resource.
-
-Actions on Multiselected Items
- If two or more resources are multiselected, Rename is disabled.
- If a project and its resource(s) are multiselected, Copy and Move are disabled.
- If a folder and its child resource(s) are multiselected, Copy and Move are disabled.
- Verify Delete on multiselected resources.
- Verify Copy and Move on multiselected files in the same project.
-
-File Specific Actions
- Verify menu content when file selected.
- Verify Add Bookmark only appears on files and the bookmark is created when invoked.
-
-Folder Specific Actions
- Verify the copy to the same folder and the different folder.
-
-Project Specific Actions
- Menu includes group with Build, Refresh, Close Project and Open Project
- Close Project appears only on an open project
- Open Project appears only on a closed project
- Both Open Project and Close Project appear when selection includes both an open and a closed project
- For a closed project, Rename is disabled and Go Into, Build, Refresh, Close Project do not appear
-
-New Object Actions
- Invoke File New .. projects, items, other.
- Verify that the view's New menu is the same as File | New in the Window.
-
-View Actions
- Invoke Sort | by Name, | by Type in the pulldown menu. Avoid using only a.java and b.txt for a testing case since the result is the same
- regardless of the sort key.
- Invoke Filters... with Select All, Deselect All options.
-
-Navigation Actions
- The view keeps track of navigation history. Go Into and Go Up add an item. Back and Forward change the cursor in the history list.
- Select a project or folder, invoke Go Into, Go to | Back, Go to | Forward, and Go to | Up.
- Verify enablement of Go xx actions reflect selection and navigation history.
- - Go Into is enabled when an open, non-empty project or a non-empty folder is selected
- - Go Up is enabled when the input has a parent .
- - Go Forward is enabled when there are following items in the list, Go Back enabled when there are previous items.
- Verify that the view's titlebar displays the simple name of its input, and that its tooltip displays the full path of its input.
- Verify that the enablement and the actions of the navigation buttons in the local toolbar are consistent with the Navigate main menu.
- Verify that when a navigation button in the local toolbar is enabled, the fullpath of where the button leads to is appended to the button's tooltip.
- e.g If the path of the view's input is Project/Folder/MyFolder, the 'Up' button has the tooltip that says 'Up to Project/Folder'
-
-Persistence
- Verify that the sort type remains the same after closing and reopening the Navigator view
- Verify that the input is persistent between sessions.
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Outline.txt b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Outline.txt
deleted file mode 100644
index 4834d89..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Outline.txt
+++ /dev/null
@@ -1,14 +0,0 @@
-This is a test list for the outline view. The outine view is a container for pages contributed by open editors.
-We test the contribution and activation of those pages.
-
-Presentation
- Verify that the view shows appropriate scrollbars when its contents extends beyond its client area.
-
-Activation
- If you open a java editor or activate one, its outline contents appears in outline view.
- Switch between two or more java editors to verify the view is updated.
- Switching between java editors updates the outline view's local toolbar and context menu.
- Close one java editor, activating another, and see page in outline change.
- Switching from a java editor to a text editor shows blank in the outline view.
- Close last java editor to see the default blank page in outline.
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Preferences.txt b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Preferences.txt
deleted file mode 100644
index 03df14f..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Preferences.txt
+++ /dev/null
@@ -1,44 +0,0 @@
-This is a test list for the preferences dialog.
-
-Presentation
- Verify that the listbox on the left shows appropriate scrollbars
- when its contents extends beyond its client area.
- Verify that the window grows to fit the content page of the
- selected item.
- Verify that you can traverse all widget groups by pressing TAB.
-
-Actions
- Clicking on a item in the tree shows the corresponding page on
- the right, including the page title.
- Verify that Defaults sets all fields to the default values for
- the current content page ONLY.
- Verify that OK stores all changes made to fields by doing the following:
- - make some changes to checkboxes, option buttons, and textboxes.
- - click OK.
- - open the dialog again and ensure that all the changes were saved.
- Verify that Cancel discards all changes made to fields by doing
- the following:
- - make some changes to checkboxes, option buttons, and textboxes.
- - click Cancel.
- - open the dialog again and ensure that all the field values
- are the same as before the change.
- Verify that ESC maps to Cancel.
- Verify that Apply stores all changes made to values by doing the
- following:
- - make some changes to checkboxes, option buttons, and textboxes.
- - click Apply and then Cancel.
- - open the dialog again and ensure that all the changes were saved.
- Verify that Apply immediately updates the workbench settings by
- doing the following:
- - open a text file with the default text editor.
- - type something in the editor
- - open the preferences dialog, and click on Workbench | Default
- Text Editor
- - click Change... At the Font dialog, select a different font
- and a different font size. Click OK.
- - at the preferences dialog, Click Apply
- - without closing the preferences dialog, ensure that the
- settings for the text editor are updated.
-
-Persistence
- Verify that all field values are persistent all the time.
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/PropertiesDialog.txt b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/PropertiesDialog.txt
deleted file mode 100644
index d0b8aea..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/PropertiesDialog.txt
+++ /dev/null
@@ -1,34 +0,0 @@
-This is a test script for the properties dialog.
-
-Presentation
- Verify that the listbox on the left shows appropriate scrollbars
- when its contents extends beyond its client area.
- Verify that the window grows to fit the content page of the
- selected item.
- Verify that you can traverse all widget groups by pressing TAB.
- Verify that the title bar shows the name of the resource about
- which the dialog shows information.
-
-Actions
- Clicking on a item that contributes in the tree shows the
- corresponding page on the right, including the page title.
- Clicking on a item that does not contribute in the tree shows
- the default page on the right.
- e.g. In the packages view, open the dialog on a package. The
- Team page should show the default page.
- Verify that OK stores all changes made to fields by doing the following:
- - make some changes to checkboxes, option buttons, and textboxes.
- - click OK.
- - open the dialog again and ensure that all the changes were saved.
- Verify that Cancel discards all changes made to fields by doing
- the following:
- - make some changes to checkboxes, option buttons, and textboxes.
- - click Cancel.
- - open the dialog again and ensure that all the field values
- are the same as before the change.
- Verify that ESC maps to Cancel.
- Verify that Apply stores all changes made to values by doing
- the following:
- - make some changes to checkboxes, option buttons, and textboxes.
- - click Apply and then Cancel.
- - open the dialog again and ensure that all the changes were saved.
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/PropertiesView.txt b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/PropertiesView.txt
deleted file mode 100644
index df338f5..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/PropertiesView.txt
+++ /dev/null
@@ -1,41 +0,0 @@
-This is a test list for the properties view. The properties view is a container for pages contributed by open views and editors.
-We test the contribution and activation of pages in the view.
-
-Presentation
- Verify that the view shows appropriate scrollbars when its contents extends beyond its client area.
-
-Activation
- If you open a view with properties, verify that the page, the local toolbar and local menu bar in properties view are updated.
- e.g. Open the navigator view and see the change in the properties view.
- If you open another view, its own properties page should appear.
- Switch between two or more components to see page in view change.
- Close one part, activating another, to see page in view change.
- Close last editor to see default blank page in the view.
- Verify that the view shows the default page when the active view doesn't have source.
- Make sure Edit menu in the workbench targets the active page in the view.
- Verify that the enablement and action of the Categories, Filter, and Defaults buttons are consistent with the view's
-
- pulldown menu.
-
-Navigator View
- Verify that toggling the Show/Hide-Categories button shows/hides items in the corresponding category tree.
- Verify that the properties view shows correct values in the following fields for a selected resource in the navigator view
- editable, last modified, name, and path
- Verify that only files have values in the size field.
-
-Perisistence
- Verify that on start-up of the view, the view displays properties for the active part and selection of the contributing view.
-
-Property Sheet Example
- Before verifying any of the following tests, do:
- 1. Make sure the workbench example is already installed
- 2. Create a .usr file and open it
- 3. Show both the outline view and the properties view
-
- Verify that the 'Show/Hide Category' toggle button and the 'Restore Default' button work.
- Verify that selecting an item in the outline view shows all properties in the properties view.
- Verify that multiselecting items shows only their common properties.
- Verify that change made to a value for an item is persistent in same session.
- Verify that modifying a value for multiselected items changes the values for all of the selected items.
- Verify that changing the Name value for an item updates the page in the outline view.
- Verify that changing the Name values for multiselected items in the outline view updates the page in the outline view.
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Tasks.txt b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Tasks.txt
deleted file mode 100644
index d0af404..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/Tasks.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-This is a test list for the tasks view.
-
-Presentation
- Verify that appropriate strings appear in all menu items and text fields.
- Verify icons for task items and problem items.
- Verify that the title bar shows the correct number of filtered items and total items.
- Verify that the view shows appropriate scrollbars when its contents extends beyond its client area.
-
-Common Actions
- Verify that header buttons in the table sort records by their respective column values in ascending/descending order alternatively.
- Verify that items that belong to files such as compile time errors are displayed only if their projects are open.
- Verify that Go To File is enabled only on file-bound items.
- Verify that double-click or Go To File on a file-bound item opens the file, if not alreadly open, and locates the code in the editor.
-
-Task Actions in Tasks View
- Verify that New Task, Delete, Delete Completed Tasks work.
- Verify that Delete is enabled only on task items.
- Verify that invoking Delete on a task item in an open file deletes the task marker from the editor.
- Verify that the enablement and action of the New Task and Delete buttons are consistent with those in the context menu.
- Verify that the DELETE button on the keyboard maps to Delete.
- Verify that the task status( completion ) and priority can be set for task items only.
-
-Problem Actions in Tasks View
- Verify that selecting a problem item displays its description message in the status bar of the workbench window.
-
-Filter Tasks Dialog
- Change the values then verify that the Reset button sets those values to default.
- Verify that tasks are filtered by the corresponding criterion of the On-any-resouce, On-selected-resouce-only, and
- On-selected-resouce-and-its-children radio buttons.
- Verify that tasks are filtered based on query word iff the description text box is not empty.
- Verify that only those tasks that contain( do not contain ) the query string show in the task view if the description combo-box
- has the value "Contains"( Does not contain ).
- Verify that the Where-problem-severity-is checkbox is enabled iff at least one of Build-path-Problem and Java-Problem in the tree is checked.
- Verify that the Where-task-priority-is and Where-task-status-is check boxes are enabled iff Task in the tree is checked.
- Verify that the enablement of the Where~ checkboxes determines the enablement of their option check boxes.
- Verify that a newly created task by New Task is affected by the current setting of the filter.
-
-Actions in Text Editor
- Verify that for a line that doesn't have a task, you can add one. It should appear in the vertical ruler and in the view
- with adequate values set in the Resouce, In Folder, and Location fields.
- Verify that for a line that has a task. you can remove the task. It disappears from the vertical ruler and from the view.
- Verify that selecting a task item from the view opens the file, if not already open, and locates the code.
-
-Persistence
- Verify that the view retains its items after being closed and reopened.
- Verify that the view maintains the sort order and filtering between sessions.
- Verify that the top index and the selection of the view are consistent between sessions, and after inserting or detaching the view.
-
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/TextEditor.txt b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/TextEditor.txt
deleted file mode 100644
index 9d0075f..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/TextEditor.txt
+++ /dev/null
@@ -1,18 +0,0 @@
-This is a test list for the text editor.
-
-Presentation
- Verify that appropriate strings appear in all menu items and text fields.
- Verify that the view shows appropriate scrollbars when its contents extends beyond its client area.
-
-Editor Actions
- Verify that Cut and Copy are enabled iff there is selected text.
- Verify that Paste is enabled iff there is text in the clipboard buffer.
- Verify that Cut, Copy, Paste, Select-All work correctly.
- Verify that Revert is enabled only if is the file dirty and works correctly.
-
-Edit Menu Actions
- Verify that the enablement and action of Cut, Copy, Paste, and Select-All in the Edit menu are consistent with those in the editor's context menu.
-
-Persistence
- The editor is marked dirty if the text is modified by either the keyboard OR the editor actions.
- The editor is marked clean after either saving the file or reverting it.
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/WelcomeEditor.txt b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/WelcomeEditor.txt
deleted file mode 100644
index d7916ac..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/WelcomeEditor.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-This is a test list for the welcome editor.
-
-Presentation
- Verify that the editor appears when the workbench runs for the first time.
- Verify that the editor shows appropriate scrollbars when its contents extends beyond its client area.
- Verify that if the editor is closed when the workbench closes, the editor remains closed in next session.
- Verify that modifying the editor's entry in the product.ini file updates the workbench by following the steps below.
- 1. Make sure the editor is closed when exiting Eclipse.
- 2. Open product.ini with a text editor and remove the wecome editor's entry from the file, which is:
- welcomePage = welcome.xml
- 3. Restart Eclipse.
- 4. Verify that Welcome doesn't show under Help in the workbench pulldown menu.
- 5. Exit Eclipse
- 6. Add the entry as in step 2 back to product.ini
- 7. Resart Eclipse
- 8. Verify that Welcome shows again under Help.
-
-Actions
- Verify that Help->Welcome invokes the editor.
- Verify that all links invoke their corresponding actions.
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/WorkbenchAction.txt b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/WorkbenchAction.txt
deleted file mode 100644
index 7b756e4..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/WorkbenchAction.txt
+++ /dev/null
@@ -1,48 +0,0 @@
-This is a test script for actions in the workbench.
-
-File Actions ..
- Invoke File New .. projects, items, other.
- Invoke Toolbar button for File New .. projects, items, other.
- Verify close and save action enablement with
- - no editors open
- - one editor
- - one dirty editor
- - after revert
- - two editors
- - two dirty editors
- - after close all
- Verify actions when switching between perspectives ( one with dirty
- editor, other without ).
- Verify after all perspectives closed.
- Open many editors, close all, test MRU list.
- Open an editor and try to print the contents.
-
-Edit Actions ..
- Verify global actions track global part.
- Verify editor contributions appear in action bars when is opened.
- Verify editors of same type reuse contributions.
- Verify editors of different type cause contribution change.
- Verify editor contributions are removed when editor is closed.
- Verify edit actions are consistent when switching between perspectives.
-
-Perspective Actions ..
- Open = always enabled
- Verify other actions only enabled when a perspective is open.
- Verify "open new window", "open perspective"
- Verify "Save As" by modifying current persp, save as, close, reopen.
- Verify "Reset" by modifying current persp, then reset.
- Test Workbench/Perspectives preference page.
- Hide Editors, Show Editors
- Hide Editors, Open new editor, verify implicit show editors.
-
-Action Sets ..
- Confirm order is consistent. Add all actions, record order,
- then remove and re-add. Select action sets to verify order.
- Test Customization of File New, Perspective Open, and Show View.
- Confirm editor actions have consistent place ..
- - start with no editors
- - show x action sets
- - open editor, verify editor actions after sets
- - hide x action sets
- - show x action sets
- Verify action set order persisted between sessions.
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/WorkbenchLayout.txt b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/WorkbenchLayout.txt
deleted file mode 100644
index 56f660e..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Component Tests/WorkbenchLayout.txt
+++ /dev/null
@@ -1,94 +0,0 @@
-This is a test script for layout in the workbench.
-
-Folder Creation ..
- - DnD view over view
- - DnD view over folder
- - DnD view over view in floating window
- - NEG TEST - DnD view over editor area.
- - DnD editor over editor
- - DnD editor over editor folder
- - NEG TEST - DnD editor over view area.
-
-Folder Breakdown ..
- - DnD view out of folder with 2
- - DnD view out of folder with 3. Folder should remain.
- - DnD view out of folder in floating window
- - DnD editor out of editor folder with 2
- - DnD editor out of editor folder with 3. Folder should remain
-
-Relative Drag and Drop ..
- - DnD view to top, right, bottom, left of another view
- - DnD view to top, right, bottom, left of folder
- - DnD view to top, right, bottom, left of editor area.
- - DnD editor within editor area
-
-Detached Windows ..
- - DnD view out of window, open detached window
- - DnD view back into window, close detached window
- - DnD second view over floating window
- - DnD second view out of floating window to create second
- detached window
- - DnD second view out of floating window onto main.
-
-Tab Items
- - reorder items in view folder by dragging tabs
- - reorder itmes in editor folder by dragging tabs
-
-Fast Views
- - DnD view over shortcut bar. It should become fast view
- - Open fast view. Unpin. It should return to last position in
- root layout.
-
-Page Switch
- - Verify layout persistance of main window when switching pages
- - Verify layout persistance of detached windows when switching pages
-
-Zoom
- - zoom / unzoom view in root layout
- - zoom / unzoom view in folder. Verify folder not visible
- - zoom / unzoom editor in single folder. Verify no other
- editors visible
- - zoom / unzoom editor in mult-folder editor area. Verify no
- other editors visible
- - NEG TEST - zoom / unzoom view in detached window. Should have
- no effect
-
-The following actions should maintain zoom
- - Show View ( if it is zoomed View )
- - Show View ( if view is visible in Detached Window )
- - switch to another page and back
- - click on any visible view or editor
- - Show / hide fast view
-
-The following actions should cause unzoom
- - Open editor
- - Close editor
- - Close all editors
- - Show / Hide editor area
- - Show view / editor which is not visible
- - Activate view / editor which is not visible
- - Reset perspective
- - Save perspective
- - Change perspective
- - DnD zoom view out of main window to detached window
- - DnD view in detached window onto zoom view
-
-The following actions cause unzoom now, but it would be convenient
-if they didn't in future
- - Close detached view.
- - All DnD
-
-Persistance Between Sessions
- - ensure layout is persisted between sessions
- - fast views
- - view layout
- - detached windows
- - open editors
-
-Placeholders
- - Drag view to new position, close, reopen.
- - Drag view to folder, close, reopen.
- - Drag view to detached, close, reopen.
- - Close all views in folder, reopen one by one.
- - Make view fast, restore.
- - Make folder fast, restore views one by one.
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Bookmarks View.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Bookmarks View.html
deleted file mode 100644
index 239850f..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Bookmarks View.html
+++ /dev/null
@@ -1,82 +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>Test Scenario: Bookmarks View</title>
-</head>
-<body>
-
-<h3>
-Bookmarks View</h3>
-Purpose: To test the Bookmark view in Eclipse. We will open the view,
-add a number of bookmarks to some files, open the source file for each
-bookmark and then delete those bookmarks.
-<p>Setup:
-<ol>
-<li>
-Install Eclipse Platform.</li>
-
-<li>
-Create a java project containing three java files and a text file.</li>
-</ol>
-Method:
-<ol>
-<li>
-Start the workbench.</li>
-
-<li>
-Invoke Perspective > Show View > Bookmarks and verify that the Bookmarks
-view appears.</li>
-
-<li>
-Select a java file in the navigator and invoke Edit > Add Bookmark.
-Verify that a new bookmark appears in the Bookmarks view for the selected
-java file.</li>
-
-<li>
-Double click the bookmark in the bookmarks view and verify that an editor
-opens on the source file.</li>
-
-<li>
-Select the 10th line of text in the editor and invoke Add Bookmark in the
-context menu. A dialog should appear where you can type the bookmark
-label. Enter "Line 10" and press OK. Verify that another bookmark
-appears in the Bookmarks view with the label "Line 10". A bookmark
-icon should also appear in the editor to the left of line 10.</li>
-
-<li>
-Close the editor.</li>
-
-<li>
-Select "Line 10" in the bookmarks view and press the "Go to File" button
-in the toolbar. Verify that an editor opens on the source file and
-that line 10 is selected.</li>
-
-<li>
-Right click on the bookmark icon in the editor and invoke "Remove Bookmark".
-Verify that the bookmark disappears in the editor and the bookmarks view.</li>
-
-<li>
-In the navigator select all three java files, verify that "Add Bookmark"
-is enabled, and then invoke it. Verify that 3 bookmarks are appear
-in the bookmarks view.</li>
-
-<li>
-Select a project, folder, or any combination of project | folder with file.
-Verify that "Add Bookmark is disabled.</li>
-
-<li>
-Go to the bookmarks view and invoke "Select All" from the context menu.
-Verify that everything is selected.</li>
-
-<li>
-Then press "Return" in the bookmarks view and verify that all of the bookmarks
-are opened in editors.</li>
-
-<li>
-Invoke "Delete" in the bookmarks view and verify that all bookmarks are
-deleted.</li>
-</ol>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/File System Export.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/File System Export.html
deleted file mode 100644
index 3f30117..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/File System Export.html
+++ /dev/null
@@ -1,97 +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="OTI Employee">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
- <title>File System Export</title>
-</head>
-<body>
-
-<center>
-<h1>
-File System Export</h1></center>
-
-<h2>
-Purpose</h2>
-The plan is to export a project with a large number files/folders at a
-time, using the file system wizard. The results should be indentical in
-layout and content as the original project used.
-<h2>
-Setup</h2>
-
-<ul>
-<li>
-Download the JUnit zip file source code from www.junit.org.</li>
-
-<li>
-Start the Eclipse workbench</li>
-
-<li>
-Create a new temporary "simple" project called "JUnit Test"</li>
-
-<li>
-Import the JUnit zip file into the project</li>
-
-<li>
-Select File -> Export, select File System and press Next.</li>
-</ul>
-
-<h2>
-Export from a project to a new directory</h2>
-
-<ol>
-<li>
-Select the "JUnit Test" project and mark it as checked.</li>
-
-<li>
-In the Directory field, type in the directory to export to.</li>
-
-<li>
-Press Finish</li>
-
-<li>
-Verify that the contents on the file system match the same file and folder
-structure as the source project</li>
-
-<li>
-Verify the content of the files.</li>
-</ol>
-
-<h2>
-Export from a project to an existing directory</h2>
-
-<ol>
-<li>
-Select the "JUnit Test" project and mark it as checked.</li>
-
-<li>
-In the Directory field, type in the directory to export to.</li>
-
-<li>
-Check the option "Overwrite existing resources without warning"</li>
-
-<li>
-Press Finish</li>
-
-<li>
-Verify you were not prompted to overwrite files</li>
-
-<li>
-Verify that the contents on the file system match the same file and folder
-structure as the source project.</li>
-
-<li>
-Verify the content of the files.</li>
-</ol>
-
-<h2>
-Cleanup</h2>
-
-<ul>
-<li>
-Delete the temporary project "JUnit Test"</li>
-</ul>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/File System Import.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/File System Import.html
deleted file mode 100644
index f2920a4..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/File System Import.html
+++ /dev/null
@@ -1,105 +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="OTI Employee">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
- <title>File System Import</title>
-</head>
-<body>
-
-<center>
-<h1>
-File System Import</h1></center>
-
-<h2>
-Purpose</h2>
-The plan is to import a large number files/folders at a time, using the
-file system wizard. The results should be indentical in layout and content
-as the original source used.
-<h2>
-Setup</h2>
-
-<ul>
-<li>
-Download the JUnit source code from www.junit.org and extract the contents
-into a folder in the file system.</li>
-
-<li>
-Start the Eclipse workbench</li>
-
-<li>
-Create a new temporary "simple" project called "JUnit Test"</li>
-
-<li>
-Select File -> Import, select File System and press Next.</li>
-</ul>
-
-<h2>
-Import into a new project</h2>
-
-<ol>
-<li>
-Click the Browse button and select the directory where the source files
-are located.</li>
-
-<li>
-Expand the folders in the tree view and until "junit" folder is visible
-and check mark the box next to it</li>
-
-<li>
-Type in "JUnit Test" in the Folder field</li>
-
-<li>
-Press Finish</li>
-
-<li>
-Verify that the contents of the project match the same file and folder
-structure as the source in the file system.</li>
-
-<li>
-Verify that the content of the files.</li>
-</ol>
-
-<h2>
-Import into an existing project</h2>
-
-<ol>
-<li>
-Click on the Directory drop down box and select the directory where the
-source files are located</li>
-
-<li>
-Expand the folders in the tree view and until "junit" folder is visible
-and check mark the box next to it</li>
-
-<li>
-Type in "JUnit Test" in the Folder field</li>
-
-<li>
-Check the option "Overwrite existing resources without warning"</li>
-
-<li>
-Press Finish</li>
-
-<li>
-Verify you were not prompted to overwrite files</li>
-
-<li>
-Verify that the contents of the project match the same file and folder
-structure as the source in the file system.</li>
-
-<li>
-Verify that the content of the files.</li>
-</ol>
-
-<h2>
-Cleanup</h2>
-
-<ul>
-<li>
-Delete the temporary project "JUnit Test"</li>
-</ul>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Navigator View.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Navigator View.html
deleted file mode 100644
index 180eb68..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Navigator View.html
+++ /dev/null
@@ -1,137 +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>Test Scenario: Navigator View</title>
-</head>
-<body>
-<h3>
-Navigator View</h3>
-Purpose: To test the Navigator view in Eclipse. We will start out
-with an empty workspace, create some projects and files, open files, open
-some new perspectives, delete some files, test the filtering and sorting
-options, and test the persistance of view state between sessions.
-<p>Setup:
-<ol>
-<li>
-Install Eclipse Platform.</li>
-
-<li>
-Delete the metadata for org.eclipse.ui.</li>
-</ol>
-Method:
-<ol>
-<li>
-Start the workbench. Confirm that the default perspective (Resource)
-and welcome editor both appear.</li>
-
-<li>
-Create a project using the File > New wizard and verify that it appears
-in the navigator.</li>
-
-<li>
-Create another project by invoking New > Project from the navigator popup
-menu. Verify that it appears in the navigator.</li>
-
-<li>
-Create a .txt file, a .html file, and a .java file by invoking New > File
-from the navigator popup menu. Verify that these files appear in
-the navigator and that an editor is opened on each. Close all of
-these editors.</li>
-
-<li>
-In the Navigator you can change the input. To test this create a
-couple of nested folders in a project using the New > Folder action in
-the navigator context menu. Then select the top level folder and
-and invoke Go Into. Verify that the input for the view changes (it
-is shown in the view title) and that only the resources in the input folder
-are visible. If you perform the same operation many times you create
-a history list in the navigator. Try navigating up and down the history
-by using the Back and Forward buttons on the view toolbar.</li>
-
-<li>
-If you select a file you can open it from the context menu. Open
-a .txt file and verify that the default text editor opens. Open a
-.java file and verify that the java editor opens.</li>
-
-<li>
-You can also open a file in a specific editor. Select a .java file
-and invoke Open With > Default Text Editor. The default text editor
-should open rather than the java editor. If you select Open With
-> System Editor something like notepad should open. The preferred
-editor for a file is always indicated with a check mark in the Open With
-menu.</li>
-
-<li>
-In the navigator you can open new perspectives. Select a project
-or folder in the navigator and invoke Open Perspective > Java from the
-context menu. Verify that a new perspective appears with the Java Perspective
-and that the input for the navigator is the project.
-Close it and go back to the first perspective.</li>
-
-<li>
-The contents of the Open Perspective menu are determined by the perspective
-properties. Note the contents of this menu. Then invoke Perspective
-> Customize and change the checked perspectives. Press OK and verify
-that the contents of Open Perspective reflect the new options.</li>
-
-<li>
-The Navigator has support for drag and drop. Try dragging a file
-from one project to another. A cursor should appear to indicate the
-drop target. If you release the file it will be moved to the target.</li>
-
-<li>
-In the navigator select a project, folder or file and try out Copy, Move
-and Rename in the context menu.</li>
-
-<li>
-Select a project, folder or file and invoke Delete in the context menu
-to delete it. Verify that the item disappears from the navigator.
-The delete action is also available in the window Edit menu. Select
-an item, invoke Edit > Delete, and verify that it has the same behavior.</li>
-
-<li>
-Select a file in the navigator and invoke Add Bookmark from the context
-menu. Open up the Bookmark view and verify that a bookmark now exists.
-If you double click on the bookmark an editor should open on the bookmark
-source file. Verify that Add Bookmark is not available if a project
-or folder is selected in the navigator.</li>
-
-<li>
-Select a project and invoke Close Project from the context menu.
-At this point the icon should change to a closed folder and all of the
-contents will be hidden. Invoke Open Project to reopen it and navigate
-the contents.</li>
-
-<li>
-If you select a resource and invoke Properties.. a properties dialog should
-appear. It will contain at least an Info, Project Referenes and Team
-page for projects, and an Info and Team page for folders or files.</li>
-
-<li>
-In the navigator you can sort items by name or type. Try out these
-options in the pulldown menu and verify that they have the correct affect.
-All sorting is done in ascending order. You can also filter items
-out. Create a couple of .class and .* files and experiment with the
-filter options. You should be able to hide or show these files as
-desired.</li>
-
-<li>
-The selection in the navigator is linked to the active editor. Open
-a couple of files. Then switch between the editors and verify that
-the editor input is selected in the navigator. Now select one of
-the open files in the navigator and verify that the corresponding editor
-is activated. You can disable this option by turning off "Link navigator
-selection to active editor" in the workbench preferences. Then verify
-that no selection occurs in the navigator as you switch between editors.
-Turn it back on and verify that selection works again.</li>
-
-<li>
-The state of the navigator (input, expansion) should be stored between
-sessions. To test this open a perspective with the navigator, change
-the input and expansions state, and then close the workbench. Restart
-the workbench and verify that the input and expansion state is restored.</li>
-</ol>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/New File Wizard.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/New File Wizard.html
deleted file mode 100644
index fe11840..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/New File Wizard.html
+++ /dev/null
@@ -1,94 +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="OTI Employee">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
- <title>New File Wizard</title>
-</head>
-<body>
-
-<center>
-<h1>
-New File Wizard</h1></center>
-
-<h2>
-Purpose</h2>
-The plan is to create a single empty file. The end result of this wizard
-should be an empty file opened in the proper editor for its type.
-<h2>
-Setup</h2>
-
-<ul>
-<li>
-Start the Eclipse workbench</li>
-
-<li>
-Create a temporary project called "File Test"</li>
-
-<li>
-Select File->New->File from the resource perspective</li>
-</ul>
-
-<h2>
-Create file at project root</h2>
-
-<ol>
-<li>
-Select the project File Test</li>
-
-<li>
-In the File Name field, type in f1.txt</li>
-
-<li>
-Press the Finish button</li>
-
-<li>
-Verify a new f1.txt file is created under the File Test project (in navigator
-view and in the file system)</li>
-
-<li>
-Verify the default text editor opened on f1.txt</li>
-
-<li>
-Verify the content of f1.txt is empty</li>
-</ol>
-
-<h2>
-Create file in new folder</h2>
-
-<ol>
-<li>
-In the "Enter or select the folder" field, type in File Test/folder</li>
-
-<li>
-In the File Name field, type in f1.txt</li>
-
-<li>
-Press the Finish button</li>
-
-<li>
-Verify that "folder" was created under the File Test project (in navigator
-view and in the file system)</li>
-
-<li>
-Verify a new f1.txt file is created under "folder" (in navigator view and
-in the file system)</li>
-
-<li>
-Verify the default text editor opened on f1.txt</li>
-
-<li>
-Verify the content of f1.txt is empty</li>
-</ol>
-
-<h2>
-Cleanup</h2>
-
-<ul>
-<li>
-Delete the temporary project "File Test"</li>
-</ul>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/New Folder Wizard.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/New Folder Wizard.html
deleted file mode 100644
index ae32603..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/New Folder Wizard.html
+++ /dev/null
@@ -1,60 +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="OTI Employee">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
- <title>New Folder Wizard</title>
-</head>
-<body>
-
-<center>
-<h1>
-New Folder Wizard</h1></center>
-
-<h2>
-Purpose</h2>
-The plan is to create a single empty folder. The end result of this wizard
-should be an empty folder.
-<h2>
-Setup</h2>
-
-<ul>
-<li>
-Start the Eclipse workbench</li>
-
-<li>
-Create a temporary project called "Folder Test"</li>
-
-<li>
-Select File->New->Folder from the resource perspective</li>
-</ul>
-
-<h2>
-Create folder at project root</h2>
-
-<ol>
-<li>
-Select the project Folder Test</li>
-
-<li>
-In the Folder Name field, type in f1</li>
-
-<li>
-Press the Finish button</li>
-
-<li>
-Verify a new f1 folder is created under the Folder Test project (in navigator
-view and in the file system)</li>
-</ol>
-
-<h2>
-Cleanup</h2>
-
-<ul>
-<li>
-Delete the temporary project "Folder Test"</li>
-</ul>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/New Project Wizard.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/New Project Wizard.html
deleted file mode 100644
index 8346abd..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/New Project Wizard.html
+++ /dev/null
@@ -1,92 +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="OTI Employee">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
- <title>New Project Wizard</title>
-</head>
-<body>
-
-<center>
-<h1>
-New Project Wizard</h1></center>
-
-<h2>
-Purpose</h2>
-The plan is to create a single empty project. The end result of this wizard
-should be an empty project.
-<h2>
-Setup</h2>
-
-<ul>
-<li>
-Start the Eclipse workbench</li>
-
-<li>
-Extract the junit.jar file into a directory on the file system</li>
-
-<li>
-Select File->New->Project from the resource perspective</li>
-
-<li>
-Select Simple and then Project and Press Next</li>
-</ul>
-
-<h2>
-Create project at default location</h2>
-
-<ol>
-<li>
-In Project Name field, type in Project Test</li>
-
-<li>
-Press Next and select another project as a reference project</li>
-
-<li>
-Press the Finish button</li>
-
-<li>
-Verify a new Project Test project is created (in navigator view and in
-the file system)</li>
-
-<li>
-Verify, in the project's properties dialog, that the Project References
-page includes the project referenced.</li>
-</ol>
-
-<h2>
-Create project at specific location</h2>
-
-<ol>
-<li>
-In Project Name field, type in Project Test2</li>
-
-<li>
-Uncheck the Use Default Location option</li>
-
-<li>
-In the Location field, type in the directory containing the junit source
-code.</li>
-
-<li>
-Press the Finish button</li>
-
-<li>
-Verify a new Project Test2 project is created (in navigator view)</li>
-
-<li>
-Verify the contents of the project match the files/folders for junit on
-the file system</li>
-</ol>
-
-<h2>
-Cleanup</h2>
-
-<ul>
-<li>
-Delete projects Project Test and Project Test2</li>
-</ul>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Outline View.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Outline View.html
deleted file mode 100644
index a7aa0b4..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Outline View.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">
- <title>Test Scenario: Outline View</title>
-</head>
-<body>
-
-<h3>
-Outline View</h3>
-Purpose: To test the Outline view in Eclipse. The Outline view is
-just a container for the pages contributed by open editors. Therefore,
-this test will focus on the creation, show, and closure of those pages.
-<p>Setup:
-<ol>
-<li>
-Install Eclipse Platform.</li>
-
-<li>
-Create a java project containing three java files and a text file.</li>
-</ol>
-Method:
-<ol>
-<li>
-Start the workbench.</li>
-
-<li>
-If any editor is open close it.</li>
-
-<li>
-Verify that the Outline view is empty and contains the text "An Outline
-is not available".</li>
-
-<li>
-Open an editor on a java file. Verify that a java page appears in the outline
-view. If you select items in this page the scroll and selected text
-within the editor should change.</li>
-
-<li>
-Open a second file in a java editor. Verify that a second java page
-appears in the outline view.</li>
-
-<li>
-If you switch between the two editors the visible page should change.</li>
-
-<li>
-Open a .txt file in a text editor. When this editor is active the
-outline view will be empty and contain the standard empty text as described
-in step 2.</li>
-
-<li>
-If you switch between a text and java editor the visible page should change.
-Verify that the toolbar and menu items in the outline also chnage.
-The java editor has Field and Member toolbar items.</li>
-
-<li>
-Close one editor. If another editor is activated verify that its
-outline page is now visible. If no editor is activated verify that
-the outline is empty.</li>
-
-<li>
-Close the last editor and verify that the default blank page is visible
-in the outline.</li>
-</ol>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Persistence.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Persistence.html
deleted file mode 100644
index 2d5c2b2..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Persistence.html
+++ /dev/null
@@ -1,55 +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>Test Scenario: Persistence</title>
-</head>
-<body>
-<h3>
-Persistence</h3>
-Purpose: To test persistence in the workbench.
-<p>Setup:
-<ol>
-<li>
-Install Eclipse Platform.</li>
-
-<li>
-Delete the metadata for org.eclipse.ui.</li>
-</ol>
-Method:
-<ol>
-<li>
-Start the workbench. Confirm that the default perspective (Resource)
-and welcome editor both appear.</li>
-
-<li>
-Create a project with 3 files, one.txt, two.txt, and three.txt. Open
-one.txt in the default perspective.</li>
-
-<li>
-In the navigator select the project and invoke Open Perspective > Java
-from the context menu. Verify that a new Java perspective appears
-in the current window. The input for the Packages view and navigator
-should be the project.</li>
-
-<li>
-Open two.txt in the Java perspective.</li>
-
-<li>
-Change the Workbench Preferences for "Open Perspective" to "Open in New
-Window". Then open a Java perspective and verify that a new window
-is created.</li>
-
-<li>
-Now we have two windows. The first window has two perspectives (resource
-and java). In the resource perspective one.txt is open in an editor.
-In the java perspective two.txt is open in an editor. In the second
-window here is one Java perspective with no open editors.</li>
-
-<li>
-Invoke File > Exit. Then restart the workbench and verify that the
-window, perspective and editor state of the workbench is restored.</li>
-</ol>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Preferences.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Preferences.html
deleted file mode 100644
index ebcf11a..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Preferences.html
+++ /dev/null
@@ -1,92 +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>Test Scenario: Preferences</title>
-</head>
-<body>
-
-<h3>
-Preferences</h3>
-Purpose: To test the Preferences in Eclipse. We will open the Preferences
-dialog, select some pages, change and apply preferences, verify their affect,
-and test persistence between sessions.
-<p>Setup:
-<ol>
-<li>
-Install Eclipse Platform.</li>
-</ol>
-Method:
-<ol>
-<li>
-Start the workbench.</li>
-
-<li>
-Invoke Window > Preferences and verify that the Preferences dialog appears.
-Click on all of the items in the left hand viewer to demonstrate that each
-item has a valid page and no exceptions occur in their creation.
-Now close the dialog.</li>
-
-<li>
-The behavior of the workbench can be customized using the preferences.
-To see this in action we will examine various preferences which ship with
-Eclipse.</li>
-
-<li>
-The selection in the navigator is linked to the active editor. Open
-a couple of files. Then switch between the editors and watch how
-the input for the active editor is selected in the navigator. You
-can disable this option in the Preferences. To do this ..</li>
-
-<ol>
-<li>
-Open the preferences dialog.</li>
-
-<li>
-Turning off "Link navigator selection to active editor" in the workbench
-preferences.</li>
-
-<li>
-Press OK. The dialog should close.</li>
-
-<li>
-Now switch between the editors. Notice that the selection in the
-navigator does not change.</li>
-</ol>
-
-<li>
-The Perspective > Open menu action can also be customized. By default
-this action will open a new perspective in the current window. You
-can change this to "open in new window" or "replace other". To see
-this behavior ..</li>
-
-<ol>
-<li>
-Open the preferences dialog. Change the workbench preferences for
-"Open Perspective" to "Open in New Window". Then press OK</li>
-
-<li>
-Invoke Perspective > Open > Java. Notice how a new window is created
-for the perspective. The list of open windows is shown in the Window
-menu. Select these items to switch between the windows.</li>
-</ol>
-
-<li>
-If you don't like the current preferences you can reset them. Open
-the preferences dialog again. To reset the state of "Link navigator
-.." and "Open Perspective .." press the Restore Defaults button.
-If you press OK the options will be saved. However, let's assume
-that you decide not to change them. Press Cancel. Then verify
-that the deviant options have not been restored to default by switching
-between editors and opening a new perspective.</li>
-
-<li>
-Invoke File > Exit. Then restart the workbench.</li>
-
-<li>
-Open the preferences dialog and confirm tha "Link navigator .. " and "Open
-Perspective .." still reflect the customized values. The workbench
-will automatically save your preferences between sessions.</li>
-</ol>
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Properties Dialog.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Properties Dialog.html
deleted file mode 100644
index cd52ea5..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Properties Dialog.html
+++ /dev/null
@@ -1,106 +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="OTI Employee">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
- <title>Properties Dialog</title>
-</head>
-<body>
-
-<center>
-<h1>
-Properties Dialog</h1></center>
-
-<h2>
-Purpose</h2>
-The plan is to confirm the default property pages for simple file, folder,
-and project resources.
-<h2>
-Setup</h2>
-
-<ul>
-<li>
-Start the Eclipse workbench</li>
-
-<li>
-Create a simple Project, Folder, and File</li>
-</ul>
-
-<h2>
-Project property pages</h2>
-
-<ol>
-<li>
-Select the simple Project, from the context menu select Properties</li>
-
-<li>
-Click on the Project References page</li>
-
-<li>
-Verify that the Project References page includes no project references</li>
-
-<li>
-Click on the Info page</li>
-
-<li>
-Verify the content is correct</li>
-
-<li>
-Check the Read Only option and press OK</li>
-
-<li>
-Verify that creating another simple file in the simple Project is disallowed</li>
-</ol>
-
-<h2>
-Folder property pages</h2>
-
-<ol>
-<li>
-Select the simple Folder, from the context menu select Properties</li>
-
-<li>
-Click on the Info page</li>
-
-<li>
-Verify the content is correct</li>
-
-<li>
-Check the Read Only option and press OK</li>
-
-<li>
-Verify that creating another simple file in the simple Folder is disallowed</li>
-</ol>
-
-<h2>
-File property pages</h2>
-
-<ol>
-<li>
-Select the simple File, from the context menu select Properties</li>
-
-<li>
-Click on the Info page</li>
-
-<li>
-Verify the content is correct</li>
-
-<li>
-Check the Read Only option and press OK</li>
-
-<li>
-Verify that editing the simple File is disallowed (editor is opened but
-cannot type in it)</li>
-</ol>
-
-<h2>
-Cleanup</h2>
-
-<ul>
-<li>
-Delete the simple File, Folder, and Project</li>
-</ul>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Properties View.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Properties View.html
deleted file mode 100644
index b4c2ade..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Properties View.html
+++ /dev/null
@@ -1,53 +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>Test Scenario: Properties View</title>
-</head>
-<body>
-
-<h3>
-Properties View</h3>
-Purpose: To test the Properties view in Eclipse. The Outline view
-is just a container for the pages contributed by other editors and views
-within the workbench. Therefore, this test will focus on the creation,
-show, and closure of those pages.
-<p>Setup:
-<ol>
-<li>
-Install Eclipse Platform.</li>
-
-<li>
-Create a project containing some files.</li>
-</ol>
-Method:
-<ol>
-<li>
-Start the workbench.</li>
-
-<li>
-Open the Navigator, Packages and Properties views.</li>
-
-<li>
-Select a file in the Navigator. Verify that the properties for this
-file are visible in the Properties view.</li>
-
-<li>
-Select a project in the Packages view. Verify that the properties
-for ths file are onw visible in the properties view.</li>
-
-<li>
-Activate the Navigator, Packages, Navigator, and Packages view by clicking
-in the title area of the view. Verify that the visible propreties
-in the properties view change to reflect the active part.</li>
-
-<li>
-Close the properties view.</li>
-
-<li>
-Open the view and verify that it shows the properties for the last selection
-in the workbench.</li>
-</ol>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Tasks View.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Tasks View.html
deleted file mode 100644
index ceb5561..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Tasks View.html
+++ /dev/null
@@ -1,105 +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>Test Scenario: Tasks View</title>
-</head>
-<body>
-
-<h3>
-Tasks View</h3>
-Purpose: To test the Tasks view in Eclipse. We will create a java
-project with java classes, introduce errors in those classes, add tasks
-to the files, and then verify them in the tasks list. We also test
-the persistance of task filtering between sessions.
-<p>Setup:
-<ol>
-<li>
-Install Eclipse Platform.</li>
-</ol>
-Method:
-<ol>
-<li>
-Start the workbench.</li>
-
-<li>
-Create a Java Project named TaskProject. Then create a class named
-TaskClass with the following content.</li>
-
-<p><br><tt>public class TaskClass {</tt>
-<br><tt> private int y;</tt>
-<br><tt> public TaskClass() {</tt>
-<br><tt> }</tt>
-<br><tt> public void doThis() {</tt>
-<br><tt> }</tt>
-<br><tt> abstract public void doThat();</tt>
-<br><tt> public int getX() {</tt>
-<br><tt> return x;</tt>
-<br><tt> }</tt>
-<br><tt>}</tt>
-<br>
-<li>
-If you save this file 2 errors will appear in the source. On line
-7 there is an error because abstract methods can only be defined in an
-abstract class. On line 9 there is an error because x is unknown.</li>
-
-<li>
-Open the Tasks view by invoking Perspective > Show View > Tasks.
-Verify that the tasks views appears and that it shows the 2 errors in the
-TaskClass.</li>
-
-<li>
-Select the first line of TaskClass and invoke "Add Task" from the context
-menu. Override the label with "Test Label" and press OK. Verify
-that a new task icon appears on the left edge of the editor and in the
-tasks view.</li>
-
-<li>
-If a problem is resolved or a task removed it should disappear from the
-task view. Open the Task view filter dialog and reset all options
-with the Reset button. Press OK and go back to the editor for TaskClass.java.
-Delete the "doThat" method and save the file. Verify that one of
-the errors on TaskClass.java is deleted.</li>
-
-<li>
-Now select the Tasks view and select the task item labelled "Test Label".
-Invoke Edit > Delete to delete this task and then verify that it disappears
-from the tasks view and from the open editor.</li>
-
-<li>
-Within the Tasks view you can also create new tasks. To test this
-press the "New Task" button on the toolbar. A new task should appear.
-Type in the label for this task and press Return. Verify that a new
-task is created. Do this a couple of times to create more than one
-task.</li>
-
-<li>
-A task is very similar to a bookmark. If you select a task you can
-open an editor on the task source. To test this close all editors.
-Then select one of the java problems for TaskClass.java and invoke Go To
-File in the context menu. Verify that an editor opens on the problem
-and that the problem is indicated by selection in the editor.</li>
-
-<li>
-Now invoke the Filters toolbar action and change the "show entries of type"
-option to "Java Problem" and nothing else. Press OK and verify that
-only Java problems appear in the task list now.</li>
-
-<li>
-Reopen the Filters dialog and select "On Selected Resource Only".
-Press OK. Now select TaskClass.java in the navigator and verify that
-the java problems for this file are visible in the navigator. Select
-the TaskProject and verify that the java problems for TaskClass.java are
-not visible.</li>
-
-<li>
-Now the task list contains a number of errors and tasks. It also
-has a couple of filtering options (java problems only and selected resource
-only). This state is persisted between sessions. To test this
-note the state of the task view. Then close the workbench and restart
-it. Verify that the visible set of tasks and the filtering options
-are restored.</li>
-</ol>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Test Scenarios.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Test Scenarios.html
deleted file mode 100644
index 2791c15..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Test Scenarios.html
+++ /dev/null
@@ -1,36 +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>Workbench Manual Test Scenarios</title>
-</head>
-<body>
-
-<h2>
-<b>Manual Test Scenarios for the Workbench (org.eclipse.ui)</b></h2>
-Last updated June 2, 2002
-
-<p>
-<br><a href="Welcome Editor.html">Welcome Editor</a>
-<br><a href="Window Actions.html">Window Actions</a>
-<br><a href="Window Layout.html">Window Layout</a>
-<br><a href="Persistence.html">Persistence</a>
-<br><a href="Navigator View.html">Navigator View</a>
-<br><a href="Outline View.html">Outline View</a>
-<br><a href="Properties View.html">Properties View</a>
-<br><a href="Bookmarks View.html">Bookmarks View</a>
-<br><a href="Tasks View.html">Tasks View</a>
-
-<br><a href="New File Wizard.html">New File Wizard</a>
-<br><a href="New Folder Wizard.html">New Folder Wizard</a>
-<br><a href="New Project Wizard.html">New Project Wizard</a>
-<br><a href="File System Export.html">File System Export</a>
-<br><a href="File System Import.html">File System Import</a>
-<br><a href="ZIP Export.html">Zip Export</a>
-<br><a href="ZIP Import.html">Zip Import</a>
-<br><a href="Properties Dialog.html">Properties Dialog</a>
-<br><a href="Preferences.html">Preferences</a>
-<br>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Text Editor b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Text Editor
deleted file mode 100644
index 2f67424..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Text Editor
+++ /dev/null
@@ -1,98 +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>Test Scenario: Text Editor</title>
-</head>
-<body>
-
-<h3>
-Text Editor</h3>
-Purpose: To test the Text Editor in Eclipse. We will open a text
-file, adding some text, play with the edit actions, verify the save and
-save as, and then test persistance between sessions.
-<p>Setup:
-<ol>
-<li>
-Install Eclipse Platform.</li>
-
-<li>
-Create a project.</li>
-</ol>
-Method:
-<ol>
-<li>
-Start the workbench.</li>
-
-<li>
-Invoke File > New > File. Create a new text file with some name like
-test1.txt. Verify that a new editor opens on the file.</li>
-
-<li>
-Copy and paste the following text into the editor ..</li>
-</ol>
-
-<blockquote>Beware the beast man, for he is the devil's pawn. Alone among
-God's primates,
-<br>he kills for sport, or lust or greed. Yes, he will murder his brother
-to possess his
-<br>brother's land. Let him not breed in great numbers, for he will make
-a desert of
-<br>his home and yours. Shun him. Drive him back into his jungle lair:
-For he is the
-<br>harbinger of death.
-<p>(Planet of the Apes)</blockquote>
-
-<ol>
-<li>
-After paste has been performed the editor state should be dirty.
-Verify that File > Save is enabled and that Save is enabled in the context
-menu. Invoke Save and verify that save is disabled.</li>
-
-<li>
-The Save As menu action is always enabled. Invoke this action to
-create a new file, say test2.txt, and verify that the name of the new file
-name is reflected in the editor tab.</li>
-
-<li>
-Modify the contents of test2.txt and save. Then open test1.txt and
-verify that it still contains the original text.</li>
-
-<li>
-In text1.txt select the first 3 lines and invoke Edit Copy. Activate
-text2.txt, put the cursor at the end of the file, and invoke Edit Paste.
-Verify that the first 3 lines of text1.txt are copied to text2.txt.</li>
-
-<li>
-Invoke Undo and Redo a few times in text2.txt to undo and redo the paste.</li>
-
-<li>
-Select a few lines of text and invoke Shift Right and Shift Left a few
-times.</li>
-
-<li>
-Now close text2.txt. The file has been modified, so a Save dialog
-should appear. Press No to avoid saving.</li>
-
-<li>
-Now we need to test Find / Replace. Select the text1.txt editor.
-This file contains many instances of he and his. Invoke Find / Replace
-and replace all instances of he by "she". You may find that various
-words like "the" are modified to "tshe". Close the find dialog and
-invoke Revert in the context menu. Verify that the file contents
-are now equal to the original text. Then try Find / Replace again
-with "whole word" selected and verify the results.</li>
-
-<li>
-Open up text2.txt. Now there should be one open editor with changs
-and one without.</li>
-
-<li>
-Invoke File > Close All. At this point a "Save Resources" dialog
-should appear where you can save the modified files. Check all modifications
-and then press "Yes". Verify that all editors are closed. Then
-open up any editor which was saved and verify changes.</li>
-</ol>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Welcome Editor.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Welcome Editor.html
deleted file mode 100644
index 75c3754..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Welcome Editor.html
+++ /dev/null
@@ -1,44 +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>Test Scenario: Welcome Editor</title>
-</head>
-<body>
-<h3>
-Welcome Editor</h3>
-Purpose: To test the Welcome editor in Eclipse. We will start the
-workbench after a fresh install, verify the visibility of the Welcome editor,
-and then test the format and links.
-<p>Setup:
-<ol>
-<li>
-Install Eclipse Platform.</li>
-
-<li>
-Delete the metadata for org.eclipse.ui. This will simulate a fresh
-install.</li>
-</ol>
-Method:
-<ol>
-<li>
-Start the workbench. Confirm that the default perspective (Resource)
-and Welcome editor both appear.</li>
-
-<li>
-Close the editor and exit the workbench.</li>
-
-<li>
-Restart the workbench and verify that the Welcome editor does not appear.
-The editor only appears automatically after a fresh install.</li>
-
-<li>
-Invoke Help > Welcome and verify that the Welcome editor opens.</li>
-
-<li>
-The Welcome editor contains a number of links. Test each of these links
-to ensure that the link invokes an appropriate action.</li>
-</ol>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Window Actions.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Window Actions.html
deleted file mode 100644
index 2459250..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Window Actions.html
+++ /dev/null
@@ -1,117 +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>Test Scenario: Window Actions</title>
-</head>
-<body>
-<h3>
-Window Actions</h3>
-Purpose: To test the standard menu and toolbar actions in Eclipse.
-We will create a project, open some editors, test the global actions, test
-the persistance of workbench state between sessions.
-<p>Setup:
-<ol>
-<li>
-Install Eclipse Platform.</li>
-
-<li>
-Delete the metadata for org.eclipse.ui.</li>
-</ol>
-Testing the File Menu:
-<ol>
-<li>
-Start the workbench.</li>
-
-<li>
-Invoke File > New > Project. A wizard will appear where you can select
-a project type. Select each item in the left hand viewer to verify
-the basic page operation. Then select Simple > Project and press
-Next. Type "SimpleProject" as the name for the project and press
-Finish. Verify that a new Resource perspective is created and that
-SimpleProject appears in the Navigator view.</li>
-
-<li>
-Create a few folders and files (one.txt, two.txt, three.txt) within SimpleProject.
-For more information on this process refer to Simon's work on the New Wizard.</li>
-
-<li>
-Open one.txt within a text editor. Verify that File > Close and Save
-As are enabled. Verify that Save is disabled.</li>
-
-<li>
-Add the following text to the file..</li>
-
-<p><br>File One
-<br>
-<li>
-Once you modify a file the File > Save action should become enabled and
-a small asterix should appear in the editor tab. Invoke Save and
-verify that the asterix disappears and that the File > Save action is disabled.</li>
-
-<li>
-Open two.txt. Add the following text to the file..</li>
-
-<p><br>File Two
-<br>
-<li>
-Open three.txt and add the following text to the file..</li>
-
-<p><br>File Three
-<br>
-<li>
-If you close an editor which is dirty the workbench should ask if you want
-to save it. With three.txt active invoke File > Close. Verify
-that the Save dialog appears. Press Yes. Then reopen the file
-to verify that the text was saved.</li>
-
-<li>
-Invoke File > Close All. At this point there is 1 dirty editor.
-Verify that the Save Resources dialog appears. Press Yes. The
-dirty editors should be saved and all editors will close.</li>
-
-<li>
-Verify that File > Close, Close All, Save, Save As, and Save All are disabled.</li>
-</ol>
-Testing the Edit Menu:
-<ol>
-<li>
-The edit actions should target the active view or editor. To test
-this ..</li>
-
-<ol>
-<li>
-Select a file in the navigator view. Invoke Edit > Delete and verify
-that the Delete File dialog appears for the current selection in the navigator.
-Close the dialog without completing the delete.</li>
-
-<li>
-Select the file again and invoke Edit > Add Bookmark. Open the Bookmarks
-view and verify that a bookmark exists for the file. Select the bookmark.
-Invoke Edit > Delete and verify that the bookmark is deleted in the bookmarks
-view.</li>
-
-<li>
-Open one.txt in a text editor. Select a piece of text and invoke
-Edit > Cut. Verify that the selection in the text editor is cut.</li>
-</ol>
-
-<li>
-Create a file named X.java. Open it in an editor and then verify
-that the Java editor actions are contributed to the workbench menu and
-toolbar.</li>
-
-<li>
-Open one.txt in an editor. Verify that the java editor actions are
-no longer visible in the workbench.</li>
-
-<li>
-Activate the java editor and verify that its contributions appear once
-again.</li>
-
-<li>
-Close the java editor and verify that the contributions disappear.</li>
-</ol>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Window Layout.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Window Layout.html
deleted file mode 100644
index f188196..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/Window Layout.html
+++ /dev/null
@@ -1,196 +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>Test Scenario: Window Layout</title>
-</head>
-<body>
-<h3>
-Window Layout</h3>
-Purpose: To test window layout in Eclipse. We will open a perspective,
-test the layout features, open a second perspective, switch between perspectives,
-and then create some windows.
-<p>Setup:
-<ol>
-<li>
-Install Eclipse Platform.</li>
-
-<li>
-Create a project with 3 .txt files.</li>
-
-<li>
-Delete the metadata for org.eclipse.ui.</li>
-</ol>
-Testing a Single Perspective:
-<ol>
-<li>
-Start the workbench.</li>
-
-<li>
-Drag the navigator over the shortcut bar (the vertical toolbar at left).
-Verify that a stack icon appears. Drop the view on the shortcut bar.
-It should become a fast view.</li>
-
-<li>
-Click on the navigator fast view button to show the view. Click on
-another view to hide it. You can also hide the view by clicking on
-the "hide" button or the fast view button.</li>
-
-<li>
-Close the Outline view. Then invoke Perspective > Show View > Outline
-to show it again. Verify that it has the same position as before.</li>
-
-<li>
-Select a text file in the navigator and open it. Verify that the
-navigator fast view is hidden and an editor appears in the editor area.</li>
-
-<li>
-Modify the contents of the editor and verify that File > Save becomes enabled.
-Save the file and verify that File > Save is disabled.</li>
-
-<li>
-Modify the contents of the editor again and close the editor. Verify
-that the Save dialog appears and you can answer, yes, no, and cancel.</li>
-
-<li>
-Open 3 text files within 3 editors. The editors appear in a single
-folder.</li>
-
-<li>
-Drag one editor out of the folder. Verify that the relative placement
-icons are shown when you are to the top, right, bottom, or left of the
-existing editor folder. The "no drop" icon should appear if you are
-over a view. Drop the editor below the existing folder.</li>
-
-<li>
-Drag another editor our of the folder onto the single view. Verify
-that the first folder is deconstructed and that a new folder is constructed.</li>
-
-<li>
-Maximize the active editor by clicking on the title area. Minimize
-it by clicking in the area again. Maximize it again and then close
-it. Verify that the perspective layout is restored.</li>
-
-<li>
-Drag a bunch of views out of the window to create detached windows.
-Try dragging these views on top of one another to create detached folders.</li>
-
-<li>
-Invoke Perspective > Reset. Answer yes to the dialog and verify that
-the layout of the perspective is restored to the original.</li>
-
-<li>
-Invoke Perspective > Close to close the page.</li>
-</ol>
-Perspective Save As:
-<ol>
-<li>
-Open the resource perspective.</li>
-
-<li>
-Drag a view onto the left tool bar. Drag another out into a detached
-window.</li>
-
-<li>
-In Eclipse you can customize the actions visible in a perspective.
-Invoke Perspective > Customize and select some new views and actions.
-Press OK and verify that the new actions appear in the menu and toolbar.</li>
-
-<li>
-Invoke Perspective > Save As and select the Resource perspective.
-Press OK and answer yes to the verify dialog.</li>
-
-<li>
-Close the perspective.</li>
-
-<li>
-Open the Resource perspective. Verify that the new page has the same
-layout and visible action sets as you created and saved.</li>
-
-<li>
-Close the perspective.</li>
-
-<li>
-Open up the Preferences dialog and view the Perspectives page. Select
-the Resource one and press Reset.</li>
-
-<li>
-Open the Resource perspective. Verify that the new page has the default
-layout.</li>
-
-<li>
-Drag a view onto the left tool bar. Drag another out into a detached
-window.</li>
-
-<li>
-Invoke Perspective > Save As and type the name of a new perspective (ie
-Bob). Press OK and then verify that the window title changes to reflect
-the new perspective.</li>
-
-<li>
-Close all perspectives</li>
-
-<li>
-Open a new Resource perspective and a Bob perspective. Verify that
-the first has the default layout and that the second has your custom layout.</li>
-</ol>
-Testing Two or More Perspectives:
-<ol>
-<li>
-Close all Perspectives</li>
-
-<li>
-Open a Resource perspective. Verify that a new page appears in the
-window with the Resource perspective.</li>
-
-<li>
-In the Navigator select your project and invoke Open Perspective > Java.
-Verify that a new perspective appears with the Java Perspective and that
-the input for the navigator is the project. Cool: Perspectives support
-scoping !!</li>
-
-<li>
-In the Java perspective open one of the text files in an editor.</li>
-
-<li>
-Drag a couple of views out of the window to create detached windows.</li>
-
-<li>
-Modify the action sets.</li>
-
-<li>
-Switch back and forth between the two pages in the window by clicking in
-the left hand tool bar. The active perspective controls the visible
-action sets, views and editors in the window. If you switch between
-two pages these attributes should change.</li>
-
-<li>
-Try Perspective > Next and Previous.</li>
-
-<li>
-Close the second perspective by invoking Perspective > Close. Verify
-that the first perspective is activated.</li>
-</ol>
-Multiple Windows
-<ol>
-<li>
-Start with one open window which has one perspective.</li>
-
-<li>
-Change the Workbench Preferences for "Open Perspective" to "Open in New
-Window". Then open a Java perspective and verify that a new window
-is created.</li>
-
-<li>
-A list of the open windows should appear in the Window menu. Select
-these items to switch between the windows.</li>
-
-<li>
-Close one window and verify that the other is activated.</li>
-
-<li>
-Close the last window and verify that the workbench shuts down.</li>
-</ol>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/ZIP Export.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/ZIP Export.html
deleted file mode 100644
index f5c5d1b..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/ZIP Export.html
+++ /dev/null
@@ -1,100 +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="OTI Employee">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
- <title>ZIP Export</title>
-</head>
-<body>
-
-<center>
-<h1>
-ZIP Export</h1></center>
-
-<h2>
-Purpose</h2>
-The plan is to export a project with a large number files/folders at a
-time, using the zip file wizard. The results should be indentical in layout
-and content as the original project used.
-<h2>
-Setup</h2>
-
-<ul>
-<li>
-Download the JUnit zip file source code from www.junit.org.</li>
-
-<li>
-Start the Eclipse workbench</li>
-
-<li>
-Create a new temporary "simple" project called "JUnit Test"</li>
-
-<li>
-Import the JUnit zip file into the project</li>
-
-<li>
-Select File -> Export, select Zip File and press Next.</li>
-</ul>
-
-<h2>
-Export from a project to a new zip file</h2>
-
-<ol>
-<li>
-Select the "JUnit Test" project and mark it as checked.</li>
-
-<li>
-In the Zip File field, type in the filename for the new zip file.</li>
-
-<li>
-Press Finish</li>
-
-<li>
-Verify that the contents in the zip file match the same file and folder
-structure as the source project</li>
-
-<li>
-Verify the content of the files.</li>
-</ol>
-
-<h2>
-Export from a project to an existing zip file</h2>
-
-<ol>
-<li>
-Select the "JUnit Test" project and mark it as checked.</li>
-
-<li>
-In the Zip File field, type in the filename for the existing zip file.</li>
-
-<li>
-Check the option "Overwrite existing resources without warning"</li>
-
-<li>
-Press Finish</li>
-
-<li>
-Verify you were not prompted to overwrite files</li>
-
-<li>
-Verify that the contents in the zip file match the same file and folder
-structure as the source project.</li>
-
-<li>
-Verify the content of the files.</li>
-</ol>
-
-<h2>
-Cleanup</h2>
-
-<ul>
-<li>
-Delete the temporary project "JUnit Test"</li>
-
-<li>
-Delete the temporary jar file</li>
-</ul>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/ZIP Import.html b/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/ZIP Import.html
deleted file mode 100644
index 17552ca..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/Manual Scenario Tests/ZIP Import.html
+++ /dev/null
@@ -1,103 +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="OTI Employee">
- <meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
- <title>ZIP Import</title>
-</head>
-<body>
-
-<center>
-<h1>
-ZIP Import</h1></center>
-
-<h2>
-Purpose</h2>
-The plan is to import a large number files/folders at a time, using the
-ZIP file wizard. The results should be indentical in layout and content
-as the original source used.
-<h2>
-Setup</h2>
-
-<ul>
-<li>
-Download the JUnit zip file source code from www.junit.org.</li>
-
-<li>
-Start the Eclipse workbench</li>
-
-<li>
-Create a new temporary "simple" project called "JUnit Test"</li>
-
-<li>
-Select File -> Import, select Zip File and press Next.</li>
-</ul>
-
-<h2>
-Import into a new project</h2>
-
-<ol>
-<li>
-Click the Browse button and select the ZIP file.</li>
-
-<li>
-Expand the folders in the tree view and until "junit" folder is visible
-and check mark the box next to it. Deselect the "doc" and "javadoc" folders.</li>
-
-<li>
-Type in "JUnit Test" in the Folder field</li>
-
-<li>
-Press Finish</li>
-
-<li>
-Verify that the contents of the project match the same file and folder
-structure as the source in the file system.</li>
-
-<li>
-Verify that the content of the files.</li>
-</ol>
-
-<h2>
-Import into an existing project</h2>
-
-<ol>
-<li>
-Click on the Zip File drop down box and select the zip file</li>
-
-<li>
-Expand the folders in the tree view and until "junit" folder is visible
-and check mark the box next to it. Deselect the "doc" and "javadoc"
-folders.</li>
-
-<li>
-Type in "JUnit Test" in the Folder field</li>
-
-<li>
-Check the option "Overwrite existing resources without warning"</li>
-
-<li>
-Press Finish</li>
-
-<li>
-Verify you were not prompted to overwrite files</li>
-
-<li>
-Verify that the contents of the project match the same file and folder
-structure as the source in the file system.</li>
-
-<li>
-Verify that the content of the files.</li>
-</ol>
-
-<h2>
-Cleanup</h2>
-
-<ul>
-<li>
-Delete the temporary project "JUnit Test"</li>
-</ul>
-
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/SelectionProviderView.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/SelectionProviderView.java
deleted file mode 100644
index 1dd454c..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/SelectionProviderView.java
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/TestPlugin.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/TestPlugin.java
deleted file mode 100644
index 6d43eb4..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/TestPlugin.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPluginDescriptor;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-
-/**
- * The main plugin class to be used in the desktop.
- */
-public class TestPlugin extends AbstractUIPlugin {
- //The shared instance.
- private static TestPlugin plugin;
- //Resource bundle.
- private ResourceBundle resourceBundle;
-
- /**
- * The constructor.
- */
- public TestPlugin(IPluginDescriptor descriptor) {
- super(descriptor);
- plugin = this;
- try {
- resourceBundle= ResourceBundle.getBundle("org.eclipse.ui.tests.TestPluginResources");
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- }
-
- /**
- * Returns the shared instance.
- */
- public static TestPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the workspace instance.
- */
- public static IWorkspace getWorkspace() {
- return ResourcesPlugin.getWorkspace();
- }
-
- /**
- * Returns the string from the plugin's resource bundle,
- * or 'key' if not found.
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle= TestPlugin.getDefault().getResourceBundle();
- try {
- return bundle.getString(key);
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- return resourceBundle;
- }
-
- /**
- * Returns the image descriptor with the given relative path.
- */
- public ImageDescriptor getImageDescriptor(String relativePath) {
- String iconPath = "icons/";
- try {
- URL installURL = getDescriptor().getInstallURL();
- URL url = new URL(installURL, iconPath + relativePath);
- return ImageDescriptor.createFromURL(url);
- }
- catch (MalformedURLException e) {
- // should not happen
- return ImageDescriptor.getMissingImageDescriptor();
- }
- }
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/UiTestSuite.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/UiTestSuite.java
deleted file mode 100644
index e399d3c..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/UiTestSuite.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.swt.SWT;
-
-/**
- * Test all areas of the UI.
- */
-public class UiTestSuite extends TestSuite {
-
- /**
- * Returns the suite. This is required to
- * use the JUnit Launcher.
- */
- public static Test suite() {
- return new UiTestSuite();
- }
-
- /**
- * Construct the test suite.
- */
- public UiTestSuite() {
- addTest(new org.eclipse.ui.tests.api.ApiTestSuite());
- // PR 1GkD5O0 - Fails on linux.
- String platform = SWT.getPlatform();
- if (!platform.equals("motif")) {
- addTest(new org.eclipse.ui.tests.dialogs.UIAutomatedSuite());
- }
- addTest(new org.eclipse.ui.tests.propertysheet.PropertySheetTestSuite());
- addTest(new org.eclipse.ui.tests.internal.InternalTestSuite());
- addTest(new org.eclipse.ui.tests.navigator.NavigatorTestSuite());
- addTest(new org.eclipse.ui.tests.adaptable.AdaptableTestSuite());
- addTest(new org.eclipse.ui.tests.zoom.ZoomTestSuite());
- addTest(new org.eclipse.ui.tests.datatransfer.DataTransferTestSuite());
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptableDecoratorTestCase.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptableDecoratorTestCase.java
deleted file mode 100644
index 72d9da6..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptableDecoratorTestCase.java
+++ /dev/null
@@ -1,209 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.adaptable;
-
-import java.io.ByteArrayInputStream;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.decorators.DecoratorDefinition;
-import org.eclipse.ui.internal.decorators.DecoratorManager;
-import org.eclipse.ui.tests.util.UITestCase;
-
-/**
- * @version 1.0
- */
-public class AdaptableDecoratorTestCase
- extends UITestCase
- implements ILabelProviderListener {
-
- private DecoratorDefinition fullDefinition;
- private DecoratorDefinition lightDefinition;
- private AdaptedResourceNavigator adaptedNavigator;
- private boolean updated = false;
- public String ADAPTED_NAVIGATOR_ID =
- "org.eclipse.ui.tests.adaptable.adaptedHierarchy";
- protected IProject testProject;
- protected IFolder testFolder;
- protected IFile testFile;
-
- /**
- * Constructor for DecoratorTestCase.
- * @param testName
- */
- public AdaptableDecoratorTestCase(String testName) {
- super(testName);
- }
-
- /**
- * Sets up the hierarchy.
- */
- protected void setUp() throws Exception {
- createTestFile();
- showAdaptedNav();
-
- WorkbenchPlugin.getDefault().getDecoratorManager().addListener(this);
-
- DecoratorDefinition[] definitions =
- WorkbenchPlugin
- .getDefault()
- .getDecoratorManager()
- .getAllDecoratorDefinitions();
- for (int i = 0; i < definitions.length; i++) {
- if (definitions[i]
- .getId()
- .equals("org.eclipse.ui.tests.adaptable.decorator"))
- fullDefinition = definitions[i];
- if (definitions[i]
- .getId()
- .equals("org.eclipse.ui.tests.navigator.lightweightdecorator"))
- lightDefinition = definitions[i];
- }
- }
-
- private DecoratorManager getDecoratorManager() {
- return WorkbenchPlugin.getDefault().getDecoratorManager();
- }
-
- /**
- * Remove the listener.
- */
-
- public void tearDown() throws Exception {
-
- if (testProject != null) {
- try {
- testProject.delete(true, null);
- } catch (CoreException e) {
- fail(e.toString());
- }
- testProject = null;
- testFolder = null;
- testFile = null;
- }
- super.tearDown();
- adaptedNavigator = null;
-
- getDecoratorManager().removeListener(this);
- }
-
- /**
- * Make a label changed event for resource.
- */
- private LabelProviderChangedEvent getLabelChangedEvent(IResource resource) {
- return new LabelProviderChangedEvent(getDecoratorManager(), resource);
- }
-
- /**
- * Test enabling the contributor
- */
- public void testEnableDecorator() throws CoreException {
- fullDefinition.setEnabled(true);
- lightDefinition.setEnabled(true);
- getDecoratorManager().reset();
-
- }
-
- /**
- * Test disabling the contributor
- */
- public void testDisableDecorator() throws CoreException {
- fullDefinition.setEnabled(false);
- lightDefinition.setEnabled(false);
- getDecoratorManager().reset();
- }
-
- /**
- * Refresh the full decorator.
- */
- public void testRefreshFullContributor() throws CoreException {
-
- updated = false;
- fullDefinition.setEnabled(true);
- lightDefinition.setEnabled(false);
- getDecoratorManager().reset();
- assertTrue("Got an update", updated);
- updated = false;
-
- }
-
- /**
- * Refresh the full decorator.
- */
- public void testRefreshLightContributor() throws CoreException {
-
- updated = false;
- lightDefinition.setEnabled(true);
- fullDefinition.setEnabled(false);
- getDecoratorManager().reset();
- assertTrue("Got an update", updated);
- updated = false;
-
- }
-
- /*
- * @see ILabelProviderListener#labelProviderChanged(LabelProviderChangedEvent)
- */
- public void labelProviderChanged(LabelProviderChangedEvent event) {
- updated = true;
- }
-
- /**
- * Shows the Adapted Resource Navigator in a new test window.
- */
- protected void showAdaptedNav() throws PartInitException {
- IWorkbenchWindow window = openTestWindow();
- adaptedNavigator =
- (AdaptedResourceNavigator) window.getActivePage().showView(
- ADAPTED_NAVIGATOR_ID);
- }
-
- protected void createTestProject() throws CoreException {
- if (testProject == null) {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- testProject = workspace.getRoot().getProject("AdaptedTestProject");
- testProject.create(null);
- testProject.open(null);
- }
- }
-
- protected void createTestFolder() throws CoreException {
- if (testFolder == null) {
- createTestProject();
- testFolder = testProject.getFolder("AdaptedTestFolder");
- testFolder.create(false, false, null);
- }
- }
-
- protected void createTestFile() throws CoreException {
- if (testFile == null) {
- createTestFolder();
- testFile = testFolder.getFile("AdaptedFoo.txt");
- testFile.create(
- new ByteArrayInputStream("Some content.".getBytes()),
- false,
- null);
- }
- }
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptableResourceWrapper.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptableResourceWrapper.java
deleted file mode 100644
index b073310..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptableResourceWrapper.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.adaptable;
-
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-public class AdaptableResourceWrapper implements IAdaptable {
-
- IResource resource;
-
- /*
- * @see IAdaptable#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IResource.class)
- return resource;
- if (adapter == IWorkbenchAdapter.class)
- return TestAdaptableWorkbenchAdapter.getInstance();
- return null;
- }
-
- public AdaptableResourceWrapper(IResource wrapped) {
- resource = wrapped;
- }
-
- public String getLabel() {
- return resource.getName() + " Adapted";
- }
-
- public AdaptableResourceWrapper getParent() {
- if (resource.getParent() != null)
- return new AdaptableResourceWrapper(resource.getParent());
- return null;
- }
-
- public AdaptableResourceWrapper[] getChildren() {
- AdaptableResourceWrapper[] wrappers = new AdaptableResourceWrapper[0];
-
- if (resource instanceof IContainer) {
- IResource[] children;
- try {
- children = ((IContainer) resource).members();
- } catch (CoreException exception) {
- return wrappers;
- }
- wrappers = new AdaptableResourceWrapper[children.length];
- for (int i = 0; i < children.length; i++) {
- wrappers[i] = new AdaptableResourceWrapper(children[i]);
- }
- }
- return wrappers;
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptableTestSuite.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptableTestSuite.java
deleted file mode 100644
index 224e001..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptableTestSuite.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.adaptable;
-
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * The AdaptableTestSuite is the TestSuite for the
- * adaptable support in the UI.
- */
-public class AdaptableTestSuite extends TestSuite {
-
- /**
- * Returns the suite. This is required to
- * use the JUnit Launcher.
- */
- public static Test suite() {
- return new AdaptableTestSuite();
- }
-
- /**
- * Constructor for AdaptableTestSuite.
- */
- public AdaptableTestSuite() {
- addTest(new TestSuite(AdaptableDecoratorTestCase.class));
- }
-
-
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptedResourceNavigator.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptedResourceNavigator.java
deleted file mode 100644
index d53a0e9..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/AdaptedResourceNavigator.java
+++ /dev/null
@@ -1,533 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.adaptable;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Platform;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.viewers.DecoratingLabelProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-
-import org.eclipse.ui.IDecoratorManager;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.part.DrillDownAdapter;
-import org.eclipse.ui.part.ViewPart;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.eclipse.ui.views.navigator.NavigatorFrameSource;
-import org.eclipse.ui.views.navigator.ResourceNavigatorMessages;
-import org.eclipse.ui.views.navigator.ResourceSorter;
-
-/**
- * Implements the Resource Navigator view.
- */
-public class AdaptedResourceNavigator
- extends ViewPart {
- private TreeViewer viewer;
- private IDialogSettings settings;
- private IMemento memento;
- private NavigatorFrameSource frameSource;
-
- protected TestNavigatorActionGroup actionGroup;
-
- /**
- * 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_PATH = "path"; //$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$
-
- 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) {
- }
- };
- /**
- * Creates a new AdaptedResourceNavigator.
- */
- public AdaptedResourceNavigator() {
- 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.
- */
- 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) {
- viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
- // initDrillDownAdapter(viewer);
- viewer.setUseHashlookup(true);
- viewer.setContentProvider(new TestAdaptableContentProvider());
- IDecoratorManager manager = getSite().getWorkbenchWindow().getWorkbench().getDecoratorManager();
- viewer.setLabelProvider(
- new DecoratingLabelProvider(
- new TestAdaptableWorkbenchAdapter(),
- manager.getLabelDecorator()));
-
- viewer.setInput(getInitialInput());
- updateTitle();
-
- MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(new IMenuListener() {
- public void menuAboutToShow(IMenuManager manager) {
- AdaptedResourceNavigator.this.fillContextMenu(manager);
- }
- });
- Menu menu = menuMgr.createContextMenu(viewer.getTree());
- viewer.getTree().setMenu(menu);
- getSite().registerContextMenu(menuMgr, viewer);
-
- makeActions();
-
- // Update the global action enable state to match
- // the current selection.
- IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
- actionGroup.updateGlobalActions(selection);
-
- viewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- handleSelectionChanged(event);
- }
- });
- viewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- handleDoubleClick(event);
- }
- });
- viewer.getControl().addKeyListener(new KeyListener() {
- public void keyPressed(KeyEvent event) {
- handleKeyPressed(event);
- }
- public void keyReleased(KeyEvent event) {
- handleKeyReleased(event);
- }
- });
-
- actionGroup.fillActionBars(selection);
-
- getSite().setSelectionProvider(viewer);
-
- getSite().getPage().addPartListener(partListener);
-
- if (memento != null)
- restoreState(memento);
- memento = null;
- }
- /* (non-Javadoc)
- * Method declared on IWorkbenchPart.
- */
- public void dispose() {
- getSite().getPage().removePartListener(partListener);
- super.dispose();
- }
- /**
- * An editor has been activated. Set the selection in this navigator
- * to be the editor's input, if linking is enabled.
- */
- 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 (!viewer.getSelection().equals(newSelection)) {
- viewer.setSelection(newSelection);
- }
- }
-
- }
-
- /**
- * Called when the context menu is about to open.
- */
- void fillContextMenu(IMenuManager menu) {
- actionGroup.setContext(new ActionContext(getViewer().getSelection()));
- actionGroup.fillContextMenu(menu);
- }
-
- /**
- * Returns the initial input for the viewer.
- * Tries to convert the 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.
- */
- IContainer getInitialInput() {
- IAdaptable input = getSite().getPage().getInput();
- 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 navigator's plugin.
- */
- public AbstractUIPlugin getPlugin() {
- return (AbstractUIPlugin) Platform.getPlugin(PlatformUI.PLUGIN_ID);
- }
- /**
- * Returns the current sorter.
- * @since 2.0
- */
- public ResourceSorter getSorter() {
- return (ResourceSorter) getViewer().getSorter();
- }
-
- /**
- * Returns the tree viewer which shows the resource hierarchy.
- * @since 2.0
- */
- public TreeViewer getViewer() {
- return viewer;
- }
- /**
- * Returns the shell to use for opening dialogs.
- * Used in this class, and in the actions.
- */
- 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
- */
- 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",
- new Object[] { new Integer(selection.size())});
- //$NON-NLS-1$
- }
- return ""; //$NON-NLS-1$
- }
- /**
- * Returns the tool tip text for the given element.
- */
- String getToolTipText(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) getViewer().getLabelProvider()).getText(
- element);
- }
- }
- /**
- * Handles double clicks in viewer.
- * Opens editor if file double-clicked.
- * @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
- if (viewer.isExpandable(element)) {
- viewer.setExpandedState(element, !viewer.getExpandedState(element));
- }
-
- }
- /**
- * Handles selection changed in viewer.
- * Updates global actions.
- * Links to editor (if option enabled)
- * @since 2.0
- */
- protected void handleSelectionChanged(SelectionChangedEvent event) {
- IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- updateStatusLine(sel);
- actionGroup.updateGlobalActions(sel);
- actionGroup.selectionChanged(sel);
- linkToEditor(sel);
- }
-
- /**
- * Handles a key press in viewer. By default do nothing.
- */
- protected void handleKeyPressed(KeyEvent event) {
-
- }
-
- /**
- * Handles a key release in viewer.
- */
- 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;
- }
-
- /**
- * Initializes a drill down adapter on the viewer.
- */
- void initDrillDownAdapter(TreeViewer viewer) {
- DrillDownAdapter drillDownAdapter = new DrillDownAdapter(viewer) {
- // need to update title whenever input changes;
- // updateNavigationButtons is called whenever any of the drill down buttons are used
- protected void updateNavigationButtons() {
- super.updateNavigationButtons();
- updateTitle();
- }
- };
- drillDownAdapter.addNavigationActions(
- getViewSite().getActionBars().getToolBarManager());
- }
- /**
- * Returns whether the preference to link navigator selection to active editor is enabled.
- * @since 2.0
- */
- protected boolean isLinkingEnabled() {
- IPreferenceStore store = getPlugin().getPreferenceStore();
- return store.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();
- IEditorReference editorArray[] = page.getEditorReferences();
- for (int i = 0; i < editorArray.length; ++i) {
- IEditorPart editor = editorArray[i].getEditor(true);
- IEditorInput input = editor.getEditorInput();
- if (input instanceof IFileEditorInput
- && file.equals(((IFileEditorInput) input).getFile())) {
- page.bringToTop(editor);
- return;
- }
- }
- }
- }
- /**
- * Create self's action objects
- */
- protected void makeActions() {
- actionGroup = new TestNavigatorActionGroup(this);
- }
-
- /**
- * Restore the state of the receiver to the state described in
- * momento.
- * @since 2.0
- */
-
- protected void restoreState(IMemento memento) {}
- public void saveState(IMemento memento) {}
- /**
- * Reveal and select the passed element selection in self's visual component
- */
- public void selectReveal(ISelection selection) {
- StructuredSelection ssel = convertSelection(selection);
- if (!ssel.isEmpty()) {
- getViewer().setSelection(ssel, true);
- }
- }
- /**
- * @see IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- getViewer().getTree().setFocus();
- }
- /**
- * Note: For experimental use only.
- * Sets the decorator for the navigator.
- *
- * @param decorator a label decorator or <code>null</code> for no decorations.
- */
- public void setLabelDecorator(ILabelDecorator decorator) {
- DecoratingLabelProvider provider =
- (DecoratingLabelProvider) getViewer().getLabelProvider();
- if(decorator == null) {
- IDecoratorManager manager = getSite().getWorkbenchWindow().getWorkbench().getDecoratorManager();
- provider.setLabelDecorator(manager.getLabelDecorator());
- }
- else {
- provider.setLabelDecorator(decorator);
- }
- }
-
-
- /**
- * Updates the message shown in the status line.
- *
- * @param selection the current selection
- */
- 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.
- */
- void updateTitle() {
- Object input = getViewer().getInput();
- String viewName = getConfigurationElement().getAttribute("name");
- //$NON-NLS-1$
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- if (input == null
- || input.equals(workspace)
- || input.equals(workspace.getRoot())) {
- setTitle(viewName);
- setTitleToolTip(""); //$NON-NLS-1$
- } else {
- ILabelProvider labelProvider =
- (ILabelProvider) getViewer().getLabelProvider();
- setTitle(
- ResourceNavigatorMessages.format(
- "ResourceNavigator.title",
- new Object[] { viewName, labelProvider.getText(input)}));
- //$NON-NLS-1$
- setTitleToolTip(getToolTipText(input));
- }
- }
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/NullLabelDecorator.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/NullLabelDecorator.java
deleted file mode 100644
index 8210188..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/NullLabelDecorator.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.adaptable;
-
-/*
- * This decorator tests the null cases
- */
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-
-/**
- * @version 1.0
- * @author
- */
-public class NullLabelDecorator implements ILabelDecorator {
-
- /*
- * @see ILabelDecorator#decorateImage(Image, Object)
- */
- public Image decorateImage(Image image, Object element) {
- return null;
- }
-
- /*
- * @see ILabelDecorator#decorateText(String, Object)
- */
- public String decorateText(String text, Object element) {
- return null;
- }
-
- /*
- * @see IBaseLabelProvider#addListener(ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- }
-
- /*
- * @see IBaseLabelProvider#dispose()
- */
- public void dispose() {
- }
-
- /*
- * @see IBaseLabelProvider#isLabelProperty(Object, String)
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /*
- * @see IBaseLabelProvider#removeListener(ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- }
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/ResourceAction.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/ResourceAction.java
deleted file mode 100644
index 6e2c05d..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/ResourceAction.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.adaptable;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.IObjectActionDelegate;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.tests.navigator.TestDecoratorContributor;
-
-public class ResourceAction implements IObjectActionDelegate {
-
- Object selectedItem;
-
- /*
- * @see IObjectActionDelegate#setActivePart(IAction, IWorkbenchPart)
- */
- public void setActivePart(IAction action, IWorkbenchPart targetPart) {
- }
-
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
-
- if (selectedItem != null)
- TestDecoratorContributor.contributor.refreshListeners(selectedItem);
-
- }
-
- /*
- * @see IActionDelegate#selectionChanged(IAction, ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection structured = (IStructuredSelection) selection;
- if (structured.isEmpty())
- selectedItem = null;
- else
- selectedItem = structured.getFirstElement();
- }
- }
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/TestAdaptableContentProvider.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/TestAdaptableContentProvider.java
deleted file mode 100644
index 0e33b10..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/TestAdaptableContentProvider.java
+++ /dev/null
@@ -1,208 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.adaptable;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IWorkspace;
-
-import org.eclipse.swt.widgets.Control;
-
-import org.eclipse.jface.viewers.AbstractTreeViewer;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.StructuredViewer;
-import org.eclipse.jface.viewers.Viewer;
-
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * Provides tree contents for objects that have the IWorkbenchAdapter
- * adapter registered.
- */
-public class TestAdaptableContentProvider 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) {
- return TestAdaptableWorkbenchAdapter.getInstance();
-}
-/* (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/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/TestAdaptableWorkbenchAdapter.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/TestAdaptableWorkbenchAdapter.java
deleted file mode 100644
index ffb1319..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/TestAdaptableWorkbenchAdapter.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.adaptable;
-
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.LabelProvider;
-
-import org.eclipse.ui.model.IWorkbenchAdapter;
-
-/**
- * @version 1.0
- * @author
- */
-public class TestAdaptableWorkbenchAdapter
- extends LabelProvider
- implements IWorkbenchAdapter {
-
- private static TestAdaptableWorkbenchAdapter singleton =
- new TestAdaptableWorkbenchAdapter();
-
- public static TestAdaptableWorkbenchAdapter getInstance() {
- return singleton;
- }
-
- public TestAdaptableWorkbenchAdapter() {
- }
-
- /*
- * @see IWorkbenchAdapter#getChildren(Object)
- */
- public Object[] getChildren(Object o) {
- if (o instanceof AdaptableResourceWrapper)
- return ((AdaptableResourceWrapper) o).getChildren();
- if(o instanceof IResource){
- AdaptableResourceWrapper wrapper = new AdaptableResourceWrapper((IResource) o);
- return wrapper.getChildren();
- }
- return new Object[0];
- }
-
- /*
- * @see IWorkbenchAdapter#getImageDescriptor(Object)
- */
- public ImageDescriptor getImageDescriptor(Object object) {
- return null;
- }
-
- /*
- * @see IWorkbenchAdapter#getLabel(Object)
- */
- public String getLabel(Object o) {
- if (o instanceof AdaptableResourceWrapper)
- return ((AdaptableResourceWrapper) o).getLabel();
- else
- return null;
- }
-
- /*
- * @see IWorkbenchAdapter#getParent(Object)
- */
- public Object getParent(Object o) {
- if (o instanceof AdaptableResourceWrapper)
- return ((AdaptableResourceWrapper) o).getParent();
- else
- return null;
- }
-
- /**
- * 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() {
- }
- /**
- * 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);
-
- return descriptor.createImage();
- }
- /* (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/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/TestNavigatorActionGroup.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/TestNavigatorActionGroup.java
deleted file mode 100644
index c579363..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/adaptable/TestNavigatorActionGroup.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.adaptable;
-
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.IStructuredSelection;
-
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.actions.ActionGroup;
-import org.eclipse.ui.actions.AddBookmarkAction;
-import org.eclipse.ui.actions.NewWizardAction;
-import org.eclipse.ui.actions.NewWizardMenu;
-import org.eclipse.ui.dialogs.PropertyDialogAction;
-import org.eclipse.ui.views.navigator.ResourceNavigatorMessages;
-
-public class TestNavigatorActionGroup extends ActionGroup {
-
- private AdaptedResourceNavigator navigator;
- private AddBookmarkAction addBookmarkAction;
- private PropertyDialogAction propertyDialogAction;
- private NewWizardAction newWizardAction;
-
- public TestNavigatorActionGroup(AdaptedResourceNavigator navigator) {
- this.navigator = navigator;
- }
-
- protected void makeActions() {
- Shell shell = navigator.getSite().getShell();
- addBookmarkAction = new AddBookmarkAction(shell);
- newWizardAction = new NewWizardAction();
- propertyDialogAction =
- new PropertyDialogAction(shell, navigator.getViewer());
- }
-
- /**
- * @see ActionGroup#fillContextMenu(IMenuManager)
- */
- public void fillContextMenu(IMenuManager menu) {
- IStructuredSelection selection = (IStructuredSelection) getContext().getSelection();
-
- MenuManager newMenu =
- new MenuManager(ResourceNavigatorMessages.getString("ResourceNavigator.new")); //$NON-NLS-1$
- menu.add(newMenu);
- new NewWizardMenu(newMenu, navigator.getSite().getWorkbenchWindow(), false);
-
- //Update the selections of those who need a refresh before filling
- addBookmarkAction.selectionChanged(selection);
- menu.add(addBookmarkAction);
-
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- menu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS + "-end")); //$NON-NLS-1$
- menu.add(new Separator());
-
- propertyDialogAction.selectionChanged(selection);
- if (propertyDialogAction.isApplicableForSelection())
- menu.add(propertyDialogAction);
- }
-
- /*
- * @see ActionFactory#fillActionBarMenu(IMenuManager, IStructuredSelection)
- */
- public void fillActionBarMenu(
- IMenuManager menu,
- IStructuredSelection selection) {
- }
-
- /**
- * Updates the global actions with the given selection.
- * Be sure to invoke after actions objects have updated, since can* methods delegate to action objects.
- */
- public void updateGlobalActions(IStructuredSelection selection) {
-
- }
-
- /**
- * Contributes actions to the local tool bar and local pulldown menu.
- * @since 2.0
- */
- public void fillActionBars(IStructuredSelection selection) {
- }
-
- /**
- * Update the selection for new selection.
- */
- public void selectionChanged(IStructuredSelection selection) {}
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ApiTestSuite.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ApiTestSuite.java
deleted file mode 100644
index 5074305..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ApiTestSuite.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Test all areas of the UI API.
- */
-public class ApiTestSuite extends TestSuite {
-
- /**
- * Returns the suite. This is required to
- * use the JUnit Launcher.
- */
- public static Test suite() {
- return new ApiTestSuite();
- }
-
- /**
- * Construct the test suite.
- */
- public ApiTestSuite() {
- addTest(new TestSuite(PlatformUITest.class));
- addTest(new TestSuite(IWorkbenchTest.class));
- addTest(new TestSuite(IWorkbenchWindowTest.class));
- addTest(new TestSuite(IWorkbenchPageTest.class));
- addTest(new TestSuite(IDeprecatedWorkbenchPageTest.class));
- addTest(new TestSuite(IActionFilterTest.class));
- addTest(new TestSuite(IPageListenerTest.class));
- addTest(new TestSuite(IPageServiceTest.class));
- addTest(new TestSuite(IPerspectiveRegistryTest.class));
- addTest(new TestSuite(IPerspectiveDescriptorTest.class));
- addTest(new TestSuite(IFileEditorMappingTest.class));
- addTest(new TestSuite(IEditorDescriptorTest.class));
- addTest(new TestSuite(IEditorRegistryTest.class));
- addTest(new TestSuite(IPerspectiveListenerTest.class));
- addTest(new TestSuite(IWorkbenchWindowActionDelegateTest.class));
- addTest(new TestSuite(IViewActionDelegateTest.class));
- addTest(new TestSuite(IViewSiteTest.class));
- addTest(new TestSuite(IEditorSiteTest.class));
- addTest(new TestSuite(IActionBarsTest.class));
- addTest(new TestSuite(IViewPartTest.class));
- addTest(new TestSuite(IEditorPartTest.class));
- addTest(new TestSuite(IEditorActionBarContributorTest.class));
- addTest(new TestSuite(ISelectionServiceTest.class));
- addTest(new TestSuite(IWorkingSetTest.class));
- addTest(new TestSuite(IWorkingSetManagerTest.class));
- addTest(new TestSuite(MockWorkingSetTest.class));
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/DeprecatedSessionRestoreTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/DeprecatedSessionRestoreTest.java
deleted file mode 100644
index 33c8109..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/DeprecatedSessionRestoreTest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IFile;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.util.EmptyPerspective;
-import org.eclipse.ui.tests.util.UITestCase;
-
-/**
- * SessionRestoreTest runs the second half of our session
- * presistance tests.
- *
-*/
-public class DeprecatedSessionRestoreTest extends UITestCase {
-
- /**
- * Construct an instance.
- */
- public DeprecatedSessionRestoreTest(String arg) {
- super(arg);
- }
-
- /**
- * Generates a session state in the workbench.
- */
- public void testRestoreSession() throws Throwable {
- IWorkbenchWindow [] windows;
- IWorkbenchPage [] pages;
-
- // Get windows.
- windows = fWorkbench.getWorkbenchWindows();
- assertEquals(windows.length, 3);
-
- // First window contains empty perspective.
- pages = windows[0].getPages();
- assertEquals(pages.length, 1);
- assertEquals(pages[0].getPerspective().getId(), EmptyPerspective.PERSP_ID);
-
- // Second window contains empty + session.
- pages = windows[1].getPages();
- assertEquals(pages.length, 2);
- assertEquals(pages[0].getPerspective().getId(), EmptyPerspective.PERSP_ID);
- assertEquals(pages[1].getPerspective().getId(), SessionPerspective.ID);
- testSessionView(pages[1]);
-
- // Third window contains 2 sessions.
- pages = windows[2].getPages();
- assertEquals(pages.length, 2);
- assertEquals(pages[0].getPerspective().getId(), SessionPerspective.ID);
- assertEquals(pages[1].getPerspective().getId(), SessionPerspective.ID);
- testSessionView(pages[0]);
- testSessionView(pages[1]);
-
- // Last page contains 3 editors.
- IEditorPart [] editors = pages[1].getEditors();
- assertEquals(editors.length, 3);
- testSessionEditor(editors[0], SessionCreateTest.TEST_FILE_1);
- testSessionEditor(editors[1], SessionCreateTest.TEST_FILE_2);
- testSessionEditor(editors[2], SessionCreateTest.TEST_FILE_3);
- }
-
- /**
- * Tests the session view within a page.
- */
- private void testSessionView(IWorkbenchPage page) {
- IViewPart view = page.findView(SessionView.VIEW_ID);
- assertNotNull(view);
- SessionView sessionView = (SessionView)view;
- sessionView.testMementoState(this);
- }
-
- /**
- * Tests the state of a session editor.
- */
- private void testSessionEditor(IEditorPart part, String fileName) {
- IEditorSite site = part.getEditorSite();
- assertEquals(site.getId(), MockEditorPart.ID1);
- IEditorInput input = part.getEditorInput();
- assertTrue(input instanceof IFileEditorInput);
- IFile file = ((IFileEditorInput)input).getFile();
- assertEquals(fileName, file.getName());
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IActionBarsTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IActionBarsTest.java
deleted file mode 100644
index 91fcc03..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IActionBarsTest.java
+++ /dev/null
@@ -1,172 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.IStatusLineManager;
-import org.eclipse.jface.action.IToolBarManager;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.util.ActionUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-
-
-/**
- * Test the lifecycle of an action delegate.
- */
-public class IActionBarsTest extends UITestCase {
-
- protected IWorkbenchWindow fWindow;
- protected IWorkbenchPage fPage;
-
- private class MockAction extends Action {
- public boolean hasRun = false;
- public MockAction() {
- super();
- }
- public void run() {
- hasRun = true;
- }
- }
-
- /**
- * Constructor for IActionDelegateTest
- */
- public IActionBarsTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- fWindow = openTestWindow();
- fPage = fWindow.getActivePage();
- }
-
- public void testGetMenuManager() throws Throwable {
- // From Javadoc: "Returns the menu manager."
-
- IViewPart part = fPage.showView(MockViewPart.ID);
- IActionBars bars = part.getViewSite().getActionBars();
- assertNotNull(bars);
- IMenuManager mgr = bars.getMenuManager();
- assertNotNull(mgr);
- }
-
- public void testGetStatusLineManager() throws Throwable {
- // From Javadoc: "Returns the status line manager."
-
- IViewPart part = fPage.showView(MockViewPart.ID);
- IActionBars bars = part.getViewSite().getActionBars();
- assertNotNull(bars);
- IStatusLineManager mgr = bars.getStatusLineManager();
- assertNotNull(mgr);
- }
-
- public void testGetToolBarManager() throws Throwable {
- // From Javadoc: "Returns the tool bar manager."
-
- IViewPart part = fPage.showView(MockViewPart.ID);
- IActionBars bars = part.getViewSite().getActionBars();
- assertNotNull(bars);
- IToolBarManager mgr = bars.getToolBarManager();
- assertNotNull(mgr);
- }
-
- public void testGetGlobalActionHandler() throws Throwable {
- // From Javadoc: "Returns the global action handler for
- // the action with the given id.
-
- IViewPart part = fPage.showView(MockViewPart.ID);
- IActionBars bars = part.getViewSite().getActionBars();
- assertNotNull(bars);
-
- // Get actions. They should all be null.
- assertNull(bars.getGlobalActionHandler(IWorkbenchActionConstants.CUT));
- assertNull(bars.getGlobalActionHandler(IWorkbenchActionConstants.COPY));
- assertNull(bars.getGlobalActionHandler(IWorkbenchActionConstants.UNDO));
-
- // Create actions.
- MockAction cut = new MockAction();
- MockAction copy = new MockAction();
- MockAction undo = new MockAction();
-
- // Set actions.
- bars.setGlobalActionHandler(IWorkbenchActionConstants.CUT, cut);
- bars.setGlobalActionHandler(IWorkbenchActionConstants.COPY, copy);
- bars.setGlobalActionHandler(IWorkbenchActionConstants.UNDO, undo);
- bars.updateActionBars();
-
- // Get actions. They should not be null.
- assertEquals(cut, bars.getGlobalActionHandler(IWorkbenchActionConstants.CUT));
- assertEquals(copy, bars.getGlobalActionHandler(IWorkbenchActionConstants.COPY));
- assertEquals(undo, bars.getGlobalActionHandler(IWorkbenchActionConstants.UNDO));
- }
-
- public void testSetGlobalActionHandler() throws Throwable {
- // From Javadoc: "Returns the global action handler for
- // the action with the given id.
-
- IViewPart part = fPage.showView(MockViewPart.ID);
- IActionBars bars = part.getViewSite().getActionBars();
- assertNotNull(bars);
-
- // Create actions.
- MockAction cut = new MockAction();
- MockAction copy = new MockAction();
- MockAction undo = new MockAction();
-
- // Set actions.
- bars.setGlobalActionHandler(IWorkbenchActionConstants.CUT, cut);
- bars.setGlobalActionHandler(IWorkbenchActionConstants.COPY, copy);
- bars.setGlobalActionHandler(IWorkbenchActionConstants.UNDO, undo);
- bars.updateActionBars();
-
- // Run the real workbench actions.
- // Verify the actions are invoked.
- cut.hasRun = copy.hasRun = undo.hasRun = false;
- ActionUtil.runActionUsingPath(this, fWindow,
- IWorkbenchActionConstants.M_EDIT + '/' + IWorkbenchActionConstants.CUT);
- ActionUtil.runActionUsingPath(this, fWindow,
- IWorkbenchActionConstants.M_EDIT + '/' + IWorkbenchActionConstants.UNDO);
- assertTrue(cut.hasRun);
- assertTrue(!copy.hasRun);
- assertTrue(undo.hasRun);
-
- // Now create a second view and run the actions again.
- // Our global actions should not be invoked.
- fPage.showView(MockViewPart.ID2);
- cut.hasRun = copy.hasRun = undo.hasRun = false;
- ActionUtil.runActionUsingPath(this, fWindow,
- IWorkbenchActionConstants.M_EDIT + '/' + IWorkbenchActionConstants.CUT);
- ActionUtil.runActionUsingPath(this, fWindow,
- IWorkbenchActionConstants.M_EDIT + '/' + IWorkbenchActionConstants.UNDO);
- assertTrue(!cut.hasRun);
- assertTrue(!copy.hasRun);
- assertTrue(!undo.hasRun);
-
- // Reactivate test view and run actions again.
- // This time our global actions should be invoked.
- fPage.activate(part);
- cut.hasRun = copy.hasRun = undo.hasRun = false;
- ActionUtil.runActionUsingPath(this, fWindow,
- IWorkbenchActionConstants.M_EDIT + '/' + IWorkbenchActionConstants.CUT);
- ActionUtil.runActionUsingPath(this, fWindow,
- IWorkbenchActionConstants.M_EDIT + '/' + IWorkbenchActionConstants.UNDO);
- assertTrue(cut.hasRun);
- assertTrue(!copy.hasRun);
- assertTrue(undo.hasRun);
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IActionDelegateTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IActionDelegateTest.java
deleted file mode 100644
index b9b9824..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IActionDelegateTest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.util.UITestCase;
-
-
-/**
- * Test the lifecycle of an action delegate.
- */
-public abstract class IActionDelegateTest extends UITestCase {
-
- protected IWorkbenchWindow fWindow;
- protected IWorkbenchPage fPage;
-
- /**
- * Constructor for IActionDelegateTest
- */
- public IActionDelegateTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- fWindow = openTestWindow();
- fPage = fWindow.getActivePage();
- }
-
- public void testRun() throws Throwable {
- // Create the action.
- Object obj = createActionWidget();
-
- // Run the action delegate.
- // The selectionChanged and run methods should be called, in that order.
- runAction(obj);
- MockActionDelegate delegate = getDelegate();
- assertNotNull(delegate);
- assertTrue(delegate.callHistory.verifyOrder(
- new String[] {"selectionChanged", "run" } ));
- }
-
- public void testSelectionChanged() throws Throwable {
- // Create the delegate by running it.
- Object obj = createActionWidget();
- runAction(obj);
- MockActionDelegate delegate = getDelegate();
- assertNotNull(delegate);
-
- // Fire a selection.
- // The selectionChanged method should be invoked.
- delegate.callHistory.clear();
- fireSelection(obj);
- assertTrue(delegate.callHistory.contains("selectionChanged"));
- }
-
- /**
- * Returns the last mock action delegate which was created.
- */
- protected MockActionDelegate getDelegate() throws Throwable {
- MockActionDelegate delegate = MockActionDelegate.lastDelegate;
- assertNotNull(delegate);
- return delegate;
- }
-
- /**
- * Creates the widget for an action, and adds the action.
- *
- * @returns an object which will be passed to runAction and
- * fireSelection.
- */
- protected abstract Object createActionWidget() throws Throwable;
-
- /**
- * Adds and runs the action delegate. Subclasses should override.
- *
- * @param obj the object returned from createActionWidget.
- */
- protected abstract void runAction(Object widget) throws Throwable;
-
- /**
- * Fires a selection from the source. Subclasses should override.
- *
- * @param obj the object returned from createActionWidget.
- */
- protected abstract void fireSelection(Object widget) throws Throwable;
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IActionFilterTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IActionFilterTest.java
deleted file mode 100644
index 19f674e..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IActionFilterTest.java
+++ /dev/null
@@ -1,176 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.jface.action.MenuManager;
-
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.util.ActionUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-
-/**
- * Test the lifecycle of an action filter.
- *
- * From Javadoc: "An IActionFilter returns whether the specific attribute
- * matches the state of the target object."
- *
- * Setup: The plugin.xml contains a number of popup menu action
- * targetted to ListElements
- *
- * redAction -> (name = red)
- * blueAction -> (name = blue)
- * trueAction -> (flag = true)
- * falseAction -> (flag = false)
- * redTrueAction -> (name = red) (flag = true)
- */
-public class IActionFilterTest extends UITestCase {
-
- protected IWorkbenchWindow fWindow;
- protected IWorkbenchPage fPage;
- protected String STATIC_MENU_VIEW_ID = "org.eclipse.ui.tests.api.IActionFilterTest1";
- protected String DYNAMIC_MENU_VIEW_ID = "org.eclipse.ui.tests.api.IActionFilterTest2";
-
- public IActionFilterTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- fWindow = openTestWindow();
- fPage = fWindow.getActivePage();
- }
-
- public void testStaticLifecycle() throws Throwable {
- testLifecycle(STATIC_MENU_VIEW_ID);
- }
-
- public void testDynamicLifecycle() throws Throwable {
- testLifecycle(DYNAMIC_MENU_VIEW_ID);
- }
-
- /**
- * Select a list element, popup the menu, and verify that the
- * action filter is called.
- *
- * See Setup above.
- */
- private void testLifecycle(String viewId) throws Throwable {
- // Create a list view.
- ListView view = (ListView)fPage.showView(viewId);
-
- // Create the test objects.
- ListElement red = new ListElement("red");
- view.addElement(red);
- view.selectElement(red);
-
- // Get action filter.
- ListElementActionFilter filter = ListElementActionFilter.getSingleton();
-
- // Open menu. Verify that action filter is called.
- MenuManager menuMgr = view.getMenuManager();
- ActionUtil.fireAboutToShow(menuMgr);
- assertTrue(filter.getCalled());
- }
-
- public void testDynamicMenuContribution() throws Throwable {
- testMenu(DYNAMIC_MENU_VIEW_ID);
- }
-
- public void testStaticMenuContribution() throws Throwable {
- testMenu(STATIC_MENU_VIEW_ID);
- }
-
- /**
- * Select a ListElement, popup a menu and verify that the
- * ListElementActionFilter.testAttribute method is invoked.
- * Then verify that the correct actions are added to the
- * popup menu.
- *
- * See Setup above.
- */
- private void testMenu(String viewId) throws Throwable {
- // Create the test objects.
- ListElement red = new ListElement("red");
- ListElement blue = new ListElement("blue");
- ListElement green = new ListElement("green");
- ListElement redTrue = new ListElement("red", true);
-
- // Create a list view.
- ListView view = (ListView)fPage.showView(viewId);
- MenuManager menuMgr = view.getMenuManager();
- view.addElement(red);
- view.addElement(blue);
- view.addElement(green);
- view.addElement(redTrue);
-
- // Get action filter.
- ListElementActionFilter filter = ListElementActionFilter.getSingleton();
-
- // Select red, verify popup.
- view.selectElement(red);
- ActionUtil.fireAboutToShow(menuMgr);
- assertTrue(filter.getCalled());
- assertNotNull(ActionUtil.getActionWithLabel(menuMgr, "redAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "blueAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "trueAction_v1"));
- assertNotNull(ActionUtil.getActionWithLabel(menuMgr, "falseAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "redTrueAction_v1"));
- view.verifyActions(this, menuMgr);
-
- // Select blue, verify popup.
- filter.clearCalled();
- view.selectElement(blue);
- ActionUtil.fireAboutToShow(menuMgr);
- assertTrue(filter.getCalled());
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "redAction_v1"));
- assertNotNull(ActionUtil.getActionWithLabel(menuMgr, "blueAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "trueAction_v1"));
- assertNotNull(ActionUtil.getActionWithLabel(menuMgr, "falseAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "redTrueAction_v1"));
- view.verifyActions(this, menuMgr);
-
- // Select green, verify popup.
- filter.clearCalled();
- view.selectElement(green);
- ActionUtil.fireAboutToShow(menuMgr);
- assertTrue(filter.getCalled());
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "redAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "blueAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "trueAction_v1"));
- assertNotNull(ActionUtil.getActionWithLabel(menuMgr, "falseAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "redTrueAction_v1"));
- view.verifyActions(this, menuMgr);
-
- // Select redTrue, verify popup.
- filter.clearCalled();
- view.selectElement(redTrue);
- ActionUtil.fireAboutToShow(menuMgr);
- assertTrue(filter.getCalled());
- assertNotNull(ActionUtil.getActionWithLabel(menuMgr, "redAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "blueAction_v1"));
- assertNotNull(ActionUtil.getActionWithLabel(menuMgr, "trueAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "falseAction_v1"));
- assertNotNull(ActionUtil.getActionWithLabel(menuMgr, "redTrueAction_v1"));
- view.verifyActions(this, menuMgr);
-
- // Select nothing, verify popup.
- filter.clearCalled();
- view.selectElement(null);
- ActionUtil.fireAboutToShow(menuMgr);
- assertTrue(!filter.getCalled());
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "redAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "blueAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "trueAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "falseAction_v1"));
- assertNull(ActionUtil.getActionWithLabel(menuMgr, "redTrueAction_v1"));
- view.verifyActions(this, menuMgr);
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IConstants.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IConstants.java
deleted file mode 100644
index 0ae0402..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IConstants.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-public interface IConstants {
- public static String FakeID =
- "Is this fake ID for buying beer or getting into a club?",
- FakeLabel =
- "Hmmm. Who's to say this is a fake label? I mean, someday, this can be a real label.",
- UnknownFileName[] =
- {
- "This is not a known file name to the world.with a cool extension",
- "this is not the same as the other.anyways this is a file extension" },
- KnownFileName[] = { "plugin.xml" },
- ProjectName = "JUnitTestingProjectName";
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IDeprecatedWorkbenchPageTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IDeprecatedWorkbenchPageTest.java
deleted file mode 100644
index d56a845..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IDeprecatedWorkbenchPageTest.java
+++ /dev/null
@@ -1,801 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.swt.SWT;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchPage;
-import org.eclipse.ui.internal.registry.IActionSetDescriptor;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.tests.util.ArrayUtil;
-import org.eclipse.ui.tests.util.CallHistory;
-import org.eclipse.ui.tests.util.EmptyPerspective;
-import org.eclipse.ui.tests.util.FileUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-
-public class IDeprecatedWorkbenchPageTest extends UITestCase {
-
- private IWorkbenchPage fActivePage;
- private IWorkbenchWindow fWin;
- private IWorkbenchPart partMask;
- private IProject proj;
-
- public IDeprecatedWorkbenchPageTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- fWin = openTestWindow();
- fActivePage = fWin.getActivePage();
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- if (proj != null) {
- try {
- FileUtil.deleteProject(proj);
- } catch (Throwable e) {
- fail();
- }
- proj = null;
- }
- }
-
- /**
- * tests both of the following:
- * setEditorAreaVisible()
- * isEditorAreaVisible()
- */
- public void testGet_SetEditorAreaVisible() throws Throwable {
- fActivePage.setEditorAreaVisible(true);
- assertTrue(fActivePage.isEditorAreaVisible() == true);
-
- fActivePage.setEditorAreaVisible(false);
- assertTrue(fActivePage.isEditorAreaVisible() == false);
- }
-
- public void testGetPerspective() throws Throwable {
- assertNotNull(fActivePage.getPerspective());
-
- IWorkbenchPage page =
- fWin.openPage(EmptyPerspective.PERSP_ID, ResourcesPlugin.getWorkspace());
- assertEquals(EmptyPerspective.PERSP_ID, page.getPerspective().getId());
- }
-
- public void testSetPerspective() throws Throwable {
- IPerspectiveDescriptor per =
- PlatformUI.getWorkbench().getPerspectiveRegistry().findPerspectiveWithId(
- EmptyPerspective.PERSP_ID);
- fActivePage.setPerspective(per);
- assertEquals(per, fActivePage.getPerspective());
- }
-
- public void testGetLabel() {
- assertNotNull(fActivePage.getLabel());
- }
-
- public void testGetInput() throws Throwable {
- IAdaptable input = ResourcesPlugin.getWorkspace();
- IWorkbenchPage page = fWin.openPage(input);
- assertEquals(input, page.getInput());
- }
-
- public void testActivate() throws Throwable {
- MockViewPart part = (MockViewPart) fActivePage.showView(MockViewPart.ID);
- MockViewPart part2 = (MockViewPart) fActivePage.showView(MockViewPart.ID2);
-
- MockPartListener listener = new MockPartListener();
- fActivePage.addPartListener(listener);
- fActivePage.activate(part);
-
- CallHistory callTrace;
-
- callTrace = part2.getCallHistory();
- callTrace.clear();
- fActivePage.activate(part2);
- assertTrue(callTrace.contains("setFocus"));
- assertTrue(listener.getCallHistory().contains("partActivated"));
-
- callTrace = part.getCallHistory();
- callTrace.clear();
- fActivePage.activate(part);
- assertTrue(callTrace.contains("setFocus"));
- assertTrue(listener.getCallHistory().contains("partActivated"));
- }
-
- public void testBringToTop() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- IEditorPart part = fActivePage.openEditor(FileUtil.createFile("a.mock1", proj));
- IEditorPart part2 =
- fActivePage.openEditor(FileUtil.createFile("b.mock1", proj));
-
- MockPartListener listener = new MockPartListener();
- fActivePage.addPartListener(listener);
- CallHistory callTrace = listener.getCallHistory();
-
- //at this point, part2 is active
- fActivePage.bringToTop(part);
- assertEquals(callTrace.contains("partBroughtToTop"), true);
-
- callTrace.clear();
- fActivePage.bringToTop(part2);
- assertEquals(callTrace.contains("partBroughtToTop"), true);
- }
-
- public void testGetWorkbenchWindow() {
-/*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- assertEquals(fActivePage.getWorkbenchWindow(), fWin);
- IWorkbenchPage page = openTestPage(fWin);
- assertEquals(page.getWorkbenchWindow(), fWin);
-*/
- }
-
- public void testShowView() throws Throwable {
- /*
- javadoc: Shows a view in this page and give it focus
- */
- MockViewPart view = (MockViewPart) fActivePage.showView(MockViewPart.ID);
- assertNotNull(view);
- assertTrue(
- view.getCallHistory().verifyOrder(
- new String[] { "init", "createPartControl", "setFocus" }));
-
- fActivePage.showView(MockViewPart.ID2 );
-
- /*
- javadoc: If the view is already visible, it is given focus
- */
- CallHistory callTrace = view.getCallHistory();
- callTrace.clear();
- assertEquals(fActivePage.showView(MockViewPart.ID), view );
- assertEquals(callTrace.contains( "setFocus" ), true );
- }
-
- /**
- * openEditor(IFile input)
- */
- public void testOpenEditor() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
-
- /*
- javadoc: 1. 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
- */
- IFile file = FileUtil.createFile("test.mock1", proj);
- IEditorPart editor = fActivePage.openEditor(file);
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(editor.getSite().getId(),
- fWorkbench.getEditorRegistry().getDefaultEditor(file).getId());
-
- /*
- javadoc: 2. 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.
- */
- //can not be tested
-
- /*
- javadoc: 3. If all else fails the file will be opened in a default text editor.
- */
- // PR 1GkD5O0 - Fails on linux
- String platform = SWT.getPlatform();
- if (!platform.equals("motif")) {
- file = FileUtil.createFile("a.null and void", proj);
- editor = fActivePage.openEditor(file);
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(editor.getSite().getId(), "org.eclipse.ui.DefaultTextEditor");
- }
-
- //open another editor to take the focus away from the first editor
- fActivePage.openEditor(FileUtil.createFile("test.mock2", proj));
-
- /*
- javadoc: If this page already has an editor open on the target object that editor is activated
- */
- //open the editor second time.
- assertEquals(editor, fActivePage.openEditor(file));
- assertEquals(editor, fActivePage.getActiveEditor());
- }
-
- /**
- * openEditor(IFile input, String editorID)
- */
- public void testOpenEditor2() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- final IFile file = FileUtil.createFile("asfasdasdf", proj);
- final String id = MockEditorPart.ID1;
-
- /*
- javadoc: The editor type is determined by mapping editorId to an editor extension registered with the workbench.
- */
- IEditorPart editor = fActivePage.openEditor(file, id);
- assertEquals(editor.getSite().getId(), id);
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
-
- //open another editor to take the focus away from the first editor
- fActivePage.openEditor(FileUtil.createFile("test.mock2", proj));
-
- /*
- javadoc: If this page already has an editor open on the target object that editor is activated
- */
- //open the first editor second time.
- assertEquals(fActivePage.openEditor(file, id), editor);
- assertEquals(fActivePage.getActiveEditor(), editor);
- }
-
- /**
- * openEditor(IEditorInput input,String editorId)
- */
- public void testOpenEditor3() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- final String id = MockEditorPart.ID1;
- IEditorInput input =
- new FileEditorInput(FileUtil.createFile("test.mock1", proj));
-
- /*
- javadoc: The editor type is determined by mapping editorId to an editor extension registered with the workbench
- */
- IEditorPart editor = fActivePage.openEditor(input, id);
- assertEquals(editor.getEditorInput(), input);
- assertEquals(editor.getSite().getId(), id);
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
-
- //open another editor to take the focus away from the first editor
- fActivePage.openEditor(FileUtil.createFile("test.mock2", proj));
-
- /*
- javadoc: If this page already has an editor open on the target object that editor is activated
- */
- //open the first editor second time.
- assertEquals(fActivePage.openEditor(input, id), editor);
- assertEquals(fActivePage.getActiveEditor(), editor);
- }
-
- /**
- * openEditor(IEditorInput input, String editorId, boolean activate)
- */
- public void testOpenEditor4() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- final String id = MockEditorPart.ID1;
- IEditorInput input =
- new FileEditorInput(FileUtil.createFile("test.mock1", proj));
- MockPartListener listener = new MockPartListener();
- fActivePage.addPartListener(listener);
- CallHistory callTrace = listener.getCallHistory();
-
- /*
- javadoc: The editor type is determined by mapping editorId to an editor extension
- registered with the workbench.
- javadoc: If activate == true the editor will be activated
- */
- //open an editor with activation
- IEditorPart editor = fActivePage.openEditor(input, id, true);
- assertEquals(editor.getEditorInput(), input);
- assertEquals(editor.getSite().getId(), id);
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(callTrace.contains( "partActivated"), true);
-
- //we need another editor so that the editor under test can receive events.
- //otherwise, events will be ignored.
- IEditorPart extra = fActivePage.openEditor(FileUtil.createFile("aaaaa", proj));
-
- //close the first editor after the second has opened; necessary for
- //test to work with fix to PR 7743
- fActivePage.closeEditor(editor, false);
-
- //open an editor without activation
- callTrace.clear();
- editor = fActivePage.openEditor(input, id, false);
- assertEquals(editor.getEditorInput(), input);
- assertEquals(editor.getSite().getId(), id);
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editor), true);
- assertEquals(callTrace.contains( "partActivated"), false);
- assertEquals(callTrace.contains( "partBroughtToTop"), true);
-
- fActivePage.activate(extra);
-
- /*
- javadoc: If this page already has an editor open on the target object that editor is brought to the front
- */
- //open the editor under test second time without activation
- callTrace.clear();
- assertEquals(fActivePage.openEditor(input, id, false), editor);
- assertEquals(callTrace.contains( "partBroughtToTop"), true);
- assertEquals(callTrace.contains( "partActivated"), false);
-
- //activate the other editor
- fActivePage.activate(extra);
-
- /*
- javadoc: If activate == true the editor will be activated
- */
- //open the editor under test second time with activation
- callTrace.clear();
- assertEquals(fActivePage.openEditor(input, id, true), editor);
- assertEquals(callTrace.contains( "partBroughtToTop"), true);
- assertEquals(callTrace.contains( "partActivated"), true);
- }
-
- /**
- * openEditor(IMarker marker)
- */
- public void testOpenEditor5() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- IMarker marker =
- FileUtil.createFile("aa.mock2", proj).createMarker(IMarker.TASK);
- CallHistory callTrace;
-
- /*
- javadoc: the cursor and selection state of the editor is then updated from information
- recorded in the marker.
- */
- //open the registered editor for the marker resource
- IEditorPart editor = fActivePage.openEditor(marker);
- callTrace = ((MockEditorPart) editor).getCallHistory();
- assertEquals(editor.getSite().getId(), MockEditorPart.ID2);
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(callTrace.contains( "gotoMarker"), true);
- fActivePage.closeEditor(editor, false);
-
- /*
- javadoc: If the marker contains an EDITOR_ID_ATTR attribute the attribute value will be used to
- determine the editor type to be opened
- */
- marker.setAttribute(IWorkbenchPage.EDITOR_ID_ATTR, MockEditorPart.ID1);
- editor = fActivePage.openEditor(marker);
- callTrace = ((MockEditorPart) editor).getCallHistory();
- assertEquals(editor.getSite().getId(), MockEditorPart.ID1);
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(callTrace.contains( "gotoMarker"), true);
- //do not close the editor this time
-
- /*
- javdoc: If this page already has an editor open on the target object that editor is activated
- */
- callTrace.clear();
- assertEquals(fActivePage.openEditor(marker), editor);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(callTrace.contains( "gotoMarker"), true);
- fActivePage.closeEditor(editor, false);
- }
-
- /**
- * openEditor(IMarker marker, boolean activate)
- */
- public void testOpenEditor6() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- IMarker marker =
- FileUtil.createFile("aa.mock2", proj).createMarker(IMarker.TASK);
- MockPartListener listener = new MockPartListener();
- fActivePage.addPartListener(listener);
- CallHistory listenerCall = listener.getCallHistory();
- CallHistory editorCall;
-
- //we need another editor so that the editor under test can receive events.
- //otherwise, events will be ignored.
- IEditorPart extra = fActivePage.openEditor(FileUtil.createFile("aaaaa", proj));
-
- /*
- javadoc: If activate == true the editor will be activated
- */
- //open the registered editor for the marker resource with activation
- IEditorPart editor = fActivePage.openEditor(marker, true);
- editorCall = ((MockEditorPart) editor).getCallHistory();
- assertEquals(editor.getSite().getId(), MockEditorPart.ID2);
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
-
- /*
- javadoc: the cursor and selection state of the editor is then updated from information
- recorded in the marker.
- */
- assertEquals(editorCall.contains( "gotoMarker"), true);
- fActivePage.closeEditor(editor, false);
-
- fActivePage.activate(extra);
-
- //open the registered editor for the marker resource without activation
- listenerCall.clear();
- editor = fActivePage.openEditor(marker, false);
- editorCall = ((MockEditorPart) editor).getCallHistory();
- assertEquals(editor.getSite().getId(), MockEditorPart.ID2);
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editor), true);
- assertEquals(listenerCall.contains( "partBroughtToTop"), true);
- assertEquals(listenerCall.contains( "partActivated"), false);
- assertEquals(editorCall.contains( "gotoMarker"), true);
- fActivePage.closeEditor(editor, false);
-
- /*
- javadoc: If the marker contains an EDITOR_ID_ATTR attribute the attribute value will be used to
- determine the editor type to be opened
- */
- String id = MockEditorPart.ID1;
- marker.setAttribute(IWorkbenchPage.EDITOR_ID_ATTR, id);
-
- //open an editor with activation
- listenerCall.clear();
-
- editor = fActivePage.openEditor(marker, true);
- editorCall = ((MockEditorPart) editor).getCallHistory();
- assertEquals(editor.getSite().getId(), id);
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(editorCall.contains( "gotoMarker"), true);
- fActivePage.closeEditor(editor, false);
-
- fActivePage.activate(extra);
-
- //open an editor without activation
- listenerCall.clear();
- editor = fActivePage.openEditor(marker, false);
- editorCall = ((MockEditorPart) editor).getCallHistory();
- assertEquals(editor.getSite().getId(), id);
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editor), true);
- assertEquals(editorCall.contains( "gotoMarker"), true);
- assertEquals(listenerCall.contains( "partActivated"), false);
- assertEquals(listenerCall.contains( "partBroughtToTop"), true);
- //do not close the editor this time
-
- fActivePage.activate(extra);
-
- /*
- javadoc: If this page already has an editor open on the target object that editor is brought to front
- */
- //open the editor second time without activation
- listenerCall.clear();
- assertEquals(fActivePage.openEditor(marker, false), editor);
- assertEquals(listenerCall.contains( "partBroughtToTop"), true);
- assertEquals(listenerCall.contains( "partActivated"), false);
-
- fActivePage.activate(extra);
-
- /*
- javdoc: If activate == true the editor will be activated
- */
- //open the editor second time with activation
- listenerCall.clear();
- assertEquals(fActivePage.openEditor(marker, true), editor);
- assertEquals(editorCall.contains( "gotoMarker"), true);
- assertEquals(listenerCall.contains( "partBroughtToTop"), true);
- assertEquals(listenerCall.contains( "partActivated"), true);
- }
-
- public void testFindView() throws Throwable {
- String id = MockViewPart.ID3;
- //id of valid, but not open view
- assertNull(fActivePage.findView(id));
-
- IViewPart view = fActivePage.showView(id);
- assertEquals(fActivePage.findView(id), view);
-
- //close view
- fActivePage.hideView(view);
- assertNull(fActivePage.findView(id));
- }
-
- public void testGetViews() throws Throwable {
- int totalBefore = fActivePage.getViews().length;
-
- IViewPart view = fActivePage.showView(MockViewPart.ID2);
- assertEquals(ArrayUtil.contains(fActivePage.getViews(), view), true);
- assertEquals(fActivePage.getViews().length, totalBefore + 1);
-
- fActivePage.hideView(view);
- assertEquals(ArrayUtil.contains(fActivePage.getViews(), view), false);
- assertEquals(fActivePage.getViews().length, totalBefore);
- }
-
- public void testHideView() throws Throwable {
- IViewPart view = fActivePage.showView(MockViewPart.ID3);
-
- fActivePage.hideView(view);
- CallHistory callTrace = ((MockViewPart) view).getCallHistory();
- assertTrue(callTrace.contains( "dispose"));
- }
-
- public void testClose() throws Throwable {
- IWorkbenchPage page = openTestPage(fWin);
-
- proj = FileUtil.createProject("testOpenEditor");
- final IFile file = FileUtil.createFile("aaa.mock1", proj);
- IEditorPart editor = page.openEditor(file);
- CallHistory callTrace = ((MockEditorPart) editor).getCallHistory();
- callTrace.clear();
-
- /*
- javadoc: If the page has open editors with unsaved content and save is true, the user will be given the opportunity to save them
- */
- assertEquals(page.close(), true);
- assertEquals(
- callTrace.verifyOrder(new String[] { "isDirty", "dispose" }),
- true);
- assertEquals(fWin.getActivePage(), fActivePage);
- }
-
- public void testCloseEditor() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- final IFile file = FileUtil.createFile("test.mock1", proj);
- IEditorPart editor;
- CallHistory callTrace;
- MockEditorPart mock;
-
- /*
- javadoc: Parameters: save - true to save the editor contents if required (recommended)
- */
- //create a clean editor that needs to be saved on closing
- editor = fActivePage.openEditor(file);
- mock = (MockEditorPart) editor;
- mock.setSaveNeeded(true);
- callTrace = mock.getCallHistory();
- callTrace.clear();
- //close the editor with save confirmation
- assertEquals( fActivePage.closeEditor(editor, true), true );
- assertEquals(
- callTrace.verifyOrder(
- new String[] { "isDirty", "dispose" }),
- true);
-
- /*
- javadoc: If the editor has unsaved content and save is true, the user will be given the opportunity to save it.
- */
- //can't be tested
-
- /*
- javadoc: Parameters: save - false to discard any unsaved changes
- */
- //create a dirty editor
- editor = fActivePage.openEditor(file);
- mock = (MockEditorPart) editor;
- mock.setDirty(true);
- mock.setSaveNeeded(true);
- callTrace = mock.getCallHistory();
- callTrace.clear();
- //close the editor and discard changes
- assertEquals( fActivePage.closeEditor(editor, false), true );
- assertEquals(callTrace.contains( "isSaveOnCloseNeeded"), false);
- /*
- * It is possible that some action may query the isDirty value of
- * the editor to update its enabled state. There is nothing wrong
- * in doing that, so do not test for no isDirty call here.
- *
- * assertEquals(callTrace.contains( "isDirty"), false);
- */
- assertEquals(callTrace.contains( "doSave"), false);
- assertEquals(callTrace.contains( "dispose"), true);
- }
-
- public void testCloseAllEditors() throws Throwable
- {
- int total = 5;
- final IFile[] files = new IFile[total];
- IEditorPart[] editors = new IEditorPart[total];
- CallHistory[] callTraces = new CallHistory[total];
- MockEditorPart[] mocks = new MockEditorPart[total];
-
- proj = FileUtil.createProject("testOpenEditor");
- for (int i = 0; i < total; i++)
- files[i] = FileUtil.createFile(i + ".mock2", proj);
-
- /*
- javadoc: If the page has open editors with unsaved content and save is true, the user will be given the opportunity to save them.
- */
- //close all clean editors with confirmation
- for( int i = 0; i < total; i ++ ){
- editors[i] = fActivePage.openEditor(files[i]);
- callTraces[i] = ((MockEditorPart)editors[i]).getCallHistory();
- }
- assertEquals(fActivePage.closeAllEditors(true), true);
- for (int i = 0; i < total; i++) {
- assertEquals(callTraces[i].contains( "isDirty"), true);
- assertEquals(callTraces[i].contains( "doSave"), false);
- callTraces[i].clear();
- }
-
- //close all dirty editors with confirmation
- //can't be tested
-
- //close all dirty editors discarding them
- for( int i = 0; i < total; i ++ ){
- editors[i] = fActivePage.openEditor(files[i]);
- mocks[i] = (MockEditorPart) editors[i];
- mocks[i].setDirty(true);
- callTraces[i] = mocks[i].getCallHistory();
- }
- assertEquals(fActivePage.closeAllEditors(false), true);
- for (int i = 0; i < total; i++) {
- assertEquals(callTraces[i].contains("doSave"), false);
- }
- }
-
- public void testSaveEditor() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- final IFile file = FileUtil.createFile("test.mock1", proj);
- IEditorPart editor;
- CallHistory callTrace;
- MockEditorPart mock;
-
- //create a clean editor
- editor = fActivePage.openEditor(file);
- mock = (MockEditorPart) editor;
- callTrace = mock.getCallHistory();
- callTrace.clear();
-
- /*
- javadoc: Saves the contents of the given editor if dirty.
- If not, this method returns without effect
- */
- //save the clean editor with confirmation
- assertEquals(fActivePage.saveEditor(editor, true), true);
- assertEquals(callTrace.contains("isDirty"), true);
- assertEquals(callTrace.contains("doSave"), false);
-
- /*
- javadoc: If confirm is true the user is prompted to confirm the command.
- */
- //can't be tested
-
- /*
- javadoc: Otherwise, the save happens without prompt.
- */
- //save the clean editor without confirmation
- assertEquals(fActivePage.saveEditor(editor, false), true);
- assertEquals(callTrace.contains( "isDirty"), true);
- assertEquals(callTrace.contains("doSave"), false);
-
- //save the dirty editor without confirmation
- mock.setDirty(true);
- callTrace.clear();
- assertEquals(fActivePage.saveEditor(editor, false), true);
- assertEquals(
- callTrace.verifyOrder(new String[] { "isDirty", "doSave" }),
- true);
- }
-
- public void testSaveAllEditors() throws Throwable {
- int total = 3;
-
- final IFile[] files = new IFile[total];
- IEditorPart[] editors = new IEditorPart[total];
- CallHistory[] callTraces = new CallHistory[total];
- MockEditorPart[] mocks = new MockEditorPart[total];
-
- proj = FileUtil.createProject("testOpenEditor");
- for (int i = 0; i < total; i++) {
- files[i] = FileUtil.createFile(i + ".mock2", proj);
- editors[i] = fActivePage.openEditor(files[i]);
- mocks[i] = (MockEditorPart) editors[i];
- callTraces[i] = mocks[i].getCallHistory();
- }
-
- /*
- javadoc: If there are no dirty editors this method returns without effect.
- javadoc: If confirm is true the user is prompted to confirm the command
- */
- //save all clean editors with confirmation
- assertEquals(fActivePage.saveAllEditors(true), true);
- for (int i = 0; i < total; i++) {
- assertEquals(callTraces[i].contains( "isDirty"), true);
- assertEquals(callTraces[i].contains( "doSave"), false);
- callTraces[i].clear();
- }
-
- //save all dirty editors with confirmation can't be tested
-
- /*
- javadoc: Parameters: confirm - false to save unsaved changes without asking
- */
- //save all clean editors without confirmation
- assertEquals(fActivePage.saveAllEditors(false), true);
- for (int i = 0; i < total; i++) {
- assertEquals(callTraces[i].contains( "isDirty"), true);
- assertEquals(callTraces[i].contains( "doSave"), false);
- callTraces[i].clear();
- }
-
- //save all dirty editors without confirmation
- for (int i = 0; i < total; i++)
- mocks[i].setDirty(true);
- assertEquals(fActivePage.saveAllEditors(false), true);
- for (int i = 0; i < total; i++)
- assertEquals(
- callTraces[i].verifyOrder(new String[] { "isDirty", "doSave" }),
- true);
- }
-
- public void testGetEditors() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- int totalBefore = fActivePage.getEditors().length;
- int num = 3;
- IEditorPart[] editors = new IEditorPart[num];
-
- for (int i = 0; i < num; i++) {
- editors[i] = fActivePage.openEditor(FileUtil.createFile(i + ".mock2", proj));
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editors[i]), true);
- }
- assertEquals(fActivePage.getEditors().length, totalBefore + num);
-
- fActivePage.closeEditor(editors[0], false);
- assertEquals(ArrayUtil.contains(fActivePage.getEditors(), editors[0]), false);
- assertEquals(fActivePage.getEditors().length, totalBefore + num - 1);
-
- fActivePage.closeAllEditors(false);
- assertEquals(fActivePage.getEditors().length, 0);
- }
-
- public void testShowActionSet() {
- String id = MockActionDelegate.ACTION_SET_ID;
- WorkbenchPage page = (WorkbenchPage) fActivePage;
-
- int totalBefore = page.getActionSets().length;
- fActivePage.showActionSet(id);
-
- IActionSetDescriptor[] sets = ((WorkbenchPage) fActivePage).getActionSets();
- boolean found = false;
- for (int i = 0; i < sets.length; i++)
- if (id.equals(sets[i].getId()))
- found = true;
- assertEquals(found, true);
-
- //check that the method does not add an invalid action set to itself
- id = IConstants.FakeID;
- fActivePage.showActionSet(id);
-
- sets = ((WorkbenchPage) fActivePage).getActionSets();
- found = false;
- for (int i = 0; i < sets.length; i++)
- if (id.equals(sets[i].getId()))
- found = true;
- assertEquals(found, false);
- assertEquals(page.getActionSets().length, totalBefore + 1);
- }
-
- public void testHideActionSet() {
- WorkbenchPage page = (WorkbenchPage) fActivePage;
- int totalBefore = page.getActionSets().length;
-
- String id = MockWorkbenchWindowActionDelegate.SET_ID;
- fActivePage.showActionSet( id );
- assertEquals(page.getActionSets().length, totalBefore + 1);
-
- fActivePage.hideActionSet(id );
- assertEquals(page.getActionSets().length, totalBefore );
-
- IActionSetDescriptor[] sets = page.getActionSets();
- boolean found = false;
- for (int i = 0; i < sets.length; i++)
- if (id.equals(sets[i].getId()))
- found = true;
- assertEquals(found, false);
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorActionBarContributorTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorActionBarContributorTest.java
deleted file mode 100644
index a1cb233..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorActionBarContributorTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.util.CallHistory;
-import org.eclipse.ui.tests.util.FileUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-
-/**
- * This is a test for IEditorPart. Since IEditorPart is an
- * interface this test verifies the IEditorPart lifecycle rather
- * than the implementation.
- */
-public class IEditorActionBarContributorTest extends UITestCase {
-
- protected IWorkbenchWindow fWindow;
- protected IWorkbenchPage fPage;
- private String EDITOR_ID = "org.eclipse.ui.tests.api.IEditorActionBarContributorTest";
-
- /**
- * Constructor for IEditorPartTest
- */
- public IEditorActionBarContributorTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- fWindow = openTestWindow();
- fPage = fWindow.getActivePage();
- }
-
- public void testInit() throws Throwable {
- // From javadoc: "Initializes this contributor, which is expected to
- // add contributions as required to the given action bars and global
- // action handlers."
-
- // Open a part.
- MockEditorPart part = openEditor(fPage, "1");
-
- // Get contributor and verify call history.
- MockEditorActionBarContributor contributor =
- (MockEditorActionBarContributor)part.getEditorSite().getActionBarContributor();
- CallHistory history = contributor.getCallHistory();
- assertTrue(history.verifyOrder(new String[] {
- "init", "setActiveEditor"}));
- assertEquals(part, contributor.getActiveEditor());
-
- // Close the part.
- fPage.closeAllEditors(false);
- }
-
- public void testSetActiveEditor() throws Throwable {
- // From javadoc: "Sets the active editor for the contributor."
-
- // Open an editor.
- MockEditorPart part = openEditor(fPage, "X");
-
- // Get contributor and verify call history.
- MockEditorActionBarContributor contributor =
- (MockEditorActionBarContributor)
- part.getEditorSite().getActionBarContributor();
- CallHistory history = contributor.getCallHistory();
- assertTrue(history.verifyOrder(new String[] {
- "init", "setActiveEditor" }));
- assertEquals(part, contributor.getActiveEditor());
-
- // Open a few more and verify setActiveEditor.
- int editorCount = 5;
- MockEditorPart [] parts = new MockEditorPart[editorCount];
- for (int nX = 0; nX < editorCount; nX ++) {
- history.clear();
- parts[nX] = openEditor(fPage, Integer.toString(nX));
- assertTrue(history.verifyOrder(new String[] {
- "setActiveEditor" }));
- assertEquals(parts[nX], contributor.getActiveEditor());
- }
-
- // Activate the parts and verify setActiveEditor.
- for (int nX = 0; nX < editorCount; nX ++) {
- history.clear();
- fPage.activate(parts[nX]);
- assertTrue(history.verifyOrder(new String[] {
- "setActiveEditor" }));
- assertEquals(parts[nX], contributor.getActiveEditor());
- }
-
- // Close the parts.
- fPage.closeAllEditors(false);
- }
-
- /**
- * @see IWorkbenchPartTest#openPart(IWorkbenchPage)
- */
- protected MockEditorPart openEditor(IWorkbenchPage page, String suffix)
- throws Throwable
- {
- IProject proj = FileUtil.createProject("IEditorActionBarContributorTest");
- IFile file = FileUtil.createFile("test" + suffix + ".txt", proj);
- return (MockEditorPart)page.openEditor(file, EDITOR_ID);
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorActionDelegateTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorActionDelegateTest.java
deleted file mode 100644
index 7367016..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorActionDelegateTest.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-
-import org.eclipse.jface.action.IMenuManager;
-
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.tests.util.ActionUtil;
-import org.eclipse.ui.tests.util.FileUtil;
-
-
-/**
- * Tests the lifecycle for an editor action delegate.
- */
-public class IEditorActionDelegateTest extends IActionDelegateTest {
-
- public static String EDITOR_ID = "org.eclipse.ui.tests.api.IEditorActionDelegateTest";
- private MockEditorPart editor;
-
- /**
- * Constructor for IWorkbenchWindowActionDelegateTest
- */
- public IEditorActionDelegateTest(String testName) {
- super(testName);
- }
-
- public void testSetActiveEditor() throws Throwable {
- // When an action delegate is run the
- // setActiveEditor, selectionChanged, and run methods should
- // be called, in that order.
-
- // Run the action.
- testRun();
-
- // Verify lifecycle.
- MockActionDelegate delegate = getDelegate();
- assertNotNull(delegate);
- assertTrue(delegate.callHistory.verifyOrder(
- new String [] {"setActiveEditor", "selectionChanged", "run"}));
- }
-
- /**
- * @see IActionDelegateTest#createActionWidget()
- */
- protected Object createActionWidget() throws Throwable {
- editor = openEditor(fPage, "X");
- return editor;
- }
-
- /**
- * @see IActionDelegateTest#runAction()
- */
- protected void runAction(Object widget) throws Throwable {
- MockEditorPart editor = (MockEditorPart)widget;
- MockEditorActionBarContributor contributor =
- (MockEditorActionBarContributor)
- editor.getEditorSite().getActionBarContributor();
- IMenuManager mgr = contributor.getActionBars().getMenuManager();
- ActionUtil.runActionWithLabel(this, mgr, "Mock Action");
- }
-
- /**
- * @see IActionDelegateTest#fireSelection()
- */
- protected void fireSelection(Object widget) throws Throwable {
- MockEditorPart editor = (MockEditorPart)widget;
- editor.fireSelection();
- }
-
- protected MockEditorPart openEditor(IWorkbenchPage page, String suffix)
- throws Throwable
- {
- IProject proj = FileUtil.createProject("IEditorActionDelegateTest");
- IFile file = FileUtil.createFile("test" + suffix + ".txt", proj);
- return (MockEditorPart)page.openEditor(file, EDITOR_ID);
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorDescriptorTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorDescriptorTest.java
deleted file mode 100644
index b4709e4..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorDescriptorTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import junit.framework.TestCase;
-
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IFileEditorMapping;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.tests.util.ArrayUtil;
-
-public class IEditorDescriptorTest extends TestCase {
- IEditorDescriptor[] fEditors;
-
- public IEditorDescriptorTest( String testName )
- {
- super( testName );
- }
-
- public void setUp()
- {
- IFileEditorMapping mapping = ( IFileEditorMapping )ArrayUtil.pickRandom(
- PlatformUI.getWorkbench().getEditorRegistry().getFileEditorMappings()
- );
- fEditors = mapping.getEditors();
- }
-
- public void testGetId() throws Throwable
- {
- for( int i = 0; i < fEditors.length; i ++ )
- assertNotNull( fEditors[ i ].getId() );
- }
-
- public void testGetImageDescriptor() throws Throwable
- {
- for( int i = 0; i < fEditors.length; i ++ )
- assertNotNull( fEditors[ i ].getImageDescriptor() );
- }
-
- public void testGetLabel() throws Throwable
- {
- for( int i = 0; i < fEditors.length; i ++ )
- assertNotNull( fEditors[ i ].getLabel() );
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorLauncherTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorLauncherTest.java
deleted file mode 100644
index 89fd026..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorLauncherTest.java
+++ /dev/null
@@ -1,15 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-public class IEditorLauncherTest {
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorPartTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorPartTest.java
deleted file mode 100644
index 568ecd5..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorPartTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.tests.util.FileUtil;
-
-/**
- * This is a test for IEditorPart. Since IEditorPart is an
- * interface this test verifies the IEditorPart lifecycle rather
- * than the implementation.
- */
-public class IEditorPartTest extends IWorkbenchPartTest {
-
- /**
- * Constructor for IEditorPartTest
- */
- public IEditorPartTest(String testName) {
- super(testName);
- }
-
- /**
- * @see IWorkbenchPartTest#openPart(IWorkbenchPage)
- */
- protected MockWorkbenchPart openPart(IWorkbenchPage page) throws Throwable {
- IProject proj = FileUtil.createProject("IEditorPartTest");
- IFile file = FileUtil.createFile("IEditorPartTest.txt", proj);
- return (MockWorkbenchPart)page.openEditor(file, MockEditorPart.ID1);
- }
-
- /**
- * @see IWorkbenchPartTest#closePart(IWorkbenchPage, MockWorkbenchPart)
- */
- protected void closePart(IWorkbenchPage page, MockWorkbenchPart part)
- throws Throwable
- {
- page.closeEditor((IEditorPart)part, false);
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorRegistryTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorRegistryTest.java
deleted file mode 100644
index 476c896..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorRegistryTest.java
+++ /dev/null
@@ -1,284 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IFileEditorMapping;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.registry.EditorRegistry;
-import org.eclipse.ui.internal.registry.FileEditorMapping;
-import org.eclipse.ui.tests.util.ArrayUtil;
-import org.eclipse.ui.tests.util.CallHistory;
-import org.eclipse.ui.tests.util.FileUtil;
-
-public class IEditorRegistryTest extends TestCase {
- private IEditorRegistry fReg;
- private IProject proj;
-
- public IEditorRegistryTest( String testName )
- {
- super( testName );
- }
-
- public void setUp()
- {
- fReg = PlatformUI.getWorkbench().getEditorRegistry();
- }
-
- public void tearDown()
- {
- if( proj != null ){
- try{
- FileUtil.deleteProject( proj );
- }catch( CoreException e )
- {
- fail();
- }
- }
- }
-
- public void testGetFileEditorMappings()
- {
- assertTrue( ArrayUtil.checkNotNull( fReg.getFileEditorMappings() ) );
- }
-
- /**
- * tests both of the following:
- * IEditorDescriptor[] getEditors(IFile file)
- * IEditorDescriptor[] getEditors(String filename)
- */
- public void testGetEditors() throws Throwable
- {
- IEditorDescriptor[] editors, editors2;
- String[][] maps = {
- {"a.mock1", MockEditorPart.ID1 },
- {"b.mock2", MockEditorPart.ID2 }
- };
-
- proj = FileUtil.createProject("testProject");
-
- for( int i = 0; i < maps.length; i ++ ){
- editors = fReg.getEditors( maps[i][0] );
- assertEquals( editors.length, 1 );
- assertEquals( editors[ 0 ].getId(), maps[i][1] );
- editors2 = fReg.getEditors( FileUtil.createFile( maps[i][0], proj ) );
- assertEquals( ArrayUtil.equals( editors, editors2 ), true );
- }
-
- //there is no matching editor
- String fileName = IConstants.UnknownFileName[0];
- editors = fReg.getEditors( fileName );
- assertEquals( editors.length, 0 );
- editors = fReg.getEditors( FileUtil.createFile( fileName, proj ));
- assertEquals( editors.length, 0 );
- }
-
- public void testFindEditor()
- {
- String id = MockEditorPart.ID1;
- IEditorDescriptor editor = fReg.findEditor( id );
- assertEquals( editor.getId(), id );
-
- //editor is not found
- id = IConstants.FakeID;
- editor = fReg.findEditor( id );
- assertNull( editor );
- }
-
- /**
- * getDefaultEditor()
- */
- public void testGetDefaultEditor()
- {
- assertNotNull( fReg.getDefaultEditor() );
- }
-
- /**
- * getDefaultEditor(String fileName)
- */
- public void testGetDefaultEditor2()
- {
- IEditorDescriptor editor = fReg.getDefaultEditor( "a.mock1" );
- assertEquals( editor.getId(), MockEditorPart.ID1 );
-
- // same extension with different name
- IEditorDescriptor editor2 = fReg.getDefaultEditor( "b.mock1" );
- assertEquals( editor, editor2 );
-
- //editor not found
- assertNull( fReg.getDefaultEditor( IConstants.UnknownFileName[0] ) );
- }
-
- /**
- * getDefaultEditor(IFile file)
- */
- public void testGetDefaultEditor3() throws Throwable
- {
- proj = FileUtil.createProject("testProject");
-
- IFile file = FileUtil.createFile("Whats up.bro", proj);
- String id = MockEditorPart.ID1;
- fReg.setDefaultEditor( file, id );
- IEditorDescriptor editor = fReg.getDefaultEditor( file );
- assertEquals( editor.getId(), id );
-
- //attach an IFile object with a registered extension to a different editor
- file = FileUtil.createFile("ambush.mock1", proj);
- id = MockEditorPart.ID2;
- fReg.setDefaultEditor( file, id );
- editor = fReg.getDefaultEditor( file );
- assertEquals( editor.getId(), id );
-
- //a non-registered IFile object with a registered extension
- String name = "what.mock2";
- file = FileUtil.createFile( name, proj);
- editor = fReg.getDefaultEditor( file );
- assertEquals( editor, fReg.getDefaultEditor( name ) );
-
- //a non-registered IFile object with an unregistered extension
- name = IConstants.UnknownFileName[0];
- file = FileUtil.createFile( name, proj);
- assertNull( fReg.getDefaultEditor( file ) );
- }
-
- public void testSetDefaultEditor() throws Throwable
- {
- proj = FileUtil.createProject("testProject");
- IFile file = FileUtil.createFile("good.file", proj);
-
- String id = MockEditorPart.ID1;
- fReg.setDefaultEditor( file, id );
- IEditorDescriptor editor = fReg.getDefaultEditor( file );
- assertEquals( editor.getId(), id );
-
- //change the default editor
- id = MockEditorPart.ID2;
- fReg.setDefaultEditor( file, id );
- editor = fReg.getDefaultEditor( file );
- assertEquals( editor.getId(), id );
-
- //register the default editor with an invalid editor id
- fReg.setDefaultEditor( file, IConstants.FakeID );
- assertNull( fReg.getDefaultEditor( file ) );
- }
-
- /**
- * tests both of the following:
- * getImageDescriptor(IFile file)
- * getImageDescriptor(String filename)
- */
- public void testGetImageDescriptor() throws Throwable
- {
- proj = FileUtil.createProject("testProject");
-
-
- ImageDescriptor image1, image2;
- String fileName;
-
- fileName = "a.mock1";
- IFile file = FileUtil.createFile(fileName, proj);
- image1 = fReg.getImageDescriptor( fileName );
- image2 = fReg.getDefaultEditor( fileName).getImageDescriptor();
- assertEquals( image1, image2 );
- //for getImageDescriptor(IFile file)
- assertEquals( image1, fReg.getImageDescriptor( file ) );
-
- //same extension, different file name
- fileName = "b.mock1";
- file = FileUtil.createFile(fileName, proj);
- assertEquals( image1, fReg.getImageDescriptor( fileName ) );
- assertEquals( image1, fReg.getImageDescriptor( file ) );
-
- //default image
- fileName = "a.nullAndVoid";
- file = FileUtil.createFile(fileName, proj);
- image1 = fReg.getImageDescriptor( fileName );
- image2 = fReg.getImageDescriptor( "b.this_is_not_good" );
- assertNotNull( image1 );
- assertEquals( image1, image2 );
- assertEquals( image2, fReg.getImageDescriptor( file ) );
- }
-
- public void testAddPropertyListener() throws Throwable
- {
- final String METHOD = "propertyChanged";
-
- //take out mappings from the registry and put them back right away
- //so that the event gets triggered without making change to the registry
- IFileEditorMapping[] src = fReg.getFileEditorMappings();
- FileEditorMapping[] maps = new FileEditorMapping[src.length];
- System.arraycopy( src, 0, maps, 0, src.length);
-
- MockPropertyListener listener = new MockPropertyListener( fReg, IEditorRegistry.PROP_CONTENTS );
- fReg.addPropertyListener( listener );
- CallHistory callTrace = listener.getCallHistory();
-
- //multiple listener
- MockPropertyListener listener2 = new MockPropertyListener( fReg, IEditorRegistry.PROP_CONTENTS );
- fReg.addPropertyListener( listener2 );
- CallHistory callTrace2 = listener2.getCallHistory();
-
- //fire!!
- callTrace.clear();
- callTrace2.clear();
- ((EditorRegistry)fReg).setFileEditorMappings( maps );
- assertEquals( callTrace.contains( METHOD ), true);
- assertEquals( callTrace2.contains( METHOD ), true);
-
- //add the same listener second time
- fReg.addPropertyListener( listener );
-
- //fire!!
- callTrace.clear();
- ((EditorRegistry)fReg).setFileEditorMappings( maps );
- //make sure the method was called only once
- assertEquals( callTrace.verifyOrder(
- new String[] { METHOD } ), true);
-
- fReg.removePropertyListener( listener );
- fReg.removePropertyListener( listener2 );
- }
-
- public void testRemovePropertyListener()
- {
- IFileEditorMapping[] src = fReg.getFileEditorMappings();
- FileEditorMapping[] maps = new FileEditorMapping[src.length];
- System.arraycopy( src, 0, maps, 0, src.length);
-
- MockPropertyListener listener = new MockPropertyListener( fReg, IEditorRegistry.PROP_CONTENTS );
- fReg.addPropertyListener( listener );
- //remove the listener immediately after adding it
- fReg.removePropertyListener( listener );
- CallHistory callTrace = listener.getCallHistory();
-
- //fire!!
- callTrace.clear();
- ((EditorRegistry)fReg).setFileEditorMappings( maps );
- assertEquals( callTrace.contains( "propertyChanged" ), false );
-
- //removing the listener that is not registered yet should have no effect
- try{
- fReg.removePropertyListener( listener );
- }catch( Throwable e )
- {
- fail();
- }
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorSiteTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorSiteTest.java
deleted file mode 100644
index eeadfe0..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IEditorSiteTest.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.tests.util.FileUtil;
-
-public class IEditorSiteTest extends IWorkbenchPartSiteTest {
-
- /**
- * Constructor for IEditorSiteTest
- */
- public IEditorSiteTest(String testName) {
- super(testName);
- }
-
- /**
- * @see IWorkbenchPartSiteTest#getTestPartName()
- */
- protected String getTestPartName() throws Throwable {
- return MockEditorPart.NAME;
- }
-
- /**
- * @see IWorkbenchPartSiteTest#getTestPartId()
- */
- protected String getTestPartId() throws Throwable {
- return MockEditorPart.ID1;
- }
-
- /**
- * @see IWorkbenchPartSiteTest#createTestPart(IWorkbenchPage)
- */
- protected IWorkbenchPart createTestPart(IWorkbenchPage page) throws Throwable {
- IProject proj = FileUtil.createProject("createTestPart");
- IFile file = FileUtil.createFile("test1.mock1", proj);
- return page.openEditor(file);
- }
-
- public void testGetActionBarContributor() throws Throwable {
- // From Javadoc: "Returns the editor action bar contributor for
- // this editor.
-
- IEditorPart editor = (IEditorPart) createTestPart(fPage);
- IEditorSite site = editor.getEditorSite();
- assertNull(site.getActionBarContributor());
-
- // TBD: Flesh this out with a real contributor.
- }
-
-
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IFileEditorMappingTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IFileEditorMappingTest.java
deleted file mode 100644
index 0f29f22..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IFileEditorMappingTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import junit.framework.TestCase;
-
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.IFileEditorMapping;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.tests.util.ArrayUtil;
-
-public class IFileEditorMappingTest extends TestCase {
- private IFileEditorMapping[] fMappings;
-
- public IFileEditorMappingTest( String testName )
- {
- super( testName );
- }
-
- public void setUp()
- {
- fMappings = PlatformUI.getWorkbench().getEditorRegistry().getFileEditorMappings();
- }
-
- public void testGetName() throws Throwable
- {
- for( int i = 0; i < fMappings.length; i ++ )
- assertNotNull( fMappings[ i ].getName() );
- }
-
- public void testGetLabel() throws Throwable
- {
- String label;
- for( int i = 0; i < fMappings.length; i ++ ){
- label = fMappings[ i ].getLabel();
- assertNotNull( label );
- assertTrue( label.equals( fMappings[ i ].getName() + "." + fMappings[ i ].getExtension() ) );
- }
- }
-
- public void testGetExtension() throws Throwable
- {
- for( int i = 0; i < fMappings.length; i ++ )
- assertNotNull( fMappings[ i ].getExtension() );
- }
-
- public void testGetEditors() throws Throwable
- {
- IEditorDescriptor[] editors;
-
- for( int i = 0; i < fMappings.length; i ++ ){
- editors = fMappings[ i ].getEditors();
- assertTrue( ArrayUtil.checkNotNull( editors ) == true );
- }
- }
-
- public void testGetImageDescriptor() throws Throwable
- {
- for( int i = 0; i < fMappings.length; i ++ )
- assertNotNull( fMappings[ i ].getImageDescriptor() );
- }
-
-//how do i set the default editor?
- public void testGetDefaultEditor() throws Throwable
- {
-/* for( int i = 0; i < fMappings.length; i ++ )
- assertNotNull( fMappings[ i ].getDefaultEditor() );*/
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPageListenerTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPageListenerTest.java
deleted file mode 100644
index b30f875..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPageListenerTest.java
+++ /dev/null
@@ -1,152 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-
-import org.eclipse.ui.IPageListener;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.util.UITestCase;
-
-/**
- * Tests the IPageListener class.
- */
-public class IPageListenerTest extends UITestCase
- implements IPageListener
-{
- private IWorkbenchWindow fWindow;
- private IWorkspace fWorkspace;
-
- private int eventsReceived = 0;
- final private int OPEN = 0x01;
- final private int CLOSE = 0x02;
- final private int ACTIVATE = 0x04;
- private IWorkbenchPage pageMask;
-
- public IPageListenerTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- fWindow = openTestWindow();
- fWorkspace = ResourcesPlugin.getWorkspace();
- fWindow.addPageListener(this);
- }
-
- public void tearDown() throws Exception {
- fWindow.removePageListener(this);
- super.tearDown();
- }
-
- /**
- * Tests the pageOpened method.
- */
- public void testPageOpened() throws Throwable {
-/*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- // From Javadoc: "Notifies this listener that the given page has been opened."
-
- // Test open page.
- eventsReceived = 0;
- IWorkbenchPage page = fWindow.openPage(EmptyPerspective.PERSP_ID,
- fWorkspace);
- assertEquals(eventsReceived, OPEN|ACTIVATE);
-
- // Close page.
- page.close();
-*/
- }
-
- /**
- * Tests the pageClosed method.
- */
- public void testPageClosed() throws Throwable {
-/*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- // From Javadoc: "Notifies this listener that the given page has been closed."
-
- // Open page.
- IWorkbenchPage page = fWindow.openPage(EmptyPerspective.PERSP_ID,
- fWorkspace);
-
- // Test close page.
- eventsReceived = 0;
- pageMask = page;
- page.close();
- assertEquals(eventsReceived, CLOSE);
-*/
- }
-
- /**
- * Tests the pageActivated method.
- */
- public void testPageActivate() throws Throwable {
-/*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- // From Javadoc: "Notifies this listener that the given page has been activated."
-
- // Add pages.
- IWorkbenchPage page1 = fWindow.openPage(EmptyPerspective.PERSP_ID,
- fWorkspace);
- IWorkbenchPage page2 = fWindow.openPage(EmptyPerspective.PERSP_ID,
- fWorkspace);
-
- // Test activation of page 1.
- eventsReceived = 0;
- pageMask = page1;
- fWindow.setActivePage(page1);
- assertEquals(eventsReceived, ACTIVATE);
-
- // Test activation of page 2.
- eventsReceived = 0;
- pageMask = page2;
- fWindow.setActivePage(page2);
- assertEquals(eventsReceived, ACTIVATE);
-
- // Cleanup.
- page1.close();
- page2.close();
-*/
- }
-
- /**
- * @see IPageListener#pageActivated(IWorkbenchPage)
- */
- public void pageActivated(IWorkbenchPage page) {
- if (pageMask == null || page == pageMask)
- eventsReceived |= ACTIVATE;
- }
-
- /**
- * @see IPageListener#pageClosed(IWorkbenchPage)
- */
- public void pageClosed(IWorkbenchPage page) {
- if (pageMask == null || page == pageMask)
- eventsReceived |= CLOSE;
- }
-
- /**
- * @see IPageListener#pageOpened(IWorkbenchPage)
- */
- public void pageOpened(IWorkbenchPage page) {
- if (pageMask == null || page == pageMask)
- eventsReceived |= OPEN;
- }
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPageServiceTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPageServiceTest.java
deleted file mode 100644
index 8af7e57..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPageServiceTest.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-
-import org.eclipse.ui.IPageListener;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.internal.IWorkbenchConstants;
-import org.eclipse.ui.tests.util.EmptyPerspective;
-import org.eclipse.ui.tests.util.UITestCase;
-
-/**
- * Tests the IPageService class.
- */
-public class IPageServiceTest extends UITestCase
- implements IPageListener, org.eclipse.ui.IPerspectiveListener
-{
- private IWorkbenchWindow fWindow;
- private IWorkspace fWorkspace;
-
- private boolean pageEventReceived;
- private boolean perspEventReceived;
-
- public IPageServiceTest(String testName) {
- super(testName);
- }
-
- protected void setUp() {
- fWindow = openTestWindow();
- fWorkspace = ResourcesPlugin.getWorkspace();
- }
-
- /**
- * Tests the addPageListener method.
- */
- public void testAddPageListener() throws Throwable {
-/*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- // From Javadoc: "Adds the given listener for page lifecycle events.
- // Has no effect if an identical listener is already registered."
-
- // Add listener.
- fWindow.addPageListener(this);
-
- // Open and close page.
- // Verify events are received.
- pageEventReceived = false;
- IWorkbenchPage page = fWindow.openPage(EmptyPerspective.PERSP_ID,
- fWorkspace);
- page.close();
- assertTrue(pageEventReceived);
-
- // Remove listener.
- fWindow.removePageListener(this);
-*/
- }
-
- /**
- * Tests the removePageListener method.
- */
- public void testRemovePageListener() throws Throwable {
- // From Javadoc: "Removes the given page listener.
- // Has no affect if an identical listener is not registered."
-
- // Add and remove listener.
- fWindow.addPageListener(this);
- fWindow.removePageListener(this);
-
- // Open and close page.
- // Verify no events are received.
- pageEventReceived = false;
- IWorkbenchPage page = fWindow.openPage(EmptyPerspective.PERSP_ID,
- fWorkspace);
- page.close();
- assertTrue(!pageEventReceived);
- }
-
- /**
- * Tests getActivePage.
- */
- public void testGetActivePage() throws Throwable {
-/*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- // From Javadoc: "return the active page, or null if no page
- // is currently active"
-
- // Add page.
- IWorkbenchPage page1 = fWindow.openPage(EmptyPerspective.PERSP_ID,
- fWorkspace);
- assertEquals(fWindow.getActivePage(), page1);
-
- // Add second page.
- IWorkbenchPage page2 = fWindow.openPage(EmptyPerspective.PERSP_ID,
- fWorkspace);
- assertEquals(fWindow.getActivePage(), page2);
-
- // Set active page.
- fWindow.setActivePage(page1);
- assertEquals(fWindow.getActivePage(), page1);
- fWindow.setActivePage(page2);
- assertEquals(fWindow.getActivePage(), page2);
-
- // Cleanup.
- page1.close();
- page2.close();
-*/
- }
-
- /**
- * Tests the addPerspectiveListener method.
- */
- public void testAddPerspectiveListener() throws Throwable {
-/*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- // From Javadoc: "Adds the given listener for a page's perspective lifecycle events.
- // Has no effect if an identical listener is already registered."
-
- // Add listener.
- fWindow.addPerspectiveListener(this);
-
- // Open page and change persp feature.
- // Verify events are received.
- perspEventReceived = false;
- IWorkbenchPage page = fWindow.openPage(IWorkbenchConstants.DEFAULT_LAYOUT_ID,
- fWorkspace);
- page.setEditorAreaVisible(false);
- page.setEditorAreaVisible(true);
- page.close();
- assertTrue(perspEventReceived);
-
- // Remove listener.
- fWindow.removePerspectiveListener(this);
-*/
- }
-
- /**
- * Tests the removePerspectiveListener method.
- */
- public void testRemovePerspectiveListener() throws Throwable {
- // From Javadoc: "Removes the given page's perspective listener.
- // Has no affect if an identical listener is not registered."
-
- // Add and remove listener.
- fWindow.addPerspectiveListener(this);
- fWindow.removePerspectiveListener(this);
-
- // Open page and change persp feature.
- // Verify no events are received.
- perspEventReceived = false;
- IWorkbenchPage page = fWindow.openPage(IWorkbenchConstants.DEFAULT_LAYOUT_ID,
- fWorkspace);
- page.setEditorAreaVisible(false);
- page.setEditorAreaVisible(true);
- page.close();
- assertTrue(!perspEventReceived);
- }
-
- /**
- * @see IPageListener#pageActivated(IWorkbenchPage)
- */
- public void pageActivated(IWorkbenchPage page) {
- pageEventReceived = true;
- }
-
- /**
- * @see IPageListener#pageClosed(IWorkbenchPage)
- */
- public void pageClosed(IWorkbenchPage page) {
- pageEventReceived = true;
- }
-
- /**
- * @see IPageListener#pageOpened(IWorkbenchPage)
- */
- public void pageOpened(IWorkbenchPage page) {
- pageEventReceived = true;
- }
-
- /**
- * @see IPerspectiveListener#perspectiveActivated(IWorkbenchPage, IPerspectiveDescriptor)
- */
- public void perspectiveActivated(IWorkbenchPage page,
- IPerspectiveDescriptor perspective)
- {
- perspEventReceived = true;
- }
-
- /**
- * @see IPerspectiveListener#perspectiveChanged(IWorkbenchPage, IPerspectiveDescriptor, String)
- */
- public void perspectiveChanged(IWorkbenchPage page,
- IPerspectiveDescriptor perspective, String changeId)
- {
- perspEventReceived = true;
- }
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveDescriptorTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveDescriptorTest.java
deleted file mode 100644
index 49fdc76..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveDescriptorTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import junit.framework.TestCase;
-
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveRegistry;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.tests.util.ArrayUtil;
-
-public class IPerspectiveDescriptorTest extends TestCase {
-
- private IPerspectiveDescriptor fPer;
- private IPerspectiveRegistry fReg;
-
- public IPerspectiveDescriptorTest( String testName )
- {
- super( testName );
- }
-
- public void setUp()
- {
- fPer = ( IPerspectiveDescriptor )ArrayUtil.pickRandom( PlatformUI.getWorkbench().getPerspectiveRegistry().getPerspectives() );
- //fPer.
- }
-
- public void testGetId()
- {
- assertNotNull( fPer.getId() );
- }
-
- public void testGetLabel()
- {
- assertNotNull( fPer.getLabel() );
- }
-
-// This always fails
- public void testGetImageDescriptor()
- {
-/* IWorkbench wb = PlatformUI.getWorkbench();
-
- IPerspectiveDescriptor[] pers = wb.getPerspectiveRegistry().getPerspectives();
- IWorkbenchPage page = wb.getActiveWorkbenchWindow().getActivePage();
-
- for( int i = 0; i < pers.length; i ++ )
- if( pers[ i ] != page.getPerspective() ){
- page.setPerspective( pers[ i ] );
- break;
- }
-
- System.out.println( "active page pers: " + page.getPerspective().getLabel() );
- System.out.println( "active pers image: " + page.getPerspective().getImageDescriptor() );
-
- for( int i = 0; i < pers.length; i ++ )
- if( pers[ i ].getLabel().equals( "Resource" ) ){
- System.out.println( "resource image: " + pers[ i ].getImageDescriptor() );
- break;
- }
- for( int i = 0; i < pers.length; i ++ ){
- assertNotNull( pers[ i ].getImageDescriptor() );
- }*/
- }
-
- public void testThis()
- {
-// opne
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveListenerTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveListenerTest.java
deleted file mode 100644
index 4c48706..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveListenerTest.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IPerspectiveListener;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.util.UITestCase;
-
-public class IPerspectiveListenerTest extends UITestCase implements IPerspectiveListener {
- private int fEvent;
- private IWorkbenchWindow fWindow;
- private IWorkbenchPage fPageMask;
- private IPerspectiveDescriptor fPerMask;
-
- /**
- * bit masks for events
- */
- public static final int
- NONE = 0x00,
- OPEN = 0x01,
- CLOSED = 0x02,
- ACTIVATED = 0x04,
- CHANGED = 0x08;
-
- public IPerspectiveListenerTest( String testName )
- {
- super( testName );
- }
-
- public void setUp()
- {
- fEvent = NONE;
- fWindow = openTestWindow();
- fWindow.addPerspectiveListener( this );
- }
-
- public void tearDown()
- {
- fWindow.removePerspectiveListener( this );
- }
-
- public void testPerspectiveActivated()
- {
-/*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- fPageMask = fWindow.getActivePage();
- fPerMask = fWorkbench.getPerspectiveRegistry().findPerspectiveWithId(EmptyPerspective.PERSP_ID );
- fPageMask.setPerspective( fPerMask );
-
- assertEquals( isActivated( fEvent ), true );
-*/
- }
-
- public void testPerspectiveChanged()
- {
-/*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- fPageMask = fWindow.getActivePage();
- fPerMask = fWorkbench.getPerspectiveRegistry().findPerspectiveWithId(EmptyPerspective.PERSP_ID );
- fPageMask.setPerspective( fPerMask );
-
- assertEquals( isActivated( fEvent ), true );
-*/
- }
-
- /**
- * @see IPerspectiveListener#perspectiveActivated(IWorkbenchPage, IPerspectiveDescriptor)
- */
- public void perspectiveActivated( IWorkbenchPage page, IPerspectiveDescriptor perspective )
- {
- if( page == fPageMask && perspective == fPerMask )
- fEvent |= ACTIVATED;
- }
-
- /**
- * @see IPerspectiveListener#perspectiveChanged(IWorkbenchPage, IPerspectiveDescriptor, String)
- */
- public void perspectiveChanged( IWorkbenchPage page, IPerspectiveDescriptor perspective, String changeId)
- {
- if( page == fPageMask && perspective == fPerMask )
- fEvent |= CHANGED;
- }
-
- public static boolean isOpen( int bits )
- {
- return ( ( bits & OPEN ) != 0 );
- }
-
- public static boolean isClosed( int bits )
- {
- return ( ( bits & CLOSED ) != 0 );
- }
-
- public static boolean isActivated( int bits )
- {
- return ( ( bits & ACTIVATED ) != 0 );
- }
-
- public static boolean isChanged( int bits )
- {
- return( ( bits & CLOSED ) != 0 );
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveRegistryTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveRegistryTest.java
deleted file mode 100644
index ec85ed3..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IPerspectiveRegistryTest.java
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ISelectionServiceTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ISelectionServiceTest.java
deleted file mode 100644
index d0b2e8c..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ISelectionServiceTest.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.SelectionProviderView;
-import org.eclipse.ui.tests.util.UITestCase;
-
-/**
- * Tests the ISelectionService class.
- */
-public class ISelectionServiceTest extends UITestCase
- implements ISelectionListener
-{
- private IWorkbenchWindow fWindow;
- private IWorkbenchPage fPage;
-
- // Event state.
- private boolean eventReceived;
- private ISelection eventSelection;
- private IWorkbenchPart eventPart;
-
- public ISelectionServiceTest(String testName) {
- super(testName);
- }
-
- protected void setUp() {
- fWindow = openTestWindow();
- fPage = fWindow.getActivePage();
- }
-
- /**
- * Tests the addSelectionListener method.
- */
- public void testAddSelectionListener() throws Throwable {
- // From Javadoc: "Adds the given selection listener.
- // Has no effect if an identical listener is already registered."
-
- // Add listener.
- fPage.addSelectionListener(this);
-
- // Open a view and select something.
- // Verify events are received.
- clearEventState();
- SelectionProviderView view = (SelectionProviderView)
- fPage.showView(SelectionProviderView.ID);
- view.setSelection("Selection");
- assertTrue("EventReceived", eventReceived);
- }
-
- /**
- * Tests the removePageListener method.
- */
- public void testRemoveSelectionListener() throws Throwable {
- // From Javadoc: "Removes the given selection listener.
- // Has no affect if an identical listener is not registered."
-
- // Add and remove listener.
- fPage.addSelectionListener(this);
- fPage.removeSelectionListener(this);
-
- // Open a view and select something.
- // Verify no events are received.
- clearEventState();
- SelectionProviderView view = (SelectionProviderView)
- fPage.showView(SelectionProviderView.ID);
- view.setSelection("Selection");
- assertTrue("EventReceived", !eventReceived);
- }
-
- /**
- * Tests getActivePage.
- */
- public void testGetSelection() throws Throwable {
- // From Javadoc: "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>"
- Object actualSel, sel1 = "Selection 1", sel2 = "Selection 2";
-
- // Open view.
- SelectionProviderView view = (SelectionProviderView)
- fPage.showView(SelectionProviderView.ID);
-
- // Fire selection and verify.
- view.setSelection(sel1);
- actualSel = unwrapSelection(fPage.getSelection());
- assertEquals("Selection", sel1, actualSel);
-
- // Fire selection and verify.
- view.setSelection(sel2);
- actualSel = unwrapSelection(fPage.getSelection());
- assertEquals("Selection", sel2, actualSel);
-
- // Close view and verify.
- fPage.hideView(view);
- assertNull("getSelection", fPage.getSelection());
- }
-
- /**
- * Test event firing for inactive parts. In this scenario
- * the event should not be fired.
- */
- public void testSelectionEventWhenInactive() throws Throwable {
- Object sel1 = "Selection 1", sel2 = "Selection 2";
-
- // Add listener.
- fPage.addSelectionListener(this);
-
- // Open two views.
- SelectionProviderView view1 = (SelectionProviderView)
- fPage.showView(SelectionProviderView.ID);
- SelectionProviderView view2 = (SelectionProviderView)
- fPage.showView(SelectionProviderView.ID_2);
-
- // Fire selection from the second.
- // Verify it is received.
- clearEventState();
- view2.setSelection(sel2);
- assertTrue("EventReceived", eventReceived);
- assertEquals("EventPart", view2, eventPart);
- assertEquals("Event Selection", sel2, unwrapSelection(eventSelection));
-
- // Fire selection from the first.
- // Verify it is NOT received.
- clearEventState();
- view1.setSelection(sel1);
- assertTrue("Unexpected selection events received", !eventReceived);
- }
-
- /**
- * Test event firing when activated.
- */
- public void testSelectionEventWhenActivated() throws Throwable {
- // From Javadoc: "Adds the given selection listener.
- // Has no effect if an identical listener is already registered."
- Object sel1 = "Selection 1", sel2 = "Selection 2";
-
- // Add listener.
- fPage.addSelectionListener(this);
-
- // Open a view and select something.
- SelectionProviderView view1 = (SelectionProviderView)
- fPage.showView(SelectionProviderView.ID);
- view1.setSelection(sel1);
-
- // Open another view and select something.
- SelectionProviderView view2 = (SelectionProviderView)
- fPage.showView(SelectionProviderView.ID_2);
- view2.setSelection(sel2);
-
- // Activate the first view.
- // Verify that selection events are fired.
- clearEventState();
- fPage.activate(view1);
- assertTrue("EventReceived", eventReceived);
- assertEquals("EventPart", view1, eventPart);
- assertEquals("Event Selection", sel1, unwrapSelection(eventSelection));
-
- // Activate the second view.
- // Verify that selection events are fired.
- clearEventState();
- fPage.activate(view2);
- assertTrue("EventReceived", eventReceived);
- assertEquals("EventPart", view2, eventPart);
- assertEquals("Event Selection", sel2, unwrapSelection(eventSelection));
- }
-
- /**
- * Unwrap a selection.
- */
- private Object unwrapSelection(ISelection sel) {
- if (sel instanceof StructuredSelection) {
- StructuredSelection struct = (StructuredSelection)sel;
- if (struct.size() == 1)
- return struct.getFirstElement();
- }
- return null;
- }
-
- /**
- * Clear the event state.
- */
- private void clearEventState() {
- eventReceived = false;
- eventPart = null;
- eventSelection = null;
- }
-
- /*
- * @see ISelectionListener#selectionChanged(IWorkbenchPart, ISelection)
- */
- public void selectionChanged(IWorkbenchPart part, ISelection selection) {
- eventReceived = true;
- eventPart = part;
- eventSelection = selection;
- }
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IViewActionDelegateTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IViewActionDelegateTest.java
deleted file mode 100644
index c239c2d..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IViewActionDelegateTest.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.jface.action.IMenuManager;
-
-import org.eclipse.ui.tests.util.ActionUtil;
-
-
-/**
- * Tests the lifecycle for a view action delegate.
- */
-public class IViewActionDelegateTest extends IActionDelegateTest {
-
- public static String TEST_VIEW_ID = "org.eclipse.ui.tests.api.IViewActionDelegateTest";
-
- /**
- * Constructor for IWorkbenchWindowActionDelegateTest
- */
- public IViewActionDelegateTest(String testName) {
- super(testName);
- }
-
- public void testInit() throws Throwable {
- // When an action delegate is run the
- // init, selectionChanged, and run methods should
- // be called, in that order.
-
- // Run the action.
- testRun();
-
- // Verify lifecycle.
- MockActionDelegate delegate = getDelegate();
- assertNotNull(delegate);
- assertTrue(delegate.callHistory.verifyOrder(
- new String [] {"init", "selectionChanged", "run"}));
- }
-
- /**
- * @see IActionDelegateTest#createActionWidget()
- */
- protected Object createActionWidget() throws Throwable {
- MockViewPart view = (MockViewPart)fPage.showView(TEST_VIEW_ID);
- return view;
- }
-
- /**
- * @see IActionDelegateTest#runAction()
- */
- protected void runAction(Object widget) throws Throwable {
- MockViewPart view = (MockViewPart)widget;
- IMenuManager mgr = view.getViewSite().getActionBars().getMenuManager();
- ActionUtil.runActionWithLabel(this, mgr, "Mock Action");
- }
-
- /**
- * @see IActionDelegateTest#fireSelection()
- */
- protected void fireSelection(Object widget) throws Throwable {
- MockViewPart view = (MockViewPart)widget;
- view.fireSelection();
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IViewPartTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IViewPartTest.java
deleted file mode 100644
index 638eb7c..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IViewPartTest.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-
-/**
- * This is a test for IViewPart. Since IViewPart is an
- * interface this test verifies the IViewPart lifecycle rather
- * than the implementation.
- */
-public class IViewPartTest extends IWorkbenchPartTest {
-
- /**
- * Constructor for IEditorPartTest
- */
- public IViewPartTest(String testName) {
- super(testName);
- }
-
- /**
- * @see IWorkbenchPartTest#openPart(IWorkbenchPage)
- */
- protected MockWorkbenchPart openPart(IWorkbenchPage page) throws Throwable {
- return (MockWorkbenchPart)page.showView(MockViewPart.ID);
- }
-
- /**
- * @see IWorkbenchPartTest#closePart(IWorkbenchPage, MockWorkbenchPart)
- */
- protected void closePart(IWorkbenchPage page, MockWorkbenchPart part)
- throws Throwable
- {
- page.hideView((IViewPart)part);
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IViewSiteTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IViewSiteTest.java
deleted file mode 100644
index f54bcff..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IViewSiteTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class IViewSiteTest extends IWorkbenchPartSiteTest {
-
- /**
- * Constructor for IViewPartSiteTest
- */
- public IViewSiteTest(String testName) {
- super(testName);
- }
-
- /**
- * @see IWorkbenchPartSiteTest#getTestPartName()
- */
- protected String getTestPartName() throws Throwable {
- return MockViewPart.NAME;
- }
-
- /**
- * @see IWorkbenchPartSiteTest#getTestPartId()
- */
- protected String getTestPartId() throws Throwable {
- return MockViewPart.ID;
- }
-
- /**
- * @see IWorkbenchPartSiteTest#createTestPart(IWorkbenchPage)
- */
- protected IWorkbenchPart createTestPart(IWorkbenchPage page) throws Throwable {
- return page.showView(MockViewPart.ID);
- }
-
- public void testGetActionBars() throws Throwable {
- // From Javadoc: "Returns the action bars for this part site."
-
- IViewPart view = (IViewPart) createTestPart(fPage);
- IViewSite site = view.getViewSite();
- assertNotNull(site.getActionBars());
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPageTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPageTest.java
deleted file mode 100644
index 7d89948..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPageTest.java
+++ /dev/null
@@ -1,846 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.swt.SWT;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IPerspectiveDescriptor;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.internal.WorkbenchPage;
-import org.eclipse.ui.internal.registry.IActionSetDescriptor;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.tests.util.CallHistory;
-import org.eclipse.ui.tests.util.EmptyPerspective;
-import org.eclipse.ui.tests.util.FileUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-
-public class IWorkbenchPageTest extends UITestCase {
-
- private IWorkbenchPage fActivePage;
- private IWorkbenchWindow fWin;
- private IWorkbenchPart partMask;
- private IProject proj;
-
- public IWorkbenchPageTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- fWin = openTestWindow();
- fActivePage = fWin.getActivePage();
- }
-
- public void tearDown() throws Exception {
- super.tearDown();
- if (proj != null) {
- try {
- FileUtil.deleteProject(proj);
- } catch (Throwable e) {
- fail();
- }
- proj = null;
- }
- }
-
- /**
- * tests both of the following:
- * setEditorAreaVisible()
- * isEditorAreaVisible()
- */
- public void testGet_SetEditorAreaVisible() throws Throwable {
- fActivePage.setEditorAreaVisible(true);
- assertTrue(fActivePage.isEditorAreaVisible() == true);
-
- fActivePage.setEditorAreaVisible(false);
- assertTrue(fActivePage.isEditorAreaVisible() == false);
- }
-
- public void testGetPerspective() throws Throwable {
- assertNotNull(fActivePage.getPerspective());
-
- IWorkbenchPage page =
- fWin.openPage(
- EmptyPerspective.PERSP_ID,
- ResourcesPlugin.getWorkspace());
- assertEquals(EmptyPerspective.PERSP_ID, page.getPerspective().getId());
- }
-
- public void testSetPerspective() throws Throwable {
- IPerspectiveDescriptor per =
- PlatformUI
- .getWorkbench()
- .getPerspectiveRegistry()
- .findPerspectiveWithId(
- EmptyPerspective.PERSP_ID);
- fActivePage.setPerspective(per);
- assertEquals(per, fActivePage.getPerspective());
- }
-
- public void testGetLabel() {
- assertNotNull(fActivePage.getLabel());
- }
-
- public void testGetInput() throws Throwable {
- IAdaptable input = ResourcesPlugin.getWorkspace();
- IWorkbenchPage page = fWin.openPage(input);
- assertEquals(input, page.getInput());
- }
-
- public void testActivate() throws Throwable {
- MockViewPart part =
- (MockViewPart) fActivePage.showView(MockViewPart.ID);
- MockViewPart part2 =
- (MockViewPart) fActivePage.showView(MockViewPart.ID2);
-
- MockPartListener listener = new MockPartListener();
- fActivePage.addPartListener(listener);
- fActivePage.activate(part);
-
- CallHistory callTrace;
-
- callTrace = part2.getCallHistory();
- callTrace.clear();
- fActivePage.activate(part2);
- assertTrue(callTrace.contains("setFocus"));
- assertTrue(listener.getCallHistory().contains("partActivated"));
-
- callTrace = part.getCallHistory();
- callTrace.clear();
- fActivePage.activate(part);
- assertTrue(callTrace.contains("setFocus"));
- assertTrue(listener.getCallHistory().contains("partActivated"));
- }
-
- public void testBringToTop() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- IEditorPart part =
- fActivePage.openEditor(FileUtil.createFile("a.mock1", proj));
- IEditorPart part2 =
- fActivePage.openEditor(FileUtil.createFile("b.mock1", proj));
-
- MockPartListener listener = new MockPartListener();
- fActivePage.addPartListener(listener);
- CallHistory callTrace = listener.getCallHistory();
-
- //at this point, part2 is active
- fActivePage.bringToTop(part);
- assertEquals(callTrace.contains("partBroughtToTop"), true);
-
- callTrace.clear();
- fActivePage.bringToTop(part2);
- assertEquals(callTrace.contains("partBroughtToTop"), true);
- }
-
- public void testGetWorkbenchWindow() {
- /*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- assertEquals(fActivePage.getWorkbenchWindow(), fWin);
- IWorkbenchPage page = openTestPage(fWin);
- assertEquals(page.getWorkbenchWindow(), fWin);
- */
- }
-
- public void testShowView() throws Throwable {
- /*
- javadoc: Shows a view in this page and give it focus
- */
- MockViewPart view =
- (MockViewPart) fActivePage.showView(MockViewPart.ID);
- assertNotNull(view);
- assertTrue(
- view.getCallHistory().verifyOrder(
- new String[] { "init", "createPartControl", "setFocus" }));
-
- fActivePage.showView(MockViewPart.ID2);
-
- /*
- javadoc: If the view is already visible, it is given focus
- */
- CallHistory callTrace = view.getCallHistory();
- callTrace.clear();
- assertEquals(fActivePage.showView(MockViewPart.ID), view);
- assertEquals(callTrace.contains("setFocus"), true);
- }
-
- /**
- * openEditor(IFile input)
- */
- public void testOpenEditor() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
-
- /*
- javadoc: 1. 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
- */
- IFile file = FileUtil.createFile("test.mock1", proj);
- IEditorPart editor = fActivePage.openEditor(file);
-
- boolean foundEditor = hasEditor(editor);
- assertEquals(foundEditor, true);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(
- editor.getSite().getId(),
- fWorkbench.getEditorRegistry().getDefaultEditor(file).getId());
-
- /*
- javadoc: 2. 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.
- */
- //can not be tested
-
- /*
- javadoc: 3. If all else fails the file will be opened in a default text editor.
- */
- // PR 1GkD5O0 - Fails on linux
- String platform = SWT.getPlatform();
- if (!platform.equals("motif")) {
- file = FileUtil.createFile("a.null and void", proj);
- editor = fActivePage.openEditor(file);
- assertEquals(hasEditor(editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(
- editor.getSite().getId(),
- "org.eclipse.ui.DefaultTextEditor");
- }
-
- //open another editor to take the focus away from the first editor
- fActivePage.openEditor(FileUtil.createFile("test.mock2", proj));
-
- /*
- javadoc: If this page already has an editor open on the target object that editor is activated
- */
- //open the editor second time.
- assertEquals(editor, fActivePage.openEditor(file));
- assertEquals(editor, fActivePage.getActiveEditor());
- }
-
- /**
- * openEditor(IFile input, String editorID)
- */
- public void testOpenEditor2() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- final IFile file = FileUtil.createFile("asfasdasdf", proj);
- final String id = MockEditorPart.ID1;
-
- /*
- javadoc: The editor type is determined by mapping editorId to an editor extension registered with the workbench.
- */
- IEditorPart editor = fActivePage.openEditor(file, id);
- assertEquals(editor.getSite().getId(), id);
- assertEquals(hasEditor(editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
-
- //open another editor to take the focus away from the first editor
- fActivePage.openEditor(FileUtil.createFile("test.mock2", proj));
-
- /*
- javadoc: If this page already has an editor open on the target object that editor is activated
- */
- //open the first editor second time.
- assertEquals(fActivePage.openEditor(file, id), editor);
- assertEquals(fActivePage.getActiveEditor(), editor);
- }
-
- /**
- * openEditor(IEditorInput input,String editorId)
- */
- public void testOpenEditor3() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- final String id = MockEditorPart.ID1;
- IEditorInput input =
- new FileEditorInput(FileUtil.createFile("test.mock1", proj));
-
- /*
- javadoc: The editor type is determined by mapping editorId to an editor extension registered with the workbench
- */
- IEditorPart editor = fActivePage.openEditor(input, id);
- assertEquals(editor.getEditorInput(), input);
- assertEquals(editor.getSite().getId(), id);
- assertEquals(hasEditor(editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
-
- //open another editor to take the focus away from the first editor
- fActivePage.openEditor(FileUtil.createFile("test.mock2", proj));
-
- /*
- javadoc: If this page already has an editor open on the target object that editor is activated
- */
- //open the first editor second time.
- assertEquals(fActivePage.openEditor(input, id), editor);
- assertEquals(fActivePage.getActiveEditor(), editor);
- }
-
- /**
- * openEditor(IEditorInput input, String editorId, boolean activate)
- */
- public void testOpenEditor4() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- final String id = MockEditorPart.ID1;
- IEditorInput input =
- new FileEditorInput(FileUtil.createFile("test.mock1", proj));
- MockPartListener listener = new MockPartListener();
- fActivePage.addPartListener(listener);
- CallHistory callTrace = listener.getCallHistory();
-
- /*
- javadoc: The editor type is determined by mapping editorId to an editor extension
- registered with the workbench.
- javadoc: If activate == true the editor will be activated
- */
- //open an editor with activation
- IEditorPart editor = fActivePage.openEditor(input, id, true);
- assertEquals(editor.getEditorInput(), input);
- assertEquals(editor.getSite().getId(), id);
- assertEquals(hasEditor(editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(callTrace.contains("partActivated"), true);
-
- //we need another editor so that the editor under test can receive events.
- //otherwise, events will be ignored.
- IEditorPart extra =
- fActivePage.openEditor(FileUtil.createFile("aaaaa", proj));
-
- //close the first editor after the second has opened; necessary for
- //test to work with fix to PR 7743
- fActivePage.closeEditor(editor, false);
-
- //open an editor without activation
- callTrace.clear();
- editor = fActivePage.openEditor(input, id, false);
- assertEquals(editor.getEditorInput(), input);
- assertEquals(editor.getSite().getId(), id);
- assertEquals(hasEditor(editor), true);
- assertEquals(callTrace.contains("partActivated"), false);
- assertEquals(callTrace.contains("partBroughtToTop"), true);
-
- fActivePage.activate(extra);
-
- /*
- javadoc: If this page already has an editor open on the target object that editor is brought to the front
- */
- //open the editor under test second time without activation
- callTrace.clear();
- assertEquals(fActivePage.openEditor(input, id, false), editor);
- assertEquals(callTrace.contains("partBroughtToTop"), true);
- assertEquals(callTrace.contains("partActivated"), false);
-
- //activate the other editor
- fActivePage.activate(extra);
-
- /*
- javadoc: If activate == true the editor will be activated
- */
- //open the editor under test second time with activation
- callTrace.clear();
- assertEquals(fActivePage.openEditor(input, id, true), editor);
- assertEquals(callTrace.contains("partBroughtToTop"), true);
- assertEquals(callTrace.contains("partActivated"), true);
- }
-
- /**
- * openEditor(IMarker marker)
- */
- public void testOpenEditor5() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- IMarker marker =
- FileUtil.createFile("aa.mock2", proj).createMarker(IMarker.TASK);
- CallHistory callTrace;
-
- /*
- javadoc: the cursor and selection state of the editor is then updated from information
- recorded in the marker.
- */
- //open the registered editor for the marker resource
- IEditorPart editor = fActivePage.openEditor(marker);
- callTrace = ((MockEditorPart) editor).getCallHistory();
- assertEquals(editor.getSite().getId(), MockEditorPart.ID2);
- assertEquals(hasEditor(editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(callTrace.contains("gotoMarker"), true);
- fActivePage.closeEditor(editor, false);
-
- /*
- javadoc: If the marker contains an EDITOR_ID_ATTR attribute the attribute value will be used to
- determine the editor type to be opened
- */
- marker.setAttribute(IWorkbenchPage.EDITOR_ID_ATTR, MockEditorPart.ID1);
- editor = fActivePage.openEditor(marker);
- callTrace = ((MockEditorPart) editor).getCallHistory();
- assertEquals(editor.getSite().getId(), MockEditorPart.ID1);
- assertEquals(hasEditor(editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(callTrace.contains("gotoMarker"), true);
- //do not close the editor this time
-
- /*
- javdoc: If this page already has an editor open on the target object that editor is activated
- */
- callTrace.clear();
- assertEquals(fActivePage.openEditor(marker), editor);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(callTrace.contains("gotoMarker"), true);
- fActivePage.closeEditor(editor, false);
- }
-
- /**
- * openEditor(IMarker marker, boolean activate)
- */
- public void testOpenEditor6() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- IMarker marker =
- FileUtil.createFile("aa.mock2", proj).createMarker(IMarker.TASK);
- MockPartListener listener = new MockPartListener();
- fActivePage.addPartListener(listener);
- CallHistory listenerCall = listener.getCallHistory();
- CallHistory editorCall;
-
- //we need another editor so that the editor under test can receive events.
- //otherwise, events will be ignored.
- IEditorPart extra =
- fActivePage.openEditor(FileUtil.createFile("aaaaa", proj));
-
- /*
- javadoc: If activate == true the editor will be activated
- */
- //open the registered editor for the marker resource with activation
- IEditorPart editor = fActivePage.openEditor(marker, true);
- editorCall = ((MockEditorPart) editor).getCallHistory();
- assertEquals(editor.getSite().getId(), MockEditorPart.ID2);
- assertEquals(hasEditor(editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
-
- /*
- javadoc: the cursor and selection state of the editor is then updated from information
- recorded in the marker.
- */
- assertEquals(editorCall.contains("gotoMarker"), true);
- fActivePage.closeEditor(editor, false);
-
- fActivePage.activate(extra);
-
- //open the registered editor for the marker resource without activation
- listenerCall.clear();
- editor = fActivePage.openEditor(marker, false);
- editorCall = ((MockEditorPart) editor).getCallHistory();
- assertEquals(editor.getSite().getId(), MockEditorPart.ID2);
- assertEquals(hasEditor(editor), true);
- assertEquals(listenerCall.contains("partBroughtToTop"), true);
- assertEquals(listenerCall.contains("partActivated"), false);
- assertEquals(editorCall.contains("gotoMarker"), true);
- fActivePage.closeEditor(editor, false);
-
- /*
- javadoc: If the marker contains an EDITOR_ID_ATTR attribute the attribute value will be used to
- determine the editor type to be opened
- */
- String id = MockEditorPart.ID1;
- marker.setAttribute(IWorkbenchPage.EDITOR_ID_ATTR, id);
-
- //open an editor with activation
- listenerCall.clear();
-
- editor = fActivePage.openEditor(marker, true);
- editorCall = ((MockEditorPart) editor).getCallHistory();
- assertEquals(editor.getSite().getId(), id);
- assertEquals(hasEditor(editor), true);
- assertEquals(fActivePage.getActiveEditor(), editor);
- assertEquals(editorCall.contains("gotoMarker"), true);
- fActivePage.closeEditor(editor, false);
-
- fActivePage.activate(extra);
-
- //open an editor without activation
- listenerCall.clear();
- editor = fActivePage.openEditor(marker, false);
- editorCall = ((MockEditorPart) editor).getCallHistory();
- assertEquals(editor.getSite().getId(), id);
- assertEquals(hasEditor(editor), true);
- assertEquals(editorCall.contains("gotoMarker"), true);
- assertEquals(listenerCall.contains("partActivated"), false);
- assertEquals(listenerCall.contains("partBroughtToTop"), true);
- //do not close the editor this time
-
- fActivePage.activate(extra);
-
- /*
- javadoc: If this page already has an editor open on the target object that editor is brought to front
- */
- //open the editor second time without activation
- listenerCall.clear();
- assertEquals(fActivePage.openEditor(marker, false), editor);
- assertEquals(listenerCall.contains("partBroughtToTop"), true);
- assertEquals(listenerCall.contains("partActivated"), false);
-
- fActivePage.activate(extra);
-
- /*
- javdoc: If activate == true the editor will be activated
- */
- //open the editor second time with activation
- listenerCall.clear();
- assertEquals(fActivePage.openEditor(marker, true), editor);
- assertEquals(editorCall.contains("gotoMarker"), true);
- assertEquals(listenerCall.contains("partBroughtToTop"), true);
- assertEquals(listenerCall.contains("partActivated"), true);
- }
-
- public void testFindView() throws Throwable {
- String id = MockViewPart.ID3;
- //id of valid, but not open view
- assertNull(fActivePage.findView(id));
-
- IViewPart view = fActivePage.showView(id);
- assertEquals(fActivePage.findView(id), view);
-
- //close view
- fActivePage.hideView(view);
- assertNull(fActivePage.findView(id));
- }
-
- public void testGetViews() throws Throwable {
- int totalBefore = fActivePage.getViewReferences().length;
-
- IViewPart view = fActivePage.showView(MockViewPart.ID2);
- assertEquals(hasView(view),true);
- assertEquals(fActivePage.getViewReferences().length, totalBefore + 1);
-
- fActivePage.hideView(view);
- assertEquals(hasView(view),false);
- assertEquals(fActivePage.getViewReferences().length, totalBefore);
- }
-
- public void testHideView() throws Throwable {
- IViewPart view = fActivePage.showView(MockViewPart.ID3);
-
- fActivePage.hideView(view);
- CallHistory callTrace = ((MockViewPart) view).getCallHistory();
- assertTrue(callTrace.contains("dispose"));
- }
-
- public void testClose() throws Throwable {
- IWorkbenchPage page = openTestPage(fWin);
-
- proj = FileUtil.createProject("testOpenEditor");
- final IFile file = FileUtil.createFile("aaa.mock1", proj);
- IEditorPart editor = page.openEditor(file);
- CallHistory callTrace = ((MockEditorPart) editor).getCallHistory();
- callTrace.clear();
-
- /*
- javadoc: If the page has open editors with unsaved content and save is true, the user will be given the opportunity to save them
- */
- assertEquals(page.close(), true);
- assertEquals(
- callTrace.verifyOrder(new String[] { "isDirty", "dispose" }),
- true);
- assertEquals(fWin.getActivePage(), fActivePage);
- }
-
- public void testCloseEditor() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- final IFile file = FileUtil.createFile("test.mock1", proj);
- IEditorPart editor;
- CallHistory callTrace;
- MockEditorPart mock;
-
- /*
- javadoc: Parameters: save - true to save the editor contents if required (recommended)
- */
- //create a clean editor that needs to be saved on closing
- editor = fActivePage.openEditor(file);
- mock = (MockEditorPart) editor;
- mock.setSaveNeeded(true);
- callTrace = mock.getCallHistory();
- callTrace.clear();
- //close the editor with save confirmation
- assertEquals(fActivePage.closeEditor(editor, true), true);
- assertEquals(
- callTrace.verifyOrder(new String[] { "isDirty", "dispose" }),
- true);
-
- /*
- javadoc: If the editor has unsaved content and save is true, the user will be given the opportunity to save it.
- */
- //can't be tested
-
- /*
- javadoc: Parameters: save - false to discard any unsaved changes
- */
- //create a dirty editor
- editor = fActivePage.openEditor(file);
- mock = (MockEditorPart) editor;
- mock.setDirty(true);
- mock.setSaveNeeded(true);
- callTrace = mock.getCallHistory();
- callTrace.clear();
- //close the editor and discard changes
- assertEquals(fActivePage.closeEditor(editor, false), true);
- assertEquals(callTrace.contains("isSaveOnCloseNeeded"), false);
- /*
- * It is possible that some action may query the isDirty value of
- * the editor to update its enabled state. There is nothing wrong
- * in doing that, so do not test for no isDirty call here.
- *
- * assertEquals(callTrace.contains( "isDirty"), false);
- */
- assertEquals(callTrace.contains("doSave"), false);
- assertEquals(callTrace.contains("dispose"), true);
- }
-
- public void testCloseAllEditors() throws Throwable {
- int total = 5;
- final IFile[] files = new IFile[total];
- IEditorPart[] editors = new IEditorPart[total];
- CallHistory[] callTraces = new CallHistory[total];
- MockEditorPart[] mocks = new MockEditorPart[total];
-
- proj = FileUtil.createProject("testOpenEditor");
- for (int i = 0; i < total; i++)
- files[i] = FileUtil.createFile(i + ".mock2", proj);
-
- /*
- javadoc: If the page has open editors with unsaved content and save is true, the user will be given the opportunity to save them.
- */
- //close all clean editors with confirmation
- for (int i = 0; i < total; i++) {
- editors[i] = fActivePage.openEditor(files[i]);
- callTraces[i] = ((MockEditorPart) editors[i]).getCallHistory();
- }
- assertEquals(fActivePage.closeAllEditors(true), true);
- for (int i = 0; i < total; i++) {
- assertEquals(callTraces[i].contains("isDirty"), true);
- assertEquals(callTraces[i].contains("doSave"), false);
- callTraces[i].clear();
- }
-
- //close all dirty editors with confirmation
- //can't be tested
-
- //close all dirty editors discarding them
- for (int i = 0; i < total; i++) {
- editors[i] = fActivePage.openEditor(files[i]);
- mocks[i] = (MockEditorPart) editors[i];
- mocks[i].setDirty(true);
- callTraces[i] = mocks[i].getCallHistory();
- }
- assertEquals(fActivePage.closeAllEditors(false), true);
- for (int i = 0; i < total; i++) {
- assertEquals(callTraces[i].contains("doSave"), false);
- }
- }
-
- public void testSaveEditor() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- final IFile file = FileUtil.createFile("test.mock1", proj);
- IEditorPart editor;
- CallHistory callTrace;
- MockEditorPart mock;
-
- //create a clean editor
- editor = fActivePage.openEditor(file);
- mock = (MockEditorPart) editor;
- callTrace = mock.getCallHistory();
- callTrace.clear();
-
- /*
- javadoc: Saves the contents of the given editor if dirty.
- If not, this method returns without effect
- */
- //save the clean editor with confirmation
- assertEquals(fActivePage.saveEditor(editor, true), true);
- assertEquals(callTrace.contains("isDirty"), true);
- assertEquals(callTrace.contains("doSave"), false);
-
- /*
- javadoc: If confirm is true the user is prompted to confirm the command.
- */
- //can't be tested
-
- /*
- javadoc: Otherwise, the save happens without prompt.
- */
- //save the clean editor without confirmation
- assertEquals(fActivePage.saveEditor(editor, false), true);
- assertEquals(callTrace.contains("isDirty"), true);
- assertEquals(callTrace.contains("doSave"), false);
-
- //save the dirty editor without confirmation
- mock.setDirty(true);
- callTrace.clear();
- assertEquals(fActivePage.saveEditor(editor, false), true);
- assertEquals(
- callTrace.verifyOrder(new String[] { "isDirty", "doSave" }),
- true);
- }
-
- public void testSaveAllEditors() throws Throwable {
- int total = 3;
-
- final IFile[] files = new IFile[total];
- IEditorPart[] editors = new IEditorPart[total];
- CallHistory[] callTraces = new CallHistory[total];
- MockEditorPart[] mocks = new MockEditorPart[total];
-
- proj = FileUtil.createProject("testOpenEditor");
- for (int i = 0; i < total; i++) {
- files[i] = FileUtil.createFile(i + ".mock2", proj);
- editors[i] = fActivePage.openEditor(files[i]);
- mocks[i] = (MockEditorPart) editors[i];
- callTraces[i] = mocks[i].getCallHistory();
- }
-
- /*
- javadoc: If there are no dirty editors this method returns without effect.
- javadoc: If confirm is true the user is prompted to confirm the command
- */
- //save all clean editors with confirmation
- assertEquals(fActivePage.saveAllEditors(true), true);
- for (int i = 0; i < total; i++) {
- assertEquals(callTraces[i].contains("isDirty"), true);
- assertEquals(callTraces[i].contains("doSave"), false);
- callTraces[i].clear();
- }
-
- //save all dirty editors with confirmation can't be tested
-
- /*
- javadoc: Parameters: confirm - false to save unsaved changes without asking
- */
- //save all clean editors without confirmation
- assertEquals(fActivePage.saveAllEditors(false), true);
- for (int i = 0; i < total; i++) {
- assertEquals(callTraces[i].contains("isDirty"), true);
- assertEquals(callTraces[i].contains("doSave"), false);
- callTraces[i].clear();
- }
-
- //save all dirty editors without confirmation
- for (int i = 0; i < total; i++)
- mocks[i].setDirty(true);
- assertEquals(fActivePage.saveAllEditors(false), true);
- for (int i = 0; i < total; i++)
- assertEquals(
- callTraces[i].verifyOrder(new String[] { "isDirty", "doSave" }),
- true);
- }
-
- public void testGetEditors() throws Throwable {
- proj = FileUtil.createProject("testOpenEditor");
- int totalBefore = fActivePage.getEditorReferences().length;
- int num = 3;
- IEditorPart[] editors = new IEditorPart[num];
-
- for (int i = 0; i < num; i++) {
- editors[i] =
- fActivePage.openEditor(FileUtil.createFile(i + ".mock2", proj));
- assertEquals(hasEditor(editors[i]),true);
- }
- assertEquals(fActivePage.getEditorReferences().length, totalBefore + num);
-
- fActivePage.closeEditor(editors[0], false);
- assertEquals(hasEditor(editors[0]),false);
- assertEquals(fActivePage.getEditorReferences().length, totalBefore + num - 1);
-
- fActivePage.closeAllEditors(false);
- assertEquals(fActivePage.getEditorReferences().length, 0);
- }
-
- public void testShowActionSet() {
- String id = MockActionDelegate.ACTION_SET_ID;
- WorkbenchPage page = (WorkbenchPage) fActivePage;
-
- int totalBefore = page.getActionSets().length;
- fActivePage.showActionSet(id);
-
- IActionSetDescriptor[] sets =
- ((WorkbenchPage) fActivePage).getActionSets();
- boolean found = false;
- for (int i = 0; i < sets.length; i++)
- if (id.equals(sets[i].getId()))
- found = true;
- assertEquals(found, true);
-
- //check that the method does not add an invalid action set to itself
- id = IConstants.FakeID;
- fActivePage.showActionSet(id);
-
- sets = ((WorkbenchPage) fActivePage).getActionSets();
- found = false;
- for (int i = 0; i < sets.length; i++)
- if (id.equals(sets[i].getId()))
- found = true;
- assertEquals(found, false);
- assertEquals(page.getActionSets().length, totalBefore + 1);
- }
-
- public void testHideActionSet() {
- WorkbenchPage page = (WorkbenchPage) fActivePage;
- int totalBefore = page.getActionSets().length;
-
- String id = MockWorkbenchWindowActionDelegate.SET_ID;
- fActivePage.showActionSet(id);
- assertEquals(page.getActionSets().length, totalBefore + 1);
-
- fActivePage.hideActionSet(id);
- assertEquals(page.getActionSets().length, totalBefore);
-
- IActionSetDescriptor[] sets = page.getActionSets();
- boolean found = false;
- for (int i = 0; i < sets.length; i++)
- if (id.equals(sets[i].getId()))
- found = true;
- assertEquals(found, false);
- }
-
- /**
- * Return whether or not the editor exists in the current page.
- * @param editor
- * @return boolean
- */
- private boolean hasEditor(IEditorPart editor) {
- IEditorReference[] references = fActivePage.getEditorReferences();
- for (int i = 0; i < references.length; i++) {
- if (references[i].getEditor(false).equals(editor))
- return true;
- }
- return false;
- }
-
- /**
- * Return whether or not the view exists in the current page.
- * @param editor
- * @return boolean
- */
- private boolean hasView(IViewPart view) {
- IViewReference[] references = fActivePage.getViewReferences();
- for (int i = 0; i < references.length; i++) {
- if (references[i].getView(false).equals(view))
- return true;
- }
- return false;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPartSiteTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPartSiteTest.java
deleted file mode 100644
index 45c2cb7..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPartSiteTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.util.UITestCase;
-
-
-/**
- * Tests the site for an IWorkbenchPart.
- */
-public abstract class IWorkbenchPartSiteTest extends UITestCase {
-
- protected IWorkbenchWindow fWindow;
- protected IWorkbenchPage fPage;
-
- /**
- * Constructor for IWorkbenchPartSiteTest
- */
- public IWorkbenchPartSiteTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- fWindow = openTestWindow();
- fPage = fWindow.getActivePage();
- }
-
- public void testGetId() throws Throwable {
- // From Javadoc: "Returns the part registry extension id for
- // this workbench site's part."
-
- IWorkbenchPart part = createTestPart(fPage);
- IWorkbenchPartSite site = part.getSite();
- assertEquals(getTestPartId(), site.getId());
- }
-
- public void testGetPage() throws Throwable {
- // From Javadoc: "Returns the page containing this workbench
- // site's part."
-
- IWorkbenchPart part = createTestPart(fPage);
- IWorkbenchPartSite site = part.getSite();
- assertEquals(fPage, site.getPage());
- }
-
- public void testGetPluginId() throws Throwable {
- // From Javadoc: "Returns the unique identifier of the
- // plug-in that defines this workbench site's part."
-
- IWorkbenchPart part = createTestPart(fPage);
- IWorkbenchPartSite site = part.getSite();
- assertEquals(getTestPartPluginId(), site.getPluginId());
- }
-
- public void testGetRegisteredName() throws Throwable {
- // From Javadoc: "Returns the registered name for this
- // workbench site's part."
-
- IWorkbenchPart part = createTestPart(fPage);
- IWorkbenchPartSite site = part.getSite();
- assertEquals(getTestPartName(), site.getRegisteredName());
- }
-
- public void testGetShell() throws Throwable {
- // From Javadoc: "Returns the shell containing this
- // workbench site's part"
-
- IWorkbenchPart part = createTestPart(fPage);
- IWorkbenchPartSite site = part.getSite();
- assertEquals(fWindow.getShell(), site.getShell());
- }
-
- public void testGetWorkbenchWindow() throws Throwable {
- // From Javadoc: "Returns the workbench window
- // containing this workbench site's part."
-
- IWorkbenchPart part = createTestPart(fPage);
- IWorkbenchPartSite site = part.getSite();
- assertEquals(fWindow, site.getWorkbenchWindow());
- }
-
- public void testGetSelectionProvider() throws Throwable {
- // From Javadoc: "'Get' returns the selection provider
- // for this workbench site's part.
-
- IWorkbenchPart part = createTestPart(fPage);
- IWorkbenchPartSite site = part.getSite();
- assertTrue(part instanceof MockWorkbenchPart);
- MockWorkbenchPart mock = (MockWorkbenchPart)part;
- assertEquals(mock.getSelectionProvider(), site.getSelectionProvider());
- }
-
- public void testSetSelectionProvider() throws Throwable {
- // From Javadoc: 'Set' sets the selection provider.
-
- // Set selection provider to null.
- IWorkbenchPart part = createTestPart(fPage);
- IWorkbenchPartSite site = part.getSite();
- site.setSelectionProvider(null);
- assertNull(site.getSelectionProvider());
-
- // Set selection provider to real.
- MockSelectionProvider provider = new MockSelectionProvider();
- site.setSelectionProvider(provider);
- assertEquals(provider, site.getSelectionProvider());
- }
-
- /**
- * Creates a test part in the page.
- */
- abstract protected IWorkbenchPart createTestPart(IWorkbenchPage page)
- throws Throwable;
-
- /**
- * Returns the expected id for a test part.
- */
- abstract protected String getTestPartId() throws Throwable;
-
- /**
- * Returns the expected name for a test part.
- */
- abstract protected String getTestPartName() throws Throwable;
-
- /**
- * Returns the expected id for a test part plugin. Subclasses may
- * override this.
- */
- protected String getTestPartPluginId() throws Throwable {
- return "org.eclipse.ui.tests";
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPartTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPartTest.java
deleted file mode 100644
index 8668c6f..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchPartTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.util.CallHistory;
-import org.eclipse.ui.tests.util.UITestCase;
-
-
-/**
- * This is a test for IWorkbenchPart. Since IWorkbenchPart is an
- * interface this test verifies the IWorkbenchPart lifecycle rather
- * than the implementation.
- */
-public abstract class IWorkbenchPartTest extends UITestCase {
-
- protected IWorkbenchWindow fWindow;
- protected IWorkbenchPage fPage;
-
- /**
- * Constructor for IActionDelegateTest
- */
- public IWorkbenchPartTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- fWindow = openTestWindow();
- fPage = fWindow.getActivePage();
- }
-
- public void testOpenAndClose() throws Throwable {
- // Open a part.
- MockWorkbenchPart part = openPart(fPage);
- CallHistory history = part.getCallHistory();
- assertTrue(history.verifyOrder(new String[] {
- "init", "createPartControl", "setFocus" }));
-
- // Close the part.
- closePart(fPage, part);
- assertTrue(history.verifyOrder(new String[] {
- "init", "createPartControl", "setFocus", "dispose"}));
- }
-
- /**
- * Opens a part. Subclasses should override
- */
- protected abstract MockWorkbenchPart openPart(IWorkbenchPage page)
- throws Throwable;
-
- /**
- * Closes a part. Subclasses should override
- */
- protected abstract void closePart(IWorkbenchPage page, MockWorkbenchPart part)
- throws Throwable;
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchTest.java
deleted file mode 100644
index 9da6529..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchTest.java
+++ /dev/null
@@ -1,293 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.swt.SWT;
-
-import org.eclipse.jface.preference.PreferenceManager;
-
-import org.eclipse.ui.IEditorRegistry;
-import org.eclipse.ui.IPerspectiveRegistry;
-import org.eclipse.ui.ISharedImages;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.tests.util.ArrayUtil;
-import org.eclipse.ui.tests.util.EmptyPerspective;
-import org.eclipse.ui.tests.util.UITestCase;
-
-/**
- * Tests the IWorkbench interface.
- */
-public class IWorkbenchTest extends UITestCase {
-
- public IWorkbenchTest(String testName) {
- super(testName);
- }
-
- /**
- * Tests the activation of two windows.
- */
- public void testGetActiveWorkbenchWindow() throws Throwable {
- IWorkbenchWindow win1, win2;
-
- // PR 1GkD5O0 - Fails on linux.
- String platform = SWT.getPlatform();
- if (platform.equals("motif"))
- return;
-
- // Test initial window.
- win1 = fWorkbench.getActiveWorkbenchWindow();
- assertNotNull(win1);
-
- // Test open window.
- win1 = openTestWindow();
- assertEquals(win1, fWorkbench.getActiveWorkbenchWindow());
-
- // Test open second window.
- win2 = openTestWindow();
- assertEquals(win2, fWorkbench.getActiveWorkbenchWindow());
-
- // Test set focus.
- win1.getShell().forceFocus();
- assertEquals(win1, fWorkbench.getActiveWorkbenchWindow());
-
- // Test set focus.
- win2.getShell().forceFocus();
- assertEquals(win2, fWorkbench.getActiveWorkbenchWindow());
-
- // Cleanup in tearDown.
- }
-
- public void testGetEditorRegistry() throws Throwable {
- IEditorRegistry reg = fWorkbench.getEditorRegistry();
- assertNotNull(reg);
- }
-
- public void testGetPerspectiveRegistry() throws Throwable {
- IPerspectiveRegistry reg = fWorkbench.getPerspectiveRegistry();
- assertNotNull(reg);
- }
-
- public void testGetPrefereneManager() throws Throwable {
- PreferenceManager mgr = fWorkbench.getPreferenceManager();
- assertNotNull(mgr);
- }
-
- public void testGetSharedImages() throws Throwable {
- ISharedImages img = fWorkbench.getSharedImages();
- assertNotNull(img);
- }
-
- public void testGetWorkingSetManager() throws Throwable {
- IWorkingSetManager workingSetManager = fWorkbench.getWorkingSetManager();
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
-
- assertNotNull(workingSetManager);
-
- IWorkingSet workingSet = workingSetManager.createWorkingSet("ws1", new IAdaptable[] {workspace.getRoot()});
- workingSetManager.addWorkingSet(workingSet);
- workingSetManager = fWorkbench.getWorkingSetManager();
- assertEquals(1, workingSetManager.getWorkingSets().length);
- assertEquals(workingSet, workingSetManager.getWorkingSets()[0]);
- }
-
- public void testGetWorkbenchWindows() throws Throwable {
- IWorkbenchWindow[] wins = fWorkbench.getWorkbenchWindows();
- assertEquals(ArrayUtil.checkNotNull(wins), true);
- int oldTotal = wins.length;
- int num = 3;
-
- IWorkbenchWindow[] newWins = new IWorkbenchWindow[num];
- for (int i = 0; i < num; i++)
- newWins[i] = openTestWindow();
-
- wins = fWorkbench.getWorkbenchWindows();
- for (int i = 0; i < num; i++)
- assertTrue(ArrayUtil.contains(wins, newWins[i]));
-
- assertEquals(wins.length, oldTotal + num);
-
- closeAllTestWindows();
- wins = fWorkbench.getWorkbenchWindows();
- assertEquals(wins.length, oldTotal);
- }
-
- /**
- * openWorkbenchWindow(String, IAdaptable)
- */
- public void testOpenWorkbenchWindow() throws Throwable {
- // open a window with valid perspective
- IWorkbenchWindow win = null;
- try {
- win =
- fWorkbench.openWorkbenchWindow(
- EmptyPerspective.PERSP_ID,
- ResourcesPlugin.getWorkspace());
- assertNotNull(win);
- // PR 1GkD5O0 - Fails on linux.
- String platform = SWT.getPlatform();
- if (!platform.equals("motif")) {
- assertEquals(win, fWorkbench.getActiveWorkbenchWindow());
- }
- assertEquals(
- EmptyPerspective.PERSP_ID,
- win.getActivePage().getPerspective().getId());
- } finally {
- if (win != null)
- win.close();
- }
-
- // open a window with invalid perspective. WorkbenchException is expected.
- boolean exceptionOccured = false;
- try {
- win =
- fWorkbench.openWorkbenchWindow("afdasfdasf", ResourcesPlugin.getWorkspace());
- } catch (WorkbenchException ex) {
- exceptionOccured = true;
- }
-
- assertEquals(exceptionOccured, true);
- }
-
- /**
- * openWorkbenchWindow(IAdaptable)
- */
- public void testOpenWorkbenchWindow2() throws Throwable {
- // open a window with valid perspective
- IWorkbenchWindow win = null;
-
- try {
- win = fWorkbench.openWorkbenchWindow(ResourcesPlugin.getWorkspace());
- assertNotNull(win);
-
- // PR 1GkD5O0 - Fails on linux.
- String platform = SWT.getPlatform();
- if (!platform.equals("motif")) {
- assertEquals(win, fWorkbench.getActiveWorkbenchWindow());
- }
- String defaultID = fWorkbench.getPerspectiveRegistry().getDefaultPerspective();
- assertEquals(win.getActivePage().getPerspective().getId(), defaultID);
-
- } finally {
- if (win != null)
- win.close();
- }
- }
-
- public void testOpenPage1() throws Throwable {
- IWorkbenchWindow win = null;
- //IWorkbenchPage page1, page2;
- try {
-/*
- * Commented out until test case can be updated to match new
- * implementation of single page per window
- *
- // Open test window.
- win = fWorkbench.openWorkbenchWindow(ResourcesPlugin.getWorkspace());
- assertNotNull(win);
-
- // Set platform pref for openPage.
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- store.setValue(IPreferenceConstants.REUSE_PERSPECTIVES,
- true);
-
- // Call openPage twice with the same input.
- // Verify that we get the same page back both times.
- page1 = fWorkbench.openPage(ResourcesPlugin.getWorkspace());
- assertNotNull(page1);
- page2 = fWorkbench.openPage(ResourcesPlugin.getWorkspace());
- assertNotNull(page2);
- assertEquals("Pages should be equal", page1, page2);
-
- // Reset platform pref for openPage.
- store.setValue(IPreferenceConstants.REUSE_PERSPECTIVES,
- false);
-*/
- // Call openPage twice with the same input.
- // Verify that we get two different pages back.
-/*
- * Commented out until Nick has time to update this
- * test case to match new implementation of openPage
- * otherwise this test always fails.
- *
- page1 = fWorkbench.openPage(ResourcesPlugin.getWorkspace());
- assertNotNull(page1);
- page2 = fWorkbench.openPage(ResourcesPlugin.getWorkspace());
- assertNotNull(page2);
- assertTrue("Pages should be not equal", page1 != page2);
-*/
- } finally {
- // Close test window.
- if (win != null)
- win.close();
- }
- }
-
- public void testOpenPage2() throws Throwable {
- IWorkbenchWindow win = null;
- //IWorkbenchPage page1, page2;
- try {
-/*
- * Commented out until test case can be updated to match new
- * implementation of single page per window
- *
- // Open test window.
- win = fWorkbench.openWorkbenchWindow(ResourcesPlugin.getWorkspace());
- assertNotNull(win);
-
- // Set platform pref for openPage.
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- store.setValue(IPreferenceConstants.REUSE_PERSPECTIVES,
- true);
-
- // Call openPage twice with the same input.
- // Verify that we get the same page back both times.
- page1 = fWorkbench.openPage(EmptyPerspective.PERSP_ID,
- ResourcesPlugin.getWorkspace(), 0);
- assertNotNull(page1);
- page2 = fWorkbench.openPage(IWorkbenchConstants.DEFAULT_LAYOUT_ID,
- ResourcesPlugin.getWorkspace(), 0);
- assertNotNull(page2);
- assertEquals("Pages should be equal", page1, page2);
-
- // Reset platform pref for openPage.
- store.setValue(IPreferenceConstants.REUSE_PERSPECTIVES,
- false);
-
- // Call openPage twice with the same input.
- // Verify that we get two different pages back.
- page1 = fWorkbench.openPage(EmptyPerspective.PERSP_ID,
- ResourcesPlugin.getWorkspace(), 0);
- assertNotNull(page1);
- page2 = fWorkbench.openPage(IWorkbenchConstants.DEFAULT_LAYOUT_ID,
- ResourcesPlugin.getWorkspace(), 0);
- assertTrue("Pages should be not equal", page1 != page2);
-*/
- } finally {
- // Close test window.
- if (win != null)
- win.close();
- }
- }
-
- /**
- * close() couldn't be tested because calling close() would lead to early termination
- * to entire test suites
- */
- public void testClose() {
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchTestSuite.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchTestSuite.java
deleted file mode 100644
index 09e3abf..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchTestSuite.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Test the workbench. This suite was created as a
- * workaround for problems running the suites from the
- * command line.
- */
-public class IWorkbenchTestSuite extends TestSuite {
-
- /**
- * Returns the suite. This is required to
- * use the JUnit Launcher.
- */
- public static Test suite() {
- return new IWorkbenchTestSuite();
- }
-
- /**
- * Construct the test suite.
- */
- public IWorkbenchTestSuite() {
- addTest(new TestSuite(IWorkbenchTest.class));
- addTest(new TestSuite(IWorkbenchWindowTest.class));
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchWindowActionDelegateTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchWindowActionDelegateTest.java
deleted file mode 100644
index f478633..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchWindowActionDelegateTest.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.tests.util.ActionUtil;
-
-/**
- * Tests the lifecycle for a window action delegate.
- */
-public class IWorkbenchWindowActionDelegateTest extends IActionDelegateTest {
-
- /**
- * Constructor for IWorkbenchWindowActionDelegateTest
- */
- public IWorkbenchWindowActionDelegateTest(String testName) {
- super(testName);
- }
-
- public void testInit() throws Throwable {
- // Run the action.
- testRun();
-
- // Verify lifecycle.
- // The init, selectionChanged, and run methods should
- // be called, in that order.
- MockActionDelegate delegate = getDelegate();
- assertNotNull(delegate);
- assertTrue(delegate.callHistory.verifyOrder(
- new String [] {"init", "selectionChanged", "run"}));
- }
-
- public void testDispose() throws Throwable {
- // Run the action.
- testRun();
-
- // Get the action.
- MockActionDelegate delegate = getDelegate();
- assertNotNull(delegate);
-
- // Dispose action.
- // Verify that the dispose method is called.
- delegate.callHistory.clear();
- removeAction();
- assertTrue(delegate.callHistory.contains("dispose"));
- }
-
- /**
- * @see IActionDelegateTest#createActionWidget()
- */
- protected Object createActionWidget() throws Throwable {
- fPage.showActionSet("org.eclipse.ui.tests.api.MockActionSet");
- return null;
- }
-
- /**
- * @see IActionDelegateTest#runAction()
- */
- protected void runAction(Object widget) throws Throwable {
- ActionUtil.runActionWithLabel(this, fWindow, "Mock Action");
- }
-
- /**
- * @see IActionDelegateTest#fireSelection()
- */
- protected void fireSelection(Object widget) throws Throwable {
- MockViewPart view = (MockViewPart)fPage.showView(MockViewPart.ID);
- view.fireSelection();
- }
-
- /**
- * Removes the action.
- */
- protected void removeAction() {
- fPage.hideActionSet("org.eclipse.ui.tests.api.MockActionSet");
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchWindowTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchWindowTest.java
deleted file mode 100644
index 51c2399..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkbenchWindowTest.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.util.ArrayUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-
-public class IWorkbenchWindowTest extends UITestCase {
-
- private IWorkbenchWindow fWin;
-
- public IWorkbenchWindowTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- fWin = openTestWindow();
- }
-
- public void testClose() throws Throwable {
- assertEquals(fWin.close(), true);
- assertEquals(ArrayUtil.contains(fWorkbench.getWorkbenchWindows(), fWin), false);
- }
-
- public void testGetActivePage() throws Throwable {
-/*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- IWorkbenchPage page1, page2;
- page1 = openTestPage(fWin);
- assertEquals(fWin.getActivePage(), page1);
-
- page2 = openTestPage(fWin);
- assertEquals(fWin.getActivePage(), page2);
-
- fWin.setActivePage(page1);
- assertEquals(fWin.getActivePage(), page1);
-
- fWin.setActivePage(page2);
- assertEquals(fWin.getActivePage(), page2);
-
- //no pages
- closeAllPages(fWin);
- assertNull(fWin.getActivePage());
-*/
- }
-
- public void testSetActivePage() throws Throwable {
- openTestPage(fWin, 5);
- IWorkbenchPage[] pages = fWin.getPages();
-
- for (int i = 0; i < pages.length; i++) {
- fWin.setActivePage(pages[i]);
- assertEquals(pages[i], fWin.getActivePage());
- }
-
- fWin.setActivePage( null );
- assertNull( fWin.getActivePage() );
- }
-
- public void testGetPages() throws Throwable {
-/*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- int totalBefore;
- IWorkbenchPage[] pages, domainPages;
-
- totalBefore = fWin.getPages().length;
- int num = 5;
- pages = openTestPage(fWin, num);
- assertEquals(fWin.getPages().length, totalBefore + num);
-
- domainPages = fWin.getPages();
- for (int i = 0; i < pages.length; i++)
- assertEquals(ArrayUtil.contains(domainPages, pages[i]), true);
-
- closeAllPages(fWin);
- assertEquals(fWin.getPages().length, 0);
-*/
- }
-
- public void testGetShell() {
- Shell sh = fWin.getShell();
- assertNotNull(sh);
- }
-
- public void testGetWorkbench() {
- IWorkbenchWindow win = fWorkbench.getActiveWorkbenchWindow();
- assertEquals(win.getWorkbench(), fWorkbench);
- }
-
- /**
- * tests openPage(String)
- */
- public void testOpenPage() throws Throwable {
-/*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- IWorkbenchPage page = null;
- try {
- page = fWin.openPage(ResourcesPlugin.getWorkspace());
- assertNotNull(page);
- assertEquals(fWin.getActivePage(), page);
- } finally {
- if (page != null)
- page.close();
- }
-*/
- }
-
- /**
- * tests openPage(String, IAdaptable)
- */
- public void testOpenPage2() throws Throwable {
-/*
- * Commented out because until test case can be updated to work
- * with new window/page/perspective implementation
- *
- IWorkbenchPage page = null;
- try {
- page = fWin.openPage(EmptyPerspective.PERSP_ID, ResourcesPlugin.getWorkspace());
- assertNotNull(page);
- assertEquals(fWin.getActivePage(), page);
- assertEquals(
- fWin.getActivePage().getPerspective().getId(),
- EmptyPerspective.PERSP_ID);
- } finally {
- if (page != null)
- page.close();
- }
-
- //test openPage() fails
- try {
- page = fWin.openPage("*************", ResourcesPlugin.getWorkspace());
- fail();
- } catch (WorkbenchException ex) {
- }
-
- page.close();
-*/
- }
-
- public void testIsApplicationMenu() {
- String[] ids = {
- IWorkbenchActionConstants.M_FILE,
- IWorkbenchActionConstants.M_VIEW,
- IWorkbenchActionConstants.M_VIEW,
- IWorkbenchActionConstants.M_WORKBENCH,
- };
-
- for( int i = 0; i < ids.length; i ++ )
- assertEquals( fWin.isApplicationMenu( ids[ i ] ), true );
-
- ids = new String[] {
- IWorkbenchActionConstants.M_EDIT,
- IWorkbenchActionConstants.M_HELP,
- IWorkbenchActionConstants.M_LAUNCH
- };
-
- for( int i = 0; i < ids.length; i ++ )
- assertEquals( fWin.isApplicationMenu( ids[ i ] ), false );
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkingSetManagerTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkingSetManagerTest.java
deleted file mode 100644
index 01323a4..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkingSetManagerTest.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.dialogs.IWorkingSetSelectionDialog;
-import org.eclipse.ui.tests.util.ArrayUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-
-public class IWorkingSetManagerTest extends UITestCase {
- final static String WORKING_SET_NAME_1 = "ws1";
- final static String WORKING_SET_NAME_2 = "ws2";
-
- IWorkingSetManager fWorkingSetManager;
- IWorkspace fWorkspace;
- IWorkingSet fWorkingSet;
- String fChangeProperty;
- Object fChangeNewValue;
- Object fChangeOldValue;
-
- class TestPropertyChangeListener implements IPropertyChangeListener {
- public void propertyChange(PropertyChangeEvent event) {
- fChangeProperty = event.getProperty();
- fChangeNewValue = event.getNewValue();
- fChangeOldValue = event.getOldValue();
- }
- }
-
- public IWorkingSetManagerTest(String testName) {
- super(testName);
- }
- protected void setUp() throws Exception {
- super.setUp();
- fWorkingSetManager = fWorkbench.getWorkingSetManager();
- fWorkspace = ResourcesPlugin.getWorkspace();
- fWorkingSet = fWorkingSetManager.createWorkingSet(WORKING_SET_NAME_1, new IAdaptable[] {fWorkspace.getRoot()});
-
- IWorkingSet[] workingSets = fWorkingSetManager.getWorkingSets();
- for (int i = 0; i < workingSets.length; i++) {
- fWorkingSetManager.removeWorkingSet(workingSets[i]);
- }
- }
- void resetChangeData() {
- fChangeProperty = "";
- fChangeNewValue = null;
- fChangeOldValue = null;
- }
-
- public void testAddPropertyChangeListener() throws Throwable {
- IPropertyChangeListener listener = new TestPropertyChangeListener();
- fWorkingSetManager.addPropertyChangeListener(listener);
-
- resetChangeData();
- fWorkingSetManager.removeWorkingSet(fWorkingSet);
- assertEquals("", fChangeProperty);
-
- resetChangeData();
- fWorkingSetManager.addWorkingSet(fWorkingSet);
- assertEquals(IWorkingSetManager.CHANGE_WORKING_SET_ADD, fChangeProperty);
- assertEquals(null, fChangeOldValue);
- assertEquals(fWorkingSet, fChangeNewValue);
-
- resetChangeData();
- fWorkingSetManager.removeWorkingSet(fWorkingSet);
- assertEquals(IWorkingSetManager.CHANGE_WORKING_SET_REMOVE, fChangeProperty);
- assertEquals(fWorkingSet, fChangeOldValue);
- assertEquals(null, fChangeNewValue);
-
- resetChangeData();
- fWorkingSet.setName(WORKING_SET_NAME_2);
- assertEquals(IWorkingSetManager.CHANGE_WORKING_SET_NAME_CHANGE, fChangeProperty);
- assertEquals(null, fChangeOldValue);
- assertEquals(fWorkingSet, fChangeNewValue);
-
- resetChangeData();
- fWorkingSet.setElements(new IAdaptable[] {});
- assertEquals(IWorkingSetManager.CHANGE_WORKING_SET_CONTENT_CHANGE, fChangeProperty);
- assertEquals(null, fChangeOldValue);
- assertEquals(fWorkingSet, fChangeNewValue);
- }
- public void testAddRecentWorkingSet() throws Throwable {
- fWorkingSetManager.addRecentWorkingSet(fWorkingSet);
- fWorkingSetManager.addWorkingSet(fWorkingSet);
- assertTrue(ArrayUtil.equals(new IWorkingSet[] {fWorkingSet}, fWorkingSetManager.getRecentWorkingSets()));
-
- IWorkingSet workingSet2 = fWorkingSetManager.createWorkingSet(WORKING_SET_NAME_2, new IAdaptable[] {fWorkspace.getRoot()});
- fWorkingSetManager.addRecentWorkingSet(workingSet2);
- fWorkingSetManager.addWorkingSet(workingSet2);
- assertTrue(ArrayUtil.equals(new IWorkingSet[] {workingSet2, fWorkingSet}, fWorkingSetManager.getRecentWorkingSets()));
- }
- public void testAddWorkingSet() throws Throwable {
- fWorkingSetManager.addWorkingSet(fWorkingSet);
- assertTrue(ArrayUtil.equals(new IWorkingSet[] {fWorkingSet}, fWorkingSetManager.getWorkingSets()));
-
- boolean exceptionThrown = false;
- try {
- fWorkingSetManager.addWorkingSet(fWorkingSet);
- }
- catch (RuntimeException exception) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
- assertTrue(ArrayUtil.equals(new IWorkingSet[] {fWorkingSet}, fWorkingSetManager.getWorkingSets()));
- }
- public void testCreateWorkingSet() throws Throwable {
- IWorkingSet workingSet2 = fWorkingSetManager.createWorkingSet(WORKING_SET_NAME_2, new IAdaptable[] {fWorkspace.getRoot()});
- assertEquals(WORKING_SET_NAME_2, workingSet2.getName());
- assertTrue(ArrayUtil.equals(new IAdaptable[] {fWorkspace.getRoot()}, workingSet2.getElements()));
-
- workingSet2 = fWorkingSetManager.createWorkingSet("", new IAdaptable[] {});
- assertEquals("", workingSet2.getName());
- assertTrue(ArrayUtil.equals(new IAdaptable[] {}, workingSet2.getElements()));
- }
- public void testCreateWorkingSetSelectionDialog() throws Throwable {
- IWorkbenchWindow window = openTestWindow();
- IWorkingSetSelectionDialog dialog = fWorkingSetManager.createWorkingSetSelectionDialog(window.getShell(), true);
-
- assertNotNull(dialog);
- }
- public void testGetRecentWorkingSets() throws Throwable {
- assertEquals(0, fWorkingSetManager.getRecentWorkingSets().length);
-
- fWorkingSetManager.addRecentWorkingSet(fWorkingSet);
- fWorkingSetManager.addWorkingSet(fWorkingSet);
- assertTrue(ArrayUtil.equals(new IWorkingSet[] {fWorkingSet}, fWorkingSetManager.getRecentWorkingSets()));
-
- IWorkingSet workingSet2 = fWorkingSetManager.createWorkingSet(WORKING_SET_NAME_2, new IAdaptable[] {fWorkspace.getRoot()});
- fWorkingSetManager.addRecentWorkingSet(workingSet2);
- fWorkingSetManager.addWorkingSet(workingSet2);
- assertTrue(ArrayUtil.equals(new IWorkingSet[] {workingSet2, fWorkingSet}, fWorkingSetManager.getRecentWorkingSets()));
-
- fWorkingSetManager.removeWorkingSet(workingSet2);
- assertTrue(ArrayUtil.equals(new IWorkingSet[] {fWorkingSet}, fWorkingSetManager.getRecentWorkingSets()));
- }
- public void testGetWorkingSet() throws Throwable {
- assertNull(fWorkingSetManager.getWorkingSet(WORKING_SET_NAME_1));
-
- fWorkingSetManager.addWorkingSet(fWorkingSet);
- assertNotNull(fWorkingSetManager.getWorkingSet(fWorkingSet.getName()));
-
- assertNull(fWorkingSetManager.getWorkingSet(""));
-
- assertNull(fWorkingSetManager.getWorkingSet(null));
- }
- public void testGetWorkingSets() throws Throwable {
- assertTrue(ArrayUtil.equals(new IWorkingSet[] {}, fWorkingSetManager.getWorkingSets()));
-
- fWorkingSetManager.addWorkingSet(fWorkingSet);
- assertTrue(ArrayUtil.equals(new IWorkingSet[] {fWorkingSet}, fWorkingSetManager.getWorkingSets()));
-
- try {
- fWorkingSetManager.addWorkingSet(fWorkingSet);
- }
- catch (RuntimeException exception) {}
- assertTrue(ArrayUtil.equals(new IWorkingSet[] {fWorkingSet}, fWorkingSetManager.getWorkingSets()));
-
- IWorkingSet workingSet2 = fWorkingSetManager.createWorkingSet(WORKING_SET_NAME_2, new IAdaptable[] {fWorkspace.getRoot()});
- fWorkingSetManager.addWorkingSet(workingSet2);
- assertTrue(ArrayUtil.contains(fWorkingSetManager.getWorkingSets(), workingSet2));
- assertTrue(ArrayUtil.contains(fWorkingSetManager.getWorkingSets(), fWorkingSet));
- }
- public void testRemovePropertyChangeListener() throws Throwable {
- IPropertyChangeListener listener = new TestPropertyChangeListener();
-
- fWorkingSetManager.removePropertyChangeListener(listener);
-
- fWorkingSetManager.addPropertyChangeListener(listener);
- fWorkingSetManager.removePropertyChangeListener(listener);
-
- resetChangeData();
- fWorkingSet.setName(WORKING_SET_NAME_1);
- assertEquals("", fChangeProperty);
- }
- public void testRemoveWorkingSet() throws Throwable {
- fWorkingSetManager.removeWorkingSet(fWorkingSet);
- assertTrue(ArrayUtil.equals(new IWorkingSet[] {}, fWorkingSetManager.getWorkingSets()));
-
- fWorkingSetManager.addWorkingSet(fWorkingSet);
- IWorkingSet workingSet2 = fWorkingSetManager.createWorkingSet(WORKING_SET_NAME_2, new IAdaptable[] {fWorkspace.getRoot()});
- fWorkingSetManager.addWorkingSet(workingSet2);
- fWorkingSetManager.removeWorkingSet(fWorkingSet);
- assertTrue(ArrayUtil.equals(new IWorkingSet[] {workingSet2}, fWorkingSetManager.getWorkingSets()));
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkingSetTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkingSetTest.java
deleted file mode 100644
index 032e157..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/IWorkingSetTest.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.tests.util.ArrayUtil;
-import org.eclipse.ui.tests.util.FileUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-
-public class IWorkingSetTest extends UITestCase {
- final static String WORKING_SET_NAME_1 = "ws1";
- final static String WORKING_SET_NAME_2 = "ws2";
-
- IWorkspace fWorkspace;
- IWorkingSet fWorkingSet;
-
- public IWorkingSetTest(String testName) {
- super(testName);
- }
- protected void setUp() throws Exception {
- super.setUp();
- IWorkingSetManager workingSetManager = fWorkbench.getWorkingSetManager();
-
- fWorkspace = ResourcesPlugin.getWorkspace();
- fWorkingSet = workingSetManager.createWorkingSet(WORKING_SET_NAME_1, new IAdaptable[] {fWorkspace.getRoot()});
- }
- public void testGetElements() throws Throwable {
- assertEquals(fWorkspace.getRoot(), fWorkingSet.getElements()[0]);
- }
- public void testGetId() throws Throwable {
- assertEquals(null, fWorkingSet.getId());
- fWorkingSet.setId("bogusId");
- assertEquals("bogusId", fWorkingSet.getId());
- fWorkingSet.setId(null);
- assertEquals(null, fWorkingSet.getId());
- }
- public void testGetName() throws Throwable {
- assertEquals(WORKING_SET_NAME_1, fWorkingSet.getName());
- }
- public void testSetElements() throws Throwable {
- boolean exceptionThrown = false;
-
- try {
- fWorkingSet.setElements(null);
- }
- catch (RuntimeException exception) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
-
- IProject p1 = FileUtil.createProject("TP1");
- IFile f1 = FileUtil.createFile("f1.txt", p1);
- IAdaptable[] elements = new IAdaptable[] {f1, p1};
- fWorkingSet.setElements(elements);
- assertTrue(ArrayUtil.equals(elements, fWorkingSet.getElements()));
-
- fWorkingSet.setElements(new IAdaptable[] {f1});
- assertEquals(f1, fWorkingSet.getElements()[0]);
-
- fWorkingSet.setElements(new IAdaptable[] {});
- assertEquals(0, fWorkingSet.getElements().length);
- }
- public void testSetId() throws Throwable {
- assertEquals(null, fWorkingSet.getId());
- fWorkingSet.setId("bogusId");
- assertEquals("bogusId", fWorkingSet.getId());
- fWorkingSet.setId(null);
- assertEquals(null, fWorkingSet.getId());
- }
- public void testSetName() throws Throwable {
- boolean exceptionThrown = false;
-
- try {
- fWorkingSet.setName(null);
- }
- catch (RuntimeException exception) {
- exceptionThrown = true;
- }
- assertTrue(exceptionThrown);
-
- fWorkingSet.setName(WORKING_SET_NAME_2);
- assertEquals(WORKING_SET_NAME_2, fWorkingSet.getName());
-
- fWorkingSet.setName("");
- assertEquals("", fWorkingSet.getName());
-
- fWorkingSet.setName(" ");
- assertEquals(" ", fWorkingSet.getName());
- }
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListContentProvider.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListContentProvider.java
deleted file mode 100644
index 72b1c02..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListContentProvider.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import java.util.List;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-public class ListContentProvider implements IStructuredContentProvider {
-
- /**
- * @see IStructuredContentProvider#getElements(Object)
- */
- public Object[] getElements(Object inputElement) {
- if (inputElement instanceof List) {
- return ((List)inputElement).toArray();
- }
- return new Object[0];
- }
-
- /**
- * @see IContentProvider#dispose()
- */
- public void dispose() {
- }
-
- /**
- * @see IContentProvider#inputChanged(Viewer, Object, Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListElement.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListElement.java
deleted file mode 100644
index 6bda65e..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListElement.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.ui.IActionFilter;
-
-public class ListElement implements IAdaptable {
-
- private String name;
- private boolean flag;
-
- public ListElement(String name) {
- this(name, false);
- }
-
- public ListElement(String name, boolean flag) {
- this.name = name;
- this.flag = flag;
- }
-
- public String toString() {
- return name + ':' + flag;
- }
-
- public String getName() {
- return name;
- }
-
- public boolean getFlag() {
- return flag;
- }
-
- public Object getAdapter(Class adapter) {
- if (adapter == IActionFilter.class) {
- return ListElementActionFilter.getSingleton();
- }
- return null;
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListElementActionFilter.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListElementActionFilter.java
deleted file mode 100644
index a93f56a..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListElementActionFilter.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.IActionFilter;
-
-public class ListElementActionFilter implements IActionFilter {
-
- private boolean called = false;
-
- public static final String ATTR_NAME = "name";
- public static final String ATTR_FLAG = "flag";
- public static final String VAL_TRUE = "true";
- public static final String VAL_FALSE = "false";
-
- private static ListElementActionFilter singleton;
-
- public static ListElementActionFilter getSingleton() {
- if (singleton == null)
- singleton = new ListElementActionFilter();
- return singleton;
- }
-
- private ListElementActionFilter() {
- super();
- }
-
- /**
- * @see IActionFilter#testAttribute(Object, String, String)
- */
- public boolean testAttribute(Object target, String name, String value) {
- called = true;
- ListElement le = (ListElement)target;
- if (name.equals(ATTR_NAME)) {
- return value.equals(le.getName());
- } else if (name.equals(ATTR_FLAG)) {
- boolean flag = le.getFlag();
- if (flag)
- return value.equals(VAL_TRUE);
- else
- return value.equals(VAL_FALSE);
- }
- return false;
- }
-
- public void clearCalled() {
- called = false;
- }
-
- public boolean getCalled() {
- return called;
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListView.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListView.java
deleted file mode 100644
index 77d0e95..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/ListView.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import java.util.ArrayList;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Menu;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.action.IMenuListener;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.jface.viewers.ListViewer;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-import org.eclipse.ui.IWorkbenchActionConstants;
-
-/**
- * An ElementViewPart shows a bunch of elements in a list
- * viewer.
- */
-public class ListView extends MockViewPart
- implements IMenuListener
-{
-
- ListViewer viewer;
- ArrayList input;
- MenuManager menuMgr;
- Menu menu;
- Action addAction;
- String ADD_ACTION_ID = "addAction";
-
- /**
- * Constructor for ElementViewPart
- */
- public ListView() {
- super();
- input = new ArrayList();
- }
-
- /**
- * @see IWorkbenchPart#createPartControl(Composite)
- */
- public void createPartControl(Composite parent) {
- callTrace.add("createPartControl");
-
- // Create viewer.
- viewer = new ListViewer(parent);
- viewer.setLabelProvider(new LabelProvider());
- viewer.setContentProvider(new ListContentProvider());
- viewer.setInput(input);
-
- // Create popup menu.
- createPopupMenu();
-
- // Register stuff.
- getSite().setSelectionProvider(viewer);
- }
-
- /**
- * Creates a popup menu.
- */
- public void createPopupMenu() {
- // Create actions.
- addAction = new Action("Add Standard Items") {
- public void run() {
- addStandardItems();
- }
- };
- addAction.setId(ADD_ACTION_ID);
-
- // Create popup menu.
- IConfigurationElement config = getConfig();
- String str = config.getAttributeAsIs("menuType");
- if (str != null && str.equals("static"))
- createStaticPopupMenu();
- else
- createDynamicPopupMenu();
- }
-
- /**
- * Creates a dynamic popup menu.
- */
- public void createDynamicPopupMenu() {
- menuMgr = new MenuManager();
- menuMgr.setRemoveAllWhenShown(true);
- menuMgr.addMenuListener(this);
- menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- getSite().registerContextMenu(menuMgr, viewer);
- }
-
- /**
- * Creates a static popup menu.
- */
- public void createStaticPopupMenu() {
- menuMgr = new MenuManager();
- menu = menuMgr.createContextMenu(viewer.getControl());
- viewer.getControl().setMenu(menu);
- getSite().registerContextMenu(menuMgr, viewer);
- menuAboutToShow(menuMgr);
- }
-
- public void addElement(ListElement el) {
- input.add(el);
- viewer.refresh();
- viewer.getControl().update();
- }
-
- public void selectElement(ListElement el) {
- if (el == null)
- viewer.setSelection(new StructuredSelection());
- else
- viewer.setSelection(new StructuredSelection(el));
- }
-
- public MenuManager getMenuManager() {
- return menuMgr;
- }
-
- /**
- * @see IMenuListener#menuAboutToShow(IMenuManager)
- */
- public void menuAboutToShow(IMenuManager menuMgr) {
- menuMgr.add(addAction);
- menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
- }
-
- /**
- * Tests that the menu mgr contains the expected actions.
- */
- public void verifyActions(TestCase test, IMenuManager menuMgr) {
- TestCase.assertNotNull(menuMgr.find(ADD_ACTION_ID));
- }
-
- public void addStandardItems() {
- addElement(new ListElement("red"));
- addElement(new ListElement("blue"));
- addElement(new ListElement("green"));
- addElement(new ListElement("red", true));
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockAction.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockAction.java
deleted file mode 100644
index cb56b9b..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockAction.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-import org.eclipse.ui.tests.TestPlugin;
-
-public class MockAction extends Action {
-
- private boolean hasRun = false;
-
- /**
- * Constructor for MockAction
- */
- protected MockAction(String text) {
- super(text);
- TestPlugin plugin = TestPlugin.getDefault();
- setImageDescriptor(plugin.getImageDescriptor("anything.gif"));
- setToolTipText(text);
- }
-
- /**
- * Constructor for MockAction
- */
- protected MockAction(String text, ImageDescriptor image) {
- super(text, image);
- setToolTipText(text);
- }
-
- public void run() {
- hasRun = true;
- }
-
- public void clearRun() {
- hasRun = false;
- }
-
- public boolean getRun() {
- return hasRun;
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockActionDelegate.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockActionDelegate.java
deleted file mode 100644
index 9c8b23a..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockActionDelegate.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-import org.eclipse.ui.tests.util.CallHistory;
-
-public class MockActionDelegate implements IWorkbenchWindowActionDelegate {
-
- public CallHistory callHistory;
- public static final String ACTION_SET_ID = "org.eclipse.ui.tests.api.MockActionSet";
- public static MockActionDelegate lastDelegate;
-
- public MockActionDelegate() {
- callHistory = new CallHistory(this);
- lastDelegate = this;
- }
-
- /*
- * @see IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- }
-
- /**
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
- callHistory.add("run");
- }
-
- /**
- * @see IActionDelegate#selectionChanged(IAction, ISelection)
- */
- public void selectionChanged(IAction action, ISelection selection) {
- callHistory.add("selectionChanged");
- }
-
- /*
- * @see IWorkbenchWindowActionDelegate#dispose()
- */
- public void dispose() {
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockEditorActionBarContributor.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockEditorActionBarContributor.java
deleted file mode 100644
index 28d8523..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockEditorActionBarContributor.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.jface.action.IToolBarManager;
-
-import org.eclipse.ui.IActionBars;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.part.EditorActionBarContributor;
-import org.eclipse.ui.tests.util.CallHistory;
-
-public class MockEditorActionBarContributor
- extends EditorActionBarContributor
-{
- protected CallHistory callHistory;
- protected IEditorPart target;
- protected int ACTION_COUNT = 5;
- protected MockAction [] actions;
-
- /**
- * Constructor for MockEditorActionBarContributor
- */
- public MockEditorActionBarContributor() {
- super();
- callHistory = new CallHistory(this);
- }
-
- public CallHistory getCallHistory() {
- return callHistory;
- }
-
- /**
- * @see IEditorActionBarContributor#init(IActionBars)
- */
- public void init(IActionBars bars) {
- callHistory.add("init");
- actions = new MockAction[ACTION_COUNT];
- for (int nX = 0; nX < ACTION_COUNT; nX ++) {
- actions[nX] = new MockAction(Integer.toString(nX));
- if (nX % 2 > 0)
- actions[nX].setEnabled(false);
- }
- super.init(bars);
- }
-
- /**
- * @see EditorActionBarContributor#contributeToToolBar(IToolBarManager)
- */
- public void contributeToToolBar(IToolBarManager toolBarManager) {
- for (int i = 0; i < actions.length; ++i) {
- toolBarManager.add(actions[i]);
- }
- }
-
- /**
- * @see IEditorActionBarContributor#setActiveEditor(IEditorPart)
- */
- public void setActiveEditor(IEditorPart targetEditor) {
- callHistory.add("setActiveEditor");
- target = targetEditor;
- }
-
- /**
- * Returns the active editor.
- */
- public IEditorPart getActiveEditor() {
- return target;
- }
-
- /**
- * Returns the actions.
- */
- public MockAction [] getActions() {
- return actions;
- }
-
- /**
- * Set the enablement for all actions.
- */
- public void enableActions(boolean b) {
- for (int nX = 0; nX < ACTION_COUNT; nX ++) {
- actions[nX].setEnabled(b);
- }
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockEditorActionDelegate.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockEditorActionDelegate.java
deleted file mode 100644
index 31776dc..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockEditorActionDelegate.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.jface.action.IAction;
-
-import org.eclipse.ui.IEditorActionDelegate;
-import org.eclipse.ui.IEditorPart;
-
-public class MockEditorActionDelegate extends MockActionDelegate
- implements IEditorActionDelegate
-{
- private IEditorPart target;
-
- /**
- * Constructor for MockEditorActionDelegate
- */
- public MockEditorActionDelegate() {
- super();
- }
-
- /**
- * @see IEditorActionDelegate#setActiveEditor(IAction, IEditorPart)
- */
- public void setActiveEditor(IAction action, IEditorPart targetEditor) {
- callHistory.add("setActiveEditor");
- target = targetEditor;
- }
-
- /**
- * Returns the active editor.
- */
- public IEditorPart getActiveEditor() {
- return target;
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockEditorPart.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockEditorPart.java
deleted file mode 100644
index caf984d..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockEditorPart.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.IProgressMonitor;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-
-public class MockEditorPart extends MockWorkbenchPart implements IEditorPart {
-
- private static final String BASE = "org.eclipse.ui.tests.api.MockEditorPart";
- public static final String ID1 = BASE + "1";
- public static final String ID2 = BASE + "2";
- public static final String NAME = "Mock Editor 1";
-
- private IEditorInput input;
- private boolean dirty = false;
- private boolean saveNeeded = false;
-
- public MockEditorPart() {
- super();
- }
-
- /**
- * @see IEditorPart#doSave(IProgressMonitor)
- */
- public void doSave(IProgressMonitor monitor) {
- dirty = false;
- callTrace.add( "doSave" );
- }
-
- /**
- * @see IEditorPart#doSaveAs()
- */
- public void doSaveAs() {
- }
-
- /**
- * @see IEditorPart#getEditorInput()
- */
- public IEditorInput getEditorInput() {
- return input;
- }
-
- /**
- * @see IEditorPart#getEditorSite()
- */
- public IEditorSite getEditorSite() {
- return (IEditorSite)getSite();
- }
-
- /**
- * @see IEditorPart#gotoMarker(IMarker)
- */
- public void gotoMarker(IMarker marker) {
- callTrace.add( "gotoMarker" );
- }
-
- /**
- * @see IEditorPart#init(IEditorSite, IEditorInput)
- */
- public void init(IEditorSite site, IEditorInput input)
- throws PartInitException {
- this.input = input;
- setSite(site);
- callTrace.add( "init" );
- }
-
- /**
- * @see IEditorPart#isDirty()
- */
- public boolean isDirty() {
- callTrace.add( "isDirty" );
- return dirty;
- }
-
- public void setDirty( boolean value )
- {
- dirty = value;
- }
-
- /**
- * @see IEditorPart#isSaveAsAllowed()
- */
- public boolean isSaveAsAllowed() {
- return false;
- }
-
- /**
- * @see IEditorPart#isSaveOnCloseNeeded()
- */
- public boolean isSaveOnCloseNeeded() {
- callTrace.add( "isSaveOnCloseNeeded" );
- return saveNeeded;
- }
-
- public void setSaveNeeded( boolean value )
- {
- saveNeeded = value;
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockPartListener.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockPartListener.java
deleted file mode 100644
index bb6a137..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockPartListener.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.IPartListener;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.tests.util.CallHistory;
-
-public class MockPartListener implements IPartListener {
- private CallHistory callTrace;
-
- public MockPartListener() {
- callTrace = new CallHistory( this );
- }
-
- public CallHistory getCallHistory() {
- return callTrace;
- }
-
- /**
- * @see IPartListener#partActivated(IWorkbenchPart)
- */
- public void partActivated(IWorkbenchPart part) {
- callTrace.add("partActivated");
- }
-
- /**
- * @see IPartListener#partBroughtToTop(IWorkbenchPart)
- */
- public void partBroughtToTop(IWorkbenchPart part) {
- callTrace.add("partBroughtToTop");
- }
-
- /**
- * @see IPartListener#partClosed(IWorkbenchPart)
- */
- public void partClosed(IWorkbenchPart part) {
- callTrace.add( "partClosed");
- }
-
- /**
- * @see IPartListener#partDeactivated(IWorkbenchPart)
- */
- public void partDeactivated(IWorkbenchPart part) {
- callTrace.add( "partDeactivated");
- }
-
- /**
- * @see IPartListener#partOpened(IWorkbenchPart)
- */
- public void partOpened(IWorkbenchPart part) {
- callTrace.add( "partOpened");
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockPropertyListener.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockPropertyListener.java
deleted file mode 100644
index dddc5b0..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockPropertyListener.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.tests.util.CallHistory;
-
-public class MockPropertyListener implements IPropertyListener {
- private CallHistory callTrace;
- private Object sourceMask;
- private int sourceId;
-
- /**
- * @param source the event source that fires the event to this listener
- * @param id the property id for the event
- */
- public MockPropertyListener( Object source, int id )
- {
- sourceMask = source;
- sourceId = id;
- callTrace = new CallHistory(this);
- }
-
- /**
- * @see IPropertyListener#propertyChanged(Object, int)
- */
- public void propertyChanged(Object source, int propId) {
- if( source == sourceMask && propId == sourceId )
- callTrace.add( "propertyChanged" );
- }
-
- public CallHistory getCallHistory()
- {
- return callTrace;
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockSelectionProvider.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockSelectionProvider.java
deleted file mode 100644
index 22cf75c..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockSelectionProvider.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-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;
-
-public class MockSelectionProvider implements ISelectionProvider {
-
- private List listeners = new ArrayList(3);
-
- /**
- * Fires out a selection to all listeners.
- */
- public void fireSelection() {
- fireSelection(new SelectionChangedEvent(this,
- StructuredSelection.EMPTY));
- }
-
- /**
- * Fires out a selection to all listeners.
- */
- public void fireSelection(SelectionChangedEvent event) {
- Iterator iter = listeners.iterator();
- while (iter.hasNext()) {
- ((ISelectionChangedListener)iter.next()).selectionChanged(event);
- }
- }
-
- /**
- * @see ISelectionProvider#addSelectionChangedListener(ISelectionChangedListener)
- */
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- listeners.add(listener);
- }
-
- /**
- * @see ISelectionProvider#getSelection()
- */
- public ISelection getSelection() {
- return StructuredSelection.EMPTY;
- }
-
- /**
- * @see ISelectionProvider#removeSelectionChangedListener(ISelectionChangedListener)
- */
- public void removeSelectionChangedListener(ISelectionChangedListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * @see ISelectionProvider#setSelection(ISelection)
- */
- public void setSelection(ISelection selection) {
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockViewActionDelegate.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockViewActionDelegate.java
deleted file mode 100644
index 78adc6d..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockViewActionDelegate.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.IViewActionDelegate;
-import org.eclipse.ui.IViewPart;
-
-/**
- * This mock is used to test IViewActionDelegate lifecycle.
- */
-public class MockViewActionDelegate extends MockActionDelegate
- implements IViewActionDelegate
-{
- /**
- * Constructor for MockWorkbenchWindowActionDelegate
- */
- public MockViewActionDelegate() {
- super();
- }
-
- /**
- * @see IViewActionDelegate#init(IViewPart)
- */
- public void init(IViewPart view) {
- callHistory.add("init");
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockViewPart.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockViewPart.java
deleted file mode 100644
index c065fd2..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockViewPart.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-
-public class MockViewPart extends MockWorkbenchPart implements IViewPart {
- public static String ID = "org.eclipse.ui.tests.api.MockViewPart";
- public static String ID2 = ID + "2";
- public static String ID3 = ID + "3";
- public static String NAME = "Mock View 1";
-
- public MockViewPart()
- {
- super();
- }
-
- /**
- * @see IViewPart#getViewSite()
- */
- public IViewSite getViewSite() {
- return (IViewSite)getSite();
- }
-
- /**
- * @see IViewPart#init(IViewSite)
- */
- public void init(IViewSite site) throws PartInitException {
- setSite(site);
- callTrace.add("init" );
- }
-
- /**
- * @see IViewPart#init(IViewSite, IMemento)
- */
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- setSite(site);
- callTrace.add("init" );
- }
-
- /**
- * @see IViewPart#saveState(IMemento)
- */
- public void saveState(IMemento memento) {
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkbenchPart.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkbenchPart.java
deleted file mode 100644
index e009058..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkbenchPart.java
+++ /dev/null
@@ -1,164 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExecutableExtension;
-import org.eclipse.core.runtime.IPluginDescriptor;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ISelectionProvider;
-
-import org.eclipse.ui.IPropertyListener;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchPartSite;
-import org.eclipse.ui.tests.util.CallHistory;
-
-public abstract class MockWorkbenchPart implements IWorkbenchPart,
- IExecutableExtension
-{
- protected CallHistory callTrace;
-
- private IPropertyListener myListener;
- private Composite myParent;
- private IWorkbenchPartSite site;
- private String title;
- private MockSelectionProvider selectionProvider;
- private IConfigurationElement config;
- private Image titleImage;
-
- public MockWorkbenchPart() {
- callTrace = new CallHistory(this);
- selectionProvider = new MockSelectionProvider();
- }
-
- public CallHistory getCallHistory()
- {
- return callTrace;
- }
-
- public ISelectionProvider getSelectionProvider() {
- return selectionProvider;
- }
-
- public void setInitializationData(IConfigurationElement config, String propertyName, Object data) throws CoreException {
- this.config = config;
- title = (String)config.getAttribute("name");
-
- // Icon.
- String strIcon = config.getAttribute("icon");//$NON-NLS-1$
- if (strIcon != null) {
- try {
- IPluginDescriptor pd = config.getDeclaringExtension()
- .getDeclaringPluginDescriptor();
- URL fullPathString = new URL(pd.getInstallURL(), strIcon);
- ImageDescriptor imageDesc = ImageDescriptor.createFromURL(fullPathString);
- titleImage = imageDesc.createImage();
- } catch (MalformedURLException e) {
- }
- }
- }
-
- public IConfigurationElement getConfig() {
- return config;
- }
-
- public void setSite(IWorkbenchPartSite site) {
- this.site = site;
- site.setSelectionProvider(selectionProvider);
- }
-
- public IWorkbenchPartSite getSite() {
- return site;
- }
-
- /**
- * @see IWorkbenchPart#addPropertyListener(IPropertyListener)
- */
- public void addPropertyListener(IPropertyListener listener) {
- myListener = listener;
- }
-
- /**
- * @see IWorkbenchPart#createPartControl(Composite)
- */
- public void createPartControl(Composite parent) {
- myParent = parent;
- callTrace.add("createPartControl" );
- Label label = new Label(parent, SWT.NONE);
- label.setText(title);
- }
-
- /**
- * @see IWorkbenchPart#dispose()
- */
- public void dispose() {
- callTrace.add("dispose" );
- }
-
- /**
- * @see IWorkbenchPart#getTitle()
- */
- public String getTitle() {
- return title;
- }
-
- /**
- * @see IWorkbenchPart#getTitleImage()
- */
- public Image getTitleImage() {
- return titleImage;
- }
-
- /**
- * @see IWorkbenchPart#getTitleToolTip()
- */
- public String getTitleToolTip() {
- return title;
- }
-
- /**
- * @see IWorkbenchPart#removePropertyListener(IPropertyListener)
- */
- public void removePropertyListener(IPropertyListener listener) {
- myListener = null;
- }
-
- /**
- * @see IWorkbenchPart#setFocus()
- */
- public void setFocus() {
- callTrace.add("setFocus" );
- }
-
- /**
- * @see IAdaptable#getAdapter(Class)
- */
- public Object getAdapter(Class arg0) {
- return null;
- }
-
- /**
- * Fires a selection out.
- */
- public void fireSelection() {
- selectionProvider.fireSelection();
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkbenchWindowActionDelegate.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkbenchWindowActionDelegate.java
deleted file mode 100644
index 721c68b..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkbenchWindowActionDelegate.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkbenchWindowActionDelegate;
-
-
-public class MockWorkbenchWindowActionDelegate extends MockActionDelegate
- implements IWorkbenchWindowActionDelegate
-{
- public static MockWorkbenchWindowActionDelegate lastDelegate;
- public static String SET_ID = "org.eclipse.ui.tests.api.MockActionSet";
- public static String ID = "org.eclipse.ui.tests.api.MockWindowAction";
-
- /**
- * Constructor for MockWorkbenchWindowActionDelegate
- */
- public MockWorkbenchWindowActionDelegate() {
- super();
- lastDelegate = this;
- }
-
- /**
- * @see IWorkbenchWindowActionDelegate#init(IWorkbenchWindow)
- */
- public void init(IWorkbenchWindow window) {
- callHistory.add("init");
- }
-
- /**
- * @see IWorkbenchWindowActionDelegate#dispose()
- */
- public void dispose() {
- callHistory.add("dispose");
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkingSetPage.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkingSetPage.java
deleted file mode 100644
index 1b01177..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkingSetPage.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.wizard.WizardPage;
-
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.dialogs.IWorkingSetPage;
-
-/**
- * Tests the org.eclipse.ui.workingSets extension point.
- */
-public class MockWorkingSetPage extends WizardPage implements IWorkingSetPage {
- private IWorkingSet workingSet;
-
- /**
- * Creates a new instance of the receiver.
- */
- public MockWorkingSetPage() {
- super("MockWorkingSetPage", "Test Working Set", ImageDescriptor.getMissingImageDescriptor()); //$NON-NLS-1$ $NON-NLS-2$
- }
- /**
- * Overrides method in WizardPage.
- *
- * @see org.eclipse.jface.wizard.WizardPage#createControl(Composite)
- */
- public void createControl(Composite parent) {
- }
- /**
- * Implements IWorkingSetPage.
- *
- * @see org.eclipse.ui.dialogs.IWorkingSetPage#getSelection()
- */
- public IWorkingSet getSelection() {
- return workingSet;
- }
- /**
- * Implements IWorkingSetPage.
- *
- * @see org.eclipse.ui.dialogs.IWorkingSetPage#setSelection(IWorkingSet)
- */
- public void setSelection(IWorkingSet workingSet) {
- }
- /**
- * @see org.eclipse.ui.dialogs.IWorkingSetPage#finish()
- */
- public void finish() {
- }
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkingSetTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkingSetTest.java
deleted file mode 100644
index d58694e..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/MockWorkingSetTest.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import junit.framework.TestCase;
-
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.registry.WorkingSetDescriptor;
-import org.eclipse.ui.internal.registry.WorkingSetRegistry;
-
-/**
- * Tests the WorkingSetDescriptor and WorkingSetRegistry.
- */
-public class MockWorkingSetTest extends TestCase {
- final static String WORKING_SET_ID = "org.eclipse.ui.tests.api.MockWorkingSet";
- final static String WORKING_SET_NAME = "Mock Working Set";
- final static String WORKING_SET_PAGE_CLASS_NAME = "org.eclipse.ui.tests.api.MockWorkingSetPage";
-
- WorkingSetRegistry fRegistry;
-
- public MockWorkingSetTest(String name) {
- super(name);
- }
- /**
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- fRegistry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
- }
- public void testWorkingSetDescriptor() throws Throwable {
- WorkingSetDescriptor workingSetDescriptor = fRegistry.getWorkingSetDescriptor(WORKING_SET_ID);
-
- assertNotNull(workingSetDescriptor.getIcon());
- assertEquals(WORKING_SET_ID, workingSetDescriptor.getId());
- assertEquals(WORKING_SET_NAME, workingSetDescriptor.getName());
- assertEquals(WORKING_SET_PAGE_CLASS_NAME, workingSetDescriptor.getPageClassName());
- }
- public void testWorkingSetRegistry() throws Throwable {
- WorkingSetDescriptor[] workingSetDescriptors = fRegistry.getWorkingSetDescriptors();
- /*
- * Should have at least resourceWorkingSetPage and MockWorkingSet
- */
- assertTrue(workingSetDescriptors.length >= 2);
-
- assertEquals(Class.forName(WORKING_SET_PAGE_CLASS_NAME), fRegistry.getWorkingSetPage(WORKING_SET_ID).getClass());
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/PlatformUITest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/PlatformUITest.java
deleted file mode 100644
index 0fa3186..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/PlatformUITest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import junit.framework.TestCase;
-
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * Tests the PlatformUI class.
- */
-public class PlatformUITest extends TestCase {
-
- public PlatformUITest(String testName) {
- super(testName);
- }
-
- public void testGetWorkbench() throws Throwable {
- // From Javadoc: "Returns the workbench interface."
- IWorkbench wb = PlatformUI.getWorkbench();
- assertNotNull(wb);
- }
-
- public void testPLUGIN_ID() {
- // From Javadoc: "Identifies the workbench plugin."
- assertNotNull(PlatformUI.PLUGIN_ID);
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionCreateTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionCreateTest.java
deleted file mode 100644
index e881f02..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionCreateTest.java
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionPerspective.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionPerspective.java
deleted file mode 100644
index 4530ad6..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionPerspective.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPerspectiveFactory;
-
-/**
- * This class tests the persistance of a perspective.
- */
-public class SessionPerspective implements IPerspectiveFactory {
-
- public static String ID = "org.eclipse.ui.tests.api.SessionPerspective";
-
- /**
- * @see IPerspectiveFactory#createInitialLayout(IPageLayout)
- */
- public void createInitialLayout(IPageLayout layout) {
- String editorArea = layout.getEditorArea();
- layout.addView(SessionView.VIEW_ID, IPageLayout.LEFT,
- 0.33f, editorArea);
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionRestoreTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionRestoreTest.java
deleted file mode 100644
index dab79d5..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionRestoreTest.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import org.eclipse.core.resources.IFile;
-
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IEditorReference;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.util.EmptyPerspective;
-import org.eclipse.ui.tests.util.UITestCase;
-
-/**
- * SessionRestoreTest runs the second half of our session
- * presistance tests.
- *
-*/
-public class SessionRestoreTest extends UITestCase {
-
- /**
- * Construct an instance.
- */
- public SessionRestoreTest(String arg) {
- super(arg);
- }
-
- /**
- * Generates a session state in the workbench.
- */
- public void testRestoreSession() throws Throwable {
- IWorkbenchWindow [] windows;
- IWorkbenchPage [] pages;
-
- // Get windows.
- windows = fWorkbench.getWorkbenchWindows();
- assertEquals(windows.length, 3);
-
- // First window contains empty perspective.
- pages = windows[0].getPages();
- assertEquals(pages.length, 1);
- assertEquals(pages[0].getPerspective().getId(), EmptyPerspective.PERSP_ID);
-
- // Second window contains empty + session.
- pages = windows[1].getPages();
- assertEquals(pages.length, 2);
- assertEquals(pages[0].getPerspective().getId(), EmptyPerspective.PERSP_ID);
- assertEquals(pages[1].getPerspective().getId(), SessionPerspective.ID);
- testSessionView(pages[1]);
-
- // Third window contains 2 sessions.
- pages = windows[2].getPages();
- assertEquals(pages.length, 2);
- assertEquals(pages[0].getPerspective().getId(), SessionPerspective.ID);
- assertEquals(pages[1].getPerspective().getId(), SessionPerspective.ID);
- testSessionView(pages[0]);
- testSessionView(pages[1]);
-
- // Last page contains 3 editors.
- IEditorReference [] editors = pages[1].getEditorReferences();
- assertEquals(editors.length, 3);
- testSessionEditor(editors[0].getEditor(true), SessionCreateTest.TEST_FILE_1);
- testSessionEditor(editors[1].getEditor(true), SessionCreateTest.TEST_FILE_2);
- testSessionEditor(editors[2].getEditor(true), SessionCreateTest.TEST_FILE_3);
- }
-
- /**
- * Tests the session view within a page.
- */
- private void testSessionView(IWorkbenchPage page) {
- IViewPart view = page.findView(SessionView.VIEW_ID);
- assertNotNull(view);
- SessionView sessionView = (SessionView)view;
- sessionView.testMementoState(this);
- }
-
- /**
- * Tests the state of a session editor.
- */
- private void testSessionEditor(IEditorPart part, String fileName) {
- IEditorSite site = part.getEditorSite();
- assertEquals(site.getId(), MockEditorPart.ID1);
- IEditorInput input = part.getEditorInput();
- assertTrue(input instanceof IFileEditorInput);
- IFile file = ((IFileEditorInput)input).getFile();
- assertEquals(fileName, file.getName());
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionView.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionView.java
deleted file mode 100644
index f3ae074..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/api/SessionView.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.api;
-
-import junit.framework.TestCase;
-
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.IViewSite;
-import org.eclipse.ui.PartInitException;
-
-/**
- * This view is used to test the creation and restoration of
- * view state between sessions.
- */
-public class SessionView extends MockViewPart {
-
- private IMemento memento;
-
- public static String VIEW_ID = "org.eclipse.ui.tests.api.SessionView";
- /**
- * Constructor for SessionView
- */
- public SessionView() {
- super();
- }
-
- /**
- * @see IViewPart#init(IViewSite, IMemento)
- */
- public void init(IViewSite site, IMemento memento) throws PartInitException {
- super.init(site, memento);
- this.memento = memento;
- }
-
- /**
- * Create an IMemento.
- */
- public void saveState(IMemento memento) {
- createMementoState(memento);
- }
-
- /**
- * Creates an IMemento.
- */
- private void createMementoState(IMemento memento) {
- // Create float, integer and string.
- memento.putFloat("float", 0.50f);
- memento.putInteger("integer", 50);
- memento.putString("string", "50");
-
- // Create a single child.
- IMemento child = memento.createChild("single");
- child.putInteger("id", 1);
-
- // Create multiple children.
- int count = 10;
- for (int nX = 0; nX < count; nX ++) {
- child = memento.createChild("multiple");
- child.putInteger("id", nX);
- }
- memento.putInteger("multiple.count", count);
- }
-
- /**
- * Restore an IMemento.
- */
- public void testMementoState(TestCase testCase) {
- // Verify that the memento was passed to us in
- // constructor.
- TestCase.assertNotNull(memento);
-
- // Read float.
- Float bigFloat = memento.getFloat("float");
- TestCase.assertNotNull(bigFloat);
- TestCase.assertEquals(bigFloat.floatValue(), 0.50f, 0.0001);
-
- // Read int.
- Integer bigInt = memento.getInteger("integer");
- TestCase.assertEquals(bigInt, new Integer(50));
-
- // Read string.
- String str = memento.getString("string");
- TestCase.assertEquals(str, "50");
-
- // Read single child.
- IMemento child = memento.getChild("single");
- TestCase.assertNotNull(child);
- bigInt = child.getInteger("id");
- TestCase.assertEquals(bigInt, new Integer(1));
-
- // Read multiple children.
- bigInt = memento.getInteger("multiple.count");
- TestCase.assertNotNull(bigInt);
- int count = bigInt.intValue();
- IMemento [] children = memento.getChildren("multiple");
- TestCase.assertEquals(count, children.length);
- for (int nX = 0; nX < count; nX ++) {
- child = children[nX];
- TestCase.assertNotNull(child);
- bigInt = child.getInteger("id");
- TestCase.assertEquals(bigInt, new Integer(nX));
- }
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/DataTransferTestSuite.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/DataTransferTestSuite.java
deleted file mode 100644
index b710de4..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/DataTransferTestSuite.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.datatransfer;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * .
- */
-public class DataTransferTestSuite extends TestSuite {
-
- /**
- * Returns the suite. This is required to
- * use the JUnit Launcher.
- */
- public static Test suite() {
- return new DataTransferTestSuite();
- }
-
- /**
- * Construct the test suite.
- */
- public DataTransferTestSuite() {
- addTest(new TestSuite(ImportOperationTest.class));
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/ImportOperationTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/ImportOperationTest.java
deleted file mode 100644
index fa44e46..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/ImportOperationTest.java
+++ /dev/null
@@ -1,301 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.datatransfer;
-
-import java.io.*;
-import java.util.*;
-
-import org.eclipse.core.resources.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.ui.dialogs.IOverwriteQuery;
-import org.eclipse.ui.tests.util.FileUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-import org.eclipse.ui.wizards.datatransfer.FileSystemStructureProvider;
-import org.eclipse.ui.wizards.datatransfer.ImportOperation;
-
-public class ImportOperationTest
- extends UITestCase
- implements IOverwriteQuery {
-
- private String localDirectory;
-
- private String[] directoryNames = { "dir1", "dir2" };
-
- private String[] fileNames = { "file1.txt", "file2.txt" };
-
- private IProject project;
-
- public ImportOperationTest(String testName) {
- super(testName);
- }
-
- private void createSubDirectory(String parentName, String newDirName)
- throws IOException {
- String newDirPath = parentName + File.separatorChar + newDirName;
- File newDir = new File(newDirPath);
- newDir.mkdir();
- for (int i = 0; i < directoryNames.length; i++) {
- createFile(newDirPath, fileNames[i]);
- }
- }
-
- private void createFile(String parentName, String filePath)
- throws IOException {
- String newFilePath = parentName + File.separatorChar + filePath;
- File newFile = new File(newFilePath);
- newFile.createNewFile();
- }
-
- private void deleteDirectory(File directory){
- File[] children = directory.listFiles();
- for(int i = 0; i < children.length; i ++){
- if(children[i].isDirectory())
- deleteDirectory(children[i]);
- else
- children[i].delete();
- }
- directory.delete();
- }
-
- /*
- * @see IOverwriteQuery#queryOverwrite(String)
- */
- public String queryOverwrite(String pathString) {
- //Always return an empty String - we aren't
- //doing anything interesting
- return "";
- }
-
- public void setUp() throws Exception {
- Class testClass =
- Class.forName("org.eclipse.ui.tests.datatransfer.ImportOperationTest");
- InputStream stream = testClass.getResourceAsStream("tests.ini");
- Properties properties = new Properties();
- properties.load(stream);
- localDirectory = properties.getProperty("localSource");
- setUpDirectory();
- super.setUp();
- }
-
- /**
- * Set up the directories and files used for the test.
- */
-
- private void setUpDirectory() throws IOException {
- File rootDirectory = new File(localDirectory);
- rootDirectory.mkdir();
- localDirectory = rootDirectory.getAbsolutePath();
- for (int i = 0; i < directoryNames.length; i++) {
- createSubDirectory(localDirectory, directoryNames[i]);
- }
- }
-
- /**
- * Tear down. Delete the project we created and all of the
- * files on the file system.
- */
- public void tearDown() throws Exception {
- super.tearDown();
- try {
- project.delete(true,true,null);
- File topDirectory = new File(localDirectory);
- deleteDirectory(topDirectory);
- }
- catch (CoreException e) {
- fail(e.toString());
- }
- }
-
- public void testGetStatus() throws Exception {
- project = FileUtil.createProject("ImportGetStatus");
- File element = new File(localDirectory);
- List importElements = new ArrayList();
- importElements.add(element);
- ImportOperation operation =
- new ImportOperation(
- project.getFullPath(),
- FileSystemStructureProvider.INSTANCE,
- this,
- importElements);
-
- assertTrue(operation.getStatus().getCode() == IStatus.OK);
- }
-
- public void testImportList() throws Exception {
- project = FileUtil.createProject("ImportList");
- File element = new File(localDirectory);
- List importElements = new ArrayList();
- importElements.add(element);
- ImportOperation operation =
- new ImportOperation(
- project.getFullPath(),
- FileSystemStructureProvider.INSTANCE,
- this,
- importElements);
- openTestWindow().run(true,true,operation);
-
- verifyFiles(directoryNames.length);
- }
-
- public void testImportSource() throws Exception {
- project = FileUtil.createProject("ImportSource");
- ImportOperation operation =
- new ImportOperation(
- project.getFullPath(),
- new File(localDirectory),
- FileSystemStructureProvider.INSTANCE,
- this);
- openTestWindow().run(true,true,operation);
- verifyFiles(directoryNames.length);
- }
-
- public void testImportSourceList() throws Exception {
- project = FileUtil.createProject("ImportSourceList");
- File element = new File(localDirectory + File.separator + directoryNames[0]);
- List importElements = new ArrayList();
- importElements.add(element);
- ImportOperation operation =
- new ImportOperation(
- project.getFullPath(),
- new File(localDirectory),
- FileSystemStructureProvider.INSTANCE,
- this,
- importElements);
- openTestWindow().run(true,true,operation);
- verifyFiles(importElements.size());
- }
-
- public void testSetContext() throws Exception {
- project = FileUtil.createProject("ImportSetContext");
- File element = new File(localDirectory);
- List importElements = new ArrayList();
- importElements.add(element);
- ImportOperation operation =
- new ImportOperation(
- project.getFullPath(),
- FileSystemStructureProvider.INSTANCE,
- this,
- importElements);
-
- operation.setContext(null);
- operation.setContext(openTestWindow().getShell());
- }
-
- public void testSetCreateContainerStructure() throws Exception {
- project = FileUtil.createProject("ImportSetCreateContainerStructure");
- File element = new File(localDirectory);
- List importElements = new ArrayList();
- importElements.add(element);
- ImportOperation operation =
- new ImportOperation(
- project.getFullPath(),
- FileSystemStructureProvider.INSTANCE,
- this,
- importElements);
-
- operation.setCreateContainerStructure(false);
- openTestWindow().run(true,true,operation);
-
- try {
- IPath path = new Path(localDirectory);
- IResource targetFolder = project.findMember(path.lastSegment());
-
- assertTrue("Import failed", targetFolder instanceof IContainer);
-
- IResource[] resources = ((IContainer) targetFolder).members();
- assertEquals("Import failed to import all directories", directoryNames.length, resources.length);
- for (int i = 0; i < resources.length; i++) {
- assertTrue("Import failed", resources[i] instanceof IContainer);
- verifyFolder((IContainer) resources[i]);
- }
- }
- catch (CoreException e) {
- fail(e.toString());
- }
- }
-
- public void testSetFilesToImport() throws Exception {
- project = FileUtil.createProject("ImportSetFilesToImport");
- File element = new File(localDirectory + File.separator + directoryNames[0]);
- ImportOperation operation =
- new ImportOperation(
- project.getFullPath(),
- new File(localDirectory),
- FileSystemStructureProvider.INSTANCE,
- this);
- List importElements = new ArrayList();
- importElements.add(element);
- operation.setFilesToImport(importElements);
- openTestWindow().run(true,true,operation);
- verifyFiles(importElements.size());
- }
-
- public void testSetOverwriteResources() throws Exception {
- project = FileUtil.createProject("ImportSetOverwriteResources");
- File element = new File(localDirectory);
- List importElements = new ArrayList();
- importElements.add(element);
- ImportOperation operation =
- new ImportOperation(
- project.getFullPath(),
- FileSystemStructureProvider.INSTANCE,
- this,
- importElements);
-
- openTestWindow().run(true,true,operation);
- operation.setOverwriteResources(true);
- openTestWindow().run(true,true,operation);
- }
-
- /**
- * Verifies that all files were imported.
- *
- * @param folderCount number of folders that were imported
- */
- private void verifyFiles(int folderCount) {
- try {
- IPath path = new Path(localDirectory);
- IResource targetFolder = project.findMember(path.makeRelative());
-
- assertTrue("Import failed", targetFolder instanceof IContainer);
-
- IResource[] resources = ((IContainer) targetFolder).members();
- assertEquals("Import failed to import all directories", folderCount, resources.length);
- for (int i = 0; i < resources.length; i++) {
- assertTrue("Import failed", resources[i] instanceof IContainer);
- verifyFolder((IContainer) resources[i]);
- }
- }
- catch (CoreException e) {
- fail(e.toString());
- }
- }
- /**
- * Verifies that all files were imported into the specified folder.
- */
- private void verifyFolder(IContainer folder) {
- try {
- IResource[] files = folder.members();
- assertEquals("Import failed to import all files", fileNames.length, files.length);
- for (int j = 0; j < fileNames.length; j++) {
- String fileName = fileNames[j];
- int k;
- for (k = 0; k < files.length; k++) {
- if (fileName.equals(files[k].getName())) break;
- }
- assertTrue("Import failed to import file " + fileName, k < fileNames.length);
- }
- }
- catch (CoreException e) {
- fail(e.toString());
- }
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/tests.ini b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/tests.ini
deleted file mode 100644
index 5acca07..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/datatransfer/tests.ini
+++ /dev/null
@@ -1 +0,0 @@
-localSource=ImportTestSource
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DataTransferMessagesCopy.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DataTransferMessagesCopy.java
deleted file mode 100644
index 83c55c0..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DataTransferMessagesCopy.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-/* THIS IS A COPY OF DataTransferMessages
- * It is made available for UI testing.
- */
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps managing messages
- */
-public class DataTransferMessagesCopy {
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.wizards.datatransfer.messages";//$NON-NLS-1$
- private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-private DataTransferMessagesCopy(){
- // 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/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DataTransferTestStub.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DataTransferTestStub.java
deleted file mode 100644
index 6f7499b..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DataTransferTestStub.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-
-
-/**
- * FOR USE BY TESTS ONLY!
- * <p>
- * Stub class that provides access to classes visible to the package
- * <code>org.eclipse.ui.wizards.datatransfer</code>. For the purpose
- * of testing.
- * </p>
- * @private
- */
-public class DataTransferTestStub {
- //Prevent instantiation
- private DataTransferTestStub(){}
-
- /**
- * Gives access to an instance of WizardFileSystemResourceExportPage1.
- * @return IWizardPage an instance of WizardFileSystemResourceExportPage1
- */
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public static IWizardPage newFileSystemResourceExportPage1(IStructuredSelection selection) {
- return new WizardFileSystemResourceExportPage1(selection);
- }
- */
- /**
- * Gives access to an instance of WizardFileSystemResourceImportPage1.
- * @return IWizardPage an instance of WizardFileSystemResourceImportPage1
- */
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public static IWizardPage newFileSystemResourceImportPage1(IWorkbench workbench, IStructuredSelection selection) {
- return new WizardFileSystemResourceImportPage1(workbench, selection);
- }
- */
- /**
- * Gives access to an instance of WizardZipFileResourceExportPage1.
- * @return IWizardPage an instance of WizardZipFileResourceExportPage1
- */
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public static IWizardPage newZipFileResourceExportPage1(IStructuredSelection selection) {
- return new WizardZipFileResourceExportPage1(selection);
- }
- */
- /**
- * Gives access to an instance of WizardZipFileResourceImportPage1.
- * @return IWizardPage an instance of WizardZipFileResourceImportPage1
- */
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public static IWizardPage newZipFileResourceImportPage1(IStructuredSelection selection) {
- return new WizardZipFileResourceExportPage1(selection);
- }
- */
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIDialogs.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIDialogs.java
deleted file mode 100644
index ac163dc..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIDialogs.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import junit.framework.TestCase;
-
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.YesNoCancelListSelectionDialog;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPartLabelProvider;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.tests.util.DialogCheck;
-
-public class DeprecatedUIDialogs extends TestCase {
- private static final String PROJECT_SELECTION_MESSAGE = WorkbenchMessages.getString("BuildOrderPreference.selectOtherProjects");
- private static final String FILTER_SELECTION_MESSAGE = ResourceNavigatorMessagesCopy.getString("FilterSelection.message");
-
- public DeprecatedUIDialogs(String name) {
- super(name);
- }
- private Shell getShell() {
- return DialogCheck.getShell();
- }
- private IWorkbench getWorkbench() {
- return WorkbenchPlugin.getDefault().getWorkbench();
- }
-
- public void testSaveAll() {
- YesNoCancelListSelectionDialog dialog = new YesNoCancelListSelectionDialog(
- getShell(),
- new AdaptableList(),
- new WorkbenchContentProvider(),
- new WorkbenchPartLabelProvider(),
- WorkbenchMessages.getString("EditorManager.saveResourcesMessage")
- );
- dialog.setTitle(WorkbenchMessages.getString("EditorManager.saveResourcesTitle"));
- DialogCheck.assertDialog(dialog, this);
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIDialogsAuto.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIDialogsAuto.java
deleted file mode 100644
index ea2ea89..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIDialogsAuto.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import junit.framework.TestCase;
-
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.dialogs.YesNoCancelListSelectionDialog;
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.internal.WorkbenchPartLabelProvider;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.model.AdaptableList;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.tests.util.DialogCheck;
-
-
-public class DeprecatedUIDialogsAuto extends TestCase {
- private static final String PROJECT_SELECTION_MESSAGE = WorkbenchMessages.getString("BuildOrderPreference.selectOtherProjects");
- private static final String FILTER_SELECTION_MESSAGE = ResourceNavigatorMessagesCopy.getString("FilterSelection.message");
-
- public DeprecatedUIDialogsAuto(String name) {
- super(name);
- }
- private Shell getShell() {
- return DialogCheck.getShell();
- }
- private IWorkbench getWorkbench() {
- return WorkbenchPlugin.getDefault().getWorkbench();
- }
-
- public void testSaveAll() {
- YesNoCancelListSelectionDialog dialog = new YesNoCancelListSelectionDialog(
- getShell(),
- new AdaptableList(),
- new WorkbenchContentProvider(),
- new WorkbenchPartLabelProvider(),
- WorkbenchMessages.getString("EditorManager.saveResourcesMessage")
- );
- dialog.setTitle(WorkbenchMessages.getString("EditorManager.saveResourcesTitle"));
- DialogCheck.assertDialogTexts(dialog, this);
- }
-
-}
-
-
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIPreferences.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIPreferences.java
deleted file mode 100644
index 0d05708..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIPreferences.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import java.util.Iterator;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceNode;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.PreferenceManager;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-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.PropertyDialog;
-import org.eclipse.ui.internal.dialogs.PropertyPageContributorManager;
-import org.eclipse.ui.internal.dialogs.PropertyPageManager;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.tests.util.DialogCheck;
-
-public class DeprecatedUIPreferences extends TestCase {
- private IProject _project;
- private static final String PROJECT_NAME = "DummyProject";
-
- public DeprecatedUIPreferences(String name) {
- super(name);
- }
- private Shell getShell() {
- return DialogCheck.getShell();
- }
- private IProject getDummyProject() {
- try {
- IProject projects[] = WorkbenchPlugin.getPluginWorkspace().getRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- if ( projects[i].getName().equals(PROJECT_NAME) ) {
- projects[i].delete(true, null);
- break;
- }
- }
- _project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
- _project.create(null);
- } catch (CoreException e) {
- System.out.println(e);
- }
- return _project;
- }
- private void deleteDummyProject(){
- try {
- if (_project != null) {
- _project.delete(true, null);
- }
- } catch (CoreException e) {
- System.out.println(e);
- }
- }
- private PreferenceDialog getPreferenceDialog(String id) {
- PreferenceDialogWrapper dialog = null;
- PreferenceManager manager = WorkbenchPlugin.getDefault().getPreferenceManager();
- if (manager != null) {
- dialog = new PreferenceDialogWrapper(getShell(), manager);
- dialog.create();
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.PREFERENCE_DIALOG});
-
- for (Iterator iterator = manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- iterator.hasNext();)
- {
- IPreferenceNode node = (IPreferenceNode)iterator.next();
- if ( node.getId().equals(id) ) {
- dialog.showPage(node);
- break;
- }
- }
- }
- return dialog;
- }
- private PropertyDialog getPropertyDialog(String id) {
- PropertyDialogWrapper dialog = null;
-
- PropertyPageManager manager = new PropertyPageManager();
- String title = "";
- String name = "";
-
-
- IProject element = getDummyProject();
- if (element == null) {
- return null;
- }
- // load pages for the selection
- // fill the manager with contributions from the matching contributors
- PropertyPageContributorManager.getManager().contribute(manager, element);
-
- IWorkbenchAdapter adapter = (IWorkbenchAdapter)element.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- name = adapter.getLabel(element);
- }
-
- // testing if there are pages in the manager
- Iterator pages = manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- if (!pages.hasNext()) {
- return null;
- } else {
- title = WorkbenchMessages.format("PropertyDialog.propertyMessage", new Object[] {name});
- dialog = new PropertyDialogWrapper(getShell(), manager, new StructuredSelection(element));
- dialog.create();
- dialog.getShell().setText(title);
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.PROPERTY_DIALOG});
- for (Iterator iterator = manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- iterator.hasNext();)
- {
- IPreferenceNode node = (IPreferenceNode)iterator.next();
- if ( node.getId().equals(id) ) {
- dialog.showPage(node);
- break;
- }
- }
- }
- return dialog;
- }
-
- public void testWorkbenchPref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.ui.preferencePages.Workbench");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testAppearancePref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.ui.preferencePages.Views");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testCompareViewersPref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.compare.internal.ComparePreferencePage");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testDefaultTextEditorPref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.ui.preferencePages.TextEditor");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testFileEditorsPref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.ui.preferencePages.FileEditors");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testLocalHistoryPref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.ui.preferencePages.FileStates");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testPerspectivesPref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.ui.preferencePages.Perspectives");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testInfoProp() {
- Dialog dialog = getPropertyDialog("org.eclipse.ui.propertypages.info.file");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testProjectReferencesProp() {
- Dialog dialog = getPropertyDialog("org.eclipse.ui.propertypages.project.reference");
- DialogCheck.assertDialog(dialog, this);
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIPreferencesAuto.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIPreferencesAuto.java
deleted file mode 100644
index 2efadd0..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIPreferencesAuto.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import java.util.Iterator;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceNode;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.PreferenceManager;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-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.PropertyDialog;
-import org.eclipse.ui.internal.dialogs.PropertyPageContributorManager;
-import org.eclipse.ui.internal.dialogs.PropertyPageManager;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.tests.util.DialogCheck;
-
-public class DeprecatedUIPreferencesAuto extends TestCase {
-
- private IProject _project;
- private static final String PROJECT_NAME = "DummyProject";
-
- public DeprecatedUIPreferencesAuto(String name) {
- super(name);
- }
- protected Shell getShell() {
- return DialogCheck.getShell();
- }
-
- private IProject getDummyProject() {
- try {
- IProject projects[] =
- WorkbenchPlugin.getPluginWorkspace().getRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- if (projects[i].getName().equals(PROJECT_NAME)) {
- projects[i].delete(true, null);
- break;
- }
- }
- _project =
- ResourcesPlugin.getWorkspace().getRoot().getProject(
- PROJECT_NAME);
- _project.create(null);
- } catch (CoreException e) {
- System.out.println(e);
- }
- return _project;
- }
- private void deleteDummyProject() {
- try {
- if (_project != null) {
- _project.delete(true, null);
- }
- } catch (CoreException e) {
- System.out.println(e);
- }
- }
- private PreferenceDialog getPreferenceDialog(String id) {
- PreferenceDialogWrapper dialog = null;
- PreferenceManager manager =
- WorkbenchPlugin.getDefault().getPreferenceManager();
- if (manager != null) {
- dialog = new PreferenceDialogWrapper(getShell(), manager);
- dialog.create();
- WorkbenchHelp.setHelp(
- dialog.getShell(),
- new Object[] { IHelpContextIds.PREFERENCE_DIALOG });
-
- for (Iterator iterator =
- manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- iterator.hasNext();
- ) {
- IPreferenceNode node = (IPreferenceNode) iterator.next();
- if (node.getId().equals(id)) {
- dialog.showPage(node);
- break;
- }
- }
- }
- return dialog;
- }
- private PropertyDialog getPropertyDialog(String id) {
- PropertyDialogWrapper dialog = null;
-
- PropertyPageManager manager = new PropertyPageManager();
- String title = "";
- String name = "";
-
- IProject element = getDummyProject();
- if (element == null) {
- return null;
- }
- // load pages for the selection
- // fill the manager with contributions from the matching contributors
- PropertyPageContributorManager.getManager().contribute(
- manager,
- element);
-
- IWorkbenchAdapter adapter =
- (IWorkbenchAdapter) element.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- name = adapter.getLabel(element);
- }
-
- // testing if there are pages in the manager
- Iterator pages =
- manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- if (!pages.hasNext()) {
- return null;
- } else {
- title =
- WorkbenchMessages.format(
- "PropertyDialog.propertyMessage",
- new Object[] { name });
- dialog =
- new PropertyDialogWrapper(
- getShell(),
- manager,
- new StructuredSelection(element));
- dialog.create();
- dialog.getShell().setText(title);
- WorkbenchHelp.setHelp(
- dialog.getShell(),
- new Object[] { IHelpContextIds.PROPERTY_DIALOG });
- for (Iterator iterator =
- manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- iterator.hasNext();
- ) {
- IPreferenceNode node = (IPreferenceNode) iterator.next();
- if (node.getId().equals(id)) {
- dialog.showPage(node);
- break;
- }
- }
- }
- return dialog;
- }
-
- public void testWorkbenchPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.preferencePages.Workbench");
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testAppearancePref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.preferencePages.Views");
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testCompareViewersPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.compare.internal.ComparePreferencePage");
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testDefaultTextEditorPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.preferencePages.TextEditor");
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testFileEditorsPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.preferencePages.FileEditors");
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testLocalHistoryPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.preferencePages.FileStates");
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testPerspectivesPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.preferencePages.Perspectives");
- DialogCheck.assertDialogTexts(dialog, this);
- }
-
- //Only really checking if this opens without an exception
- public void testFontEditorsPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.tests.dialogs.FontFieldEditorTestPreferencePage");
- DialogCheck.assertDialogTexts(dialog,this);
- }
-
- public void testInfoProp() {
- /*
- * Commented out because it generates a failure
- * of expect and actual width values. Suspect this
- * is an SWT issue.
- *
- Dialog dialog = getPropertyDialog("org.eclipse.ui.propertypages.info.file");
- DialogCheck.assertDialogTexts(dialog, this);
- */
- }
- public void testProjectReferencesProp() {
- /*
- * Commented out because it generates a failure
- * of expect and actual width values. Suspect this
- * is an SWT issue.
- *
- Dialog dialog = getPropertyDialog("org.eclipse.ui.propertypages.project.reference");
- DialogCheck.assertDialogTexts(dialog, this);
- */
- }
-
- /**
- * Test the editors preference page and toggle the
- * enable state twice to be sure there are no errors.
- */
- public void testFieldEditorEnablePref() {
-
- PreferenceDialogWrapper dialog = null;
- PreferenceManager manager =
- WorkbenchPlugin.getDefault().getPreferenceManager();
- if (manager != null) {
- dialog = new PreferenceDialogWrapper(getShell(), manager);
- dialog.create();
-
- for (Iterator iterator =
- manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- iterator.hasNext();
- ) {
- IPreferenceNode node = (IPreferenceNode) iterator.next();
- if (node
- .getId()
- .equals("org.eclipse.ui.tests.dialogs.EnableTestPreferencePage")) {
- dialog.showPage(node);
- EnableTestPreferencePage page =
- (EnableTestPreferencePage) dialog.getPage(node);
- page.flipState();
- page.flipState();
- break;
- }
- }
- }
-
- }
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIWizards.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIWizards.java
deleted file mode 100644
index 8fe0eed..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIWizards.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import junit.framework.TestCase;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.Dialog;
-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.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.WizardNewProjectReferencePage;
-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;
-import org.eclipse.ui.internal.dialogs.ImportWizard;
-import org.eclipse.ui.internal.dialogs.NewWizard;
-import org.eclipse.ui.tests.util.DialogCheck;
-import org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard;
-import org.eclipse.ui.wizards.newresource.BasicNewFolderResourceWizard;
-import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
-
-
-public class DeprecatedUIWizards extends TestCase {
- private static final int SIZING_WIZARD_WIDTH = 470;
- private static final int SIZING_WIZARD_HEIGHT = 550;
- private static final int SIZING_WIZARD_WIDTH_2 = 500;
- private static final int SIZING_WIZARD_HEIGHT_2 = 500;
-
- public DeprecatedUIWizards(String name) {
- super(name);
- }
- private Shell getShell() {
- return DialogCheck.getShell();
- }
- private IWorkbench getWorkbench() {
- return WorkbenchPlugin.getDefault().getWorkbench();
- }
- private WizardDialog exportWizard(IWizardPage page) {
- ExportWizard wizard = new ExportWizard();
- wizard.init(getWorkbench(), null);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("ExportResourcesAction");
- if(wizardSettings == null)
- wizardSettings = workbenchSettings.addNewSection("ExportResourcesAction");
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
- 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(), new Object[]{IHelpContextIds.EXPORT_WIZARD});
-
- if (page != null) {
- page.setWizard(wizard);
- dialog.showPage(page);
- }
- return dialog;
- }
- private WizardDialog importWizard(IWizardPage page) {
- ImportWizard wizard = new ImportWizard();
- wizard.init(getWorkbench(), null);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("ImportResourcesAction");
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("ImportResourcesAction");
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- 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(), new Object[]{IHelpContextIds.IMPORT_WIZARD});
-
- if (page != null) {
- page.setWizard(wizard);
- dialog.showPage(page);
- }
- return dialog;
- }
-
- public void testExportResources() {//reference: ExportResourcesAction
- Dialog dialog = exportWizard(null);
- DialogCheck.assertDialog(dialog, this);
- }
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public void testFileSystemExport() {
- Dialog dialog = exportWizard( DataTransferTestStub.newFileSystemResourceExportPage1(null) );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testZipFileExport() {
- Dialog dialog = exportWizard( DataTransferTestStub.newZipFileResourceExportPage1(null) );
- DialogCheck.assertDialog(dialog, this);
- }
- */
- public void testImportResources() {//reference: ImportResourcesAction
- Dialog dialog = importWizard(null);
- DialogCheck.assertDialog(dialog, this);
- }
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public void testFileSystemImport() {
- Dialog dialog = importWizard( DataTransferTestStub.newFileSystemResourceImportPage1(WorkbenchPlugin.getDefault().getWorkbench(), StructuredSelection.EMPTY) );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testZipFileImport() {
- Dialog dialog = importWizard( DataTransferTestStub.newZipFileResourceImportPage1(null) );
- DialogCheck.assertDialog(dialog, this);
- }
- */
- public void testNewFile() {
- BasicNewFileResourceWizard wizard = new BasicNewFileResourceWizard();
- wizard.init( PlatformUI.getWorkbench(), new StructuredSelection() );
- wizard.setNeedsProgressMonitor(true);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.NEW_FILE_WIZARD});
- DialogCheck.assertDialog(dialog, this);
- }
- public void testNewFolder() {
- BasicNewFolderResourceWizard wizard = new BasicNewFolderResourceWizard();
- wizard.init( PlatformUI.getWorkbench(), new StructuredSelection() );
- wizard.setNeedsProgressMonitor(true);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFolderAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.NEW_FOLDER_WIZARD});
- DialogCheck.assertDialog(dialog, this);
- }
- public void testNewProjectPage1() {
- BasicNewProjectResourceWizard wizard = new BasicNewProjectResourceWizard();
- wizard.init(PlatformUI.getWorkbench(), null);
- wizard.setNeedsProgressMonitor(true);
-
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.NEW_PROJECT_WIZARD});
- DialogCheck.assertDialog(dialog, this);
- }
- public void testNewProjectPage2() {
- BasicNewProjectResourceWizard wizard = new BasicNewProjectResourceWizard();
- wizard.init(PlatformUI.getWorkbench(), null);
- wizard.setNeedsProgressMonitor(true);
-
- WizardNewProjectReferencePage page = new WizardNewProjectReferencePage("basicReferenceProjectPage");//$NON-NLS-1$
- page.setTitle(ResourceMessagesCopy.getString("NewProject.refeerenceTitle")); //$NON-NLS-1$
- page.setDescription(ResourceMessagesCopy.getString("NewProject.referenceDescription")); //$NON-NLS-1$
- page.setWizard(wizard);
-
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- dialog.showPage(page);
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.NEW_PROJECT_WIZARD});
- DialogCheck.assertDialog(dialog, this);
- }
- public void testNewProject() {
- // Create wizard selection wizard.
- NewWizard wizard = new NewWizard();
- wizard.setProjectsOnly(true);
- ISelection selection = getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- IStructuredSelection selectionToPass = null;
- if (selection instanceof IStructuredSelection)
- selectionToPass = (IStructuredSelection) selection;
- else
- selectionToPass = StructuredSelection.EMPTY;
- wizard.init(getWorkbench(), selectionToPass);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction");//$NON-NLS-1$
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("NewWizardAction");//$NON-NLS-1$
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- // Create wizard dialog.
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.NEW_PROJECT_WIZARD});
- DialogCheck.assertDialog(dialog, this);
- }
- public void testNewResource() {
- NewWizard wizard = new NewWizard();
- ISelection selection = getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- IStructuredSelection selectionToPass = null;
- if (selection instanceof IStructuredSelection)
- selectionToPass = (IStructuredSelection) selection;
- else
- selectionToPass = StructuredSelection.EMPTY;
- wizard.init(getWorkbench(), selectionToPass);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction");//$NON-NLS-1$
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("NewWizardAction");//$NON-NLS-1$
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.NEW_WIZARD});
- DialogCheck.assertDialog(dialog, this);
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIWizardsAuto.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIWizardsAuto.java
deleted file mode 100644
index ac3ef32..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/DeprecatedUIWizardsAuto.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-import org.eclipse.ui.dialogs.WizardNewProjectReferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.ui.tests.util.DialogCheck;
-import org.eclipse.ui.tests.util.FileUtil;
-import org.eclipse.ui.wizards.newresource.*;
-
-public class DeprecatedUIWizardsAuto extends TestCase {
- private static final int SIZING_WIZARD_WIDTH = 470;
- private static final int SIZING_WIZARD_HEIGHT = 550;
- private static final int SIZING_WIZARD_WIDTH_2 = 500;
- private static final int SIZING_WIZARD_HEIGHT_2 = 500;
-
- private IProject project;
-
- public DeprecatedUIWizardsAuto(String name) {
- super(name);
- }
- private Shell getShell() {
- return DialogCheck.getShell();
- }
- private IWorkbench getWorkbench() {
- return WorkbenchPlugin.getDefault().getWorkbench();
- }
-
- private WizardDialog exportWizard(IWizardPage page) {
- ExportWizard wizard = new ExportWizard();
- wizard.init(getWorkbench(), null);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("ExportResourcesAction");
- if(wizardSettings == null)
- wizardSettings = workbenchSettings.addNewSection("ExportResourcesAction");
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
- 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(), new Object[]{IHelpContextIds.EXPORT_WIZARD});
-
- if (page != null) {
- page.setWizard(wizard);
- dialog.showPage(page);
- }
- return dialog;
- }
- private WizardDialog importWizard(IWizardPage page) {
- ImportWizard wizard = new ImportWizard();
- wizard.init(getWorkbench(), null);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("ImportResourcesAction");
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("ImportResourcesAction");
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- 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(), new Object[]{IHelpContextIds.IMPORT_WIZARD});
-
- if (page != null) {
- page.setWizard(wizard);
- dialog.showPage(page);
- }
- return dialog;
- }
-
- /**
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- try {
- if (project != null) {
- project.delete(true,true,null);
- project = null;
- }
- }
- catch (CoreException e) {
- fail(e.toString());
- }
- }
-
- public void testExportResources() {//reference: ExportResourcesAction
- Dialog dialog = exportWizard(null);
- DialogCheck.assertDialogTexts(dialog, this);
- }
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public void testFileSystemExport() {
- Dialog dialog = exportWizard( DataTransferTestStub.newFileSystemResourceExportPage1(null) );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testZipFileExport() {
- Dialog dialog = exportWizard( DataTransferTestStub.newZipFileResourceExportPage1(null) );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- */
- public void testImportResources() {//reference: ImportResourcesAction
- Dialog dialog = importWizard(null);
- DialogCheck.assertDialogTexts(dialog, this);
- }
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public void testFileSystemImport() {
- Dialog dialog = importWizard( DataTransferTestStub.newFileSystemResourceImportPage1(WorkbenchPlugin.getDefault().getWorkbench(), StructuredSelection.EMPTY) );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testZipFileImport() {
- Dialog dialog = importWizard( DataTransferTestStub.newZipFileResourceImportPage1(null) );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- */
- public void testNewFile() {
- BasicNewFileResourceWizard wizard = new BasicNewFileResourceWizard();
- wizard.init( PlatformUI.getWorkbench(), new StructuredSelection() );
- wizard.setNeedsProgressMonitor(true);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.NEW_FILE_WIZARD});
- DialogCheck.assertDialogTexts(dialog, this);
- }
- /**
- * Test for bug 30719 [Linked Resources] NullPointerException when setting filename for WizardNewFileCreationPage
- */
- public void testNewFile2() {
- BasicNewFileResourceWizard wizard = new BasicNewFileResourceWizard() {
- public void addPages() {
- super.addPages();
- IWizardPage page = getPage("newFilePage1");
- assertTrue("Expected newFilePage1", page instanceof WizardNewFileCreationPage);
- WizardNewFileCreationPage fileCreationPage = (WizardNewFileCreationPage) page;
-
- try {
- project = FileUtil.createProject("testNewFile2");
- }
- catch (CoreException e) {
- fail(e.getMessage());
- }
- fileCreationPage.setContainerFullPath(project.getFullPath());
- fileCreationPage.setFileName("testFileName.test");
- }
- };
-
- wizard.init( PlatformUI.getWorkbench(), new StructuredSelection() );
- wizard.setNeedsProgressMonitor(true);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_FILE_WIZARD);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNewFolder() {
- BasicNewFolderResourceWizard wizard = new BasicNewFolderResourceWizard();
- wizard.init( PlatformUI.getWorkbench(), new StructuredSelection() );
- wizard.setNeedsProgressMonitor(true);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFolderAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.NEW_FOLDER_WIZARD});
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNewProjectPage1() {
- BasicNewProjectResourceWizard wizard = new BasicNewProjectResourceWizard();
- wizard.init(PlatformUI.getWorkbench(), null);
- wizard.setNeedsProgressMonitor(true);
-
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.NEW_PROJECT_WIZARD});
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNewProjectPage2() {
- BasicNewProjectResourceWizard wizard = new BasicNewProjectResourceWizard();
- wizard.init(PlatformUI.getWorkbench(), null);
- wizard.setNeedsProgressMonitor(true);
-
- WizardNewProjectReferencePage page = new WizardNewProjectReferencePage("basicReferenceProjectPage");//$NON-NLS-1$
- page.setTitle(ResourceMessagesCopy.getString("NewProject.refeerenceTitle")); //$NON-NLS-1$
- page.setDescription(ResourceMessagesCopy.getString("NewProject.referenceDescription")); //$NON-NLS-1$
- page.setWizard(wizard);
-
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- dialog.showPage(page);
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.NEW_PROJECT_WIZARD});
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNewProject() {
- // Create wizard selection wizard.
- NewWizard wizard = new NewWizard();
- wizard.setProjectsOnly(true);
- ISelection selection = getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- IStructuredSelection selectionToPass = null;
- if (selection instanceof IStructuredSelection)
- selectionToPass = (IStructuredSelection) selection;
- else
- selectionToPass = StructuredSelection.EMPTY;
- wizard.init(getWorkbench(), selectionToPass);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction");//$NON-NLS-1$
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("NewWizardAction");//$NON-NLS-1$
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- // Create wizard dialog.
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.NEW_PROJECT_WIZARD});
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNewResource() {
- NewWizard wizard = new NewWizard();
- ISelection selection = getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- IStructuredSelection selectionToPass = null;
- if (selection instanceof IStructuredSelection)
- selectionToPass = (IStructuredSelection) selection;
- else
- selectionToPass = StructuredSelection.EMPTY;
- wizard.init(getWorkbench(), selectionToPass);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction");//$NON-NLS-1$
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("NewWizardAction");//$NON-NLS-1$
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- WorkbenchHelp.setHelp(dialog.getShell(), new Object[]{IHelpContextIds.NEW_WIZARD});
- DialogCheck.assertDialogTexts(dialog, this);
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/EnableTestPreferencePage.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/EnableTestPreferencePage.java
deleted file mode 100644
index d5fc6cc..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/EnableTestPreferencePage.java
+++ /dev/null
@@ -1,159 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.ColorFieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.FontFieldEditor;
-import org.eclipse.jface.preference.PathEditor;
-import org.eclipse.jface.preference.RadioGroupFieldEditor;
-import org.eclipse.jface.preference.StringFieldEditor;
-
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-public class EnableTestPreferencePage
- extends FieldEditorPreferencePage
- implements IWorkbenchPreferencePage {
-
- private BooleanFieldEditor be;
- private ColorFieldEditor ce;
- private FontFieldEditor fe;
- private PathEditor pe;
- private RadioGroupFieldEditor rg;
- private StringFieldEditor se;
-
- private Composite beParent;
- private Composite ceParent;
- private Composite feParent;
- private Composite peParent;
- private Composite rgParent;
- private Composite seParent;
-
- private boolean enabledState = true;
-
- public EnableTestPreferencePage() {
- super(GRID);
- }
-
- public void flipState() {
- if (enabledState)
- enabledState = false;
- else
- enabledState = true;
-
- be.setEnabled(enabledState, beParent);
- ce.setEnabled(enabledState, ceParent);
- fe.setEnabled(enabledState, feParent);
- pe.setEnabled(enabledState, peParent);
- rg.setEnabled(enabledState, rgParent);
- se.setEnabled(enabledState, seParent);
-
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
- protected void createFieldEditors() {
-
- String[][] labelsAndValues =
- new String[][] { { "Label 1", "Value 1" }, {
- "Label 2", "Value 2" }
- };
-
- beParent = getFieldEditorParent();
- be =
- new BooleanFieldEditor(
- "BooleanValue",
- "BooleanTest",
- beParent);
- addField(be);
-
- ceParent = getFieldEditorParent();
- ce =
- new ColorFieldEditor(
- "ColorValue",
- "Color Test",
- ceParent);
- addField(ce);
-
- feParent = getFieldEditorParent();
- fe =
- new FontFieldEditor(
- "FontValue",
- "Font Test",
- feParent);
- addField(fe);
-
- peParent = getFieldEditorParent();
- pe =
- new PathEditor(
- "PathValue",
- "Path Test",
- "C:\temp",
- peParent);
- addField(pe);
-
- rgParent = getFieldEditorParent();
- rg =
- new RadioGroupFieldEditor(
- "Radio Value",
- "Radio Test",
- 2,
- labelsAndValues,
- rgParent);
- addField(rg);
-
- seParent = getFieldEditorParent();
- se =
- new StringFieldEditor(
- "String Value",
- "String Editor",
- seParent);
- addField(se);
-
- }
-
- /* (non-Javadoc)
- * Method declared on PreferencePage.
- */
- protected Control createContents(Composite parent) {
- Composite composite = (Composite) super.createContents(parent);
- Button enabledButton = new Button(parent, SWT.PUSH);
- enabledButton.setText("Switch Enabled State");
-
- enabledButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- flipState();
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- flipState();
- }
- });
- return composite;
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/FontFieldEditorTestPreferencePage.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/FontFieldEditorTestPreferencePage.java
deleted file mode 100644
index 8138363..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/FontFieldEditorTestPreferencePage.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.FontFieldEditor;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-/**
- * The Field Editor Preference page is a test of the font field
- * editors with and without previewers.
- */
-public class FontFieldEditorTestPreferencePage
- extends FieldEditorPreferencePage
- implements IWorkbenchPreferencePage {
-
- /**
- * Create the preference page.
- */
- public FontFieldEditorTestPreferencePage() {
- super(GRID);
- }
-
- /**
- * @see org.eclipse.jface.preference.FieldEditorPreferencePage#createFieldEditors()
- */
- protected void createFieldEditors() {
-
- Composite feParent = getFieldEditorParent();
-
- for (int i = 0; i < 3; i++) {
- //Create one with a preview
- addField(
- new FontFieldEditor(
- "FontValue" + String.valueOf(i),
- "Font Test" + String.valueOf(i),
- "Preview",
- feParent));
-
- //Create one without
- addField(
- new FontFieldEditor(
- "FontValueDefault" + String.valueOf(i),
- "Font Test Default" + String.valueOf(i),
- feParent));
- }
-
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
- }
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/NavigatorTestStub.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/NavigatorTestStub.java
deleted file mode 100644
index e3aa420..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/NavigatorTestStub.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-
-
-/**
- * FOR USE BY TESTS ONLY!
- * <p>
- * Stub class that provides access to classes visible to the package
- * <code>org.eclipse.ui.views.navigator</code>. For the purpose of
- * testing.
- * </p>
- * @private
- */
-
-public class NavigatorTestStub {
- //Prevent instantiation
- private NavigatorTestStub(){}
-
- /**
- * Gives access to an instance of GotoResourceDialog.
- * @return GotoResourceDialog an instance of GotoResourceDialog.
- */
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public static GotoResourceDialog newGotoResourceDialog(Shell parentShell,IResource[] resources) {
- return new GotoResourceDialog(parentShell, resources);
- }
- */
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/PreferenceDialogWrapper.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/PreferenceDialogWrapper.java
deleted file mode 100644
index 3881546..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/PreferenceDialogWrapper.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.preference.IPreferenceNode;
-import org.eclipse.jface.preference.IPreferencePage;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.PreferenceManager;
-
-public class PreferenceDialogWrapper extends PreferenceDialog {
-
- public PreferenceDialogWrapper(
- Shell parentShell,
- PreferenceManager manager) {
- super(parentShell, manager);
- }
- public boolean showPage(IPreferenceNode node) {
- return super.showPage(node);
- }
-
- public IPreferencePage getPage(IPreferenceNode node) {
- if (node == null)
- return null;
-
- // Create the page if nessessary
- if (node.getPage() == null)
- node.createPage();
-
- if (node.getPage() == null)
- return null;
-
- return node.getPage();
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/PropertyDialogWrapper.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/PropertyDialogWrapper.java
deleted file mode 100644
index 993f771..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/PropertyDialogWrapper.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.preference.IPreferenceNode;
-import org.eclipse.jface.preference.PreferenceManager;
-import org.eclipse.jface.viewers.ISelection;
-
-import org.eclipse.ui.internal.dialogs.PropertyDialog;
-
-
-public class PropertyDialogWrapper extends PropertyDialog {
-
- public PropertyDialogWrapper(Shell parentShell, PreferenceManager manager, ISelection selection) {
- super(parentShell, manager, selection);
- }
- protected boolean showPage(IPreferenceNode node) {
- return super.showPage(node);
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/ResourceMessagesCopy.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/ResourceMessagesCopy.java
deleted file mode 100644
index dcb8db8..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/ResourceMessagesCopy.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps managing messages
- */
-public class ResourceMessagesCopy {
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.wizards.newresource.messages";//$NON-NLS-1$
- private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
-private ResourceMessagesCopy(){
- // 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/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/ResourceNavigatorMessagesCopy.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/ResourceNavigatorMessagesCopy.java
deleted file mode 100644
index 4fd62be..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/ResourceNavigatorMessagesCopy.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-/* THIS IS A COPY OF ResourceNavigatorMessages Class
- * It is made available for UI testing.
- */
-
-import java.text.MessageFormat;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-/**
- * Utility class which helps managing messages
- */
-public class ResourceNavigatorMessagesCopy {
- private static final String RESOURCE_BUNDLE= "org.eclipse.ui.views.navigator.messages";//$NON-NLS-1$
- private static ResourceBundle bundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
-
-private ResourceNavigatorMessagesCopy(){
- // 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/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/TaskListTestStub.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/TaskListTestStub.java
deleted file mode 100644
index f4e4028..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/TaskListTestStub.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-
-
-/**
- * FOR USE BY TESTS ONLY!
- * <p>
- * Stub class that provides access to classes visible to the package
- * <code>org.eclipse.ui.views.tasklist</code>. For the purpose
- * of testing.
- * </p>
- * @private
- */
-public class TaskListTestStub {
- //Prevent instantiation
- private TaskListTestStub(){}
-
- /**
- * Gives access to an instance of FiltersDialog.
- * @return FiltersDialog an instance of FiltersDialog.
- */
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public static FiltersDialog newFiltersDialog(Shell parentShell) {
- return new FiltersDialog(parentShell);
- }
- */
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/TextEditorTestStub.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/TextEditorTestStub.java
deleted file mode 100644
index 57da2e8..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/TextEditorTestStub.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-
-
-/**
- * FOR USE BY TESTS ONLY!
- * <p>
- * Stub class that provides access to classes visible to the package
- * <code>org.eclipse.ui.texteditor</code>. For the purpose of
- * testing.
- * </p>
- * @private
- */
-
-public class TextEditorTestStub {
- //Prevent instantiation
- private TextEditorTestStub(){}
-
- /**
- * Gives access to an instance of FindReplaceDialog.
- * @return FindReplaceDialog an instance of FindReplaceDialog.
- */
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public static FindReplaceDialog newFindReplaceDialog(Shell parentShell) {
- return new FindReplaceDialog(parentShell);
- }
- */
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIAutomatedSuite.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIAutomatedSuite.java
deleted file mode 100644
index 9b04286..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIAutomatedSuite.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-/**
- * Test all areas of the UI.
- */
-public class UIAutomatedSuite extends TestSuite {
-
- /**
- * Returns the suite. This is required to
- * use the JUnit Launcher.
- */
- public static Test suite() {
- return new UIAutomatedSuite();
- }
-
- /**
- * Construct the test suite.
- */
- public UIAutomatedSuite() {
- addTest(new TestSuite(UIDialogsAuto.class));
- addTest(new TestSuite(DeprecatedUIDialogsAuto.class));
- addTest(new TestSuite(UIWizardsAuto.class));
- addTest(new TestSuite(DeprecatedUIWizardsAuto.class));
- addTest(new TestSuite(UIPreferencesAuto.class));
- addTest(new TestSuite(DeprecatedUIPreferencesAuto.class));
- addTest(new TestSuite(UIMessageDialogsAuto.class));
- addTest(new TestSuite(UINewWorkingSetWizardAuto.class));
- addTest(new TestSuite(UIEditWorkingSetWizardAuto.class));
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIDialogs.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIDialogs.java
deleted file mode 100644
index 61b6a7d..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIDialogs.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.ui.internal.registry.PerspectiveDescriptor;
-import org.eclipse.ui.internal.registry.PerspectiveRegistry;
-import org.eclipse.ui.tests.util.DialogCheck;
-
-public class UIDialogs extends TestCase {
- private static final String PROJECT_SELECTION_MESSAGE = WorkbenchMessages.getString("BuildOrderPreference.selectOtherProjects");
- private static final String FILTER_SELECTION_MESSAGE = ResourceNavigatorMessagesCopy.getString("FilterSelection.message");
-
- public UIDialogs(String name) {
- super(name);
- }
- private Shell getShell() {
- return DialogCheck.getShell();
- }
- private IWorkbench getWorkbench() {
- return WorkbenchPlugin.getDefault().getWorkbench();
- }
- public void testAbout() {
- Dialog dialog = new AboutDialog(getWorkbench().getActiveWorkbenchWindow());
- DialogCheck.assertDialog(dialog, this);
- }
- public void testAddProjects() {
- Dialog dialog = new ListSelectionDialog(getShell(),
- null,
- new SimpleListContentProvider(),
- new LabelProvider(),
- PROJECT_SELECTION_MESSAGE
- );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testCopyMoveProject() {
- IProject dummyProject = ResourcesPlugin.getWorkspace().getRoot().getProject("DummyProject");
- Dialog dialog = new ProjectLocationSelectionDialog(getShell(), dummyProject);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testCopyMoveResource() {
- Dialog dialog = new ContainerSelectionDialog( getShell(), null, true, WorkbenchMessages.getString("CopyResourceAction.selectDestination") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testEditActionSetsDialog() {
- Dialog dialog;
- Perspective persp = null;
- //Test perspective: use current perspective of test case
- try {/*fixme: should try to get current perspective, or default; currently only
- gets first perspective in the registry.*/
- persp = new Perspective((PerspectiveDescriptor)getWorkbench().getPerspectiveRegistry().getPerspectives()[0],
- (WorkbenchPage)getWorkbench().getActiveWorkbenchWindow().getActivePage()
- );
- dialog = new CustomizePerspectiveDialog(getShell(), persp);
- } catch (WorkbenchException e) {
- dialog = null;
- }
- DialogCheck.assertDialog(dialog, this);
- if (persp != null) {
- persp.dispose();
- }
- }
- public void testEditorSelection() {
- Dialog dialog = new EditorSelectionDialog( getShell() );
- DialogCheck.assertDialog(dialog, this);
- }
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public void testFindReplace() {
- Dialog dialog = TextEditorTestStub.newFindReplaceDialog( getShell() );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testGotoResource() {
- Dialog dialog = NavigatorTestStub.newGotoResourceDialog(getShell(), new IResource[0]);
- DialogCheck.assertDialog(dialog, this);
- }
- */
- public void testNavigatorFilter() {
- Dialog dialog = new ListSelectionDialog(getShell(), null, new SimpleListContentProvider(), new LabelProvider(), FILTER_SELECTION_MESSAGE);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testNewFileType() {
- Dialog dialog = new FileExtensionDialog( getShell() );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testProgressInformation() {
- ProgressMonitorDialog dialog = new ProgressMonitorDialog( getShell() );
- dialog.setBlockOnOpen(true);
- DialogCheck.assertDialog(dialog, this);
- }
-
- public void testSaveAs() {
- Dialog dialog = new SaveAsDialog( getShell() );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testSavePerspective() {
- PerspectiveRegistry reg = (PerspectiveRegistry)WorkbenchPlugin.getDefault().getPerspectiveRegistry();
- // Get persp name.
- SavePerspectiveDialog dialog = new SavePerspectiveDialog(getShell(), reg);
- IPerspectiveDescriptor description = reg.findPerspectiveWithId( getWorkbench().getActiveWorkbenchWindow().getActivePage().getPerspective().getId() );
- dialog.setInitialSelection(description);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testSelectPerspective() {
- Dialog dialog = new SelectPerspectiveDialog(getShell(), PlatformUI.getWorkbench().getPerspectiveRegistry() );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testSelectTypes() {
- Dialog dialog = new TypeFilteringDialog(getShell(), null);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testShowView() {
- Dialog dialog = new ShowViewDialog( getShell(), WorkbenchPlugin.getDefault().getViewRegistry() );
- DialogCheck.assertDialog(dialog, this);
- }
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public void testTaskFilters() {
- Dialog dialog = TaskListTestStub.newFiltersDialog( getShell() );
- DialogCheck.assertDialog(dialog, this);
- }
- */
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIDialogsAuto.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIDialogsAuto.java
deleted file mode 100644
index 157cbd6..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIDialogsAuto.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.viewers.LabelProvider;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.ui.internal.registry.PerspectiveDescriptor;
-import org.eclipse.ui.internal.registry.PerspectiveRegistry;
-import org.eclipse.ui.tests.util.DialogCheck;
-
-
-public class UIDialogsAuto extends TestCase {
- private static final String PROJECT_SELECTION_MESSAGE = WorkbenchMessages.getString("BuildOrderPreference.selectOtherProjects");
- private static final String FILTER_SELECTION_MESSAGE = ResourceNavigatorMessagesCopy.getString("FilterSelection.message");
-
- public UIDialogsAuto(String name) {
- super(name);
- }
- private Shell getShell() {
- return DialogCheck.getShell();
- }
- private IWorkbench getWorkbench() {
- return WorkbenchPlugin.getDefault().getWorkbench();
- }
-
- public void testAbout() {
- Dialog dialog = new AboutDialog(getWorkbench().getActiveWorkbenchWindow());
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testAddProjects() {
- Dialog dialog = new ListSelectionDialog(getShell(),
- null,
- new SimpleListContentProvider(),
- new LabelProvider(),
- PROJECT_SELECTION_MESSAGE
- );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testCopyMoveProject() {
- IProject dummyProject = ResourcesPlugin.getWorkspace().getRoot().getProject("DummyProject");
- Dialog dialog = new ProjectLocationSelectionDialog(getShell(), dummyProject);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testCopyMoveResource() {
- Dialog dialog = new ContainerSelectionDialog( getShell(), null, true, WorkbenchMessages.getString("CopyResourceAction.selectDestination") );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testEditActionSetsDialog() {
- Dialog dialog;
- Perspective persp = null;
- //Test perspective: use current perspective of test case
- try {/*fixme: should try to get current perspective, or default; currently only
- gets first perspective in the registry.*/
- persp = new Perspective((PerspectiveDescriptor)getWorkbench().getPerspectiveRegistry().getPerspectives()[0],
- (WorkbenchPage)getWorkbench().getActiveWorkbenchWindow().getActivePage()
- );
- dialog = new CustomizePerspectiveDialog(getShell(), persp);
- } catch (WorkbenchException e) {
- dialog = null;
- }
- DialogCheck.assertDialogTexts(dialog, this);
- if (persp != null) {
- persp.dispose();
- }
- }
- public void testEditorSelection() {
- Dialog dialog = new EditorSelectionDialog( getShell() );
- DialogCheck.assertDialogTexts(dialog, this);
- }
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public void testFindReplace() {
- Dialog dialog = TextEditorTestStub.newFindReplaceDialog( getShell() );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testGotoResource() {
- Dialog dialog = NavigatorTestStub.newGotoResourceDialog(getShell(), new IResource[0]);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- */
- public void testNavigatorFilter() {
- Dialog dialog = new ListSelectionDialog(getShell(), null, new SimpleListContentProvider(), new LabelProvider(), FILTER_SELECTION_MESSAGE);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNewFileType() {
- Dialog dialog = new FileExtensionDialog( getShell() );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testProgressInformation() {
- ProgressMonitorDialog dialog = new ProgressMonitorDialog( getShell() );
- dialog.setBlockOnOpen(true);
- DialogCheck.assertDialogTexts(dialog, this);
- }
-
- public void testSaveAs() {
- Dialog dialog = new SaveAsDialog( getShell() );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testSavePerspective() {
- PerspectiveRegistry reg = (PerspectiveRegistry)WorkbenchPlugin.getDefault().getPerspectiveRegistry();
- // Get persp name.
- SavePerspectiveDialog dialog = new SavePerspectiveDialog(getShell(), reg);
- IPerspectiveDescriptor description = reg.findPerspectiveWithId( getWorkbench().getActiveWorkbenchWindow().getActivePage().getPerspective().getId() );
- dialog.setInitialSelection(description);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testSelectPerspective() {
- Dialog dialog = new SelectPerspectiveDialog(getShell(), PlatformUI.getWorkbench().getPerspectiveRegistry() );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testSelectTypes() {
- Dialog dialog = new TypeFilteringDialog(getShell(), null);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testShowView() {
- Dialog dialog = new ShowViewDialog( getShell(), WorkbenchPlugin.getDefault().getViewRegistry() );
- DialogCheck.assertDialogTexts(dialog, this);
- }
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public void testTaskFilters() {
- Dialog dialog = TaskListTestStub.newFiltersDialog( getShell() );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- */
-}
-
-
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIEditWorkingSetWizardAuto.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIEditWorkingSetWizardAuto.java
deleted file mode 100644
index d8faa52..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIEditWorkingSetWizardAuto.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.swt.widgets.*;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-
-import org.eclipse.jface.wizard.IWizardPage;
-
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.dialogs.IWorkingSetPage;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.dialogs.WorkingSetEditWizard;
-import org.eclipse.ui.internal.registry.WorkingSetRegistry;
-import org.eclipse.ui.tests.util.ArrayUtil;
-import org.eclipse.ui.tests.util.DialogCheck;
-
-/**
- * Tests the WorkingSetEditWizard
- * Tests input validation, presence of correct edit page and
- * wizard page texts.
- */
-public class UIEditWorkingSetWizardAuto extends UIWorkingSetWizardsAuto {
- IWorkingSetPage fDefaultEditPage;
-
- public UIEditWorkingSetWizardAuto(String name) {
- super(name);
- }
-
- /**
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
- fDefaultEditPage = registry.getDefaultWorkingSetPage();
- fWizard = new WorkingSetEditWizard(fDefaultEditPage);
- super.setUp();
- }
- public void testEditPage() throws Throwable {
- IWizardPage page = fWizardDialog.getCurrentPage();
- assertTrue(page instanceof IWorkingSetPage);
-
- /*
- * Verify that correct working set edit page is displayed
- */
- assertTrue(page.getClass() == fDefaultEditPage.getClass());
- /*
- * Test initial page state
- */
- assertTrue(page.canFlipToNextPage() == false);
- assertTrue(fWizard.canFinish() == false);
- assertNull(page.getErrorMessage());
- /*
- * Test page state with preset page input
- */
- IWorkingSetManager workingSetManager = fWorkbench.getWorkingSetManager();
- IWorkingSet workingSet = workingSetManager.createWorkingSet(WORKING_SET_NAME_1, new IAdaptable[] {p1, f2});
- ((WorkingSetEditWizard) fWizard).setSelection(workingSet);
-
- List widgets = getWidgets((Composite) page.getControl(), Text.class);
- Text text = (Text) widgets.get(0);
- assertEquals(WORKING_SET_NAME_1, text.getText());
- assertTrue(page.canFlipToNextPage() == false);
- assertTrue(fWizard.canFinish() == false);
- assertNull(page.getErrorMessage());
- widgets = getWidgets((Composite) page.getControl(), Tree.class);
- Tree tree = (Tree) widgets.get(0);
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- assertEquals(workspace.getRoot().getProjects().length, tree.getItemCount());
- setTextWidgetText(WORKING_SET_NAME_2,page);
- assertTrue(fWizard.canFinish());
-
- /*
- * Test page state with partial page input
- */
- setTextWidgetText("",page);
- assertTrue(page.canFlipToNextPage() == false);
- assertTrue(fWizard.canFinish() == false);
- assertNotNull(page.getErrorMessage());
-
- /*
- * Test page state with complete page input
- */
- setTextWidgetText(WORKING_SET_NAME_2,page);
- checkTreeItems();
- assertTrue(page.canFlipToNextPage() == false);
- assertTrue(fWizard.canFinish());
- assertNull(page.getErrorMessage());
-
- fWizard.performFinish();
- workingSet = ((WorkingSetEditWizard) fWizard).getSelection();
- IAdaptable[] workingSetItems = workingSet.getElements();
- assertEquals(WORKING_SET_NAME_2, workingSet.getName());
- assertTrue(ArrayUtil.contains(workingSetItems, p1));
- assertTrue(ArrayUtil.contains(workingSetItems, p2));
-
- DialogCheck.assertDialogTexts(fWizardDialog, this);
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIErrorDialogs.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIErrorDialogs.java
deleted file mode 100644
index ba3815b..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIErrorDialogs.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.tests.util.DialogCheck;
-
-public class UIErrorDialogs extends TestCase {
-
- public UIErrorDialogs(String name) {
- super(name);
- }
-
- private Shell getShell() {
- return DialogCheck.getShell();
- }
-
- /*
- * Get an example ErrorDialog with a status and a couple of
- * child statuses.
- */
- private ErrorDialog getMultiStatusErrorDialog() {
-
- IStatus[] childStatuses = new IStatus[2];
- childStatuses[0] =
- new Status(
- IStatus.ERROR,
- "org.eclipse.ui.tests",
- IStatus.ERROR,
- "Error message 1",
- new Throwable());
- childStatuses[1] =
- new Status(
- IStatus.ERROR,
- "org.eclipse.ui.tests",
- IStatus.ERROR,
- "Error message 2",
- new Throwable());
- MultiStatus mainStatus =
- new MultiStatus(
- "org.eclipse.ui.tests",
- IStatus.ERROR,
- childStatuses,
- "Main error",
- new Throwable());
-
- return new ErrorDialog(
- getShell(),
- "Error Test",
- "Error message",
- mainStatus,
- IStatus.ERROR);
- }
-
- public void testErrorClipboard() {
- Dialog dialog = getMultiStatusErrorDialog();
- DialogCheck.assertDialog(dialog, this);
- }
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIInteractiveSuite.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIInteractiveSuite.java
deleted file mode 100644
index 468bd3c..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIInteractiveSuite.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Test all areas of the UI.
- */
-public class UIInteractiveSuite extends TestSuite {
-
- /**
- * Returns the suite. This is required to
- * use the JUnit Launcher.
- */
- public static Test suite() {
- return new UIInteractiveSuite();
- }
-
- /**
- * Construct the test suite.
- */
- public UIInteractiveSuite() {
- addTest(new TestSuite(UIPreferences.class));
- addTest(new TestSuite(DeprecatedUIPreferences.class));
- addTest(new TestSuite(UIWizards.class));
- addTest(new TestSuite(DeprecatedUIWizards.class));
- addTest(new TestSuite(UIDialogs.class));
- addTest(new TestSuite(DeprecatedUIDialogs.class));
- addTest(new TestSuite(UIMessageDialogs.class));
- addTest(new TestSuite(UIErrorDialogs.class));
- }
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIMessageDialogs.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIMessageDialogs.java
deleted file mode 100644
index d6fe6bb..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIMessageDialogs.java
+++ /dev/null
@@ -1,418 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import java.util.ResourceBundle;
-
-import junit.framework.TestCase;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.JFaceResources;
-
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.tests.util.DialogCheck;
-
-public class UIMessageDialogs extends TestCase {
- private static final String DUMMY_RESOURCE = "Dummy.resource";
- private static final String DUMMY_PROJECT = "DummyProject";
- private static final String DUMMY_ABSOLUTE_PATH = "C:\\Dummypath\\Dummy.resource";
- private static final String DUMMY_RELATIVE_PATH = "\\" + DUMMY_PROJECT + "\\" + DUMMY_RESOURCE;
-
- public UIMessageDialogs(String name) {
- super(name);
- }
-
- private Shell getShell() {
- return DialogCheck.getShell();
- }
-
- /**
- * Returns the given string from the Text Editor's resource bundle.
- * Should call org.eclipse.ui.texteditor.EditorMessages directly,
- * but it has package visibility.
- */
- private String getEditorString(String id) {
- ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.ui.texteditor.EditorMessages");
- assertNotNull("EditorMessages", bundle);
- String string = bundle.getString(id);
- assertNotNull(id, string);
- return string;
- }
-
- /*
- * Convenience method simliar to org.eclipse.jface.dialogs.MessageDialog::openConfirm.
- * The method will return the dialog instead of opening.
- * @param title the dialog's title, or <code>null</code> if none.
- * @param message the message.
- * @return Dialog the confirm dialog.
- */
- private MessageDialog getConfirmDialog(String title, String message) {
- return new MessageDialog(
- getShell(),
- title,
- null,
- message,
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
- }
- /*
- * Convenience method simliar to org.eclipse.jface.dialogs.MessageDialog::openError.
- * The method will return the dialog instead of opening.
- * @param title the dialog's title, or <code>null</code> if none.
- * @param message the message.
- * @return MessageDialog the error confirm dialog.
- */
- private MessageDialog getErrorDialog(String title, String message) {
- return new MessageDialog(
- getShell(),
- title,
- null,
- message,
- MessageDialog.ERROR,
- new String[] {IDialogConstants.OK_LABEL},
- 0);
- }
- /*
- * Convenience method simliar to org.eclipse.jface.dialogs.MessageDialog::openInformation.
- * The method will return the dialog instead of opening.
- * @param title the dialog's title, or <code>null</code> if none.
- * @param message the message.
- * @return MessageDialog the information dialog.
- */
- private MessageDialog getInformationDialog(String title, String message) {
- return new MessageDialog(
- getShell(),
- title,
- null,
- message,
- MessageDialog.INFORMATION,
- new String[] { IDialogConstants.OK_LABEL },
- 0);
- }
- /*
- * Convenience method simliar to org.eclipse.jface.dialogs.MessageDialog::openQuestion.
- * The method will return the dialog instead of opening.
- * @param title the dialog's title, or <code>null</code> if none.
- * @param message the message.
- * @return MessageDialog the question dialog.
- */
- private MessageDialog getQuestionDialog(String title, String message) {
- return new MessageDialog(
- getShell(),
- title,
- null,
- message,
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
- 0);
- }
- /*
- * Convenience method simliar to org.eclipse.jface.dialogs.MessageDialog::getWarningDialog.
- * The method will return the dialog instead of opening.
- * @param title the dialog's title, or <code>null</code> if none.
- * @param message the message.
- * @return MessageDialog the confirm dialog.
- */
- private MessageDialog getWarningDialog(String title, String message) {
- return new MessageDialog(
- getShell(),
- title,
- null,
- message,
- MessageDialog.WARNING,
- new String[] {IDialogConstants.OK_LABEL},
- 0);
- }
-
- public void testAbortPageFlipping() {
- Dialog dialog = getWarningDialog(
- JFaceResources.getString("AbortPageFlippingDialog.title"),
- JFaceResources.getString("AbortPageFlippingDialog.message") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testCloseFileDeleted() {
- Dialog dialog = getConfirmDialog(
- getEditorString("Editor.error.activated.deleted.close.title"),
- getEditorString("Editor.error.activated.deleted.close.message") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testCopyOverwrite() {
- Dialog dialog = getQuestionDialog(
- WorkbenchMessages.getString("CopyResourceAction.resourceExists"),
- WorkbenchMessages.format("CopyResourceAction.overwriteQuestion", new Object[] {DUMMY_RELATIVE_PATH}) );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testDeleteProject() {
- String title = WorkbenchMessages.getString("DeleteResourceAction.titleProject");
- String msg = WorkbenchMessages.format("DeleteResourceAction.confirmProject1", new Object[] {DUMMY_PROJECT, DUMMY_ABSOLUTE_PATH});
- Dialog dialog = new MessageDialog(
- getShell(),
- title,
- null, // accept the default window icon
- msg,
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testDeleteReadOnlyCheck() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("DeleteResourceAction.checkDelete"),
- null,
- WorkbenchMessages.format("DeleteResourceAction.readOnlyQuestion", new Object[] {DUMMY_RESOURCE}),
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL },
- 0);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testDeleteResource() {
- Dialog dialog = getQuestionDialog(
- WorkbenchMessages.getString("DeleteResourceAction.title"),
- WorkbenchMessages.format("DeleteResourceAction.confirm1", new Object[] {DUMMY_RESOURCE}) );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testDeleteResources() {
- Dialog dialog = getQuestionDialog(
- WorkbenchMessages.getString("DeleteResourceAction.title"),
- WorkbenchMessages.format("DeleteResourceAction.confirmN", new Object[] {DUMMY_RESOURCE}) );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testDropOverwrite() {
- Dialog dialog = new MessageDialog(
- getShell(),
- ResourceNavigatorMessagesCopy.getString("DropAdapter.question"),
- null,
- ResourceNavigatorMessagesCopy.format("DropAdapter.overwriteQuery", new Object[] {DUMMY_RELATIVE_PATH}),
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testErrorClosing() {
- Dialog dialog = getQuestionDialog(
- WorkbenchMessages.getString("Error"),
- WorkbenchMessages.getString("ErrorClosingNoArg") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testFileChanged() {
- MessageDialog dialog = getQuestionDialog(
- getEditorString("Editor.error.activated.outofsync.title"),
- getEditorString("Editor.error.activated.outofsync.message") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testFileExtensionEmpty() {
- Dialog dialog = getInformationDialog(
- WorkbenchMessages.getString("FileEditorPreference.extensionEmptyTitle"),
- WorkbenchMessages.getString("FileEditorPreference.extensionEmptyMessage") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testFileNameWrong() {
- Dialog dialog = getInformationDialog(
- WorkbenchMessages.getString("FileEditorPreference.fileNameInvalidTitle"),
- WorkbenchMessages.getString("FileEditorPreference.fileNameInvalidMessage") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testFileTypeExists() {
- Dialog dialog = getInformationDialog(
- WorkbenchMessages.getString("FileEditorPreference.existsTitle"),
- WorkbenchMessages.getString("FileEditorPreference.existsMessage") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testInvalidType_1() {
- Dialog dialog = getWarningDialog(
- WorkbenchMessages.getString("FileExtension.invalidTitle"),
- WorkbenchMessages.getString("FileExtension.invalidMessage") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testInvalidType_2() {
- Dialog dialog = getWarningDialog(
- WorkbenchMessages.getString("FileExtension.invalidType"),
- WorkbenchMessages.getString("FileExtension.invalidTypeMessage") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testMoveReadOnlyCheck() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("MoveResourceAction.title"),
- null,
- WorkbenchMessages.format("MoveResourceAction.checkMoveMessage", new Object[] {DUMMY_RESOURCE}),
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL },
- 0);
- DialogCheck.assertDialog(dialog, this);
- }
- /*
- public void testNoBuilders() {
- Dialog dialog = getWarningDialog(
- WorkbenchMessages.getString("BuildAction.warning"),
- WorkbenchMessages.getString("BuildAction.noBuilders") );
- DialogCheck.assertDialog(dialog, this);
- }
- */
- /*
- public void testNoGlobalBuildersDialog() {
- Dialog dialog = getWarningDialog(
- WorkbenchMessages.getString("GlobalBuildAction.warning"),
- WorkbenchMessages.getString("GlobalBuildAction.noBuilders") );
- DialogCheck.assertDialog(dialog, this);
- }
- */
- public void testNoPropertyPage() {
- Dialog dialog = getInformationDialog(
- WorkbenchMessages.getString("PropertyDialog.messageTitle"),
- WorkbenchMessages.format("PropertyDialog.noPropertyMessage", new Object[] {"DummyPropertyPage"}) );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testNoSelectedExportResources() {
- Dialog dialog = getInformationDialog(
- DataTransferMessagesCopy.getString("DataTransfer.information"),
- DataTransferMessagesCopy.getString("FileExport.noneSelected") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testNoSelectedImportResources() {
- Dialog dialog = getInformationDialog(
- DataTransferMessagesCopy.getString("DataTransfer.information"),
- DataTransferMessagesCopy.getString("FileImport.noneSelected") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testOperationNotAvailable() {
- Dialog dialog = getInformationDialog(
- WorkbenchMessages.getString("Information"),
- WorkbenchMessages.getString("PluginActino.operationNotAvailableMessage") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testOverwritePerspective() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("SavePerspective.overwriteTitle"),
- null,
- WorkbenchMessages.format("SavePerspective.overwriteQuestion", new Object[] {"Dummy Perspective"}),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testRefreshDeleteProject() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("RefreshAction.dialogTitle"),
- null,
- WorkbenchMessages.format("RefreshAction.locationDeletedMessage", new Object[] {DUMMY_PROJECT, "c:\\dummypath\\" + DUMMY_PROJECT}),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
- 0);
- DialogCheck.assertDialogTexts(dialog, this);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testRenameOverwrite() {
- Dialog dialog = getQuestionDialog(
- WorkbenchMessages.getString("RenameResourceAction.resourceExists"),
- WorkbenchMessages.format("RenameResourceAction.overwriteQuestion", new Object[] {DUMMY_RELATIVE_PATH}) );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testResetPerspective() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("ResetPerspective.title"),
- null,
- WorkbenchMessages.format("ResetPerspective.message", new Object[] {"Dummy Perspective"}),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testSaveAsOverwrite() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("Question"),
- null,
- WorkbenchMessages.format("SaveAsDialog.overwriteQuestion", new Object[] {DUMMY_RELATIVE_PATH}),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testSaveChanges() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("Save_Resource"),
- null,
- WorkbenchMessages.format("EditorManager.saveChangesQuestion", new Object[] {DUMMY_RESOURCE}),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testSaveFileDeleted() {
- MessageDialog dialog = new MessageDialog(
- getShell(),
- getEditorString("Editor.error.activated.deleted.save.title"),
- null,
- getEditorString("Editor.error.activated.deleted.save.message"),
- MessageDialog.QUESTION,
- new String[] {
- getEditorString("Editor.error.activated.deleted.save.button.save"),
- getEditorString("Editor.error.activated.deleted.save.button.close")},
- 0);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testUpdateConflict() {
- MessageDialog dialog = getQuestionDialog(
- getEditorString("Editor.error.save.outofsync.title"),
- getEditorString("Editor.error.save.outofsync.message") );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testWizardClosing() {
- Dialog dialog = new MessageDialog(
- getShell(),
- JFaceResources.getString("WizardClosingDialog.title"),
- null,
- JFaceResources.getString("WizardClosingDialog.message"),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL},
- 0);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testWizardOverwrite() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("Question"),
- null,
- WorkbenchMessages.format("WizardDataTransfer.existsQuestion", new Object[] {DUMMY_ABSOLUTE_PATH}),
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialog(dialog, this);
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIMessageDialogsAuto.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIMessageDialogsAuto.java
deleted file mode 100644
index b43f5c5..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIMessageDialogsAuto.java
+++ /dev/null
@@ -1,419 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import java.util.ResourceBundle;
-
-import junit.framework.TestCase;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.resource.JFaceResources;
-
-import org.eclipse.ui.internal.WorkbenchMessages;
-import org.eclipse.ui.tests.util.DialogCheck;
-
-
-public class UIMessageDialogsAuto extends TestCase {
- private static final String DUMMY_RESOURCE = "Dummy.resource";
- private static final String DUMMY_PROJECT = "DummyProject";
- private static final String DUMMY_ABSOLUTE_PATH = "C:\\Dummypath\\Dummy.resource";
- private static final String DUMMY_RELATIVE_PATH = "\\" + DUMMY_PROJECT + "\\" + DUMMY_RESOURCE;
-
- public UIMessageDialogsAuto(String name) {
- super(name);
- }
- private Shell getShell() {
- return DialogCheck.getShell();
- }
-
- /*
- * Convenience method simliar to org.eclipse.jface.dialogs.MessageDialog::openConfirm.
- * The method will return the dialog instead of opening.
- * @param title the dialog's title, or <code>null</code> if none.
- * @param message the message.
- * @return Dialog the confirm dialog.
- */
- private MessageDialog getConfirmDialog(String title, String message) {
- return new MessageDialog(
- getShell(),
- title,
- null,
- message,
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
- }
- /*
- * Convenience method simliar to org.eclipse.jface.dialogs.MessageDialog::openError.
- * The method will return the dialog instead of opening.
- * @param title the dialog's title, or <code>null</code> if none.
- * @param message the message.
- * @return MessageDialog the error confirm dialog.
- */
- private MessageDialog getErrorDialog(String title, String message) {
- return new MessageDialog(
- getShell(),
- title,
- null,
- message,
- MessageDialog.ERROR,
- new String[] {IDialogConstants.OK_LABEL},
- 0);
- }
- /*
- * Convenience method simliar to org.eclipse.jface.dialogs.MessageDialog::openInformation.
- * The method will return the dialog instead of opening.
- * @param title the dialog's title, or <code>null</code> if none.
- * @param message the message.
- * @return MessageDialog the information dialog.
- */
- private MessageDialog getInformationDialog(String title, String message) {
- return new MessageDialog(
- getShell(),
- title,
- null,
- message,
- MessageDialog.INFORMATION,
- new String[] { IDialogConstants.OK_LABEL },
- 0);
- }
- /*
- * Convenience method simliar to org.eclipse.jface.dialogs.MessageDialog::openQuestion.
- * The method will return the dialog instead of opening.
- * @param title the dialog's title, or <code>null</code> if none.
- * @param message the message.
- * @return MessageDialog the question dialog.
- */
- private MessageDialog getQuestionDialog(String title, String message) {
- return new MessageDialog(
- getShell(),
- title,
- null,
- message,
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
- 0);
- }
- /*
- * Convenience method simliar to org.eclipse.jface.dialogs.MessageDialog::getWarningDialog.
- * The method will return the dialog instead of opening.
- * @param title the dialog's title, or <code>null</code> if none.
- * @param message the message.
- * @return MessageDialog the confirm dialog.
- */
- private MessageDialog getWarningDialog(String title, String message) {
- return new MessageDialog(
- getShell(),
- title,
- null,
- message,
- MessageDialog.WARNING,
- new String[] {IDialogConstants.OK_LABEL},
- 0);
- }
-
- public void testAbortPageFlipping() {
- Dialog dialog = getWarningDialog (
- JFaceResources.getString("AbortPageFlippingDialog.title"),
- JFaceResources.getString("AbortPageFlippingDialog.message") );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testCloseFileDeleted() {
- Dialog dialog = null;
- ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.ui.texteditor.EditorMessages");
- if (bundle != null) {
- dialog = getConfirmDialog(
- bundle.getString("Editor.error.activated.deleted.close.title"),
- bundle.getString("Editor.error.activated.deleted.close.message") );
- }
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testCopyOverwrite() {
- Dialog dialog = getQuestionDialog(
- WorkbenchMessages.getString("CopyResourceAction.resourceExists"),
- WorkbenchMessages.format("CopyResourceAction.overwriteQuestion", new Object[] {DUMMY_RELATIVE_PATH}) );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testDeleteProject() {
- String title = WorkbenchMessages.getString("DeleteResourceAction.titleProject");
- String msg = WorkbenchMessages.format("DeleteResourceAction.confirmProject1", new Object[] {DUMMY_PROJECT, DUMMY_ABSOLUTE_PATH});
- Dialog dialog = new MessageDialog(
- getShell(),
- title,
- null, // accept the default window icon
- msg,
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testDeleteReadOnlyCheck() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("DeleteResourceAction.checkDelete"),
- null,
- WorkbenchMessages.format("DeleteResourceAction.readOnlyQuestion", new Object[] {DUMMY_RESOURCE}),
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL },
- 0);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testDeleteResource() {
- Dialog dialog = getQuestionDialog(
- WorkbenchMessages.getString("DeleteResourceAction.title"),
- WorkbenchMessages.format("DeleteResourceAction.confirm1", new Object[] {DUMMY_RESOURCE}) );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testDeleteResources() {
- Dialog dialog = getQuestionDialog(
- WorkbenchMessages.getString("DeleteResourceAction.title"),
- WorkbenchMessages.format("DeleteResourceAction.confirmN", new Object[] {DUMMY_RESOURCE}) );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testDropOverwrite() {
- Dialog dialog = new MessageDialog(
- getShell(),
- ResourceNavigatorMessagesCopy.getString("DropAdapter.question"),
- null,
- ResourceNavigatorMessagesCopy.format("DropAdapter.overwriteQuery", new Object[] {DUMMY_RELATIVE_PATH}),
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testErrorClosing() {
- Dialog dialog = getQuestionDialog(
- WorkbenchMessages.getString("Error"),
- WorkbenchMessages.getString("ErrorClosingNoArg") );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testFileChanged() {
- MessageDialog dialog = null;
- ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.ui.texteditor.EditorMessages");
- if (bundle != null) {
- dialog = getQuestionDialog(
- bundle.getString("Editor.error.activated.outofsync.title"),
- bundle.getString("Editor.error.activated.outofsync.message") );
- }
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testFileExtensionEmpty() {
- Dialog dialog = getInformationDialog(
- WorkbenchMessages.getString("FileEditorPreference.extensionEmptyTitle"),
- WorkbenchMessages.getString("FileEditorPreference.extensionEmptyMessage") );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testFileNameWrong() {
- Dialog dialog = getInformationDialog(
- WorkbenchMessages.getString("FileEditorPreference.fileNameInvalidTitle"),
- WorkbenchMessages.getString("FileEditorPreference.fileNameInvalidMessage") );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testFileTypeExists() {
- Dialog dialog = getInformationDialog(
- WorkbenchMessages.getString("FileEditorPreference.existsTitle"),
- WorkbenchMessages.getString("FileEditorPreference.existsMessage") );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testInvalidType_1() {
- Dialog dialog = getWarningDialog(
- WorkbenchMessages.getString("FileExtension.invalidTitle"),
- WorkbenchMessages.getString("FileExtension.invalidMessage") );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testInvalidType_2() {
- Dialog dialog = getWarningDialog(
- WorkbenchMessages.getString("FileExtension.invalidType"),
- WorkbenchMessages.getString("FileExtension.invalidTypeMessage") );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testMoveReadOnlyCheck() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("MoveResourceAction.title"),
- null,
- WorkbenchMessages.format("MoveResourceAction.checkMoveMessage", new Object[] {DUMMY_RESOURCE}),
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL },
- 0);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNoBuilders() {
- Dialog dialog = getWarningDialog(
- WorkbenchMessages.getString("BuildAction.warning"),
- WorkbenchMessages.getString("BuildAction.noBuilders") );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNoGlobalBuildersDialog() {
- Dialog dialog = getWarningDialog(
- WorkbenchMessages.getString("GlobalBuildAction.warning"),
- WorkbenchMessages.getString("GlobalBuildAction.noBuilders") );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNoPropertyPage() {
- Dialog dialog = getInformationDialog(
- WorkbenchMessages.getString("PropertyDialog.messageTitle"),
- WorkbenchMessages.format("PropertyDialog.noPropertyMessage", new Object[] {"DummyPropertyPage"}) );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNoSelectedExportResources() {
- Dialog dialog = getInformationDialog(
- DataTransferMessagesCopy.getString("DataTransfer.information"),
- DataTransferMessagesCopy.getString("FileExport.noneSelected") );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNoSelectedImportResources() {
- Dialog dialog = getInformationDialog(
- DataTransferMessagesCopy.getString("DataTransfer.information"),
- DataTransferMessagesCopy.getString("FileImport.noneSelected") );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testOperationNotAvailable() {
- Dialog dialog = getInformationDialog(
- WorkbenchMessages.getString("Information"),
- WorkbenchMessages.getString("PluginActino.operationNotAvailableMessage") );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testOverwritePerspective() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("SavePerspective.overwriteTitle"),
- null,
- WorkbenchMessages.format("SavePerspective.overwriteQuestion", new Object[] {"Dummy Perspective"}),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testRefreshDeleteProject() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("RefreshAction.dialogTitle"),
- null,
- WorkbenchMessages.format("RefreshAction.locationDeletedMessage", new Object[] {DUMMY_PROJECT, "c:\\dummypath\\" + DUMMY_PROJECT}),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL},
- 0);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testRenameOverwrite() {
- Dialog dialog = getQuestionDialog(
- WorkbenchMessages.getString("RenameResourceAction.resourceExists"),
- WorkbenchMessages.format("RenameResourceAction.overwriteQuestion", new Object[] {DUMMY_RELATIVE_PATH}) );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testResetPerspective() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("ResetPerspective.title"),
- null,
- WorkbenchMessages.format("ResetPerspective.message", new Object[] {"Dummy Perspective"}),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testSaveAsOverwrite() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("Question"),
- null,
- WorkbenchMessages.format("SaveAsDialog.overwriteQuestion", new Object[] {DUMMY_RELATIVE_PATH}),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testSaveChanges() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("Save_Resource"),
- null,
- WorkbenchMessages.format("EditorManager.saveChangesQuestion", new Object[] {DUMMY_RESOURCE}),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testSaveFileDeleted() {
- MessageDialog dialog = null;
- ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.ui.texteditor.EditorMessages");
- if (bundle != null) {
- dialog= new MessageDialog(
- getShell(),
- bundle.getString("Editor.error.activated.deleted.save.title"),
- null,
- bundle.getString("Editor.error.activated.deleted.save.message"),
- MessageDialog.QUESTION,
- new String[] {
- bundle.getString("Editor.error.activated.deleted.save.button.save"),
- bundle.getString("Editor.error.activated.deleted.save.button.close")},
- 0);
- }
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testUpdateConflict() {
- MessageDialog dialog = null;
- ResourceBundle bundle = ResourceBundle.getBundle("org.eclipse.ui.texteditor.EditorMessages");
- if (bundle != null) {
- dialog = getQuestionDialog(
- bundle.getString("Editor.error.save.outofsync.title"),
- bundle.getString("Editor.error.save.outofsync.message") );
- }
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testWizardClosing() {
- Dialog dialog = new MessageDialog(
- getShell(),
- JFaceResources.getString("WizardClosingDialog.title"),
- null,
- JFaceResources.getString("WizardClosingDialog.message"),
- MessageDialog.QUESTION,
- new String[] {IDialogConstants.OK_LABEL},
- 0);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testWizardOverwrite() {
- Dialog dialog = new MessageDialog(
- getShell(),
- WorkbenchMessages.getString("Question"),
- null,
- WorkbenchMessages.format("WizardDataTransfer.existsQuestion", new Object[] {DUMMY_ABSOLUTE_PATH}),
- MessageDialog.QUESTION,
- new String[] {
- IDialogConstants.YES_LABEL,
- IDialogConstants.YES_TO_ALL_LABEL,
- IDialogConstants.NO_LABEL,
- IDialogConstants.CANCEL_LABEL},
- 0);
- DialogCheck.assertDialogTexts(dialog, this);
- }
-
-
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UINewWorkingSetWizardAuto.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UINewWorkingSetWizardAuto.java
deleted file mode 100644
index 348cc89..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UINewWorkingSetWizardAuto.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.jface.wizard.*;
-import org.eclipse.swt.*;
-import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.*;
-import org.eclipse.ui.dialogs.*;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.ui.internal.registry.*;
-import org.eclipse.ui.tests.util.*;
-
-/**
- * Tests the WorkingSetNewWizard.
- * Tests input validation, presence of type page and correct edit page
- * and wizard page texts.
- */
-public class UINewWorkingSetWizardAuto extends UIWorkingSetWizardsAuto {
-
- public UINewWorkingSetWizardAuto(String name) {
- super(name);
- }
- /**
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- fWizard = new WorkingSetNewWizard();
- super.setUp();
- }
- public void testTypePage() throws Throwable {
- IWizardPage page = fWizardDialog.getCurrentPage();
- assertTrue((page instanceof WorkingSetTypePage) == fWorkingSetDescriptors.length > 1);
-
- /*
- * Should have at least resourceWorkingSetPage and MockWorkingSet
- */
- assertTrue(fWorkingSetDescriptors.length >= 2);
- if (page instanceof WorkingSetTypePage) {
- WorkingSetTypePage typePage = (WorkingSetTypePage) page;
- List widgets = getWidgets((Composite) page.getControl(), Table.class);
- Table table = (Table) widgets.get(0);
- /*
- * Test initial page state
- */
- assertEquals(fWorkingSetDescriptors.length, table.getItemCount());
- assertTrue(typePage.canFlipToNextPage() == false);
- assertTrue(fWizard.canFinish() == false);
- /*
- * Test page state with page complete input
- */
- table.setSelection(fWorkingSetDescriptors.length - 1);
- table.notifyListeners(SWT.Selection, new Event());
- assertTrue(typePage.canFlipToNextPage());
- assertTrue(fWizard.canFinish() == false);
-
- /*
- * Check page texts
- */
- DialogCheck.assertDialogTexts(fWizardDialog, this);
- }
- }
- public void testEditPage() throws Throwable {
- WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
- IWizardPage page = fWizardDialog.getCurrentPage();
- IWizardPage defaultEditPage = registry.getDefaultWorkingSetPage();
- String defaultEditPageClassName = defaultEditPage.getClass().getName();
- assertTrue((page instanceof WorkingSetTypePage) == fWorkingSetDescriptors.length > 1);
-
- if (page instanceof WorkingSetTypePage) {
- /*
- * Select the default (Resource) working set type
- * and advance to edit page.
- */
- List widgets = getWidgets((Composite) page.getControl(), Table.class);
- Table table = (Table) widgets.get(0);
- TableItem[] items = table.getItems();
- String workingSetName = null;
- for (int descriptorIndex = 0; descriptorIndex < fWorkingSetDescriptors.length; descriptorIndex++) {
- WorkingSetDescriptor descriptor = fWorkingSetDescriptors[descriptorIndex];
- if (defaultEditPageClassName.equals(descriptor.getPageClassName())) {
- workingSetName = descriptor.getName();
- break;
- }
- }
- assertNotNull(workingSetName);
- boolean found = false;
- for (int i = 0; i < items.length; i++) {
- if (items[i].getText().equals(workingSetName)) {
- table.setSelection(i);
- found = true;
- break;
- }
- }
- assertTrue(found);
- fWizardDialog.showPage(fWizard.getNextPage(page));
- }
- page = fWizardDialog.getCurrentPage();
- assertTrue(page instanceof IWorkingSetPage);
-
- /*
- * Verify that correct working set edit page is displayed
- */
- assertTrue(page.getClass() == defaultEditPage.getClass());
- /*
- * Test initial page state
- */
- assertTrue(page.canFlipToNextPage() == false);
- assertTrue(fWizard.canFinish() == false);
- assertNull(page.getErrorMessage());
- /*
- * Test page state with partial page input
- */
- setTextWidgetText(WORKING_SET_NAME_1,page);
- assertTrue(page.canFlipToNextPage() == false);
- assertTrue(fWizard.canFinish() == false);
- assertNotNull(page.getErrorMessage());
-
- /*
- * Test page state with page complete input
- */
- checkTreeItems();
- assertTrue(page.canFlipToNextPage() == false);
- assertTrue(fWizard.canFinish());
- assertNull(page.getErrorMessage());
-
- fWizard.performFinish();
- IWorkingSet workingSet = ((WorkingSetNewWizard) fWizard).getSelection();
- IAdaptable[] workingSetItems = workingSet.getElements();
- assertEquals(WORKING_SET_NAME_1, workingSet.getName());
-
- List widgets = getWidgets((Composite) page.getControl(), Tree.class);
- Tree tree = (Tree) widgets.get(0);
- assertEquals(workingSetItems.length, tree.getItemCount());
- assertTrue(ArrayUtil.contains(workingSetItems, p1));
- assertTrue(ArrayUtil.contains(workingSetItems, p2));
-
- /*
- * Check page texts
- */
- DialogCheck.assertDialogTexts(fWizardDialog, this);
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIPreferences.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIPreferences.java
deleted file mode 100644
index 682f1cf..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIPreferences.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import java.util.Iterator;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceNode;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.PreferenceManager;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-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.PropertyDialog;
-import org.eclipse.ui.internal.dialogs.PropertyPageContributorManager;
-import org.eclipse.ui.internal.dialogs.PropertyPageManager;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.tests.util.DialogCheck;
-
-public class UIPreferences extends TestCase {
- private IProject _project;
- private static final String PROJECT_NAME = "DummyProject";
-
- public UIPreferences(String name) {
- super(name);
- }
- private Shell getShell() {
- return DialogCheck.getShell();
- }
- private IProject getDummyProject() {
- try {
- IProject projects[] = WorkbenchPlugin.getPluginWorkspace().getRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- if ( projects[i].getName().equals(PROJECT_NAME) ) {
- projects[i].delete(true, null);
- break;
- }
- }
- _project = ResourcesPlugin.getWorkspace().getRoot().getProject(PROJECT_NAME);
- _project.create(null);
- } catch (CoreException e) {
- System.out.println(e);
- }
- return _project;
- }
- private void deleteDummyProject(){
- try {
- if (_project != null) {
- _project.delete(true, null);
- }
- } catch (CoreException e) {
- System.out.println(e);
- }
- }
- private PreferenceDialog getPreferenceDialog(String id) {
- PreferenceDialogWrapper dialog = null;
- PreferenceManager manager = WorkbenchPlugin.getDefault().getPreferenceManager();
- if (manager != null) {
- dialog = new PreferenceDialogWrapper(getShell(), manager);
- dialog.create();
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.PREFERENCE_DIALOG);
-
- for (Iterator iterator = manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- iterator.hasNext();)
- {
- IPreferenceNode node = (IPreferenceNode)iterator.next();
- if ( node.getId().equals(id) ) {
- dialog.showPage(node);
- break;
- }
- }
- }
- return dialog;
- }
- private PropertyDialog getPropertyDialog(String id) {
- PropertyDialogWrapper dialog = null;
-
- PropertyPageManager manager = new PropertyPageManager();
- String title = "";
- String name = "";
-
-
- IProject element = getDummyProject();
- if (element == null) {
- return null;
- }
- // load pages for the selection
- // fill the manager with contributions from the matching contributors
- PropertyPageContributorManager.getManager().contribute(manager, element);
-
- IWorkbenchAdapter adapter = (IWorkbenchAdapter)element.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- name = adapter.getLabel(element);
- }
-
- // testing if there are pages in the manager
- Iterator pages = manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- if (!pages.hasNext()) {
- return null;
- } else {
- title = WorkbenchMessages.format("PropertyDialog.propertyMessage", new Object[] {name});
- dialog = new PropertyDialogWrapper(getShell(), manager, new StructuredSelection(element));
- dialog.create();
- dialog.getShell().setText(title);
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.PROPERTY_DIALOG);
- for (Iterator iterator = manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- iterator.hasNext();)
- {
- IPreferenceNode node = (IPreferenceNode)iterator.next();
- if ( node.getId().equals(id) ) {
- dialog.showPage(node);
- break;
- }
- }
- }
- return dialog;
- }
-
- public void testWorkbenchPref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.ui.preferencePages.Workbench");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testAppearancePref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.ui.preferencePages.Views");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testCompareViewersPref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.compare.internal.ComparePreferencePage");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testDefaultTextEditorPref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.ui.preferencePages.TextEditor");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testFileEditorsPref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.ui.preferencePages.FileEditors");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testLocalHistoryPref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.ui.preferencePages.FileStates");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testPerspectivesPref() {
- Dialog dialog = getPreferenceDialog("org.eclipse.ui.preferencePages.Perspectives");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testInfoProp() {
- Dialog dialog = getPropertyDialog("org.eclipse.ui.propertypages.info.file");
- DialogCheck.assertDialog(dialog, this);
- }
- public void testProjectReferencesProp() {
- Dialog dialog = getPropertyDialog("org.eclipse.ui.propertypages.project.reference");
- DialogCheck.assertDialog(dialog, this);
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIPreferencesAuto.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIPreferencesAuto.java
deleted file mode 100644
index 48b79dc..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIPreferencesAuto.java
+++ /dev/null
@@ -1,257 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import java.util.Iterator;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.preference.IPreferenceNode;
-import org.eclipse.jface.preference.PreferenceDialog;
-import org.eclipse.jface.preference.PreferenceManager;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-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.PropertyDialog;
-import org.eclipse.ui.internal.dialogs.PropertyPageContributorManager;
-import org.eclipse.ui.internal.dialogs.PropertyPageManager;
-import org.eclipse.ui.model.IWorkbenchAdapter;
-import org.eclipse.ui.tests.util.DialogCheck;
-
-public class UIPreferencesAuto extends TestCase {
-
- private IProject _project;
- private static final String PROJECT_NAME = "DummyProject";
-
- public UIPreferencesAuto(String name) {
- super(name);
- }
- protected Shell getShell() {
- return DialogCheck.getShell();
- }
-
- private IProject getDummyProject() {
- try {
- IProject projects[] =
- WorkbenchPlugin.getPluginWorkspace().getRoot().getProjects();
- for (int i = 0; i < projects.length; i++) {
- if (projects[i].getName().equals(PROJECT_NAME)) {
- projects[i].delete(true, null);
- break;
- }
- }
- _project =
- ResourcesPlugin.getWorkspace().getRoot().getProject(
- PROJECT_NAME);
- _project.create(null);
- } catch (CoreException e) {
- System.out.println(e);
- }
- return _project;
- }
- private void deleteDummyProject() {
- try {
- if (_project != null) {
- _project.delete(true, null);
- }
- } catch (CoreException e) {
- System.out.println(e);
- }
- }
- private PreferenceDialog getPreferenceDialog(String id) {
- PreferenceDialogWrapper dialog = null;
- PreferenceManager manager =
- WorkbenchPlugin.getDefault().getPreferenceManager();
- if (manager != null) {
- dialog = new PreferenceDialogWrapper(getShell(), manager);
- dialog.create();
- WorkbenchHelp.setHelp(
- dialog.getShell(),
- IHelpContextIds.PREFERENCE_DIALOG);
-
- for (Iterator iterator =
- manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- iterator.hasNext();
- ) {
- IPreferenceNode node = (IPreferenceNode) iterator.next();
- if (node.getId().equals(id)) {
- dialog.showPage(node);
- break;
- }
- }
- }
- return dialog;
- }
- private PropertyDialog getPropertyDialog(String id) {
- PropertyDialogWrapper dialog = null;
-
- PropertyPageManager manager = new PropertyPageManager();
- String title = "";
- String name = "";
-
- IProject element = getDummyProject();
- if (element == null) {
- return null;
- }
- // load pages for the selection
- // fill the manager with contributions from the matching contributors
- PropertyPageContributorManager.getManager().contribute(
- manager,
- element);
-
- IWorkbenchAdapter adapter =
- (IWorkbenchAdapter) element.getAdapter(IWorkbenchAdapter.class);
- if (adapter != null) {
- name = adapter.getLabel(element);
- }
-
- // testing if there are pages in the manager
- Iterator pages =
- manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- if (!pages.hasNext()) {
- return null;
- } else {
- title =
- WorkbenchMessages.format(
- "PropertyDialog.propertyMessage",
- new Object[] { name });
- dialog =
- new PropertyDialogWrapper(
- getShell(),
- manager,
- new StructuredSelection(element));
- dialog.create();
- dialog.getShell().setText(title);
- WorkbenchHelp.setHelp(
- dialog.getShell(),
- IHelpContextIds.PROPERTY_DIALOG);
- for (Iterator iterator =
- manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- iterator.hasNext();
- ) {
- IPreferenceNode node = (IPreferenceNode) iterator.next();
- if (node.getId().equals(id)) {
- dialog.showPage(node);
- break;
- }
- }
- }
- return dialog;
- }
-
- public void testWorkbenchPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.preferencePages.Workbench");
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testAppearancePref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.preferencePages.Views");
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testCompareViewersPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.compare.internal.ComparePreferencePage");
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testDefaultTextEditorPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.preferencePages.TextEditor");
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testFileEditorsPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.preferencePages.FileEditors");
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testLocalHistoryPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.preferencePages.FileStates");
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testPerspectivesPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.preferencePages.Perspectives");
- DialogCheck.assertDialogTexts(dialog, this);
- }
-
- //Only really checking if this opens without an exception
- public void testFontEditorsPref() {
- Dialog dialog =
- getPreferenceDialog("org.eclipse.ui.tests.dialogs.FontFieldEditorTestPreferencePage");
- DialogCheck.assertDialogTexts(dialog,this);
- }
-
- public void testInfoProp() {
- /*
- * Commented out because it generates a failure
- * of expect and actual width values. Suspect this
- * is an SWT issue.
- *
- Dialog dialog = getPropertyDialog("org.eclipse.ui.propertypages.info.file");
- DialogCheck.assertDialogTexts(dialog, this);
- */
- }
- public void testProjectReferencesProp() {
- /*
- * Commented out because it generates a failure
- * of expect and actual width values. Suspect this
- * is an SWT issue.
- *
- Dialog dialog = getPropertyDialog("org.eclipse.ui.propertypages.project.reference");
- DialogCheck.assertDialogTexts(dialog, this);
- */
- }
-
- /**
- * Test the editors preference page and toggle the
- * enable state twice to be sure there are no errors.
- */
- public void testFieldEditorEnablePref() {
-
- PreferenceDialogWrapper dialog = null;
- PreferenceManager manager =
- WorkbenchPlugin.getDefault().getPreferenceManager();
- if (manager != null) {
- dialog = new PreferenceDialogWrapper(getShell(), manager);
- dialog.create();
-
- for (Iterator iterator =
- manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- iterator.hasNext();
- ) {
- IPreferenceNode node = (IPreferenceNode) iterator.next();
- if (node
- .getId()
- .equals("org.eclipse.ui.tests.dialogs.EnableTestPreferencePage")) {
- dialog.showPage(node);
- EnableTestPreferencePage page =
- (EnableTestPreferencePage) dialog.getPage(node);
- page.flipState();
- page.flipState();
- break;
- }
- }
- }
-
- }
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWizards.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWizards.java
deleted file mode 100644
index eb942a8..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWizards.java
+++ /dev/null
@@ -1,228 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import junit.framework.TestCase;
-
-import org.eclipse.swt.widgets.Shell;
-
-import org.eclipse.jface.dialogs.Dialog;
-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.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.WizardNewProjectReferencePage;
-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;
-import org.eclipse.ui.internal.dialogs.ImportWizard;
-import org.eclipse.ui.internal.dialogs.NewWizard;
-import org.eclipse.ui.tests.util.DialogCheck;
-import org.eclipse.ui.wizards.newresource.BasicNewFileResourceWizard;
-import org.eclipse.ui.wizards.newresource.BasicNewFolderResourceWizard;
-import org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard;
-
-
-public class UIWizards extends TestCase {
- private static final int SIZING_WIZARD_WIDTH = 470;
- private static final int SIZING_WIZARD_HEIGHT = 550;
- private static final int SIZING_WIZARD_WIDTH_2 = 500;
- private static final int SIZING_WIZARD_HEIGHT_2 = 500;
-
- public UIWizards(String name) {
- super(name);
- }
- private Shell getShell() {
- return DialogCheck.getShell();
- }
- private IWorkbench getWorkbench() {
- return WorkbenchPlugin.getDefault().getWorkbench();
- }
- private WizardDialog exportWizard(IWizardPage page) {
- ExportWizard wizard = new ExportWizard();
- wizard.init(getWorkbench(), null);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("ExportResourcesAction");
- if(wizardSettings == null)
- wizardSettings = workbenchSettings.addNewSection("ExportResourcesAction");
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
- 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.EXPORT_WIZARD);
-
- if (page != null) {
- page.setWizard(wizard);
- dialog.showPage(page);
- }
- return dialog;
- }
- private WizardDialog importWizard(IWizardPage page) {
- ImportWizard wizard = new ImportWizard();
- wizard.init(getWorkbench(), null);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("ImportResourcesAction");
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("ImportResourcesAction");
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- 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.IMPORT_WIZARD);
-
- if (page != null) {
- page.setWizard(wizard);
- dialog.showPage(page);
- }
- return dialog;
- }
-
- public void testExportResources() {//reference: ExportResourcesAction
- Dialog dialog = exportWizard(null);
- DialogCheck.assertDialog(dialog, this);
- }
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public void testFileSystemExport() {
- Dialog dialog = exportWizard( DataTransferTestStub.newFileSystemResourceExportPage1(null) );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testZipFileExport() {
- Dialog dialog = exportWizard( DataTransferTestStub.newZipFileResourceExportPage1(null) );
- DialogCheck.assertDialog(dialog, this);
- }
- */
- public void testImportResources() {//reference: ImportResourcesAction
- Dialog dialog = importWizard(null);
- DialogCheck.assertDialog(dialog, this);
- }
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public void testFileSystemImport() {
- Dialog dialog = importWizard( DataTransferTestStub.newFileSystemResourceImportPage1(WorkbenchPlugin.getDefault().getWorkbench(), StructuredSelection.EMPTY) );
- DialogCheck.assertDialog(dialog, this);
- }
- public void testZipFileImport() {
- Dialog dialog = importWizard( DataTransferTestStub.newZipFileResourceImportPage1(null) );
- DialogCheck.assertDialog(dialog, this);
- }
- */
- public void testNewFile() {
- BasicNewFileResourceWizard wizard = new BasicNewFileResourceWizard();
- wizard.init( PlatformUI.getWorkbench(), new StructuredSelection() );
- wizard.setNeedsProgressMonitor(true);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_FILE_WIZARD);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testNewFolder() {
- BasicNewFolderResourceWizard wizard = new BasicNewFolderResourceWizard();
- wizard.init( PlatformUI.getWorkbench(), new StructuredSelection() );
- wizard.setNeedsProgressMonitor(true);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFolderAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_FOLDER_WIZARD);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testNewProjectPage1() {
- BasicNewProjectResourceWizard wizard = new BasicNewProjectResourceWizard();
- wizard.init(PlatformUI.getWorkbench(), null);
- wizard.setNeedsProgressMonitor(true);
-
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_PROJECT_WIZARD);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testNewProjectPage2() {
- BasicNewProjectResourceWizard wizard = new BasicNewProjectResourceWizard();
- wizard.init(PlatformUI.getWorkbench(), null);
- wizard.setNeedsProgressMonitor(true);
-
- WizardNewProjectReferencePage page = new WizardNewProjectReferencePage("basicReferenceProjectPage");//$NON-NLS-1$
- page.setTitle(ResourceMessagesCopy.getString("NewProject.refeerenceTitle")); //$NON-NLS-1$
- page.setDescription(ResourceMessagesCopy.getString("NewProject.referenceDescription")); //$NON-NLS-1$
- page.setWizard(wizard);
-
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- dialog.showPage(page);
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_PROJECT_WIZARD);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testNewProject() {
- // Create wizard selection wizard.
- NewWizard wizard = new NewWizard();
- wizard.setProjectsOnly(true);
- ISelection selection = getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- IStructuredSelection selectionToPass = null;
- if (selection instanceof IStructuredSelection)
- selectionToPass = (IStructuredSelection) selection;
- else
- selectionToPass = StructuredSelection.EMPTY;
- wizard.init(getWorkbench(), selectionToPass);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction");//$NON-NLS-1$
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("NewWizardAction");//$NON-NLS-1$
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- // Create wizard dialog.
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_PROJECT_WIZARD);
- DialogCheck.assertDialog(dialog, this);
- }
- public void testNewResource() {
- NewWizard wizard = new NewWizard();
- ISelection selection = getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- IStructuredSelection selectionToPass = null;
- if (selection instanceof IStructuredSelection)
- selectionToPass = (IStructuredSelection) selection;
- else
- selectionToPass = StructuredSelection.EMPTY;
- wizard.init(getWorkbench(), selectionToPass);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction");//$NON-NLS-1$
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("NewWizardAction");//$NON-NLS-1$
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_WIZARD);
- DialogCheck.assertDialog(dialog, this);
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWizardsAuto.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWizardsAuto.java
deleted file mode 100644
index 5aa2c22..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWizardsAuto.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
-import org.eclipse.ui.dialogs.WizardNewProjectReferencePage;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.*;
-import org.eclipse.ui.internal.dialogs.*;
-import org.eclipse.ui.tests.util.DialogCheck;
-import org.eclipse.ui.tests.util.FileUtil;
-import org.eclipse.ui.wizards.newresource.*;
-
-public class UIWizardsAuto extends TestCase {
- private static final int SIZING_WIZARD_WIDTH = 470;
- private static final int SIZING_WIZARD_HEIGHT = 550;
- private static final int SIZING_WIZARD_WIDTH_2 = 500;
- private static final int SIZING_WIZARD_HEIGHT_2 = 500;
-
- private IProject project;
-
- public UIWizardsAuto(String name) {
- super(name);
- }
- private Shell getShell() {
- return DialogCheck.getShell();
- }
- private IWorkbench getWorkbench() {
- return WorkbenchPlugin.getDefault().getWorkbench();
- }
-
- private WizardDialog exportWizard(IWizardPage page) {
- ExportWizard wizard = new ExportWizard();
- wizard.init(getWorkbench(), null);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("ExportResourcesAction");
- if(wizardSettings == null)
- wizardSettings = workbenchSettings.addNewSection("ExportResourcesAction");
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
- 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.EXPORT_WIZARD);
-
- if (page != null) {
- page.setWizard(wizard);
- dialog.showPage(page);
- }
- return dialog;
- }
- private WizardDialog importWizard(IWizardPage page) {
- ImportWizard wizard = new ImportWizard();
- wizard.init(getWorkbench(), null);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("ImportResourcesAction");
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("ImportResourcesAction");
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- 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.IMPORT_WIZARD);
-
- if (page != null) {
- page.setWizard(wizard);
- dialog.showPage(page);
- }
- return dialog;
- }
-
- /**
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- super.tearDown();
- try {
- if (project != null) {
- project.delete(true,true,null);
- project = null;
- }
- }
- catch (CoreException e) {
- fail(e.toString());
- }
- }
-
- public void testExportResources() {//reference: ExportResourcesAction
- Dialog dialog = exportWizard(null);
- DialogCheck.assertDialogTexts(dialog, this);
- }
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public void testFileSystemExport() {
- Dialog dialog = exportWizard( DataTransferTestStub.newFileSystemResourceExportPage1(null) );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testZipFileExport() {
- Dialog dialog = exportWizard( DataTransferTestStub.newZipFileResourceExportPage1(null) );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- */
- public void testImportResources() {//reference: ImportResourcesAction
- Dialog dialog = importWizard(null);
- DialogCheck.assertDialogTexts(dialog, this);
- }
-/**
- * 1GJWD2E: ITPUI:ALL - Test classes should not be released in public packages.
- *
- public void testFileSystemImport() {
- Dialog dialog = importWizard( DataTransferTestStub.newFileSystemResourceImportPage1(WorkbenchPlugin.getDefault().getWorkbench(), StructuredSelection.EMPTY) );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testZipFileImport() {
- Dialog dialog = importWizard( DataTransferTestStub.newZipFileResourceImportPage1(null) );
- DialogCheck.assertDialogTexts(dialog, this);
- }
- */
- public void testNewFile() {
- BasicNewFileResourceWizard wizard = new BasicNewFileResourceWizard();
- wizard.init( PlatformUI.getWorkbench(), new StructuredSelection() );
- wizard.setNeedsProgressMonitor(true);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(),IHelpContextIds.NEW_FILE_WIZARD);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- /**
- * Test for bug 30719 [Linked Resources] NullPointerException when setting filename for WizardNewFileCreationPage
- */
- public void testNewFile2() {
- BasicNewFileResourceWizard wizard = new BasicNewFileResourceWizard() {
- public void addPages() {
- super.addPages();
- IWizardPage page = getPage("newFilePage1");
- assertTrue("Expected newFilePage1", page instanceof WizardNewFileCreationPage);
- WizardNewFileCreationPage fileCreationPage = (WizardNewFileCreationPage) page;
-
- try {
- project = FileUtil.createProject("testNewFile2");
- }
- catch (CoreException e) {
- fail(e.getMessage());
- }
- fileCreationPage.setContainerFullPath(project.getFullPath());
- fileCreationPage.setFileName("testFileName.test");
- }
- };
-
- wizard.init( PlatformUI.getWorkbench(), new StructuredSelection() );
- wizard.setNeedsProgressMonitor(true);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_FILE_WIZARD);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNewFolder() {
- BasicNewFolderResourceWizard wizard = new BasicNewFolderResourceWizard();
- wizard.init( PlatformUI.getWorkbench(), new StructuredSelection() );
- wizard.setNeedsProgressMonitor(true);
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFolderAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_FOLDER_WIZARD);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNewProjectPage1() {
- BasicNewProjectResourceWizard wizard = new BasicNewProjectResourceWizard();
- wizard.init(PlatformUI.getWorkbench(), null);
- wizard.setNeedsProgressMonitor(true);
-
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_PROJECT_WIZARD);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNewProjectPage2() {
- BasicNewProjectResourceWizard wizard = new BasicNewProjectResourceWizard();
- wizard.init(PlatformUI.getWorkbench(), null);
- wizard.setNeedsProgressMonitor(true);
-
- WizardNewProjectReferencePage page = new WizardNewProjectReferencePage("basicReferenceProjectPage");//$NON-NLS-1$
- page.setTitle(ResourceMessagesCopy.getString("NewProject.refeerenceTitle")); //$NON-NLS-1$
- page.setDescription(ResourceMessagesCopy.getString("NewProject.referenceDescription")); //$NON-NLS-1$
- page.setWizard(wizard);
-
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- dialog.getShell().setText(WorkbenchMessages.getString("CreateFileAction.title")); //$NON-NLS-1$
- dialog.showPage(page);
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_PROJECT_WIZARD);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNewProject() {
- // Create wizard selection wizard.
- NewWizard wizard = new NewWizard();
- wizard.setProjectsOnly(true);
- ISelection selection = getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- IStructuredSelection selectionToPass = null;
- if (selection instanceof IStructuredSelection)
- selectionToPass = (IStructuredSelection) selection;
- else
- selectionToPass = StructuredSelection.EMPTY;
- wizard.init(getWorkbench(), selectionToPass);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction");//$NON-NLS-1$
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("NewWizardAction");//$NON-NLS-1$
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- // Create wizard dialog.
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_PROJECT_WIZARD);
- DialogCheck.assertDialogTexts(dialog, this);
- }
- public void testNewResource() {
- NewWizard wizard = new NewWizard();
- ISelection selection = getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- IStructuredSelection selectionToPass = null;
- if (selection instanceof IStructuredSelection)
- selectionToPass = (IStructuredSelection) selection;
- else
- selectionToPass = StructuredSelection.EMPTY;
- wizard.init(getWorkbench(), selectionToPass);
- IDialogSettings workbenchSettings = WorkbenchPlugin.getDefault().getDialogSettings();
- IDialogSettings wizardSettings = workbenchSettings.getSection("NewWizardAction");//$NON-NLS-1$
- if(wizardSettings==null)
- wizardSettings = workbenchSettings.addNewSection("NewWizardAction");//$NON-NLS-1$
- wizard.setDialogSettings(wizardSettings);
- wizard.setForcePreviousAndNextButtons(true);
-
- WizardDialog dialog = new WizardDialog(getShell(), wizard);
- dialog.create();
- dialog.getShell().setSize( Math.max(SIZING_WIZARD_WIDTH_2, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT_2 );
- WorkbenchHelp.setHelp(dialog.getShell(), IHelpContextIds.NEW_WIZARD);
- DialogCheck.assertDialogTexts(dialog, this);
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWorkingSetWizardsAuto.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWorkingSetWizardsAuto.java
deleted file mode 100644
index de23577..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/dialogs/UIWorkingSetWizardsAuto.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.dialogs;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.swt.widgets.Widget;
-
-import org.eclipse.jface.wizard.*;
-import org.eclipse.jface.wizard.Wizard;
-import org.eclipse.jface.wizard.WizardDialog;
-
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.help.WorkbenchHelp;
-import org.eclipse.ui.internal.IHelpContextIds;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.registry.WorkingSetDescriptor;
-import org.eclipse.ui.internal.registry.WorkingSetRegistry;
-import org.eclipse.ui.tests.util.DialogCheck;
-import org.eclipse.ui.tests.util.FileUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-
-/**
- * Abstract test class for the working set wizard tests.
- */
-public abstract class UIWorkingSetWizardsAuto extends UITestCase {
- protected static final int SIZING_WIZARD_WIDTH = 470;
- protected static final int SIZING_WIZARD_HEIGHT = 550;
- protected static final int SIZING_WIZARD_WIDTH_2 = 500;
- protected static final int SIZING_WIZARD_HEIGHT_2 = 500;
- protected static final String WORKING_SET_NAME_1 = "ws1";
- protected static final String WORKING_SET_NAME_2 = "ws2";
-
- protected WizardDialog fWizardDialog;
- protected Wizard fWizard;
- protected WorkingSetDescriptor[] fWorkingSetDescriptors;
- protected IProject p1;
- protected IProject p2;
- protected IFile f1;
- protected IFile f2;
-
- public UIWorkingSetWizardsAuto(String name) {
- super(name);
- }
- protected void checkTreeItems() {
- List widgets = getWidgets((Composite) fWizardDialog.getCurrentPage().getControl(), Tree.class);
- Tree tree = (Tree) widgets.get(0);
- TreeItem[] treeItems = tree.getItems();
- for (int i = 0; i < treeItems.length; i++) {
- treeItems[i].setChecked(true);
- Event event = new Event();
- event.detail = SWT.CHECK;
- event.item = treeItems[i];
- tree.notifyListeners(SWT.Selection, event);
- }
- }
- private void deleteResources() throws CoreException {
- if (p1 != null) {
- FileUtil.deleteProject(p1);
- }
- if (p2 != null) {
- FileUtil.deleteProject(p2);
- }
- }
- private Shell getShell() {
- return DialogCheck.getShell();
- }
- protected List getWidgets(Composite composite, Class clazz) {
- Widget[] children = composite.getChildren();
- List selectedChildren = new ArrayList();
-
- for (int i = 0; i < children.length; i++) {
- Widget child = children[i];
- if (child.getClass() == clazz) {
- selectedChildren.add(child);
- }
- if (child instanceof Composite) {
- selectedChildren.addAll(getWidgets((Composite) child, clazz));
- }
- }
- return selectedChildren;
- }
- /**
- * <code>fWizard</code> must be initialized by subclasses prior to calling setUp.
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
-
- fWizardDialog = new WizardDialog(getShell(), fWizard);
- fWizardDialog.create();
- Shell dialogShell = fWizardDialog.getShell();
- dialogShell.setSize(Math.max(SIZING_WIZARD_WIDTH_2, dialogShell.getSize().x), SIZING_WIZARD_HEIGHT_2);
- WorkbenchHelp.setHelp(fWizardDialog.getShell(), IHelpContextIds.WORKING_SET_NEW_WIZARD);
-
- WorkingSetRegistry registry = WorkbenchPlugin.getDefault().getWorkingSetRegistry();
- fWorkingSetDescriptors = registry.getWorkingSetDescriptors();
-
- IWorkingSetManager workingSetManager = fWorkbench.getWorkingSetManager();
- IWorkingSet[] workingSets = workingSetManager.getWorkingSets();
- for (int i = 0; i < workingSets.length; i++) {
- workingSetManager.removeWorkingSet(workingSets[i]);
- }
- setupResources();
- }
- private void setupResources() throws CoreException {
- p1 = FileUtil.createProject("TP1");
- p2 = FileUtil.createProject("TP2");
- f1 = FileUtil.createFile("f1.txt", p1);
- f2 = FileUtil.createFile("f2.txt", p2);
- }
- protected void setTextWidgetText(String text,IWizardPage page) {
- List widgets = getWidgets((Composite) page.getControl(), Text.class);
- Text textWidget = (Text) widgets.get(0);
- textWidget.setText(text);
- textWidget.notifyListeners(SWT.Modify, new Event());
- }
- /**
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- deleteResources();
- super.tearDown();
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ActionExpressionTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ActionExpressionTest.java
deleted file mode 100644
index a8d3210..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ActionExpressionTest.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal;
-
-import org.eclipse.jface.action.MenuManager;
-
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.api.ListElement;
-import org.eclipse.ui.tests.api.ListView;
-import org.eclipse.ui.tests.util.ActionUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-
-
-/**
- * This class contains tests for popup menu enablement
- */
-public abstract class ActionExpressionTest extends UITestCase {
- protected IWorkbenchWindow fWindow;
- protected IWorkbenchPage fPage;
- protected String VIEW_ID = "org.eclipse.ui.tests.internal.ActionExpressionTest";
-
- ListElement red = new ListElement("red");
- ListElement blue = new ListElement("blue");
- ListElement redTrue = new ListElement("red", true);
-
- public ActionExpressionTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- fWindow = openTestWindow();
- fPage = fWindow.getActivePage();
- }
-
- public void testAllAction() throws Throwable
- {
- // Setup.
- ListView view = showListView();
- MenuManager mgr = getActionMenuManager(view);
-
- // Test null selection.
- selectAndUpdateMenu(view, null, mgr);
- testAction(mgr, "allAction_v2", false);
-
- // Test red selection.
- selectAndUpdateMenu(view, red, mgr);
- testAction(mgr, "allAction_v2", true);
-
- // Test blue selection.
- selectAndUpdateMenu(view, blue, mgr);
- testAction(mgr, "allAction_v2", true);
-
- // Test red + true selection.
- selectAndUpdateMenu(view, redTrue, mgr);
- testAction(mgr, "allAction_v2", true);
- }
-
- public void testRedAction() throws Throwable
- {
- // Setup.
- ListView view = showListView();
- MenuManager mgr = getActionMenuManager(view);
-
- // Test null selection.
- selectAndUpdateMenu(view, null, mgr);
- testAction(mgr, "redAction_v2", false);
-
- // Test red selection.
- selectAndUpdateMenu(view, red, mgr);
- testAction(mgr, "redAction_v2", true);
-
- // Test blue selection.
- selectAndUpdateMenu(view, blue, mgr);
- testAction(mgr, "redAction_v2", false);
-
- // Test red + true selection.
- selectAndUpdateMenu(view, redTrue, mgr);
- testAction(mgr, "redAction_v2", true);
- }
-
- public void testNotRedAction() throws Throwable
- {
- // Setup.
- ListView view = showListView();
- MenuManager mgr = getActionMenuManager(view);
-
- // Test null selection.
- selectAndUpdateMenu(view, null, mgr);
- testAction(mgr, "notRedAction_v2", false);
-
- // Test red selection.
- selectAndUpdateMenu(view, red, mgr);
- testAction(mgr, "notRedAction_v2", false);
-
- // Test blue selection.
- selectAndUpdateMenu(view, blue, mgr);
- testAction(mgr, "notRedAction_v2", true);
-
- // Test red + true selection.
- selectAndUpdateMenu(view, redTrue, mgr);
- testAction(mgr, "notRedAction_v2", false);
- }
-
- public void testTrueAction() throws Throwable
- {
- // Setup.
- ListView view = showListView();
- MenuManager mgr = getActionMenuManager(view);
-
- // Test null selection.
- selectAndUpdateMenu(view, null, mgr);
- testAction(mgr, "trueAction_v2", false);
-
- // Test red selection.
- selectAndUpdateMenu(view, red, mgr);
- testAction(mgr, "trueAction_v2", false);
-
- // Test blue selection.
- selectAndUpdateMenu(view, blue, mgr);
- testAction(mgr, "trueAction_v2", false);
-
- // Test red + true selection.
- selectAndUpdateMenu(view, redTrue, mgr);
- testAction(mgr, "trueAction_v2", true);
- }
-
- public void testRedOrBlueAction() throws Throwable
- {
- // Setup.
- ListView view = showListView();
- MenuManager mgr = getActionMenuManager(view);
-
- // Test null selection.
- selectAndUpdateMenu(view, null, mgr);
- testAction(mgr, "redOrBlueAction_v2", false);
-
- // Test red selection.
- selectAndUpdateMenu(view, red, mgr);
- testAction(mgr, "redOrBlueAction_v2", true);
-
- // Test blue selection.
- selectAndUpdateMenu(view, blue, mgr);
- testAction(mgr, "redOrBlueAction_v2", true);
-
- // Test red + true selection.
- selectAndUpdateMenu(view, redTrue, mgr);
- testAction(mgr, "redOrBlueAction_v2", true);
- }
-
- public void testRedAndTrueAction() throws Throwable
- {
- // Setup.
- ListView view = showListView();
- MenuManager mgr = getActionMenuManager(view);
-
- // Test null selection.
- selectAndUpdateMenu(view, null, mgr);
- testAction(mgr, "redAndTrueAction_v2", false);
-
- // Test red selection.
- selectAndUpdateMenu(view, red, mgr);
- testAction(mgr, "redAndTrueAction_v2", false);
-
- // Test blue selection.
- selectAndUpdateMenu(view, blue, mgr);
- testAction(mgr, "redAndTrueAction_v2", false);
-
- // Test red + true selection.
- selectAndUpdateMenu(view, redTrue, mgr);
- testAction(mgr, "redAndTrueAction_v2", true);
- }
-
- public void testPluginStateActions() throws Throwable
- {
- // Setup.
- ListView view = showListView();
- MenuManager mgr = getActionMenuManager(view);
-
- // Open the menu and test actions.
- selectAndUpdateMenu(view, red, mgr);
- testAction(mgr, "pluginNotInstalledAction_v2", false);
- testAction(mgr, "pluginInstalledAction_v2", true);
- testAction(mgr, "pluginNotActivatedAction_v2", false);
- testAction(mgr, "pluginActivatedAction_v2", true);
- }
-
- public void testSystemPropertyAction() throws Throwable
- {
- // Setup.
- ListView view = showListView();
- MenuManager mgr = getActionMenuManager(view);
-
- // Clear the system property, refresh the menu,
- // and test the action.
- System.setProperty("ActionExpressionVar", "");
- selectAndUpdateMenu(view, red, mgr);
- testAction(mgr, "systemPropertyAction_v2", false);
-
- // Set the system property, refresh the menu,
- // and test the action.
- System.setProperty("ActionExpressionVar", "bubba");
- selectAndUpdateMenu(view, blue, mgr);
- testAction(mgr, "systemPropertyAction_v2", true);
- }
-
- /**
- * Creates the list view.
- */
- protected ListView showListView() throws Throwable
- {
- ListView view = (ListView)(fPage.showView(VIEW_ID));
- red = new ListElement("red");
- blue = new ListElement("blue");
- redTrue = new ListElement("red", true);
- view.addElement(red);
- view.addElement(blue);
- view.addElement(redTrue);
- return view;
- }
-
- /**
- * Select an object and fire about to show.
- */
- protected void selectAndUpdateMenu(ListView view, ListElement element,
- MenuManager mgr) throws Throwable
- {
- view.selectElement(element);
- ActionUtil.fireAboutToShow(mgr);
- }
-
- /**
- * Returns the menu manager containing the actions.
- */
- protected abstract MenuManager getActionMenuManager(ListView view)
- throws Throwable;
-
- /**
- * Tests the enablement / visibility of an action.
- */
- protected abstract void testAction(MenuManager mgr, String action, boolean expected)
- throws Throwable;
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ActionSetExpressionTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ActionSetExpressionTest.java
deleted file mode 100644
index 7250397..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ActionSetExpressionTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal;
-
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.SubContributionItem;
-
-import org.eclipse.ui.internal.WorkbenchWindow;
-import org.eclipse.ui.tests.api.ListView;
-import org.eclipse.ui.tests.util.ActionUtil;
-
-
-/**
- * This class contains tests for action set enablement
- */
-public class ActionSetExpressionTest extends ActionExpressionTest {
-
- public ActionSetExpressionTest(String testName) {
- super(testName);
- }
-
- /**
- * Opens the action set. Returns the menu manager containing it.
- */
- protected MenuManager getActionMenuManager(ListView view)
- throws Throwable
- {
- fPage.showActionSet("org.eclipse.ui.tests.internal.ListElementActions");
- WorkbenchWindow win = (WorkbenchWindow)fWindow;
- IContributionItem item = win.getMenuBarManager().find("org.eclipse.ui.tests.internal.ListElementMenu");
- while (item instanceof SubContributionItem) {
- item = ((SubContributionItem)item).getInnerItem();
- if (item instanceof MenuManager)
- return (MenuManager)item;
- }
- fail("Unable to find menu manager");
- return null;
- }
-
- /**
- * Tests the enablement of an action.
- */
- protected void testAction(MenuManager mgr, String action, boolean expected)
- throws Throwable
- {
- assertEquals(action, expected, ActionUtil.getActionWithLabel(mgr, action).isEnabled());
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/EditorActionBarsTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/EditorActionBarsTest.java
deleted file mode 100644
index cbb152d..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/EditorActionBarsTest.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-
-import org.eclipse.swt.widgets.ToolBar;
-import org.eclipse.swt.widgets.ToolItem;
-
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.ToolBarManager;
-
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.internal.CoolBarContributionItem;
-import org.eclipse.ui.internal.CoolBarManager;
-import org.eclipse.ui.internal.WorkbenchWindow;
-import org.eclipse.ui.tests.api.MockAction;
-import org.eclipse.ui.tests.api.MockEditorActionBarContributor;
-import org.eclipse.ui.tests.api.MockEditorPart;
-import org.eclipse.ui.tests.api.MockViewPart;
-import org.eclipse.ui.tests.util.FileUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-
-
-/**
- * This class contains tests for the editor action bars
- * implementation.
- */
-public class EditorActionBarsTest extends UITestCase {
-
- protected IWorkbenchWindow fWindow;
- protected IWorkbenchPage fPage;
- private String EDITOR_ID = "org.eclipse.ui.tests.internal.EditorActionBarsTest";
-
- /**
- * Constructor for IEditorPartTest
- */
- public EditorActionBarsTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- fWindow = openTestWindow();
- fPage = fWindow.getActivePage();
- }
-
- /**
- * Test action enablement / disablement when a
- * part is active.
- * <p>
- * Created for PR 1GJNB52: ToolItems in EditorToolBarManager can get
- * out of synch with the state of the IAction
- * </p>
- */
- public void testActionEnablementWhenActive() throws Throwable {
- // Open an editor.
- MockEditorPart editor = openEditor(fPage, "1");
- MockEditorActionBarContributor contributor =
- (MockEditorActionBarContributor)editor.getEditorSite().getActionBarContributor();
-
- // Enable all actions.
- contributor.enableActions(true);
- verifyToolItemState(contributor, true);
-
- // Disable all actions.
- contributor.enableActions(false);
- verifyToolItemState(contributor, false);
- }
-
- /**
- * Test action enablement / disablement when a
- * part is inactive.
- * <p>
- * Created for PR 1GJNB52: ToolItems in EditorToolBarManager can get
- * out of synch with the state of the IAction
- * </p>
- */
- public void testActionEnablementWhenInactive() throws Throwable {
- // Open an editor.
- MockEditorPart editor = openEditor(fPage, "2");
- MockEditorActionBarContributor contributor =
- (MockEditorActionBarContributor)editor.getEditorSite().getActionBarContributor();
-
- // Enable all actions.
- contributor.enableActions(true);
- verifyToolItemState(contributor, true);
-
- // Activate some other part. Disable the actions.
- // Then activate the editor and test tool item state.
- fPage.showView(MockViewPart.ID);
- contributor.enableActions(false);
- fPage.activate(editor);
- verifyToolItemState(contributor, false);
-
- // Activate some other part. Enable the actions.
- // Then activate the editor and test tool item state.
- fPage.showView(MockViewPart.ID);
- contributor.enableActions(true);
- fPage.activate(editor);
- verifyToolItemState(contributor, true);
- }
-
- /**
- * Open a test editor.
- */
- protected MockEditorPart openEditor(IWorkbenchPage page, String suffix)
- throws Throwable
- {
- IProject proj = FileUtil.createProject("IEditorActionBarsTest");
- IFile file = FileUtil.createFile("test" + suffix + ".txt", proj);
- return (MockEditorPart)page.openEditor(file, EDITOR_ID);
- }
-
- /**
- * Tests whether actions are enabled.
- */
- protected void verifyToolItemState(MockEditorActionBarContributor ctr,
- boolean enabled)
- {
- MockAction [] actions = ctr.getActions();
- for (int nX = 0; nX < actions.length; nX ++)
- verifyToolItemState(actions[nX], enabled);
- }
-
- /**
- * Tests whether an action is enabled.
- */
- protected void verifyToolItemState(IAction action, boolean enabled) {
- String actionText = action.getText();
- IToolBarManager tbm = ((WorkbenchWindow)fWindow).getCoolBarManager();
- if (tbm instanceof ToolBarManager) {
- ToolBar tb = ((ToolBarManager) tbm).getControl();
- ToolItem [] items = tb.getItems();
- for (int i = 0; i < items.length; i ++) {
- String itemText = items[i].getToolTipText();
- if (actionText.equals(itemText)) {
- assertEquals(enabled, items[i].getEnabled());
- return;
- }
- }
- }
- else if (tbm instanceof CoolBarManager) {
- IContributionItem[] coolItems = tbm.getItems();
- for (int i = 0; i < coolItems.length; ++i) {
- if (coolItems[i] instanceof CoolBarContributionItem) {
- CoolBarContributionItem coolItem = (CoolBarContributionItem) coolItems[i];
- ToolBarManager citbm = coolItem.getToolBarManager();
- ToolBar tb = ((ToolBarManager) citbm).getControl();
- ToolItem [] items = tb.getItems();
- for (int j = 0; j < items.length; j ++) {
- String itemText = items[j].getToolTipText();
- if (actionText.equals(itemText)) {
- assertEquals(enabled, items[j].getEnabled());
- return;
- }
- }
- }
- }
- }
- fail("Action for " + actionText + " not found");
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedSourceViewer.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedSourceViewer.java
deleted file mode 100644
index 5cfa522..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedSourceViewer.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal;
-
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.text.source.IVerticalRuler;
-import org.eclipse.jface.text.source.SourceViewer;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-
-public class ExtendedSourceViewer extends SourceViewer {
-
- /**
- * Constructs a new source viewer. The vertical ruler is initially visible.
- * The viewer has not yet been initialized with a source viewer configuration.
- *
- * @param parent the parent of the viewer's control
- * @param ruler the vertical ruler used by this source viewer
- * @param styles the SWT style bits
- */
- public ExtendedSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
- super(parent, ruler, styles);
- }
-
- /*
- * @see Viewer#getSelection()
- */
- public ISelection getSelection() {
- Point p= getSelectedRange();
- if (p.x == -1 || p.y == -1)
- return ExtendedTextSelection.emptySelection();
-
- return new ExtendedTextSelection(getDocument(), p.x, p.y);
- }
-
- /**
- * Sends out a selection changed event to all registered listeners.
- *
- * @param offset the offset of the newly selected range
- * @param length the length of the newly selected range
- */
- protected void selectionChanged(int offset, int length) {
- ISelection selection= new ExtendedTextSelection(getDocument(), offset, length);
- SelectionChangedEvent event= new SelectionChangedEvent(this, selection);
- fireSelectionChanged(event);
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedTextEditor.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedTextEditor.java
deleted file mode 100644
index dcfbba1..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedTextEditor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal;
-
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.widgets.Composite;
-
-import org.eclipse.jface.text.source.ISourceViewer;
-import org.eclipse.jface.text.source.IVerticalRuler;
-
-import org.eclipse.ui.editors.text.TextEditor;
-
-public class ExtendedTextEditor extends TextEditor {
-
- /**
- * Constructor for TextSelectionActionFilterEditor.
- */
- public ExtendedTextEditor() {
- super();
- }
-
- /**
- * Creates the source viewer to be used by this editor.
- * Subclasses may re-implement this method.
- *
- * @param parent the parent control
- * @param ruler the vertical ruler
- * @param styles style bits
- * @return the source viewer
- */
- protected ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
- return new ExtendedSourceViewer(parent, ruler, styles);
- }
-
- public boolean isDirty() {
- return false;
- }
-
- /**
- * Set the text in the editor.
- */
- public void setText(String text) {
- ExtendedSourceViewer viewer = (ExtendedSourceViewer)getSourceViewer();
- StyledText widget = viewer.getTextWidget();
- widget.setText(text);
- viewer.setSelectedRange(0, text.length());
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedTextSelection.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedTextSelection.java
deleted file mode 100644
index 7541476..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedTextSelection.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal;
-
-import org.eclipse.core.runtime.IAdaptable;
-
-import org.eclipse.jface.text.IDocument;
-import org.eclipse.jface.text.TextSelection;
-
-import org.eclipse.ui.IActionFilter;
-
-public class ExtendedTextSelection extends TextSelection
- implements IAdaptable
-{
- static private ExtendedTextSelectionActionFilter filter =
- new ExtendedTextSelectionActionFilter();
-
- /**
- * Constructor for ExtendedTextSelection.
- * @param offset
- * @param length
- */
- public ExtendedTextSelection(int offset, int length) {
- super(offset, length);
- }
-
- /**
- * Constructor for ExtendedTextSelection.
- * @param document
- * @param offset
- * @param length
- */
- public ExtendedTextSelection(IDocument document, int offset, int length) {
- super(document, offset, length);
- }
-
- /*
- * @see IAdaptable#getAdapter(Class)
- */
- public Object getAdapter(Class adapter) {
- if (adapter == IActionFilter.class) {
- return filter;
- }
- return null;
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedTextSelectionActionFilter.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedTextSelectionActionFilter.java
deleted file mode 100644
index 6fca162..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/ExtendedTextSelectionActionFilter.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal;
-
-import org.eclipse.jface.text.ITextSelection;
-
-import org.eclipse.ui.IActionFilter;
-
-public class ExtendedTextSelectionActionFilter implements IActionFilter {
-
- /**
- * An attribute indicating the selection length (value <code>"isEmpty"</code>).
- * The attribute value in xml must be one of <code>"true" or "false"</code>.
- */
- public static final String IS_EMPTY = "isEmpty"; //$NON-NLS-1$
-
- /**
- * An attribute indicating the selection text (value <code>"text"</code>).
- * The attribute value in xml is unconstrained.
- */
- public static final String TEXT = "text"; //$NON-NLS-1$
-
- /**
- * An attribute indicating the selection text (value <code>"text"</code>).
- * The attribute value in xml is unconstrained.
- */
- public static final String CASE_INSENSITIVE_TEXT = "caseInsensitiveText"; //$NON-NLS-1$
-
- /*
- * @see IActionFilter#testAttribute(Object, String, String)
- */
- public boolean testAttribute(Object target, String name, String value) {
- ITextSelection sel = (ITextSelection)target;
- if (name.equals(IS_EMPTY)) {
- return (sel.getLength() == 0);
- } else if (name.equals(TEXT)) {
- String text = sel.getText();
- return (text.indexOf(value) >= 0);
- } else if (name.equals(CASE_INSENSITIVE_TEXT)) {
- String text = sel.getText().toLowerCase();
- value = value.toLowerCase();
- return (text.indexOf(value) >= 0);
- }
- return false;
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/InternalTestSuite.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/InternalTestSuite.java
deleted file mode 100644
index 91becf8..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/InternalTestSuite.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Test all areas of the UI Implementation.
- */
-public class InternalTestSuite extends TestSuite {
-
- /**
- * Returns the suite. This is required to
- * use the JUnit Launcher.
- */
- public static Test suite() {
- return new InternalTestSuite();
- }
-
- /**
- * Construct the test suite.
- */
- public InternalTestSuite() {
- addTest(new TestSuite(EditorActionBarsTest.class));
- addTest(new TestSuite(ActionSetExpressionTest.class));
- addTest(new TestSuite(PopupMenuExpressionTest.class));
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/PopupMenuExpressionTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/PopupMenuExpressionTest.java
deleted file mode 100644
index b9d7ebd..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/PopupMenuExpressionTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal;
-
-import org.eclipse.jface.action.MenuManager;
-
-import org.eclipse.ui.tests.api.ListView;
-import org.eclipse.ui.tests.util.ActionUtil;
-
-
-/**
- * This class contains tests for popup menu visibility
- */
-public class PopupMenuExpressionTest extends ActionExpressionTest {
-
- public PopupMenuExpressionTest(String testName) {
- super(testName);
- }
-
- /**
- * Returns the menu manager containing the actions.
- */
- protected MenuManager getActionMenuManager(ListView view)
- throws Throwable
- {
- return view.getMenuManager();
- }
-
- /**
- * Tests the visibility of an action.
- */
- protected void testAction(MenuManager mgr, String action, boolean expected)
- throws Throwable
- {
- if (expected)
- assertNotNull(action, ActionUtil.getActionWithLabel(mgr, action));
- else
- assertNull(action, ActionUtil.getActionWithLabel(mgr, action));
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/TextSelectionActionExpressionTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/TextSelectionActionExpressionTest.java
deleted file mode 100644
index cbbc1c2..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/internal/TextSelectionActionExpressionTest.java
+++ /dev/null
@@ -1,181 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.SubContributionItem;
-
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.internal.WorkbenchWindow;
-import org.eclipse.ui.tests.util.ActionUtil;
-import org.eclipse.ui.tests.util.FileUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-
-
-/**
- * This class contains tests for text selection action enablement
- */
-public class TextSelectionActionExpressionTest extends UITestCase
-{
- protected IWorkbenchWindow fWindow;
- protected IWorkbenchPage fPage;
-
- public TextSelectionActionExpressionTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- fWindow = openTestWindow();
- fPage = fWindow.getActivePage();
- }
-
- public void testAnyTextAction() throws Throwable
- {
- // Setup.
- ExtendedTextEditor editor = showTextEditor("anyText.exttxt");
- MenuManager mgr = getActionMenuManager(editor);
-
- // Test empty selection.
- selectAndUpdateMenu(editor, "", mgr);
- testAction(mgr, "anyText", true);
-
- // Test full selection.
- selectAndUpdateMenu(editor, "bob", mgr);
- testAction(mgr, "anyText", true);
-
- // Activate another view.
- fPage.showView(IPageLayout.ID_BOOKMARKS);
- testAction(mgr, "anyText", false);
-
- // Activate editor.
- // Test old selection.
- fPage.activate(editor);
- testAction(mgr, "anyText", true);
-
- // Test empty selection.
- selectAndUpdateMenu(editor, "", mgr);
- testAction(mgr, "anyText", true);
- }
-
- public void testEmptyTextAction() throws Throwable
- {
- // Setup.
- ExtendedTextEditor editor = showTextEditor("emptyText.exttxt");
- MenuManager mgr = getActionMenuManager(editor);
-
- // Test empty selection.
- selectAndUpdateMenu(editor, "", mgr);
- testAction(mgr, "emptyText", true);
-
- // Test full selection.
- selectAndUpdateMenu(editor, "bob", mgr);
- testAction(mgr, "emptyText", false);
-
- // Activate another view.
- fPage.showView(IPageLayout.ID_BOOKMARKS);
- testAction(mgr, "emptyText", false);
-
- // Activate editor.
- // Test old selection.
- fPage.activate(editor);
- testAction(mgr, "emptyText", false);
-
- // Test empty selection.
- selectAndUpdateMenu(editor, "", mgr);
- testAction(mgr, "emptyText", true);
- }
-
- public void testHelloTextAction() throws Throwable
- {
- // Setup.
- ExtendedTextEditor editor = showTextEditor("helloText.exttxt");
- MenuManager mgr = getActionMenuManager(editor);
-
- // Test empty selection.
- selectAndUpdateMenu(editor, "", mgr);
- testAction(mgr, "helloText", false);
-
- // Test wrong selection.
- selectAndUpdateMenu(editor, "bob", mgr);
- testAction(mgr, "helloText", false);
-
- // Test right selection.
- selectAndUpdateMenu(editor, "Hello", mgr);
- testAction(mgr, "helloText", true);
-
- // Activate another view.
- fPage.showView(IPageLayout.ID_BOOKMARKS);
- testAction(mgr, "helloText", false);
-
- // Activate editor.
- // Test old selection.
- fPage.activate(editor);
- testAction(mgr, "helloText", true);
-
- // Test wrong selection.
- selectAndUpdateMenu(editor, "bob", mgr);
- testAction(mgr, "helloText", false);
- }
-
- /**
- * Creates the list view.
- */
- private ExtendedTextEditor showTextEditor(String fileName) throws Throwable
- {
- IProject proj = FileUtil.createProject("TextSelectionActionExpressionTest");
- IFile file = FileUtil.createFile(fileName, proj);
- return (ExtendedTextEditor)fPage.openEditor(file);
- }
-
- /**
- * Select an object and fire about to show.
- */
- private void selectAndUpdateMenu(ExtendedTextEditor editor, String str,
- MenuManager mgr) throws Throwable
- {
- editor.setText(str);
- fPage.saveEditor(editor, false);
- ActionUtil.fireAboutToShow(mgr);
- }
-
- /**
- * Returns the menu manager containing the actions.
- */
- private MenuManager getActionMenuManager(ExtendedTextEditor editor)
- throws Throwable
- {
- fPage.showActionSet("org.eclipse.ui.tests.internal.TextSelectionActions");
- WorkbenchWindow win = (WorkbenchWindow)fWindow;
- IContributionItem item = win.getMenuBarManager().find("org.eclipse.ui.tests.internal.TextSelectionMenu");
- while (item instanceof SubContributionItem) {
- item = ((SubContributionItem)item).getInnerItem();
- if (item instanceof MenuManager)
- return (MenuManager)item;
- }
- fail("Unable to find menu manager");
- return null;
- }
-
- /**
- * Tests the enablement / visibility of an action.
- */
- private void testAction(MenuManager mgr, String action,
- boolean expected) throws Throwable
- {
- assertEquals(action, expected, ActionUtil.getActionWithLabel(mgr, action).isEnabled());
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/BrokenUpdatePreferencePage.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/BrokenUpdatePreferencePage.java
deleted file mode 100644
index 99545c3..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/BrokenUpdatePreferencePage.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.manual;
-
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.FontData;
-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.jface.preference.PreferencePage;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This is a test preference page designed to
- * generate errors on update
- */
-public class BrokenUpdatePreferencePage
- extends PreferencePage
- implements IWorkbenchPreferencePage {
-
- private IPropertyChangeListener badListener =
- new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- //Intentionally generate an error
- String[] strings = new String[1];
- System.out.println(strings[2]);
- }
- };
-
- FontData[] data;
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#createContents(Composite)
- */
- protected Control createContents(Composite parent) {
-
- data = parent.getFont().getFontData();
-
- Composite buttonComposite = new Composite(parent, SWT.NULL);
- buttonComposite.setLayout(new GridLayout());
- buttonComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Button fontButton = new Button(buttonComposite, SWT.PUSH);
- fontButton.setText("Update Font");
- fontButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- changeFont();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- changeFont();
- }
- });
-
- Button preferencePluginButton = new Button(buttonComposite, SWT.PUSH);
- preferencePluginButton.setText("Update Plugin Preferences");
- preferencePluginButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- changePluginPreference();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- changePluginPreference();
- }
- });
-
- Button preferenceButton = new Button(buttonComposite, SWT.PUSH);
- preferenceButton.setText("Update Dialog Preferences");
- preferenceButton.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- changePluginPreference();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- changePluginPreference();
- }
- });
-
- return buttonComposite;
-
- }
-
- /**
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(IWorkbench)
- */
- public void init(IWorkbench workbench) {
-
- JFaceResources.getFontRegistry().addListener(badListener);
-
- PlatformUI
- .getWorkbench()
- .getPreferenceStore()
- .addPropertyChangeListener(
- badListener);
-
- }
-
- /**
- * see@DialogPage.dispose();
- */
- public void dispose() {
- super.dispose();
- JFaceResources.getFontRegistry().removeListener(badListener);
-
- PlatformUI
- .getWorkbench()
- .getPreferenceStore()
- .removePropertyChangeListener(
- badListener);
- }
-
- public void changeFont() {
- JFaceResources.getFontRegistry().put("FAKO", data);
- }
-
- public void changePluginPreference() {
- PlatformUI.getWorkbench().getPreferenceStore().firePropertyChangeEvent(
- "FAKO",
- "Old",
- "New");
- }
-
- public void changePreference() {
- getPreferenceStore().firePropertyChangeEvent(
- "FAKO",
- "Old",
- "New");
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/UIPreferencesManual.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/UIPreferencesManual.java
deleted file mode 100644
index 7c6a956..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/manual/UIPreferencesManual.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.manual;
-
-import java.util.Iterator;
-
-import org.eclipse.jface.preference.IPreferenceNode;
-import org.eclipse.jface.preference.PreferenceManager;
-
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.tests.dialogs.PreferenceDialogWrapper;
-import org.eclipse.ui.tests.dialogs.UIPreferencesAuto;
-
-/**
- * The UIPreferencesManual is a test case that requires
- * the user to click OK on message dialog when it is
- * run
- */
-
-public class UIPreferencesManual extends UIPreferencesAuto {
-
- public UIPreferencesManual(String name) {
- super(name);
- }
-
- /**
- * Test the bad update preference page by generating all
- * of the dialog errors.
- */
- public void testBrokenListenerPref() {
-
- PreferenceDialogWrapper dialog = null;
- PreferenceManager manager =
- WorkbenchPlugin.getDefault().getPreferenceManager();
- if (manager != null) {
- dialog = new PreferenceDialogWrapper(getShell(), manager);
- dialog.create();
-
- for (Iterator iterator =
- manager.getElements(PreferenceManager.PRE_ORDER).iterator();
- iterator.hasNext();
- ) {
- IPreferenceNode node = (IPreferenceNode) iterator.next();
- if (node
- .getId()
- .equals("org.eclipse.ui.tests.manual.BrokenUpdatePreferencePage")) {
- dialog.showPage(node);
- BrokenUpdatePreferencePage page =
- (BrokenUpdatePreferencePage) dialog.getPage(node);
- page.changeFont();
- page.changePluginPreference();
- break;
- }
- }
- }
-
- }
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/AbstractNavigatorTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/AbstractNavigatorTest.java
deleted file mode 100644
index 6ab1049..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/AbstractNavigatorTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.navigator;
-
-import java.io.ByteArrayInputStream;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.tests.util.UITestCase;
-import org.eclipse.ui.views.navigator.ResourceNavigator;
-
-/**
- * The AbstractNavigatorTest is the abstract superclass
- * of tests that use a populated Resource Navigator.
- */
-abstract class AbstractNavigatorTest extends UITestCase {
-
- private static final String NAVIGATOR_VIEW_ID = "org.eclipse.ui.views.ResourceNavigator";
-
- protected IProject testProject;
- protected IFolder testFolder;
- protected IFile testFile;
- protected ResourceNavigator navigator;
-
- public AbstractNavigatorTest(String testName) {
- super(testName);
- }
-
- protected void createTestProject() throws CoreException {
- if (testProject == null) {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- testProject = workspace.getRoot().getProject("TestProject");
- testProject.create(null);
- testProject.open(null);
- }
- }
-
- protected void createTestFolder() throws CoreException {
- if (testFolder == null) {
- createTestProject();
- testFolder = testProject.getFolder("TestFolder");
- testFolder.create(false, false, null);
- }
- }
-
- protected void createTestFile() throws CoreException {
- if (testFile == null) {
- createTestFolder();
- testFile = testFolder.getFile("Foo.txt");
- testFile.create(new ByteArrayInputStream("Some content.".getBytes()), false, null);
- }
- }
-
- /** Shows the Navigator in a new test window. */
- protected void showNav() throws PartInitException {
- IWorkbenchWindow window = openTestWindow();
- navigator = (ResourceNavigator) window.getActivePage().showView(NAVIGATOR_VIEW_ID);
- }
-
- public void tearDown() throws Exception {
- if (testProject != null) {
- try {
- testProject.delete(true, null);
- }
- catch (CoreException e) {
- fail(e.toString());
- }
- testProject = null;
- testFolder = null;
- testFile = null;
- }
- super.tearDown();
- navigator = null;
- }
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/DecoratorTestCase.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/DecoratorTestCase.java
deleted file mode 100644
index 6ff41da..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/DecoratorTestCase.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.navigator;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.decorators.DecoratorDefinition;
-import org.eclipse.ui.internal.decorators.DecoratorManager;
-
-/**
- * @version 1.0
- */
-public class DecoratorTestCase
- extends AbstractNavigatorTest
- implements ILabelProviderListener {
-
- private DecoratorDefinition definition;
- private boolean updated = false;
-
- /**
- * Constructor for DecoratorTestCase.
- * @param testName
- */
- public DecoratorTestCase(String testName) {
- super(testName);
- }
-
- /**
- * Sets up the hierarchy.
- */
- protected void setUp() throws Exception {
- createTestFile();
- showNav();
-
- WorkbenchPlugin.getDefault().getDecoratorManager().addListener(this);
-
- DecoratorDefinition[] definitions =
- WorkbenchPlugin.getDefault().getDecoratorManager().getAllDecoratorDefinitions();
- for (int i = 0; i < definitions.length; i++) {
- if (definitions[i].getId().equals("org.eclipse.ui.tests.adaptable.decorator"))
- definition = definitions[i];
- }
- }
-
- private DecoratorManager getDecoratorManager() {
- return WorkbenchPlugin.getDefault().getDecoratorManager();
- }
-
- /**
- * Remove the listener.
- */
-
- public void tearDown() throws Exception {
- super.tearDown();
- getDecoratorManager().removeListener(this);
- }
-
- /**
- * Make a label changed event for resource.
- */
- private LabelProviderChangedEvent getLabelChangedEvent(IResource resource) {
- return new LabelProviderChangedEvent(getDecoratorManager(), resource);
- }
-
- /**
- * Test enabling the contributor
- */
- public void testEnableDecorator() throws CoreException{
- definition.setEnabled(true);
- getDecoratorManager().reset();
-
- }
-
- /**
- * Test disabling the contributor
- */
- public void testDisableDecorator() throws CoreException{
- definition.setEnabled(false);
- getDecoratorManager().reset();
- }
-
- /**
- * Refresh the test decorator.
- */
- public void testRefreshContributor() throws CoreException{
-
- updated = false;
- definition.setEnabled(true);
- getDecoratorManager().reset();
-
- assertTrue("Got an update", updated);
- updated = false;
-
- }
-
- /*
- * @see ILabelProviderListener#labelProviderChanged(LabelProviderChangedEvent)
- */
- public void labelProviderChanged(LabelProviderChangedEvent event) {
- updated = true;
- }
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/DuplicateMenuItemTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/DuplicateMenuItemTest.java
deleted file mode 100644
index 69ec4af..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/DuplicateMenuItemTest.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.navigator;
-
-import java.util.HashSet;
-
-import junit.framework.Assert;
-
-import org.eclipse.swt.widgets.Menu;
-import org.eclipse.swt.widgets.MenuItem;
-
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-import org.eclipse.ui.internal.WorkbenchWindow;
-
-/**
- * The DuplicateMenuItemTest is a class for testing the popups
- * and window menus for the navigator to check for duplicate menu
- * entries.
- */
-public class DuplicateMenuItemTest extends AbstractNavigatorTest {
-
- /**
- * Constructor for DuplicateMenuItemTest.
- * @param testName
- */
- public DuplicateMenuItemTest(String testName) {
- super(testName);
- }
-
- public void testSelection() {
-
- IStructuredSelection selection = new StructuredSelection(testProject);
- checkSelection(selection);
- selection = new StructuredSelection(testFolder);
- checkSelection(selection);
- selection = new StructuredSelection(testFile);
- checkSelection(selection);
- }
-
- private void checkMenu(Menu menu, String menuName) {
-
- MenuItem[] items = menu.getItems();
- HashSet labels = new HashSet();
- for (int i = 0; i < items.length; i++) {
- String label = items[i].getText();
- System.out.println(label);
- Assert.assertTrue(
- "Duplicate menu entry in: " + menuName + " " + label,
- !labels.contains(label));
- if(items[i].getMenu() != null)
- checkMenu(items[i].getMenu(),label);
- }
-
- }
-
-
- private void checkWorkbenchMenu() {
-
- MenuManager workbenchManager =
- ((WorkbenchWindow) navigator.getViewSite().getWorkbenchWindow())
- .getMenuManager();
-
- checkMenu(workbenchManager.getMenu(), "Workbench");
- }
-
-
-
- private void checkSelection(IStructuredSelection selection) {
- navigator.selectReveal(selection);
- checkWorkbenchMenu();
- }
-
- /**
- * Sets up the hierarchy.
- */
- protected void setUp() throws Exception {
- createTestFile();
- showNav();
- }
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/LightweightDecoratorTestCase.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/LightweightDecoratorTestCase.java
deleted file mode 100644
index 93463cb..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/LightweightDecoratorTestCase.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.navigator;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.decorators.DecoratorDefinition;
-import org.eclipse.ui.internal.decorators.DecoratorManager;
-
-/**
- * @version 1.0
- */
-public class LightweightDecoratorTestCase
- extends AbstractNavigatorTest
- implements ILabelProviderListener {
-
- private DecoratorDefinition definition;
- private boolean updated = false;
-
- /**
- * Constructor for DecoratorTestCase.
- * @param testName
- */
- public LightweightDecoratorTestCase(String testName) {
- super(testName);
- }
-
- /**
- * Sets up the hierarchy.
- */
- protected void setUp() throws Exception {
- createTestFile();
- showNav();
-
- WorkbenchPlugin.getDefault().getDecoratorManager().addListener(this);
-
- DecoratorDefinition[] definitions =
- WorkbenchPlugin.getDefault().getDecoratorManager().getAllDecoratorDefinitions();
- for (int i = 0; i < definitions.length; i++) {
- if (definitions[i].getId().equals("org.eclipse.ui.tests.navigator.lightweightdecorator"))
- definition = definitions[i];
- }
- }
-
- private DecoratorManager getDecoratorManager() {
- return WorkbenchPlugin.getDefault().getDecoratorManager();
- }
-
- /**
- * Remove the listener.
- */
-
- public void tearDown() throws Exception {
- super.tearDown();
- getDecoratorManager().removeListener(this);
- }
-
- /**
- * Make a label changed event for resource.
- */
- private LabelProviderChangedEvent getLabelChangedEvent(IResource resource) {
- return new LabelProviderChangedEvent(getDecoratorManager(), resource);
- }
-
- /**
- * Test enabling the contributor
- */
- public void testEnableDecorator() throws CoreException{
- definition.setEnabled(true);
- getDecoratorManager().reset();
-
- }
-
- /**
- * Test disabling the contributor
- */
- public void testDisableDecorator() throws CoreException{
- definition.setEnabled(false);
- getDecoratorManager().reset();
- }
-
- /**
- * Refresh the test decorator.
- */
- public void testRefreshContributor() throws CoreException{
-
- updated = false;
- definition.setEnabled(true);
- getDecoratorManager().reset();
-
- assertTrue("Got an update", updated);
- updated = false;
-
- }
-
- /*
- * @see ILabelProviderListener#labelProviderChanged(LabelProviderChangedEvent)
- */
- public void labelProviderChanged(LabelProviderChangedEvent event) {
- updated = true;
- }
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/NavigatorTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/NavigatorTest.java
deleted file mode 100644
index 1c4628c..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/NavigatorTest.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.navigator;
-
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.StructuredSelection;
-
-import org.eclipse.ui.PartInitException;
-
-/**
- * Tests the Resource Navigator view.
- */
-public class NavigatorTest extends AbstractNavigatorTest {
-
- public NavigatorTest(String testName) {
- super(testName);
- }
-
- /**
- * Tests that the Navigator is initially populated with
- * the correct elements from the workspace.
- */
- public void testInitialPopulation() throws CoreException, PartInitException {
- createTestFile();
- showNav();
-
- // test its initial content by setting and getting selection on the file
- ISelectionProvider selProv = navigator.getSite().getSelectionProvider();
- StructuredSelection sel = new StructuredSelection(testFile);
- selProv.setSelection(sel);
- assertEquals(sel, selProv.getSelection());
- }
-
- /**
- * Tests that the Navigator updates properly when a file is added to the workbench.
- */
- public void testFileAddition() throws CoreException, PartInitException {
- createTestFolder(); // create the project and folder before the Navigator is shown
- showNav();
- createTestFile(); // create the file after the Navigator is shown
-
- // test its initial content by setting and getting selection on the file
- ISelectionProvider selProv = navigator.getSite().getSelectionProvider();
- StructuredSelection sel = new StructuredSelection(testFile);
- selProv.setSelection(sel);
- assertEquals(sel, selProv.getSelection());
- }
-
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/NavigatorTestSuite.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/NavigatorTestSuite.java
deleted file mode 100644
index 7d299cf..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/NavigatorTestSuite.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.navigator;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-
-public class NavigatorTestSuite extends TestSuite {
-
- /**
- * Returns the suite. This is required to
- * use the JUnit Launcher.
- */
- public static Test suite() {
- return new NavigatorTestSuite();
- }
-
- /**
- * Construct the test suite.
- */
- public NavigatorTestSuite() {
- addTest(new TestSuite(ResourceNavigatorTest.class));
- addTest(new TestSuite(NavigatorTest.class));
- addTest(new TestSuite(DecoratorTestCase.class));
- addTest(new TestSuite(LightweightDecoratorTestCase.class));
- addTest(new TestSuite(DuplicateMenuItemTest.class));
- }
-
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/ResourceNavigatorTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/ResourceNavigatorTest.java
deleted file mode 100644
index 8dfbfdb..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/ResourceNavigatorTest.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.navigator;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.widgets.TreeItem;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchActionConstants;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.IWorkingSet;
-import org.eclipse.ui.IWorkingSetManager;
-import org.eclipse.ui.part.ISetSelectionTarget;
-import org.eclipse.ui.tests.util.ActionUtil;
-import org.eclipse.ui.tests.util.FileUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-import org.eclipse.ui.views.navigator.ResourceNavigator;
-
-public class ResourceNavigatorTest extends UITestCase {
- private IWorkbenchPage activePage;
- private IWorkbenchWindow workbenchWindow;
- private IViewPart view;
- private IProject p1;
- private IProject p2;
- private IFile f1;
- private IFile f2;
-
- /**
- * Constructor for ResourceNavigatorTest.
- * @param testName
- */
- public ResourceNavigatorTest(String testName) {
- super(testName);
- }
-
- public void setUp() {
- workbenchWindow = openTestWindow();
- activePage = workbenchWindow.getActivePage();
- }
-
- private void setupView() throws Throwable {
- view = activePage.showView("org.eclipse.ui.views.ResourceNavigator");
- }
-
- private void setupResources() throws Throwable {
- if (p1 == null) {
- p1 = FileUtil.createProject("TP1");
- f1 = null;
- }
- if (p2 == null) {
- p2 = FileUtil.createProject("TP2");
- f2 = null;
- }
- if (f1 == null)
- f1 = FileUtil.createFile("f1.txt", p1);
- if (f2 == null)
- f2 = FileUtil.createFile("f2.txt", p2);
- }
-
- public void fixTestGlobalBookmarkAction() throws Throwable {
- setupView();
- setupResources();
-
- // Select a file
- IStructuredSelection sel = new StructuredSelection(f1);
- ((ResourceNavigator) view).selectReveal(sel);
-
- // Remember the previous marker count on the file
- int oldCount = (f1.findMarkers(IMarker.BOOKMARK, true, IResource.DEPTH_INFINITE)).length;
-
- // Now try the bookmark action
- ActionUtil.runActionUsingPath(this, workbenchWindow, IWorkbenchActionConstants.M_EDIT + '/' + IWorkbenchActionConstants.BOOKMARK);
-
- // Make sure the resource was bookmarked
- int newCount = (f1.findMarkers(IMarker.BOOKMARK, true, IResource.DEPTH_INFINITE)).length;
- assertTrue("Selected file was not bookmarked via Edit->Bookmark action.", oldCount + 1 == newCount);
- }
-
-/*
- * This test should be moved to an interactive test suite as this
- * test causes a dialog to popup when the resource is deleted by
- * the delete action
- *
- public void testGlobalDeleteAction() throws Throwable {
- setupView();
- setupResources();
-
- // Select a file
- IStructuredSelection sel = new StructuredSelection(f1);
- ((ResourceNavigator) view).selectReveal(sel);
-
- // Now try the delete action
- ActionUtil.runActionUsingPath(this, workbenchWindow, IWorkbenchActionConstants.M_EDIT + '/' + IWorkbenchActionConstants.DELETE);
-
- // Make sure the resource was deleted
- assertTrue("Selected file was not deleted via Edit->Delete action.", p1.findMember(f1.getName()) == null);
- f1 = null;
- }
-*/
-
- public void testSelectReveal() throws Throwable {
- setupView();
- setupResources();
-
- ISetSelectionTarget part = (ISetSelectionTarget) view;
- TreeViewer tree = ((ResourceNavigator) view).getViewer();
-
- // Set the selection in the navigator
- IStructuredSelection sel1 = new StructuredSelection(f1);
- part.selectReveal(sel1);
- // Get the selection the tree has
- IStructuredSelection treeSel1 = (IStructuredSelection) tree.getSelection();
- assertTrue("First selection wrong size, should be only one.", treeSel1.size() == 1);
- IResource resource1 = (IResource) treeSel1.getFirstElement();
- assertTrue("First selection contains wrong file resource.", resource1.equals(f1));
-
- // Set the selection in the navigator
- IStructuredSelection sel2 = new StructuredSelection(p2);
- part.selectReveal(sel2);
- // Get the selection the tree has
- IStructuredSelection treeSel2 = (IStructuredSelection) tree.getSelection();
- assertTrue("Second selection wrong size, should be only one.", treeSel2.size() == 1);
- IResource resource2 = (IResource) treeSel2.getFirstElement();
- assertTrue("Second selection contains wrong project resource.", resource2.equals(p2));
- }
-
- public void testWorkingSet() throws Throwable {
- setupView();
- setupResources();
-
- ResourceNavigator navigator = ((ResourceNavigator) view);
- IWorkingSetManager workingSetManager = fWorkbench.getWorkingSetManager();
- IWorkingSet workingSet = workingSetManager.createWorkingSet("ws1", new IAdaptable[] {f1});
-
- assertNull(navigator.getWorkingSet());
-
- navigator.setWorkingSet(workingSet);
- assertEquals(workingSet, navigator.getWorkingSet());
-
- navigator.setWorkingSet(null);
- assertNull(navigator.getWorkingSet());
-
- FileUtil.createFile("f11.txt", p1);
- navigator.setWorkingSet(workingSet);
- TreeViewer viewer = navigator.getTreeViewer();
- viewer.expandAll();
- TreeItem[] items = viewer.getTree().getItems();
- assertEquals(p1, items[0].getData());
- items = items[0].getItems();
- assertEquals(f1, items[0].getData());
- }
-}
-
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/TestDecoratorContributor.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/TestDecoratorContributor.java
deleted file mode 100644
index bf2a1a9..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/TestDecoratorContributor.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.navigator;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-
-import org.eclipse.swt.graphics.Image;
-
-import org.eclipse.jface.viewers.ILabelDecorator;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.LabelProviderChangedEvent;
-
-import org.eclipse.ui.internal.misc.Assert;
-
-public class TestDecoratorContributor implements ILabelDecorator {
-
- public static TestDecoratorContributor contributor;
- private Set listeners = new HashSet();
- public static String DECORATOR_SUFFIX = "_SUFFIX";
-
- public TestDecoratorContributor() {
- contributor = this;
- }
-
- /*
- * @see ILabelDecorator#decorateText(String, Object)
- */
- public String decorateText(String text, Object element) {
- //Check that the element is adapted to IResource
- Assert.isTrue(element instanceof IResource);
- return text + DECORATOR_SUFFIX;
- }
- /*
- * @see ILabelDecorator#decorateImage(Image, Object)
- */
- public Image decorateImage(Image image, Object element) {
- Assert.isTrue(element instanceof IResource);
- return image;
- }
-
- /*
- * @see IBaseLabelProvider#addListener(ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- listeners.add(listener);
- }
-
- /*
- * @see IBaseLabelProvider#dispose()
- */
- public void dispose() {
- contributor = null;
- listeners = new HashSet();
- }
-
- /*
- * @see IBaseLabelProvider#isLabelProperty(Object, String)
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /*
- * @see IBaseLabelProvider#removeListener(ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Refresh the listeners to update the decorators for
- * element.
- */
-
- public void refreshListeners(Object element) {
- Iterator iterator = listeners.iterator();
- while (iterator.hasNext()) {
- LabelProviderChangedEvent event = new LabelProviderChangedEvent(this, element);
- ((ILabelProviderListener) iterator.next()).labelProviderChanged(event);
- }
- }
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/TestLightweightDecoratorContributor.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/TestLightweightDecoratorContributor.java
deleted file mode 100644
index 1f4a95e..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/navigator/TestLightweightDecoratorContributor.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.navigator;
-
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.*;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.*;
-import org.eclipse.ui.internal.misc.Assert;
-import org.eclipse.ui.tests.TestPlugin;
-
-public class TestLightweightDecoratorContributor
- implements ILightweightLabelDecorator {
-
- public static TestLightweightDecoratorContributor contributor;
- private Set listeners = new HashSet();
- public static String DECORATOR_SUFFIX = "_SUFFIX";
- public static String DECORATOR_PREFIX = "PREFIX_";
- private ImageDescriptor descriptor;
-
- public TestLightweightDecoratorContributor() {
- contributor = this;
- }
-
- /*
- * @see IBaseLabelProvider#addListener(ILabelProviderListener)
- */
- public void addListener(ILabelProviderListener listener) {
- listeners.add(listener);
- }
-
- /*
- * @see IBaseLabelProvider#dispose()
- */
- public void dispose() {
- contributor = null;
- listeners = new HashSet();
- }
-
- /*
- * @see IBaseLabelProvider#isLabelProperty(Object, String)
- */
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- /*
- * @see IBaseLabelProvider#removeListener(ILabelProviderListener)
- */
- public void removeListener(ILabelProviderListener listener) {
- listeners.remove(listener);
- }
-
- /**
- * Refresh the listeners to update the decorators for
- * element.
- */
-
- public void refreshListeners(Object element) {
- Iterator iterator = listeners.iterator();
- while (iterator.hasNext()) {
- LabelProviderChangedEvent event =
- new LabelProviderChangedEvent(this, element);
- ((ILabelProviderListener) iterator.next()).labelProviderChanged(
- event);
- }
- }
-
- /**
- * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#getOverlay(java.lang.Object)
- */
- public ImageDescriptor getOverlay(Object element) {
- Assert.isTrue(element instanceof IResource);
- if (descriptor == null) {
- URL source =
- TestPlugin.getDefault().getDescriptor().getInstallURL();
- try {
- descriptor =
- ImageDescriptor.createFromURL(
- new URL(source, "icons/binary_co.gif"));
- } catch (MalformedURLException exception) {
- return null;
- }
- }
- return descriptor;
-
- }
-
- /**
- * @see org.eclipse.jface.viewers.ILightweightLabelDecorator#decorate(java.lang.Object, org.eclipse.jface.viewers.IDecoration)
- */
- public void decorate(Object element, IDecoration decoration) {
- decoration.addOverlay(getOverlay(element));
- decoration.addPrefix(DECORATOR_PREFIX);
- decoration.addSuffix(DECORATOR_SUFFIX);
- }
-
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/PropertySheetAuto.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/PropertySheetAuto.java
deleted file mode 100644
index 38bb546..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/PropertySheetAuto.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.propertysheet;
-
-import java.util.ArrayList;
-import java.util.Random;
-
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.widgets.Display;
-
-import org.eclipse.jface.viewers.StructuredSelection;
-
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.tests.SelectionProviderView;
-import org.eclipse.ui.tests.util.UITestCase;
-import org.eclipse.ui.views.properties.ColorPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertyDescriptor;
-import org.eclipse.ui.views.properties.IPropertySource;
-import org.eclipse.ui.views.properties.TextPropertyDescriptor;
-/**
- * The class implements a test for the workbench's default
- * property sheet page. It does this by firing a sequence of
- * selection events. The property sheet view receives these events
- * and displays the properties for the selected objects.
- * We are able to test the property sheet code which displays
- * properties and handles the transition to another set of
- * properties.
- */
-
-public class PropertySheetAuto extends UITestCase {
-
- /**
- * This car serves as a simple porperty source.
- * The only interesting behavior it has is that if
- * one of its properties has a "null" value then
- * it does not include that property in its list
- * of property descriptors.
- */
- private class Car implements IPropertySource {
- private int modelYear = 0;
- private RGB color = null;
- private String manufacturer = null;
- private String model = null;
- private double engineSize = 0.0;
-
- // property ids
- private final static String prefix = "org.eclipse.ui.tests.standardcomponents.propertysheetauto.";
- private final static String MODEL_YEAR = prefix + "modelyear";
- private final static String COLOR = prefix + "color";
- private final static String MANUFACTURER = prefix + "manufacturer";
- private final static String MODEL = prefix + "model";
- private final static String ENGINE_SIZE = prefix + "enginesize";
-
- private IPropertyDescriptor[] descriptors;
-
- public Car(int carModelYear, RGB carColor,
- String carManufacturer, String carModel, double carEngineSize) {
- modelYear = carModelYear;
- color = carColor;
- manufacturer = carManufacturer;
- model = carModel;
- engineSize = carEngineSize;
-
- createDescriptors();
- }
- /**
- * Creates the property descriptors.
- * If one of the properties has a "null" value then
- * that property is not included in the list of
- * property descriptors.
- */
- private void createDescriptors() {
- ArrayList list = new ArrayList(5);
- if (modelYear != 0)
- list.add(new TextPropertyDescriptor(MODEL_YEAR, "model year"));
- if (color != null)
- list.add(new ColorPropertyDescriptor(COLOR, "color"));
- if (manufacturer != null)
- list.add(new TextPropertyDescriptor(MANUFACTURER, "make"));
- if (model != null)
- list.add(new TextPropertyDescriptor(MODEL, "model"));
- if (engineSize != 0.0)
- list.add(new TextPropertyDescriptor(ENGINE_SIZE, "engine"));
- descriptors = (IPropertyDescriptor[])list.toArray(new IPropertyDescriptor[list.size()]);
- }
- public Object getEditableValue() {
- return this;
- }
- public IPropertyDescriptor[] getPropertyDescriptors() {
- return descriptors;
- }
- public Object getPropertyValue(Object id) {
- if (id.equals(MODEL_YEAR))
- return Integer.toString(modelYear);
- if (id.equals(COLOR))
- return color;
- if (id.equals(MANUFACTURER))
- return manufacturer;
- if (id.equals(MODEL))
- return model;
- if (id.equals(ENGINE_SIZE))
- return Double.toString(engineSize);
- return null;
- }
- public boolean isPropertySet(Object id) {
- return false;
- }
- public void resetPropertyValue(Object id) {
- return;
- }
- public void setPropertyValue(Object id, Object value) {
- if (id.equals(MODEL_YEAR))
- modelYear = new Integer((String)value).intValue();
- if (id.equals(COLOR))
- color = (RGB)value;
- if (id.equals(MANUFACTURER))
- manufacturer = (String)value;
- if (id.equals(MODEL))
- model = (String)value;
- if (id.equals(ENGINE_SIZE))
- engineSize = new Double((String)value).doubleValue();
- }
- public String toString() {
- StringBuffer s = new StringBuffer();
- s.append("<");
- if (modelYear != 0) {
- s.append(modelYear);
- s.append(" ");
- }
- if (color != null) {
- s.append(color);
- s.append(" ");
- }
- if (manufacturer != null) {
- s.append(manufacturer);
- s.append(" ");
- }
- if (model != null) {
- s.append(model);
- s.append(" ");
- }
- if (engineSize != 0.0) {
- s.append(engineSize);
- s.append(" ");
- }
- s.append(">");
- return s.toString();
- }
- }
- private IWorkbenchPage activePage;
- private IWorkbenchWindow workbenchWindow;
- private SelectionProviderView selectionProviderView;
- private Car[] cars;
- private Random random = new Random();
- private static final int NUMBER_OF_CARS = 10;
- private static final int NUMBER_OF_SELECTIONS = 100;
- private static final String[] makers = new String[] {"Ford", "GM", "Chrysler", "BMW", "Toyota", "Nissan", "Honda", "Volvo"};
- private static final String[] models = new String[] {"Thunderbird", "Deville", "Viper", "320i", "Camry", "Ultima", "Prelude", "V70"};
- public PropertySheetAuto(String name) {
- super(name);
- }
- /**
- * Creates a array of car objects
- */
- private void createCars() {
- cars = new Car[NUMBER_OF_CARS];
- for (int i = 0; i < cars.length; i++) {
- cars[i] = createCar();
- }
- }
- /**
- * Creates a car initialized with random values
- */
- private Car createCar() {
- int modelYear = 0;
- RGB color = null;
- String manufacturer = null;
- String model = null;
- double engineSize = 0.0;
- // only set 25% of the properties
- int FACTOR = 4;
- if (random.nextInt(FACTOR) < FACTOR - 1)
- modelYear = 1990 + random.nextInt(15);
- if (random.nextInt(FACTOR) < FACTOR - 1)
- color = new RGB(random.nextInt(256), random.nextInt(256), random.nextInt(256));
- if (random.nextInt(FACTOR) < FACTOR - 1)
- manufacturer = makers[random.nextInt(makers.length)];
- if (random.nextInt(FACTOR) < FACTOR - 1)
- model = models[random.nextInt(models.length)];
- if (random.nextInt(FACTOR) < FACTOR - 1)
- engineSize = random.nextDouble() * 6;
- return new Car(modelYear, color, manufacturer, model, engineSize);
- }
-
- public void setUp() {
- workbenchWindow = openTestWindow();
- activePage = workbenchWindow.getActivePage();
- }
-
- protected IWorkbenchPart createTestPart(IWorkbenchPage page) throws Throwable {
- IViewPart view = page.showView("org.eclipse.ui.views.PropertySheet");
- selectionProviderView = (SelectionProviderView)page.showView(SelectionProviderView.ID);
- return view;
-
- }
-
- /**
- * Supply selection events with a random car selection
- */
- public void testInput() throws Throwable {
- createTestPart(activePage);
- createCars();
- for (int i=0; i < NUMBER_OF_SELECTIONS; i++) {
- // create the selection
- int numberToSelect = random.nextInt(NUMBER_OF_CARS - 2);
- ArrayList selection = new ArrayList(numberToSelect);
- while (selection.size() < numberToSelect) {
- int j = random.nextInt(NUMBER_OF_CARS);
- if (!selection.contains(cars[j]))
- selection.add(cars[j]);
- }
- StructuredSelection structuredSelection = new StructuredSelection(selection);
- // fire the selection
- selectionProviderView.setSelection(structuredSelection);
- while(Display.getCurrent().readAndDispatch());
- }
- }
-}
-
-
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/PropertySheetTestSuite.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/PropertySheetTestSuite.java
deleted file mode 100644
index 81b35ac..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/propertysheet/PropertySheetTestSuite.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.propertysheet;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * Test areas of the Property Sheet API.
- */
-public class PropertySheetTestSuite extends TestSuite {
-
- /**
- * Returns the suite. This is required to
- * use the JUnit Launcher.
- */
- public static Test suite() {
- return new PropertySheetTestSuite();
- }
-
- /**
- * Construct the test suite.
- */
- public PropertySheetTestSuite() {
- addTest(new TestSuite(PropertySheetAuto.class));
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ActivateTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ActivateTest.java
deleted file mode 100644
index 33e8744..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ActivateTest.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.zoom;
-import junit.framework.Assert;
-
-import org.eclipse.ui.IViewPart;
-
-public class ActivateTest extends ZoomTestCase {
- public ActivateTest(String name) {
- super(name);
- }
-
- // activate a regular view when a view is zoomed
- public void test1() {
- IViewPart view1 = showRegularView(view1Id);
- IViewPart view2 = showRegularView(view2Id);
- zoom(view1);
- Assert.assertTrue(isZoomed(view1));
- page.activate(view2);
- Assert.assertTrue(noZoom());
- }
- // activate a fast view when a view is zoomed
- public void test2() {
- IViewPart view1 = showRegularView(view1Id);
- IViewPart view2 = showFastView(view2Id);
- zoom(view1);
- Assert.assertTrue(isZoomed(view1));
- page.activate(view2);
- Assert.assertTrue(isZoomed(view1));
- }
- // activate an editor when a view is zoomed
- public void test3() {
- IViewPart view = showRegularView(view1Id);
- page.activate(view);
- zoom(view);
- Assert.assertTrue(isZoomed(view));
- page.activate(editor1);
- Assert.assertTrue(noZoom());
- }
- //activate a regular view when an editor is zoomed
- public void test4() {
- IViewPart view = showRegularView(view1Id);
- zoom(editor1);
- Assert.assertTrue(isZoomed(editor1));
- page.activate(view);
- Assert.assertTrue(noZoom());
- }
- // activate a fast view when an editor is zoomed
- public void test5() {
- IViewPart view = showFastView(view1Id);
- zoom(editor1);
- Assert.assertTrue(isZoomed(editor1));
- page.activate(view);
- Assert.assertTrue(isZoomed(editor1));
- }
- // activate an editor in the same workbench as the zoomed editor
- public void test6() {
- zoom(editor1);
- Assert.assertTrue(isZoomed(editor1));
- page.activate(editor2);
- Assert.assertTrue(isZoomed(editor2));
- }
- // activate an editor in a different workbench than the zoomed editor
- public void test7() {
- differentWorkbookSetUp();
- zoom(editor1);
- Assert.assertTrue(isZoomed(editor1));
- page.activate(editor2);
- Assert.assertTrue(noZoom());
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/CloseEditorTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/CloseEditorTest.java
deleted file mode 100644
index c8da61b..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/CloseEditorTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.zoom;
-import junit.framework.Assert;
-
-import org.eclipse.ui.IViewPart;
-
-public class CloseEditorTest extends ZoomTestCase {
- public CloseEditorTest(String name) {
- super(name);
- }
-
- // closing the editor activates a regular view
- public void test1() {
- IViewPart view = showRegularView(view1Id);
- page.closeEditor(editor2, false);
- zoom(editor1);
- Assert.assertTrue(isZoomed(editor1));
- page.closeEditor(editor1, false);
- Assert.assertTrue(page.getActivePart() == view);
- Assert.assertTrue(noZoom());
- }
- // closing the editor activates an editor in the same workbook
- public void test2() {
- zoom(editor1);
- Assert.assertTrue(isZoomed(editor1));
- page.closeEditor(editor1, false);
- Assert.assertTrue(page.getActivePart() == editor2);
- Assert.assertTrue(isZoomed(editor2));
- }
- // closing the editor activates an editor in a different workbook
- public void test3() {
- differentWorkbookSetUp();
- zoom(editor1);
- Assert.assertTrue(isZoomed(editor1));
- page.closeEditor(editor1, false);
- Assert.assertTrue(page.getActivePart() == editor2);
- Assert.assertTrue(noZoom());
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/HideViewTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/HideViewTest.java
deleted file mode 100644
index 17e382f..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/HideViewTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.zoom;
-import junit.framework.Assert;
-
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IViewPart;
-
-public class HideViewTest extends ZoomTestCase {
- public HideViewTest(String name) {
- super(name);
- }
-
- // hiding a fast view causes a zoomed regular view to be activated
- public void test1() {
- IViewPart view1 = showFastView(view1Id);
- zoom(editor1);
- Assert.assertTrue(isZoomed(editor1));
- page.hideView(view1);
- Assert.assertTrue(page.getActivePart() == editor1);
- Assert.assertTrue(isZoomed(editor1));
- }
- // hiding a fast view causes a zoomed regular view to be activated
- public void test2() {
- IViewPart view1 = showRegularView(view1Id);
- IViewPart view2 = showFastView(view2Id);
- zoom(view1);
- Assert.assertTrue(isZoomed(view1));
- page.hideView(view2);
- Assert.assertTrue(page.getActivePart() == view1);
- Assert.assertTrue(isZoomed(view1));
- }
- // hiding a regular view causes another regular view to be activated
- public void test3() {
- IViewPart view1 = showRegularView(view1Id);
- IViewPart view2 = showRegularView(view2Id);
- zoom(view1);
- Assert.assertTrue(isZoomed(view1));
- page.hideView(view1);
- Assert.assertTrue(page.getActivePart() == view2);
- Assert.assertTrue(noZoom());
- }
- // hiding view causes an editor to be activated
- public void test4() {
- IViewPart view1 = showRegularView(view1Id);
- zoom(view1);
- Assert.assertTrue(isZoomed(view1));
- page.hideView(view1);
- Assert.assertTrue(page.getActivePart() instanceof IEditorPart);
- Assert.assertTrue(noZoom());
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/OpenEditorTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/OpenEditorTest.java
deleted file mode 100644
index f90e1da..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/OpenEditorTest.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.zoom;
-import junit.framework.Assert;
-
-import org.eclipse.ui.IViewPart;
-
-public class OpenEditorTest extends ZoomTestCase {
- public OpenEditorTest(String name) {
- super(name);
- }
-
- // open an editor when a view is zoomed
- public void test1() {
- IViewPart view = showRegularView(view1Id);
- zoom(view);
- openEditor(file1);
- Assert.assertTrue(noZoom());
- }
- // open an editor in the same workbook as the zoomed editor
- public void test2() {
- zoom(editor1);
- openEditor(file2);
- Assert.assertTrue(isZoomed(editor2));
- }
- // open an editor in a different workbook than the zoomed editor
- public void test3() {
- differentWorkbookSetUp();
- zoom(editor1);
- openEditor(file2);
- Assert.assertTrue(noZoom());
- }
- // open a new editor while another editor is zoomed
- public void test4() {
- page.closeEditor(editor2, false);
- zoom(editor1);
- openEditor(file2);
- Assert.assertTrue(isZoomed(editor2));
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ShowViewTest.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ShowViewTest.java
deleted file mode 100644
index 56e0fd7..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ShowViewTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.zoom;
-
-import junit.framework.Assert;
-
-import org.eclipse.ui.IViewPart;
-
-public class ShowViewTest extends ZoomTestCase {
- public ShowViewTest(String name) {
- super(name);
- }
-
- // a view is zoomed, a regular view is shown
- public void test1() {
- IViewPart view1 = showRegularView(view1Id);
- showRegularView(view2Id);
- zoom(view1);
- Assert.assertTrue(isZoomed(view1));
- showRegularView(view2Id);
- Assert.assertTrue(noZoom());
- }
- // a view is zoomed, a fast view is shown
- public void test2() {
- IViewPart view1 = showRegularView(view1Id);
- zoom(view1);
- Assert.assertTrue(isZoomed(view1));
- showFastView(view2Id);
- Assert.assertTrue(isZoomed(view1));
- }
- // an editor is zoomed, a regular view is shown
- public void test3() {
- zoom(editor1);
- Assert.assertTrue(isZoomed(editor1));
- showRegularView(view1Id);
- Assert.assertTrue(noZoom());
- }
- // an editor is zoomed, a fast view is shown
- public void test4() {
- zoom(editor1);
- Assert.assertTrue(isZoomed(editor1));
- showFastView(view1Id);
- Assert.assertTrue(isZoomed(editor1));
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ZoomTestCase.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ZoomTestCase.java
deleted file mode 100644
index 15394f6..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ZoomTestCase.java
+++ /dev/null
@@ -1,139 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.zoom;
-import junit.framework.Assert;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.runtime.CoreException;
-
-import org.eclipse.jface.preference.IPreferenceStore;
-
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.internal.EditorArea;
-import org.eclipse.ui.internal.EditorPane;
-import org.eclipse.ui.internal.EditorSite;
-import org.eclipse.ui.internal.EditorWorkbook;
-import org.eclipse.ui.internal.IPreferenceConstants;
-import org.eclipse.ui.internal.PartPane;
-import org.eclipse.ui.internal.PartSite;
-import org.eclipse.ui.internal.WorkbenchPage;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.internal.WorkbenchWindow;
-import org.eclipse.ui.tests.api.MockEditorPart;
-import org.eclipse.ui.tests.util.FileUtil;
-import org.eclipse.ui.tests.util.UITestCase;
-
-public class ZoomTestCase extends UITestCase {
- private static final String projectName = "Test";
- private static final String file1Name = "TestFile1";
- private static final String file2Name = "TestFile2";
- protected static final String view1Id = IPageLayout.ID_RES_NAV;
- protected static final String view2Id = IPageLayout.ID_OUTLINE;
-
- protected WorkbenchWindow window;
- protected WorkbenchPage page;
- protected IProject project;
- protected IFile file1, file2;
- protected IEditorPart editor1, editor2;
-
- public ZoomTestCase(String name) {
- super(name);
- }
-
- public void setUp() {
- window = (WorkbenchWindow)openTestWindow();
- page = (WorkbenchPage)window.getActivePage();
- IPreferenceStore store = WorkbenchPlugin.getDefault().getPreferenceStore();
- store.setDefault(IPreferenceConstants.OPEN_VIEW_MODE, IPreferenceConstants.OVM_FAST);
- try {
- project = FileUtil.createProject("IEditorPartTest");
- file1 = FileUtil.createFile("Test1.java", project);
- file2 = FileUtil.createFile("Test2.java", project);
- editor1 = page.openEditor(file1, MockEditorPart.ID1);
- editor2 = page.openEditor(file2, MockEditorPart.ID2);
- } catch(PartInitException e) {
- } catch(CoreException e) {
- }
- }
-
- // opens editor2 in a seperate workbook
- protected void differentWorkbookSetUp() {
- EditorPane pane = (EditorPane)((PartSite)editor1.getSite()).getPane();
- EditorArea area = pane.getWorkbook().getEditorArea();
- EditorWorkbook workbook = new EditorWorkbook(area);
-
- area.add(workbook, IPageLayout.BOTTOM, (float) 0.5, pane.getWorkbook());
- workbook.add(pane);
-
- EditorPane pane1 = (EditorPane)((EditorSite)editor1.getSite()).getPane();
- EditorPane pane2 = (EditorPane)((EditorSite)editor2.getSite()).getPane();
- Assert.assertTrue(!pane1.getWorkbook().equals(pane2.getWorkbook()));
- }
-
- // zooms the given part
- protected void zoom(IWorkbenchPart part) {
- if (part == null)
- throw new NullPointerException();
- page.toggleZoom(((PartSite) part.getSite()).getPane().getPartReference());
- Assert.assertTrue(page.isZoomed());
- }
- // open the given file in an editor
- protected void openEditor(IFile file) {
- try {
- if(file == file1)
- editor1 = page.openEditor(file);
- if(file == file2)
- editor2 = page.openEditor(file);
- } catch(PartInitException e) {
- }
- }
- // show the given view as a regular view
- protected IViewPart showRegularView(String id) {
- try {
- IViewPart view = page.showView(id);
- IViewReference ref = (IViewReference)page.getReference(view);
- if(page.isFastView(ref))
- page.removeFastView(ref);
- return view;
- } catch(PartInitException e) {
- } ;
- return null;
- }
- // show the given view
- protected IViewPart showFastView(String id) {
- try {
- IViewPart view = page.showView(id);
- IViewReference ref = (IViewReference)page.getReference(view);
- Assert.assertTrue(page.isFastView(ref));
- return view;
- } catch(PartInitException e) {
- } ;
- return null;
- }
- // returns whether this part is zoomed
- protected boolean isZoomed(IWorkbenchPart part) {
- PartSite site = (PartSite)part.getSite();
- PartPane pane = site.getPane();
- return pane.isZoomed();
- }
- // returns true if the page is not zoomed, false otherwise
- protected boolean noZoom() {
- if (page.isZoomed())
- return false;
- return true;
- }
-}
diff --git a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ZoomTestSuite.java b/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ZoomTestSuite.java
deleted file mode 100644
index a431f70..0000000
--- a/tests/org.eclipse.ui.tests/Eclipse UI Tests/org/eclipse/ui/tests/zoom/ZoomTestSuite.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.zoom;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-/**
- * A test suite to test the zooming behavior of Eclipse.
- */
-public class ZoomTestSuite extends TestSuite {
- /**
- * Returns the suite. This is required to
- * use the JUnit Launcher.
- */
- public static Test suite() {
- return new ZoomTestSuite();
- }
-
- /**
- * Construct the test suite.
- */
- public ZoomTestSuite() {
- addTest(new TestSuite(ActivateTest.class));
- addTest(new TestSuite(CloseEditorTest.class));
- addTest(new TestSuite(HideViewTest.class));
- addTest(new TestSuite(OpenEditorTest.class));
- addTest(new TestSuite(ShowViewTest.class));
- }
-}
diff --git a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/AccessibilityTestPass.java b/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/AccessibilityTestPass.java
deleted file mode 100644
index 996e704..0000000
--- a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/AccessibilityTestPass.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal.util;
-
-
-import java.util.ArrayList;
-
-
-public class AccessibilityTestPass implements IDialogTestPass {
- private static final int CHECKLIST_SIZE = 5;
-
- /**
- * @see IDialogTestPass#title()
- */
- public String title() {
- return "Test Pass: Accessibility";
- }
- /**
- * @see IDialogTestPass#description()
- */
- public String description() {
- return "Verify the accessibility of the dialogs.";
- }
- /**
- * @see IDialogTestPass#label()
- */
- public String label() {
- return "&Accessibility";
- }
- /**
- * @see IDialogTestPass#checkListTexts()
- */
- public ArrayList checkListTexts() {
- ArrayList list = new ArrayList(CHECKLIST_SIZE);
- list.add("&1) all widgets are accessible by tabbing.");
- list.add("&2) forwards and backwards tabbing is in a logical order");
- list.add("&3) all the widgets with labels have an appropriate mnemonic.");
- list.add("&4) there are no duplicate mnemonics.");
- list.add("&5) selectable widgets can be selected using the spacebar.");
- return list;
- }
- /**
- * @see IDialogTestPass#failureTexts()
- * Size of the return array must be the same size as the checkListTexts'
- * ArrayList.
- */
- public String[] failureTexts() {
- String[] failureText = new String[CHECKLIST_SIZE];
- failureText[0] = "Some widgets aren't accessible by tabbing.";
- failureText[1] = "Tabbing order is illogical.";
- failureText[2] = "Missing or inappropriate mnemonics.";
- failureText[3] = "Duplicate mnemonics.";
- failureText[4] = "Some widgets cannot be selected using the spacebar.";
- return failureText;
- }
- /**
- * @see IDialogTestPass#queryText()
- */
- public String queryText() {
- return "Is the accessibility of the dialog acceptable?";
- }
- /**
- * @see IDialogTestPass#getID()
- */
- public int getID() {
- return VerifyDialog.TEST_ACCESS;
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/FailureDialog.java b/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/FailureDialog.java
deleted file mode 100644
index 56f9e3b..0000000
--- a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/FailureDialog.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal.util;
-
-
-
-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.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.resource.JFaceResources;
-
-
-/*
- * A dialog for collecting notes from the tester regarding
- * the failure of a test.
- */
-public class FailureDialog extends Dialog {
- private Text _text;
- private String _log;
- private int SIZING_TEXT_WIDTH = 400;
- private int SIZING_TEXT_HEIGHT = 200;
-
- /**
- * Constructor for FailureDialog
- */
- public FailureDialog(Shell parentShell) {
- super(parentShell);
- }
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText("Dialog Test Failed");
- }
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- createButton(parent, IDialogConstants.OK_ID, "&OK", true);
- createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, false);
- }
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected Control createDialogArea(Composite parent) {
- // page group
- Composite composite = (Composite)super.createDialogArea(parent);
- composite.setSize( composite.computeSize(SWT.DEFAULT, SWT.DEFAULT) );
-
- Label label = new Label(composite, SWT.WRAP);
- label.setText("&Enter a note regarding the failure:");
-
- _text = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
- _text.setFont( JFaceResources.getFontRegistry().get(JFaceResources.TEXT_FONT) );
- GridData data = new GridData(GridData.FILL_BOTH);
- data.widthHint = SIZING_TEXT_WIDTH;
- data.heightHint = SIZING_TEXT_HEIGHT;
- _text.setLayoutData(data);
-
- return composite;
- }
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void okPressed() {
- _log = _text.getText();
- super.okPressed();
- }
- /*
- * @return String the text contained in the input area of
- * the dialog.
- */
- String getText() {
- if (_log == null) {
- return "Empty entry.";
- } else {
- return _log;
- }
- }
- /*
- * Sets the text of the input area. This should only be
- * called to set the initial text so only call before invoking
- * open().
- */
- void setText(String text) {
- _text.setText(text);
- }
- /*
- * Returns a string representation of this class which
- * the text contained in the input area of the dialog.
- */
- public String toString() {
- return getText();
- }
-}
-
-
diff --git a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/FocusTestPass.java b/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/FocusTestPass.java
deleted file mode 100644
index 93f4d80..0000000
--- a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/FocusTestPass.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal.util;
-
-
-
-import java.util.ArrayList;
-
-
-/*
- * This test pass verifies the initial focus of a dialog
- * when it is given focus.
- */
-public class FocusTestPass implements IDialogTestPass {
- private static final int CHECKLIST_SIZE = 1;
-
-
- /**
- * @see IDialogTestPass#title()
- */
- public String title() {
- return "Test Pass: Initial Focus";
- }
- /**
- * @see IDialogTestPass#description()
- */
- public String description() {
- return "Verify the initial focus of the dialogs.";
- }
- /**
- * @see IDialogTestPass#label()
- */
- public String label() {
- return "&Initial Focus";
- }
- /**
- * @see IDialogTestPass#checkListTexts()
- */
- public ArrayList checkListTexts() {
- ArrayList list = new ArrayList(CHECKLIST_SIZE);
- list.add("&1) the initial focus is appropriate.");
- return list;
- }
- /**
- * @see IDialogTestPass#failureTexts()
- * Size of the return array must be the same size as the checkListTexts'
- * ArrayList.
- */
- public String[] failureTexts() {
- String[] failureText = new String[CHECKLIST_SIZE];
- failureText[0] = "The initial focus is inappropriate.";
- return failureText;
- }
- /**
- * @see IDialogTestPass#queryText()
- */
- public String queryText() {
- return "Is the initial focus of the dialog correct?";
- }
- /**
- * @see IDialogTestPass#getID()
- */
- public int getID() {
- return VerifyDialog.TEST_FOCUS;
- }
-}
diff --git a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/IDialogTestPass.java b/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/IDialogTestPass.java
deleted file mode 100644
index 9a3bca2..0000000
--- a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/IDialogTestPass.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal.util;
-
-
-import java.util.ArrayList;
-
-
-/*
- * Interface to describe a visual test pass for a dialog test.
- */
-public interface IDialogTestPass {
- /*
- * @return String The title of the test pass.
- */
- public String title();
- /*
- * @return String The description of the test pass.
- */
- public String description();
- /*
- * @return String The label of the test pass to be used
- * in a selection list. The return includes an '&'
- * if a mnemonic is desired.
- */
- public String label();
- /*
- * @return ArrayList A list of items to appear in a checklist.
- * The items in the list must be Strings and should include an
- * '&' if a mnemonic is desired.
- */
- public ArrayList checkListTexts();
- /*
- * @return String[] Associated failure messages that correspond
- * to the checklist items. The size of this array should be the
- * same size as the checklist.
- */
- public String[] failureTexts();
- /*
- * @return String The test that corresponds to the test pass to
- * which the tester will respond with a 'yes' or 'no'.
- */
- public String queryText();
- /*
- * @return int A unique number that identifies the test pass.
- */
- public int getID();
-}
-
-
diff --git a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/SizingTestPass.java b/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/SizingTestPass.java
deleted file mode 100644
index f4c29e7..0000000
--- a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/SizingTestPass.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal.util;
-
-
-
-import java.util.ArrayList;
-
-
-/*
- * This test pass verifies visually the sizing of the dialog and its
- * widgets.
- */
-class SizingTestPass implements IDialogTestPass {
- private static final int CHECKLIST_SIZE = 5;
-
-
- /**
- * @see IDialogTestPass#title()
- */
- public String title() {
- return "Test Pass: Sizing and Display";
- }
- /**
- * @see IDialogTestPass#description()
- */
- public String description() {
- return "Verify the sizing and display of the dialogs and widgets.";
- }
- /**
- * @see IDialogTestPass#label()
- */
- public String label() {
- return "&Sizing and Display";
- }
- /**
- * @see IDialogTestPass#checkListTexts()
- */
- public ArrayList checkListTexts() {
- ArrayList list = new ArrayList(CHECKLIST_SIZE);
- list.add("&1) the correct dialog displays.");
- list.add("&2) the dialog is an appropriate size for the required resolution (1024x768).");
- list.add("&3) the texts are correct and not cut off.");
- list.add("&4) all strings have been externalized properly.");
- list.add("&5) all the widgets are viewable and not cut off.");
- return list;
- }
- /**
- * @see IDialogTestPass#failureTexts()
- * Size of the return array must be the same size as the checkListTexts'
- * ArrayList.
- */
- public String[] failureTexts() {
- String[] failureText = new String[CHECKLIST_SIZE];
- failureText[0] = "The wrong dialog displayed.";
- failureText[1] = "The dialog is too large for the required resolution.";
- failureText[2] = "Text labels are wrong or cut off.";
- failureText[3] = "Some strings have not been externalized properly.";
- failureText[4] = "Some widgets are cut off.";
- return failureText;
- }
- /**
- * @see IDialogTestPass#queryText()
- */
- public String queryText() {
- return "Is the sizing and display of the dialog correct?";
- }
- /**
- * @see IDialogTestPass#getID()
- */
- public int getID() {
- return VerifyDialog.TEST_SIZING;
- }
-}
diff --git a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/VerifyDialog.java b/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/VerifyDialog.java
deleted file mode 100644
index b8c512e..0000000
--- a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/internal/util/VerifyDialog.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.internal.util;
-
-
-import java.util.Iterator;
-
-import org.eclipse.swt.SWT;
-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.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.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-
-
-/*
- * This dialog is intended to verify a dialogs in a testing
- * environment. The tester can test for sizing, initial focus,
- * or accessibility.
- */
-public class VerifyDialog extends TitleAreaDialog {
- private int SIZING_WIDTH = 400;
-
- private static int TEST_TYPE;
- public static final int TEST_SIZING = 0;
- public static final int TEST_FOCUS = 1;
- public static final int TEST_ACCESS = 2;
- private IDialogTestPass _dialogTests[] = new IDialogTestPass[3];
-
-
- private Dialog _testDialog; //the dialog to test
- private Point _testDialogSize;
-
- private Label _queryLabel;
- private Button _yesButton;
- private Button _noButton;
- private Button _checkList[];
- private String _failureText;
-
- /*
- * Create an instance of the verification dialog.
- */
- public VerifyDialog(Shell parent) {
- super(parent);
- if ( !(TEST_TYPE <= 2) && !(TEST_TYPE >= 0) ) {
- TEST_TYPE = TEST_SIZING;
- }
- _failureText = "";
- _dialogTests[0] = new SizingTestPass();
- _dialogTests[1] = new FocusTestPass();
- _dialogTests[2] = new AccessibilityTestPass();
- }
-
- /* (non-Javadoc)
- * Method declared on Window.
- */
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText("Dialog Verification");
- setShellStyle(SWT.NONE);
- }
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void createButtonsForButtonBar(Composite parent) {
- _yesButton = createButton(parent, IDialogConstants.YES_ID, IDialogConstants.YES_LABEL, true);
- _noButton = createButton(parent, IDialogConstants.NO_ID, IDialogConstants.NO_LABEL, false);
- }
- /* (non-Javadoc)
- * Method declared on Dialog.
- */
- protected void buttonPressed(int buttonId) {
- if (IDialogConstants.YES_ID == buttonId) {
- setReturnCode(IDialogConstants.YES_ID);
- if (_testDialog.getShell() != null) {
- _testDialog.close();
- }
- close();
- } else if (IDialogConstants.NO_ID == buttonId) {
- handleFailure();
- }
- }
- /* (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);
- composite.setSize(SIZING_WIDTH, SWT.DEFAULT);
- 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));
-
-
- createTestSelectionGroup(composite);
- createCheckListGroup(composite);
-
-
- _queryLabel = new Label(composite, SWT.NONE);
- _queryLabel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- initializeTest();
- return composite;
- }
- /*
- * Group for selecting type of test.
- */
- private void createTestSelectionGroup(Composite parent) {
- Group group = new Group(parent, SWT.SHADOW_NONE);
- group.setText("Testing:");
- group.setLayout( new GridLayout() );
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- group.setLayoutData(data);
-
- for (int i = 0; i < _dialogTests.length; i++) {
- Button radio = new Button(group, SWT.RADIO);
- radio.setText( _dialogTests[i].label() );
- final int testID = _dialogTests[i].getID();
- radio.addSelectionListener(new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- TEST_TYPE = testID;
- initializeTest();
- _yesButton.setEnabled(true);
- }
- });
- if ( TEST_TYPE == _dialogTests[i].getID() ) {
- radio.setSelection(true);
- }
- }
- }
- /*
- * Initializes the checklist with empty checks.
- */
- private void createCheckListGroup(Composite parent) {
- Group group = new Group(parent, SWT.SHADOW_NONE);
- group.setText("Verify that:");
- group.setLayout( new GridLayout() );
- GridData data = new GridData(GridData.FILL_HORIZONTAL);
- group.setLayoutData(data);
-
- int checkListSize = 0;
- for (int i = 0; i < _dialogTests.length; i++) {
- int size = _dialogTests[i].checkListTexts().size();
- if (size > checkListSize) {
- checkListSize = size;
- }
- }
- _checkList = new Button[checkListSize];
- SelectionAdapter selectionAdapter = new SelectionAdapter() {
- public void widgetSelected(SelectionEvent e) {
- checkYesEnable();
- }
- };
- for (int i = 0; i < checkListSize; i++) {
- _checkList[i] = new Button(group, SWT.CHECK);
- _checkList[i].addSelectionListener(selectionAdapter);
- data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
- data.grabExcessHorizontalSpace = true;
- _checkList[i].setLayoutData(data);
- }
- }
- /*
- * Disables the yes button if any of the items in the checklist
- * are unchecked. Enables the yes button otherwise.
- */
- private void checkYesEnable() {
- boolean enable = true;
- for (int i = 0; i < _checkList.length; i++) {
- if ( !_checkList[i].getSelection() ) {
- enable = false;
- }
- }
- _yesButton.setEnabled(enable);
- }
- /*
- * Initializes the checklist, banner texts, and query label
- */
- private void initializeTest() {
- IDialogTestPass test = _dialogTests[TEST_TYPE];
- setTitle( test.title() );
- setMessage( test.description() );
- Iterator iterator = test.checkListTexts().iterator();
- for (int i = 0; i < _checkList.length; i++) {
- if ( iterator.hasNext() ) {
- _checkList[i].setText( iterator.next().toString() );
- _checkList[i].setVisible(true);
- _checkList[i].update();
- } else {
- _checkList[i].setVisible(false);
- _checkList[i].update();
- }
- _checkList[i].setSelection(true);
- }
- _queryLabel.setText( test.queryText() );
- }
- public String getFailureText() {
- return _failureText;
- }
- /*
- * Can't open the verification dialog without a specified
- * test dialog, this simply returns a failure and prevents
- * opening. Should use open(Dialog) instead.
- *
- */
- public int open() {
- _failureText = "Testing dialog is required, use VerifyDialog::open(Dialog)";
- return IDialogConstants.NO_ID;
- }
- /*
- * Opens the verification dialog to test the specified dialog.
- */
- public int open(Dialog testDialog) {
- if (getShell() == null) {
- create();
- }
- getShell().setLocation(0, 0);
- getShell().setSize(Math.max(SIZING_WIDTH, getShell().getSize().x), getShell().getSize().y);
- _testDialog = testDialog;
- if (_testDialog.getShell() == null) {
- _testDialog.create();
- }
- _testDialogSize = _testDialog.getShell().getSize();
- openNewTestDialog();
-
- return super.open();
- }
- /*
- * Opens the dialog to be verified.
- */
- private void openNewTestDialog() {
- if (_testDialog.getShell() == null) {
- _testDialog.create();
- }
- _testDialog.setBlockOnOpen(false);
- _testDialog.getShell().setLocation(getShell().getSize().x + 1, 0);
- _testDialog.getShell().setSize(_testDialogSize);
- _testDialog.getShell().addShellListener(new ShellAdapter() {
- public void shellClosed(ShellEvent e) {
- e.doit = false;
- }
-
- });
- _testDialog.open();
- }
- /*
- * The test dialog failed, open the failure dialog.
- */
- private void handleFailure() {
- IDialogTestPass test = _dialogTests[TEST_TYPE];
- StringBuffer text = new StringBuffer();
- String label = test.label();
- label = label.substring(0, label.indexOf("&")) +
- label.substring(label.indexOf("&") + 1);
- text.append(label).
- append(" failed on the ").
- append(SWT.getPlatform()).
- append(" platform:\n");
-
- String failureMessages[] = test.failureTexts();
- for (int i = 0; i < test.checkListTexts().size(); i++) {
- if ( !_checkList[i].getSelection() ) {
- text.append("- ").append(failureMessages[i]).append("\n");
- }
- }
- FailureDialog dialog = new FailureDialog( getShell() );
- dialog.create();
- dialog.setText( text.toString() );
- if (dialog.open() == IDialogConstants.OK_ID) {
- _failureText = dialog.toString();
- setReturnCode(IDialogConstants.NO_ID);
- if (_testDialog.getShell() != null) {
- _testDialog.close();
- }
- close();
- }
- }
- /*
- * In case the shell was closed by a means other than
- * the NO button.
- */
- protected void handleShellCloseEvent() {
- handleFailure();
- }
-}
-
-
diff --git a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/ActionUtil.java b/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/ActionUtil.java
deleted file mode 100644
index 93c6413..0000000
--- a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/ActionUtil.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.util;
-import java.lang.reflect.Method;
-
-import junit.framework.TestCase;
-
-import org.eclipse.jface.action.ActionContributionItem;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.action.SubContributionItem;
-
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.internal.WorkbenchWindow;
-
-
-/**
- * <code>ActionUtil</code> contains methods to run actions
- * in the workbench.
- */
-public class ActionUtil {
-
-
- /**
- * Runs an action contribution.
- *
- * @param test the current test case
- * @param item an action contribution item
- */
- public static void runAction(TestCase test,
- IContributionItem item)
- {
- TestCase.assertTrue(item instanceof ActionContributionItem);
- ((ActionContributionItem)item).getAction().run();
- }
-
- /**
- * Runs the first action found in a menu manager with a
- * particular label.
- *
- * @param test the current test case
- * @param mgr the containing menu manager
- * @param label the action label
- */
- public static void runActionWithLabel(TestCase test,
- IMenuManager mgr, String label)
- {
- IContributionItem [] items = mgr.getItems();
- for (int nX = 0; nX < items.length; nX ++) {
- IContributionItem item = items[nX];
- if (item instanceof SubContributionItem)
- item = ((SubContributionItem)item).getInnerItem();
- if (item instanceof ActionContributionItem) {
- IAction action = ((ActionContributionItem)item).getAction();
- if (label.equals(action.getText())) {
- action.run();
- return;
- }
- }
- }
- TestCase.fail("Unable to find action: " + label);
- }
-
-
- /**
- * Runs the first action found in a window with a
- * particular label.
- *
- * @param test the current test case
- * @param win the containing window
- * @param label the action label
- */
- public static void runActionWithLabel(TestCase test,
- IWorkbenchWindow win, String label)
- {
- WorkbenchWindow realWin = (WorkbenchWindow)win;
- IMenuManager mgr = realWin.getMenuManager();
- runActionWithLabel(test, mgr, label);
- }
-
- /**
- * Runs an action identified by an id path in a
- * menu manager.
- *
- * @param test the current test case
- * @param mgr the containing menu manager
- * @param label the action label
- */
- public static void runActionUsingPath(TestCase test,
- IMenuManager mgr, String idPath)
- {
- IContributionItem item = mgr.findUsingPath(idPath);
- TestCase.assertNotNull(item);
- runAction(test, item);
- }
-
- /**
- * Runs an action identified by an id path in a
- * window.
- *
- * @param test the current test case
- * @param win the containing window
- * @param label the action label
- */
- public static void runActionUsingPath(TestCase test,
- IWorkbenchWindow win, String idPath)
- {
- WorkbenchWindow realWin = (WorkbenchWindow)win;
- IMenuManager mgr = realWin.getMenuManager();
- runActionUsingPath(test, mgr, idPath);
- }
-
- /**
- * Returns the first action found in a menu manager with a
- * particular label.
- *
- * @param mgr the containing menu manager
- * @param label the action label
- * @return the first action with the label, or <code>null</code>
- * if it is not found.
- */
- public static IAction getActionWithLabel(IMenuManager mgr,
- String label)
- {
- IContributionItem [] items = mgr.getItems();
- for (int nX = 0; nX < items.length; nX ++) {
- IContributionItem item = items[nX];
- if (item instanceof SubContributionItem)
- item = ((SubContributionItem)item).getInnerItem();
- if (item instanceof ActionContributionItem) {
- IAction action = ((ActionContributionItem)item).getAction();
- if (label.equals(action.getText())) {
- return action;
- }
- }
- }
- return null;
- }
-
- /**
- * Fire the "handleAboutToShow" method in a menu manager.
- * This triggers the same behavior as when a user opens a menu.
- * The menu to be populated with actions and those
- * actions to be enacted in SWT widgets.
- *
- * @param mgr the menu manager to open
- */
- public static void fireAboutToShow(MenuManager mgr)
- throws Throwable
- {
- Class clazz = mgr.getClass();
- Method method = clazz.getDeclaredMethod("handleAboutToShow", new Class [0]);
- method.setAccessible(true);
- method.invoke(mgr, new Object[0]);
- }
-}
-
-
diff --git a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/ArrayUtil.java b/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/ArrayUtil.java
deleted file mode 100644
index 3b9792d..0000000
--- a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/ArrayUtil.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.util;
-import java.util.Random;
-
-
-/**
- * <code>ArrayUtil</code> contains methods for array
- * examination.
- */
-public class ArrayUtil
-{
- private static Random randomBox = new Random();
-
-
- /**
- * Returns a random object chosen from an array.
- *
- * @param array the input array
- * @return a random object in the array
- */
- public static Object pickRandom(Object[] array) {
- int num = randomBox.nextInt(array.length);
- return array[num];
- }
-
-
- /**
- * Returns whether an array is not null and
- * each object in the array is not null.
- *
- * @param array the input array
- * @return <code>true or false</code>
- */
- public static boolean checkNotNull(Object[] array) {
- if (array == null)
- return false;
- else {
- for (int i = 0; i < array.length; i++)
- if (array[i] == null)
- return false;
- return true;
- }
- }
-
-
- /**
- * Returns whether an array contains a given object.
- *
- * @param array the input array
- * @param element the test object
- * @return <code>true</code> if the array contains the object,
- * <code>false</code> otherwise.
- */
- public static boolean contains(Object[] array, Object element) {
- if (array == null || element == null)
- return false;
- else {
- for (int i = 0; i < array.length; i++)
- if( array[ i ] == element )
- return true;
- return false;
- }
- }
-
-
- /**
- * Returns whether two arrays are equal. They must
- * have the same size and the same contents.
- *
- * @param one the first array
- * @param two the second array
- * @return <code>true</code> if the array are equal,
- * <code>false</code> otherwise.
- */
- public static boolean equals(Object[] one, Object[] two) {
- if (one.length != two.length)
- return false;
- else {
- for (int i = 0; i < one.length; i++)
- if (one[i] != two[i])
- return false;
- return true;
- }
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/CallHistory.java b/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/CallHistory.java
deleted file mode 100644
index 4a35470..0000000
--- a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/CallHistory.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.util;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-
-
-/**
- * <code>CallHistory</code> is used to record the invocation
- * of methods within a target object. This is useful during
- * lifecycle testing for an object.
- * <p>
- * To use <code>CallHistory</code> ..
- * <ol>
- * <li>Create a CallHistory in the target or pass one in.</li>
- * <li>Invoke some test scenario. </li>
- * <li>If a method is called on the target record the invocation
- * in the call history</li>
- * <li>Verify the call history after the test scenario is
- * complete.</li>
- * </ol>
- * </p><p>
- * Each <code>CallHistory</code> has a target which is used to
- * verify the method names passed to the history. If an invalid
- * name is passed an <code>IllegalArgumentException</code> will
- * be thrown.
- * </p>
- */
-public class CallHistory {
- private ArrayList methodList;
- private Class classType;
-
-
- /**
- * Creates a new call history for an object.
- *
- * @param target the call history target.
- */
- public CallHistory( Object target )
- {
- methodList = new ArrayList();
- classType = target.getClass();
- }
-
- /**
- * Throws an exception if the method name is invalid
- * for the given target class.
- */
- private void testMethodName(String methodName) {
- Method[] methods = classType.getMethods();
- for( int i = 0; i < methods.length; i ++ )
- if( methods[ i ].getName().equals( methodName ) )
- return;
- throw new IllegalArgumentException("Target class ("
- + classType.getName()
- + ") does not contain method: "
- + methodName);
- }
-
- /**
- * Adds a method name to the call history.
- *
- * @param methodName the name of a method
- */
- public void add(String methodName)
- {
- testMethodName(methodName);
- methodList.add( methodName );
- }
-
- /**
- * Clears the call history.
- */
- public void clear()
- {
- methodList.clear();
- }
-
- /**
- * Returns whether a list of methods have been called in
- * order.
- *
- * @param testNames an array of the method names in the order they are expected
- * @return <code>true</code> if the methods were called in order
- */
- public boolean verifyOrder(String[] testNames ) throws IllegalArgumentException
- {
- int testIndex = 0;
- int testLength = testNames.length;
- if (testLength == 0)
- return true;
- for (int nX = 0; nX < methodList.size(); nX ++) {
- String methodName = (String)methodList.get(nX);
- String testName = testNames[testIndex];
- testMethodName(testName);
- if(testName.equals(methodName))
- ++ testIndex;
- if (testIndex >= testLength)
- return true;
- }
- return false;
- }
-
- /**
- * Returns whether a method has been called.
- *
- * @param methodName a method name
- * @return <code>true</code> if the method was called
- */
- public boolean contains(String methodName )
- {
- testMethodName(methodName);
- return methodList.contains( methodName );
- }
-
- /**
- * Returns whether a list of methods were called.
- *
- * @param methodNames a list of methods
- * @return <code>true</code> if the methods were called
- */
- public boolean contains(String[] methodNames )
- {
- for( int i = 0; i < methodNames.length; i ++ ) {
- testMethodName(methodNames[ i ] );
- if(!methodList.contains( methodNames[ i ] ))
- return false;
- }
- return true;
- }
-
- /**
- * Prints the call history to the console.
- */
- public void printToConsole()
- {
- for( int i = 0; i < methodList.size(); i ++ )
- System.out.println( methodList.get( i ) );
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/DialogCheck.java b/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/DialogCheck.java
deleted file mode 100644
index d2b5cff..0000000
--- a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/DialogCheck.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.util;
-
-
-
-
-import junit.framework.Assert;
-
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-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.TabFolder;
-import org.eclipse.ui.internal.WorkbenchPlugin;
-import org.eclipse.ui.tests.internal.util.VerifyDialog;
-
-
-/**
- * A <code>DialogCheck</code> is used test a dialog in
- * various ways.
- * <p>
- * For interactive tests use <code>assertDialog</code>.
- * For automated tests use <code>assert DialogTexts</code>.
- * </p>
- */
-public class DialogCheck {
- private DialogCheck() {
- }
- private static VerifyDialog _verifyDialog;
-
-
- /**
- * Asserts that a given dialog is not null and that it passes
- * certain visual tests. These tests will be verified manually
- * by the tester using an input dialog. Use this assert method
- * to verify a dialog's sizing, initial focus, or accessiblity.
- * To ensure that both the input dialog and the test dialog are
- * accessible by the tester, the getShell() method should be used
- * when creating the test dialog.
- *
- * Example usage:
- * <code>Dialog dialog = new AboutDialog( DialogCheck.getShell() );
- * DialogCheck.assertDialog(dialog, this);</code>
- *
- * @param dialog the test dialog to be verified.
- * @param assert this is the test case object, assertions will be
- * executed on this object.
- */
- public static void assertDialog(Dialog dialog, Assert assert) {
- Assert.assertNotNull(dialog);
- if (_verifyDialog.getShell() == null) {
- //force the creation of the verify dialog
- getShell();
- }
- if (_verifyDialog.open(dialog) == IDialogConstants.NO_ID) {
- Assert.assertTrue(_verifyDialog.getFailureText(), false);
- }
- }
-
-
- /**
- * Automated test that checks all the labels and buttons of a dialog
- * to make sure there is enough room to display all the text. Any
- * text that wraps is only approximated and is currently not accurate.
- *
- * @param dialog the test dialog to be verified.
- * @param assert this is the test case object, assertions will be
- * executed on this object.
- */
- public static void assertDialogTexts(Dialog dialog, Assert assert) {
- Assert.assertNotNull(dialog);
- dialog.setBlockOnOpen(false);
- dialog.open();
- Shell shell = dialog.getShell();
- verifyCompositeText(shell, assert);
- dialog.close();
- }
-
-
- /**
- * This method should be called when creating dialogs to test. This
- * ensures that the dialog's parent shell will be that of the
- * verification dialog.
- *
- * @return Shell The shell of the verification dialog to be used as
- * the parent shell of the test dialog.
- */
- public static Shell getShell() {
- Shell shell =
- WorkbenchPlugin
- .getDefault()
- .getWorkbench()
- .getActiveWorkbenchWindow()
- .getShell();
- _verifyDialog = new VerifyDialog(shell);
- _verifyDialog.create();
- return _verifyDialog.getShell();
- }
-
-
- /*
- * Looks at all the child widgets of a given composite and
- * verifies the text on all labels and widgets.
- * @param composite The composite to look through
- * @param assert The object to invoke assertions on.
- */
- private static void verifyCompositeText(Composite composite, Assert assert) {
- Control children[] = composite.getChildren();
- for (int i = 0; i < children.length; i++) {
- if (children[i] instanceof TabFolder) {
- TabFolder folder = (TabFolder)children[i];
- int numPages = folder.getItemCount();
- for (int j=0; j<numPages; j++) {
- folder.setSelection(j);
- }
- }
- try {
- //verify the text if the child is a button
- verifyButtonText((Button) children[i], assert);
- } catch (ClassCastException exNotButton) {
- try {
- //child is not a button, maybe a label
- verifyLabelText((Label) children[i], assert);
- } catch (ClassCastException exNotLabel) {
- try {
- //child is not a label, make a recursive call if it is a composite
- verifyCompositeText((Composite) children[i], assert);
- } catch (ClassCastException exNotComposite) {
- //the child is not a button, label, or composite - ignore it.
- }
- }
- }
- }
- }
-
- /*
- * Verifies that a given button is large enough to display its text.
- * @param button The button to verify,
- * @param assert The object to invoke assertions on.
- */
- private static void verifyButtonText(Button button, Assert assert) {
- String widget = button.toString();
- Point size = button.getSize();
-
-
- //compute the size with no line wrapping
- Point preferred = button.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- //if (size.y/preferred.y) == X, then label spans X lines, so divide
- //the calculated value of preferred.x by X
- if (preferred.y * size.y > 0) {
- preferred.y /= countLines(button.getText()); //check for '\n\'
- if (size.y / preferred.y > 1) {
- preferred.x /= (size.y / preferred.y);
- }
- }
-
-
- String message =
- new StringBuffer("Warning: ")
- .append(widget)
- .append("\n\tActual Width -> ")
- .append(size.x)
- .append("\n\tRecommended Width -> ")
- .append(preferred.x)
- .toString();
- if (preferred.x > size.x) {
- //close the dialog
- button.getShell().dispose();
- Assert.assertTrue(message.toString(), false);
- }
- }
-
- /*
- * Verifies that a given label is large enough to display its text.
- * @param label The label to verify,
- * @param assert The object to invoke assertions on.
- */
- private static void verifyLabelText(Label label, Assert assert) {
- String widget = label.toString();
- Point size = label.getSize();
-
-
- //compute the size with no line wrapping
- Point preferred = label.computeSize(SWT.DEFAULT, SWT.DEFAULT);
- //if (size.y/preferred.y) == X, then label spans X lines, so divide
- //the calculated value of preferred.x by X
- if (preferred.y * size.y > 0) {
- preferred.y /= countLines(label.getText());
- if (size.y / preferred.y > 1) {
- preferred.x /= (size.y / preferred.y);
- }
- }
- String message =
- new StringBuffer("Warning: ")
- .append(widget)
- .append("\n\tActual Width -> ")
- .append(size.x)
- .append("\n\tRecommended Width -> ")
- .append(preferred.x)
- .toString();
- if (preferred.x > size.x) {
- //close the dialog
- label.getShell().dispose();
- Assert.assertTrue(message.toString(), false);
- }
- }
-
- /*
- * Counts the number of lines in a given String.
- * For example, if a string contains one (1) newline character,
- * a value of two (2) would be returned.
- * @param text The string to look through.
- * @return int the number of lines in text.
- */
- private static int countLines(String text) {
- int newLines = 1;
- for (int i = 0; i < text.length(); i++) {
- if (text.charAt(i) == '\n') {
- newLines++;
- }
- }
- return newLines;
- }
-}
diff --git a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/EmptyPerspective.java b/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/EmptyPerspective.java
deleted file mode 100644
index 5c151d8..0000000
--- a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/EmptyPerspective.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.util;
-
-
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPerspectiveFactory;
-
-
-/**
- * This perspective is used for testing api. It defines an initial
- * layout with no parts, just an editor area.
- */
-public class EmptyPerspective implements IPerspectiveFactory {
-
- /**
- * The perspective id.
- */
- public static final String PERSP_ID = "org.eclipse.ui.tests.util.EmptyPerspective";
-
- /**
- * Constructs a new Default layout engine.
- */
- public EmptyPerspective() {
- 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) {
- //layout.addView( MockViewPart.ID, IPageLayout.BOTTOM, 0.5f, layout.getEditorArea() );
- }
-}
diff --git a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/FileUtil.java b/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/FileUtil.java
deleted file mode 100644
index d1e6a5f..0000000
--- a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/FileUtil.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.util;
-
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-
-
-/**
- * <code>FileUtil</code> contains methods to create and
- * delete files and projects.
- */
-public class FileUtil {
-
-
- /**
- * Creates a new project.
- *
- * @param name the project name
- */
- public static IProject createProject(String name)
- throws CoreException
- {
- IWorkspace ws = ResourcesPlugin.getWorkspace();
- IWorkspaceRoot root = ws.getRoot();
- IProject proj = root.getProject(name);
- if (!proj.exists())
- proj.create(null);
- if (!proj.isOpen())
- proj.open(null);
- return proj;
- }
-
-
- /**
- * Deletes a project.
- *
- * @param proj the project
- */
- public static void deleteProject(IProject proj)
- throws CoreException
- {
- proj.delete(true, null);
- }
-
- /**
- * Creates a new file in a project.
- *
- * @param name the new file name
- * @param proj the existing project
- * @return the new file
- */
- public static IFile createFile(String name, IProject proj)
- throws CoreException
- {
- IFile file = proj.getFile(name);
- if (!file.exists()) {
- String str = " ";
- InputStream in = new ByteArrayInputStream(str.getBytes());
- file.create(in, true, null);
- }
- return file;
- }
-
-}
-
-
diff --git a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/UITestCase.java b/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/UITestCase.java
deleted file mode 100644
index 0d9eaa0..0000000
--- a/tests/org.eclipse.ui.tests/UI Test Utils/org/eclipse/ui/tests/util/UITestCase.java
+++ /dev/null
@@ -1,125 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
- *******************************************************************************/
-package org.eclipse.ui.tests.util;
-
-
-import java.util.*;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.ui.*;
-
-
-/**
- * <code>UITestCase</code> is a useful super class for most
- * UI tests cases. It contains methods to create new windows
- * and pages. It will also automatically close the test
- * windows when the tearDown method is called.
- */
-public abstract class UITestCase extends TestCase
-{
- protected IWorkbench fWorkbench;
- private List testWindows;
-
-
- public UITestCase(String testName) {
- super(testName);
-// ErrorDialog.NO_UI = true;
- fWorkbench = PlatformUI.getWorkbench();
- testWindows = new ArrayList(3);
- }
-
-
- /**
- * Tear down. May be overridden.
- */
- protected void tearDown() throws Exception {
- closeAllTestWindows();
- }
-
-
- /**
- * Open a test window with the empty perspective.
- */
- public IWorkbenchWindow openTestWindow() {
- try {
- IWorkbenchWindow win =
- fWorkbench.openWorkbenchWindow(
- EmptyPerspective.PERSP_ID,
- ResourcesPlugin.getWorkspace());
- testWindows.add(win);
- return win;
- } catch (WorkbenchException e) {
- fail();
- return null;
- }
- }
-
-
- /**
- * Close all test windows.
- */
- public void closeAllTestWindows() {
- Iterator iter = testWindows.iterator();
- IWorkbenchWindow win;
- while (iter.hasNext()) {
- win = (IWorkbenchWindow) iter.next();
- win.close();
- }
- testWindows.clear();
- }
-
-
- /**
- * Open a test page with the empty perspective in a window.
- */
- public IWorkbenchPage openTestPage(IWorkbenchWindow win)
- {
- IWorkbenchPage[] pages = openTestPage(win, 1);
- if( pages != null )
- return pages[0];
- else
- return null;
- }
-
-
- /**
- * Open "n" test pages with the empty perspectie in a window.
- */
- public IWorkbenchPage[] openTestPage(IWorkbenchWindow win, int pageTotal) {
- try{
- IWorkbenchPage[] pages = new IWorkbenchPage[pageTotal];
- IWorkspace work = ResourcesPlugin.getWorkspace();
-
-
- for (int i = 0; i < pageTotal; i++)
- pages[i] = win.openPage(EmptyPerspective.PERSP_ID, work);
- return pages;
- }
- catch( WorkbenchException e )
- {
- fail();
- return null;
- }
- }
-
-
- /**
- * Close all pages within a window.
- */
- public void closeAllPages(IWorkbenchWindow window) {
- IWorkbenchPage[] pages = window.getPages();
- for (int i = 0; i < pages.length; i++)
- pages[i].close();
- }
-}
\ No newline at end of file
diff --git a/tests/org.eclipse.ui.tests/about.html b/tests/org.eclipse.ui.tests/about.html
deleted file mode 100644
index 9db411a..0000000
--- a/tests/org.eclipse.ui.tests/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/tests/org.eclipse.ui.tests/build.properties b/tests/org.eclipse.ui.tests/build.properties
deleted file mode 100644
index b8558f1..0000000
--- a/tests/org.eclipse.ui.tests/build.properties
+++ /dev/null
@@ -1,23 +0,0 @@
-###############################################################################
-# Copyright (c) 2000, 2003 IBM Corporation 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 API and implementation
-###############################################################################
-source.uitests.jar = Eclipse JFace Tests/,\
- Eclipse UI Tests/,\
- UI Test Utils/
-bin.includes = icons/,\
- doc/,\
- plugin.properties,\
- plugin.xml,\
- *.html,\
- *.jar,\
- .options,\
- *.xml,\
- uiSniff,\
- uiSniff.bat
diff --git a/tests/org.eclipse.ui.tests/doc/Introduction.html b/tests/org.eclipse.ui.tests/doc/Introduction.html
deleted file mode 100644
index 0440e61..0000000
--- a/tests/org.eclipse.ui.tests/doc/Introduction.html
+++ /dev/null
@@ -1,133 +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="Build">
- <meta name="GENERATOR" content="Mozilla/4.5 [en] (WinNT; I) [Netscape]">
- <title>The Workbench Test Framework</title>
-</head>
-<body>
-
-<h2>
-The Workbench Test Suite</h2>
-Dave Springgay
-<br>September 2001
-<h3>
-In Brief</h3>
-This document describes the UI Test Suite. This test suite is available
-from <tt>org.eclipse.ui.tests</tt> in the desktop repository and consist
-of a series of non-interactive sniff tests which are run after a build,
-plus a set of interactive tests which require human feedback. You
-can run any of these from the JUnit Eclipse Plugin Tests launcher or from
-the command line.
-<p>The <tt>org.eclipse.ui.tests</tt> project is organized in hierarchical
-fashion. The root is <tt>UiTestSuite</tt> in <tt>org.eclipse.ui.tests</tt>.
-This test suite contains a collection of "specialized suites" which test
-specific areas of functionality or components in the workbench. Currently
-there is only one suite, <tt>ApiTestSuite
-</tt>in<tt> org.eclipse.ui.tests.api</tt>,
-which contains a number of test cases which deal specifically with workbench
-API. A <tt>uiTest</tt> extension is declared for each suite so that
-you can run every test in the workbench or a subset of the tests.
-<p>To run the UiTestSuite from within Eclipse just select UiTestSuite.java
-in the navigator and invoke Run > JUnit Eclipse Plugin Tests. The
-results of the test suite will appear in the JUnit view.
-<h3>
-Automated Sniff Tests</h3>
-The following process is used to run the workbench UI sniff tests after
-a build.
-<p>To create the sniff test files ..
-<ol>
-<li>
-Export the 4 test projects into a zip file. The options in the export
-wizard should be set to "Compress the contents of the file" and not "Create
-directory Structure".</li>
-</ol>
-To run the sniff tests in a fresh build of Eclipse ..
-<ol>
-<li>
-Unzip the zip file in the Eclipse plugins directory.</li>
-
-<li>
-On Windows copy uiSniff.bat in the org.eclipse.ui.tests plugin directory
-to the Eclipse home directory. On Linux copy uiSniff instead.</li>
-
-<li>
-Run uiSniff.bat ( or uiSniff ). Redirect the results into a file.</li>
-</ol>
-
-<h3>
-Test Patterns</h3>
-In our own testing we have discovered a number of common test patterns.
-In order to encourage a consistent approach for testing they are published
-below.
-<p><b>Simple Setters, Getters and Commands</b>
-<p>Scenario: You want to test setters, commands and getters on an interface.
-<p>Method: Call the setter or command which affects the object state.
-Call the getter to verify that state.
-<p><b>Top Down Coverage</b>
-<p>Scenario: You want to demonstrate thorough coverage of a component.
-<p>Method: Start at the object root of the instance hierarchy and test
-every class downwards to the leaf classes. Stop when you encounter
-a layer which already has JUnit test cases. For instance, in the
-workbench UI don't test JFace, SWT, or core. They should have their
-own test suites and are assumed to work.
-<p><b>Superclass Subclass</b>
-<p>Scenario: You want to test D, which is a subclass of B.
-<p>Method: Implement a test case for B called BTest. Then create
-a subclass of BTest called DTest which tests D. If B is an abstract
-class use a factory method in BTest to create the test object.
-<p><b>Listener Source</b>
-<p>Scenario: You want to test S, a class which fires events when a particular
-situation occurs.
-<p>Method: Implement a listener for S which records the reception of events.
-Then write a test class for S called STest which does something which should
-cause those events to fire. Verify the reception of events afterwards.
-<p><b>Multiple Session</b>
-<p>Scenario: You want to test the persistance of state from one session
-to the next.
-<p>Method: You need to create two test suites. One test suite will
-set up the state. The other will verify the state. Run them
-sequentially in two separate processes.
-<p><b>Global State</b>
-<p>Scenario: In Eclipse the workbench is a global object. Unfortunately,
-this means that one test case may modify that state and affect the outcome
-of another unrelated test case. How can you avoid this problem?
-<p>Method: If the test case modifies the state of a window or something
-in the window you should create a new window as part of the setUp for the
-test case. Run the test code within that window and then close the
-test window in the tearDown method. The modified state will be discarded
-when the window is closed
-<p><b>Lifecycle</b>
-<p>Scenario: Within the workbench there are various interfaces, such as
-IViewPart, which are defined as API and implemented by plugin code.
-There is no need to test the implementation of the interface, but it is
-good to test the lifecycle as implemented by objects which call the interface.
-<p>Method: Define a class X which implements the interface and records
-the invocation of various methods. Create a scenario where this class
-is loaded and should receive events. Afterwards, test that those
-methods were called.
-<p><b>Piercing the Encapsulation</b>
-<p>Scenario: To test the behavior of commands which modify the state of
-the object when there are no public interfaces to query that state.
-<p>Method: If possible, cast the interface to a concrete class with additional
-public methods. For instance, in the workbench the underlying structure
-for IWorkbench is exposed in Workbench. Given a Workbench object,
-you can get the menu, toolbar, etc, and interact directly with the actions
-to verify their state or invoke them directly. This is also a useful
-way to simulate action invocation from the UI.
-<p><b>Mock Objects</b>
-<p>Scenario: To test the implementation of an interface which instantiates
-an extension. For instance, in the test case for IWorkbenchPage we
-need to open views and editors.
-<p>Method: If we reference views and editors which exist within the Workbench
-UI Standard Components project the test case is vulnerable to change in
-those components. In this case we're not testing the components,
-we're testing IWorkbenchPage, so we implemented some light weight mock
-views and editors which do nothing more than record their own creation
-and lifecycle.
-<br>
-<br>
-<br>
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/doc/JUnitPractices.html b/tests/org.eclipse.ui.tests/doc/JUnitPractices.html
deleted file mode 100644
index 16e0b05..0000000
--- a/tests/org.eclipse.ui.tests/doc/JUnitPractices.html
+++ /dev/null
@@ -1,118 +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="Build">
- <meta name="GENERATOR" content="Microsoft FrontPage 4.0">
- <title>The Workbench Test Framework</title>
-</head>
-<body>
-
-<h3>
-Plugin Test Practices</h3>
-In our own testing we have discovered a number of common test patterns.
-In order to encourage a consistent approach for testing they are published
-below.
-<p><b>Setters, Getters and Commands</b>
-<p>Scenario: You want to test setters, getters, and commands in an interface.
-<p>Method: Call the setter or command which affects the object state.
-Call the getter to verify that state. If you can't see this state
-see to "Piercing an Interface".
-<p><b>Subclass Superclass</b>
-<p>Scenario: You want to test D, which is a subclass of B.
-<p>Method: Implement a test case for B called BTest. Then create
-a subclass of BTest called DTest which tests D the additional methods on
-D. Add a factory method to BTest to create any required test objects
-which may be specific to the test case and override it in DTest.
-When this approach is taken you inherit all of the BTest methods within
-the subclass DTest.
-<p><b>Event Notification</b>
-<p>Scenario: You want to test Source, a class which fires events when a
-particular situation occurs.
-<p>Method: Implement a listener for Source which can record the reception
-of events. Then write a test class for Source called SourceTest which does
-something which should cause those events to fire. Verify the reception
-of events afterwards.
-<p>Additional Tips: The CallHistory class in org.eclipse.ui.tests.util can
-be used to record the methods invoked in a target object. If the
-listener can be added then test the removal of the listener also.
-Make sure that events are not received after the listener has been removed.
-<p><b>Avoiding Global State</b>
-<p>Scenario: In Eclipse the workbench is a global object. Unfortunately,
-this means that one test case may modify that state of the workbench and
-affect the outcome of other unrelated test cases. How can you avoid
-this problem?
-<p>Method: If the test case modifies the state of a window or something
-in the window you should create a new window as part of the setUp for the
-test case. Run the test code within that window and then close the
-test window in the tearDown method. The modified state will be discarded
-when the window is closed.
-<p>Additional Tips: The UITestCase class in org.eclipse.ui.tests.util can
-be used as a superclass for your test case. It provides useful methods
-for the creation of new windows, pages, etc, and their disposal.
-<p><b>Piercing the Encapsulation</b>
-<p>Scenario: To test the behavior of commands which modify the state of
-the object when there are no public interfaces to query that state.
-<p>Method: If possible, cast the interface to a concrete class with additional
-public methods. For instance, in the workbench the underlying structure
-for IWorkbench is exposed in Workbench. Given a Workbench object,
-you can get the menu, toolbar, etc, and interact directly with those objects
-to verify their state or invoke them directly.
-<p>Additional Tips: The ActionUtil class in org.eclipse.ui.tests.util can
-be used to invoke actions within a window or menu manager.
-<p><b>Extension Creation</b>
-<p>Scenario: You want to test the creation of an extension. For instance,
-the IWorkbenchPage has a method called openEditor which creates an editor
-extension, and another called showView which creates a view extension.
-How do you test these?
-<p>Method: Obviously we can test these methods by invoking them.
-However, each of them take an editor or view id. Which id's do we
-use? If we reference views and editors which exist within the Workbench
-UI Standard Components project the test case is vulnerable to change in
-those components. But we're not testing those standard components,
-we're actually testing IWorkbenchPage, so it is better to implement some
-light weight mock views and editors which do nothing more than record their
-own creation and lifecycle.
-<p><b>Extension Lifecycle</b>
-<p>Scenario: Within the workbench there are various interfaces, such as
-IViewPart, which are defined as API and implemented by plugin code.
-There is no need to test the implementation of an interface like this if
-you define it and expect others to implement it. However, it is important
-to test the lifecycle of the object as implemented by those objects which
-create and call the interface implementation.
-<p>Method: Define a class X which implements the interface and records
-the invocation of various methods. Create a scenario where this class
-is instantiated and should receive events. Afterwards, test that
-those methods were called.
-<p>Additional Tips: The CallHistory class in org.eclipse.ui.tests.util can
-be used to record the methods invoked in a target object.
-<p><b>Session Persistence</b>
-<p>Scenario: You want to test the persistence of state from one session
-to the next.
-<p>Method: You need to create two test cases. One test case will
-set up the state. The other will verify the state. Run them
-sequentially in two separate processes.
-<p><b>Testing Mixins</b>
-<p>Scenario: Within the workbench there are many classes which implement
-a particular interface. Given the responsability defined by the class
-and the interfaces separately, how do you organize the test cases?
-<p>Method: You may choose to use a one to one rule of thumb. Create
-one test case class for each class or interface in the mixin. This
-hierarchical separation makes it easier to reuse each test case when an
-interface is implemented by more than one class. It also simplifies
-the accounting required to track which test cases have been written.
-<p><b>Where Do I Stop?</b>
-<p>Scenario: The workbench has many layers. If you are a plugin developer
-what are the bounds of the area you should test?
-<p>Method: In general, you should assume that everything you rely upon
-works. If you don't take this approach you will spend endless hours
-testing code written by other people. For instance, in the workbench UI
-we don't test JFace, SWT, or core. They have their own test suites
-and are assumed to work. On the other hand, you should at least write
-tests for every API which you provide to others. In Eclipse we have
-very strong rules for API compatability, and your own test cases allow
-you to change the implementation of API with some confidence.
-<br>
-<br>
-</body>
-</html>
diff --git a/tests/org.eclipse.ui.tests/icons/anything.gif b/tests/org.eclipse.ui.tests/icons/anything.gif
deleted file mode 100644
index efc77a7..0000000
--- a/tests/org.eclipse.ui.tests/icons/anything.gif
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.ui.tests/icons/binary_co.gif b/tests/org.eclipse.ui.tests/icons/binary_co.gif
deleted file mode 100644
index 23a508e..0000000
--- a/tests/org.eclipse.ui.tests/icons/binary_co.gif
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.ui.tests/icons/mockeditorpart1.gif b/tests/org.eclipse.ui.tests/icons/mockeditorpart1.gif
deleted file mode 100644
index efc77a7..0000000
--- a/tests/org.eclipse.ui.tests/icons/mockeditorpart1.gif
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.ui.tests/icons/mockeditorpart2.gif b/tests/org.eclipse.ui.tests/icons/mockeditorpart2.gif
deleted file mode 100644
index efc77a7..0000000
--- a/tests/org.eclipse.ui.tests/icons/mockeditorpart2.gif
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.ui.tests/icons/view.gif b/tests/org.eclipse.ui.tests/icons/view.gif
deleted file mode 100644
index efc77a7..0000000
--- a/tests/org.eclipse.ui.tests/icons/view.gif
+++ /dev/null
Binary files differ
diff --git a/tests/org.eclipse.ui.tests/plugin.xml b/tests/org.eclipse.ui.tests/plugin.xml
deleted file mode 100644
index eb820d1..0000000
--- a/tests/org.eclipse.ui.tests/plugin.xml
+++ /dev/null
@@ -1,796 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<plugin
- id="org.eclipse.ui.tests"
- name="Eclipse UI Tests"
- version="2.1.0"
- provider-name="Eclipse.org"
- class="org.eclipse.ui.tests.TestPlugin">
-
- <runtime>
- <library name="uitests.jar"/>
- </runtime>
- <requires>
- <import plugin="org.eclipse.core.boot"/>
- <import plugin="org.eclipse.core.runtime"/>
- <import plugin="org.eclipse.core.resources"/>
- <import plugin="org.eclipse.swt"/>
- <import plugin="org.eclipse.ui"/>
- <import plugin="org.junit"/>
- </requires>
-
-
-<!-- Utils -->
- <extension
- point="org.eclipse.ui.perspectives">
- <perspective
- name="Empty Perspective"
- class="org.eclipse.ui.tests.util.EmptyPerspective"
- id="org.eclipse.ui.tests.util.EmptyPerspective">
- </perspective>
- </extension>
-<!-- Utils End -->
- <extension
- point="org.eclipse.ui.perspectives">
- <perspective
- name="Session Perspective"
- class="org.eclipse.ui.tests.api.SessionPerspective"
- id="org.eclipse.ui.tests.api.SessionPerspective">
- </perspective>
- </extension>
- <extension
- point="org.eclipse.ui.views">
- <view
- name="Mock View 1"
- icon="icons\view.gif"
- class="org.eclipse.ui.tests.api.MockViewPart"
- id="org.eclipse.ui.tests.api.MockViewPart">
- </view>
- <view
- name="Mock View 2"
- icon="icons\view.gif"
- class="org.eclipse.ui.tests.api.MockViewPart"
- id="org.eclipse.ui.tests.api.MockViewPart2">
- </view>
- <view
- name="Mock View 3"
- icon="icons\view.gif"
- class="org.eclipse.ui.tests.api.MockViewPart"
- id="org.eclipse.ui.tests.api.MockViewPart3">
- </view>
- <view
- name="Session Test View"
- icon="icons\view.gif"
- class="org.eclipse.ui.tests.api.SessionView"
- id="org.eclipse.ui.tests.api.SessionView">
- </view>
- <view
- name="IViewActionDelegateTest View"
- icon="icons\view.gif"
- class="org.eclipse.ui.tests.api.MockViewPart"
- id="org.eclipse.ui.tests.api.IViewActionDelegateTest">
- </view>
- <view
- name="Action Filter Test View 1"
- menuType="static"
- icon="icons\view.gif"
- class="org.eclipse.ui.tests.api.ListView"
- id="org.eclipse.ui.tests.api.IActionFilterTest1">
- </view>
- <view
- name="Action Expression Test View"
- icon="icons\view.gif"
- class="org.eclipse.ui.tests.api.ListView"
- id="org.eclipse.ui.tests.internal.ActionExpressionTest">
- </view>
- <view
- name="Action Filter Test View 2"
- menuType="dynamic"
- icon="icons\view.gif"
- class="org.eclipse.ui.tests.api.ListView"
- id="org.eclipse.ui.tests.api.IActionFilterTest2">
- </view>
- <view
- name="Selection Provider Test View"
- icon="icons\view.gif"
- class="org.eclipse.ui.tests.SelectionProviderView"
- id="org.eclipse.ui.tests.SelectionProviderView">
- </view>
- <view
- name="Selection Provider Test View 2"
- icon="icons\view.gif"
- class="org.eclipse.ui.tests.SelectionProviderView"
- id="org.eclipse.ui.tests.SelectionProviderView2">
- </view>
- <view
- name="Adapted Resource Navigator"
- icon="icons\view.gif"
- class="org.eclipse.ui.tests.adaptable.AdaptedResourceNavigator"
- id="org.eclipse.ui.tests.adaptable.adaptedHierarchy">
- </view>
- </extension>
- <extension
- point="org.eclipse.ui.editors">
- <editor
- name="Mock Editor 1"
- icon="icons\mockeditorpart1.gif"
- extensions="mock1"
- class="org.eclipse.ui.tests.api.MockEditorPart"
- id="org.eclipse.ui.tests.api.MockEditorPart1">
- </editor>
- <editor
- name="Mock Editor 2"
- icon="icons\mockeditorpart2.gif"
- extensions="mock2"
- class="org.eclipse.ui.tests.api.MockEditorPart"
- id="org.eclipse.ui.tests.api.MockEditorPart2">
- </editor>
- <editor
- name="IEditorActionBarContributorTest"
- icon="icons\mockeditorpart2.gif"
- extensions="mock3"
- contributorClass="org.eclipse.ui.tests.api.MockEditorActionBarContributor"
- class="org.eclipse.ui.tests.api.MockEditorPart"
- id="org.eclipse.ui.tests.api.IEditorActionBarContributorTest">
- </editor>
- <editor
- name="IEditorActionDelegateTest"
- icon="icons\mockeditorpart2.gif"
- extensions="mock3"
- contributorClass="org.eclipse.ui.tests.api.MockEditorActionBarContributor"
- class="org.eclipse.ui.tests.api.MockEditorPart"
- id="org.eclipse.ui.tests.api.IEditorActionDelegateTest">
- </editor>
- <editor
- name="IEditorActionBarsTest"
- icon="icons\mockeditorpart2.gif"
- extensions="mock3"
- contributorClass="org.eclipse.ui.tests.api.MockEditorActionBarContributor"
- class="org.eclipse.ui.tests.api.MockEditorPart"
- id="org.eclipse.ui.tests.internal.EditorActionBarsTest">
- </editor>
- <editor
- name="ExtendedTextEditor"
- icon="icons\mockeditorpart2.gif"
- extensions="exttxt"
- contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
- class="org.eclipse.ui.tests.internal.ExtendedTextEditor"
- id="org.eclipse.ui.tests.ExtendedTextEditor">
- </editor>
- </extension>
- <extension
- point="org.eclipse.ui.actionSets">
- <actionSet
- label="Mock Action Set"
- id="org.eclipse.ui.tests.api.MockActionSet">
- <action
- label="Mock Action"
- class="org.eclipse.ui.tests.api.MockWorkbenchWindowActionDelegate"
- menubarPath="additions"
- id="org.eclipse.ui.tests.api.MockWindowAction">
- </action>
- </actionSet>
- </extension>
- <extension
- point="org.eclipse.ui.viewActions">
- <viewContribution
- targetID="org.eclipse.ui.tests.api.IViewActionDelegateTest"
- id="va1">
- <action
- label="Mock Action"
- class="org.eclipse.ui.tests.api.MockViewActionDelegate"
- menubarPath="additions"
- id="a1">
- </action>
- </viewContribution>
- </extension>
- <extension
- point="org.eclipse.ui.editorActions">
- <editorContribution
- targetID="org.eclipse.ui.tests.api.IEditorActionDelegateTest"
- id="ea1">
- <action
- label="Mock Action"
- class="org.eclipse.ui.tests.api.MockEditorActionDelegate"
- menubarPath="additions"
- id="a1">
- </action>
- </editorContribution>
- </extension>
- <extension
- point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc1">
- <filter
- name="name"
- value="red">
- </filter>
- <action
- label="redAction_v1"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc1">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc2">
- <filter
- name="name"
- value="blue">
- </filter>
- <action
- label="blueAction_v1"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc2">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc3">
- <filter
- name="flag"
- value="true">
- </filter>
- <action
- label="trueAction_v1"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc3">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc4">
- <filter
- name="flag"
- value="false">
- </filter>
- <action
- label="falseAction_v1"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc4">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc5">
- <filter
- name="name"
- value="red">
- </filter>
- <filter
- name="flag"
- value="true">
- </filter>
- <action
- label="redTrueAction_v1"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc5">
- </action>
- </objectContribution>
-<!-- Adaptable test-->
- <objectContribution
- objectClass="org.eclipse.core.resources.IResource"
- adaptable="true"
- id="org.eclipse.ui.tests.adaptable.ResourceContributions">
- <action
- label="Resource Action"
- class="org.eclipse.ui.tests.adaptable.ResourceAction"
- menubarPath="org.eclipse.ui.OpenFileAction"
- id="resource action">
- </action>
- </objectContribution>
- </extension>
- <extension
- point="org.eclipse.ui.actionSets">
-<!-- ActionSetExpressionTest -->
- <actionSet
- label="List Element"
- id="org.eclipse.ui.tests.internal.ListElementActions">
- <menu
- label="List Element"
- path="additions"
- id="org.eclipse.ui.tests.internal.ListElementMenu">
- <separator
- name="group1">
- </separator>
- </menu>
- <action
- label="allAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.ListElementMenu/group1"
- enablesFor="1"
- id="org.eclipse.ui.tests.internal.ac1">
- <enablement>
- <objectClass
- name="org.eclipse.ui.tests.api.ListElement">
- </objectClass>
- </enablement>
- </action>
- <action
- label="redAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.ListElementMenu/group1"
- enablesFor="1"
- id="org.eclipse.ui.tests.internal.ac2">
- <enablement>
- <and>
- <objectClass
- name="org.eclipse.ui.tests.api.ListElement">
- </objectClass>
- <objectState
- name="name"
- value="red">
- </objectState>
- </and>
- </enablement>
- </action>
- <action
- label="notRedAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.ListElementMenu/group1"
- enablesFor="1"
- id="org.eclipse.ui.tests.internal.ac3">
- <enablement>
- <and>
- <objectClass
- name="org.eclipse.ui.tests.api.ListElement">
- </objectClass>
- <not>
- <objectState
- name="name"
- value="red">
- </objectState>
- </not>
- </and>
- </enablement>
- </action>
- <action
- label="trueAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.ListElementMenu/group1"
- enablesFor="1"
- id="org.eclipse.ui.tests.internal.ac4">
- <enablement>
- <and>
- <objectClass
- name="org.eclipse.ui.tests.api.ListElement">
- </objectClass>
- <objectState
- name="flag"
- value="true">
- </objectState>
- </and>
- </enablement>
- </action>
- <action
- label="redOrBlueAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.ListElementMenu/group1"
- enablesFor="1"
- id="org.eclipse.ui.tests.internal.ac5">
- <enablement>
- <or>
- <and>
- <objectClass
- name="org.eclipse.ui.tests.api.ListElement">
- </objectClass>
- <objectState
- name="name"
- value="red">
- </objectState>
- </and>
- <and>
- <objectClass
- name="org.eclipse.ui.tests.api.ListElement">
- </objectClass>
- <objectState
- name="name"
- value="blue">
- </objectState>
- </and>
- </or>
- </enablement>
- </action>
- <action
- label="redAndTrueAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.ListElementMenu/group1"
- enablesFor="1"
- id="org.eclipse.ui.tests.internal.ac6">
- <enablement>
- <and>
- <objectClass
- name="org.eclipse.ui.tests.api.ListElement">
- </objectClass>
- <objectState
- name="name"
- value="red">
- </objectState>
- <objectState
- name="flag"
- value="true">
- </objectState>
- </and>
- </enablement>
- </action>
- <action
- label="pluginNotInstalledAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.ListElementMenu/group1"
- id="org.eclipse.ui.tests.internal.ac7">
- <enablement>
- <pluginState
- value="installed"
- id="7777xxf">
- </pluginState>
- </enablement>
- </action>
- <action
- label="pluginInstalledAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.ListElementMenu/group1"
- id="org.eclipse.ui.tests.internal.ac8">
- <enablement>
- <pluginState
- value="installed"
- id="org.eclipse.ui">
- </pluginState>
- </enablement>
- </action>
- <action
- label="pluginNotActivatedAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.ListElementMenu/group1"
- id="org.eclipse.ui.tests.internal.ac9">
- <enablement>
- <pluginState
- value="activated"
- id="org.eclipse.update">
- </pluginState>
- </enablement>
- </action>
- <action
- label="pluginActivatedAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.ListElementMenu/group1"
- id="org.eclipse.ui.tests.internal.ac10">
- <enablement>
- <pluginState
- value="activated"
- id="org.eclipse.ui">
- </pluginState>
- </enablement>
- </action>
- <action
- label="systemPropertyAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.ListElementMenu/group1"
- id="org.eclipse.ui.tests.internal.ac11">
- <enablement>
- <systemProperty
- name="ActionExpressionVar"
- value="bubba">
- </systemProperty>
- </enablement>
- </action>
- </actionSet>
-<!-- TextSelectionActionFilterText -->
- <actionSet
- label="Text Selection Tests"
- id="org.eclipse.ui.tests.internal.TextSelectionActions">
- <menu
- label="Text Selection Tests"
- path="additions"
- id="org.eclipse.ui.tests.internal.TextSelectionMenu">
- <separator
- name="group1">
- </separator>
- </menu>
- <action
- label="anyText"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.TextSelectionMenu/group1"
- enablesFor="1"
- id="org.eclipse.ui.tests.internal.as_1">
- <selection
- class="org.eclipse.jface.text.ITextSelection">
- </selection>
- </action>
- <action
- label="emptyText"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.TextSelectionMenu/group1"
- id="org.eclipse.ui.tests.internal.ac_2">
- <enablement>
- <and>
- <objectClass
- name="org.eclipse.jface.text.ITextSelection">
- </objectClass>
- <objectState
- name="isEmpty"
- value="true">
- </objectState>
- </and>
- </enablement>
- </action>
- <action
- label="helloText"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- menubarPath="org.eclipse.ui.tests.internal.TextSelectionMenu/group1"
- id="org.eclipse.ui.tests.internal.ac_3">
- <enablement>
- <and>
- <objectClass
- name="org.eclipse.jface.text.ITextSelection">
- </objectClass>
- <objectState
- name="text"
- value="Hello">
- </objectState>
- </and>
- </enablement>
- </action>
- </actionSet>
- </extension>
- <extension
- point="org.eclipse.ui.popupMenus">
-<!-- PopupMenuExpressionTest -->
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc1">
- <action
- label="allAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc1">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc2">
- <visibility>
- <objectState
- name="name"
- value="red">
- </objectState>
- </visibility>
- <action
- label="redAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc2">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc3">
- <visibility>
- <not>
- <objectState
- name="name"
- value="red">
- </objectState>
- </not>
- </visibility>
- <action
- label="notRedAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc3">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc4">
- <visibility>
- <objectState
- name="flag"
- value="true">
- </objectState>
- </visibility>
- <action
- label="trueAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc4">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc5">
- <visibility>
- <or>
- <objectState
- name="name"
- value="red">
- </objectState>
- <objectState
- name="name"
- value="blue">
- </objectState>
- </or>
- </visibility>
- <action
- label="redOrBlueAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc4">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc6">
- <visibility>
- <and>
- <objectState
- name="name"
- value="red">
- </objectState>
- <objectState
- name="flag"
- value="true">
- </objectState>
- </and>
- </visibility>
- <action
- label="redAndTrueAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc4">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc7">
- <visibility>
- <pluginState
- value="installed"
- id="7777xxf">
- </pluginState>
- </visibility>
- <action
- label="pluginNotInstalledAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc4">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc8">
- <visibility>
- <pluginState
- value="installed"
- id="org.eclipse.ui">
- </pluginState>
- </visibility>
- <action
- label="pluginInstalledAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc4">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc9">
- <visibility>
- <pluginState
- value="activated"
- id="org.eclipse.update">
- </pluginState>
- </visibility>
- <action
- label="pluginNotActivatedAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc4">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc10">
- <visibility>
- <pluginState
- value="activated"
- id="org.eclipse.ui">
- </pluginState>
- </visibility>
- <action
- label="pluginActivatedAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc4">
- </action>
- </objectContribution>
- <objectContribution
- objectClass="org.eclipse.ui.tests.api.ListElement"
- id="oc11">
- <visibility>
- <systemProperty
- name="ActionExpressionVar"
- value="bubba">
- </systemProperty>
- </visibility>
- <action
- label="systemPropertyAction_v2"
- class="org.eclipse.ui.tests.api.MockActionDelegate"
- id="oc4">
- </action>
- </objectContribution>
- </extension>
-<!-- Decorator tests -->
- <extension
- point="org.eclipse.ui.decorators">
- <decorator
- objectClass="org.eclipse.core.resources.IResource"
- label="Test Decorator"
- description="The test decorator"
- tooltip="No tip"
- state="true"
- class="org.eclipse.ui.tests.navigator.TestDecoratorContributor"
- id="org.eclipse.ui.tests.adaptable.decorator">
- </decorator>
- <decorator
- objectClass="org.eclipse.core.resources.IResource"
- adaptable="true"
- label="Null Decorator"
- description="A null test decorator"
- tooltip="No tip"
- state="true"
- class="org.eclipse.ui.tests.adaptable.NullLabelDecorator"
- id="org.eclipse.ui.tests.adaptable.nulldecorator">
- </decorator>
- <decorator
- lightweight="true"
- adaptable="true"
- label="Lightweight Test Decorator"
- description="A lightweight test decorator"
- tooltip="No tip"
- state="true"
- class="org.eclipse.ui.tests.navigator.TestLightweightDecoratorContributor"
- id="org.eclipse.ui.tests.navigator.lightweightdecorator">
- <enablement>
- <objectClass
- name="org.eclipse.core.resources.IResource">
- </objectClass>
- </enablement>
- </decorator>
- <decorator
- adaptable="true"
- state="true"
- id="org.eclipse.ui.tests.navigator.declareddecorator"
- lightweight="true"
- quadrant="TOP_LEFT"
- icon="icons/binary_co.gif"
- label="Declarative Test Decorator"
- description="A lightweight test decorator"
- tooltip="No tip">
- <enablement>
- <objectClass
- name="org.eclipse.core.resources.IResource">
- </objectClass>
- </enablement>
- </decorator>
- </extension>
-<!-- Working set tests -->
- <extension
- point="org.eclipse.ui.workingSets">
- <workingSet
- name="Mock Working Set"
- pageClass="org.eclipse.ui.tests.api.MockWorkingSetPage"
- icon="icons/anything.gif"
- id="org.eclipse.ui.tests.api.MockWorkingSet">
- </workingSet>
- </extension>
-<!-- Preference tests -->
- <extension
- point="org.eclipse.ui.preferencePages">
- <page
- name="Editors Test"
- class="org.eclipse.ui.tests.dialogs.EnableTestPreferencePage"
- id="org.eclipse.ui.tests.dialogs.EnableTestPreferencePage">
- </page>
- <page
- name="Bad Listeners Test"
- class="org.eclipse.ui.tests.manual.BrokenUpdatePreferencePage"
- id="org.eclipse.ui.tests.manual.BrokenUpdatePreferencePage">
- </page>
- <page
- name="Font Editors"
- class="org.eclipse.ui.tests.dialogs.FontFieldEditorTestPreferencePage"
- id="org.eclipse.ui.tests.dialogs.FontFieldEditorTestPreferencePage">
- </page>
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.ui.tests/test.xml b/tests/org.eclipse.ui.tests/test.xml
deleted file mode 100644
index e85a5f9..0000000
--- a/tests/org.eclipse.ui.tests/test.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0"?>
-
-<project name="testsuite" default="run" basedir=".">
- <!-- The property ${eclipse-home} should be passed into this script -->
- <!-- Set a meaningful default value for when it is not. -->
- <property name="eclipse-home" value="${basedir}\..\.."/>
-
- <!-- sets the properties eclipse-home, and library-file -->
- <property name="plugin-name" value="org.eclipse.ui.tests"/>
- <property name="library-file"
- value="${eclipse-home}/plugins/org.eclipse.test/library.xml"/>
-
- <!-- This target holds all initialization code that needs to be done for -->
- <!-- all tests that are to be run. Initialization for individual tests -->
- <!-- should be done within the body of the suite target. -->
- <target name="init">
- <tstamp/>
- <delete>
- <fileset dir="${eclipse-home}" includes="org*.xml"/>
- </delete>
- </target>
-
- <!-- This target defines the tests that need to be run. -->
- <target name="suite">
- <property name="session-folder"
- value="${eclipse-home}/ui_session_sniff_folder"/>
- <delete dir="${session-folder}" quiet="true"/>
- <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${session-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname"
- value="org.eclipse.ui.tests.api.SessionCreateTest"/>
-
- </ant>
-
- <!-- Commented out until source of problem found (not reusing same workspace dir)
- <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${session-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname"
- value="org.eclipse.ui.tests.api.SessionRestoreTest"/>
- </ant>
- -->
-
- <property name="sniff-folder"
- value="${eclipse-home}/ui_sniff_folder"/>
- <delete dir="${sniff-folder}" quiet="true"/>
- <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${sniff-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname"
- value="org.eclipse.ui.tests.UiTestSuite"/>
-
- </ant>
-
- <property name="jface-sniff-folder"
- value="${eclipse-home}/jface_sniff_folder"/>
- <delete dir="${jface-sniff-folder}" quiet="true"/>
- <ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
- <property name="data-dir" value="${jface-sniff-folder}"/>
- <property name="plugin-name" value="${plugin-name}"/>
- <property name="classname"
- value="org.eclipse.jface.tests.viewers.AllTests"/>
- </ant>
- </target>
-
- <!-- This target holds code to cleanup the testing environment after -->
- <!-- after all of the tests have been run. You can use this target to -->
- <!-- delete temporary files that have been created. -->
- <target name="cleanup">
- </target>
-
- <!-- This target runs the test suite. Any actions that need to happen -->
- <!-- after all the tests have been run should go here. -->
- <target name="run" depends="init,suite,cleanup">
- <ant target="collect" antfile="${library-file}" dir="${eclipse-home}">
- <property name="includes" value="org*.xml"/>
- <property name="output-file" value="${plugin-name}.xml"/>
- </ant>
- </target>
-
-</project>
diff --git a/tests/org.eclipse.ui.tests/uiSniff b/tests/org.eclipse.ui.tests/uiSniff
deleted file mode 100644
index e2d47e4..0000000
--- a/tests/org.eclipse.ui.tests/uiSniff
+++ /dev/null
@@ -1,10 +0,0 @@
-echo Running ui.TestSuite
-rm -rf 'ui_sniff_folder'
-./jre/bin/java -cp startup.jar org.eclipse.core.launcher.UIMain -application org.eclipse.ui.junit.runner -dev bin -data %LOCATION% -testPluginName org.eclipse.ui.tests -className org.eclipse.ui.tests.UiTestSuite -console
-
-echo Running ui.api.SessionCreateTest
-rm -rf ui_session_sniff_folder
-./jre/bin/java -cp startup.jar org.eclipse.core.launcher.UIMain -application org.eclipse.ui.junit.runner -dev bin -data %LOCATION% -testPluginName org.eclipse.ui.tests -className org.eclipse.ui.tests.api.SessionCreateTest -console
-
-echo Running ui.api.SessionRestoreTest
-./jre/bin/java -cp startup.jar org.eclipse.core.launcher.UIMain -application org.eclipse.ui.junit.runner -dev bin -data %LOCATION% -testPluginName org.eclipse.ui.tests -className org.eclipse.ui.tests.api.SessionRestoreTest -console
diff --git a/tests/org.eclipse.ui.tests/uiSniff.bat b/tests/org.eclipse.ui.tests/uiSniff.bat
deleted file mode 100644
index 84fbc08..0000000
--- a/tests/org.eclipse.ui.tests/uiSniff.bat
+++ /dev/null
@@ -1,17 +0,0 @@
-@echo off
-rem This is the UI Sniff test batch file.
-
-set CLASSPATH=startup.jar
-
-set LOCATION=ui_sniff_folder
-del /Q /S %LOCATION%
-echo Running UiTestSuite
-.\jre\bin\java -cp %CLASSPATH% org.eclipse.core.launcher.UIMain -application org.eclipse.ui.junit.runner -dev bin -data %LOCATION% -testPluginName org.eclipse.ui.tests -className org.eclipse.ui.tests.UiTestSuite -console
-
-set LOCATION=ui_session_sniff_folder
-del /Q /S %LOCATION%
-echo Running SessionCreateTest
-.\jre\bin\java -cp %CLASSPATH% org.eclipse.core.launcher.UIMain -application org.eclipse.ui.junit.runner -dev bin -data %LOCATION% -testPluginName org.eclipse.ui.tests -className org.eclipse.ui.tests.api.SessionCreateTest -console
-echo Running SessionRestoreTest
-.\jre\bin\java -cp %CLASSPATH% org.eclipse.core.launcher.UIMain -application org.eclipse.ui.junit.runner -dev bin -data %LOCATION% -testPluginName org.eclipse.ui.tests -className org.eclipse.ui.tests.api.SessionRestoreTest -console
-